@mypixia/simplex-designer 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,8 +1,8 @@
1
- import qo, { useState as E, useRef as dt, useEffect as ct, useMemo as wi, forwardRef as Xo, useCallback as Nt, useReducer as Qo, useImperativeHandle as Zo } from "react";
1
+ import qo, { useState as E, useRef as dt, useEffect as st, useMemo as vi, forwardRef as Xo, useCallback as zt, useReducer as Qo, useImperativeHandle as Zo } from "react";
2
2
  import Ko from "qrcode";
3
3
  import Jo from "react-barcode";
4
- import ki from "axios";
5
- import './index_external.css';var Be = { exports: {} }, we = {};
4
+ import wi from "axios";
5
+ import './index_external.css';var Oe = { exports: {} }, we = {};
6
6
  /**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.js
@@ -50,7 +50,7 @@ function ea() {
50
50
  function r(g) {
51
51
  if (g == null) return null;
52
52
  if (typeof g == "function")
53
- return g.$$typeof === zt ? null : g.displayName || g.name || null;
53
+ return g.$$typeof === Tt ? null : g.displayName || g.name || null;
54
54
  if (typeof g == "string") return g;
55
55
  switch (g) {
56
56
  case H:
@@ -81,7 +81,7 @@ function ea() {
81
81
  return g = g.displayName, g || (g = M.displayName || M.name || "", g = g !== "" ? "ForwardRef(" + g + ")" : "ForwardRef"), g;
82
82
  case J:
83
83
  return M = g.displayName || null, M !== null ? M : r(g.type) || "Memo";
84
- case bt:
84
+ case St:
85
85
  M = g._payload, g = g._init;
86
86
  try {
87
87
  return r(g(M));
@@ -102,8 +102,8 @@ function ea() {
102
102
  }
103
103
  if (M) {
104
104
  M = console;
105
- var U = M.error, ot = typeof Symbol == "function" && Symbol.toStringTag && g[Symbol.toStringTag] || g.constructor.name || "Object";
106
- return U.call(
105
+ var _ = M.error, ot = typeof Symbol == "function" && Symbol.toStringTag && g[Symbol.toStringTag] || g.constructor.name || "Object";
106
+ return _.call(
107
107
  M,
108
108
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
109
109
  ot
@@ -112,7 +112,7 @@ function ea() {
112
112
  }
113
113
  function s(g) {
114
114
  if (g === H) return "<>";
115
- if (typeof g == "object" && g !== null && g.$$typeof === bt)
115
+ if (typeof g == "object" && g !== null && g.$$typeof === St)
116
116
  return "<...>";
117
117
  try {
118
118
  var M = r(g);
@@ -122,7 +122,7 @@ function ea() {
122
122
  }
123
123
  }
124
124
  function l() {
125
- var g = _.A;
125
+ var g = V.A;
126
126
  return g === null ? null : g.getOwner();
127
127
  }
128
128
  function h() {
@@ -136,14 +136,14 @@ function ea() {
136
136
  return g.key !== void 0;
137
137
  }
138
138
  function w(g, M) {
139
- function U() {
139
+ function _() {
140
140
  rt || (rt = !0, console.error(
141
141
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
142
142
  M
143
143
  ));
144
144
  }
145
- U.isReactWarning = !0, Object.defineProperty(g, "key", {
146
- get: U,
145
+ _.isReactWarning = !0, Object.defineProperty(g, "key", {
146
+ get: _,
147
147
  configurable: !0
148
148
  });
149
149
  }
@@ -153,14 +153,14 @@ function ea() {
153
153
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
154
154
  )), g = this.props.ref, g !== void 0 ? g : null;
155
155
  }
156
- function A(g, M, U, ot, St, ft, Rt, Ct) {
157
- return U = ft.ref, g = {
156
+ function A(g, M, _, ot, vt, ft, Rt, Ft) {
157
+ return _ = ft.ref, g = {
158
158
  $$typeof: B,
159
159
  type: g,
160
160
  key: M,
161
161
  props: ft,
162
- _owner: St
163
- }, (U !== void 0 ? U : null) !== null ? Object.defineProperty(g, "ref", {
162
+ _owner: vt
163
+ }, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(g, "ref", {
164
164
  enumerable: !1,
165
165
  get: k
166
166
  }) : Object.defineProperty(g, "ref", { enumerable: !1, value: null }), g._store = {}, Object.defineProperty(g._store, "validated", {
@@ -182,10 +182,10 @@ function ea() {
182
182
  configurable: !1,
183
183
  enumerable: !1,
184
184
  writable: !0,
185
- value: Ct
185
+ value: Ft
186
186
  }), Object.freeze && (Object.freeze(g.props), Object.freeze(g)), g;
187
187
  }
188
- function F(g, M, U, ot, St, ft, Rt, Ct) {
188
+ function F(g, M, _, ot, vt, ft, Rt, Ft) {
189
189
  var xt = M.children;
190
190
  if (xt !== void 0)
191
191
  if (ot)
@@ -200,10 +200,10 @@ function ea() {
200
200
  else T(xt);
201
201
  if (O.call(M, "key")) {
202
202
  xt = r(g);
203
- var Ft = Object.keys(M).filter(function(ee) {
204
- return ee !== "key";
203
+ var Nt = Object.keys(M).filter(function(oe) {
204
+ return oe !== "key";
205
205
  });
206
- ot = 0 < Ft.length ? "{key: someKey, " + Ft.join(": ..., ") + ": ...}" : "{key: someKey}", P[xt + ot] || (Ft = 0 < Ft.length ? "{" + Ft.join(": ..., ") + ": ...}" : "{}", console.error(
206
+ ot = 0 < Nt.length ? "{key: someKey, " + Nt.join(": ..., ") + ": ...}" : "{key: someKey}", P[xt + ot] || (Nt = 0 < Nt.length ? "{" + Nt.join(": ..., ") + ": ...}" : "{}", console.error(
207
207
  `A props object containing a "key" prop is being spread into JSX:
208
208
  let props = %s;
209
209
  <%s {...props} />
@@ -212,33 +212,33 @@ React keys must be passed directly to JSX without using spread:
212
212
  <%s key={someKey} {...props} />`,
213
213
  ot,
214
214
  xt,
215
- Ft,
215
+ Nt,
216
216
  xt
217
217
  ), P[xt + ot] = !0);
218
218
  }
219
- if (xt = null, U !== void 0 && (n(U), xt = "" + U), f(M) && (n(M.key), xt = "" + M.key), "key" in M) {
220
- U = {};
221
- for (var Gt in M)
222
- Gt !== "key" && (U[Gt] = M[Gt]);
223
- } else U = M;
219
+ if (xt = null, _ !== void 0 && (n(_), xt = "" + _), f(M) && (n(M.key), xt = "" + M.key), "key" in M) {
220
+ _ = {};
221
+ for (var $t in M)
222
+ $t !== "key" && (_[$t] = M[$t]);
223
+ } else _ = M;
224
224
  return xt && w(
225
- U,
225
+ _,
226
226
  typeof g == "function" ? g.displayName || g.name || "Unknown" : g
227
227
  ), A(
228
228
  g,
229
229
  xt,
230
230
  ft,
231
- St,
231
+ vt,
232
232
  l(),
233
- U,
233
+ _,
234
234
  Rt,
235
- Ct
235
+ Ft
236
236
  );
237
237
  }
238
238
  function T(g) {
239
239
  typeof g == "object" && g !== null && g.$$typeof === B && g._store && (g._store.validated = 1);
240
240
  }
241
- var S = qo, B = Symbol.for("react.transitional.element"), I = Symbol.for("react.portal"), H = Symbol.for("react.fragment"), Q = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), b = Symbol.for("react.context"), L = Symbol.for("react.forward_ref"), j = Symbol.for("react.suspense"), it = Symbol.for("react.suspense_list"), J = Symbol.for("react.memo"), bt = Symbol.for("react.lazy"), pt = Symbol.for("react.activity"), zt = Symbol.for("react.client.reference"), _ = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, O = Object.prototype.hasOwnProperty, R = Array.isArray, st = console.createTask ? console.createTask : function() {
241
+ var S = qo, B = Symbol.for("react.transitional.element"), I = Symbol.for("react.portal"), H = Symbol.for("react.fragment"), Q = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), b = Symbol.for("react.context"), L = Symbol.for("react.forward_ref"), j = Symbol.for("react.suspense"), it = Symbol.for("react.suspense_list"), J = Symbol.for("react.memo"), St = Symbol.for("react.lazy"), pt = Symbol.for("react.activity"), Tt = Symbol.for("react.client.reference"), V = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, O = Object.prototype.hasOwnProperty, R = Array.isArray, lt = console.createTask ? console.createTask : function() {
242
242
  return null;
243
243
  };
244
244
  S = {
@@ -249,37 +249,37 @@ React keys must be passed directly to JSX without using spread:
249
249
  var rt, yt = {}, v = S["react-stack-bottom-frame"].bind(
250
250
  S,
251
251
  h
252
- )(), q = st(s(h)), P = {};
253
- ke.Fragment = H, ke.jsx = function(g, M, U, ot, St) {
254
- var ft = 1e4 > _.recentlyCreatedOwnerStacks++;
252
+ )(), X = lt(s(h)), P = {};
253
+ ke.Fragment = H, ke.jsx = function(g, M, _, ot, vt) {
254
+ var ft = 1e4 > V.recentlyCreatedOwnerStacks++;
255
255
  return F(
256
256
  g,
257
257
  M,
258
- U,
258
+ _,
259
259
  !1,
260
260
  ot,
261
- St,
261
+ vt,
262
262
  ft ? Error("react-stack-top-frame") : v,
263
- ft ? st(s(g)) : q
263
+ ft ? lt(s(g)) : X
264
264
  );
265
- }, ke.jsxs = function(g, M, U, ot, St) {
266
- var ft = 1e4 > _.recentlyCreatedOwnerStacks++;
265
+ }, ke.jsxs = function(g, M, _, ot, vt) {
266
+ var ft = 1e4 > V.recentlyCreatedOwnerStacks++;
267
267
  return F(
268
268
  g,
269
269
  M,
270
- U,
270
+ _,
271
271
  !0,
272
272
  ot,
273
- St,
273
+ vt,
274
274
  ft ? Error("react-stack-top-frame") : v,
275
- ft ? st(s(g)) : q
275
+ ft ? lt(s(g)) : X
276
276
  );
277
277
  };
278
278
  }()), ke;
279
279
  }
280
280
  var Ji;
281
281
  function ia() {
282
- return Ji || (Ji = 1, process.env.NODE_ENV === "production" ? Be.exports = ta() : Be.exports = ea()), Be.exports;
282
+ return Ji || (Ji = 1, process.env.NODE_ENV === "production" ? Oe.exports = ta() : Oe.exports = ea()), Oe.exports;
283
283
  }
284
284
  var e = ia();
285
285
  const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
@@ -2424,7 +2424,7 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2424
2424
  { id: 264, text: "Magnifique", category: "Calligraphy", fontSize: 40, fontFamily: "Allura", fill: "#4338ca", textAlign: "center" },
2425
2425
  { id: 265, text: "Bloom", category: "Calligraphy", fontSize: 52, fontFamily: "Parisienne", fill: "#db2777", textAlign: "center" },
2426
2426
  { id: 266, text: "Bella Vita", category: "Calligraphy", fontSize: 42, fontFamily: "Satisfy", fill: "#0d9488", textAlign: "center" }
2427
- ], zi = [
2427
+ ], Ni = [
2428
2428
  "Arial",
2429
2429
  "Helvetica",
2430
2430
  "Times New Roman",
@@ -2435,10 +2435,10 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2435
2435
  "Trebuchet MS",
2436
2436
  "Impact",
2437
2437
  "Comic Sans MS"
2438
- ], oa = new Set(zi), ji = [
2438
+ ], oa = new Set(Ni), ki = [
2439
2439
  {
2440
2440
  name: "System",
2441
- fonts: zi
2441
+ fonts: Ni
2442
2442
  },
2443
2443
  {
2444
2444
  name: "Signage & Display",
@@ -2539,7 +2539,7 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2539
2539
  name: "Monospace",
2540
2540
  fonts: ["Roboto Mono", "Source Code Pro", "JetBrains Mono", "Space Mono", "IBM Plex Mono"]
2541
2541
  }
2542
- ], no = ji.reduce((r, o) => r.concat(o.fonts), []), aa = (r) => oa.has(r), ra = "https://fonts.googleapis.com/css2", to = new Set(zi), na = (r) => `family=${r.trim().replace(/\s+/g, "+")}:wght@400;700`, $e = (r) => {
2542
+ ], no = ki.reduce((r, o) => r.concat(o.fonts), []), aa = (r) => oa.has(r), ra = "https://fonts.googleapis.com/css2", to = new Set(Ni), na = (r) => `family=${r.trim().replace(/\s+/g, "+")}:wght@400;700`, Ge = (r) => {
2543
2543
  if (typeof document > "u") return;
2544
2544
  const o = (r || []).filter(
2545
2545
  (s) => s && !to.has(s)
@@ -2551,7 +2551,7 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2551
2551
  h.rel = "stylesheet", h.href = `${ra}?${l.map(na).join("&")}&display=swap`, h.setAttribute("data-simplex-font", "1"), document.head.appendChild(h), l.forEach((f) => to.add(f));
2552
2552
  }
2553
2553
  }, so = async (r) => {
2554
- if (!(!r || aa(r)) && ($e([r]), !(typeof document > "u" || !document.fonts || !document.fonts.load)))
2554
+ if (!(!r || aa(r)) && (Ge([r]), !(typeof document > "u" || !document.fonts || !document.fonts.load)))
2555
2555
  try {
2556
2556
  await Promise.all([
2557
2557
  document.fonts.load(`400 24px "${r}"`),
@@ -2559,10 +2559,10 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2559
2559
  ]);
2560
2560
  } catch {
2561
2561
  }
2562
- }, Ti = async (r) => {
2562
+ }, zi = async (r) => {
2563
2563
  const o = Array.from(new Set((r || []).filter(Boolean)));
2564
2564
  await Promise.all(o.map(so));
2565
- }, Ci = {
2565
+ }, ji = {
2566
2566
  business: {
2567
2567
  name: "Business & Office",
2568
2568
  icons: [
@@ -2653,7 +2653,7 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2653
2653
  { name: "shield", symbol: "🛡️", unicode: "🛡️" }
2654
2654
  ]
2655
2655
  }
2656
- }, lo = () => Object.values(Ci).flatMap(
2656
+ }, lo = () => Object.values(ji).flatMap(
2657
2657
  (r) => r.icons.map((o) => ({
2658
2658
  ...o,
2659
2659
  category: r.name
@@ -2662,7 +2662,7 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2662
2662
  (n) => n.name.toLowerCase().includes(r.toLowerCase()) || n.category.toLowerCase().includes(r.toLowerCase())
2663
2663
  ), la = ({ onSelectIcon: r, disabled: o = !1 }) => {
2664
2664
  const [n, s] = E(!1), [l, h] = E(""), [f, w] = E("all"), k = dt(null);
2665
- ct(() => {
2665
+ st(() => {
2666
2666
  const S = (B) => {
2667
2667
  k.current && !k.current.contains(B.target) && s(!1);
2668
2668
  };
@@ -2673,7 +2673,7 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2673
2673
  }, T = (() => {
2674
2674
  let S = lo();
2675
2675
  if (l.trim() && (S = sa(l)), f !== "all") {
2676
- const B = Ci[f];
2676
+ const B = ji[f];
2677
2677
  B && (S = S.filter((I) => I.category === B.name));
2678
2678
  }
2679
2679
  return S;
@@ -2713,7 +2713,7 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2713
2713
  className: "category-select",
2714
2714
  children: [
2715
2715
  /* @__PURE__ */ e.jsx("option", { value: "all", children: "All Categories" }),
2716
- Object.entries(Ci).map(([S, B]) => /* @__PURE__ */ e.jsx("option", { value: S, children: B.name }, S))
2716
+ Object.entries(ji).map(([S, B]) => /* @__PURE__ */ e.jsx("option", { value: S, children: B.name }, S))
2717
2717
  ]
2718
2718
  }
2719
2719
  )
@@ -2876,7 +2876,7 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2876
2876
  { value: "MSI", label: "MSI (Retail)" },
2877
2877
  { value: "pharmacode", label: "Pharmacode (Pharmaceutical)" },
2878
2878
  { value: "codabar", label: "Codabar (Libraries/Blood banks)" }
2879
- ], bt = () => {
2879
+ ], St = () => {
2880
2880
  if (l.trim())
2881
2881
  try {
2882
2882
  A(/* @__PURE__ */ e.jsx(
@@ -2898,7 +2898,7 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2898
2898
  console.error("Barcode generation error:", O), alert("Invalid data for selected barcode format. Please check your input.");
2899
2899
  }
2900
2900
  }, pt = () => {
2901
- var O, R, st, rt;
2901
+ var O, R, lt, rt;
2902
2902
  if (!(!k || !it.current))
2903
2903
  try {
2904
2904
  const yt = it.current.querySelector("svg");
@@ -2906,13 +2906,13 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2906
2906
  console.error("No SVG element found in barcode");
2907
2907
  return;
2908
2908
  }
2909
- const v = document.createElement("canvas"), q = v.getContext("2d"), P = yt.getBoundingClientRect(), g = ((R = (O = yt.width) == null ? void 0 : O.baseVal) == null ? void 0 : R.value) || P.width || 200, M = ((rt = (st = yt.height) == null ? void 0 : st.baseVal) == null ? void 0 : rt.value) || P.height || 100;
2909
+ const v = document.createElement("canvas"), X = v.getContext("2d"), P = yt.getBoundingClientRect(), g = ((R = (O = yt.width) == null ? void 0 : O.baseVal) == null ? void 0 : R.value) || P.width || 200, M = ((rt = (lt = yt.height) == null ? void 0 : lt.baseVal) == null ? void 0 : rt.value) || P.height || 100;
2910
2910
  v.width = g, v.height = M;
2911
- const U = new XMLSerializer().serializeToString(yt), ot = new Blob([U], { type: "image/svg+xml;charset=utf-8" }), St = URL.createObjectURL(ot), ft = new Image();
2911
+ const _ = new XMLSerializer().serializeToString(yt), ot = new Blob([_], { type: "image/svg+xml;charset=utf-8" }), vt = URL.createObjectURL(ot), ft = new Image();
2912
2912
  ft.onload = () => {
2913
- q.drawImage(ft, 0, 0);
2914
- const Rt = v.toDataURL("image/png"), Ct = new Image();
2915
- Ct.onload = () => {
2913
+ X.drawImage(ft, 0, 0);
2914
+ const Rt = v.toDataURL("image/png"), Ft = new Image();
2915
+ Ft.onload = () => {
2916
2916
  n({
2917
2917
  type: "barcode",
2918
2918
  src: Rt,
@@ -2922,16 +2922,16 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2922
2922
  height: M,
2923
2923
  x: 100,
2924
2924
  y: 100,
2925
- imageObject: Ct
2926
- }), zt();
2927
- }, Ct.src = Rt, URL.revokeObjectURL(St);
2928
- }, ft.src = St;
2925
+ imageObject: Ft
2926
+ }), Tt();
2927
+ }, Ft.src = Rt, URL.revokeObjectURL(vt);
2928
+ }, ft.src = vt;
2929
2929
  } catch (yt) {
2930
2930
  console.error("Error adding barcode to canvas:", yt), alert("Failed to add barcode to canvas. Please try again.");
2931
2931
  }
2932
- }, zt = () => {
2932
+ }, Tt = () => {
2933
2933
  h(""), A(null), w("CODE128"), T(2), B(100), H(20), o();
2934
- }, _ = (O) => ({
2934
+ }, V = (O) => ({
2935
2935
  CODE128: "Supports all ASCII characters. Most versatile format.",
2936
2936
  EAN13: "Requires exactly 12 digits (13th is checksum). Used for retail products.",
2937
2937
  EAN8: "Requires exactly 7 digits (8th is checksum). Compact version of EAN-13.",
@@ -2942,14 +2942,14 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2942
2942
  pharmacode: "Numbers 3-131070. Used in pharmaceutical industry.",
2943
2943
  codabar: "Supports 0-9, A-D, and symbols. Used in libraries."
2944
2944
  })[O] || "";
2945
- return r ? /* @__PURE__ */ e.jsx("div", { className: "barcode-modal-overlay", onClick: zt, children: /* @__PURE__ */ e.jsxs("div", { className: "barcode-modal-content", onClick: (O) => O.stopPropagation(), children: [
2945
+ return r ? /* @__PURE__ */ e.jsx("div", { className: "barcode-modal-overlay", onClick: Tt, children: /* @__PURE__ */ e.jsxs("div", { className: "barcode-modal-content", onClick: (O) => O.stopPropagation(), children: [
2946
2946
  /* @__PURE__ */ e.jsxs("div", { className: "barcode-modal-header", children: [
2947
2947
  /* @__PURE__ */ e.jsx("h3", { children: "Generate Barcode" }),
2948
2948
  /* @__PURE__ */ e.jsx(
2949
2949
  "button",
2950
2950
  {
2951
2951
  className: "barcode-modal-close",
2952
- onClick: zt,
2952
+ onClick: Tt,
2953
2953
  "aria-label": "Close",
2954
2954
  children: "×"
2955
2955
  }
@@ -2980,7 +2980,7 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
2980
2980
  children: J.map((O) => /* @__PURE__ */ e.jsx("option", { value: O.value, children: O.label }, O.value))
2981
2981
  }
2982
2982
  ),
2983
- /* @__PURE__ */ e.jsx("small", { className: "format-description", children: _(f) })
2983
+ /* @__PURE__ */ e.jsx("small", { className: "format-description", children: V(f) })
2984
2984
  ] }),
2985
2985
  /* @__PURE__ */ e.jsxs("div", { className: "barcode-options", children: [
2986
2986
  /* @__PURE__ */ e.jsxs("div", { className: "barcode-form-group", children: [
@@ -3058,7 +3058,7 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
3058
3058
  "button",
3059
3059
  {
3060
3060
  className: "barcode-btn barcode-btn-generate",
3061
- onClick: bt,
3061
+ onClick: St,
3062
3062
  disabled: !l.trim(),
3063
3063
  children: "Generate Barcode"
3064
3064
  }
@@ -3147,75 +3147,75 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
3147
3147
  ] }), fa = ({ isOpen: r, onClose: o, onAddSticker: n, theme: s, apiKey: l, apiEndpoint: h }) => {
3148
3148
  const [f, w] = E([]), [k, A] = E(!1), [F, T] = E(null), [S, B] = E(""), [I, H] = E(""), [Q, N] = E({});
3149
3149
  dt(null);
3150
- const [z, b] = E(!1), [L, j] = E(!1), [it, J] = E(!1), bt = `${h}/api/v1/designer`;
3151
- ct(() => {
3150
+ const [z, b] = E(!1), [L, j] = E(!1), [it, J] = E(!1), St = `${h}/api/v1/designer`;
3151
+ st(() => {
3152
3152
  r && l && pt();
3153
3153
  }, [r, l]);
3154
3154
  const pt = async () => {
3155
3155
  const v = sessionStorage.getItem("apc_x_sub_status");
3156
- v === "active" ? (b(!0), j(!0), _()) : v === "inactive" ? (b(!1), j(!0)) : (J(!0), await zt());
3157
- }, zt = async () => {
3156
+ v === "active" ? (b(!0), j(!0), V()) : v === "inactive" ? (b(!1), j(!0)) : (J(!0), await Tt());
3157
+ }, Tt = async () => {
3158
3158
  if (!l) {
3159
3159
  b(!1), j(!0), J(!1);
3160
3160
  return;
3161
3161
  }
3162
- const v = `${bt}/get-subscription-status/${l}`;
3162
+ const v = `${St}/get-subscription-status/${l}`;
3163
3163
  try {
3164
- (await ki.get(v)).data.object === "active" ? (sessionStorage.setItem("apc_x_sub_status", "active"), b(!0), _()) : (sessionStorage.setItem("apc_x_sub_status", "inactive"), b(!1));
3165
- } catch (q) {
3166
- console.error("Subscription check failed:", q), sessionStorage.setItem("apc_x_sub_status", "inactive"), b(!1);
3164
+ (await wi.get(v)).data.object === "active" ? (sessionStorage.setItem("apc_x_sub_status", "active"), b(!0), V()) : (sessionStorage.setItem("apc_x_sub_status", "inactive"), b(!1));
3165
+ } catch (X) {
3166
+ console.error("Subscription check failed:", X), sessionStorage.setItem("apc_x_sub_status", "inactive"), b(!1);
3167
3167
  } finally {
3168
3168
  J(!1), j(!0);
3169
3169
  }
3170
- }, _ = async () => {
3170
+ }, V = async () => {
3171
3171
  const v = sessionStorage.getItem("apc_stickers");
3172
3172
  if (v)
3173
3173
  try {
3174
- const q = JSON.parse(v);
3175
- w(q);
3174
+ const X = JSON.parse(v);
3175
+ w(X);
3176
3176
  return;
3177
3177
  } catch {
3178
3178
  console.warn("Failed to parse cached stickers, fetching fresh data");
3179
3179
  }
3180
3180
  A(!0), T(null);
3181
3181
  try {
3182
- const q = await ki.get(`${bt}/get-stickers`);
3183
- if (q.data && q.data.object && q.data.object.contents) {
3184
- const P = q.data.object.contents;
3182
+ const X = await wi.get(`${St}/get-stickers`);
3183
+ if (X.data && X.data.object && X.data.object.contents) {
3184
+ const P = X.data.object.contents;
3185
3185
  w(P), sessionStorage.setItem("apc_stickers", JSON.stringify(P));
3186
3186
  } else
3187
3187
  throw new Error("Invalid response format");
3188
- } catch (q) {
3189
- console.error("Error fetching stickers:", q), T("Failed to load stickers. Please try again.");
3188
+ } catch (X) {
3189
+ console.error("Error fetching stickers:", X), T("Failed to load stickers. Please try again.");
3190
3190
  } finally {
3191
3191
  A(!1);
3192
3192
  }
3193
- }, O = (v, q) => {
3193
+ }, O = (v, X) => {
3194
3194
  n({
3195
3195
  type: "sticker",
3196
3196
  src: v,
3197
- name: q,
3197
+ name: X,
3198
3198
  width: 100,
3199
3199
  height: 100,
3200
3200
  x: 100,
3201
3201
  y: 100
3202
3202
  }), o();
3203
3203
  }, R = (v) => {
3204
- N((q) => ({
3205
- ...q,
3206
- [v]: !q[v]
3204
+ N((X) => ({
3205
+ ...X,
3206
+ [v]: !X[v]
3207
3207
  }));
3208
- }, st = (v) => {
3209
- const q = {};
3208
+ }, lt = (v) => {
3209
+ const X = {};
3210
3210
  return v.forEach((P) => {
3211
3211
  const g = P.name.split("/");
3212
- let M = q;
3213
- g.forEach((U, ot) => {
3214
- M[U] || (M[U] = ot === g.length - 1 ? P : {}), M = M[U];
3212
+ let M = X;
3213
+ g.forEach((_, ot) => {
3214
+ M[_] || (M[_] = ot === g.length - 1 ? P : {}), M = M[_];
3215
3215
  });
3216
- }), q;
3217
- }, rt = (v, q = "", P = 0) => /* @__PURE__ */ e.jsx("div", { className: "sticker-tree-level", style: { paddingLeft: `${P * 15}px` }, children: Object.keys(v).map((g) => {
3218
- const M = `${q}/${g}`, U = Q[M];
3216
+ }), X;
3217
+ }, rt = (v, X = "", P = 0) => /* @__PURE__ */ e.jsx("div", { className: "sticker-tree-level", style: { paddingLeft: `${P * 15}px` }, children: Object.keys(v).map((g) => {
3218
+ const M = `${X}/${g}`, _ = Q[M];
3219
3219
  return v[g].type === "image" ? !I || g.toLowerCase().includes(I.toLowerCase()) ? /* @__PURE__ */ e.jsx(
3220
3220
  "div",
3221
3221
  {
@@ -3227,8 +3227,8 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
3227
3227
  src: v[g].url,
3228
3228
  alt: g,
3229
3229
  loading: "lazy",
3230
- onError: (St) => {
3231
- St.target.style.display = "none";
3230
+ onError: (vt) => {
3231
+ vt.target.style.display = "none";
3232
3232
  }
3233
3233
  }
3234
3234
  ) })
@@ -3241,12 +3241,12 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
3241
3241
  className: "category-header",
3242
3242
  onClick: () => R(M),
3243
3243
  children: [
3244
- /* @__PURE__ */ e.jsx("span", { className: `expand-icon ${U ? "expanded" : ""}`, children: "▶" }),
3244
+ /* @__PURE__ */ e.jsx("span", { className: `expand-icon ${_ ? "expanded" : ""}`, children: "▶" }),
3245
3245
  /* @__PURE__ */ e.jsx("span", { className: "category-name", children: g })
3246
3246
  ]
3247
3247
  }
3248
3248
  ),
3249
- U && rt(v[g], M, P + 1)
3249
+ _ && rt(v[g], M, P + 1)
3250
3250
  ] }, M);
3251
3251
  }) }), yt = f.filter(
3252
3252
  (v) => !I || v.name.toLowerCase().includes(I.toLowerCase())
@@ -3281,9 +3281,9 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
3281
3281
  k && /* @__PURE__ */ e.jsx(eo, {}),
3282
3282
  F && /* @__PURE__ */ e.jsxs("div", { className: "sticker-error", children: [
3283
3283
  /* @__PURE__ */ e.jsx("p", { children: F }),
3284
- /* @__PURE__ */ e.jsx("button", { onClick: _, children: "Retry" })
3284
+ /* @__PURE__ */ e.jsx("button", { onClick: V, children: "Retry" })
3285
3285
  ] }),
3286
- !k && !F && f.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "sticker-grid", children: rt(st(yt)) })
3286
+ !k && !F && f.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "sticker-grid", children: rt(lt(yt)) })
3287
3287
  ] })
3288
3288
  ] })
3289
3289
  ] }) }) : null;
@@ -3312,10 +3312,10 @@ const K = ({ name: r, size: o = 24, color: n = "#000000", ...s }) => {
3312
3312
  <filter id="lift" x="-30%" y="-30%" width="160%" height="160%">
3313
3313
  <feDropShadow dx="0.5" dy="1.1" stdDeviation="0.9" flood-color="#1a1208" flood-opacity="0.4"/>
3314
3314
  </filter>
3315
- </defs>`, Ge = 'fill="none" stroke="rgba(20,12,6,0.5)" stroke-width="1.3" stroke-dasharray="2.6 2" stroke-linecap="round"', Y = (r, o, n, s, l = "satin") => `<circle cx="${r}" cy="${o}" r="${n}" fill="${s}"/><circle cx="${r}" cy="${o}" r="${n}" fill="url(#${l})"/><circle cx="${r}" cy="${o}" r="${n}" ${Ge}/>`, Lt = (r, o, n, s, l, h = 0, f = "satin") => {
3315
+ </defs>`, Ue = 'fill="none" stroke="rgba(20,12,6,0.5)" stroke-width="1.3" stroke-dasharray="2.6 2" stroke-linecap="round"', U = (r, o, n, s, l = "satin") => `<circle cx="${r}" cy="${o}" r="${n}" fill="${s}"/><circle cx="${r}" cy="${o}" r="${n}" fill="url(#${l})"/><circle cx="${r}" cy="${o}" r="${n}" ${Ue}/>`, Lt = (r, o, n, s, l, h = 0, f = "satin") => {
3316
3316
  const w = h ? ` transform="rotate(${h} ${r} ${o})"` : "";
3317
- return `<ellipse cx="${r}" cy="${o}" rx="${n}" ry="${s}" fill="${l}"${w}/><ellipse cx="${r}" cy="${o}" rx="${n}" ry="${s}" fill="url(#${f})"${w}/><ellipse cx="${r}" cy="${o}" rx="${n}" ry="${s}" ${Ge}${w}/>`;
3318
- }, Z = (r, o, n = "satin") => `<path d="${r}" fill="${o}"/><path d="${r}" fill="url(#${n})"/><path d="${r}" ${Ge}/>`, Pt = (r, o, n, s, l, h = 2, f = "satin") => `<rect x="${r}" y="${o}" width="${n}" height="${s}" rx="${h}" fill="${l}"/><rect x="${r}" y="${o}" width="${n}" height="${s}" rx="${h}" fill="url(#${f})"/><rect x="${r}" y="${o}" width="${n}" height="${s}" rx="${h}" ${Ge}/>`, ht = (r, o, n = 3) => `<path d="${r}" fill="none" stroke="${o}" stroke-width="${n}" stroke-linecap="round"/><path d="${r}" fill="none" stroke="rgba(255,255,255,0.4)" stroke-width="${Math.max(0.8, n * 0.35)}" stroke-linecap="round"/>`;
3317
+ return `<ellipse cx="${r}" cy="${o}" rx="${n}" ry="${s}" fill="${l}"${w}/><ellipse cx="${r}" cy="${o}" rx="${n}" ry="${s}" fill="url(#${f})"${w}/><ellipse cx="${r}" cy="${o}" rx="${n}" ry="${s}" ${Ue}${w}/>`;
3318
+ }, Z = (r, o, n = "satin") => `<path d="${r}" fill="${o}"/><path d="${r}" fill="url(#${n})"/><path d="${r}" ${Ue}/>`, Pt = (r, o, n, s, l, h = 2, f = "satin") => `<rect x="${r}" y="${o}" width="${n}" height="${s}" rx="${h}" fill="${l}"/><rect x="${r}" y="${o}" width="${n}" height="${s}" rx="${h}" fill="url(#${f})"/><rect x="${r}" y="${o}" width="${n}" height="${s}" rx="${h}" ${Ue}/>`, ht = (r, o, n = 3) => `<path d="${r}" fill="none" stroke="${o}" stroke-width="${n}" stroke-linecap="round"/><path d="${r}" fill="none" stroke="rgba(255,255,255,0.4)" stroke-width="${Math.max(0.8, n * 0.35)}" stroke-linecap="round"/>`;
3319
3319
  let io = 0;
3320
3320
  const tt = (r, o, n, s) => {
3321
3321
  io += 1;
@@ -3327,70 +3327,70 @@ const tt = (r, o, n, s) => {
3327
3327
  description: n,
3328
3328
  url: `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(l)}`
3329
3329
  };
3330
- }, mi = (r, o, n, s, l, h, f) => [...Array(n)].map((w, k) => {
3330
+ }, ui = (r, o, n, s, l, h, f) => [...Array(n)].map((w, k) => {
3331
3331
  const A = 360 / n * k, F = A * Math.PI / 180;
3332
3332
  return Lt(r + Math.cos(F) * s, o + Math.sin(F) * s, l, h, f, A);
3333
- }).join(""), pi = (r, o, n, s, l, h, f = 3) => [...Array(n)].map((w, k) => {
3333
+ }).join(""), mi = (r, o, n, s, l, h, f = 3) => [...Array(n)].map((w, k) => {
3334
3334
  const A = 360 / n * k * Math.PI / 180;
3335
3335
  return ht(`M${r + Math.cos(A) * s} ${o + Math.sin(A) * s} L${r + Math.cos(A) * l} ${o + Math.sin(A) * l}`, h, f);
3336
3336
  }).join(""), ua = [
3337
3337
  // ---- Floral ----
3338
- tt("Rose", "Floral", "Satin rose", Lt(60, 58, 26, 26, "#e23b6d") + Lt(60, 58, 17, 17, "#f06292", 0, "satinV") + Y(60, 58, 8, "#ad1457") + Z("M60 84 q4 16 -6 26", "#2e7d32")),
3339
- tt("Sunflower", "Floral", "Sunflower", mi(60, 58, 12, 30, 9, 5, "#f4b400") + Y(60, 58, 17, "#8d5524", "satinV")),
3338
+ tt("Rose", "Floral", "Satin rose", Lt(60, 58, 26, 26, "#e23b6d") + Lt(60, 58, 17, 17, "#f06292", 0, "satinV") + U(60, 58, 8, "#ad1457") + Z("M60 84 q4 16 -6 26", "#2e7d32")),
3339
+ tt("Sunflower", "Floral", "Sunflower", ui(60, 58, 12, 30, 9, 5, "#f4b400") + U(60, 58, 17, "#8d5524", "satinV")),
3340
3340
  tt("Tulip", "Floral", "Tulip", Z("M60 28 q18 6 16 30 q-16 -10 -16 -10 q0 0 -16 10 q-2 -24 16 -30 Z", "#e23b6d") + Z("M60 48 q8 4 7 20 q-7 -6 -7 -6 q0 0 -7 6 q-1 -16 7 -20 Z", "#ad1457") + ht("M60 58 L60 96", "#2e7d32", 3) + Z("M60 78 q14 -6 20 4 q-14 8 -20 -4 Z", "#43a047")),
3341
- tt("Daisy", "Floral", "Daisy", mi(60, 58, 10, 26, 11, 5, "#ffffff") + Y(60, 58, 12, "#ffca28")),
3342
- tt("Cherry Blossom", "Floral", "Cherry blossom", mi(60, 60, 5, 18, 11, 9, "#f8bbd0") + Y(60, 60, 7, "#fff176") + pi(60, 60, 5, 6, 16, "#fce4ec", 1.4)),
3341
+ tt("Daisy", "Floral", "Daisy", ui(60, 58, 10, 26, 11, 5, "#ffffff") + U(60, 58, 12, "#ffca28")),
3342
+ tt("Cherry Blossom", "Floral", "Cherry blossom", ui(60, 60, 5, 18, 11, 9, "#f8bbd0") + U(60, 60, 7, "#fff176") + mi(60, 60, 5, 6, 16, "#fce4ec", 1.4)),
3343
3343
  tt("Lavender", "Floral", "Lavender sprig", ht("M60 100 C58 70 62 50 60 26", "#5e7d3a", 3) + [...Array(7)].map((r, o) => Lt(60 + (o % 2 ? 6 : -6), 30 + o * 9, 6, 4, "#9575cd", o % 2 ? 25 : -25)).join("")),
3344
3344
  // ---- Nature ----
3345
3345
  tt("Pine Tree", "Nature", "Evergreen", Pt(56, 86, 8, 16, "#795548") + Z("M60 20 L82 56 L38 56 Z", "#2e7d32") + Z("M60 40 L88 82 L32 82 Z", "#388e3c")),
3346
- tt("Mountain", "Nature", "Mountain", Z("M16 92 L52 36 L72 66 L88 44 L104 92 Z", "#6d8299") + Z("M52 36 L64 54 L40 54 Z", "#ffffff") + Y(92, 30, 9, "#ffd54f")),
3347
- tt("Sun", "Nature", "Sunburst", pi(60, 60, 12, 26, 40, "#f9a825", 3) + Y(60, 60, 22, "#fbc02d")),
3346
+ tt("Mountain", "Nature", "Mountain", Z("M16 92 L52 36 L72 66 L88 44 L104 92 Z", "#6d8299") + Z("M52 36 L64 54 L40 54 Z", "#ffffff") + U(92, 30, 9, "#ffd54f")),
3347
+ tt("Sun", "Nature", "Sunburst", mi(60, 60, 12, 26, 40, "#f9a825", 3) + U(60, 60, 22, "#fbc02d")),
3348
3348
  tt("Leaf Sprig", "Nature", "Leaf sprig", ht("M60 96 C60 70 60 50 60 28", "#2e7d32", 3) + Z("M60 70 q-22 -6 -26 -22 q24 0 26 22 Z", "#43a047") + Z("M60 52 q22 -6 26 -22 q-24 0 -26 22 Z", "#66bb6a") + Z("M60 38 q-18 -6 -22 -20 q20 0 22 20 Z", "#43a047")),
3349
3349
  tt("Cactus", "Nature", "Potted cactus", Z("M52 92 q-2 -34 8 -34 q10 0 8 34 Z", "#2e7d32") + Z("M52 70 q-16 0 -16 -14 q0 -8 6 -8 q10 0 10 14 Z", "#43a047") + Z("M68 64 q16 0 16 -14 q0 -8 -6 -8 q-10 0 -10 14 Z", "#43a047") + Pt(46, 92, 28, 16, "#c1502e", 3)),
3350
- tt("Mushroom", "Nature", "Toadstool", Z("M30 64 q0 -34 30 -34 q30 0 30 34 Z", "#e53935") + Pt(50, 64, 20, 34, "#fff8e1", 6) + Y(46, 50, 4, "#fff") + Y(60, 44, 5, "#fff") + Y(74, 52, 4, "#fff")),
3350
+ tt("Mushroom", "Nature", "Toadstool", Z("M30 64 q0 -34 30 -34 q30 0 30 34 Z", "#e53935") + Pt(50, 64, 20, 34, "#fff8e1", 6) + U(46, 50, 4, "#fff") + U(60, 44, 5, "#fff") + U(74, 52, 4, "#fff")),
3351
3351
  tt("Acorn", "Nature", "Acorn", Z("M40 56 q20 30 40 0 q-20 8 -40 0 Z", "#a1683a") + Z("M38 56 q22 -20 44 0 q-22 8 -44 0 Z", "#6d4c2f") + ht("M60 30 L60 38", "#6d4c2f", 3)),
3352
3352
  // ---- Animals ----
3353
3353
  tt("Butterfly", "Animals", "Butterfly", Lt(44, 50, 16, 13, "#7e57c2", -18) + Lt(76, 50, 16, 13, "#7e57c2", 18, "satinV") + Lt(46, 76, 12, 10, "#9575cd", -12) + Lt(74, 76, 12, 10, "#9575cd", 12, "satinV") + Pt(57, 42, 6, 44, "#4527a0", 3) + ht("M60 44 L52 30", "#4527a0", 2) + ht("M60 44 L68 30", "#4527a0", 2)),
3354
3354
  tt("Bee", "Animals", "Bumblebee", Lt(60, 64, 22, 16, "#fbc02d") + Pt(50, 48, 8, 32, "#3e2723", 2) + Pt(64, 48, 8, 32, "#3e2723", 2) + Lt(40, 54, 12, 7, "#e3f2fd", -25) + Lt(80, 54, 12, 7, "#e3f2fd", 25)),
3355
- tt("Ladybug", "Animals", "Ladybug", Y(60, 62, 24, "#e53935") + ht("M60 38 L60 86", "#3e2723", 2) + Y(60, 40, 9, "#3e2723") + Y(50, 56, 4, "#3e2723") + Y(70, 56, 4, "#3e2723") + Y(50, 72, 4, "#3e2723") + Y(70, 72, 4, "#3e2723")),
3356
- tt("Cat", "Animals", "Cat face", Y(60, 64, 26, "#9e9e9e") + Z("M40 46 L36 24 L54 40 Z", "#9e9e9e") + Z("M80 46 L84 24 L66 40 Z", "#9e9e9e") + Y(51, 62, 3.4, "#212121") + Y(69, 62, 3.4, "#212121") + Z("M56 72 q4 4 8 0", "#212121")),
3357
- tt("Bird", "Animals", "Little bird", Lt(58, 62, 22, 17, "#42a5f5") + Y(74, 50, 10, "#42a5f5") + Z("M82 50 L96 54 L82 58 Z", "#fb8c00") + Y(77, 48, 2.4, "#212121") + Z("M40 64 q-16 4 -18 16 q18 -2 22 -8 Z", "#1e88e5")),
3358
- tt("Fish", "Animals", "Tropical fish", Lt(56, 62, 26, 16, "#26c6da") + Z("M82 62 L100 48 L100 76 Z", "#0097a7") + Y(44, 58, 2.6, "#063") + Z("M56 46 q0 -10 -8 -12 q2 8 8 12 Z", "#0097a7")),
3359
- tt("Paw", "Animals", "Paw print", Lt(60, 72, 14, 11, "#6d4c41") + Y(44, 52, 6, "#6d4c41") + Y(58, 44, 6, "#6d4c41") + Y(72, 46, 6, "#6d4c41") + Y(82, 58, 5, "#6d4c41")),
3355
+ tt("Ladybug", "Animals", "Ladybug", U(60, 62, 24, "#e53935") + ht("M60 38 L60 86", "#3e2723", 2) + U(60, 40, 9, "#3e2723") + U(50, 56, 4, "#3e2723") + U(70, 56, 4, "#3e2723") + U(50, 72, 4, "#3e2723") + U(70, 72, 4, "#3e2723")),
3356
+ tt("Cat", "Animals", "Cat face", U(60, 64, 26, "#9e9e9e") + Z("M40 46 L36 24 L54 40 Z", "#9e9e9e") + Z("M80 46 L84 24 L66 40 Z", "#9e9e9e") + U(51, 62, 3.4, "#212121") + U(69, 62, 3.4, "#212121") + Z("M56 72 q4 4 8 0", "#212121")),
3357
+ tt("Bird", "Animals", "Little bird", Lt(58, 62, 22, 17, "#42a5f5") + U(74, 50, 10, "#42a5f5") + Z("M82 50 L96 54 L82 58 Z", "#fb8c00") + U(77, 48, 2.4, "#212121") + Z("M40 64 q-16 4 -18 16 q18 -2 22 -8 Z", "#1e88e5")),
3358
+ tt("Fish", "Animals", "Tropical fish", Lt(56, 62, 26, 16, "#26c6da") + Z("M82 62 L100 48 L100 76 Z", "#0097a7") + U(44, 58, 2.6, "#063") + Z("M56 46 q0 -10 -8 -12 q2 8 8 12 Z", "#0097a7")),
3359
+ tt("Paw", "Animals", "Paw print", Lt(60, 72, 14, 11, "#6d4c41") + U(44, 52, 6, "#6d4c41") + U(58, 44, 6, "#6d4c41") + U(72, 46, 6, "#6d4c41") + U(82, 58, 5, "#6d4c41")),
3360
3360
  // ---- Geometric ----
3361
3361
  tt("Diamond", "Geometric", "Diamond", Z("M60 20 L96 60 L60 100 L24 60 Z", "#1e88e5") + Z("M60 38 L78 60 L60 82 L42 60 Z", "#64b5f6", "satinV")),
3362
3362
  tt("Chevron", "Geometric", "Chevrons", [0, 18, 36].map((r, o) => ht(`M24 ${42 + r} L60 ${62 + r} L96 ${42 + r}`, ["#1e88e5", "#26a69a", "#ef6c00"][o], 5)).join("")),
3363
- tt("Mandala", "Geometric", "Mandala", Y(60, 60, 30, "#8e24aa") + Y(60, 60, 20, "#ab47bc", "satinV") + [...Array(8)].map((r, o) => {
3363
+ tt("Mandala", "Geometric", "Mandala", U(60, 60, 30, "#8e24aa") + U(60, 60, 20, "#ab47bc", "satinV") + [...Array(8)].map((r, o) => {
3364
3364
  const n = o * 45 * Math.PI / 180;
3365
- return Y(60 + Math.cos(n) * 30, 60 + Math.sin(n) * 30, 5, "#f3e5f5");
3366
- }).join("") + Y(60, 60, 8, "#f3e5f5")),
3365
+ return U(60 + Math.cos(n) * 30, 60 + Math.sin(n) * 30, 5, "#f3e5f5");
3366
+ }).join("") + U(60, 60, 8, "#f3e5f5")),
3367
3367
  // ---- Symbols ----
3368
3368
  tt("Heart", "Symbols", "Heart", Z("M60 92 C24 66 30 34 50 34 C58 34 60 42 60 46 C60 42 62 34 70 34 C90 34 96 66 60 92 Z", "#e53935")),
3369
3369
  tt("Star", "Symbols", "Star", Z("M60 22 L71 50 L101 50 L77 68 L86 98 L60 80 L34 98 L43 68 L19 50 L49 50 Z", "#fbc02d")),
3370
- tt("Crown", "Symbols", "Crown", Z("M28 84 L34 46 L48 66 L60 40 L72 66 L86 46 L92 84 Z", "#f9a825") + Pt(28, 84, 64, 10, "#f57f17") + Y(34, 46, 5, "#fdd835") + Y(60, 40, 5, "#fdd835") + Y(86, 46, 5, "#fdd835")),
3371
- tt("Anchor", "Symbols", "Anchor", Y(60, 30, 7, "#37474f") + ht("M60 36 L60 92", "#455a64", 5) + ht("M40 60 L80 60", "#455a64", 5) + Z("M30 76 q6 22 30 22 q24 0 30 -22 q-12 14 -30 14 q-18 0 -30 -14 Z", "#37474f")),
3370
+ tt("Crown", "Symbols", "Crown", Z("M28 84 L34 46 L48 66 L60 40 L72 66 L86 46 L92 84 Z", "#f9a825") + Pt(28, 84, 64, 10, "#f57f17") + U(34, 46, 5, "#fdd835") + U(60, 40, 5, "#fdd835") + U(86, 46, 5, "#fdd835")),
3371
+ tt("Anchor", "Symbols", "Anchor", U(60, 30, 7, "#37474f") + ht("M60 36 L60 92", "#455a64", 5) + ht("M40 60 L80 60", "#455a64", 5) + Z("M30 76 q6 22 30 22 q24 0 30 -22 q-12 14 -30 14 q-18 0 -30 -14 Z", "#37474f")),
3372
3372
  tt("Lightning", "Symbols", "Lightning bolt", Z("M64 18 L40 64 L56 64 L50 102 L84 50 L66 50 Z", "#ffb300")),
3373
- tt("Music Note", "Symbols", "Music note", Y(46, 84, 11, "#5e35b1") + Y(82, 76, 11, "#5e35b1") + Pt(54, 30, 6, 54, "#5e35b1", 3) + Pt(85, 22, 6, 54, "#5e35b1", 3) + Z("M57 30 L91 22 L91 34 L57 42 Z", "#5e35b1")),
3374
- tt("Peace", "Symbols", "Peace sign", Y(60, 60, 30, "#43a047") + ht("M60 30 L60 90", "rgba(255,255,255,0.95)", 4) + ht("M60 60 L38 82", "rgba(255,255,255,0.95)", 4) + ht("M60 60 L82 82", "rgba(255,255,255,0.95)", 4)),
3373
+ tt("Music Note", "Symbols", "Music note", U(46, 84, 11, "#5e35b1") + U(82, 76, 11, "#5e35b1") + Pt(54, 30, 6, 54, "#5e35b1", 3) + Pt(85, 22, 6, 54, "#5e35b1", 3) + Z("M57 30 L91 22 L91 34 L57 42 Z", "#5e35b1")),
3374
+ tt("Peace", "Symbols", "Peace sign", U(60, 60, 30, "#43a047") + ht("M60 30 L60 90", "rgba(255,255,255,0.95)", 4) + ht("M60 60 L38 82", "rgba(255,255,255,0.95)", 4) + ht("M60 60 L82 82", "rgba(255,255,255,0.95)", 4)),
3375
3375
  // ---- Food ----
3376
- tt("Cupcake", "Food", "Cupcake", Z("M38 64 L82 64 L74 98 L46 98 Z", "#d7a86e") + Z("M34 64 q6 -28 26 -28 q20 0 26 28 Z", "#ec407a") + Y(48, 50, 3, "#fff") + Y(60, 44, 3, "#fff") + Y(72, 50, 3, "#fff") + Y(60, 34, 5, "#e53935")),
3377
- tt("Cherries", "Food", "Cherries", Y(46, 84, 12, "#e53935") + Y(74, 84, 12, "#c62828") + ht("M46 72 C50 50 60 40 64 30", "#2e7d32", 2.5) + ht("M74 72 C70 52 66 42 64 30", "#2e7d32", 2.5) + Z("M64 30 q14 -8 22 -2 q-12 8 -22 2 Z", "#43a047")),
3376
+ tt("Cupcake", "Food", "Cupcake", Z("M38 64 L82 64 L74 98 L46 98 Z", "#d7a86e") + Z("M34 64 q6 -28 26 -28 q20 0 26 28 Z", "#ec407a") + U(48, 50, 3, "#fff") + U(60, 44, 3, "#fff") + U(72, 50, 3, "#fff") + U(60, 34, 5, "#e53935")),
3377
+ tt("Cherries", "Food", "Cherries", U(46, 84, 12, "#e53935") + U(74, 84, 12, "#c62828") + ht("M46 72 C50 50 60 40 64 30", "#2e7d32", 2.5) + ht("M74 72 C70 52 66 42 64 30", "#2e7d32", 2.5) + Z("M64 30 q14 -8 22 -2 q-12 8 -22 2 Z", "#43a047")),
3378
3378
  tt("Coffee", "Food", "Coffee cup", Z("M34 50 L84 50 L80 92 L38 92 Z", "#6d4c41") + Z("M84 56 q16 0 16 14 q0 14 -18 12", "#6d4c41") + ht("M48 38 q4 -8 0 -14", "#bcaaa4", 2.5) + ht("M60 38 q4 -8 0 -14", "#bcaaa4", 2.5) + ht("M72 38 q4 -8 0 -14", "#bcaaa4", 2.5)),
3379
3379
  // ---- Sports ----
3380
- tt("Soccer Ball", "Sports", "Soccer ball", Y(60, 60, 32, "#fafafa") + Z("M60 44 L74 54 L69 72 L51 72 L46 54 Z", "#212121") + pi(60, 60, 5, 12, 30, "#212121", 2)),
3381
- tt("Basketball", "Sports", "Basketball", Y(60, 60, 32, "#ef6c00") + ht("M60 28 L60 92", "#3e2723", 2.5) + ht("M28 60 L92 60", "#3e2723", 2.5) + ht("M36 36 Q60 60 36 84", "#3e2723", 2.5) + ht("M84 36 Q60 60 84 84", "#3e2723", 2.5)),
3380
+ tt("Soccer Ball", "Sports", "Soccer ball", U(60, 60, 32, "#fafafa") + Z("M60 44 L74 54 L69 72 L51 72 L46 54 Z", "#212121") + mi(60, 60, 5, 12, 30, "#212121", 2)),
3381
+ tt("Basketball", "Sports", "Basketball", U(60, 60, 32, "#ef6c00") + ht("M60 28 L60 92", "#3e2723", 2.5) + ht("M28 60 L92 60", "#3e2723", 2.5) + ht("M36 36 Q60 60 36 84", "#3e2723", 2.5) + ht("M84 36 Q60 60 84 84", "#3e2723", 2.5)),
3382
3382
  // ---- Holiday ----
3383
3383
  tt("Snowflake", "Holiday", "Snowflake", [...Array(6)].map((r, o) => {
3384
3384
  const n = o * 60 * Math.PI / 180, s = 60 + Math.cos(n) * 38, l = 60 + Math.sin(n) * 38, h = 60 + Math.cos(n) * 22, f = 60 + Math.sin(n) * 22;
3385
3385
  return ht(`M60 60 L${s} ${l}`, "#4fc3f7", 3) + ht(`M${h} ${f} L${h + Math.cos(n + 0.5) * 10} ${f + Math.sin(n + 0.5) * 10}`, "#4fc3f7", 2) + ht(`M${h} ${f} L${h + Math.cos(n - 0.5) * 10} ${f + Math.sin(n - 0.5) * 10}`, "#4fc3f7", 2);
3386
- }).join("") + Y(60, 60, 5, "#81d4fa")),
3386
+ }).join("") + U(60, 60, 5, "#81d4fa")),
3387
3387
  tt("Gift", "Holiday", "Gift box", Pt(34, 54, 52, 44, "#e53935", 4) + Pt(54, 54, 12, 44, "#fff", 2) + Pt(34, 50, 52, 12, "#c62828", 3) + Z("M60 50 q-18 -22 -2 -22 q8 0 2 22 Z", "#fbc02d") + Z("M60 50 q18 -22 2 -22 q-8 0 -2 22 Z", "#fbc02d")),
3388
- tt("Holly", "Holiday", "Holly & berries", Z("M40 60 q10 -22 22 -10 q-2 16 -22 10 Z", "#2e7d32") + Z("M80 60 q-10 -22 -22 -10 q2 16 22 10 Z", "#388e3c") + Z("M50 78 q10 -16 20 -6 q-4 14 -20 6 Z", "#43a047") + Y(56, 64, 5, "#e53935") + Y(64, 64, 5, "#c62828") + Y(60, 72, 5, "#e53935")),
3388
+ tt("Holly", "Holiday", "Holly & berries", Z("M40 60 q10 -22 22 -10 q-2 16 -22 10 Z", "#2e7d32") + Z("M80 60 q-10 -22 -22 -10 q2 16 22 10 Z", "#388e3c") + Z("M50 78 q10 -16 20 -6 q-4 14 -20 6 Z", "#43a047") + U(56, 64, 5, "#e53935") + U(64, 64, 5, "#c62828") + U(60, 72, 5, "#e53935")),
3389
3389
  // ---- Text ----
3390
- tt("Monogram", "Text", "Initial monogram", Y(60, 60, 34, "#5e35b1") + Y(60, 60, 34, "#5e35b1", "satinV") + '<text x="60" y="75" text-anchor="middle" font-family="Georgia, serif" font-size="46" font-weight="700" fill="#ede7f6">A</text>')
3390
+ tt("Monogram", "Text", "Initial monogram", U(60, 60, 34, "#5e35b1") + U(60, 60, 34, "#5e35b1", "satinV") + '<text x="60" y="75" text-anchor="middle" font-family="Georgia, serif" font-size="46" font-weight="700" fill="#ede7f6">A</text>')
3391
3391
  ], ma = ({ isOpen: r, onClose: o, onAddEmbroidery: n, theme: s, apiKey: l, apiEndpoint: h }) => {
3392
3392
  const [f, w] = E([]), [k, A] = E(!1), [F, T] = E(null), [S, B] = E(""), [I, H] = E("All"), Q = dt(null), N = ["All", "Floral", "Nature", "Geometric", "Traditional", "Sports", "Hobbies", "Food", "Symbols", "Holiday", "Text"];
3393
- ct(() => {
3393
+ st(() => {
3394
3394
  r && w(ua);
3395
3395
  }, [r]);
3396
3396
  const z = (L) => {
@@ -3515,26 +3515,26 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
3515
3515
  width: 300,
3516
3516
  height: 90
3517
3517
  }
3518
- }), ao = ["#b07e4f", "#7d4f28"], Pe = ["#f3e6cf", "#e3cda6"], yi = ["#dfe4ea", "#9aa4b1"], xi = ["#3a4651", "#222a31"], xa = [
3518
+ }), ao = ["#b07e4f", "#7d4f28"], He = ["#f3e6cf", "#e3cda6"], pi = ["#dfe4ea", "#9aa4b1"], yi = ["#3a4651", "#222a31"], xa = [
3519
3519
  // ---- Signage ----
3520
- Ot("Welcome", "Signage", "Bold welcome sign", { text: "WELCOME", font: "Bebas Neue", sysFont: "Impact, sans-serif", ink: "#3a2a1a", card: Pe, size: 46, previewSize: 34 }),
3520
+ Ot("Welcome", "Signage", "Bold welcome sign", { text: "WELCOME", font: "Bebas Neue", sysFont: "Impact, sans-serif", ink: "#3a2a1a", card: He, size: 46, previewSize: 34 }),
3521
3521
  Ot("Open", "Signage", "Shop open sign", { text: "OPEN", font: "Anton", sysFont: "Impact, sans-serif", ink: "#7a3b12", card: ao, size: 54, previewSize: 40 }),
3522
- Ot("Café", "Signage", "Café script sign", { text: "Café", font: "Pacifico", sysFont: '"Brush Script MT", cursive', ink: "#f5f5f5", card: xi, size: 50, previewSize: 38 }),
3523
- Ot("Gather", "Signage", "Gather sign", { text: "gather", font: "Playfair Display", sysFont: "Georgia, serif", ink: "#2e2a26", card: Pe, size: 46, style: "italic", previewSize: 36 }),
3522
+ Ot("Café", "Signage", "Café script sign", { text: "Café", font: "Pacifico", sysFont: '"Brush Script MT", cursive', ink: "#f5f5f5", card: yi, size: 50, previewSize: 38 }),
3523
+ Ot("Gather", "Signage", "Gather sign", { text: "gather", font: "Playfair Display", sysFont: "Georgia, serif", ink: "#2e2a26", card: He, size: 46, style: "italic", previewSize: 36 }),
3524
3524
  // ---- Home & Family ----
3525
3525
  Ot("Family Name", "Home", "Family name plaque", { text: "The Smiths", font: "Great Vibes", sysFont: '"Brush Script MT", cursive', ink: "#3a2a1a", card: ao, size: 48, previewSize: 30 }),
3526
- Ot("Home Sweet Home", "Home", "Home sweet home", { text: "Home Sweet Home", font: "Dancing Script", sysFont: '"Brush Script MT", cursive', ink: "#3a2a1a", card: Pe, size: 40, previewSize: 22 }),
3527
- Ot("House Number", "Home", "House number", { text: "123", font: "Alfa Slab One", sysFont: "Georgia, serif", ink: "#2b3036", card: yi, size: 64, previewSize: 48 }),
3528
- Ot("Address", "Home", "Street address", { text: "21 OAK STREET", font: "Oswald", sysFont: "Arial, sans-serif", ink: "#f5f5f5", card: xi, size: 34, previewSize: 18 }),
3526
+ Ot("Home Sweet Home", "Home", "Home sweet home", { text: "Home Sweet Home", font: "Dancing Script", sysFont: '"Brush Script MT", cursive', ink: "#3a2a1a", card: He, size: 40, previewSize: 22 }),
3527
+ Ot("House Number", "Home", "House number", { text: "123", font: "Alfa Slab One", sysFont: "Georgia, serif", ink: "#2b3036", card: pi, size: 64, previewSize: 48 }),
3528
+ Ot("Address", "Home", "Street address", { text: "21 OAK STREET", font: "Oswald", sysFont: "Arial, sans-serif", ink: "#f5f5f5", card: yi, size: 34, previewSize: 18 }),
3529
3529
  // ---- Celebrations ----
3530
- Ot("Mr & Mrs", "Wedding", "Wedding sign", { text: "Mr & Mrs", font: "Great Vibes", sysFont: '"Brush Script MT", cursive', ink: "#3a2a1a", card: Pe, size: 52, previewSize: 34 }),
3531
- Ot("Joy", "Celebrations", "Holiday joy", { text: "Joy", font: "Sacramento", sysFont: '"Brush Script MT", cursive', ink: "#f5f5f5", card: xi, size: 60, previewSize: 46 }),
3532
- Ot("Established", "Celebrations", "Established year", { text: "EST. 2024", font: "Staatliches", sysFont: "Impact, sans-serif", ink: "#2b3036", card: yi, size: 44, previewSize: 30 }),
3530
+ Ot("Mr & Mrs", "Wedding", "Wedding sign", { text: "Mr & Mrs", font: "Great Vibes", sysFont: '"Brush Script MT", cursive', ink: "#3a2a1a", card: He, size: 52, previewSize: 34 }),
3531
+ Ot("Joy", "Celebrations", "Holiday joy", { text: "Joy", font: "Sacramento", sysFont: '"Brush Script MT", cursive', ink: "#f5f5f5", card: yi, size: 60, previewSize: 46 }),
3532
+ Ot("Established", "Celebrations", "Established year", { text: "EST. 2024", font: "Staatliches", sysFont: "Impact, sans-serif", ink: "#2b3036", card: pi, size: 44, previewSize: 30 }),
3533
3533
  // ---- Business ----
3534
- Ot("Office", "Business", "Office name plate", { text: "OFFICE", font: "Oswald", sysFont: "Arial, sans-serif", ink: "#2b3036", card: yi, size: 40, previewSize: 30 })
3534
+ Ot("Office", "Business", "Office name plate", { text: "OFFICE", font: "Oswald", sysFont: "Arial, sans-serif", ink: "#2b3036", card: pi, size: 40, previewSize: 30 })
3535
3535
  ], ba = ({ isOpen: r, onClose: o, onAddHandcraft: n, theme: s }) => {
3536
3536
  const [l, h] = E([]), [f, w] = E(""), [k, A] = E("All"), F = dt(null), T = ["All", "Signage", "Business", "Home", "Wedding", "Celebrations"];
3537
- ct(() => {
3537
+ st(() => {
3538
3538
  r && h(xa);
3539
3539
  }, [r]);
3540
3540
  const S = (I) => {
@@ -3598,18 +3598,18 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
3598
3598
  ] }) }) : null;
3599
3599
  }, Sa = ({ isOpen: r, onClose: o, onAddText: n, theme: s }) => {
3600
3600
  const [l, h] = E(""), [f, w] = E("All");
3601
- ct(() => {
3601
+ st(() => {
3602
3602
  if (!r) return;
3603
3603
  const S = Array.from(new Set(ie.map((B) => B.fontFamily).filter(Boolean)));
3604
- $e(S);
3604
+ Ge(S);
3605
3605
  }, [r]);
3606
- const k = wi(() => {
3606
+ const k = vi(() => {
3607
3607
  const S = ie.reduce((B, I) => (B[I.category] = (B[I.category] || 0) + 1, B), {});
3608
3608
  return [
3609
3609
  { name: "All", count: ie.length },
3610
3610
  ...Object.entries(S).map(([B, I]) => ({ name: B, count: I }))
3611
3611
  ];
3612
- }, [ie]), A = wi(() => ie.filter((S) => {
3612
+ }, [ie]), A = vi(() => ie.filter((S) => {
3613
3613
  const B = !l || S.text.toLowerCase().includes(l.toLowerCase()) || S.category.toLowerCase().includes(l.toLowerCase()), I = f === "All" || S.category === f;
3614
3614
  return B && I;
3615
3615
  }), [ie, l, f]), F = (S) => {
@@ -3719,65 +3719,65 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
3719
3719
  onAIImageGenerate: w
3720
3720
  }) => {
3721
3721
  const [k, A] = E(""), [F, T] = E(null), [S, B] = E(!1), [I, H] = E(null), [Q, N] = E(null), z = dt(null);
3722
- if (ct(() => {
3722
+ if (st(() => {
3723
3723
  r && (N(null), B(!1));
3724
3724
  }, [r]), !r) return null;
3725
- const b = (s == null ? void 0 : s.primaryColor) || "#4c5bf2", L = !S && (k.trim().length > 0 || !!F), j = (_) => {
3726
- var st;
3727
- const O = (st = _.target.files) == null ? void 0 : st[0];
3725
+ const b = (s == null ? void 0 : s.primaryColor) || "#4c5bf2", L = !S && (k.trim().length > 0 || !!F), j = (V) => {
3726
+ var lt;
3727
+ const O = (lt = V.target.files) == null ? void 0 : lt[0];
3728
3728
  if (!O || !O.type.startsWith("image/")) return;
3729
3729
  const R = new FileReader();
3730
- R.onload = (rt) => T({ dataUrl: rt.target.result, name: O.name }), R.onerror = () => N("Could not read that image. Please try another file."), R.readAsDataURL(O), _.target.value = "";
3731
- }, it = () => T(null), J = (_) => {
3732
- const O = _ && typeof _ == "object" && "object" in _ ? _.object : _;
3730
+ R.onload = (rt) => T({ dataUrl: rt.target.result, name: O.name }), R.onerror = () => N("Could not read that image. Please try another file."), R.readAsDataURL(O), V.target.value = "";
3731
+ }, it = () => T(null), J = (V) => {
3732
+ const O = V && typeof V == "object" && "object" in V ? V.object : V;
3733
3733
  return O ? typeof O == "string" ? O : O.imageUrl || O.url || O.image || (O.imageBase64 ? `data:image/png;base64,${O.imageBase64}` : null) : null;
3734
- }, bt = async () => {
3735
- var _, O;
3734
+ }, St = async () => {
3735
+ var V, O;
3736
3736
  N(null), B(!0), H(null);
3737
3737
  try {
3738
3738
  const R = { prompt: k.trim(), imageDataUrl: (F == null ? void 0 : F.dataUrl) || null };
3739
- let st = null;
3739
+ let lt = null;
3740
3740
  if (typeof w == "function") {
3741
3741
  const rt = await w(R);
3742
- st = typeof rt == "string" ? rt : J(rt);
3742
+ lt = typeof rt == "string" ? rt : J(rt);
3743
3743
  } else {
3744
3744
  const rt = f || (h ? `${h}/api/v1/designer` : "");
3745
3745
  if (!rt)
3746
3746
  throw new Error("AI image generation is not configured.");
3747
- const yt = await ki.post(`${rt}/generate-image`, {
3747
+ const yt = await wi.post(`${rt}/generate-image`, {
3748
3748
  prompt: R.prompt,
3749
3749
  image: R.imageDataUrl,
3750
3750
  apiKey: l
3751
3751
  });
3752
- st = J(yt.data);
3752
+ lt = J(yt.data);
3753
3753
  }
3754
- if (!st) throw new Error("No image was returned. Please try a different prompt.");
3755
- H(st);
3754
+ if (!lt) throw new Error("No image was returned. Please try a different prompt.");
3755
+ H(lt);
3756
3756
  } catch (R) {
3757
3757
  console.error("AI image generation failed:", R), N(
3758
- ((O = (_ = R == null ? void 0 : R.response) == null ? void 0 : _.data) == null ? void 0 : O.message) || (R == null ? void 0 : R.message) || "Image generation failed. Please try again."
3758
+ ((O = (V = R == null ? void 0 : R.response) == null ? void 0 : V.data) == null ? void 0 : O.message) || (R == null ? void 0 : R.message) || "Image generation failed. Please try again."
3759
3759
  );
3760
3760
  } finally {
3761
3761
  B(!1);
3762
3762
  }
3763
3763
  }, pt = () => {
3764
3764
  if (!I) return;
3765
- const _ = new Image();
3766
- _.crossOrigin = "anonymous", _.onload = () => {
3767
- const R = _.naturalWidth || 512, st = _.naturalHeight || 512, rt = Math.min(1, 250 / Math.max(R, st));
3765
+ const V = new Image();
3766
+ V.crossOrigin = "anonymous", V.onload = () => {
3767
+ const R = V.naturalWidth || 512, lt = V.naturalHeight || 512, rt = Math.min(1, 250 / Math.max(R, lt));
3768
3768
  n({
3769
- imageData: _,
3769
+ imageData: V,
3770
3770
  src: I,
3771
3771
  width: Math.round(R * rt),
3772
- height: Math.round(st * rt),
3772
+ height: Math.round(lt * rt),
3773
3773
  originalWidth: R,
3774
- originalHeight: st
3774
+ originalHeight: lt
3775
3775
  }), o();
3776
- }, _.onerror = () => N("The generated image could not be loaded onto the canvas."), _.src = I;
3777
- }, zt = () => {
3776
+ }, V.onerror = () => N("The generated image could not be loaded onto the canvas."), V.src = I;
3777
+ }, Tt = () => {
3778
3778
  H(null), N(null);
3779
3779
  };
3780
- return /* @__PURE__ */ e.jsx("div", { className: "ai-modal-overlay", onClick: o, children: /* @__PURE__ */ e.jsxs("div", { className: "ai-modal-content", onClick: (_) => _.stopPropagation(), children: [
3780
+ return /* @__PURE__ */ e.jsx("div", { className: "ai-modal-overlay", onClick: o, children: /* @__PURE__ */ e.jsxs("div", { className: "ai-modal-content", onClick: (V) => V.stopPropagation(), children: [
3781
3781
  /* @__PURE__ */ e.jsxs("div", { className: "ai-modal-header", children: [
3782
3782
  /* @__PURE__ */ e.jsx("h3", { children: "✨ AI Image Generator" }),
3783
3783
  /* @__PURE__ */ e.jsx("button", { className: "ai-modal-close", onClick: o, "aria-label": "Close", children: "×" })
@@ -3798,7 +3798,7 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
3798
3798
  rows: 4,
3799
3799
  placeholder: "e.g. a minimalist mountain logo · a bold retro sunset · a cute cartoon cat mascot · a seamless floral pattern",
3800
3800
  value: k,
3801
- onChange: (_) => A(_.target.value)
3801
+ onChange: (V) => A(V.target.value)
3802
3802
  }
3803
3803
  ),
3804
3804
  /* @__PURE__ */ e.jsxs("div", { className: "ai-ref-section", children: [
@@ -3815,8 +3815,8 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
3815
3815
  type: "button",
3816
3816
  className: "ai-upload-btn",
3817
3817
  onClick: () => {
3818
- var _;
3819
- return (_ = z.current) == null ? void 0 : _.click();
3818
+ var V;
3819
+ return (V = z.current) == null ? void 0 : V.click();
3820
3820
  },
3821
3821
  children: "+ Upload an image to transform"
3822
3822
  }
@@ -3841,7 +3841,7 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
3841
3841
  className: "ai-generate-btn",
3842
3842
  style: { backgroundColor: b, opacity: L ? 1 : 0.6 },
3843
3843
  disabled: !L,
3844
- onClick: bt,
3844
+ onClick: St,
3845
3845
  children: S ? /* @__PURE__ */ e.jsxs("span", { className: "ai-generating", children: [
3846
3846
  /* @__PURE__ */ e.jsx("span", { className: "ai-spinner" }),
3847
3847
  " Generating…"
@@ -3853,13 +3853,13 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
3853
3853
  /* @__PURE__ */ e.jsx("div", { className: "ai-result-preview", children: /* @__PURE__ */ e.jsx("img", { src: I, alt: "AI generated result" }) }),
3854
3854
  Q && /* @__PURE__ */ e.jsx("div", { className: "ai-error", children: Q }),
3855
3855
  /* @__PURE__ */ e.jsxs("div", { className: "ai-result-actions", children: [
3856
- /* @__PURE__ */ e.jsx("button", { type: "button", className: "ai-secondary-btn", onClick: zt, children: "Start over" }),
3856
+ /* @__PURE__ */ e.jsx("button", { type: "button", className: "ai-secondary-btn", onClick: Tt, children: "Start over" }),
3857
3857
  /* @__PURE__ */ e.jsx(
3858
3858
  "button",
3859
3859
  {
3860
3860
  type: "button",
3861
3861
  className: "ai-secondary-btn",
3862
- onClick: bt,
3862
+ onClick: St,
3863
3863
  disabled: S,
3864
3864
  children: S ? "Regenerating…" : "Regenerate"
3865
3865
  }
@@ -3904,53 +3904,57 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
3904
3904
  apiKey: it,
3905
3905
  apiEndpoint: J,
3906
3906
  // AI image generation: on by default; host can disable.
3907
- aiEnabled: bt = !0,
3907
+ aiEnabled: St = !0,
3908
3908
  aiEndpoint: pt,
3909
- onAIImageGenerate: zt,
3909
+ onAIImageGenerate: Tt,
3910
3910
  // Login gate: when not authenticated, the AI button asks the
3911
3911
  // host to send the visitor to sign in instead of opening the modal.
3912
- isAuthenticated: _ = !0,
3912
+ isAuthenticated: V = !0,
3913
3913
  onRequireAuth: O
3914
3914
  }) => {
3915
- const R = b === "customize", rt = (L || []).some((V) => String(V).toUpperCase() === "EMBROIDERY") || j === "Y", yt = (L || []).some((V) => String(V).toUpperCase() === "HANDCRAFTED"), [v, q] = E(!1), [P, g] = E(!1), [M, U] = E(!1), [ot, St] = E(!1), [ft, Rt] = E(!1), [Ct, xt] = E(!1), [Ft, Gt] = E(!1), [ee, oe] = E(!1), [ae, de] = E(!1), [vt, re] = E(!1), X = !R || vt, je = (V) => {
3916
- const Ut = V.target.files[0];
3917
- Ut && Ut.type.startsWith("image/") && A(Ut), V.target.value = "";
3918
- }, Qt = (V) => {
3915
+ const R = b === "customize", rt = (L || []).some((q) => String(q).toUpperCase() === "EMBROIDERY") || j === "Y", yt = (L || []).some((q) => String(q).toUpperCase() === "HANDCRAFTED"), [v, X] = E(!1), [P, g] = E(!1), [M, _] = E(!1), [ot, vt] = E(!1), [ft, Rt] = E(!1), [Ft, xt] = E(!1), [Nt, $t] = E(!1), [oe, je] = E(!1), [ae, re] = E(!1), [jt, Zt] = E(!1), [Y, Ce] = E(!1), Vt = !R || Y;
3916
+ st(() => {
3917
+ V && oe && ($t(!0), je(!1));
3918
+ }, [V, oe]);
3919
+ const qe = (q) => {
3920
+ const Yt = q.target.files[0];
3921
+ Yt && Yt.type.startsWith("image/") && A(Yt), q.target.value = "";
3922
+ }, Xe = (q) => {
3919
3923
  r("icon", {
3920
- iconData: V,
3921
- text: V.symbol,
3924
+ iconData: q,
3925
+ text: q.symbol,
3922
3926
  fontSize: 48,
3923
3927
  fontFamily: "Arial",
3924
3928
  fill: "#000000"
3925
3929
  });
3926
- }, Ue = (V) => {
3927
- r("qrcode", V);
3928
- }, Ye = (V) => {
3929
- r("barcode", V);
3930
- }, he = (V) => {
3931
- r("sticker", V);
3932
- }, _t = (V) => {
3933
- r("embroidery", V);
3934
- }, ne = (V) => {
3935
- r("text", V);
3936
- }, Wt = (V, Ut) => {
3937
- r(V, Ut);
3938
- }, Ce = (V) => {
3939
- r("image", V);
3940
- }, At = () => {
3941
- oe(!ee), de(!1);
3942
- }, se = () => {
3943
- de(!ae), oe(!1);
3944
- }, qe = (V) => {
3945
- V === "custom" ? r("text") : V === "templates" && xt(!0), oe(!1);
3930
+ }, de = (q) => {
3931
+ r("qrcode", q);
3932
+ }, Ut = (q) => {
3933
+ r("barcode", q);
3934
+ }, ne = (q) => {
3935
+ r("sticker", q);
3936
+ }, Wt = (q) => {
3937
+ r("embroidery", q);
3938
+ }, Fe = (q) => {
3939
+ r("text", q);
3940
+ }, Et = (q, Yt) => {
3941
+ r(q, Yt);
3942
+ }, se = (q) => {
3943
+ r("image", q);
3944
+ }, Ti = () => {
3945
+ re(!ae), Zt(!1);
3946
+ }, Bt = () => {
3947
+ Zt(!jt), re(!1);
3948
+ }, Ne = (q) => {
3949
+ q === "custom" ? r("text") : q === "templates" && xt(!0), re(!1);
3946
3950
  };
3947
- ct(() => {
3948
- Ti(ro.map((V) => V.fontFamily).filter(Boolean));
3951
+ st(() => {
3952
+ zi(ro.map((q) => q.fontFamily).filter(Boolean));
3949
3953
  }, []);
3950
- const Bt = (V) => {
3951
- r("text", { ...V }), oe(!1);
3952
- }, Et = (V) => {
3953
- r(V), de(!1);
3954
+ const he = (q) => {
3955
+ r("text", { ...q }), re(!1);
3956
+ }, bt = (q) => {
3957
+ r(q), Zt(!1);
3954
3958
  }, at = "#475569";
3955
3959
  return /* @__PURE__ */ e.jsxs("div", { className: "toolbar", children: [
3956
3960
  /* @__PURE__ */ e.jsxs("div", { className: "toolbar-section", children: [
@@ -3983,17 +3987,17 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
3983
3987
  )
3984
3988
  ] }),
3985
3989
  /* @__PURE__ */ e.jsx("div", { className: "toolbar-separator" }),
3986
- bt && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
3990
+ St && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
3987
3991
  /* @__PURE__ */ e.jsx("div", { className: "toolbar-group", children: /* @__PURE__ */ e.jsxs(
3988
3992
  "button",
3989
3993
  {
3990
3994
  className: "toolbar-btn compact ai-btn",
3991
3995
  onClick: () => {
3992
- if (!_) {
3993
- O && O();
3996
+ if (!V) {
3997
+ je(!0), O && O();
3994
3998
  return;
3995
3999
  }
3996
- Gt(!0);
4000
+ $t(!0);
3997
4001
  },
3998
4002
  disabled: z,
3999
4003
  title: "AI: generate artwork, images, logos, icons and much more",
@@ -4017,42 +4021,42 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4017
4021
  className: "toolbar-btn compact dropdown-trigger",
4018
4022
  disabled: z,
4019
4023
  title: "Add Text",
4020
- onClick: At,
4024
+ onClick: Ti,
4021
4025
  children: [
4022
4026
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "text", size: 18, color: z ? "#94a3b8" : at }) }),
4023
4027
  /* @__PURE__ */ e.jsx("span", { className: "label", children: "Text" }),
4024
- /* @__PURE__ */ e.jsx("span", { className: `dropdown-arrow ${ee ? "open" : ""}`, children: "▾" })
4028
+ /* @__PURE__ */ e.jsx("span", { className: `dropdown-arrow ${ae ? "open" : ""}`, children: "▾" })
4025
4029
  ]
4026
4030
  }
4027
4031
  ),
4028
- /* @__PURE__ */ e.jsxs("div", { className: `dropdown-menu text-design-menu ${ee ? "show" : ""}`, style: { minWidth: 240 }, children: [
4029
- /* @__PURE__ */ e.jsxs("button", { onClick: () => qe("custom"), children: [
4032
+ /* @__PURE__ */ e.jsxs("div", { className: `dropdown-menu text-design-menu ${ae ? "show" : ""}`, style: { minWidth: 240 }, children: [
4033
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => Ne("custom"), children: [
4030
4034
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "text", size: 16, color: at }) }),
4031
4035
  " Custom text"
4032
4036
  ] }),
4033
4037
  /* @__PURE__ */ e.jsx("div", { style: { padding: "6px 10px 2px", fontSize: 11, fontWeight: 700, color: "#94a3b8", textTransform: "uppercase", letterSpacing: 0.5 }, children: "Design ideas" }),
4034
- ro.map((V) => /* @__PURE__ */ e.jsx(
4038
+ ro.map((q) => /* @__PURE__ */ e.jsx(
4035
4039
  "button",
4036
4040
  {
4037
- onClick: () => Bt(V),
4038
- title: `Add "${V.text}"`,
4041
+ onClick: () => he(q),
4042
+ title: `Add "${q.text}"`,
4039
4043
  style: { justifyContent: "flex-start" },
4040
4044
  children: /* @__PURE__ */ e.jsx("span", { style: {
4041
- fontFamily: `'${V.fontFamily}', cursive`,
4042
- fontWeight: V.fontWeight || "normal",
4043
- fontStyle: V.fontStyle || "normal",
4044
- color: V.fill || "#111827",
4045
+ fontFamily: `'${q.fontFamily}', cursive`,
4046
+ fontWeight: q.fontWeight || "normal",
4047
+ fontStyle: q.fontStyle || "normal",
4048
+ color: q.fill || "#111827",
4045
4049
  fontSize: 18,
4046
4050
  lineHeight: 1.2,
4047
4051
  whiteSpace: "nowrap",
4048
4052
  overflow: "hidden",
4049
4053
  textOverflow: "ellipsis",
4050
- textTransform: V.textTransform || "none"
4051
- }, children: V.text })
4054
+ textTransform: q.textTransform || "none"
4055
+ }, children: q.text })
4052
4056
  },
4053
- V.id
4057
+ q.id
4054
4058
  )),
4055
- /* @__PURE__ */ e.jsxs("button", { onClick: () => qe("templates"), style: { borderTop: "1px solid #e2e8f0", marginTop: 4, color: "#2563eb", fontWeight: 600 }, children: [
4059
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => Ne("templates"), style: { borderTop: "1px solid #e2e8f0", marginTop: 4, color: "#2563eb", fontWeight: 600 }, children: [
4056
4060
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "book", size: 16, color: "#2563eb" }) }),
4057
4061
  " More designs…"
4058
4062
  ] })
@@ -4062,76 +4066,76 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4062
4066
  "button",
4063
4067
  {
4064
4068
  type: "button",
4065
- className: `toolbar-btn compact ${vt ? "active" : ""}`,
4066
- onClick: () => re((V) => !V),
4069
+ className: `toolbar-btn compact ${Y ? "active" : ""}`,
4070
+ onClick: () => Ce((q) => !q),
4067
4071
  title: "More tools (shapes, QR code, barcode, grid)",
4068
4072
  children: [
4069
- /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "gear", size: 18, color: vt ? "#ffffff" : at }) }),
4073
+ /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "gear", size: 18, color: Y ? "#ffffff" : at }) }),
4070
4074
  /* @__PURE__ */ e.jsx("span", { className: "label", children: "More" }),
4071
- /* @__PURE__ */ e.jsx("span", { className: `dropdown-arrow ${vt ? "open" : ""}`, children: "▾" })
4075
+ /* @__PURE__ */ e.jsx("span", { className: `dropdown-arrow ${Y ? "open" : ""}`, children: "▾" })
4072
4076
  ]
4073
4077
  }
4074
4078
  ),
4075
- X && /* @__PURE__ */ e.jsxs("div", { className: "toolbar-dropdown", children: [
4079
+ Vt && /* @__PURE__ */ e.jsxs("div", { className: "toolbar-dropdown", children: [
4076
4080
  /* @__PURE__ */ e.jsxs(
4077
4081
  "button",
4078
4082
  {
4079
4083
  className: "toolbar-btn compact dropdown-trigger",
4080
4084
  disabled: z,
4081
- onClick: se,
4085
+ onClick: Bt,
4082
4086
  children: [
4083
4087
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "shapes", size: 18, color: z ? "#94a3b8" : at }) }),
4084
4088
  /* @__PURE__ */ e.jsx("span", { className: "label", children: "Shapes" }),
4085
- /* @__PURE__ */ e.jsx("span", { className: `dropdown-arrow ${ae ? "open" : ""}`, children: "▾" })
4089
+ /* @__PURE__ */ e.jsx("span", { className: `dropdown-arrow ${jt ? "open" : ""}`, children: "▾" })
4086
4090
  ]
4087
4091
  }
4088
4092
  ),
4089
- /* @__PURE__ */ e.jsxs("div", { className: `dropdown-menu ${ae ? "show" : ""}`, children: [
4090
- /* @__PURE__ */ e.jsxs("button", { onClick: () => Et("rectangle"), children: [
4093
+ /* @__PURE__ */ e.jsxs("div", { className: `dropdown-menu ${jt ? "show" : ""}`, children: [
4094
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => bt("rectangle"), children: [
4091
4095
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "rectangle", size: 16, color: at }) }),
4092
4096
  " Rectangle"
4093
4097
  ] }),
4094
- /* @__PURE__ */ e.jsxs("button", { onClick: () => Et("circle"), children: [
4098
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => bt("circle"), children: [
4095
4099
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "circle", size: 16, color: at }) }),
4096
4100
  " Circle"
4097
4101
  ] }),
4098
- /* @__PURE__ */ e.jsxs("button", { onClick: () => Et("triangle"), children: [
4102
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => bt("triangle"), children: [
4099
4103
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "triangle", size: 16, color: at }) }),
4100
4104
  " Triangle"
4101
4105
  ] }),
4102
- /* @__PURE__ */ e.jsxs("button", { onClick: () => Et("star"), children: [
4106
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => bt("star"), children: [
4103
4107
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "star", size: 16, color: at }) }),
4104
4108
  " Star"
4105
4109
  ] }),
4106
- /* @__PURE__ */ e.jsxs("button", { onClick: () => Et("heart"), children: [
4110
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => bt("heart"), children: [
4107
4111
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "heart", size: 16, color: at }) }),
4108
4112
  " Heart"
4109
4113
  ] }),
4110
- /* @__PURE__ */ e.jsxs("button", { onClick: () => Et("arrow"), children: [
4114
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => bt("arrow"), children: [
4111
4115
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "arrowShape", size: 16, color: at }) }),
4112
4116
  " Arrow"
4113
4117
  ] }),
4114
- /* @__PURE__ */ e.jsxs("button", { onClick: () => Et("diamond"), children: [
4118
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => bt("diamond"), children: [
4115
4119
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "diamond", size: 16, color: at }) }),
4116
4120
  " Diamond"
4117
4121
  ] }),
4118
- /* @__PURE__ */ e.jsxs("button", { onClick: () => Et("hexagon"), children: [
4122
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => bt("hexagon"), children: [
4119
4123
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "hexagon", size: 16, color: at }) }),
4120
4124
  " Hexagon"
4121
4125
  ] }),
4122
- /* @__PURE__ */ e.jsxs("button", { onClick: () => Et("pentagon"), children: [
4126
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => bt("pentagon"), children: [
4123
4127
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "pentagon", size: 16, color: at }) }),
4124
4128
  " Pentagon"
4125
4129
  ] }),
4126
- /* @__PURE__ */ e.jsxs("button", { onClick: () => Et("oval"), children: [
4130
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => bt("oval"), children: [
4127
4131
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "oval", size: 16, color: at }) }),
4128
4132
  " Oval"
4129
4133
  ] }),
4130
- /* @__PURE__ */ e.jsxs("button", { onClick: () => Et("roundedRectangle"), children: [
4134
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => bt("roundedRectangle"), children: [
4131
4135
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "roundedRect", size: 16, color: at }) }),
4132
4136
  " Rounded Rectangle"
4133
4137
  ] }),
4134
- /* @__PURE__ */ e.jsxs("button", { onClick: () => Et("horizontalLine"), children: [
4138
+ /* @__PURE__ */ e.jsxs("button", { onClick: () => bt("horizontalLine"), children: [
4135
4139
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: /* @__PURE__ */ e.jsx(K, { name: "horizontalLine", size: 16, color: at }) }),
4136
4140
  " Horizontal Line"
4137
4141
  ] })
@@ -4146,18 +4150,18 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4146
4150
  {
4147
4151
  type: "file",
4148
4152
  accept: "image/*",
4149
- onChange: je,
4153
+ onChange: qe,
4150
4154
  disabled: z
4151
4155
  }
4152
4156
  )
4153
4157
  ] }),
4154
4158
  /* @__PURE__ */ e.jsx("div", { className: "toolbar-separator" }),
4155
- /* @__PURE__ */ e.jsx(la, { onSelectIcon: Qt, theme: N, disabled: z }),
4159
+ /* @__PURE__ */ e.jsx(la, { onSelectIcon: Xe, theme: N, disabled: z }),
4156
4160
  /* @__PURE__ */ e.jsxs(
4157
4161
  "button",
4158
4162
  {
4159
4163
  className: "toolbar-btn compact",
4160
- onClick: () => U(!0),
4164
+ onClick: () => _(!0),
4161
4165
  disabled: z,
4162
4166
  title: "Add Sticker",
4163
4167
  children: [
@@ -4166,13 +4170,13 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4166
4170
  ]
4167
4171
  }
4168
4172
  ),
4169
- X && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
4173
+ Vt && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
4170
4174
  /* @__PURE__ */ e.jsx("div", { className: "toolbar-separator" }),
4171
4175
  /* @__PURE__ */ e.jsxs(
4172
4176
  "button",
4173
4177
  {
4174
4178
  className: "toolbar-btn compact",
4175
- onClick: () => q(!0),
4179
+ onClick: () => X(!0),
4176
4180
  disabled: z,
4177
4181
  title: "Add QR Code",
4178
4182
  children: [
@@ -4202,7 +4206,7 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4202
4206
  "button",
4203
4207
  {
4204
4208
  className: "toolbar-btn compact",
4205
- onClick: () => St(!0),
4209
+ onClick: () => vt(!0),
4206
4210
  disabled: z,
4207
4211
  title: "Add Embroidery Design",
4208
4212
  children: [
@@ -4259,7 +4263,7 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4259
4263
  )
4260
4264
  ] })
4261
4265
  ] }),
4262
- X && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
4266
+ Vt && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
4263
4267
  /* @__PURE__ */ e.jsx("div", { className: "toolbar-separator" }),
4264
4268
  /* @__PURE__ */ e.jsxs("div", { className: "toolbar-group", children: [
4265
4269
  /* @__PURE__ */ e.jsxs(
@@ -4317,8 +4321,8 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4317
4321
  ca,
4318
4322
  {
4319
4323
  isOpen: v,
4320
- onClose: () => q(!1),
4321
- onAddQRCode: Ue,
4324
+ onClose: () => X(!1),
4325
+ onAddQRCode: de,
4322
4326
  theme: N
4323
4327
  }
4324
4328
  ),
@@ -4327,7 +4331,7 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4327
4331
  {
4328
4332
  isOpen: P,
4329
4333
  onClose: () => g(!1),
4330
- onAddBarcode: Ye,
4334
+ onAddBarcode: Ut,
4331
4335
  theme: N
4332
4336
  }
4333
4337
  ),
@@ -4335,8 +4339,8 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4335
4339
  fa,
4336
4340
  {
4337
4341
  isOpen: M,
4338
- onClose: () => U(!1),
4339
- onAddSticker: he,
4342
+ onClose: () => _(!1),
4343
+ onAddSticker: ne,
4340
4344
  theme: N,
4341
4345
  apiKey: it,
4342
4346
  apiEndpoint: J
@@ -4346,8 +4350,8 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4346
4350
  ma,
4347
4351
  {
4348
4352
  isOpen: ot,
4349
- onClose: () => St(!1),
4350
- onAddEmbroidery: _t,
4353
+ onClose: () => vt(!1),
4354
+ onAddEmbroidery: Wt,
4351
4355
  theme: N,
4352
4356
  apiKey: it,
4353
4357
  apiEndpoint: J
@@ -4358,30 +4362,30 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4358
4362
  {
4359
4363
  isOpen: ft,
4360
4364
  onClose: () => Rt(!1),
4361
- onAddHandcraft: ne,
4365
+ onAddHandcraft: Fe,
4362
4366
  theme: N
4363
4367
  }
4364
4368
  ),
4365
4369
  /* @__PURE__ */ e.jsx(
4366
4370
  Sa,
4367
4371
  {
4368
- isOpen: Ct,
4372
+ isOpen: Ft,
4369
4373
  onClose: () => xt(!1),
4370
- onAddText: Wt,
4374
+ onAddText: Et,
4371
4375
  theme: N
4372
4376
  }
4373
4377
  ),
4374
- bt && /* @__PURE__ */ e.jsx(
4378
+ St && /* @__PURE__ */ e.jsx(
4375
4379
  va,
4376
4380
  {
4377
- isOpen: Ft,
4378
- onClose: () => Gt(!1),
4379
- onAddImage: Ce,
4381
+ isOpen: Nt,
4382
+ onClose: () => $t(!1),
4383
+ onAddImage: se,
4380
4384
  theme: N,
4381
4385
  apiKey: it,
4382
4386
  apiEndpoint: J,
4383
4387
  aiEndpoint: pt,
4384
- onAIImageGenerate: zt
4388
+ onAIImageGenerate: Tt
4385
4389
  }
4386
4390
  )
4387
4391
  ] });
@@ -4389,9 +4393,9 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4389
4393
  }, onFontLoaded: n = () => {
4390
4394
  } }) => {
4391
4395
  const [s, l] = E(!1), [h, f] = E(""), w = dt(null);
4392
- ct(() => {
4393
- s && $e(no);
4394
- }, [s]), ct(() => {
4396
+ st(() => {
4397
+ s && Ge(no);
4398
+ }, [s]), st(() => {
4395
4399
  if (!s) return;
4396
4400
  const F = (S) => {
4397
4401
  w.current && !w.current.contains(S.target) && l(!1);
@@ -4402,9 +4406,9 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4402
4406
  document.removeEventListener("mousedown", F), document.removeEventListener("keydown", T);
4403
4407
  };
4404
4408
  }, [s]);
4405
- const k = wi(() => {
4409
+ const k = vi(() => {
4406
4410
  const F = h.trim().toLowerCase();
4407
- return F ? ji.map((T) => ({ ...T, fonts: T.fonts.filter((S) => S.toLowerCase().includes(F)) })).filter((T) => T.fonts.length > 0) : ji;
4411
+ return F ? ki.map((T) => ({ ...T, fonts: T.fonts.filter((S) => S.toLowerCase().includes(F)) })).filter((T) => T.fonts.length > 0) : ki;
4408
4412
  }, [h]), A = async (F) => {
4409
4413
  o(F), l(!1), f(""), await so(F), n();
4410
4414
  };
@@ -4487,7 +4491,7 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4487
4491
  "button",
4488
4492
  {
4489
4493
  type: "button",
4490
- onMouseEnter: () => $e([T]),
4494
+ onMouseEnter: () => Ge([T]),
4491
4495
  onClick: () => A(T),
4492
4496
  style: {
4493
4497
  width: "100%",
@@ -4516,7 +4520,7 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4516
4520
  }
4517
4521
  )
4518
4522
  ] });
4519
- }, He = [
4523
+ }, Ve = [
4520
4524
  { name: "White", hex: "#FFFFFF" },
4521
4525
  { name: "Ecru", hex: "#F3EAD3" },
4522
4526
  { name: "Cream", hex: "#F7E9C3" },
@@ -4557,7 +4561,7 @@ const Ot = (r, o, n, { text: s, font: l, sysFont: h, ink: f, card: w, size: k =
4557
4561
  { name: "Gold Metallic", hex: "#C8A53B" },
4558
4562
  { name: "Silver Metallic", hex: "#B6BCC4" }
4559
4563
  ];
4560
- function Fi(r) {
4564
+ function Ci(r) {
4561
4565
  if (!r) return null;
4562
4566
  let o = String(r).trim().replace("#", "");
4563
4567
  if (o.length === 3 && (o = o.split("").map((s) => s + s).join("")), o.length !== 6) return null;
@@ -4569,19 +4573,19 @@ function Ca(r, o) {
4569
4573
  return (2 + n / 256) * s * s + 4 * l * l + (2 + (255 - n) / 256) * h * h;
4570
4574
  }
4571
4575
  function Fa(r) {
4572
- const o = Fi(r);
4573
- if (!o) return He[0];
4574
- let n = He[0], s = 1 / 0;
4575
- for (const l of He) {
4576
- const h = Fi(l.hex), f = Ca(o, h);
4576
+ const o = Ci(r);
4577
+ if (!o) return Ve[0];
4578
+ let n = Ve[0], s = 1 / 0;
4579
+ for (const l of Ve) {
4580
+ const h = Ci(l.hex), f = Ca(o, h);
4577
4581
  f < s && (s = f, n = l);
4578
4582
  }
4579
4583
  return n;
4580
4584
  }
4581
4585
  function Na(r) {
4582
- return Fi(r) ? Fa(r).hex : r;
4586
+ return Ci(r) ? Fa(r).hex : r;
4583
4587
  }
4584
- const bi = {
4588
+ const xi = {
4585
4589
  widthIn: 12,
4586
4590
  // physical print-area width in inches
4587
4591
  dpi: 300,
@@ -4589,24 +4593,24 @@ const bi = {
4589
4593
  safeAreaPct: 5
4590
4594
  // safe-area inset (% of each edge) kept clear of trims/seams
4591
4595
  }, za = 6e3;
4592
- function _e(r) {
4596
+ function Ye(r) {
4593
4597
  const o = r || {};
4594
4598
  return {
4595
- widthIn: Number(o.widthIn) > 0 ? Number(o.widthIn) : bi.widthIn,
4596
- dpi: Number(o.dpi) > 0 ? Number(o.dpi) : bi.dpi,
4597
- safeAreaPct: Number.isFinite(Number(o.safeAreaPct)) ? Math.min(40, Math.max(0, Number(o.safeAreaPct))) : bi.safeAreaPct
4599
+ widthIn: Number(o.widthIn) > 0 ? Number(o.widthIn) : xi.widthIn,
4600
+ dpi: Number(o.dpi) > 0 ? Number(o.dpi) : xi.dpi,
4601
+ safeAreaPct: Number.isFinite(Number(o.safeAreaPct)) ? Math.min(40, Math.max(0, Number(o.safeAreaPct))) : xi.safeAreaPct
4598
4602
  };
4599
4603
  }
4600
4604
  function Ta(r, o, n) {
4601
- const { widthIn: s, dpi: l } = _e(n);
4605
+ const { widthIn: s, dpi: l } = Ye(n);
4602
4606
  if (!(r > 0)) return 1;
4603
4607
  let f = s * l / r;
4604
4608
  f = Math.max(1, f);
4605
4609
  const w = Math.max(r, o || r), k = za / w;
4606
4610
  return Math.min(f, Math.max(1, k));
4607
4611
  }
4608
- function Ni(r, o) {
4609
- const { widthIn: n } = _e(o);
4612
+ function Fi(r, o) {
4613
+ const { widthIn: n } = Ye(o);
4610
4614
  return r > 0 ? n / r : 0;
4611
4615
  }
4612
4616
  function co(r, o, n) {
@@ -4617,11 +4621,11 @@ function co(r, o, n) {
4617
4621
  if (!(l > 0)) return null;
4618
4622
  const h = r.width || 0;
4619
4623
  if (!(h > 0)) return null;
4620
- const f = h * Ni(o, n);
4624
+ const f = h * Fi(o, n);
4621
4625
  return f > 0 ? l / f : null;
4622
4626
  }
4623
4627
  function ho(r, o) {
4624
- const { dpi: n } = _e(o);
4628
+ const { dpi: n } = Ye(o);
4625
4629
  return r == null ? null : r >= n ? { level: "good", color: "#16a34a", label: "Print quality: Excellent" } : r >= n / 2 ? { level: "warn", color: "#d97706", label: "Print quality: Acceptable — may look soft" } : { level: "bad", color: "#dc2626", label: "Print quality: Too low — will look blurry" };
4626
4630
  }
4627
4631
  const Ma = ({
@@ -4691,10 +4695,10 @@ const Ma = ({
4691
4695
  /* @__PURE__ */ e.jsx("h3", { children: "Properties" }),
4692
4696
  /* @__PURE__ */ e.jsx("p", { className: "no-selection", children: "Select an element to edit its properties" })
4693
4697
  ] });
4694
- const j = (v, q) => {
4695
- n(r.id, { [v]: q });
4698
+ const j = (v, X) => {
4699
+ n(r.id, { [v]: X });
4696
4700
  }, it = () => {
4697
- var v, q, P;
4701
+ var v, X, P;
4698
4702
  return /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
4699
4703
  /* @__PURE__ */ e.jsx("h4", { children: "Text Content" }),
4700
4704
  /* @__PURE__ */ e.jsxs("div", { className: "property-row", children: [
@@ -4869,7 +4873,7 @@ const Ma = ({
4869
4873
  {
4870
4874
  className: (v = r.textDecoration) != null && v.includes("underline") ? "active" : "",
4871
4875
  onClick: () => {
4872
- const g = r.textDecoration || "", M = g.split(" ").filter((U) => U && U !== "underline");
4876
+ const g = r.textDecoration || "", M = g.split(" ").filter((_) => _ && _ !== "underline");
4873
4877
  g.includes("underline") || M.push("underline"), j("textDecoration", M.join(" ").trim());
4874
4878
  },
4875
4879
  title: "Underline",
@@ -4879,9 +4883,9 @@ const Ma = ({
4879
4883
  /* @__PURE__ */ e.jsx(
4880
4884
  "button",
4881
4885
  {
4882
- className: (q = r.textDecoration) != null && q.includes("overline") ? "active" : "",
4886
+ className: (X = r.textDecoration) != null && X.includes("overline") ? "active" : "",
4883
4887
  onClick: () => {
4884
- const g = r.textDecoration || "", M = g.split(" ").filter((U) => U && U !== "overline");
4888
+ const g = r.textDecoration || "", M = g.split(" ").filter((_) => _ && _ !== "overline");
4885
4889
  g.includes("overline") || M.push("overline"), j("textDecoration", M.join(" ").trim());
4886
4890
  },
4887
4891
  title: "Overline",
@@ -4893,7 +4897,7 @@ const Ma = ({
4893
4897
  {
4894
4898
  className: (P = r.textDecoration) != null && P.includes("line-through") ? "active" : "",
4895
4899
  onClick: () => {
4896
- const g = r.textDecoration || "", M = g.split(" ").filter((U) => U && U !== "line-through");
4900
+ const g = r.textDecoration || "", M = g.split(" ").filter((_) => _ && _ !== "line-through");
4897
4901
  g.includes("line-through") || M.push("line-through"), j("textDecoration", M.join(" ").trim());
4898
4902
  },
4899
4903
  title: "Strikethrough",
@@ -5000,7 +5004,7 @@ const Ma = ({
5000
5004
  {
5001
5005
  title: "Real thread colours",
5002
5006
  style: { display: "flex", flexWrap: "wrap", gap: 4, marginTop: 6, maxWidth: 200 },
5003
- children: He.map((g) => /* @__PURE__ */ e.jsx(
5007
+ children: Ve.map((g) => /* @__PURE__ */ e.jsx(
5004
5008
  "button",
5005
5009
  {
5006
5010
  type: "button",
@@ -5316,7 +5320,7 @@ const Ma = ({
5316
5320
  }
5317
5321
  )
5318
5322
  ] })
5319
- ] }), bt = async () => {
5323
+ ] }), St = async () => {
5320
5324
  if (!(!I || N)) {
5321
5325
  z(!0), L("");
5322
5326
  try {
@@ -5327,13 +5331,13 @@ const Ma = ({
5327
5331
  z(!1);
5328
5332
  }
5329
5333
  }
5330
- }, pt = ["image", "sticker", "embroidery"], zt = () => !I || !pt.includes(r.type) ? null : /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
5334
+ }, pt = ["image", "sticker", "embroidery"], Tt = () => !I || !pt.includes(r.type) ? null : /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
5331
5335
  /* @__PURE__ */ e.jsx(
5332
5336
  "button",
5333
5337
  {
5334
5338
  type: "button",
5335
5339
  className: "remove-bg-btn",
5336
- onClick: bt,
5340
+ onClick: St,
5337
5341
  disabled: N,
5338
5342
  style: {
5339
5343
  width: "100%",
@@ -5354,7 +5358,7 @@ const Ma = ({
5354
5358
  }
5355
5359
  ),
5356
5360
  b && /* @__PURE__ */ e.jsx("div", { style: { marginTop: 6, fontSize: 12, color: "#dc2626" }, children: b })
5357
- ] }), _ = () => /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
5361
+ ] }), V = () => /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
5358
5362
  /* @__PURE__ */ e.jsx("h4", { children: "Image Properties" }),
5359
5363
  /* @__PURE__ */ e.jsxs("div", { className: "property-row", children: [
5360
5364
  /* @__PURE__ */ e.jsx("label", { children: "Opacity" }),
@@ -5552,8 +5556,8 @@ const Ma = ({
5552
5556
  type: "number",
5553
5557
  value: r.strokeWidth || r.height || 2,
5554
5558
  onChange: (v) => {
5555
- const q = parseInt(v.target.value);
5556
- j("strokeWidth", q), j("height", q);
5559
+ const X = parseInt(v.target.value);
5560
+ j("strokeWidth", X), j("height", X);
5557
5561
  },
5558
5562
  min: "1",
5559
5563
  max: "50"
@@ -5600,7 +5604,7 @@ const Ma = ({
5600
5604
  )
5601
5605
  ] })
5602
5606
  ] })
5603
- ] }), st = () => /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
5607
+ ] }), lt = () => /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
5604
5608
  /* @__PURE__ */ e.jsx("h4", { children: "Layer Controls" }),
5605
5609
  /* @__PURE__ */ e.jsxs("div", { className: "button-group vertical", children: [
5606
5610
  /* @__PURE__ */ e.jsx("button", { onClick: () => s(r.id, "top"), children: "Bring to Front" }),
@@ -5623,28 +5627,28 @@ const Ma = ({
5623
5627
  ], yt = () => {
5624
5628
  const v = co(r, T, B);
5625
5629
  if (v == null) return null;
5626
- const q = ho(v, B);
5627
- return q ? /* @__PURE__ */ e.jsxs(
5630
+ const X = ho(v, B);
5631
+ return X ? /* @__PURE__ */ e.jsxs(
5628
5632
  "div",
5629
5633
  {
5630
5634
  className: "property-group dpi-meter",
5631
- style: { borderLeft: `4px solid ${q.color}`, paddingLeft: 10 },
5635
+ style: { borderLeft: `4px solid ${X.color}`, paddingLeft: 10 },
5632
5636
  children: [
5633
5637
  /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
5634
5638
  /* @__PURE__ */ e.jsx("span", { style: {
5635
5639
  width: 9,
5636
5640
  height: 9,
5637
5641
  borderRadius: "50%",
5638
- background: q.color,
5642
+ background: X.color,
5639
5643
  flex: "0 0 auto"
5640
5644
  } }),
5641
- /* @__PURE__ */ e.jsxs("strong", { style: { color: q.color, fontSize: 13 }, children: [
5645
+ /* @__PURE__ */ e.jsxs("strong", { style: { color: X.color, fontSize: 13 }, children: [
5642
5646
  Math.round(v),
5643
5647
  " DPI"
5644
5648
  ] })
5645
5649
  ] }),
5646
- /* @__PURE__ */ e.jsx("div", { style: { fontSize: 12, color: "#475569", marginTop: 2 }, children: q.label }),
5647
- q.level !== "good" && /* @__PURE__ */ e.jsx("div", { style: { fontSize: 11, color: "#64748b", marginTop: 4 }, children: "Make it smaller on the canvas or upload a higher-resolution image." })
5650
+ /* @__PURE__ */ e.jsx("div", { style: { fontSize: 12, color: "#475569", marginTop: 2 }, children: X.label }),
5651
+ X.level !== "good" && /* @__PURE__ */ e.jsx("div", { style: { fontSize: 11, color: "#64748b", marginTop: 4 }, children: "Make it smaller on the canvas or upload a higher-resolution image." })
5648
5652
  ]
5649
5653
  }
5650
5654
  ) : null;
@@ -5656,13 +5660,13 @@ const Ma = ({
5656
5660
  ] }),
5657
5661
  /* @__PURE__ */ e.jsxs("div", { className: "panel-content", children: [
5658
5662
  yt(),
5659
- zt(),
5663
+ Tt(),
5660
5664
  r.type === "text" && it(),
5661
5665
  rt.includes(r.type) && J(),
5662
- r.type === "image" && _(),
5666
+ r.type === "image" && V(),
5663
5667
  r.type === "horizontalLine" && R(),
5664
5668
  O(),
5665
- st(),
5669
+ lt(),
5666
5670
  /* @__PURE__ */ e.jsx("div", { className: "property-group", children: /* @__PURE__ */ e.jsxs(
5667
5671
  "button",
5668
5672
  {
@@ -5795,19 +5799,19 @@ const Ma = ({
5795
5799
  )) })
5796
5800
  ] });
5797
5801
  };
5798
- let Si = null;
5802
+ let bi = null;
5799
5803
  function Ea() {
5800
- if (Si) return Si;
5804
+ if (bi) return bi;
5801
5805
  if (typeof document > "u") return null;
5802
5806
  const r = document.createElement("canvas");
5803
5807
  r.width = 6, r.height = 6;
5804
5808
  const o = r.getContext("2d");
5805
- return o.strokeStyle = "rgba(255,255,255,0.34)", o.lineWidth = 1.7, o.lineCap = "round", o.beginPath(), o.moveTo(-2, 8), o.lineTo(8, -2), o.stroke(), o.strokeStyle = "rgba(0,0,0,0.16)", o.lineWidth = 1.1, o.beginPath(), o.moveTo(1.5, 8), o.lineTo(8, 1.5), o.stroke(), Si = r, r;
5809
+ return o.strokeStyle = "rgba(255,255,255,0.34)", o.lineWidth = 1.7, o.lineCap = "round", o.beginPath(), o.moveTo(-2, 8), o.lineTo(8, -2), o.stroke(), o.strokeStyle = "rgba(0,0,0,0.16)", o.lineWidth = 1.1, o.beginPath(), o.moveTo(1.5, 8), o.lineTo(8, 1.5), o.stroke(), bi = r, r;
5806
5810
  }
5807
- function vi(r) {
5811
+ function Si(r) {
5808
5812
  return r ? (r.productionMethods || []).map((n) => String(n).toUpperCase()).includes("EMBROIDERY") || r.supportsEmbroidery === "Y" : !1;
5809
5813
  }
5810
- function Ve(r, o, n, { fontSize: s = 20, color: l = "#1f6feb" } = {}) {
5814
+ function _e(r, o, n, { fontSize: s = 20, color: l = "#1f6feb" } = {}) {
5811
5815
  const h = Na(l || "#1f6feb"), f = r.globalAlpha === void 0 ? 1 : r.globalAlpha, w = (() => {
5812
5816
  const k = Ea();
5813
5817
  try {
@@ -5847,7 +5851,7 @@ class Ia {
5847
5851
  B && B.type === "text" && B.fontFamily && F.push(B.fontFamily);
5848
5852
  });
5849
5853
  }
5850
- await Ti(F), typeof document < "u" && document.fonts && document.fonts.ready && await document.fonts.ready;
5854
+ await zi(F), typeof document < "u" && document.fonts && document.fonts.ready && await document.fonts.ready;
5851
5855
  } catch {
5852
5856
  }
5853
5857
  for (const F of n) {
@@ -6009,7 +6013,7 @@ class Ia {
6009
6013
  }
6010
6014
  s.forEach((f, w) => {
6011
6015
  const k = w * l;
6012
- h ? Ve(this.ctx, f, k, { fontSize: o.fontSize || 20, color: o.fill || "#000000" }) : (o.stroke && o.strokeWidth > 0 && this.ctx.strokeText(f, 0, k), this.ctx.fillText(f, 0, k));
6016
+ h ? _e(this.ctx, f, k, { fontSize: o.fontSize || 20, color: o.fill || "#000000" }) : (o.stroke && o.strokeWidth > 0 && this.ctx.strokeText(f, 0, k), this.ctx.fillText(f, 0, k));
6013
6017
  });
6014
6018
  }
6015
6019
  // Arc text along a circle — same geometry as the editor's drawCurvedText.
@@ -6026,7 +6030,7 @@ class Ia {
6026
6030
  h.textAlign = "center", h.textBaseline = "middle", h.save(), h.translate(B, I), h.rotate(-S * F / 2);
6027
6031
  for (let j = 0; j < f.length; j++) {
6028
6032
  const it = k[j] / T;
6029
- if (h.rotate(S * it / 2), h.save(), h.translate(0, -S * T), l ? Ve(h, f[j], 0, { fontSize: w, color: o.fill || "#000000" }) : (H && h.strokeText(f[j], 0, 0), h.fillText(f[j], 0, 0)), z) {
6033
+ if (h.rotate(S * it / 2), h.save(), h.translate(0, -S * T), l ? _e(h, f[j], 0, { fontSize: w, color: o.fill || "#000000" }) : (H && h.strokeText(f[j], 0, 0), h.fillText(f[j], 0, 0)), z) {
6030
6034
  const J = k[j];
6031
6035
  h.strokeStyle = b, h.lineWidth = L, h.setLineDash && h.setLineDash([]), N.underline && (h.beginPath(), h.moveTo(-J / 2, w / 2 + 2), h.lineTo(J / 2, w / 2 + 2), h.stroke()), N.overline && (h.beginPath(), h.moveTo(-J / 2, -(w / 2 + 2)), h.lineTo(J / 2, -(w / 2 + 2)), h.stroke()), N.strike && (h.beginPath(), h.moveTo(-J / 2, 0), h.lineTo(J / 2, 0), h.stroke());
6032
6036
  }
@@ -6683,7 +6687,7 @@ const Wa = (r, o) => {
6683
6687
  };
6684
6688
  clearTimeout(n), n = setTimeout(h, o);
6685
6689
  };
6686
- }, Oe = [
6690
+ }, $e = [
6687
6691
  { key: "make-it-yours", title: "Make it yours", body: "Add your text, upload a logo, or drag artwork straight onto the product to bring your design to life." },
6688
6692
  { key: "start-creating", title: "Start creating", body: "Drop in your logo, type a slogan, or add artwork — your custom product takes shape as you go." },
6689
6693
  { key: "design-in-seconds", title: "Design yours in seconds", body: "Add text or upload an image to get started — no design skills needed." }
@@ -6755,8 +6759,8 @@ const Wa = (r, o) => {
6755
6759
  // key) to pin a specific variant from EMPTY_STATE_VARIANTS; the host's
6756
6760
  // experiment framework decides the bucket. Defaults to the first variant.
6757
6761
  emptyStateVariant: Q = 0
6758
- } = r, [N, z] = E([]), [b, L] = E(null), [j, it] = E([]), [J, bt] = E(!1), [pt, zt] = E(!1), [_, O] = E(!1), [R, st] = E({ x: 0, y: 0 }), [rt, yt] = E(null), [v, q] = E(600), [P, g] = E(600), [M, U] = E(1), [ot, St] = E(h || ((Xi = f.colorSettings) == null ? void 0 : Xi[0])), [ft, Rt] = E(!1), [Ct, xt] = E(l !== "customize"), [Ft, Gt] = E(!0), [ee, oe] = E(!1), [ae, de] = E(l !== "customize"), vt = _e(A), re = Ta(v, P, vt);
6759
- ct(() => {
6762
+ } = r, [N, z] = E([]), [b, L] = E(null), [j, it] = E([]), [J, St] = E(!1), [pt, Tt] = E(!1), [V, O] = E(!1), [R, lt] = E({ x: 0, y: 0 }), [rt, yt] = E(null), [v, X] = E(600), [P, g] = E(600), [M, _] = E(1), [ot, vt] = E(h || ((Xi = f.colorSettings) == null ? void 0 : Xi[0])), [ft, Rt] = E(!1), [Ft, xt] = E(l !== "customize"), [Nt, $t] = E(!0), [oe, je] = E(!1), [ae, re] = E(l !== "customize"), jt = Ye(A), Zt = Ta(v, P, jt);
6763
+ st(() => {
6760
6764
  if (!b) {
6761
6765
  it((i) => i.length ? [] : i);
6762
6766
  return;
@@ -6765,41 +6769,41 @@ const Wa = (r, o) => {
6765
6769
  (i) => i.length > 1 && i.includes(b.id) ? i : [b.id]
6766
6770
  );
6767
6771
  }, [b]);
6768
- const [X, je] = E(f.sections[0]), [Qt, Ue] = E(!1), [Ye, he] = E(!1), [_t, ne] = E({}), [Wt, Ce] = E([]), [At, se] = E(-1), [qe] = E(new Ra("localStorage")), Bt = dt(null), Et = dt(null), at = dt(null), V = dt(null), Ut = dt({ v: [], h: [] }), Xe = dt([]), Qe = dt([]), Ze = dt(null), fe = dt(null), ge = dt(null), Mi = dt(null), ue = dt(null), Yt = dt(null), fo = dt(null), me = dt(new Ia()), go = dt(!1), [pe, Ai] = E(null), mt = Nt(() => {
6772
+ const [Y, Ce] = E(f.sections[0]), [Vt, qe] = E(!1), [Xe, de] = E(!1), [Ut, ne] = E({}), [Wt, Fe] = E([]), [Et, se] = E(-1), [Ti] = E(new Ra("localStorage")), Bt = dt(null), Ne = dt(null), he = dt(null), bt = dt(null), at = dt({ v: [], h: [] }), q = dt([]), Yt = dt([]), Qe = dt(null), fe = dt(null), ge = dt(null), Mi = dt(null), ue = dt(null), qt = dt(null), fo = dt(null), me = dt(new Ia()), go = dt(!1), [pe, Ai] = E(null), mt = zt(() => {
6769
6773
  const i = {
6770
6774
  elements: JSON.parse(JSON.stringify(N)),
6771
6775
  selectedElement: b ? { ...b } : null,
6772
6776
  timestamp: Date.now()
6773
- }, t = Wt.slice(0, At + 1);
6774
- t.push(i), t.length > 50 ? t.shift() : se(At + 1), Ce(t);
6775
- }, [N, b, Wt, At]), ye = Nt(() => ({
6777
+ }, t = Wt.slice(0, Et + 1);
6778
+ t.push(i), t.length > 50 ? t.shift() : se(Et + 1), Fe(t);
6779
+ }, [N, b, Wt, Et]), ye = zt(() => ({
6776
6780
  elements: N,
6777
6781
  canvasWidth: v,
6778
6782
  canvasHeight: P,
6779
6783
  selectedColor: ot,
6780
- activeSection: X,
6784
+ activeSection: Y,
6781
6785
  product: f,
6782
- sectionDesigns: _t,
6786
+ sectionDesigns: Ut,
6783
6787
  zoomLevel: M,
6784
6788
  showGrid: ft,
6785
- snapToGrid: Ft,
6789
+ snapToGrid: Nt,
6786
6790
  selectedElement: b ? { ...b } : null,
6787
6791
  canvasRef: Bt
6788
6792
  // Include reference for thumbnail generation
6789
- }), [N, v, P, ot, X, f, _t, M, ft, Ft, b]), Ei = (i) => {
6793
+ }), [N, v, P, ot, Y, f, Ut, M, ft, Nt, b]), Ei = (i) => {
6790
6794
  if (i.sections && typeof i.sections == "object") {
6791
6795
  const t = Object.keys(i.sections)[0], a = i.sections[t];
6792
6796
  if (a && a.elements) {
6793
- z(a.elements || []), q(a.canvasWidth || 800), g(a.canvasHeight || 600), St(a.selectedColor || f.colorSettings[0]), U(a.zoomLevel || 1), Rt(a.showGrid || !1), Gt(a.snapToGrid || !0), L(null), i.sections && ne(i.sections);
6797
+ z(a.elements || []), X(a.canvasWidth || 800), g(a.canvasHeight || 600), vt(a.selectedColor || f.colorSettings[0]), _(a.zoomLevel || 1), Rt(a.showGrid || !1), $t(a.snapToGrid || !0), L(null), i.sections && ne(i.sections);
6794
6798
  const c = f.sections.find((m) => m.sectionName === t);
6795
- c && je(c), Ce([]), se(-1), setTimeout(() => {
6799
+ c && Ce(c), Fe([]), se(-1), setTimeout(() => {
6796
6800
  mt();
6797
6801
  }, 100);
6798
6802
  return;
6799
6803
  }
6800
6804
  }
6801
6805
  };
6802
- ct(() => {
6806
+ st(() => {
6803
6807
  const t = setTimeout(async () => {
6804
6808
  if (N.length === 0 && Wt.length <= 1) {
6805
6809
  if (k)
@@ -6827,36 +6831,36 @@ const Wa = (r, o) => {
6827
6831
  }, 300);
6828
6832
  return () => clearTimeout(t);
6829
6833
  }, [w, k, f.colorSettings, f.sections]);
6830
- const Ke = Nt((i = "png", t = !0) => {
6834
+ const Ze = zt((i = "png", t = !0) => {
6831
6835
  const a = ye();
6832
6836
  return f.sections, me.current.exportAllSections(
6833
- { [(X == null ? void 0 : X.sectionName) || "main"]: a },
6837
+ { [(Y == null ? void 0 : Y.sectionName) || "main"]: a },
6834
6838
  [{
6835
- id: (X == null ? void 0 : X.sectionName) || "main",
6836
- sectionName: (X == null ? void 0 : X.sectionName) || "main",
6837
- image: X == null ? void 0 : X.sectionImage,
6838
- sectionImage: X == null ? void 0 : X.sectionImage
6839
+ id: (Y == null ? void 0 : Y.sectionName) || "main",
6840
+ sectionName: (Y == null ? void 0 : Y.sectionName) || "main",
6841
+ image: Y == null ? void 0 : Y.sectionImage,
6842
+ sectionImage: Y == null ? void 0 : Y.sectionImage
6839
6843
  }],
6840
6844
  v,
6841
6845
  P,
6842
6846
  i,
6843
6847
  t,
6844
6848
  pe,
6845
- re
6849
+ Zt
6846
6850
  );
6847
- }, [ye, f.sections, X, v, P, re]), uo = no, Fe = 20;
6848
- ct(() => {
6849
- const i = () => Ue(window.innerWidth < 768);
6851
+ }, [ye, f.sections, Y, v, P, Zt]), uo = no, ze = 20;
6852
+ st(() => {
6853
+ const i = () => qe(window.innerWidth < 768);
6850
6854
  return i(), window.addEventListener("resize", i), () => window.removeEventListener("resize", i);
6851
- }, []), ct(() => {
6855
+ }, []), st(() => {
6852
6856
  const i = document.createElement("canvas");
6853
6857
  i.width = v, i.height = P, fo.current = i;
6854
- }, [v, P]), ct(() => {
6858
+ }, [v, P]), st(() => {
6855
6859
  Wt.length === 0 && mt();
6856
6860
  }, []);
6857
- const Zt = (i, t, a, c, m, u) => {
6861
+ const Kt = (i, t, a, c, m, u) => {
6858
6862
  i.beginPath(), i.moveTo(t + u, a), i.lineTo(t + c - u, a), i.quadraticCurveTo(t + c, a, t + c, a + u), i.lineTo(t + c, a + m - u), i.quadraticCurveTo(t + c, a + m, t + c - u, a + m), i.lineTo(t + u, a + m), i.quadraticCurveTo(t, a + m, t, a + m - u), i.lineTo(t, a + u), i.quadraticCurveTo(t, a, t + u, a), i.closePath();
6859
- }, Ne = (i, t) => {
6863
+ }, Te = (i, t) => {
6860
6864
  if (t.type === "text" && !t.isIcon) {
6861
6865
  i.save(), i.font = `${t.fontStyle || "normal"} ${t.fontWeight || "normal"} ${t.fontSize || 20}px ${t.fontFamily || "Arial"}`;
6862
6866
  try {
@@ -6872,14 +6876,14 @@ const Wa = (r, o) => {
6872
6876
  et = et.toLowerCase();
6873
6877
  break;
6874
6878
  case "capitalize":
6875
- et = et.replace(/\b\w/g, (jt) => jt.toUpperCase());
6879
+ et = et.replace(/\b\w/g, (Ct) => Ct.toUpperCase());
6876
6880
  break;
6877
6881
  }
6878
6882
  const gt = et.split(`
6879
- `), W = Math.max(1, ...gt.map((jt) => i.measureText(jt || " ").width)), lt = (t.fontSize || 20) * (t.lineHeight || 1.2), It = Math.max(t.fontSize || 20, gt.length * lt);
6883
+ `), W = Math.max(1, ...gt.map((Ct) => i.measureText(Ct || " ").width)), ct = (t.fontSize || 20) * (t.lineHeight || 1.2), It = Math.max(t.fontSize || 20, gt.length * ct);
6880
6884
  i.restore();
6881
- const wt = t.textAlign || "left", kt = wt === "center" ? t.x - W / 2 : wt === "right" ? t.x - W : t.x, Tt = t.y;
6882
- return { x: kt, y: Tt, width: W, height: It, cx: kt + W / 2, cy: Tt + It / 2 };
6885
+ const wt = t.textAlign || "left", kt = wt === "center" ? t.x - W / 2 : wt === "right" ? t.x - W : t.x, Mt = t.y;
6886
+ return { x: kt, y: Mt, width: W, height: It, cx: kt + W / 2, cy: Mt + It / 2 };
6883
6887
  }
6884
6888
  if (!t.isIcon)
6885
6889
  return {
@@ -6895,7 +6899,7 @@ const Wa = (r, o) => {
6895
6899
  return i.restore(), { x: D, y: G, width: d, height: p, cx: x, cy: C };
6896
6900
  }, mo = (i, t) => {
6897
6901
  if (!t) return;
6898
- const a = 8, c = 8, m = 4, u = 30, y = Ne(i, t), d = t.isIcon ? Math.max(a, 12) : a, p = {
6902
+ const a = 8, c = 8, m = 4, u = 30, y = Te(i, t), d = t.isIcon ? Math.max(a, 12) : a, p = {
6899
6903
  x: -y.width / 2 - d,
6900
6904
  y: -y.height / 2 - d,
6901
6905
  w: y.width + d * 2,
@@ -6908,14 +6912,14 @@ const Wa = (r, o) => {
6908
6912
  p.x + p.w,
6909
6913
  p.y + p.h
6910
6914
  );
6911
- if (x.addColorStop(0, "#3b82f6"), x.addColorStop(0.5, "#1d4ed8"), x.addColorStop(1, "#3b82f6"), i.strokeStyle = "rgba(59,130,246,.3)", i.lineWidth = 3, Zt(
6915
+ if (x.addColorStop(0, "#3b82f6"), x.addColorStop(0.5, "#1d4ed8"), x.addColorStop(1, "#3b82f6"), i.strokeStyle = "rgba(59,130,246,.3)", i.lineWidth = 3, Kt(
6912
6916
  i,
6913
6917
  p.x - 1,
6914
6918
  p.y - 1,
6915
6919
  p.w + 2,
6916
6920
  p.h + 2,
6917
6921
  m + 1
6918
- ), i.stroke(), i.strokeStyle = x, i.lineWidth = 2, i.setLineDash([8, 4]), Zt(i, p.x, p.y, p.w, p.h, m), i.stroke(), i.lineDashOffset = -(Date.now() / 50) % 12, i.strokeStyle = "#ffffff", i.lineWidth = 1, i.setLineDash([4, 8]), Zt(i, p.x, p.y, p.w, p.h, m), i.stroke(), i.setLineDash([]), i.lineDashOffset = 0, t.locked) {
6922
+ ), i.stroke(), i.strokeStyle = x, i.lineWidth = 2, i.setLineDash([8, 4]), Kt(i, p.x, p.y, p.w, p.h, m), i.stroke(), i.lineDashOffset = -(Date.now() / 50) % 12, i.strokeStyle = "#ffffff", i.lineWidth = 1, i.setLineDash([4, 8]), Kt(i, p.x, p.y, p.w, p.h, m), i.stroke(), i.setLineDash([]), i.lineDashOffset = 0, t.locked) {
6919
6923
  i.restore();
6920
6924
  return;
6921
6925
  }
@@ -6946,7 +6950,7 @@ const Wa = (r, o) => {
6946
6950
  i.strokeStyle = "#3b82f6", i.lineWidth = 1, i.setLineDash([2, 2]), i.beginPath(), i.moveTo(C, D + 12), i.lineTo(C, p.y), i.stroke(), i.setLineDash([]), i.beginPath(), i.arc(C, D, 12, 0, 2 * Math.PI), i.fillStyle = "#f59e0b", i.fill(), i.strokeStyle = "#ffffff", i.lineWidth = 2, i.stroke(), i.strokeStyle = "#ffffff", i.lineWidth = 2, i.beginPath(), i.arc(C, D, 6, -Math.PI / 2, Math.PI, !1), i.stroke(), i.beginPath(), i.moveTo(C - 6, D), i.lineTo(C - 3, D - 3), i.lineTo(C - 3, D + 3), i.closePath(), i.fillStyle = "#ffffff", i.fill(), i.restore();
6947
6951
  }, po = (i, t) => {
6948
6952
  if (!t) return [];
6949
- const a = Ne(i, t), c = t.isIcon ? Math.max(8, 12) : 8, m = 8, u = 30, y = (t.rotation || 0) * Math.PI / 180, d = {
6953
+ const a = Te(i, t), c = t.isIcon ? Math.max(8, 12) : 8, m = 8, u = 30, y = (t.rotation || 0) * Math.PI / 180, d = {
6950
6954
  x: -a.width / 2 - c,
6951
6955
  y: -a.height / 2 - c,
6952
6956
  w: a.width + c * 2,
@@ -6975,32 +6979,32 @@ const Wa = (r, o) => {
6975
6979
  return y.type;
6976
6980
  }
6977
6981
  return null;
6978
- }, xe = Nt(() => {
6979
- if (At > 0) {
6980
- const i = Wt[At - 1];
6981
- z(i.elements), L(i.selectedElement), se(At - 1);
6982
+ }, xe = zt(() => {
6983
+ if (Et > 0) {
6984
+ const i = Wt[Et - 1];
6985
+ z(i.elements), L(i.selectedElement), se(Et - 1);
6982
6986
  }
6983
- }, [Wt, At]), le = Nt(() => {
6984
- if (At < Wt.length - 1) {
6985
- const i = Wt[At + 1];
6986
- z(i.elements), L(i.selectedElement), se(At + 1);
6987
+ }, [Wt, Et]), le = zt(() => {
6988
+ if (Et < Wt.length - 1) {
6989
+ const i = Wt[Et + 1];
6990
+ z(i.elements), L(i.selectedElement), se(Et + 1);
6987
6991
  }
6988
- }, [Wt, At]), qt = (i) => Ft ? Math.round(i / Fe) * Fe : i;
6989
- ct(() => {
6990
- if (X != null && X.sectionImage) {
6991
- at.current = null, V.current = null;
6992
+ }, [Wt, Et]), Xt = (i) => Nt ? Math.round(i / ze) * ze : i;
6993
+ st(() => {
6994
+ if (Y != null && Y.sectionImage) {
6995
+ he.current = null, bt.current = null;
6992
6996
  const i = Bt.current;
6993
6997
  if (i && i.getContext("2d").clearRect(0, 0, v, P), w && !pe)
6994
6998
  return;
6995
6999
  const t = new Image();
6996
7000
  t.crossOrigin = "anonymous", t.onload = () => {
6997
- at.current = t, V.current = t, nt();
7001
+ he.current = t, bt.current = t, nt();
6998
7002
  }, t.onerror = () => {
6999
- console.error("Failed to load background image:", X.sectionImage), nt();
7000
- }, t.src = X.sectionImage;
7003
+ console.error("Failed to load background image:", Y.sectionImage), nt();
7004
+ }, t.src = Y.sectionImage;
7001
7005
  } else
7002
- at.current = null, V.current = null, nt();
7003
- }, [X, pe]), ct(() => {
7006
+ he.current = null, bt.current = null, nt();
7007
+ }, [Y, pe]), st(() => {
7004
7008
  const i = (t) => {
7005
7009
  const a = document.activeElement;
7006
7010
  if (!(a && (a.tagName === "INPUT" || a.tagName === "TEXTAREA" || a.tagName === "SELECT" || a.isContentEditable))) {
@@ -7026,9 +7030,9 @@ const Wa = (r, o) => {
7026
7030
  }, [b, s, xe, le, mt]);
7027
7031
  const Dt = () => `element_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, yo = (i) => {
7028
7032
  i.strokeStyle = "#e0e0e0", i.lineWidth = 1, i.setLineDash([1, 1]);
7029
- for (let t = 0; t <= v; t += Fe)
7033
+ for (let t = 0; t <= v; t += ze)
7030
7034
  i.beginPath(), i.moveTo(t, 0), i.lineTo(t, P), i.stroke();
7031
- for (let t = 0; t <= P; t += Fe)
7035
+ for (let t = 0; t <= P; t += ze)
7032
7036
  i.beginPath(), i.moveTo(0, t), i.lineTo(v, t), i.stroke();
7033
7037
  i.setLineDash([]);
7034
7038
  }, xo = (i, t) => {
@@ -7134,21 +7138,21 @@ const Wa = (r, o) => {
7134
7138
  }, vo = (i, t, a, c, m = !1) => {
7135
7139
  const u = Array.from(t);
7136
7140
  if (u.length === 0) return;
7137
- const y = a.fontSize || 20, d = u.map((Mt) => i.measureText(Mt).width), p = d.reduce((Mt, Xt) => Mt + Xt, 0) || 1, x = Math.max(1e-4, Math.abs(a.curve) * Math.PI / 180), C = p / x, D = a.curve >= 0 ? 1 : -1, G = (c || p) / 2, et = D * C + y / 2, gt = a.stroke && a.strokeWidth > 0, W = typeof a.textDecoration == "string" ? a.textDecoration : "", lt = {
7141
+ const y = a.fontSize || 20, d = u.map((At) => i.measureText(At).width), p = d.reduce((At, Qt) => At + Qt, 0) || 1, x = Math.max(1e-4, Math.abs(a.curve) * Math.PI / 180), C = p / x, D = a.curve >= 0 ? 1 : -1, G = (c || p) / 2, et = D * C + y / 2, gt = a.stroke && a.strokeWidth > 0, W = typeof a.textDecoration == "string" ? a.textDecoration : "", ct = {
7138
7142
  underline: W.includes("underline") || !!a.underline,
7139
7143
  overline: W.includes("overline") || !!a.overline,
7140
7144
  strike: W.includes("line-through") || !!a.strikethrough
7141
- }, It = lt.underline || lt.overline || lt.strike, wt = a.decorationColor || a.fill || "#000000", kt = Math.max(1, y / 20), Tt = i.textAlign, jt = i.textBaseline;
7145
+ }, It = ct.underline || ct.overline || ct.strike, wt = a.decorationColor || a.fill || "#000000", kt = Math.max(1, y / 20), Mt = i.textAlign, Ct = i.textBaseline;
7142
7146
  i.textAlign = "center", i.textBaseline = "middle", i.save(), i.translate(G, et), i.rotate(-D * x / 2);
7143
- for (let Mt = 0; Mt < u.length; Mt++) {
7144
- const Xt = d[Mt] / C;
7145
- if (i.rotate(D * Xt / 2), i.save(), i.translate(0, -D * C), m ? Ve(i, u[Mt], 0, { fontSize: y, color: a.fill || "#000000" }) : (gt && i.strokeText(u[Mt], 0, 0), i.fillText(u[Mt], 0, 0)), It) {
7146
- const Ht = d[Mt];
7147
- i.strokeStyle = wt, i.lineWidth = kt, i.setLineDash && i.setLineDash([]), lt.underline && (i.beginPath(), i.moveTo(-Ht / 2, y / 2 + 2), i.lineTo(Ht / 2, y / 2 + 2), i.stroke()), lt.overline && (i.beginPath(), i.moveTo(-Ht / 2, -(y / 2 + 2)), i.lineTo(Ht / 2, -(y / 2 + 2)), i.stroke()), lt.strike && (i.beginPath(), i.moveTo(-Ht / 2, 0), i.lineTo(Ht / 2, 0), i.stroke());
7147
+ for (let At = 0; At < u.length; At++) {
7148
+ const Qt = d[At] / C;
7149
+ if (i.rotate(D * Qt / 2), i.save(), i.translate(0, -D * C), m ? _e(i, u[At], 0, { fontSize: y, color: a.fill || "#000000" }) : (gt && i.strokeText(u[At], 0, 0), i.fillText(u[At], 0, 0)), It) {
7150
+ const Ht = d[At];
7151
+ i.strokeStyle = wt, i.lineWidth = kt, i.setLineDash && i.setLineDash([]), ct.underline && (i.beginPath(), i.moveTo(-Ht / 2, y / 2 + 2), i.lineTo(Ht / 2, y / 2 + 2), i.stroke()), ct.overline && (i.beginPath(), i.moveTo(-Ht / 2, -(y / 2 + 2)), i.lineTo(Ht / 2, -(y / 2 + 2)), i.stroke()), ct.strike && (i.beginPath(), i.moveTo(-Ht / 2, 0), i.lineTo(Ht / 2, 0), i.stroke());
7148
7152
  }
7149
- i.restore(), i.rotate(D * Xt / 2);
7153
+ i.restore(), i.rotate(D * Qt / 2);
7150
7154
  }
7151
- i.restore(), i.textAlign = Tt, i.textBaseline = jt;
7155
+ i.restore(), i.textAlign = Mt, i.textBaseline = Ct;
7152
7156
  }, wo = (i, t) => {
7153
7157
  i.save();
7154
7158
  let a = t.text || "Text";
@@ -7178,14 +7182,14 @@ const Wa = (r, o) => {
7178
7182
  ), i.fillStyle = t.fill || "#000000";
7179
7183
  }
7180
7184
  (t.hasTextShadow || t.textShadowColor) && (i.shadowColor = t.textShadowColor || "rgba(0,0,0,0.5)", i.shadowBlur = t.textShadowBlur != null ? t.textShadowBlur : 4, i.shadowOffsetX = t.textShadowX != null ? t.textShadowX : 2, i.shadowOffsetY = t.textShadowY != null ? t.textShadowY : 2);
7181
- const d = vi(f) && t.type === "text" && !t.isIcon;
7185
+ const d = Si(f) && t.type === "text" && !t.isIcon;
7182
7186
  if (t.curve && Math.abs(t.curve) >= 1) {
7183
7187
  vo(i, c.join(" "), t, u, d), i.restore();
7184
7188
  return;
7185
7189
  }
7186
7190
  c.forEach((p, x) => {
7187
7191
  const C = x * m, D = i.measureText(p).width;
7188
- d ? Ve(i, p, C, { fontSize: t.fontSize || 20, color: t.fill || "#000000" }) : (t.stroke && t.strokeWidth > 0 && i.strokeText(p, 0, C), i.fillText(p, 0, C));
7192
+ d ? _e(i, p, C, { fontSize: t.fontSize || 20, color: t.fill || "#000000" }) : (t.stroke && t.strokeWidth > 0 && i.strokeText(p, 0, C), i.fillText(p, 0, C));
7189
7193
  const G = t.fontSize || 20, et = t.decorationColor || t.fill || "#000000", gt = Math.max(1, G / 20);
7190
7194
  if (i.strokeStyle = et, i.lineWidth = gt, t.textDecoration === "underline" || t.underline) {
7191
7195
  const W = C + G + 2;
@@ -7199,8 +7203,8 @@ const Wa = (r, o) => {
7199
7203
  const W = C + G / 2;
7200
7204
  i.beginPath(), i.moveTo(0, W), i.lineTo(D, W), i.stroke();
7201
7205
  }
7202
- typeof t.textDecoration == "string" && t.textDecoration.includes(" ") && t.textDecoration.split(" ").forEach((lt) => {
7203
- switch (lt.trim()) {
7206
+ typeof t.textDecoration == "string" && t.textDecoration.includes(" ") && t.textDecoration.split(" ").forEach((ct) => {
7207
+ switch (ct.trim()) {
7204
7208
  case "underline":
7205
7209
  const It = C + G + 2;
7206
7210
  i.beginPath(), i.moveTo(0, It), i.lineTo(D, It), i.stroke();
@@ -7292,7 +7296,7 @@ const Wa = (r, o) => {
7292
7296
  i.beginPath(), i.ellipse(a, c, m, u, 0, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7293
7297
  }, Io = (i, t) => {
7294
7298
  const a = Math.min(t.width, t.height) * 0.1;
7295
- Zt(i, 0, 0, t.width, t.height, a), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7299
+ Kt(i, 0, 0, t.width, t.height, a), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7296
7300
  }, Lo = (i, t) => {
7297
7301
  i.save(), t.opacity !== void 0 && (i.globalAlpha = t.opacity), i.strokeStyle = t.stroke || t.fill || "#000000", i.lineWidth = t.strokeWidth || t.height || 2, i.lineCap = "round", i.beginPath(), i.moveTo(0, t.height / 2), i.lineTo(t.width, t.height / 2), i.stroke(), i.restore();
7298
7302
  }, Do = (i, t) => {
@@ -7343,17 +7347,17 @@ const Wa = (r, o) => {
7343
7347
  return;
7344
7348
  }
7345
7349
  if (t._stickerLoadError) {
7346
- ze(i, t, "Failed to load", !0);
7350
+ Me(i, t, "Failed to load", !0);
7347
7351
  return;
7348
7352
  }
7349
7353
  }
7350
- ze(i, t, "Your customization");
7354
+ Me(i, t, "Your customization");
7351
7355
  } catch (c) {
7352
- console.error("Error drawing sticker:", c), ze(i, t, "Error", !0);
7356
+ console.error("Error drawing sticker:", c), Me(i, t, "Error", !0);
7353
7357
  }
7354
7358
  else
7355
- ze(i, t, "No Sticker");
7356
- }, ze = (i, t, a, c = !1) => {
7359
+ Me(i, t, "No Sticker");
7360
+ }, Me = (i, t, a, c = !1) => {
7357
7361
  i.fillStyle = c ? "#ffebee" : "#f8f9fa", i.fillRect(0, 0, t.width, t.height), i.strokeStyle = c ? "#f44336" : "#dee2e6", i.lineWidth = 2, i.strokeRect(0, 0, t.width, t.height), i.fillStyle = c ? "#f44336" : "#6c757d", i.font = "12px Arial", i.textAlign = "center", i.textBaseline = "middle", i.fillText(a, t.width / 2, t.height / 2);
7358
7362
  }, Wo = (i, t) => {
7359
7363
  if (t.imageObject && t.imageObject.complete && t.imageObject.naturalHeight !== 0)
@@ -7377,10 +7381,10 @@ const Wa = (r, o) => {
7377
7381
  if (!a) return !1;
7378
7382
  const c = a.x + a.width / 2, m = a.y + a.height / 2, u = i - c, y = t - m, d = -(a.rotation || 0) * Math.PI / 180, p = Math.cos(d), x = Math.sin(d), C = u * p - y * x, D = u * x + y * p, G = a.width / 2, et = a.height / 2;
7379
7383
  return C >= -G && C <= G && D >= -et && D <= et;
7380
- }, Di = Nt(() => {
7381
- if (Yt.current) {
7382
- const t = Yt.current;
7383
- Yt.current = null;
7384
+ }, Di = zt(() => {
7385
+ if (qt.current) {
7386
+ const t = qt.current;
7387
+ qt.current = null;
7384
7388
  const a = Math.min(t.x0, t.x1), c = Math.min(t.y0, t.y1), m = Math.abs(t.x1 - t.x0), u = Math.abs(t.y1 - t.y0);
7385
7389
  if (m > 3 && u > 3) {
7386
7390
  const y = N.filter((p) => {
@@ -7389,13 +7393,13 @@ const Wa = (r, o) => {
7389
7393
  }), d = y.map((p) => p.id);
7390
7394
  it(d), L(d.length ? y[y.length - 1] : null);
7391
7395
  }
7392
- Vt();
7396
+ _t();
7393
7397
  }
7394
- (J || pt || _) && mt(), ue.current = null, Ut.current = { v: [], h: [] }, Xe.current = [], Qe.current = [], Ze.current = null, bt(!1), zt(!1), O(!1), yt(null);
7398
+ (J || pt || V) && mt(), ue.current = null, at.current = { v: [], h: [] }, q.current = [], Yt.current = [], Qe.current = null, St(!1), Tt(!1), O(!1), yt(null);
7395
7399
  const i = Bt.current;
7396
7400
  i && (i.style.cursor = "default");
7397
- }, [J, pt, _, mt, N]);
7398
- ct(() => {
7401
+ }, [J, pt, V, mt, N]);
7402
+ st(() => {
7399
7403
  const i = (t) => {
7400
7404
  if (s) return;
7401
7405
  const a = document.activeElement;
@@ -7409,7 +7413,7 @@ const Wa = (r, o) => {
7409
7413
  });
7410
7414
  u.length && (z((y) => y.filter((d) => !u.includes(d.id))), L(null), it([]), mt(), t.preventDefault());
7411
7415
  }
7412
- if ((t.ctrlKey || t.metaKey) && t.key === "d" && b && (ei(b.id), t.preventDefault()), t.key === "Escape" && (b || m.length) && (L(null), it([]), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "c" && m.length && (Mi.current = m.map((u) => N.find((y) => y.id === u)).filter(Boolean).map((u) => ({ ...u })), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "v") {
7416
+ if ((t.ctrlKey || t.metaKey) && t.key === "d" && b && (ti(b.id), t.preventDefault()), t.key === "Escape" && (b || m.length) && (L(null), it([]), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "c" && m.length && (Mi.current = m.map((u) => N.find((y) => y.id === u)).filter(Boolean).map((u) => ({ ...u })), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "v") {
7413
7417
  const u = Mi.current;
7414
7418
  if (u && u.length) {
7415
7419
  const y = u.map((d) => ({ ...d, id: Dt(), x: (d.x || 0) + 20, y: (d.y || 0) + 20 }));
@@ -7440,21 +7444,21 @@ const Wa = (r, o) => {
7440
7444
  });
7441
7445
  if (p.length)
7442
7446
  if (z((x) => x.map((C) => p.includes(C.id) ? { ...C, x: C.x + y, y: C.y + d } : C)), L((x) => x && p.includes(x.id) ? { ...x, x: x.x + y, y: x.y + d } : x), mt(), p.length === 1 && b) {
7443
- const x = b.x + y, C = b.y + d, D = Ni(v, vt), G = (et) => et >= 10 ? Math.round(et).toString() : et >= 1 ? et.toFixed(1) : et.toFixed(2);
7447
+ const x = b.x + y, C = b.y + d, D = Fi(v, jt), G = (et) => et >= 10 ? Math.round(et).toString() : et >= 1 ? et.toFixed(1) : et.toFixed(2);
7444
7448
  fe.current = {
7445
7449
  cx: x + (b.width || 0) / 2,
7446
7450
  y: C + (b.height || 0) + 8,
7447
7451
  label: D > 0 ? `x ${G(x * D)}" y ${G(C * D)}"` : `x ${Math.round(x)} y ${Math.round(C)}`
7448
- }, Vt(), ge.current && clearTimeout(ge.current), ge.current = setTimeout(() => {
7449
- fe.current = null, Vt();
7452
+ }, _t(), ge.current && clearTimeout(ge.current), ge.current = setTimeout(() => {
7453
+ fe.current = null, _t();
7450
7454
  }, 1e3);
7451
7455
  } else
7452
- Vt();
7456
+ _t();
7453
7457
  }
7454
7458
  };
7455
7459
  return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
7456
- }, [b, j, N, xe, le, s, v, vt]);
7457
- const Je = (i, t = {}) => {
7460
+ }, [b, j, N, xe, le, s, v, jt]);
7461
+ const Ke = (i, t = {}) => {
7458
7462
  const a = {
7459
7463
  id: Dt(),
7460
7464
  type: i,
@@ -7511,7 +7515,7 @@ const Wa = (r, o) => {
7511
7515
  }
7512
7516
  z((c) => [...c, a]), L(a), mt();
7513
7517
  }, Bo = () => {
7514
- Je("text", {
7518
+ Ke("text", {
7515
7519
  text: "Your text",
7516
7520
  fontSize: 32,
7517
7521
  width: 220,
@@ -7523,9 +7527,9 @@ const Wa = (r, o) => {
7523
7527
  const i = document.createElement("input");
7524
7528
  i.type = "file", i.accept = "image/*", i.onchange = (t) => {
7525
7529
  const a = t.target.files && t.target.files[0];
7526
- a && a.type.startsWith("image/") && ri(a);
7530
+ a && a.type.startsWith("image/") && ai(a);
7527
7531
  }, i.click();
7528
- }, Te = (i, t) => {
7532
+ }, Ae = (i, t) => {
7529
7533
  z((a) => a.map(
7530
7534
  (c) => c.id === i ? { ...c, ...t } : c
7531
7535
  )), b && b.id === i && L((a) => ({ ...a, ...t }));
@@ -7537,7 +7541,7 @@ const Wa = (r, o) => {
7537
7541
  const a = await H(t), c = typeof a == "string" ? a : URL.createObjectURL(a), m = new Image();
7538
7542
  m.crossOrigin = "anonymous", await new Promise((p, x) => {
7539
7543
  m.onload = p, m.onerror = () => x(new Error("Processed image failed to load")), m.src = c;
7540
- }), Te(i.id, {
7544
+ }), Ae(i.id, {
7541
7545
  src: c,
7542
7546
  image: c,
7543
7547
  imageData: c,
@@ -7551,9 +7555,9 @@ const Wa = (r, o) => {
7551
7555
  originalHeight: m.naturalHeight,
7552
7556
  bgRemoved: !0
7553
7557
  }), mt(), nt();
7554
- }, ti = Nt(() => {
7558
+ }, Je = zt(() => {
7555
7559
  b && (z((i) => i.filter((t) => t.id !== b.id)), L(null), mt());
7556
- }, [b, mt]), ei = (i) => {
7560
+ }, [b, mt]), ti = (i) => {
7557
7561
  const t = N.find((a) => a.id === i);
7558
7562
  if (t) {
7559
7563
  const a = {
@@ -7573,11 +7577,11 @@ const Wa = (r, o) => {
7573
7577
  width: Math.max(10, (b.width || 0) * i),
7574
7578
  height: Math.max(10, (b.height || 0) * i)
7575
7579
  };
7576
- (b.type === "text" || b.isIcon) && (t.fontSize = Math.max(6, Math.round((b.fontSize || 20) * i))), Te(b.id, t), mt();
7580
+ (b.type === "text" || b.isIcon) && (t.fontSize = Math.max(6, Math.round((b.fontSize || 20) * i))), Ae(b.id, t), mt();
7577
7581
  }, Bi = (i) => {
7578
7582
  if (!b || b.locked) return;
7579
7583
  const t = (((b.rotation || 0) + i) % 360 + 360) % 360;
7580
- Te(b.id, { rotation: t }), mt();
7584
+ Ae(b.id, { rotation: t }), mt();
7581
7585
  }, Pi = (i) => {
7582
7586
  const t = N.filter((c) => j.includes(c.id));
7583
7587
  if (t.length < 2) return;
@@ -7603,28 +7607,28 @@ const Wa = (r, o) => {
7603
7607
  const c = [...N], m = c[a];
7604
7608
  t === "up" && a < c.length - 1 ? (c[a] = c[a + 1], c[a + 1] = m) : t === "down" && a > 0 ? (c[a] = c[a - 1], c[a - 1] = m) : t === "top" ? (c.splice(a, 1), c.push(m)) : t === "bottom" && (c.splice(a, 1), c.unshift(m)), z(c), mt();
7605
7609
  };
7606
- Nt(() => {
7607
- X && ne((i) => ({
7610
+ zt(() => {
7611
+ Y && ne((i) => ({
7608
7612
  ...i,
7609
- [X.sectionName]: {
7613
+ [Y.sectionName]: {
7610
7614
  elements: [...N],
7611
7615
  selectedColor: ot
7612
7616
  }
7613
7617
  }));
7614
- }, [X, N, ot]);
7618
+ }, [Y, N, ot]);
7615
7619
  const [, Go] = Qo((i) => i + 1, 0);
7616
7620
  setTimeout(() => {
7617
7621
  Go();
7618
7622
  }, 20);
7619
- const _o = Nt(() => {
7620
- X && ne((i) => ({
7623
+ const _o = zt(() => {
7624
+ Y && ne((i) => ({
7621
7625
  ...i,
7622
- [X.sectionName]: {
7626
+ [Y.sectionName]: {
7623
7627
  elements: [...N],
7624
7628
  selectedColor: ot
7625
7629
  }
7626
7630
  }));
7627
- }, [X, N, ot]);
7631
+ }, [Y, N, ot]);
7628
7632
  Zo(o, () => ({
7629
7633
  handleSectionChange: $i,
7630
7634
  flushCurrentSectionDesign: _o,
@@ -7634,7 +7638,7 @@ const Wa = (r, o) => {
7634
7638
  addImageFromUrl: (i, t = {}) => {
7635
7639
  if (!i) return;
7636
7640
  const a = t.width || 220, c = t.height || 220;
7637
- Je("image", {
7641
+ Ke("image", {
7638
7642
  imageData: i,
7639
7643
  src: i,
7640
7644
  width: a,
@@ -7644,16 +7648,16 @@ const Wa = (r, o) => {
7644
7648
  });
7645
7649
  },
7646
7650
  // Export methods that return download-ready data
7647
- exportPrintReady: async (i = "png") => await Ke(i, !1),
7648
- exportFullDesign: async (i = "png") => await Ke(i, !0),
7651
+ exportPrintReady: async (i = "png") => await Ze(i, !1),
7652
+ exportFullDesign: async (i = "png") => await Ze(i, !0),
7649
7653
  // Access to the existing exportDesign method
7650
- exportDesign: Ke,
7654
+ exportDesign: Ze,
7651
7655
  // Get canvas data for custom exports
7652
7656
  getCanvasData: () => ye(),
7653
7657
  // NEW: Export methods that return JSON with File objects
7654
7658
  exportAllDesignsAsJSON: async (i = "png") => {
7655
7659
  try {
7656
- const t = ye(), a = (X == null ? void 0 : X.sectionName) || "main", c = {
7660
+ const t = ye(), a = (Y == null ? void 0 : Y.sectionName) || "main", c = {
7657
7661
  elements: t.elements,
7658
7662
  selectedColor: t.selectedColor,
7659
7663
  canvasWidth: t.canvasWidth,
@@ -7664,8 +7668,8 @@ const Wa = (r, o) => {
7664
7668
  }, u = f.sections && f.sections.length > 0 ? f.sections : [{
7665
7669
  id: a,
7666
7670
  sectionName: a,
7667
- image: X == null ? void 0 : X.sectionImage,
7668
- sectionImage: X == null ? void 0 : X.sectionImage
7671
+ image: Y == null ? void 0 : Y.sectionImage,
7672
+ sectionImage: Y == null ? void 0 : Y.sectionImage
7669
7673
  }];
7670
7674
  return await me.current.exportAllSectionsAsJSON(
7671
7675
  m,
@@ -7674,7 +7678,7 @@ const Wa = (r, o) => {
7674
7678
  P,
7675
7679
  i,
7676
7680
  pe,
7677
- re
7681
+ Zt
7678
7682
  );
7679
7683
  } catch (t) {
7680
7684
  throw console.error("Export as JSON failed:", t), t;
@@ -7683,101 +7687,101 @@ const Wa = (r, o) => {
7683
7687
  exportCurrentSectionAsJSON: async (i = "png") => {
7684
7688
  try {
7685
7689
  const t = ye();
7686
- return await me.current.exportCurrentSectionAsJSON(t, i, pe, re);
7690
+ return await me.current.exportCurrentSectionAsJSON(t, i, pe, Zt);
7687
7691
  } catch (t) {
7688
7692
  throw console.error("Export current section as JSON failed:", t), t;
7689
7693
  }
7690
7694
  }
7691
7695
  }));
7692
- const $t = dt(null), ii = dt(!1), nt = Nt(() => {
7696
+ const Gt = dt(null), ei = dt(!1), nt = zt(() => {
7693
7697
  const i = Bt.current;
7694
- if (!i || ii.current) return;
7695
- ii.current = !0;
7698
+ if (!i || ei.current) return;
7699
+ ei.current = !0;
7696
7700
  const t = i.getContext("2d");
7697
- if (t.clearRect(0, 0, v, P), V.current && t.drawImage(V.current, 0, 0, v, P), ft && yo(t), N.forEach((d) => {
7701
+ if (t.clearRect(0, 0, v, P), bt.current && t.drawImage(bt.current, 0, 0, v, P), ft && yo(t), N.forEach((d) => {
7698
7702
  t.save(), t.globalAlpha = d.opacity || 1, xo(t, d), t.restore();
7699
7703
  }), j.length > 1 ? (t.save(), t.strokeStyle = "#3b82f6", t.lineWidth = 1.5, t.setLineDash([4, 3]), j.forEach((d) => {
7700
7704
  const p = N.find((D) => D.id === d);
7701
7705
  if (!p) return;
7702
- const x = Ne(t, p), C = 4;
7706
+ const x = Te(t, p), C = 4;
7703
7707
  t.save(), t.translate(x.cx, x.cy), p.rotation && t.rotate(p.rotation * Math.PI / 180), t.strokeRect(-x.width / 2 - C, -x.height / 2 - C, x.width + C * 2, x.height + C * 2), t.restore();
7704
- }), t.restore()) : b && mo(t, b), Yt.current) {
7705
- const d = Yt.current, p = Math.min(d.x0, d.x1), x = Math.min(d.y0, d.y1), C = Math.abs(d.x1 - d.x0), D = Math.abs(d.y1 - d.y0);
7708
+ }), t.restore()) : b && mo(t, b), qt.current) {
7709
+ const d = qt.current, p = Math.min(d.x0, d.x1), x = Math.min(d.y0, d.y1), C = Math.abs(d.x1 - d.x0), D = Math.abs(d.y1 - d.y0);
7706
7710
  t.save(), t.fillStyle = "rgba(59,130,246,0.12)", t.strokeStyle = "#3b82f6", t.lineWidth = 1, t.setLineDash([4, 3]), t.fillRect(p, x, C, D), t.strokeRect(p, x, C, D), t.restore();
7707
7711
  }
7708
- const a = Ut.current;
7712
+ const a = at.current;
7709
7713
  a && (a.v && a.v.length || a.h && a.h.length) && (t.save(), t.strokeStyle = "#ec4899", t.lineWidth = 1, t.setLineDash([5, 4]), (a.v || []).forEach((d) => {
7710
7714
  t.beginPath(), t.moveTo(d, 0), t.lineTo(d, P), t.stroke();
7711
7715
  }), (a.h || []).forEach((d) => {
7712
7716
  t.beginPath(), t.moveTo(0, d), t.lineTo(v, d), t.stroke();
7713
7717
  }), t.restore());
7714
- const c = Xe.current;
7718
+ const c = q.current;
7715
7719
  c && c.length && (t.save(), t.strokeStyle = "#ef4444", t.fillStyle = "#ef4444", t.lineWidth = 1, t.font = "11px sans-serif", t.textAlign = "center", t.textBaseline = "middle", c.forEach((d) => {
7716
7720
  t.beginPath(), t.moveTo(d.x1, d.y1), t.lineTo(d.x2, d.y2), t.stroke();
7717
7721
  const p = d.y1 === d.y2, x = 4;
7718
7722
  t.beginPath(), p ? (t.moveTo(d.x1, d.y1 - x), t.lineTo(d.x1, d.y1 + x), t.moveTo(d.x2, d.y2 - x), t.lineTo(d.x2, d.y2 + x)) : (t.moveTo(d.x1 - x, d.y1), t.lineTo(d.x1 + x, d.y1), t.moveTo(d.x2 - x, d.y2), t.lineTo(d.x2 + x, d.y2)), t.stroke();
7719
7723
  const C = (d.x1 + d.x2) / 2, D = (d.y1 + d.y2) / 2, G = `${d.label}`, gt = t.measureText(G).width + 8, W = 15;
7720
- t.fillStyle = "#ef4444", Zt(t, C - gt / 2, D - W / 2, gt, W, 3), t.fill(), t.fillStyle = "#ffffff", t.fillText(G, C, D + 0.5), t.fillStyle = "#ef4444";
7724
+ t.fillStyle = "#ef4444", Kt(t, C - gt / 2, D - W / 2, gt, W, 3), t.fill(), t.fillStyle = "#ffffff", t.fillText(G, C, D + 0.5), t.fillStyle = "#ef4444";
7721
7725
  }), t.restore());
7722
- const m = Qe.current;
7726
+ const m = Yt.current;
7723
7727
  m && m.length && (t.save(), t.strokeStyle = "#a855f7", t.fillStyle = "#a855f7", t.lineWidth = 1, t.font = "11px sans-serif", t.textAlign = "center", t.textBaseline = "middle", m.forEach((d) => {
7724
7728
  t.beginPath(), t.moveTo(d.x1, d.y1), t.lineTo(d.x2, d.y2), t.stroke();
7725
7729
  const p = d.y1 === d.y2, x = 4;
7726
7730
  t.beginPath(), p ? (t.moveTo(d.x1, d.y1 - x), t.lineTo(d.x1, d.y1 + x), t.moveTo(d.x2, d.y2 - x), t.lineTo(d.x2, d.y2 + x)) : (t.moveTo(d.x1 - x, d.y1), t.lineTo(d.x1 + x, d.y1), t.moveTo(d.x2 - x, d.y2), t.lineTo(d.x2 + x, d.y2)), t.stroke();
7727
7731
  const C = (d.x1 + d.x2) / 2, D = (d.y1 + d.y2) / 2, G = `${d.label}`, gt = t.measureText(G).width + 8, W = 15;
7728
- t.fillStyle = "#a855f7", Zt(t, C - gt / 2, D - W / 2, gt, W, 3), t.fill(), t.fillStyle = "#ffffff", t.fillText(G, C, D + 0.5), t.fillStyle = "#a855f7";
7732
+ t.fillStyle = "#a855f7", Kt(t, C - gt / 2, D - W / 2, gt, W, 3), t.fill(), t.fillStyle = "#ffffff", t.fillText(G, C, D + 0.5), t.fillStyle = "#a855f7";
7729
7733
  }), t.restore());
7730
- const u = Ze.current;
7734
+ const u = Qe.current;
7731
7735
  if (u) {
7732
7736
  t.save(), t.font = "11px sans-serif", t.textAlign = "center", t.textBaseline = "middle";
7733
7737
  const p = t.measureText(u.label).width + 10, x = 16, C = Math.max(p / 2, Math.min(v - p / 2, u.cx)), D = Math.min(P - x / 2, u.y + x / 2);
7734
- t.fillStyle = "#1d4ed8", Zt(t, C - p / 2, D - x / 2, p, x, 3), t.fill(), t.fillStyle = "#ffffff", t.fillText(u.label, C, D + 0.5), t.restore();
7738
+ t.fillStyle = "#1d4ed8", Kt(t, C - p / 2, D - x / 2, p, x, 3), t.fill(), t.fillStyle = "#ffffff", t.fillText(u.label, C, D + 0.5), t.restore();
7735
7739
  }
7736
7740
  const y = fe.current;
7737
7741
  if (y) {
7738
7742
  t.save(), t.font = "11px sans-serif", t.textAlign = "center", t.textBaseline = "middle";
7739
7743
  const p = t.measureText(y.label).width + 10, x = 16, C = Math.max(p / 2, Math.min(v - p / 2, y.cx)), D = Math.min(P - x / 2, y.y + x / 2);
7740
- t.fillStyle = "#1d4ed8", Zt(t, C - p / 2, D - x / 2, p, x, 3), t.fill(), t.fillStyle = "#ffffff", t.fillText(y.label, C, D + 0.5), t.restore();
7744
+ t.fillStyle = "#1d4ed8", Kt(t, C - p / 2, D - x / 2, p, x, 3), t.fill(), t.fillStyle = "#ffffff", t.fillText(y.label, C, D + 0.5), t.restore();
7741
7745
  }
7742
- ii.current = !1;
7743
- }, [N, b, j, v, P, ft]), oi = dt(nt);
7744
- ct(() => {
7745
- oi.current = nt;
7746
+ ei.current = !1;
7747
+ }, [N, b, j, v, P, ft]), ii = dt(nt);
7748
+ st(() => {
7749
+ ii.current = nt;
7746
7750
  }, [nt]);
7747
7751
  const Hi = dt(!1);
7748
- ct(() => {
7749
- Hi.current = J || pt || _;
7750
- }, [J, pt, _]);
7751
- const Vt = Nt(() => {
7752
- $t.current && cancelAnimationFrame($t.current), $t.current = requestAnimationFrame(() => {
7753
- oi.current(), $t.current = null;
7752
+ st(() => {
7753
+ Hi.current = J || pt || V;
7754
+ }, [J, pt, V]);
7755
+ const _t = zt(() => {
7756
+ Gt.current && cancelAnimationFrame(Gt.current), Gt.current = requestAnimationFrame(() => {
7757
+ ii.current(), Gt.current = null;
7754
7758
  });
7755
7759
  }, []);
7756
- ct(() => {
7757
- me.current && (me.current.embroidery = vi(f));
7758
- }, [f]), ct(() => {
7760
+ st(() => {
7761
+ me.current && (me.current.embroidery = Si(f));
7762
+ }, [f]), st(() => {
7759
7763
  const i = (N || []).filter((a) => a && a.type === "text" && a.fontFamily).map((a) => a.fontFamily);
7760
7764
  if (i.length === 0) return;
7761
7765
  let t = !1;
7762
- return Ti(i).then(() => {
7766
+ return zi(i).then(() => {
7763
7767
  t || nt();
7764
7768
  }), () => {
7765
7769
  t = !0;
7766
7770
  };
7767
- }, [N, nt]), ct(() => {
7768
- Vt();
7769
- }, [N, b, j, v, P, ft, Vt]), ct(() => {
7770
- V.current && Vt();
7771
- }, [V.current, Vt]), ct(() => () => {
7772
- $t.current && cancelAnimationFrame($t.current);
7771
+ }, [N, nt]), st(() => {
7772
+ _t();
7773
+ }, [N, b, j, v, P, ft, _t]), st(() => {
7774
+ bt.current && _t();
7775
+ }, [bt.current, _t]), st(() => () => {
7776
+ Gt.current && cancelAnimationFrame(Gt.current);
7773
7777
  }, []);
7774
- const ai = Nt(() => {
7775
- oi.current(), Hi.current && ($t.current = requestAnimationFrame(ai));
7778
+ const oi = zt(() => {
7779
+ ii.current(), Hi.current && (Gt.current = requestAnimationFrame(oi));
7776
7780
  }, []);
7777
- ct(() => {
7778
- J || pt || _ ? ai() : ($t.current && (cancelAnimationFrame($t.current), $t.current = null), Vt());
7779
- }, [J, pt, _, ai, Vt]);
7780
- const Uo = Nt((i) => {
7781
+ st(() => {
7782
+ J || pt || V ? oi() : (Gt.current && (cancelAnimationFrame(Gt.current), Gt.current = null), _t());
7783
+ }, [J, pt, V, oi, _t]);
7784
+ const Uo = zt((i) => {
7781
7785
  if (s) return;
7782
7786
  const t = Bt.current, a = t.getBoundingClientRect(), c = (i.clientX - a.left) / M, m = (i.clientY - a.top) / M;
7783
7787
  if (i.pointerId != null && t.setPointerCapture)
@@ -7785,20 +7789,20 @@ const Wa = (r, o) => {
7785
7789
  t.setPointerCapture(i.pointerId);
7786
7790
  } catch {
7787
7791
  }
7788
- if (fe.current && (fe.current = null, ge.current && clearTimeout(ge.current)), st({ x: c, y: m }), b && !b.locked && j.length <= 1) {
7792
+ if (fe.current && (fe.current = null, ge.current && clearTimeout(ge.current)), lt({ x: c, y: m }), b && !b.locked && j.length <= 1) {
7789
7793
  const d = Ii(c, m, b);
7790
7794
  if (d) {
7791
7795
  if (d === "rotate") {
7792
7796
  O(!0);
7793
7797
  const p = b.x + b.width / 2, x = b.y + b.height / 2, C = Math.atan2(m - x, c - p) * 180 / Math.PI;
7794
- st({
7798
+ lt({
7795
7799
  x: c,
7796
7800
  y: m,
7797
7801
  initialAngle: C,
7798
7802
  initialRotation: b.rotation || 0
7799
7803
  });
7800
7804
  } else
7801
- zt(!0), yt(d), st({
7805
+ Tt(!0), yt(d), lt({
7802
7806
  x: c,
7803
7807
  y: m,
7804
7808
  initialWidth: b.width,
@@ -7825,44 +7829,44 @@ const Wa = (r, o) => {
7825
7829
  }
7826
7830
  if (u && y.length > 1 && y.includes(u.id)) {
7827
7831
  const d = N.filter((p) => y.includes(p.id) && !p.locked);
7828
- d.length && (bt(!0), ue.current = { startX: c, startY: m, items: d.map((p) => ({ id: p.id, x: p.x, y: p.y })) }, st({ x: c, y: m }));
7832
+ d.length && (St(!0), ue.current = { startX: c, startY: m, items: d.map((p) => ({ id: p.id, x: p.x, y: p.y })) }, lt({ x: c, y: m }));
7829
7833
  return;
7830
7834
  }
7831
7835
  if (u) {
7832
- ue.current = null, L(u), u.locked || (bt(!0), st({ x: c, y: m, offsetX: c - u.x, offsetY: m - u.y })), nt();
7836
+ ue.current = null, L(u), u.locked || (St(!0), lt({ x: c, y: m, offsetX: c - u.x, offsetY: m - u.y })), nt();
7833
7837
  return;
7834
7838
  }
7835
- L(null), Yt.current = { x0: c, y0: m, x1: c, y1: m }, nt();
7836
- }, [s, M, b, j, N, nt]), Yo = Nt((i) => {
7839
+ L(null), qt.current = { x0: c, y0: m, x1: c, y1: m }, nt();
7840
+ }, [s, M, b, j, N, nt]), Yo = zt((i) => {
7837
7841
  if (s) return;
7838
7842
  const t = Bt.current, a = t.getBoundingClientRect(), c = (i.clientX - a.left) / M, m = (i.clientY - a.top) / M;
7839
- if (Yt.current) {
7840
- Yt.current = { ...Yt.current, x1: c, y1: m }, t.style.cursor = "crosshair", nt();
7843
+ if (qt.current) {
7844
+ qt.current = { ...qt.current, x1: c, y1: m }, t.style.cursor = "crosshair", nt();
7841
7845
  return;
7842
7846
  }
7843
7847
  if (J && ue.current) {
7844
7848
  const u = ue.current;
7845
7849
  let y = c - u.startX, d = m - u.startY;
7846
7850
  const p = (W) => {
7847
- const lt = N.find((It) => It.id === W);
7848
- return lt && lt.width || 0;
7851
+ const ct = N.find((It) => It.id === W);
7852
+ return ct && ct.width || 0;
7849
7853
  }, x = (W) => {
7850
- const lt = N.find((It) => It.id === W);
7851
- return lt && lt.height || 0;
7854
+ const ct = N.find((It) => It.id === W);
7855
+ return ct && ct.height || 0;
7852
7856
  }, C = Math.min(...u.items.map((W) => W.x)), D = Math.max(...u.items.map((W) => W.x + p(W.id))), G = Math.min(...u.items.map((W) => W.y)), et = Math.max(...u.items.map((W) => W.y + x(W.id)));
7853
7857
  y = Math.max(-C, Math.min(v - D, y)), d = Math.max(-G, Math.min(P - et, d));
7854
7858
  const gt = {};
7855
7859
  u.items.forEach((W) => {
7856
7860
  gt[W.id] = { x: W.x + y, y: W.y + d };
7857
- }), z((W) => W.map((lt) => gt[lt.id] ? { ...lt, ...gt[lt.id] } : lt)), L((W) => W && gt[W.id] ? { ...W, ...gt[W.id] } : W), t.style.cursor = "grabbing", nt();
7861
+ }), z((W) => W.map((ct) => gt[ct.id] ? { ...ct, ...gt[ct.id] } : ct)), L((W) => W && gt[W.id] ? { ...W, ...gt[W.id] } : W), t.style.cursor = "grabbing", nt();
7858
7862
  return;
7859
7863
  }
7860
- if (b && !J && !pt && !_) {
7864
+ if (b && !J && !pt && !V) {
7861
7865
  const u = Ii(c, m, b);
7862
7866
  u ? u === "rotate" ? t.style.cursor = "grab" : t.style.cursor = u : Li(c, m, b) ? t.style.cursor = "move" : t.style.cursor = "default";
7863
7867
  } else
7864
7868
  t.style.cursor = J ? "grabbing" : "default";
7865
- if (_ && b) {
7869
+ if (V && b) {
7866
7870
  const u = b.x + b.width / 2, y = b.y + b.height / 2, p = Math.atan2(m - y, c - u) * 180 / Math.PI - R.initialAngle;
7867
7871
  let x = R.initialRotation + p;
7868
7872
  i.shiftKey && (x = Math.round(x / 15) * 15), x = (x % 360 + 360) % 360, z(
@@ -7893,91 +7897,91 @@ const Wa = (r, o) => {
7893
7897
  const W = R.initialWidth / R.initialHeight;
7894
7898
  rt.includes("e"), p = d / W, rt.includes("n") && (C = R.initialY + (R.initialHeight - p));
7895
7899
  }
7896
- Ft && (x = qt(x), C = qt(C), d = qt(d), p = qt(p));
7900
+ Nt && (x = Xt(x), C = Xt(C), d = Xt(d), p = Xt(p));
7897
7901
  const D = {
7898
7902
  ...b,
7899
7903
  x,
7900
7904
  y: C,
7901
7905
  width: d,
7902
7906
  height: p
7903
- }, G = Ni(v, vt), et = (W) => W >= 10 ? Math.round(W).toString() : W >= 1 ? W.toFixed(1) : W.toFixed(2), gt = G > 0 ? `${et(d * G)}" × ${et(p * G)}"` : `${Math.round(d)} × ${Math.round(p)} px`;
7904
- Ze.current = {
7907
+ }, G = Fi(v, jt), et = (W) => W >= 10 ? Math.round(W).toString() : W >= 1 ? W.toFixed(1) : W.toFixed(2), gt = G > 0 ? `${et(d * G)}" × ${et(p * G)}"` : `${Math.round(d)} × ${Math.round(p)} px`;
7908
+ Qe.current = {
7905
7909
  cx: x + d / 2,
7906
7910
  y: C + p + 8,
7907
7911
  label: gt
7908
7912
  }, z(
7909
7913
  (W) => W.map(
7910
- (lt) => lt.id === b.id ? D : lt
7914
+ (ct) => ct.id === b.id ? D : ct
7911
7915
  )
7912
7916
  ), L(D), nt();
7913
7917
  return;
7914
7918
  }
7915
7919
  if (J && b) {
7916
7920
  let u = c - R.offsetX, y = m - R.offsetY;
7917
- Ft && (u = qt(u), y = qt(y));
7921
+ Nt && (u = Xt(u), y = Xt(y));
7918
7922
  const d = 6 / (M || 1), p = b.width, x = b.height, C = N.filter(($) => $.id !== b.id), D = [0, v / 2, v], G = [0, P / 2, P];
7919
7923
  C.forEach(($) => {
7920
7924
  D.push($.x, $.x + ($.width || 0) / 2, $.x + ($.width || 0)), G.push($.y, $.y + ($.height || 0) / 2, $.y + ($.height || 0));
7921
7925
  });
7922
- const et = ($, Kt, Ie) => {
7923
- const Le = [0, Kt / 2, Kt];
7926
+ const et = ($, Jt, De) => {
7927
+ const Re = [0, Jt / 2, Jt];
7924
7928
  let ce = null;
7925
- return Le.forEach((De) => {
7926
- Ie.forEach((Jt) => {
7927
- const te = Math.abs($ + De - Jt);
7928
- te <= d && (!ce || te < ce.d) && (ce = { d: te, snapped: Jt - De, line: Jt });
7929
+ return Re.forEach((We) => {
7930
+ De.forEach((te) => {
7931
+ const ee = Math.abs($ + We - te);
7932
+ ee <= d && (!ce || ee < ce.d) && (ce = { d: ee, snapped: te - We, line: te });
7929
7933
  });
7930
7934
  }), ce;
7931
7935
  }, gt = { v: [], h: [] }, W = et(u, p, D);
7932
7936
  W && (u = W.snapped, gt.v.push(W.line));
7933
- const lt = et(y, x, G);
7934
- lt && (y = lt.snapped, gt.h.push(lt.line)), Ut.current = gt, u = Math.max(0, Math.min(v - b.width, u)), y = Math.max(0, Math.min(P - b.height, y));
7937
+ const ct = et(y, x, G);
7938
+ ct && (y = ct.snapped, gt.h.push(ct.line)), at.current = gt, u = Math.max(0, Math.min(v - b.width, u)), y = Math.max(0, Math.min(P - b.height, y));
7935
7939
  const It = () => {
7936
- const $ = u, Kt = u + p, Ie = y, Le = y + x, ce = (ut) => Math.min(Le, ut.y + (ut.height || 0)) - Math.max(Ie, ut.y), De = (ut) => Math.min(Kt, ut.x + (ut.width || 0)) - Math.max($, ut.x);
7937
- let Jt = null, te = null, Re = null, We = null;
7940
+ const $ = u, Jt = u + p, De = y, Re = y + x, ce = (ut) => Math.min(Re, ut.y + (ut.height || 0)) - Math.max(De, ut.y), We = (ut) => Math.min(Jt, ut.x + (ut.width || 0)) - Math.max($, ut.x);
7941
+ let te = null, ee = null, Be = null, Pe = null;
7938
7942
  return C.forEach((ut) => {
7939
- const gi = ut.x + (ut.width || 0), ui = ut.y + (ut.height || 0);
7940
- ce(ut) > 0 && (gi <= $ && (!Jt || gi > Jt.edge) && (Jt = { edge: gi, el: ut }), ut.x >= Kt && (!te || ut.x < te.edge) && (te = { edge: ut.x, el: ut })), De(ut) > 0 && (ui <= Ie && (!Re || ui > Re.edge) && (Re = { edge: ui, el: ut }), ut.y >= Le && (!We || ut.y < We.edge) && (We = { edge: ut.y, el: ut }));
7941
- }), { L: Jt, R: te, T: Re, B: We };
7943
+ const fi = ut.x + (ut.width || 0), gi = ut.y + (ut.height || 0);
7944
+ ce(ut) > 0 && (fi <= $ && (!te || fi > te.edge) && (te = { edge: fi, el: ut }), ut.x >= Jt && (!ee || ut.x < ee.edge) && (ee = { edge: ut.x, el: ut })), We(ut) > 0 && (gi <= De && (!Be || gi > Be.edge) && (Be = { edge: gi, el: ut }), ut.y >= Re && (!Pe || ut.y < Pe.edge) && (Pe = { edge: ut.y, el: ut }));
7945
+ }), { L: te, R: ee, T: Be, B: Pe };
7942
7946
  };
7943
- let { L: wt, R: kt, T: Tt, B: jt } = It();
7947
+ let { L: wt, R: kt, T: Mt, B: Ct } = It();
7944
7948
  if (!W && wt && kt) {
7945
7949
  const $ = (wt.edge + kt.edge - p) / 2;
7946
7950
  Math.abs(u - $) <= d && (u = $);
7947
7951
  }
7948
- if (!lt && Tt && jt) {
7949
- const $ = (Tt.edge + jt.edge - x) / 2;
7952
+ if (!ct && Mt && Ct) {
7953
+ const $ = (Mt.edge + Ct.edge - x) / 2;
7950
7954
  Math.abs(y - $) <= d && (y = $);
7951
7955
  }
7952
- u = Math.max(0, Math.min(v - b.width, u)), y = Math.max(0, Math.min(P - b.height, y)), { L: wt, R: kt, T: Tt, B: jt } = It();
7953
- const Mt = u, Xt = u + p, Ht = y, Me = y + x, Ae = ($) => (Math.max(Ht, $.y) + Math.min(Me, $.y + ($.height || 0))) / 2, Ee = ($) => (Math.max(Mt, $.x) + Math.min(Xt, $.x + ($.width || 0))) / 2, si = wt ? Math.round(Mt - wt.edge) : null, li = kt ? Math.round(kt.edge - Xt) : null, ci = Tt ? Math.round(Ht - Tt.edge) : null, di = jt ? Math.round(jt.edge - Me) : null, hi = wt && kt && si === li, fi = Tt && jt && ci === di, Se = [];
7954
- if (wt && !hi) {
7955
- const $ = Ae(wt.el);
7956
- Se.push({ x1: wt.edge, y1: $, x2: Mt, y2: $, label: si });
7956
+ u = Math.max(0, Math.min(v - b.width, u)), y = Math.max(0, Math.min(P - b.height, y)), { L: wt, R: kt, T: Mt, B: Ct } = It();
7957
+ const At = u, Qt = u + p, Ht = y, Ee = y + x, Ie = ($) => (Math.max(Ht, $.y) + Math.min(Ee, $.y + ($.height || 0))) / 2, Le = ($) => (Math.max(At, $.x) + Math.min(Qt, $.x + ($.width || 0))) / 2, ni = wt ? Math.round(At - wt.edge) : null, si = kt ? Math.round(kt.edge - Qt) : null, li = Mt ? Math.round(Ht - Mt.edge) : null, ci = Ct ? Math.round(Ct.edge - Ee) : null, di = wt && kt && ni === si, hi = Mt && Ct && li === ci, Se = [];
7958
+ if (wt && !di) {
7959
+ const $ = Ie(wt.el);
7960
+ Se.push({ x1: wt.edge, y1: $, x2: At, y2: $, label: ni });
7957
7961
  }
7958
- if (kt && !hi) {
7959
- const $ = Ae(kt.el);
7960
- Se.push({ x1: Xt, y1: $, x2: kt.edge, y2: $, label: li });
7962
+ if (kt && !di) {
7963
+ const $ = Ie(kt.el);
7964
+ Se.push({ x1: Qt, y1: $, x2: kt.edge, y2: $, label: si });
7961
7965
  }
7962
- if (Tt && !fi) {
7963
- const $ = Ee(Tt.el);
7964
- Se.push({ x1: $, y1: Tt.edge, x2: $, y2: Ht, label: ci });
7966
+ if (Mt && !hi) {
7967
+ const $ = Le(Mt.el);
7968
+ Se.push({ x1: $, y1: Mt.edge, x2: $, y2: Ht, label: li });
7965
7969
  }
7966
- if (jt && !fi) {
7967
- const $ = Ee(jt.el);
7968
- Se.push({ x1: $, y1: Me, x2: $, y2: jt.edge, label: di });
7970
+ if (Ct && !hi) {
7971
+ const $ = Le(Ct.el);
7972
+ Se.push({ x1: $, y1: Ee, x2: $, y2: Ct.edge, label: ci });
7969
7973
  }
7970
- Xe.current = Se;
7974
+ q.current = Se;
7971
7975
  const ve = [];
7972
- if (hi) {
7973
- const $ = (Ae(wt.el) + Ae(kt.el)) / 2;
7974
- ve.push({ x1: wt.edge, y1: $, x2: Mt, y2: $, label: si }), ve.push({ x1: Xt, y1: $, x2: kt.edge, y2: $, label: li });
7976
+ if (di) {
7977
+ const $ = (Ie(wt.el) + Ie(kt.el)) / 2;
7978
+ ve.push({ x1: wt.edge, y1: $, x2: At, y2: $, label: ni }), ve.push({ x1: Qt, y1: $, x2: kt.edge, y2: $, label: si });
7975
7979
  }
7976
- if (fi) {
7977
- const $ = (Ee(Tt.el) + Ee(jt.el)) / 2;
7978
- ve.push({ x1: $, y1: Tt.edge, x2: $, y2: Ht, label: ci }), ve.push({ x1: $, y1: Me, x2: $, y2: jt.edge, label: di });
7980
+ if (hi) {
7981
+ const $ = (Le(Mt.el) + Le(Ct.el)) / 2;
7982
+ ve.push({ x1: $, y1: Mt.edge, x2: $, y2: Ht, label: li }), ve.push({ x1: $, y1: Ee, x2: $, y2: Ct.edge, label: ci });
7979
7983
  }
7980
- Qe.current = ve;
7984
+ Yt.current = ve;
7981
7985
  const Qi = {
7982
7986
  ...b,
7983
7987
  x: u,
@@ -7985,14 +7989,14 @@ const Wa = (r, o) => {
7985
7989
  };
7986
7990
  z(
7987
7991
  ($) => $.map(
7988
- (Kt) => Kt.id === b.id ? Qi : Kt
7992
+ (Jt) => Jt.id === b.id ? Qi : Jt
7989
7993
  )
7990
7994
  ), L(Qi), nt();
7991
7995
  }
7992
- }, [s, M, b, J, pt, _, rt, R, Ft, v, P, N, nt]), $i = Nt((i) => {
7993
- X && ne((a) => ({
7996
+ }, [s, M, b, J, pt, V, rt, R, Nt, v, P, N, nt]), $i = zt((i) => {
7997
+ Y && ne((a) => ({
7994
7998
  ...a,
7995
- [X.sectionName]: {
7999
+ [Y.sectionName]: {
7996
8000
  elements: N.map((c) => c.type === "image" ? {
7997
8001
  ...c,
7998
8002
  // Keep the image data reference
@@ -8002,7 +8006,7 @@ const Wa = (r, o) => {
8002
8006
  selectedColor: ot
8003
8007
  }
8004
8008
  }));
8005
- const t = _t[i.sectionName];
8009
+ const t = Ut[i.sectionName];
8006
8010
  if (t) {
8007
8011
  const a = t.elements.map((c) => {
8008
8012
  if (c.type === "image" && c.src && !c.imageData) {
@@ -8017,11 +8021,11 @@ const Wa = (r, o) => {
8017
8021
  }
8018
8022
  return c;
8019
8023
  });
8020
- z(a), St(t.selectedColor || ot);
8024
+ z(a), vt(t.selectedColor || ot);
8021
8025
  } else
8022
8026
  z([]);
8023
- je(i), L(null);
8024
- }, [X, N, ot, _t, nt]), ri = Nt((i) => {
8027
+ Ce(i), L(null);
8028
+ }, [Y, N, ot, Ut, nt]), ai = zt((i) => {
8025
8029
  if (i && i.type.startsWith("image/")) {
8026
8030
  const t = new FileReader();
8027
8031
  t.onload = (a) => {
@@ -8030,8 +8034,8 @@ const Wa = (r, o) => {
8030
8034
  const m = {
8031
8035
  id: Dt(),
8032
8036
  type: "image",
8033
- x: qt(v / 2 - 100),
8034
- y: qt(P / 2 - 100),
8037
+ x: Xt(v / 2 - 100),
8038
+ y: Xt(P / 2 - 100),
8035
8039
  width: Math.min(c.width, 200),
8036
8040
  // Limit initial size
8037
8041
  height: Math.min(c.height, 200),
@@ -8050,20 +8054,20 @@ const Wa = (r, o) => {
8050
8054
  }, t.readAsDataURL(i);
8051
8055
  } else
8052
8056
  alert("Please select a valid image file.");
8053
- }, [v, P, qt, Dt, mt]), Vi = Nt(
8057
+ }, [v, P, Xt, Dt, mt]), Vi = zt(
8054
8058
  Wa(() => {
8055
8059
  nt();
8056
8060
  }, 16),
8057
8061
  // 60fps limit
8058
8062
  [nt]
8059
8063
  );
8060
- ct(() => {
8064
+ st(() => {
8061
8065
  go.current || Vi();
8062
- }, [N, b, ft, Vi]), ct(() => {
8066
+ }, [N, b, ft, Vi]), st(() => {
8063
8067
  nt();
8064
8068
  }, [nt]);
8065
8069
  const Gi = (i) => {
8066
- if (!Ct) return { horizontal: [], vertical: [] };
8070
+ if (!Ft) return { horizontal: [], vertical: [] };
8067
8071
  const t = document.querySelector(".ruler-horizontal"), a = document.querySelector(".ruler-vertical");
8068
8072
  if (!t || !a)
8069
8073
  return { horizontal: [], vertical: [] };
@@ -8080,7 +8084,7 @@ const Wa = (r, o) => {
8080
8084
  });
8081
8085
  return { horizontal: p, vertical: x };
8082
8086
  }, [_i, Ui] = E({ horizontal: [], vertical: [] });
8083
- ct(() => {
8087
+ st(() => {
8084
8088
  const i = () => {
8085
8089
  setTimeout(() => {
8086
8090
  const c = Gi(M);
@@ -8095,33 +8099,33 @@ const Wa = (r, o) => {
8095
8099
  return window.addEventListener("resize", a), () => {
8096
8100
  window.removeEventListener("resize", a), clearTimeout(t);
8097
8101
  };
8098
- }, [M, Ct]), ct(() => {
8099
- if (Ct && !Qt) {
8102
+ }, [M, Ft]), st(() => {
8103
+ if (Ft && !Vt) {
8100
8104
  const i = setTimeout(() => {
8101
8105
  const t = Gi(M);
8102
8106
  Ui(t);
8103
8107
  }, 100);
8104
8108
  return () => clearTimeout(i);
8105
8109
  }
8106
- }, [Ct, Qt, M]);
8107
- const ni = vi(f), Yi = ni ? Da(N) : [], qi = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
8110
+ }, [Ft, Vt, M]);
8111
+ const ri = Si(f), Yi = ri ? Da(N) : [], qi = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
8108
8112
  /* @__PURE__ */ e.jsx(
8109
8113
  Ma,
8110
8114
  {
8111
8115
  selectedElement: b,
8112
8116
  selectedCount: j.length,
8113
- onUpdate: Te,
8117
+ onUpdate: Ae,
8114
8118
  onMoveLayer: Oi,
8115
8119
  onAlignSelection: Ho,
8116
8120
  onDistributeSelection: $o,
8117
8121
  onDeleteSelection: Vo,
8118
8122
  availableFonts: uo,
8119
8123
  theme: n,
8120
- isEmbroidery: ni,
8124
+ isEmbroidery: ri,
8121
8125
  onFontLoaded: nt,
8122
8126
  canvasWidth: v,
8123
8127
  canvasHeight: P,
8124
- printConfig: vt,
8128
+ printConfig: jt,
8125
8129
  onRemoveBackground: H ? Ri : null
8126
8130
  }
8127
8131
  ),
@@ -8134,7 +8138,7 @@ const Wa = (r, o) => {
8134
8138
  it(i ? [i.id] : []), L(i);
8135
8139
  },
8136
8140
  onMoveLayer: Oi,
8137
- onDeleteElement: ti,
8141
+ onDeleteElement: Je,
8138
8142
  theme: n
8139
8143
  }
8140
8144
  )
@@ -8143,21 +8147,21 @@ const Wa = (r, o) => {
8143
8147
  /* @__PURE__ */ e.jsx("div", { className: "designer-header", children: /* @__PURE__ */ e.jsx(
8144
8148
  ka,
8145
8149
  {
8146
- onAddElement: Je,
8147
- onDeleteElement: () => b && ti(b.id),
8148
- onDuplicateElement: () => b && ei(b.id),
8150
+ onAddElement: Ke,
8151
+ onDeleteElement: () => b && Je(b.id),
8152
+ onDuplicateElement: () => b && ti(b.id),
8149
8153
  onUndo: xe,
8150
8154
  onRedo: le,
8151
8155
  onToggleGrid: () => Rt(!ft),
8152
- onToggleRulers: () => xt(!Ct),
8153
- onToggleSnap: () => Gt(!Ft),
8154
- onTogglePrintGuides: () => de((i) => !i),
8155
- onImageUpload: ri,
8156
- canUndo: At > 0,
8157
- canRedo: At < Wt.length - 1,
8156
+ onToggleRulers: () => xt(!Ft),
8157
+ onToggleSnap: () => $t(!Nt),
8158
+ onTogglePrintGuides: () => re((i) => !i),
8159
+ onImageUpload: ai,
8160
+ canUndo: Et > 0,
8161
+ canRedo: Et < Wt.length - 1,
8158
8162
  showGrid: ft,
8159
- showRulers: Ct,
8160
- snapToGrid: Ft,
8163
+ showRulers: Ft,
8164
+ snapToGrid: Nt,
8161
8165
  showPrintGuides: ae,
8162
8166
  selectedElement: b,
8163
8167
  theme: n,
@@ -8174,7 +8178,7 @@ const Wa = (r, o) => {
8174
8178
  onRequireAuth: I
8175
8179
  }
8176
8180
  ) }),
8177
- ni && !ee && /* @__PURE__ */ e.jsxs(
8181
+ ri && !oe && /* @__PURE__ */ e.jsxs(
8178
8182
  "div",
8179
8183
  {
8180
8184
  role: "note",
@@ -8202,7 +8206,7 @@ const Wa = (r, o) => {
8202
8206
  "button",
8203
8207
  {
8204
8208
  type: "button",
8205
- onClick: () => oe(!0),
8209
+ onClick: () => je(!0),
8206
8210
  "aria-label": "Dismiss",
8207
8211
  style: { background: "none", border: "none", cursor: "pointer", fontSize: 18, color: "#9a3412", lineHeight: 1 },
8208
8212
  children: "×"
@@ -8212,7 +8216,7 @@ const Wa = (r, o) => {
8212
8216
  }
8213
8217
  ),
8214
8218
  /* @__PURE__ */ e.jsxs("div", { className: "designer-content", children: [
8215
- Ct && !Qt && /* @__PURE__ */ e.jsxs("div", { className: "rulers", children: [
8219
+ Ft && !Vt && /* @__PURE__ */ e.jsxs("div", { className: "rulers", children: [
8216
8220
  /* @__PURE__ */ e.jsx("div", { className: "ruler-horizontal", children: /* @__PURE__ */ e.jsx("div", { className: "ruler-horizontal-numbers", children: _i.horizontal.map((i, t) => /* @__PURE__ */ e.jsx(
8217
8221
  "span",
8218
8222
  {
@@ -8236,7 +8240,7 @@ const Wa = (r, o) => {
8236
8240
  "div",
8237
8241
  {
8238
8242
  className: "canvas-container",
8239
- ref: Et,
8243
+ ref: Ne,
8240
8244
  onDragOver: (i) => {
8241
8245
  s || i.preventDefault();
8242
8246
  },
@@ -8245,17 +8249,17 @@ const Wa = (r, o) => {
8245
8249
  if (s) return;
8246
8250
  i.preventDefault();
8247
8251
  const t = [...((a = i.dataTransfer) == null ? void 0 : a.files) || []].find((c) => c.type.startsWith("image/"));
8248
- t && ri(t);
8252
+ t && ai(t);
8249
8253
  },
8250
8254
  children: [
8251
- Qt && /* @__PURE__ */ e.jsx(
8255
+ Vt && /* @__PURE__ */ e.jsx(
8252
8256
  "button",
8253
8257
  {
8254
8258
  type: "button",
8255
8259
  className: "mobile-panel-toggle",
8256
8260
  "aria-label": "Open tools & properties",
8257
8261
  title: "Tools & properties",
8258
- onClick: () => he((i) => !i),
8262
+ onClick: () => de((i) => !i),
8259
8263
  style: {
8260
8264
  position: "absolute",
8261
8265
  top: 8,
@@ -8276,7 +8280,7 @@ const Wa = (r, o) => {
8276
8280
  }
8277
8281
  ),
8278
8282
  !s && N.length > 0 && (() => {
8279
- const i = [], t = ((vt == null ? void 0 : vt.safeAreaPct) || 0) / 100;
8283
+ const i = [], t = ((jt == null ? void 0 : jt.safeAreaPct) || 0) / 100;
8280
8284
  if (t) {
8281
8285
  const c = v * t, m = P * t, u = v * (1 - t), y = P * (1 - t);
8282
8286
  N.some(
@@ -8285,8 +8289,8 @@ const Wa = (r, o) => {
8285
8289
  }
8286
8290
  return N.some((c) => {
8287
8291
  var u;
8288
- const m = co(c, v, vt);
8289
- return m != null && ((u = ho(m, vt)) == null ? void 0 : u.level) === "bad";
8292
+ const m = co(c, v, jt);
8293
+ return m != null && ((u = ho(m, jt)) == null ? void 0 : u.level) === "bad";
8290
8294
  }) && i.push({ key: "dpi", text: "An image is low-resolution and may print blurry — try a larger file or smaller size." }), i.length ? /* @__PURE__ */ e.jsx("div", { style: {
8291
8295
  position: "absolute",
8292
8296
  top: 8,
@@ -8355,7 +8359,7 @@ const Wa = (r, o) => {
8355
8359
  }
8356
8360
  ),
8357
8361
  !s && N.length === 0 && (() => {
8358
- const i = Oe[(typeof Q == "number" ? Q : Oe.findIndex((a) => a.key === Q)) % Oe.length] || Oe[0], t = {
8362
+ const i = $e[(typeof Q == "number" ? Q : $e.findIndex((a) => a.key === Q)) % $e.length] || $e[0], t = {
8359
8363
  display: "inline-flex",
8360
8364
  alignItems: "center",
8361
8365
  gap: 6,
@@ -8447,10 +8451,10 @@ const Wa = (r, o) => {
8447
8451
  } }),
8448
8452
  /* @__PURE__ */ e.jsx("div", { style: {
8449
8453
  position: "absolute",
8450
- top: `${vt.safeAreaPct}%`,
8451
- left: `${vt.safeAreaPct}%`,
8452
- right: `${vt.safeAreaPct}%`,
8453
- bottom: `${vt.safeAreaPct}%`,
8454
+ top: `${jt.safeAreaPct}%`,
8455
+ left: `${jt.safeAreaPct}%`,
8456
+ right: `${jt.safeAreaPct}%`,
8457
+ bottom: `${jt.safeAreaPct}%`,
8454
8458
  border: "1px dashed rgba(37, 99, 235, 0.9)"
8455
8459
  }, children: /* @__PURE__ */ e.jsx("span", { style: {
8456
8460
  position: "absolute",
@@ -8468,7 +8472,7 @@ const Wa = (r, o) => {
8468
8472
  }
8469
8473
  ),
8470
8474
  b && !s && j.length <= 1 && (() => {
8471
- const i = Bt.current && Bt.current.getContext("2d"), t = i ? Ne(i, b) : { cx: b.x + (b.width || 0) / 2, y: b.y }, a = t.cx, c = t.y, m = ["image", "sticker", "embroidery"].includes(b.type), u = !!b.locked, y = {
8475
+ const i = Bt.current && Bt.current.getContext("2d"), t = i ? Te(i, b) : { cx: b.x + (b.width || 0) / 2, y: b.y }, a = t.cx, c = t.y, m = ["image", "sticker", "embroidery"].includes(b.type), u = !!b.locked, y = {
8472
8476
  width: 30,
8473
8477
  height: 30,
8474
8478
  border: "none",
@@ -8508,7 +8512,7 @@ const Wa = (r, o) => {
8508
8512
  d.stopPropagation(), Wi(1.1);
8509
8513
  }, children: /* @__PURE__ */ e.jsx(K, { name: "plus", size: 18, color: "#334155" }) }),
8510
8514
  /* @__PURE__ */ e.jsx("button", { style: y, title: "Duplicate", onClick: (d) => {
8511
- d.stopPropagation(), ei(b.id);
8515
+ d.stopPropagation(), ti(b.id);
8512
8516
  }, children: /* @__PURE__ */ e.jsx(K, { name: "duplicate", size: 18, color: "#334155" }) }),
8513
8517
  /* @__PURE__ */ e.jsx("button", { style: y, title: "Rotate left 15°", onClick: (d) => {
8514
8518
  d.stopPropagation(), Bi(-15);
@@ -8535,7 +8539,7 @@ const Wa = (r, o) => {
8535
8539
  !u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
8536
8540
  /* @__PURE__ */ e.jsx("span", { style: { width: 1, height: 20, background: "#e2e8f0", margin: "0 2px" } }),
8537
8541
  /* @__PURE__ */ e.jsx("button", { style: y, title: "Delete", onClick: (d) => {
8538
- d.stopPropagation(), ti();
8542
+ d.stopPropagation(), Je();
8539
8543
  }, children: /* @__PURE__ */ e.jsx(K, { name: "trash", size: 18, color: "#dc2626" }) })
8540
8544
  ] })
8541
8545
  ]
@@ -8548,7 +8552,7 @@ const Wa = (r, o) => {
8548
8552
  ]
8549
8553
  }
8550
8554
  ),
8551
- !Qt && /* @__PURE__ */ e.jsx("div", { className: "side-panels", children: qi })
8555
+ !Vt && /* @__PURE__ */ e.jsx("div", { className: "side-panels", children: qi })
8552
8556
  ] }),
8553
8557
  /* @__PURE__ */ e.jsxs("div", { className: "designer-footer", children: [
8554
8558
  /* @__PURE__ */ e.jsxs("div", { className: "section-thumbnails", children: [
@@ -8557,11 +8561,11 @@ const Wa = (r, o) => {
8557
8561
  /* @__PURE__ */ e.jsx("u", { children: f.name })
8558
8562
  ] }),
8559
8563
  /* @__PURE__ */ e.jsx("div", { className: "thumbnails-container", children: f.sections.map((i) => {
8560
- const t = _t[i.sectionName] && _t[i.sectionName].elements && _t[i.sectionName].elements.length > 0;
8564
+ const t = Ut[i.sectionName] && Ut[i.sectionName].elements && Ut[i.sectionName].elements.length > 0;
8561
8565
  return /* @__PURE__ */ e.jsxs(
8562
8566
  "div",
8563
8567
  {
8564
- className: `section-thumbnail compact ${X.sectionName === i.sectionName ? "active" : ""}`,
8568
+ className: `section-thumbnail compact ${Y.sectionName === i.sectionName ? "active" : ""}`,
8565
8569
  onClick: (a) => {
8566
8570
  a.stopPropagation();
8567
8571
  const c = f.sections.find((m) => m.sectionName === i.sectionName);
@@ -8598,7 +8602,7 @@ const Wa = (r, o) => {
8598
8602
  "button",
8599
8603
  {
8600
8604
  className: "zoom-button compact zoom-out",
8601
- onClick: () => U(Math.max(0.25, M - 0.25)),
8605
+ onClick: () => _(Math.max(0.25, M - 0.25)),
8602
8606
  disabled: M <= 0.25,
8603
8607
  title: "Zoom Out",
8604
8608
  children: /* @__PURE__ */ e.jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
@@ -8621,7 +8625,7 @@ const Wa = (r, o) => {
8621
8625
  max: "4",
8622
8626
  step: "0.25",
8623
8627
  value: M,
8624
- onChange: (i) => U(parseFloat(i.target.value)),
8628
+ onChange: (i) => _(parseFloat(i.target.value)),
8625
8629
  className: "zoom-slider compact"
8626
8630
  }
8627
8631
  ) })
@@ -8630,7 +8634,7 @@ const Wa = (r, o) => {
8630
8634
  "button",
8631
8635
  {
8632
8636
  className: "zoom-button compact zoom-in",
8633
- onClick: () => U(Math.min(4, M + 0.25)),
8637
+ onClick: () => _(Math.min(4, M + 0.25)),
8634
8638
  disabled: M >= 4,
8635
8639
  title: "Zoom In",
8636
8640
  children: /* @__PURE__ */ e.jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
@@ -8645,7 +8649,7 @@ const Wa = (r, o) => {
8645
8649
  "button",
8646
8650
  {
8647
8651
  className: "zoom-reset compact",
8648
- onClick: () => U(1),
8652
+ onClick: () => _(1),
8649
8653
  title: "Reset Zoom (100%)",
8650
8654
  children: /* @__PURE__ */ e.jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
8651
8655
  /* @__PURE__ */ e.jsx("path", { d: "M3 3l18 18" }),
@@ -8657,11 +8661,11 @@ const Wa = (r, o) => {
8657
8661
  ] })
8658
8662
  ] })
8659
8663
  ] }),
8660
- Qt && Ye && /* @__PURE__ */ e.jsx(
8664
+ Vt && Xe && /* @__PURE__ */ e.jsx(
8661
8665
  "div",
8662
8666
  {
8663
8667
  className: "mobile-panel-modal-overlay",
8664
- onClick: () => he(!1),
8668
+ onClick: () => de(!1),
8665
8669
  style: {
8666
8670
  position: "fixed",
8667
8671
  inset: 0,
@@ -8707,7 +8711,7 @@ const Wa = (r, o) => {
8707
8711
  {
8708
8712
  type: "button",
8709
8713
  "aria-label": "Close",
8710
- onClick: () => he(!1),
8714
+ onClick: () => de(!1),
8711
8715
  style: {
8712
8716
  width: 32,
8713
8717
  height: 32,