@mypixia/simplex-designer 2.1.1 → 2.1.3

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 _e, { useState as N, useRef as nt, useEffect as et, useMemo as re, forwardRef as Ye, useCallback as ot, useReducer as qe, useImperativeHandle as Ve } from "react";
1
+ import _e, { useState as N, useRef as dt, useEffect as et, useMemo as ae, forwardRef as Ye, useCallback as ot, useReducer as qe, useImperativeHandle as Ve } from "react";
2
2
  import Xe from "qrcode";
3
3
  import Je from "react-barcode";
4
- import ae from "axios";
5
- import './index_external.css';var Rt = { exports: {} }, Tt = {};
4
+ import se from "axios";
5
+ import './index_external.css';var Dt = { exports: {} }, Tt = {};
6
6
  /**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.js
@@ -12,24 +12,24 @@ import './index_external.css';var Rt = { exports: {} }, Tt = {};
12
12
  * This source code is licensed under the MIT license found in the
13
13
  * LICENSE file in the root directory of this source tree.
14
14
  */
15
- var se;
15
+ var le;
16
16
  function Ke() {
17
- if (se) return Tt;
18
- se = 1;
17
+ if (le) return Tt;
18
+ le = 1;
19
19
  var d = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment");
20
- function a(l, s, h) {
21
- var y = null;
22
- if (h !== void 0 && (y = "" + h), s.key !== void 0 && (y = "" + s.key), "key" in s) {
23
- h = {};
20
+ function a(l, s, f) {
21
+ var x = null;
22
+ if (f !== void 0 && (x = "" + f), s.key !== void 0 && (x = "" + s.key), "key" in s) {
23
+ f = {};
24
24
  for (var c in s)
25
- c !== "key" && (h[c] = s[c]);
26
- } else h = s;
27
- return s = h.ref, {
25
+ c !== "key" && (f[c] = s[c]);
26
+ } else f = s;
27
+ return s = f.ref, {
28
28
  $$typeof: d,
29
29
  type: l,
30
- key: y,
30
+ key: x,
31
31
  ref: s !== void 0 ? s : null,
32
- props: h
32
+ props: f
33
33
  };
34
34
  }
35
35
  return Tt.Fragment = o, Tt.jsx = a, Tt.jsxs = a, Tt;
@@ -44,20 +44,20 @@ var jt = {};
44
44
  * This source code is licensed under the MIT license found in the
45
45
  * LICENSE file in the root directory of this source tree.
46
46
  */
47
- var le;
47
+ var ne;
48
48
  function Ze() {
49
- return le || (le = 1, process.env.NODE_ENV !== "production" && function() {
50
- function d(m) {
51
- if (m == null) return null;
52
- if (typeof m == "function")
53
- return m.$$typeof === rt ? null : m.displayName || m.name || null;
54
- if (typeof m == "string") return m;
55
- switch (m) {
49
+ return ne || (ne = 1, process.env.NODE_ENV !== "production" && function() {
50
+ function d(u) {
51
+ if (u == null) return null;
52
+ if (typeof u == "function")
53
+ return u.$$typeof === rt ? null : u.displayName || u.name || null;
54
+ if (typeof u == "string") return u;
55
+ switch (u) {
56
56
  case w:
57
57
  return "Fragment";
58
58
  case E:
59
59
  return "Profiler";
60
- case z:
60
+ case B:
61
61
  return "StrictMode";
62
62
  case W:
63
63
  return "Suspense";
@@ -66,126 +66,126 @@ function Ze() {
66
66
  case q:
67
67
  return "Activity";
68
68
  }
69
- if (typeof m == "object")
70
- switch (typeof m.tag == "number" && console.error(
69
+ if (typeof u == "object")
70
+ switch (typeof u.tag == "number" && console.error(
71
71
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
72
- ), m.$$typeof) {
72
+ ), u.$$typeof) {
73
73
  case T:
74
74
  return "Portal";
75
75
  case $:
76
- return (m.displayName || "Context") + ".Provider";
76
+ return (u.displayName || "Context") + ".Provider";
77
77
  case S:
78
- return (m._context.displayName || "Context") + ".Consumer";
79
- case B:
80
- var A = m.render;
81
- return m = m.displayName, m || (m = A.displayName || A.name || "", m = m !== "" ? "ForwardRef(" + m + ")" : "ForwardRef"), m;
78
+ return (u._context.displayName || "Context") + ".Consumer";
79
+ case z:
80
+ var A = u.render;
81
+ return u = u.displayName, u || (u = A.displayName || A.name || "", u = u !== "" ? "ForwardRef(" + u + ")" : "ForwardRef"), u;
82
82
  case U:
83
- return A = m.displayName || null, A !== null ? A : d(m.type) || "Memo";
83
+ return A = u.displayName || null, A !== null ? A : d(u.type) || "Memo";
84
84
  case ft:
85
- A = m._payload, m = m._init;
85
+ A = u._payload, u = u._init;
86
86
  try {
87
- return d(m(A));
87
+ return d(u(A));
88
88
  } catch {
89
89
  }
90
90
  }
91
91
  return null;
92
92
  }
93
- function o(m) {
94
- return "" + m;
93
+ function o(u) {
94
+ return "" + u;
95
95
  }
96
- function a(m) {
96
+ function a(u) {
97
97
  try {
98
- o(m);
98
+ o(u);
99
99
  var A = !1;
100
100
  } catch {
101
101
  A = !0;
102
102
  }
103
103
  if (A) {
104
104
  A = console;
105
- var Q = A.error, _ = typeof Symbol == "function" && Symbol.toStringTag && m[Symbol.toStringTag] || m.constructor.name || "Object";
105
+ var Q = A.error, _ = typeof Symbol == "function" && Symbol.toStringTag && u[Symbol.toStringTag] || u.constructor.name || "Object";
106
106
  return Q.call(
107
107
  A,
108
108
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
109
109
  _
110
- ), o(m);
110
+ ), o(u);
111
111
  }
112
112
  }
113
- function l(m) {
114
- if (m === w) return "<>";
115
- if (typeof m == "object" && m !== null && m.$$typeof === ft)
113
+ function l(u) {
114
+ if (u === w) return "<>";
115
+ if (typeof u == "object" && u !== null && u.$$typeof === ft)
116
116
  return "<...>";
117
117
  try {
118
- var A = d(m);
118
+ var A = d(u);
119
119
  return A ? "<" + A + ">" : "<...>";
120
120
  } catch {
121
121
  return "<...>";
122
122
  }
123
123
  }
124
124
  function s() {
125
- var m = Y.A;
126
- return m === null ? null : m.getOwner();
125
+ var u = Y.A;
126
+ return u === null ? null : u.getOwner();
127
127
  }
128
- function h() {
128
+ function f() {
129
129
  return Error("react-stack-top-frame");
130
130
  }
131
- function y(m) {
132
- if (O.call(m, "key")) {
133
- var A = Object.getOwnPropertyDescriptor(m, "key").get;
131
+ function x(u) {
132
+ if (O.call(u, "key")) {
133
+ var A = Object.getOwnPropertyDescriptor(u, "key").get;
134
134
  if (A && A.isReactWarning) return !1;
135
135
  }
136
- return m.key !== void 0;
136
+ return u.key !== void 0;
137
137
  }
138
- function c(m, A) {
138
+ function c(u, A) {
139
139
  function Q() {
140
140
  K || (K = !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
  A
143
143
  ));
144
144
  }
145
- Q.isReactWarning = !0, Object.defineProperty(m, "key", {
145
+ Q.isReactWarning = !0, Object.defineProperty(u, "key", {
146
146
  get: Q,
147
147
  configurable: !0
148
148
  });
149
149
  }
150
- function u() {
151
- var m = d(this.type);
152
- return it[m] || (it[m] = !0, console.error(
150
+ function y() {
151
+ var u = d(this.type);
152
+ return it[u] || (it[u] = !0, console.error(
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
- )), m = this.props.ref, m !== void 0 ? m : null;
154
+ )), u = this.props.ref, u !== void 0 ? u : null;
155
155
  }
156
- function x(m, A, Q, _, Z, V, ht, H) {
157
- return Q = V.ref, m = {
156
+ function g(u, A, Q, _, Z, V, ht, H) {
157
+ return Q = V.ref, u = {
158
158
  $$typeof: I,
159
- type: m,
159
+ type: u,
160
160
  key: A,
161
161
  props: V,
162
162
  _owner: Z
163
- }, (Q !== void 0 ? Q : null) !== null ? Object.defineProperty(m, "ref", {
163
+ }, (Q !== void 0 ? Q : null) !== null ? Object.defineProperty(u, "ref", {
164
164
  enumerable: !1,
165
- get: u
166
- }) : Object.defineProperty(m, "ref", { enumerable: !1, value: null }), m._store = {}, Object.defineProperty(m._store, "validated", {
165
+ get: y
166
+ }) : Object.defineProperty(u, "ref", { enumerable: !1, value: null }), u._store = {}, Object.defineProperty(u._store, "validated", {
167
167
  configurable: !1,
168
168
  enumerable: !1,
169
169
  writable: !0,
170
170
  value: 0
171
- }), Object.defineProperty(m, "_debugInfo", {
171
+ }), Object.defineProperty(u, "_debugInfo", {
172
172
  configurable: !1,
173
173
  enumerable: !1,
174
174
  writable: !0,
175
175
  value: null
176
- }), Object.defineProperty(m, "_debugStack", {
176
+ }), Object.defineProperty(u, "_debugStack", {
177
177
  configurable: !1,
178
178
  enumerable: !1,
179
179
  writable: !0,
180
180
  value: ht
181
- }), Object.defineProperty(m, "_debugTask", {
181
+ }), Object.defineProperty(u, "_debugTask", {
182
182
  configurable: !1,
183
183
  enumerable: !1,
184
184
  writable: !0,
185
185
  value: H
186
- }), Object.freeze && (Object.freeze(m.props), Object.freeze(m)), m;
186
+ }), Object.freeze && (Object.freeze(u.props), Object.freeze(u)), u;
187
187
  }
188
- function F(m, A, Q, _, Z, V, ht, H) {
188
+ function F(u, A, Q, _, Z, V, ht, H) {
189
189
  var P = A.children;
190
190
  if (P !== void 0)
191
191
  if (_)
@@ -199,11 +199,11 @@ function Ze() {
199
199
  );
200
200
  else C(P);
201
201
  if (O.call(A, "key")) {
202
- P = d(m);
203
- var ct = Object.keys(A).filter(function(Dt) {
204
- return Dt !== "key";
202
+ P = d(u);
203
+ var nt = Object.keys(A).filter(function(Et) {
204
+ return Et !== "key";
205
205
  });
206
- _ = 0 < ct.length ? "{key: someKey, " + ct.join(": ..., ") + ": ...}" : "{key: someKey}", j[P + _] || (ct = 0 < ct.length ? "{" + ct.join(": ..., ") + ": ...}" : "{}", console.error(
206
+ _ = 0 < nt.length ? "{key: someKey, " + nt.join(": ..., ") + ": ...}" : "{key: someKey}", j[P + _] || (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,20 +212,20 @@ React keys must be passed directly to JSX without using spread:
212
212
  <%s key={someKey} {...props} />`,
213
213
  _,
214
214
  P,
215
- ct,
215
+ nt,
216
216
  P
217
217
  ), j[P + _] = !0);
218
218
  }
219
- if (P = null, Q !== void 0 && (a(Q), P = "" + Q), y(A) && (a(A.key), P = "" + A.key), "key" in A) {
219
+ if (P = null, Q !== void 0 && (a(Q), P = "" + Q), x(A) && (a(A.key), P = "" + A.key), "key" in A) {
220
220
  Q = {};
221
221
  for (var gt in A)
222
222
  gt !== "key" && (Q[gt] = A[gt]);
223
223
  } else Q = A;
224
224
  return P && c(
225
225
  Q,
226
- typeof m == "function" ? m.displayName || m.name || "Unknown" : m
227
- ), x(
228
- m,
226
+ typeof u == "function" ? u.displayName || u.name || "Unknown" : u
227
+ ), g(
228
+ u,
229
229
  P,
230
230
  V,
231
231
  Z,
@@ -235,54 +235,54 @@ React keys must be passed directly to JSX without using spread:
235
235
  H
236
236
  );
237
237
  }
238
- function C(m) {
239
- typeof m == "object" && m !== null && m.$$typeof === I && m._store && (m._store.validated = 1);
238
+ function C(u) {
239
+ typeof u == "object" && u !== null && u.$$typeof === I && u._store && (u._store.validated = 1);
240
240
  }
241
- var p = _e, I = Symbol.for("react.transitional.element"), T = Symbol.for("react.portal"), w = Symbol.for("react.fragment"), z = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), S = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), at = Symbol.for("react.suspense_list"), U = Symbol.for("react.memo"), ft = Symbol.for("react.lazy"), q = Symbol.for("react.activity"), rt = Symbol.for("react.client.reference"), Y = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, O = Object.prototype.hasOwnProperty, J = Array.isArray, st = console.createTask ? console.createTask : function() {
241
+ var p = _e, I = Symbol.for("react.transitional.element"), T = Symbol.for("react.portal"), w = Symbol.for("react.fragment"), B = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), S = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), z = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), at = Symbol.for("react.suspense_list"), U = Symbol.for("react.memo"), ft = Symbol.for("react.lazy"), q = Symbol.for("react.activity"), rt = Symbol.for("react.client.reference"), Y = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, O = Object.prototype.hasOwnProperty, J = Array.isArray, st = console.createTask ? console.createTask : function() {
242
242
  return null;
243
243
  };
244
244
  p = {
245
- "react-stack-bottom-frame": function(m) {
246
- return m();
245
+ "react-stack-bottom-frame": function(u) {
246
+ return u();
247
247
  }
248
248
  };
249
249
  var K, it = {}, M = p["react-stack-bottom-frame"].bind(
250
250
  p,
251
- h
252
- )(), G = st(l(h)), j = {};
253
- jt.Fragment = w, jt.jsx = function(m, A, Q, _, Z) {
251
+ f
252
+ )(), G = st(l(f)), j = {};
253
+ jt.Fragment = w, jt.jsx = function(u, A, Q, _, Z) {
254
254
  var V = 1e4 > Y.recentlyCreatedOwnerStacks++;
255
255
  return F(
256
- m,
256
+ u,
257
257
  A,
258
258
  Q,
259
259
  !1,
260
260
  _,
261
261
  Z,
262
262
  V ? Error("react-stack-top-frame") : M,
263
- V ? st(l(m)) : G
263
+ V ? st(l(u)) : G
264
264
  );
265
- }, jt.jsxs = function(m, A, Q, _, Z) {
265
+ }, jt.jsxs = function(u, A, Q, _, Z) {
266
266
  var V = 1e4 > Y.recentlyCreatedOwnerStacks++;
267
267
  return F(
268
- m,
268
+ u,
269
269
  A,
270
270
  Q,
271
271
  !0,
272
272
  _,
273
273
  Z,
274
274
  V ? Error("react-stack-top-frame") : M,
275
- V ? st(l(m)) : G
275
+ V ? st(l(u)) : G
276
276
  );
277
277
  };
278
278
  }()), jt;
279
279
  }
280
- var ne;
280
+ var ce;
281
281
  function ti() {
282
- return ne || (ne = 1, process.env.NODE_ENV === "production" ? Rt.exports = Ke() : Rt.exports = Ze()), Rt.exports;
282
+ return ce || (ce = 1, process.env.NODE_ENV === "production" ? Dt.exports = Ke() : Dt.exports = Ze()), Dt.exports;
283
283
  }
284
284
  var i = ti();
285
- const Pt = {
285
+ const Ut = {
286
286
  business: {
287
287
  name: "Business & Office",
288
288
  icons: [
@@ -373,32 +373,32 @@ const Pt = {
373
373
  { name: "shield", symbol: "🛡️", unicode: "🛡️" }
374
374
  ]
375
375
  }
376
- }, de = () => Object.values(Pt).flatMap(
376
+ }, fe = () => Object.values(Ut).flatMap(
377
377
  (d) => d.icons.map((o) => ({
378
378
  ...o,
379
379
  category: d.name
380
380
  }))
381
- ), ei = (d) => de().filter(
381
+ ), ei = (d) => fe().filter(
382
382
  (a) => a.name.toLowerCase().includes(d.toLowerCase()) || a.category.toLowerCase().includes(d.toLowerCase())
383
383
  ), ii = ({ onSelectIcon: d, disabled: o = !1 }) => {
384
- const [a, l] = N(!1), [s, h] = N(""), [y, c] = N("all"), u = nt(null);
384
+ const [a, l] = N(!1), [s, f] = N(""), [x, c] = N("all"), y = dt(null);
385
385
  et(() => {
386
386
  const p = (I) => {
387
- u.current && !u.current.contains(I.target) && l(!1);
387
+ y.current && !y.current.contains(I.target) && l(!1);
388
388
  };
389
389
  return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
390
390
  }, []);
391
- const x = (p) => {
392
- d(p), l(!1), h("");
391
+ const g = (p) => {
392
+ d(p), l(!1), f("");
393
393
  }, C = (() => {
394
- let p = de();
395
- if (s.trim() && (p = ei(s)), y !== "all") {
396
- const I = Pt[y];
394
+ let p = fe();
395
+ if (s.trim() && (p = ei(s)), x !== "all") {
396
+ const I = Ut[x];
397
397
  I && (p = p.filter((T) => T.category === I.name));
398
398
  }
399
399
  return p;
400
400
  })();
401
- return /* @__PURE__ */ i.jsxs("div", { className: "icon-selector", ref: u, children: [
401
+ return /* @__PURE__ */ i.jsxs("div", { className: "icon-selector", ref: y, children: [
402
402
  /* @__PURE__ */ i.jsxs(
403
403
  "button",
404
404
  {
@@ -421,19 +421,19 @@ const Pt = {
421
421
  type: "text",
422
422
  placeholder: "Search icons...",
423
423
  value: s,
424
- onChange: (p) => h(p.target.value),
424
+ onChange: (p) => f(p.target.value),
425
425
  className: "icon-search"
426
426
  }
427
427
  ),
428
428
  /* @__PURE__ */ i.jsxs(
429
429
  "select",
430
430
  {
431
- value: y,
431
+ value: x,
432
432
  onChange: (p) => c(p.target.value),
433
433
  className: "category-select",
434
434
  children: [
435
435
  /* @__PURE__ */ i.jsx("option", { value: "all", children: "All Categories" }),
436
- Object.entries(Pt).map(([p, I]) => /* @__PURE__ */ i.jsx("option", { value: p, children: I.name }, p))
436
+ Object.entries(Ut).map(([p, I]) => /* @__PURE__ */ i.jsx("option", { value: p, children: I.name }, p))
437
437
  ]
438
438
  }
439
439
  )
@@ -442,7 +442,7 @@ const Pt = {
442
442
  "button",
443
443
  {
444
444
  className: "icon-item",
445
- onClick: () => x(p),
445
+ onClick: () => g(p),
446
446
  title: `${p.name} (${p.category})`,
447
447
  children: [
448
448
  /* @__PURE__ */ i.jsx("span", { className: "icon-symbol", children: p.symbol }),
@@ -459,10 +459,10 @@ const Pt = {
459
459
  ] })
460
460
  ] });
461
461
  }, oi = ({ isOpen: d, onClose: o, onAddQRCode: a, theme: l }) => {
462
- const [s, h] = N(""), [y, c] = N(""), [u, x] = N(200), [F, C] = N("M"), p = () => {
462
+ const [s, f] = N(""), [x, c] = N(""), [y, g] = N(200), [F, C] = N("M"), p = () => {
463
463
  if (!s.trim()) return;
464
464
  const w = {
465
- width: u,
465
+ width: y,
466
466
  errorCorrectionLevel: F,
467
467
  type: "image/png",
468
468
  quality: 0.92,
@@ -472,31 +472,31 @@ const Pt = {
472
472
  light: "#FFFFFF"
473
473
  }
474
474
  };
475
- Xe.toDataURL(s, w, (z, E) => {
476
- if (z) {
477
- console.error("QR Code generation error:", z);
475
+ Xe.toDataURL(s, w, (B, E) => {
476
+ if (B) {
477
+ console.error("QR Code generation error:", B);
478
478
  return;
479
479
  }
480
480
  c(E);
481
481
  });
482
482
  }, I = () => {
483
- if (!y) return;
483
+ if (!x) return;
484
484
  const w = new Image();
485
485
  w.onload = () => {
486
486
  a({
487
487
  type: "qrcode",
488
- src: y,
488
+ src: x,
489
489
  data: s,
490
- width: u,
491
- height: u,
490
+ width: y,
491
+ height: y,
492
492
  x: 100,
493
493
  y: 100,
494
494
  imageObject: w
495
495
  // Store the loaded image object
496
496
  }), T();
497
- }, w.src = y;
497
+ }, w.src = x;
498
498
  }, T = () => {
499
- h(""), c(""), o();
499
+ f(""), c(""), o();
500
500
  };
501
501
  return d ? /* @__PURE__ */ i.jsx("div", { className: "qr-modal-overlay", onClick: T, children: /* @__PURE__ */ i.jsxs("div", { className: "qr-modal-content", onClick: (w) => w.stopPropagation(), children: [
502
502
  /* @__PURE__ */ i.jsxs("div", { className: "qr-modal-header", children: [
@@ -519,7 +519,7 @@ const Pt = {
519
519
  {
520
520
  id: "qr-data",
521
521
  value: s,
522
- onChange: (w) => h(w.target.value),
522
+ onChange: (w) => f(w.target.value),
523
523
  placeholder: "https://example.com or any text...",
524
524
  rows: 3
525
525
  }
@@ -533,8 +533,8 @@ const Pt = {
533
533
  {
534
534
  type: "number",
535
535
  id: "qr-size",
536
- value: u,
537
- onChange: (w) => x(Math.max(50, Math.min(500, parseInt(w.target.value) || 200))),
536
+ value: y,
537
+ onChange: (w) => g(Math.max(50, Math.min(500, parseInt(w.target.value) || 200))),
538
538
  min: "50",
539
539
  max: "500"
540
540
  }
@@ -567,9 +567,9 @@ const Pt = {
567
567
  children: "Generate QR Code"
568
568
  }
569
569
  ) }),
570
- y && /* @__PURE__ */ i.jsxs("div", { className: "qr-preview", children: [
570
+ x && /* @__PURE__ */ i.jsxs("div", { className: "qr-preview", children: [
571
571
  /* @__PURE__ */ i.jsx("h4", { children: "Preview" }),
572
- /* @__PURE__ */ i.jsx("div", { className: "qr-preview-container", children: /* @__PURE__ */ i.jsx("img", { src: y, alt: "QR Code Preview" }) }),
572
+ /* @__PURE__ */ i.jsx("div", { className: "qr-preview-container", children: /* @__PURE__ */ i.jsx("img", { src: x, alt: "QR Code Preview" }) }),
573
573
  /* @__PURE__ */ i.jsx(
574
574
  "button",
575
575
  {
@@ -586,7 +586,7 @@ const Pt = {
586
586
  ] })
587
587
  ] }) }) : null;
588
588
  }, ri = ({ isOpen: d, onClose: o, onAddBarcode: a, theme: l }) => {
589
- const [s, h] = N(""), [y, c] = N("CODE128"), [u, x] = N(null), [F, C] = N(2), [p, I] = N(100), [T, w] = N(20), [z, E] = N("center"), [S, $] = N("bottom"), [B, W] = N(10), at = nt(null), U = [
589
+ const [s, f] = N(""), [x, c] = N("CODE128"), [y, g] = N(null), [F, C] = N(2), [p, I] = N(100), [T, w] = N(20), [B, E] = N("center"), [S, $] = N("bottom"), [z, W] = N(10), at = dt(null), U = [
590
590
  { value: "CODE128", label: "CODE128 (Most Common)" },
591
591
  { value: "EAN13", label: "EAN-13 (European Article Number)" },
592
592
  { value: "EAN8", label: "EAN-8 (Short EAN)" },
@@ -599,17 +599,17 @@ const Pt = {
599
599
  ], ft = () => {
600
600
  if (s.trim())
601
601
  try {
602
- x(/* @__PURE__ */ i.jsx(
602
+ g(/* @__PURE__ */ i.jsx(
603
603
  Je,
604
604
  {
605
605
  value: s,
606
- format: y,
606
+ format: x,
607
607
  width: F,
608
608
  height: p,
609
609
  fontSize: T,
610
- textAlign: z,
610
+ textAlign: B,
611
611
  textPosition: S,
612
- margin: B,
612
+ margin: z,
613
613
  background: "#ffffff",
614
614
  lineColor: "#000000"
615
615
  }
@@ -619,15 +619,15 @@ const Pt = {
619
619
  }
620
620
  }, q = () => {
621
621
  var O, J, st, K;
622
- if (!(!u || !at.current))
622
+ if (!(!y || !at.current))
623
623
  try {
624
624
  const it = at.current.querySelector("svg");
625
625
  if (!it) {
626
626
  console.error("No SVG element found in barcode");
627
627
  return;
628
628
  }
629
- const M = document.createElement("canvas"), G = M.getContext("2d"), j = it.getBoundingClientRect(), m = ((J = (O = it.width) == null ? void 0 : O.baseVal) == null ? void 0 : J.value) || j.width || 200, A = ((K = (st = it.height) == null ? void 0 : st.baseVal) == null ? void 0 : K.value) || j.height || 100;
630
- M.width = m, M.height = A;
629
+ const M = document.createElement("canvas"), G = M.getContext("2d"), j = it.getBoundingClientRect(), u = ((J = (O = it.width) == null ? void 0 : O.baseVal) == null ? void 0 : J.value) || j.width || 200, A = ((K = (st = it.height) == null ? void 0 : st.baseVal) == null ? void 0 : K.value) || j.height || 100;
630
+ M.width = u, M.height = A;
631
631
  const Q = new XMLSerializer().serializeToString(it), _ = new Blob([Q], { type: "image/svg+xml;charset=utf-8" }), Z = URL.createObjectURL(_), V = new Image();
632
632
  V.onload = () => {
633
633
  G.drawImage(V, 0, 0);
@@ -637,8 +637,8 @@ const Pt = {
637
637
  type: "barcode",
638
638
  src: ht,
639
639
  data: s,
640
- format: y,
641
- width: m,
640
+ format: x,
641
+ width: u,
642
642
  height: A,
643
643
  x: 100,
644
644
  y: 100,
@@ -650,7 +650,7 @@ const Pt = {
650
650
  console.error("Error adding barcode to canvas:", it), alert("Failed to add barcode to canvas. Please try again.");
651
651
  }
652
652
  }, rt = () => {
653
- h(""), x(null), c("CODE128"), C(2), I(100), w(20), o();
653
+ f(""), g(null), c("CODE128"), C(2), I(100), w(20), o();
654
654
  }, Y = (O) => ({
655
655
  CODE128: "Supports all ASCII characters. Most versatile format.",
656
656
  EAN13: "Requires exactly 12 digits (13th is checksum). Used for retail products.",
@@ -684,7 +684,7 @@ const Pt = {
684
684
  type: "text",
685
685
  id: "barcode-data",
686
686
  value: s,
687
- onChange: (O) => h(O.target.value),
687
+ onChange: (O) => f(O.target.value),
688
688
  placeholder: "Enter your data..."
689
689
  }
690
690
  )
@@ -695,12 +695,12 @@ const Pt = {
695
695
  "select",
696
696
  {
697
697
  id: "barcode-format",
698
- value: y,
698
+ value: x,
699
699
  onChange: (O) => c(O.target.value),
700
700
  children: U.map((O) => /* @__PURE__ */ i.jsx("option", { value: O.value, children: O.label }, O.value))
701
701
  }
702
702
  ),
703
- /* @__PURE__ */ i.jsx("small", { className: "format-description", children: Y(y) })
703
+ /* @__PURE__ */ i.jsx("small", { className: "format-description", children: Y(x) })
704
704
  ] }),
705
705
  /* @__PURE__ */ i.jsxs("div", { className: "barcode-options", children: [
706
706
  /* @__PURE__ */ i.jsxs("div", { className: "barcode-form-group", children: [
@@ -783,9 +783,9 @@ const Pt = {
783
783
  children: "Generate Barcode"
784
784
  }
785
785
  ) }),
786
- u && /* @__PURE__ */ i.jsxs("div", { className: "barcode-preview", children: [
786
+ y && /* @__PURE__ */ i.jsxs("div", { className: "barcode-preview", children: [
787
787
  /* @__PURE__ */ i.jsx("h4", { children: "Preview" }),
788
- /* @__PURE__ */ i.jsx("div", { className: "barcode-preview-container", ref: at, children: u }),
788
+ /* @__PURE__ */ i.jsx("div", { className: "barcode-preview-container", ref: at, children: y }),
789
789
  /* @__PURE__ */ i.jsx(
790
790
  "button",
791
791
  {
@@ -847,7 +847,7 @@ const Pt = {
847
847
  children: "Get API Key"
848
848
  }
849
849
  )
850
- ] }), ce = () => /* @__PURE__ */ i.jsxs("div", { style: { textAlign: "center", padding: "40px" }, children: [
850
+ ] }), de = () => /* @__PURE__ */ i.jsxs("div", { style: { textAlign: "center", padding: "40px" }, children: [
851
851
  /* @__PURE__ */ i.jsx("div", { style: {
852
852
  border: "4px solid #f3f3f3",
853
853
  borderTop: "4px solid #3498db",
@@ -864,10 +864,10 @@ const Pt = {
864
864
  100% { transform: rotate(360deg); }
865
865
  }
866
866
  ` })
867
- ] }), si = ({ isOpen: d, onClose: o, onAddSticker: a, theme: l, apiKey: s, apiEndpoint: h }) => {
868
- const [y, c] = N([]), [u, x] = N(!1), [F, C] = N(null), [p, I] = N(""), [T, w] = N(""), [z, E] = N({});
869
- nt(null);
870
- const [S, $] = N(!1), [B, W] = N(!1), [at, U] = N(!1), ft = `${h}/api/v1/designer`;
867
+ ] }), si = ({ isOpen: d, onClose: o, onAddSticker: a, theme: l, apiKey: s, apiEndpoint: f }) => {
868
+ const [x, c] = N([]), [y, g] = N(!1), [F, C] = N(null), [p, I] = N(""), [T, w] = N(""), [B, E] = N({});
869
+ dt(null);
870
+ const [S, $] = N(!1), [z, W] = N(!1), [at, U] = N(!1), ft = `${f}/api/v1/designer`;
871
871
  et(() => {
872
872
  d && s && q();
873
873
  }, [d, s]);
@@ -881,7 +881,7 @@ const Pt = {
881
881
  }
882
882
  const M = `${ft}/get-subscription-status/${s}`;
883
883
  try {
884
- (await ae.get(M)).data.object === "active" ? (sessionStorage.setItem("apc_x_sub_status", "active"), $(!0), Y()) : (sessionStorage.setItem("apc_x_sub_status", "inactive"), $(!1));
884
+ (await se.get(M)).data.object === "active" ? (sessionStorage.setItem("apc_x_sub_status", "active"), $(!0), Y()) : (sessionStorage.setItem("apc_x_sub_status", "inactive"), $(!1));
885
885
  } catch (G) {
886
886
  console.error("Subscription check failed:", G), sessionStorage.setItem("apc_x_sub_status", "inactive"), $(!1);
887
887
  } finally {
@@ -897,9 +897,9 @@ const Pt = {
897
897
  } catch {
898
898
  console.warn("Failed to parse cached stickers, fetching fresh data");
899
899
  }
900
- x(!0), C(null);
900
+ g(!0), C(null);
901
901
  try {
902
- const G = await ae.get(`${ft}/get-stickers`);
902
+ const G = await se.get(`${ft}/get-stickers`);
903
903
  if (G.data && G.data.object && G.data.object.contents) {
904
904
  const j = G.data.object.contents;
905
905
  c(j), sessionStorage.setItem("apc_stickers", JSON.stringify(j));
@@ -908,7 +908,7 @@ const Pt = {
908
908
  } catch (G) {
909
909
  console.error("Error fetching stickers:", G), C("Failed to load stickers. Please try again.");
910
910
  } finally {
911
- x(!1);
911
+ g(!1);
912
912
  }
913
913
  }, O = (M, G) => {
914
914
  a({
@@ -928,24 +928,24 @@ const Pt = {
928
928
  }, st = (M) => {
929
929
  const G = {};
930
930
  return M.forEach((j) => {
931
- const m = j.name.split("/");
931
+ const u = j.name.split("/");
932
932
  let A = G;
933
- m.forEach((Q, _) => {
934
- A[Q] || (A[Q] = _ === m.length - 1 ? j : {}), A = A[Q];
933
+ u.forEach((Q, _) => {
934
+ A[Q] || (A[Q] = _ === u.length - 1 ? j : {}), A = A[Q];
935
935
  });
936
936
  }), G;
937
- }, K = (M, G = "", j = 0) => /* @__PURE__ */ i.jsx("div", { className: "sticker-tree-level", style: { paddingLeft: `${j * 15}px` }, children: Object.keys(M).map((m) => {
938
- const A = `${G}/${m}`, Q = z[A];
939
- return M[m].type === "image" ? !T || m.toLowerCase().includes(T.toLowerCase()) ? /* @__PURE__ */ i.jsx(
937
+ }, K = (M, G = "", j = 0) => /* @__PURE__ */ i.jsx("div", { className: "sticker-tree-level", style: { paddingLeft: `${j * 15}px` }, children: Object.keys(M).map((u) => {
938
+ const A = `${G}/${u}`, Q = B[A];
939
+ return M[u].type === "image" ? !T || u.toLowerCase().includes(T.toLowerCase()) ? /* @__PURE__ */ i.jsx(
940
940
  "div",
941
941
  {
942
942
  className: "sticker-item",
943
- onClick: () => O(M[m].url, m),
943
+ onClick: () => O(M[u].url, u),
944
944
  children: /* @__PURE__ */ i.jsx("div", { className: "sticker-preview", children: /* @__PURE__ */ i.jsx(
945
945
  "img",
946
946
  {
947
- src: M[m].url,
948
- alt: m,
947
+ src: M[u].url,
948
+ alt: u,
949
949
  loading: "lazy",
950
950
  onError: (Z) => {
951
951
  Z.target.style.display = "none";
@@ -962,13 +962,13 @@ const Pt = {
962
962
  onClick: () => J(A),
963
963
  children: [
964
964
  /* @__PURE__ */ i.jsx("span", { className: `expand-icon ${Q ? "expanded" : ""}`, children: "▶" }),
965
- /* @__PURE__ */ i.jsx("span", { className: "category-name", children: m })
965
+ /* @__PURE__ */ i.jsx("span", { className: "category-name", children: u })
966
966
  ]
967
967
  }
968
968
  ),
969
- Q && K(M[m], A, j + 1)
969
+ Q && K(M[u], A, j + 1)
970
970
  ] }, A);
971
- }) }), it = y.filter(
971
+ }) }), it = x.filter(
972
972
  (M) => !T || M.name.toLowerCase().includes(T.toLowerCase())
973
973
  );
974
974
  return d ? /* @__PURE__ */ i.jsx("div", { className: "sticker-modal-overlay", onClick: o, children: /* @__PURE__ */ i.jsxs("div", { className: "sticker-modal-content", onClick: (M) => M.stopPropagation(), children: [
@@ -985,9 +985,9 @@ const Pt = {
985
985
  )
986
986
  ] }),
987
987
  /* @__PURE__ */ i.jsxs("div", { className: "sticker-modal-body", children: [
988
- at && /* @__PURE__ */ i.jsx(ce, {}),
989
- !S && !at && B && /* @__PURE__ */ i.jsx(ai, { theme: l }),
990
- S && B && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
988
+ at && /* @__PURE__ */ i.jsx(de, {}),
989
+ !S && !at && z && /* @__PURE__ */ i.jsx(ai, { theme: l }),
990
+ S && z && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
991
991
  /* @__PURE__ */ i.jsx("div", { className: "sticker-modal-controls", children: /* @__PURE__ */ i.jsx("div", { className: "search-container", children: /* @__PURE__ */ i.jsx(
992
992
  "input",
993
993
  {
@@ -998,12 +998,12 @@ const Pt = {
998
998
  className: "sticker-search"
999
999
  }
1000
1000
  ) }) }),
1001
- u && /* @__PURE__ */ i.jsx(ce, {}),
1001
+ y && /* @__PURE__ */ i.jsx(de, {}),
1002
1002
  F && /* @__PURE__ */ i.jsxs("div", { className: "sticker-error", children: [
1003
1003
  /* @__PURE__ */ i.jsx("p", { children: F }),
1004
1004
  /* @__PURE__ */ i.jsx("button", { onClick: Y, children: "Retry" })
1005
1005
  ] }),
1006
- !u && !F && y.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "sticker-grid", children: K(st(it)) })
1006
+ !y && !F && x.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "sticker-grid", children: K(st(it)) })
1007
1007
  ] })
1008
1008
  ] })
1009
1009
  ] }) }) : null;
@@ -2559,33 +2559,33 @@ const Pt = {
2559
2559
  category: "Geometric",
2560
2560
  description: "Complex mandala flower pattern"
2561
2561
  }
2562
- ], ni = ({ isOpen: d, onClose: o, onAddEmbroidery: a, theme: l, apiKey: s, apiEndpoint: h }) => {
2563
- const [y, c] = N([]), [u, x] = N(!1), [F, C] = N(null), [p, I] = N(""), [T, w] = N("All"), z = nt(null), E = ["All", "Floral", "Nature", "Geometric", "Traditional", "Sports", "Hobbies", "Food", "Symbols", "Holiday", "Text"];
2562
+ ], ni = ({ isOpen: d, onClose: o, onAddEmbroidery: a, theme: l, apiKey: s, apiEndpoint: f }) => {
2563
+ const [x, c] = N([]), [y, g] = N(!1), [F, C] = N(null), [p, I] = N(""), [T, w] = N("All"), B = dt(null), E = ["All", "Floral", "Nature", "Geometric", "Traditional", "Sports", "Hobbies", "Food", "Symbols", "Holiday", "Text"];
2564
2564
  et(() => {
2565
2565
  d && c(li);
2566
2566
  }, [d]);
2567
- const S = (B) => {
2567
+ const S = (z) => {
2568
2568
  a({
2569
2569
  type: "embroidery",
2570
- src: B.url,
2571
- name: B.name,
2572
- description: B.description,
2573
- category: B.category,
2570
+ src: z.url,
2571
+ name: z.name,
2572
+ description: z.description,
2573
+ category: z.category,
2574
2574
  width: 120,
2575
2575
  height: 120,
2576
2576
  x: 100,
2577
2577
  y: 100
2578
2578
  }), o();
2579
- }, $ = y.filter((B) => {
2580
- const W = !p || B.name.toLowerCase().includes(p.toLowerCase()) || B.description.toLowerCase().includes(p.toLowerCase()), at = T === "All" || B.category === T;
2579
+ }, $ = x.filter((z) => {
2580
+ const W = !p || z.name.toLowerCase().includes(p.toLowerCase()) || z.description.toLowerCase().includes(p.toLowerCase()), at = T === "All" || z.category === T;
2581
2581
  return W && at;
2582
2582
  });
2583
2583
  return d ? /* @__PURE__ */ i.jsx("div", { className: "embroidery-modal-overlay", onClick: o, children: /* @__PURE__ */ i.jsxs(
2584
2584
  "div",
2585
2585
  {
2586
2586
  className: "embroidery-modal-content",
2587
- onClick: (B) => B.stopPropagation(),
2588
- ref: z,
2587
+ onClick: (z) => z.stopPropagation(),
2588
+ ref: B,
2589
2589
  children: [
2590
2590
  /* @__PURE__ */ i.jsxs("div", { className: "embroidery-modal-header", children: [
2591
2591
  /* @__PURE__ */ i.jsx("h3", { children: "Choose an Embroidery Design" }),
@@ -2606,7 +2606,7 @@ const Pt = {
2606
2606
  type: "text",
2607
2607
  placeholder: "Search embroidery designs...",
2608
2608
  value: p,
2609
- onChange: (B) => I(B.target.value),
2609
+ onChange: (z) => I(z.target.value),
2610
2610
  className: "embroidery-search"
2611
2611
  }
2612
2612
  ) }),
@@ -2616,46 +2616,46 @@ const Pt = {
2616
2616
  "select",
2617
2617
  {
2618
2618
  value: T,
2619
- onChange: (B) => w(B.target.value),
2619
+ onChange: (z) => w(z.target.value),
2620
2620
  className: "category-select",
2621
- children: E.map((B) => /* @__PURE__ */ i.jsx("option", { value: B, children: B }, B))
2621
+ children: E.map((z) => /* @__PURE__ */ i.jsx("option", { value: z, children: z }, z))
2622
2622
  }
2623
2623
  )
2624
2624
  ] })
2625
2625
  ] }),
2626
2626
  /* @__PURE__ */ i.jsxs("div", { className: "embroidery-modal-body", children: [
2627
- u && /* @__PURE__ */ i.jsxs("div", { className: "embroidery-loading", children: [
2627
+ y && /* @__PURE__ */ i.jsxs("div", { className: "embroidery-loading", children: [
2628
2628
  /* @__PURE__ */ i.jsx("div", { className: "loading-spinner" }),
2629
2629
  /* @__PURE__ */ i.jsx("p", { children: "Loading embroidery designs..." })
2630
2630
  ] }),
2631
2631
  F && /* @__PURE__ */ i.jsx("div", { className: "embroidery-error", children: /* @__PURE__ */ i.jsx("p", { children: F }) }),
2632
- !u && !F && /* @__PURE__ */ i.jsx("div", { className: "embroidery-grid", children: $.map((B) => /* @__PURE__ */ i.jsxs(
2632
+ !y && !F && /* @__PURE__ */ i.jsx("div", { className: "embroidery-grid", children: $.map((z) => /* @__PURE__ */ i.jsxs(
2633
2633
  "div",
2634
2634
  {
2635
2635
  className: "embroidery-item",
2636
- onClick: () => S(B),
2637
- title: B.description,
2636
+ onClick: () => S(z),
2637
+ title: z.description,
2638
2638
  children: [
2639
2639
  /* @__PURE__ */ i.jsx("div", { className: "embroidery-preview", children: /* @__PURE__ */ i.jsx(
2640
2640
  "img",
2641
2641
  {
2642
- src: B.url,
2643
- alt: B.name,
2642
+ src: z.url,
2643
+ alt: z.name,
2644
2644
  loading: "lazy",
2645
2645
  onError: (W) => {
2646
- console.error("Failed to load embroidery image:", B.url), W.target.style.display = "none";
2646
+ console.error("Failed to load embroidery image:", z.url), W.target.style.display = "none";
2647
2647
  }
2648
2648
  }
2649
2649
  ) }),
2650
2650
  /* @__PURE__ */ i.jsxs("div", { className: "embroidery-info", children: [
2651
- /* @__PURE__ */ i.jsx("div", { className: "embroidery-name", children: B.name }),
2652
- /* @__PURE__ */ i.jsx("div", { className: "embroidery-category", children: B.category })
2651
+ /* @__PURE__ */ i.jsx("div", { className: "embroidery-name", children: z.name }),
2652
+ /* @__PURE__ */ i.jsx("div", { className: "embroidery-category", children: z.category })
2653
2653
  ] })
2654
2654
  ]
2655
2655
  },
2656
- B.id
2656
+ z.id
2657
2657
  )) }),
2658
- !u && !F && $.length === 0 && /* @__PURE__ */ i.jsx("div", { className: "no-embroideries", children: /* @__PURE__ */ i.jsx("p", { children: "No embroidery designs found matching your search." }) })
2658
+ !y && !F && $.length === 0 && /* @__PURE__ */ i.jsx("div", { className: "no-embroideries", children: /* @__PURE__ */ i.jsx("p", { children: "No embroidery designs found matching your search." }) })
2659
2659
  ] }),
2660
2660
  /* @__PURE__ */ i.jsx("div", { className: "embroidery-modal-footer", children: /* @__PURE__ */ i.jsxs("div", { className: "embroidery-disclaimer", children: [
2661
2661
  /* @__PURE__ */ i.jsx("span", { className: "disclaimer-icon", children: "ℹ️" }),
@@ -4602,16 +4602,16 @@ const Pt = {
4602
4602
  textAlign: "center"
4603
4603
  }
4604
4604
  ], ci = ({ isOpen: d, onClose: o, onAddText: a, theme: l }) => {
4605
- const [s, h] = N(""), [y, c] = N("All"), u = re(() => {
4605
+ const [s, f] = N(""), [x, c] = N("All"), y = ae(() => {
4606
4606
  const p = Nt.reduce((I, T) => (I[T.category] = (I[T.category] || 0) + 1, I), {});
4607
4607
  return [
4608
4608
  { name: "All", count: Nt.length },
4609
4609
  ...Object.entries(p).map(([I, T]) => ({ name: I, count: T }))
4610
4610
  ];
4611
- }, [Nt]), x = re(() => Nt.filter((p) => {
4612
- const I = !s || p.text.toLowerCase().includes(s.toLowerCase()) || p.category.toLowerCase().includes(s.toLowerCase()), T = y === "All" || p.category === y;
4611
+ }, [Nt]), g = ae(() => Nt.filter((p) => {
4612
+ const I = !s || p.text.toLowerCase().includes(s.toLowerCase()) || p.category.toLowerCase().includes(s.toLowerCase()), T = x === "All" || p.category === x;
4613
4613
  return I && T;
4614
- }), [Nt, s, y]), F = (p) => {
4614
+ }), [Nt, s, x]), F = (p) => {
4615
4615
  const I = {
4616
4616
  ...p,
4617
4617
  x: 100,
@@ -4640,14 +4640,14 @@ const Pt = {
4640
4640
  type: "text",
4641
4641
  placeholder: "Search templates...",
4642
4642
  value: s,
4643
- onChange: (p) => h(p.target.value),
4643
+ onChange: (p) => f(p.target.value),
4644
4644
  className: "search-input"
4645
4645
  }
4646
4646
  ) }),
4647
- /* @__PURE__ */ i.jsx("div", { className: "category-tabs", children: u.map((p) => /* @__PURE__ */ i.jsxs(
4647
+ /* @__PURE__ */ i.jsx("div", { className: "category-tabs", children: y.map((p) => /* @__PURE__ */ i.jsxs(
4648
4648
  "button",
4649
4649
  {
4650
- className: `category-tab ${y === p.name ? "active" : ""}`,
4650
+ className: `category-tab ${x === p.name ? "active" : ""}`,
4651
4651
  onClick: () => c(p.name),
4652
4652
  children: [
4653
4653
  p.name,
@@ -4666,7 +4666,7 @@ const Pt = {
4666
4666
  /* @__PURE__ */ i.jsx("div", { className: "custom-icon", children: "✏️" }),
4667
4667
  /* @__PURE__ */ i.jsx("div", { className: "custom-label", children: "Create Custom Text" })
4668
4668
  ] }) }),
4669
- x.map((p) => /* @__PURE__ */ i.jsxs(
4669
+ g.map((p) => /* @__PURE__ */ i.jsxs(
4670
4670
  "div",
4671
4671
  {
4672
4672
  className: "template-item",
@@ -4701,9 +4701,9 @@ const Pt = {
4701
4701
  ))
4702
4702
  ] }),
4703
4703
  /* @__PURE__ */ i.jsx("div", { className: "modal-footer", children: /* @__PURE__ */ i.jsxs("div", { className: "results-count", children: [
4704
- x.length,
4704
+ g.length,
4705
4705
  " template",
4706
- x.length !== 1 ? "s" : "",
4706
+ g.length !== 1 ? "s" : "",
4707
4707
  " found"
4708
4708
  ] }) })
4709
4709
  ] }) }) : null;
@@ -4713,24 +4713,24 @@ const Pt = {
4713
4713
  onDuplicateElement: a,
4714
4714
  onUndo: l,
4715
4715
  onRedo: s,
4716
- onToggleGrid: h,
4717
- onToggleRulers: y,
4716
+ onToggleGrid: f,
4717
+ onToggleRulers: x,
4718
4718
  onToggleSnap: c,
4719
- onImageUpload: u,
4720
- canUndo: x,
4719
+ onImageUpload: y,
4720
+ canUndo: g,
4721
4721
  canRedo: F,
4722
4722
  showGrid: C,
4723
4723
  showRulers: p,
4724
4724
  snapToGrid: I,
4725
4725
  selectedElement: T,
4726
4726
  theme: w,
4727
- readOnly: z,
4727
+ readOnly: B,
4728
4728
  apiKey: E,
4729
4729
  apiEndpoint: S
4730
4730
  }) => {
4731
- const [$, B] = N(!1), [W, at] = N(!1), [U, ft] = N(!1), [q, rt] = N(!1), [Y, O] = N(!1), [J, st] = N(!1), [K, it] = N(!1), M = (P) => {
4732
- const ct = P.target.files[0];
4733
- ct && ct.type.startsWith("image/") && u(ct), P.target.value = "";
4731
+ const [$, z] = N(!1), [W, at] = N(!1), [U, ft] = N(!1), [q, rt] = N(!1), [Y, O] = N(!1), [J, st] = N(!1), [K, it] = N(!1), M = (P) => {
4732
+ const nt = P.target.files[0];
4733
+ nt && nt.type.startsWith("image/") && y(nt), P.target.value = "";
4734
4734
  }, G = (P) => {
4735
4735
  d("icon", {
4736
4736
  iconData: P,
@@ -4741,14 +4741,14 @@ const Pt = {
4741
4741
  });
4742
4742
  }, j = (P) => {
4743
4743
  d("qrcode", P);
4744
- }, m = (P) => {
4744
+ }, u = (P) => {
4745
4745
  d("barcode", P);
4746
4746
  }, A = (P) => {
4747
4747
  d("sticker", P);
4748
4748
  }, Q = (P) => {
4749
4749
  d("embroidery", P);
4750
- }, _ = (P, ct) => {
4751
- d(P, ct);
4750
+ }, _ = (P, nt) => {
4751
+ d(P, nt);
4752
4752
  }, Z = () => {
4753
4753
  st(!J), it(!1);
4754
4754
  }, V = () => {
@@ -4766,7 +4766,7 @@ const Pt = {
4766
4766
  {
4767
4767
  className: "toolbar-btn compact",
4768
4768
  onClick: l,
4769
- disabled: !x || z,
4769
+ disabled: !g || B,
4770
4770
  title: "Undo (Ctrl+Z)",
4771
4771
  children: [
4772
4772
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "↶" }),
@@ -4779,7 +4779,7 @@ const Pt = {
4779
4779
  {
4780
4780
  className: "toolbar-btn compact",
4781
4781
  onClick: s,
4782
- disabled: !F || z,
4782
+ disabled: !F || B,
4783
4783
  title: "Redo (Ctrl+Y)",
4784
4784
  children: [
4785
4785
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "↷" }),
@@ -4795,7 +4795,7 @@ const Pt = {
4795
4795
  "button",
4796
4796
  {
4797
4797
  className: "toolbar-btn compact dropdown-trigger",
4798
- disabled: z,
4798
+ disabled: B,
4799
4799
  title: "Add Text",
4800
4800
  onClick: Z,
4801
4801
  children: [
@@ -4821,7 +4821,7 @@ const Pt = {
4821
4821
  "button",
4822
4822
  {
4823
4823
  className: "toolbar-btn compact dropdown-trigger",
4824
- disabled: z,
4824
+ disabled: B,
4825
4825
  onClick: V,
4826
4826
  children: [
4827
4827
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "◩" }),
@@ -4882,7 +4882,7 @@ const Pt = {
4882
4882
  ] })
4883
4883
  ] }),
4884
4884
  /* @__PURE__ */ i.jsx("div", { className: "toolbar-separator" }),
4885
- /* @__PURE__ */ i.jsxs("label", { className: "toolbar-btn compact file-upload", style: { cursor: z ? "not-allowed" : "pointer" }, children: [
4885
+ /* @__PURE__ */ i.jsxs("label", { className: "toolbar-btn compact file-upload", style: { cursor: B ? "not-allowed" : "pointer" }, children: [
4886
4886
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "☁️" }),
4887
4887
  /* @__PURE__ */ i.jsx("span", { className: "label", children: "Upload" }),
4888
4888
  /* @__PURE__ */ i.jsx(
@@ -4891,18 +4891,18 @@ const Pt = {
4891
4891
  type: "file",
4892
4892
  accept: "image/*",
4893
4893
  onChange: M,
4894
- disabled: z
4894
+ disabled: B
4895
4895
  }
4896
4896
  )
4897
4897
  ] }),
4898
4898
  /* @__PURE__ */ i.jsx("div", { className: "toolbar-separator" }),
4899
- /* @__PURE__ */ i.jsx(ii, { onSelectIcon: G, theme: w, disabled: z }),
4899
+ /* @__PURE__ */ i.jsx(ii, { onSelectIcon: G, theme: w, disabled: B }),
4900
4900
  /* @__PURE__ */ i.jsxs(
4901
4901
  "button",
4902
4902
  {
4903
4903
  className: "toolbar-btn compact",
4904
4904
  onClick: () => ft(!0),
4905
- disabled: z,
4905
+ disabled: B,
4906
4906
  title: "Add Sticker",
4907
4907
  children: [
4908
4908
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "🎨" }),
@@ -4915,8 +4915,8 @@ const Pt = {
4915
4915
  "button",
4916
4916
  {
4917
4917
  className: "toolbar-btn compact",
4918
- onClick: () => B(!0),
4919
- disabled: z,
4918
+ onClick: () => z(!0),
4919
+ disabled: B,
4920
4920
  title: "Add QR Code",
4921
4921
  children: [
4922
4922
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "▦" }),
@@ -4929,7 +4929,7 @@ const Pt = {
4929
4929
  {
4930
4930
  className: "toolbar-btn compact",
4931
4931
  onClick: () => at(!0),
4932
- disabled: z,
4932
+ disabled: B,
4933
4933
  title: "Add Barcode",
4934
4934
  children: [
4935
4935
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "▤" }),
@@ -4944,7 +4944,7 @@ const Pt = {
4944
4944
  {
4945
4945
  className: "toolbar-btn compact",
4946
4946
  onClick: () => rt(!0),
4947
- disabled: z,
4947
+ disabled: B,
4948
4948
  title: "Add Embroidery Design",
4949
4949
  children: [
4950
4950
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "🧵" }),
@@ -4960,7 +4960,7 @@ const Pt = {
4960
4960
  {
4961
4961
  className: "toolbar-btn compact success",
4962
4962
  onClick: a,
4963
- disabled: z,
4963
+ disabled: B,
4964
4964
  title: "Duplicate Element (Ctrl+D)",
4965
4965
  children: [
4966
4966
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "⧉" }),
@@ -4973,7 +4973,7 @@ const Pt = {
4973
4973
  {
4974
4974
  className: "toolbar-btn compact danger",
4975
4975
  onClick: o,
4976
- disabled: z,
4976
+ disabled: B,
4977
4977
  title: "Delete Element (Delete)",
4978
4978
  children: [
4979
4979
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "🗑️" }),
@@ -4989,7 +4989,7 @@ const Pt = {
4989
4989
  "button",
4990
4990
  {
4991
4991
  className: `toolbar-btn compact ${C ? "active" : ""}`,
4992
- onClick: h,
4992
+ onClick: f,
4993
4993
  title: "Toggle Grid",
4994
4994
  children: [
4995
4995
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "⚏" }),
@@ -5001,7 +5001,7 @@ const Pt = {
5001
5001
  "button",
5002
5002
  {
5003
5003
  className: `toolbar-btn compact ${p ? "active" : ""}`,
5004
- onClick: y,
5004
+ onClick: x,
5005
5005
  title: "Toggle Rulers",
5006
5006
  children: [
5007
5007
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "📐" }),
@@ -5027,7 +5027,7 @@ const Pt = {
5027
5027
  oi,
5028
5028
  {
5029
5029
  isOpen: $,
5030
- onClose: () => B(!1),
5030
+ onClose: () => z(!1),
5031
5031
  onAddQRCode: j,
5032
5032
  theme: w
5033
5033
  }
@@ -5037,7 +5037,7 @@ const Pt = {
5037
5037
  {
5038
5038
  isOpen: W,
5039
5039
  onClose: () => at(!1),
5040
- onAddBarcode: m,
5040
+ onAddBarcode: u,
5041
5041
  theme: w
5042
5042
  }
5043
5043
  ),
@@ -5080,16 +5080,16 @@ const Pt = {
5080
5080
  availableFonts: l,
5081
5081
  theme: s
5082
5082
  }) => {
5083
- const [h, y] = N(!1);
5083
+ const [f, x] = N(!1);
5084
5084
  if (!d)
5085
5085
  return /* @__PURE__ */ i.jsxs("div", { className: "properties-panel", children: [
5086
5086
  /* @__PURE__ */ i.jsx("h3", { children: "Properties" }),
5087
5087
  /* @__PURE__ */ i.jsx("p", { className: "no-selection", children: "Select an element to edit its properties" })
5088
5088
  ] });
5089
- const c = (w, z) => {
5090
- o(d.id, { [w]: z });
5091
- }, u = () => {
5092
- var w, z, E;
5089
+ const c = (w, B) => {
5090
+ o(d.id, { [w]: B });
5091
+ }, y = () => {
5092
+ var w, B, E;
5093
5093
  return /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5094
5094
  /* @__PURE__ */ i.jsx("h4", { children: "Text Content" }),
5095
5095
  /* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
@@ -5193,7 +5193,7 @@ const Pt = {
5193
5193
  {
5194
5194
  className: (w = d.textDecoration) != null && w.includes("underline") ? "active" : "",
5195
5195
  onClick: () => {
5196
- const S = d.textDecoration || "", $ = S.split(" ").filter((B) => B && B !== "underline");
5196
+ const S = d.textDecoration || "", $ = S.split(" ").filter((z) => z && z !== "underline");
5197
5197
  S.includes("underline") || $.push("underline"), c("textDecoration", $.join(" ").trim());
5198
5198
  },
5199
5199
  title: "Underline",
@@ -5203,9 +5203,9 @@ const Pt = {
5203
5203
  /* @__PURE__ */ i.jsx(
5204
5204
  "button",
5205
5205
  {
5206
- className: (z = d.textDecoration) != null && z.includes("overline") ? "active" : "",
5206
+ className: (B = d.textDecoration) != null && B.includes("overline") ? "active" : "",
5207
5207
  onClick: () => {
5208
- const S = d.textDecoration || "", $ = S.split(" ").filter((B) => B && B !== "overline");
5208
+ const S = d.textDecoration || "", $ = S.split(" ").filter((z) => z && z !== "overline");
5209
5209
  S.includes("overline") || $.push("overline"), c("textDecoration", $.join(" ").trim());
5210
5210
  },
5211
5211
  title: "Overline",
@@ -5217,7 +5217,7 @@ const Pt = {
5217
5217
  {
5218
5218
  className: (E = d.textDecoration) != null && E.includes("line-through") ? "active" : "",
5219
5219
  onClick: () => {
5220
- const S = d.textDecoration || "", $ = S.split(" ").filter((B) => B && B !== "line-through");
5220
+ const S = d.textDecoration || "", $ = S.split(" ").filter((z) => z && z !== "line-through");
5221
5221
  S.includes("line-through") || $.push("line-through"), c("textDecoration", $.join(" ").trim());
5222
5222
  },
5223
5223
  title: "Strikethrough",
@@ -5344,7 +5344,7 @@ const Pt = {
5344
5344
  ] })
5345
5345
  ] })
5346
5346
  ] }) }),
5347
- h && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
5347
+ f && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
5348
5348
  /* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
5349
5349
  /* @__PURE__ */ i.jsxs("div", { className: "input-group", children: [
5350
5350
  /* @__PURE__ */ i.jsx("label", { children: "Letter Spacing" }),
@@ -5552,7 +5552,7 @@ const Pt = {
5552
5552
  ] })
5553
5553
  ] })
5554
5554
  ] });
5555
- }, x = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5555
+ }, g = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5556
5556
  /* @__PURE__ */ i.jsx("h4", { children: "Shape Properties" }),
5557
5557
  /* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
5558
5558
  /* @__PURE__ */ i.jsx("label", { children: "Fill Color" }),
@@ -5635,7 +5635,7 @@ const Pt = {
5635
5635
  "%"
5636
5636
  ] })
5637
5637
  ] }),
5638
- h && /* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
5638
+ f && /* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
5639
5639
  /* @__PURE__ */ i.jsx("label", { children: "Border Radius" }),
5640
5640
  /* @__PURE__ */ i.jsx(
5641
5641
  "input",
@@ -5728,8 +5728,8 @@ const Pt = {
5728
5728
  type: "number",
5729
5729
  value: d.strokeWidth || d.height || 2,
5730
5730
  onChange: (w) => {
5731
- const z = parseInt(w.target.value);
5732
- c("strokeWidth", z), c("height", z);
5731
+ const B = parseInt(w.target.value);
5732
+ c("strokeWidth", B), c("height", B);
5733
5733
  },
5734
5734
  min: "1",
5735
5735
  max: "50"
@@ -5803,8 +5803,8 @@ const Pt = {
5803
5803
  /* @__PURE__ */ i.jsx("span", { className: "element-type", children: d.type })
5804
5804
  ] }),
5805
5805
  /* @__PURE__ */ i.jsxs("div", { className: "panel-content", children: [
5806
- d.type === "text" && u(),
5807
- T.includes(d.type) && x(),
5806
+ d.type === "text" && y(),
5807
+ T.includes(d.type) && g(),
5808
5808
  d.type === "image" && F(),
5809
5809
  d.type === "horizontalLine" && p(),
5810
5810
  C(),
@@ -5813,9 +5813,9 @@ const Pt = {
5813
5813
  "button",
5814
5814
  {
5815
5815
  className: "toggle-advanced",
5816
- onClick: () => y(!h),
5816
+ onClick: () => x(!f),
5817
5817
  children: [
5818
- h ? "Hide" : "Show",
5818
+ f ? "Hide" : "Show",
5819
5819
  " Advanced Options"
5820
5820
  ]
5821
5821
  }
@@ -5828,10 +5828,10 @@ const Pt = {
5828
5828
  onSelectElement: a,
5829
5829
  onMoveLayer: l,
5830
5830
  onDeleteElement: s,
5831
- theme: h
5831
+ theme: f
5832
5832
  }) => {
5833
- const y = (u, x) => {
5834
- switch (u) {
5833
+ const x = (y, g) => {
5834
+ switch (y) {
5835
5835
  case "text":
5836
5836
  return "T";
5837
5837
  case "rectangle":
@@ -5871,32 +5871,32 @@ const Pt = {
5871
5871
  default:
5872
5872
  return "?";
5873
5873
  }
5874
- }, c = (u) => {
5875
- var x, F;
5876
- if (u.type === "text")
5877
- return u.isIcon && u.iconData ? `Icon: ${u.iconData.name}` : ((x = u.text) == null ? void 0 : x.substring(0, 20)) + (((F = u.text) == null ? void 0 : F.length) > 20 ? "..." : "") || "Text";
5878
- if (u.type === "qrcode")
5879
- return `QR Code: ${(u.data || "").substring(0, 15) + ((u.data || "").length > 15 ? "..." : "")}`;
5880
- if (u.type === "barcode") {
5881
- const C = u.format || "CODE128", p = u.data || "";
5874
+ }, c = (y) => {
5875
+ var g, F;
5876
+ if (y.type === "text")
5877
+ return y.isIcon && y.iconData ? `Icon: ${y.iconData.name}` : ((g = y.text) == null ? void 0 : g.substring(0, 20)) + (((F = y.text) == null ? void 0 : F.length) > 20 ? "..." : "") || "Text";
5878
+ if (y.type === "qrcode")
5879
+ return `QR Code: ${(y.data || "").substring(0, 15) + ((y.data || "").length > 15 ? "..." : "")}`;
5880
+ if (y.type === "barcode") {
5881
+ const C = y.format || "CODE128", p = y.data || "";
5882
5882
  return `Barcode (${C}): ${p.substring(0, 10) + (p.length > 10 ? "..." : "")}`;
5883
5883
  }
5884
- return u.type === "sticker" ? `Sticker: ${(u.name || "Untitled").substring(0, 15)}` : u.type === "embroidery" ? `Embroidery: ${(u.name || "Design").substring(0, 15)}` : u.type.charAt(0).toUpperCase() + u.type.slice(1);
5884
+ return y.type === "sticker" ? `Sticker: ${(y.name || "Untitled").substring(0, 15)}` : y.type === "embroidery" ? `Embroidery: ${(y.name || "Design").substring(0, 15)}` : y.type.charAt(0).toUpperCase() + y.type.slice(1);
5885
5885
  };
5886
5886
  return /* @__PURE__ */ i.jsxs("div", { className: "layers-panel", children: [
5887
5887
  /* @__PURE__ */ i.jsxs("div", { className: "panel-header", children: [
5888
5888
  /* @__PURE__ */ i.jsx("h3", { children: "Layers" }),
5889
5889
  /* @__PURE__ */ i.jsx("span", { className: "layer-count", children: d.length })
5890
5890
  ] }),
5891
- /* @__PURE__ */ i.jsx("div", { className: "layers-list", children: d.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "no-layers", children: "No elements added yet" }) : [...d].reverse().map((u, x) => /* @__PURE__ */ i.jsxs(
5891
+ /* @__PURE__ */ i.jsx("div", { className: "layers-list", children: d.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "no-layers", children: "No elements added yet" }) : [...d].reverse().map((y, g) => /* @__PURE__ */ i.jsxs(
5892
5892
  "div",
5893
5893
  {
5894
- className: `layer-item ${(o == null ? void 0 : o.id) === u.id ? "selected" : ""}`,
5895
- onClick: () => a(u),
5894
+ className: `layer-item ${(o == null ? void 0 : o.id) === y.id ? "selected" : ""}`,
5895
+ onClick: () => a(y),
5896
5896
  children: [
5897
5897
  /* @__PURE__ */ i.jsxs("div", { className: "layer-info", children: [
5898
- /* @__PURE__ */ i.jsx("span", { className: "layer-icon", children: y(u.type) }),
5899
- /* @__PURE__ */ i.jsx("span", { className: "layer-name", children: c(u) })
5898
+ /* @__PURE__ */ i.jsx("span", { className: "layer-icon", children: x(y.type) }),
5899
+ /* @__PURE__ */ i.jsx("span", { className: "layer-name", children: c(y) })
5900
5900
  ] }),
5901
5901
  /* @__PURE__ */ i.jsxs("div", { className: "layer-controls", children: [
5902
5902
  /* @__PURE__ */ i.jsx(
@@ -5904,9 +5904,9 @@ const Pt = {
5904
5904
  {
5905
5905
  className: "layer-btn",
5906
5906
  onClick: (F) => {
5907
- F.stopPropagation(), l(u.id, "up");
5907
+ F.stopPropagation(), l(y.id, "up");
5908
5908
  },
5909
- disabled: x === 0,
5909
+ disabled: g === 0,
5910
5910
  title: "Move Up",
5911
5911
  children: "↑"
5912
5912
  }
@@ -5916,9 +5916,9 @@ const Pt = {
5916
5916
  {
5917
5917
  className: "layer-btn",
5918
5918
  onClick: (F) => {
5919
- F.stopPropagation(), l(u.id, "down");
5919
+ F.stopPropagation(), l(y.id, "down");
5920
5920
  },
5921
- disabled: x === d.length - 1,
5921
+ disabled: g === d.length - 1,
5922
5922
  title: "Move Down",
5923
5923
  children: "↓"
5924
5924
  }
@@ -5928,7 +5928,7 @@ const Pt = {
5928
5928
  {
5929
5929
  className: "layer-btn delete",
5930
5930
  onClick: (F) => {
5931
- F.stopPropagation(), s(u.id);
5931
+ F.stopPropagation(), s(y.id);
5932
5932
  },
5933
5933
  title: "Delete",
5934
5934
  children: "×"
@@ -5937,7 +5937,7 @@ const Pt = {
5937
5937
  ] })
5938
5938
  ]
5939
5939
  },
5940
- u.id
5940
+ y.id
5941
5941
  )) })
5942
5942
  ] });
5943
5943
  };
@@ -5946,17 +5946,17 @@ class gi {
5946
5946
  this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d");
5947
5947
  }
5948
5948
  // Add this method to the ExportManager class
5949
- async exportAllSections(o, a, l, s, h = "png", y = !0, c = null) {
5950
- const u = {};
5951
- for (const x of a) {
5952
- const F = x.id || x.sectionName, C = o[F];
5949
+ async exportAllSections(o, a, l, s, f = "png", x = !0, c = null) {
5950
+ const y = {};
5951
+ for (const g of a) {
5952
+ const F = g.id || g.sectionName, C = o[F];
5953
5953
  if (!C || !C.elements || C.elements.length === 0) {
5954
5954
  console.log(`Skipping section ${F} - no elements`);
5955
5955
  continue;
5956
5956
  }
5957
- if (this.canvas.width = l, this.canvas.height = s, this.ctx.clearRect(0, 0, l, s), y) {
5958
- let I = x.image || x.sectionImage;
5959
- if (c && c.sectionImage && (x.sectionName === "Front" || c.sections && Object.keys(c.sections).includes(x.sectionName)) && (I = c.sectionImage), I)
5957
+ if (this.canvas.width = l, this.canvas.height = s, this.ctx.clearRect(0, 0, l, s), x) {
5958
+ let I = g.image || g.sectionImage;
5959
+ if (c && c.sectionImage && (g.sectionName === "Front" || c.sections && Object.keys(c.sections).includes(g.sectionName)) && (I = c.sectionImage), I)
5960
5960
  try {
5961
5961
  const T = await this.loadImage(I);
5962
5962
  await this.processImageColor(T, C.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, l, s);
@@ -5967,13 +5967,13 @@ class gi {
5967
5967
  this.ctx.clearRect(0, 0, l, s);
5968
5968
  for (const I of C.elements)
5969
5969
  await this.drawElement(I);
5970
- const p = this.canvas.toDataURL(`image/${h}`, h === "jpeg" ? 0.9 : void 0);
5971
- u[F] = {
5970
+ const p = this.canvas.toDataURL(`image/${f}`, f === "jpeg" ? 0.9 : void 0);
5971
+ y[F] = {
5972
5972
  dataUrl: p,
5973
5973
  blob: await this.dataUrlToBlob(p)
5974
5974
  };
5975
5975
  }
5976
- return u;
5976
+ return y;
5977
5977
  }
5978
5978
  // Also add a method to download all exports
5979
5979
  async downloadExports(o, a = "design") {
@@ -5983,12 +5983,12 @@ class gi {
5983
5983
  return;
5984
5984
  }
5985
5985
  if (l.length === 1) {
5986
- const s = l[0], { blob: h } = o[s], y = URL.createObjectURL(h), c = document.createElement("a");
5987
- c.href = y, c.download = `${a}-${s}.png`, document.body.appendChild(c), c.click(), document.body.removeChild(c), URL.revokeObjectURL(y);
5986
+ const s = l[0], { blob: f } = o[s], x = URL.createObjectURL(f), c = document.createElement("a");
5987
+ c.href = x, c.download = `${a}-${s}.png`, document.body.appendChild(c), c.click(), document.body.removeChild(c), URL.revokeObjectURL(x);
5988
5988
  } else
5989
5989
  for (const s of l) {
5990
- const { blob: h } = o[s], y = URL.createObjectURL(h), c = document.createElement("a");
5991
- c.href = y, c.download = `${a}-${s}.png`, document.body.appendChild(c), c.click(), document.body.removeChild(c), URL.revokeObjectURL(y), await new Promise((u) => setTimeout(u, 100));
5990
+ const { blob: f } = o[s], x = URL.createObjectURL(f), c = document.createElement("a");
5991
+ c.href = x, c.download = `${a}-${s}.png`, document.body.appendChild(c), c.click(), document.body.removeChild(c), URL.revokeObjectURL(x), await new Promise((y) => setTimeout(y, 100));
5992
5992
  }
5993
5993
  }
5994
5994
  async loadImage(o) {
@@ -6005,18 +6005,18 @@ class gi {
6005
6005
  async processImageColor(o, a) {
6006
6006
  const l = document.createElement("canvas"), s = l.getContext("2d");
6007
6007
  l.width = o.width, l.height = o.height, s.clearRect(0, 0, l.width, l.height), s.drawImage(o, 0, 0);
6008
- const h = s.getImageData(0, 0, l.width, l.height), y = h.data, c = this.hexToRgb(a);
6008
+ const f = s.getImageData(0, 0, l.width, l.height), x = f.data, c = this.hexToRgb(a);
6009
6009
  if (!c) {
6010
6010
  console.warn("Invalid target color:", a);
6011
6011
  return;
6012
6012
  }
6013
- const { r: u, g: x, b: F } = c;
6014
- for (let C = 0; C < y.length; C += 4) {
6015
- if (y[C + 3] === 0) continue;
6016
- const I = this.getLuma(y[C], y[C + 1], y[C + 2]);
6017
- y[C] = Math.round(u * I), y[C + 1] = Math.round(x * I), y[C + 2] = Math.round(F * I);
6013
+ const { r: y, g, b: F } = c;
6014
+ for (let C = 0; C < x.length; C += 4) {
6015
+ if (x[C + 3] === 0) continue;
6016
+ const I = this.getLuma(x[C], x[C + 1], x[C + 2]);
6017
+ x[C] = Math.round(y * I), x[C + 1] = Math.round(g * I), x[C + 2] = Math.round(F * I);
6018
6018
  }
6019
- return s.putImageData(h, 0, 0), this.processedImage = new Image(), new Promise((C) => {
6019
+ return s.putImageData(f, 0, 0), this.processedImage = new Image(), new Promise((C) => {
6020
6020
  this.processedImage.onload = () => {
6021
6021
  C();
6022
6022
  }, this.processedImage.onerror = () => {
@@ -6089,9 +6089,9 @@ class gi {
6089
6089
  this.ctx.font = `${o.fontStyle || "normal"} ${o.fontWeight || "normal"} ${o.fontSize || 20}px ${o.fontFamily || "Arial"}`, this.ctx.fillStyle = o.fill || "#000000", this.ctx.textAlign = o.textAlign || "left", this.ctx.textBaseline = "top", o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth);
6090
6090
  const a = (o.text || "Text").split(`
6091
6091
  `), l = (o.fontSize || 20) * 1.2;
6092
- a.forEach((s, h) => {
6093
- const y = h * l;
6094
- o.stroke && o.strokeWidth > 0 && this.ctx.strokeText(s, 0, y), this.ctx.fillText(s, 0, y);
6092
+ a.forEach((s, f) => {
6093
+ const x = f * l;
6094
+ o.stroke && o.strokeWidth > 0 && this.ctx.strokeText(s, 0, x), this.ctx.fillText(s, 0, x);
6095
6095
  });
6096
6096
  }
6097
6097
  drawRectangle(o) {
@@ -6106,10 +6106,10 @@ class gi {
6106
6106
  this.ctx.beginPath(), this.ctx.moveTo(a, 0), this.ctx.lineTo(0, o.height), this.ctx.lineTo(o.width, o.height), this.ctx.closePath(), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
6107
6107
  }
6108
6108
  drawStar(o) {
6109
- const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, h = s * 0.4, y = o.numPoints || 5;
6109
+ const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, f = s * 0.4, x = o.numPoints || 5;
6110
6110
  this.ctx.beginPath();
6111
- for (let c = 0; c < y * 2; c++) {
6112
- const u = c % 2 === 0 ? s : h, x = c * Math.PI / y, F = a + Math.cos(x) * u, C = l + Math.sin(x) * u;
6111
+ for (let c = 0; c < x * 2; c++) {
6112
+ const y = c % 2 === 0 ? s : f, g = c * Math.PI / x, F = a + Math.cos(g) * y, C = l + Math.sin(g) * y;
6113
6113
  c === 0 ? this.ctx.moveTo(F, C) : this.ctx.lineTo(F, C);
6114
6114
  }
6115
6115
  this.ctx.closePath(), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
@@ -6120,10 +6120,10 @@ class gi {
6120
6120
  }
6121
6121
  async dataUrlToBlob(o) {
6122
6122
  return new Promise((a) => {
6123
- const l = document.createElement("canvas"), s = l.getContext("2d"), h = new Image();
6124
- h.onload = () => {
6125
- l.width = h.width, l.height = h.height, s.drawImage(h, 0, 0), l.toBlob(a);
6126
- }, h.src = o;
6123
+ const l = document.createElement("canvas"), s = l.getContext("2d"), f = new Image();
6124
+ f.onload = () => {
6125
+ l.width = f.width, l.height = f.height, s.drawImage(f, 0, 0), l.toBlob(a);
6126
+ }, f.src = o;
6127
6127
  });
6128
6128
  }
6129
6129
  hexToRgb(o) {
@@ -6140,67 +6140,67 @@ class gi {
6140
6140
  this.ctx.beginPath(), this.ctx.moveTo(a, 0), this.ctx.lineTo(o.width, l), this.ctx.lineTo(a, o.height), this.ctx.lineTo(0, l), this.ctx.closePath(), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
6141
6141
  }
6142
6142
  drawHexagon(o) {
6143
- const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, h = 6;
6143
+ const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, f = 6;
6144
6144
  this.ctx.beginPath();
6145
- for (let y = 0; y < h; y++) {
6146
- const c = y * 2 * Math.PI / h - Math.PI / 2, u = a + s * Math.cos(c), x = l + s * Math.sin(c);
6147
- y === 0 ? this.ctx.moveTo(u, x) : this.ctx.lineTo(u, x);
6145
+ for (let x = 0; x < f; x++) {
6146
+ const c = x * 2 * Math.PI / f - Math.PI / 2, y = a + s * Math.cos(c), g = l + s * Math.sin(c);
6147
+ x === 0 ? this.ctx.moveTo(y, g) : this.ctx.lineTo(y, g);
6148
6148
  }
6149
6149
  this.ctx.closePath(), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
6150
6150
  }
6151
6151
  drawPentagon(o) {
6152
- const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, h = 5;
6152
+ const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, f = 5;
6153
6153
  this.ctx.beginPath();
6154
- for (let y = 0; y < h; y++) {
6155
- const c = y * 2 * Math.PI / h - Math.PI / 2, u = a + s * Math.cos(c), x = l + s * Math.sin(c);
6156
- y === 0 ? this.ctx.moveTo(u, x) : this.ctx.lineTo(u, x);
6154
+ for (let x = 0; x < f; x++) {
6155
+ const c = x * 2 * Math.PI / f - Math.PI / 2, y = a + s * Math.cos(c), g = l + s * Math.sin(c);
6156
+ x === 0 ? this.ctx.moveTo(y, g) : this.ctx.lineTo(y, g);
6157
6157
  }
6158
6158
  this.ctx.closePath(), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
6159
6159
  }
6160
6160
  drawHeart(o) {
6161
- const a = o.width, l = o.height, s = 0, h = 0;
6161
+ const a = o.width, l = o.height, s = 0, f = 0;
6162
6162
  this.ctx.beginPath();
6163
- const y = l * 0.3;
6164
- this.ctx.moveTo(s + a / 2, h + y), this.ctx.bezierCurveTo(
6163
+ const x = l * 0.3;
6164
+ this.ctx.moveTo(s + a / 2, f + x), this.ctx.bezierCurveTo(
6165
6165
  s + a / 2,
6166
- h,
6166
+ f,
6167
6167
  s,
6168
- h,
6168
+ f,
6169
6169
  s,
6170
- h + y
6170
+ f + x
6171
6171
  ), this.ctx.bezierCurveTo(
6172
6172
  s,
6173
- h + (l + y) / 2,
6173
+ f + (l + x) / 2,
6174
6174
  s + a / 2,
6175
- h + (l + y) / 2,
6175
+ f + (l + x) / 2,
6176
6176
  s + a / 2,
6177
- h + l
6177
+ f + l
6178
6178
  ), this.ctx.bezierCurveTo(
6179
6179
  s + a / 2,
6180
- h + (l + y) / 2,
6180
+ f + (l + x) / 2,
6181
6181
  s + a,
6182
- h + (l + y) / 2,
6182
+ f + (l + x) / 2,
6183
6183
  s + a,
6184
- h + y
6184
+ f + x
6185
6185
  ), this.ctx.bezierCurveTo(
6186
6186
  s + a,
6187
- h,
6187
+ f,
6188
6188
  s + a / 2,
6189
- h,
6189
+ f,
6190
6190
  s + a / 2,
6191
- h + y
6191
+ f + x
6192
6192
  ), this.ctx.closePath(), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
6193
6193
  }
6194
6194
  drawOval(o) {
6195
- const a = o.width / 2, l = o.height / 2, s = o.width / 2, h = o.height / 2;
6196
- this.ctx.beginPath(), this.ctx.ellipse(a, l, s, h, 0, 0, 2 * Math.PI), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
6195
+ const a = o.width / 2, l = o.height / 2, s = o.width / 2, f = o.height / 2;
6196
+ this.ctx.beginPath(), this.ctx.ellipse(a, l, s, f, 0, 0, 2 * Math.PI), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
6197
6197
  }
6198
6198
  drawRoundedRectangle(o) {
6199
6199
  const a = Math.min(o.width, o.height) * 0.1;
6200
6200
  this.drawRoundedRect(0, 0, o.width, o.height, a), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
6201
6201
  }
6202
- drawRoundedRect(o, a, l, s, h) {
6203
- this.ctx.beginPath(), this.ctx.moveTo(o + h, a), this.ctx.lineTo(o + l - h, a), this.ctx.quadraticCurveTo(o + l, a, o + l, a + h), this.ctx.lineTo(o + l, a + s - h), this.ctx.quadraticCurveTo(o + l, a + s, o + l - h, a + s), this.ctx.lineTo(o + h, a + s), this.ctx.quadraticCurveTo(o, a + s, o, a + s - h), this.ctx.lineTo(o, a + h), this.ctx.quadraticCurveTo(o, a, o + h, a), this.ctx.closePath();
6202
+ drawRoundedRect(o, a, l, s, f) {
6203
+ this.ctx.beginPath(), this.ctx.moveTo(o + f, a), this.ctx.lineTo(o + l - f, a), this.ctx.quadraticCurveTo(o + l, a, o + l, a + f), this.ctx.lineTo(o + l, a + s - f), this.ctx.quadraticCurveTo(o + l, a + s, o + l - f, a + s), this.ctx.lineTo(o + f, a + s), this.ctx.quadraticCurveTo(o, a + s, o, a + s - f), this.ctx.lineTo(o, a + f), this.ctx.quadraticCurveTo(o, a, o + f, a), this.ctx.closePath();
6204
6204
  }
6205
6205
  async drawQRCode(o) {
6206
6206
  if (o.imageObject)
@@ -6321,91 +6321,91 @@ class gi {
6321
6321
  });
6322
6322
  }
6323
6323
  // Export all sections as JSON with File objects
6324
- async exportAllSectionsAsJSON(o, a, l, s, h = "png", y = null) {
6324
+ async exportAllSectionsAsJSON(o, a, l, s, f = "png", x = null) {
6325
6325
  var p, I;
6326
- const c = [], u = [], x = {};
6326
+ const c = [], y = [], g = {};
6327
6327
  for (const T of a) {
6328
- const w = T.sectionName, z = o[w];
6329
- if (!z || !z.elements || z.elements.length === 0) {
6328
+ const w = T.sectionName, B = o[w];
6329
+ if (!B || !B.elements || B.elements.length === 0) {
6330
6330
  console.log(`Skipping section ${w} - no elements`);
6331
6331
  continue;
6332
6332
  }
6333
6333
  let E = T.image || T.sectionImage;
6334
- y && y.sectionImage && (T.sectionName === "Front" || y.sections && Object.keys(y.sections).includes(T.sectionName)) && (E = y.sectionImage);
6334
+ x && x.sectionImage && (T.sectionName === "Front" || x.sections && Object.keys(x.sections).includes(T.sectionName)) && (E = x.sectionImage);
6335
6335
  const S = {
6336
- ...z,
6336
+ ...B,
6337
6337
  // Include background information using the determined image
6338
6338
  backgroundImage: E,
6339
6339
  sectionImage: E,
6340
6340
  sectionName: w,
6341
6341
  // Ensure we have the selected color
6342
- selectedColor: z.selectedColor || "#FFFFFF",
6342
+ selectedColor: B.selectedColor || "#FFFFFF",
6343
6343
  // Include canvas dimensions
6344
6344
  canvasWidth: l,
6345
6345
  canvasHeight: s
6346
6346
  };
6347
- x[w] = S;
6347
+ g[w] = S;
6348
6348
  const $ = await this.exportSectionAsBlob(
6349
- z,
6349
+ B,
6350
6350
  T,
6351
6351
  l,
6352
6352
  s,
6353
- h,
6353
+ f,
6354
6354
  !0,
6355
- y
6355
+ x
6356
6356
  // Pass initData to exportSectionAsBlob
6357
6357
  );
6358
6358
  if ($) {
6359
6359
  const W = await this.blobToFile(
6360
6360
  $,
6361
- `${w}-full.${h}`,
6362
- `image/${h}`
6361
+ `${w}-full.${f}`,
6362
+ `image/${f}`
6363
6363
  );
6364
6364
  c.push({
6365
6365
  sectionName: w,
6366
6366
  sectionImage: W
6367
6367
  });
6368
6368
  }
6369
- const B = await this.exportSectionAsBlob(
6370
- z,
6369
+ const z = await this.exportSectionAsBlob(
6370
+ B,
6371
6371
  T,
6372
6372
  l,
6373
6373
  s,
6374
- h,
6374
+ f,
6375
6375
  !1,
6376
- y
6376
+ x
6377
6377
  // Pass initData to exportSectionAsBlob
6378
6378
  );
6379
- if (B) {
6379
+ if (z) {
6380
6380
  const W = await this.blobToFile(
6381
- B,
6382
- `${w}-print.${h}`,
6383
- `image/${h}`
6381
+ z,
6382
+ `${w}-print.${f}`,
6383
+ `image/${f}`
6384
6384
  );
6385
- u.push({
6385
+ y.push({
6386
6386
  sectionName: w,
6387
6387
  sectionImage: W
6388
6388
  });
6389
6389
  }
6390
6390
  }
6391
6391
  let F = ((p = a[0]) == null ? void 0 : p.image) || ((I = a[0]) == null ? void 0 : I.sectionImage);
6392
- if (y && y.sectionImage) {
6392
+ if (x && x.sectionImage) {
6393
6393
  const T = a[0];
6394
- T && (T.sectionName === "Front" || y.sections && Object.keys(y.sections).includes(T.sectionName)) && (F = y.sectionImage);
6394
+ T && (T.sectionName === "Front" || x.sections && Object.keys(x.sections).includes(T.sectionName)) && (F = x.sectionImage);
6395
6395
  }
6396
6396
  const C = {
6397
- sections: x,
6397
+ sections: g,
6398
6398
  canvasWidth: l,
6399
6399
  canvasHeight: s,
6400
6400
  sectionImage: F,
6401
- format: h,
6401
+ format: f,
6402
6402
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
6403
6403
  version: "1.0",
6404
6404
  // Include initData information if present
6405
- ...y && {
6405
+ ...x && {
6406
6406
  initData: {
6407
- sectionImage: y.sectionImage,
6408
- sections: y.sections ? Object.keys(y.sections) : []
6407
+ sectionImage: x.sectionImage,
6408
+ sections: x.sections ? Object.keys(x.sections) : []
6409
6409
  }
6410
6410
  },
6411
6411
  // Include product information for complete context
@@ -6419,46 +6419,46 @@ class gi {
6419
6419
  };
6420
6420
  return {
6421
6421
  fullDesign: c,
6422
- printReady: u,
6422
+ printReady: y,
6423
6423
  designFile: JSON.stringify(C)
6424
6424
  };
6425
6425
  }
6426
6426
  // Helper method to export a single section as blob
6427
- async exportSectionAsBlob(o, a, l, s, h = "png", y = !0, c = null) {
6427
+ async exportSectionAsBlob(o, a, l, s, f = "png", x = !0, c = null) {
6428
6428
  try {
6429
- if (this.canvas.width = l, this.canvas.height = s, this.ctx.clearRect(0, 0, l, s), y) {
6430
- let u = a.image || a.sectionImage;
6431
- if (c && c.sectionImage && (a.sectionName === "Front" || c.sections && Object.keys(c.sections).includes(a.sectionName)) && (u = c.sectionImage), u)
6429
+ if (this.canvas.width = l, this.canvas.height = s, this.ctx.clearRect(0, 0, l, s), x) {
6430
+ let y = a.image || a.sectionImage;
6431
+ if (c && c.sectionImage && (a.sectionName === "Front" || c.sections && Object.keys(c.sections).includes(a.sectionName)) && (y = c.sectionImage), y)
6432
6432
  try {
6433
- const x = await this.loadImage(u);
6434
- await this.processImageColor(x, o.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, l, s);
6435
- } catch (x) {
6436
- console.warn("Failed to load background image:", x);
6433
+ const g = await this.loadImage(y);
6434
+ await this.processImageColor(g, o.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, l, s);
6435
+ } catch (g) {
6436
+ console.warn("Failed to load background image:", g);
6437
6437
  }
6438
6438
  } else
6439
6439
  this.ctx.clearRect(0, 0, l, s);
6440
- for (const u of o.elements)
6441
- await this.drawElement(u);
6442
- return new Promise((u) => {
6443
- this.canvas.toBlob(u, `image/${h}`, h === "jpeg" ? 0.9 : void 0);
6440
+ for (const y of o.elements)
6441
+ await this.drawElement(y);
6442
+ return new Promise((y) => {
6443
+ this.canvas.toBlob(y, `image/${f}`, f === "jpeg" ? 0.9 : void 0);
6444
6444
  });
6445
- } catch (u) {
6446
- return console.error("Error exporting section as blob:", u), null;
6445
+ } catch (y) {
6446
+ return console.error("Error exporting section as blob:", y), null;
6447
6447
  }
6448
6448
  }
6449
6449
  async exportCurrentSectionAsJSON(o, a = "png", l = null) {
6450
6450
  var I, T, w;
6451
6451
  const s = ((I = o.activeSection) == null ? void 0 : I.sectionName) || "main";
6452
- let h = ((T = o.activeSection) == null ? void 0 : T.sectionImage) || ((w = o.activeSection) == null ? void 0 : w.image);
6453
- l && l.sectionImage && (s === "Front" || l.sections && Object.keys(l.sections).includes(s)) && (h = l.sectionImage);
6454
- const y = {
6452
+ let f = ((T = o.activeSection) == null ? void 0 : T.sectionImage) || ((w = o.activeSection) == null ? void 0 : w.image);
6453
+ l && l.sectionImage && (s === "Front" || l.sections && Object.keys(l.sections).includes(s)) && (f = l.sectionImage);
6454
+ const x = {
6455
6455
  elements: o.elements,
6456
6456
  selectedColor: o.selectedColor,
6457
6457
  canvasWidth: o.canvasWidth,
6458
6458
  canvasHeight: o.canvasHeight,
6459
6459
  // Include background information using the determined image
6460
- backgroundImage: h,
6461
- sectionImage: h,
6460
+ backgroundImage: f,
6461
+ sectionImage: f,
6462
6462
  sectionName: s,
6463
6463
  zoomLevel: o.zoomLevel,
6464
6464
  showGrid: o.showGrid,
@@ -6466,10 +6466,10 @@ class gi {
6466
6466
  }, c = {
6467
6467
  id: s,
6468
6468
  sectionName: s,
6469
- image: h,
6470
- sectionImage: h
6471
- }, u = [], x = [], F = await this.exportSectionAsBlob(
6472
- y,
6469
+ image: f,
6470
+ sectionImage: f
6471
+ }, y = [], g = [], F = await this.exportSectionAsBlob(
6472
+ x,
6473
6473
  c,
6474
6474
  o.canvasWidth,
6475
6475
  o.canvasHeight,
@@ -6479,18 +6479,18 @@ class gi {
6479
6479
  // Pass initData to exportSectionAsBlob
6480
6480
  );
6481
6481
  if (F) {
6482
- const z = await this.blobToFile(
6482
+ const B = await this.blobToFile(
6483
6483
  F,
6484
6484
  `${s}-full.${a}`,
6485
6485
  `image/${a}`
6486
6486
  );
6487
- u.push({
6487
+ y.push({
6488
6488
  sectionName: s,
6489
- sectionImage: z
6489
+ sectionImage: B
6490
6490
  });
6491
6491
  }
6492
6492
  const C = await this.exportSectionAsBlob(
6493
- y,
6493
+ x,
6494
6494
  c,
6495
6495
  o.canvasWidth,
6496
6496
  o.canvasHeight,
@@ -6500,21 +6500,21 @@ class gi {
6500
6500
  // Pass initData to exportSectionAsBlob
6501
6501
  );
6502
6502
  if (C) {
6503
- const z = await this.blobToFile(
6503
+ const B = await this.blobToFile(
6504
6504
  C,
6505
6505
  `${s}-print.${a}`,
6506
6506
  `image/${a}`
6507
6507
  );
6508
- x.push({
6508
+ g.push({
6509
6509
  sectionName: s,
6510
- sectionImage: z
6510
+ sectionImage: B
6511
6511
  });
6512
6512
  }
6513
6513
  const p = {
6514
- sections: { [s]: y },
6514
+ sections: { [s]: x },
6515
6515
  canvasWidth: o.canvasWidth,
6516
6516
  canvasHeight: o.canvasHeight,
6517
- sectionImage: h,
6517
+ sectionImage: f,
6518
6518
  // Use the determined image here too
6519
6519
  format: a,
6520
6520
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -6530,15 +6530,15 @@ class gi {
6530
6530
  productInfo: {
6531
6531
  sections: [{
6532
6532
  sectionName: s,
6533
- sectionImage: h,
6533
+ sectionImage: f,
6534
6534
  // Use the determined image here too
6535
6535
  id: s
6536
6536
  }]
6537
6537
  }
6538
6538
  };
6539
6539
  return {
6540
- fullDesign: u,
6541
- printReady: x,
6540
+ fullDesign: y,
6541
+ printReady: g,
6542
6542
  designFile: JSON.stringify(p)
6543
6543
  };
6544
6544
  }
@@ -6551,10 +6551,10 @@ class xi {
6551
6551
  saveDesign(o, a) {
6552
6552
  var l;
6553
6553
  try {
6554
- const s = this.generateDesignId(o), h = (/* @__PURE__ */ new Date()).toISOString(), y = {
6554
+ const s = this.generateDesignId(o), f = (/* @__PURE__ */ new Date()).toISOString(), x = {
6555
6555
  id: s,
6556
6556
  name: o,
6557
- timestamp: h,
6557
+ timestamp: f,
6558
6558
  version: "1.0",
6559
6559
  canvasData: {
6560
6560
  elements: a.elements || [],
@@ -6570,11 +6570,11 @@ class xi {
6570
6570
  },
6571
6571
  metadata: {
6572
6572
  elementCount: ((l = a.elements) == null ? void 0 : l.length) || 0,
6573
- lastModified: h,
6573
+ lastModified: f,
6574
6574
  thumbnail: a.thumbnail || null
6575
6575
  }
6576
6576
  };
6577
- return this.storage.setItem(this.STORAGE_PREFIX + s, JSON.stringify(y)), this.updateDesignsList(s, o, h), { success: !0, designId: s, message: "Design saved successfully" };
6577
+ return this.storage.setItem(this.STORAGE_PREFIX + s, JSON.stringify(x)), this.updateDesignsList(s, o, f), { success: !0, designId: s, message: "Design saved successfully" };
6578
6578
  } catch (s) {
6579
6579
  return console.error("Error saving design:", s), { success: !1, error: s.message };
6580
6580
  }
@@ -6584,10 +6584,10 @@ class xi {
6584
6584
  try {
6585
6585
  let a = o;
6586
6586
  if (!o.startsWith("design_")) {
6587
- const y = this.getAllDesigns().find((c) => c.name === o);
6588
- if (!y)
6587
+ const x = this.getAllDesigns().find((c) => c.name === o);
6588
+ if (!x)
6589
6589
  return { success: !1, error: "Design not found" };
6590
- a = y.id;
6590
+ a = x.id;
6591
6591
  }
6592
6592
  const l = this.storage.getItem(this.STORAGE_PREFIX + a);
6593
6593
  return l ? { success: !0, data: JSON.parse(l) } : { success: !1, error: "Design not found" };
@@ -6620,8 +6620,8 @@ class xi {
6620
6620
  const a = this.loadDesign(o);
6621
6621
  if (!a.success)
6622
6622
  return a;
6623
- const l = a.data, s = JSON.stringify(l, null, 2), h = new Blob([s], { type: "application/json" }), y = URL.createObjectURL(h), c = document.createElement("a");
6624
- return c.href = y, c.download = `${l.name}_${l.id}.json`, document.body.appendChild(c), c.click(), document.body.removeChild(c), URL.revokeObjectURL(y), { success: !0, message: "Design exported successfully" };
6623
+ const l = a.data, s = JSON.stringify(l, null, 2), f = new Blob([s], { type: "application/json" }), x = URL.createObjectURL(f), c = document.createElement("a");
6624
+ return c.href = x, c.download = `${l.name}_${l.id}.json`, document.body.appendChild(c), c.click(), document.body.removeChild(c), URL.revokeObjectURL(x), { success: !0, message: "Design exported successfully" };
6625
6625
  } catch (a) {
6626
6626
  return console.error("Error exporting design:", a), { success: !1, error: a.message };
6627
6627
  }
@@ -6633,13 +6633,13 @@ class xi {
6633
6633
  const l = new FileReader();
6634
6634
  l.onload = (s) => {
6635
6635
  try {
6636
- const h = JSON.parse(s.target.result);
6637
- if (!this.validateDesignData(h)) {
6636
+ const f = JSON.parse(s.target.result);
6637
+ if (!this.validateDesignData(f)) {
6638
6638
  a({ success: !1, error: "Invalid design file format" });
6639
6639
  return;
6640
6640
  }
6641
- const y = this.generateDesignId(h.name + "_imported");
6642
- h.id = y, h.name += "_imported", h.timestamp = (/* @__PURE__ */ new Date()).toISOString(), h.metadata.lastModified = h.timestamp, this.storage.setItem(this.STORAGE_PREFIX + y, JSON.stringify(h)), this.updateDesignsList(y, h.name, h.timestamp), a({ success: !0, data: h, message: "Design imported successfully" });
6641
+ const x = this.generateDesignId(f.name + "_imported");
6642
+ f.id = x, f.name += "_imported", f.timestamp = (/* @__PURE__ */ new Date()).toISOString(), f.metadata.lastModified = f.timestamp, this.storage.setItem(this.STORAGE_PREFIX + x, JSON.stringify(f)), this.updateDesignsList(x, f.name, f.timestamp), a({ success: !0, data: f, message: "Design imported successfully" });
6643
6643
  } catch {
6644
6644
  a({ success: !1, error: "Failed to parse design file" });
6645
6645
  }
@@ -6707,13 +6707,13 @@ class xi {
6707
6707
  return `design_${a}_${l}`;
6708
6708
  }
6709
6709
  updateDesignsList(o, a, l) {
6710
- const s = this.getAllDesigns(), h = s.findIndex((c) => c.id === o), y = {
6710
+ const s = this.getAllDesigns(), f = s.findIndex((c) => c.id === o), x = {
6711
6711
  id: o,
6712
6712
  name: a,
6713
6713
  timestamp: l,
6714
6714
  lastModified: l
6715
6715
  };
6716
- h >= 0 ? s[h] = y : s.push(y), s.sort((c, u) => new Date(u.timestamp) - new Date(c.timestamp)), this.storage.setItem(this.DESIGNS_LIST_KEY, JSON.stringify(s));
6716
+ f >= 0 ? s[f] = x : s.push(x), s.sort((c, y) => new Date(y.timestamp) - new Date(c.timestamp)), this.storage.setItem(this.DESIGNS_LIST_KEY, JSON.stringify(s));
6717
6717
  }
6718
6718
  validateDesignData(o) {
6719
6719
  return o && o.id && o.name && o.canvasData && Array.isArray(o.canvasData.elements);
@@ -6763,16 +6763,16 @@ const yi = Ye((d, o) => {
6763
6763
  }
6764
6764
  ]
6765
6765
  },
6766
- initFile: h,
6767
- initDesignContent: y
6768
- } = d, [c, u] = N([]), [x, F] = N(null), [C, p] = N(!1), [I, T] = N(!1), [w, z] = N(!1), [E, S] = N({ x: 0, y: 0 }), [$, B] = N(null), [W, at] = N(800), [U, ft] = N(600), [q, rt] = N(1), [Y, O] = N(s.colorSettings[0]), [J, st] = N(!1), [K, it] = N(!0), [M, G] = N(!0), [j, m] = N(s.sections[0]), [A, Q] = N(!1), [_, Z] = N({}), [V, ht] = N([]), [H, P] = N(-1), [ct] = N(new xi("localStorage")), gt = nt(null), Dt = nt(null), kt = nt(null), wt = nt(null), Ut = nt(null), Et = nt(new gi()), Bt = nt(!1), [yt, Ot] = N(null), lt = ot(() => {
6766
+ initFile: f,
6767
+ initDesignContent: x
6768
+ } = d, [c, y] = N([]), [g, F] = N(null), [C, p] = N(!1), [I, T] = N(!1), [w, B] = N(!1), [E, S] = N({ x: 0, y: 0 }), [$, z] = N(null), [W, at] = N(600), [U, ft] = N(600), [q, rt] = N(1), [Y, O] = N(s.colorSettings[0]), [J, st] = N(!1), [K, it] = N(!0), [M, G] = N(!0), [j, u] = N(s.sections[0]), [A, Q] = N(!1), [_, Z] = N({}), [V, ht] = N([]), [H, P] = N(-1), [nt] = N(new xi("localStorage")), gt = dt(null), Et = dt(null), kt = dt(null), wt = dt(null), Ot = dt(null), zt = dt(new gi()), Bt = dt(!1), [yt, Qt] = N(null), lt = ot(() => {
6769
6769
  const e = {
6770
6770
  elements: JSON.parse(JSON.stringify(c)),
6771
- selectedElement: x ? { ...x } : null,
6771
+ selectedElement: g ? { ...g } : null,
6772
6772
  timestamp: Date.now()
6773
6773
  }, t = V.slice(0, H + 1);
6774
6774
  t.push(e), t.length > 50 ? t.shift() : P(H + 1), ht(t);
6775
- }, [c, x, V, H]), St = ot(() => ({
6775
+ }, [c, g, V, H]), St = ot(() => ({
6776
6776
  elements: c,
6777
6777
  canvasWidth: W,
6778
6778
  canvasHeight: U,
@@ -6783,16 +6783,16 @@ const yi = Ye((d, o) => {
6783
6783
  zoomLevel: q,
6784
6784
  showGrid: J,
6785
6785
  snapToGrid: M,
6786
- selectedElement: x ? { ...x } : null,
6786
+ selectedElement: g ? { ...g } : null,
6787
6787
  canvasRef: gt
6788
6788
  // Include reference for thumbnail generation
6789
- }), [c, W, U, Y, j, s, _, q, J, M, x]), Qt = (e) => {
6789
+ }), [c, W, U, Y, j, s, _, q, J, M, g]), $t = (e) => {
6790
6790
  if (e.sections && typeof e.sections == "object") {
6791
6791
  const t = Object.keys(e.sections)[0], r = e.sections[t];
6792
6792
  if (r && r.elements) {
6793
- u(r.elements || []), at(r.canvasWidth || 800), ft(r.canvasHeight || 600), O(r.selectedColor || s.colorSettings[0]), rt(r.zoomLevel || 1), st(r.showGrid || !1), G(r.snapToGrid || !0), F(null), e.sections && Z(e.sections);
6794
- const n = s.sections.find((f) => f.sectionName === t);
6795
- n && m(n), ht([]), P(-1), setTimeout(() => {
6793
+ y(r.elements || []), at(r.canvasWidth || 800), ft(r.canvasHeight || 600), O(r.selectedColor || s.colorSettings[0]), rt(r.zoomLevel || 1), st(r.showGrid || !1), G(r.snapToGrid || !0), F(null), e.sections && Z(e.sections);
6794
+ const n = s.sections.find((h) => h.sectionName === t);
6795
+ n && u(n), ht([]), P(-1), setTimeout(() => {
6796
6796
  lt();
6797
6797
  }, 100);
6798
6798
  return;
@@ -6802,21 +6802,21 @@ const yi = Ye((d, o) => {
6802
6802
  et(() => {
6803
6803
  const t = setTimeout(async () => {
6804
6804
  if (c.length === 0 && V.length <= 1)
6805
- if (y)
6805
+ if (x)
6806
6806
  try {
6807
- const r = JSON.parse(y);
6808
- Ot(r), Qt(r);
6807
+ const r = JSON.parse(x);
6808
+ Qt(r), $t(r);
6809
6809
  } catch (r) {
6810
6810
  console.error("Error loading design file:", r), console.warn("Using default text instead");
6811
6811
  }
6812
- else if (h)
6812
+ else if (f)
6813
6813
  try {
6814
- const r = await fetch(h);
6814
+ const r = await fetch(f);
6815
6815
  if (r.ok) {
6816
6816
  const n = await r.text();
6817
6817
  if (n.trim()) {
6818
- const f = JSON.parse(n.trim());
6819
- Ot(f), Qt(f);
6818
+ const h = JSON.parse(n.trim());
6819
+ Qt(h), $t(h);
6820
6820
  }
6821
6821
  } else
6822
6822
  console.warn("Failed to load design file, using default text");
@@ -6824,10 +6824,10 @@ const yi = Ye((d, o) => {
6824
6824
  console.error("Error loading design file:", r), console.warn("Using default text instead");
6825
6825
  }
6826
6826
  else {
6827
- const n = "Arial", f = "Change me", b = document.createElement("canvas").getContext("2d");
6827
+ const n = "Arial", h = "Change me", b = document.createElement("canvas").getContext("2d");
6828
6828
  b.font = `24px ${n}`;
6829
- const v = b.measureText(f).width, R = {
6830
- id: dt(),
6829
+ const v = b.measureText(h).width, R = {
6830
+ id: ct(),
6831
6831
  type: "text",
6832
6832
  x: W / 2 - v / 2,
6833
6833
  // Center the actual text width
@@ -6835,7 +6835,7 @@ const yi = Ye((d, o) => {
6835
6835
  // Center based on font size
6836
6836
  width: v,
6837
6837
  height: 24,
6838
- text: f,
6838
+ text: h,
6839
6839
  fontSize: 24,
6840
6840
  fontFamily: n,
6841
6841
  fontWeight: "normal",
@@ -6848,16 +6848,16 @@ const yi = Ye((d, o) => {
6848
6848
  rotation: 0,
6849
6849
  opacity: 1
6850
6850
  };
6851
- u([R]), F(R), setTimeout(() => {
6851
+ y([R]), F(R), setTimeout(() => {
6852
6852
  lt();
6853
6853
  }, 100);
6854
6854
  }
6855
6855
  }, 300);
6856
6856
  return () => clearTimeout(t);
6857
- }, [h, y, s.colorSettings, s.sections]);
6858
- const zt = ot((e = "png", t = !0) => {
6857
+ }, [f, x, s.colorSettings, s.sections]);
6858
+ const Wt = ot((e = "png", t = !0) => {
6859
6859
  const r = St();
6860
- return s.sections, Et.current.exportAllSections(
6860
+ return s.sections, zt.current.exportAllSections(
6861
6861
  { [(j == null ? void 0 : j.sectionName) || "main"]: r },
6862
6862
  [{
6863
6863
  id: (j == null ? void 0 : j.sectionName) || "main",
@@ -6871,7 +6871,7 @@ const yi = Ye((d, o) => {
6871
6871
  t,
6872
6872
  yt
6873
6873
  );
6874
- }, [St, s.sections, j, W, U]), fe = [
6874
+ }, [St, s.sections, j, W, U]), he = [
6875
6875
  "Arial",
6876
6876
  "Helvetica",
6877
6877
  "Times New Roman",
@@ -6893,13 +6893,13 @@ const yi = Ye((d, o) => {
6893
6893
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
6894
6894
  }, []), et(() => {
6895
6895
  const e = document.createElement("canvas");
6896
- e.width = W, e.height = U, Ut.current = e;
6896
+ e.width = W, e.height = U, Ot.current = e;
6897
6897
  }, [W, U]), et(() => {
6898
6898
  V.length === 0 && lt();
6899
6899
  }, []);
6900
- const At = (e, t, r, n, f, g) => {
6901
- e.beginPath(), e.moveTo(t + g, r), e.lineTo(t + n - g, r), e.quadraticCurveTo(t + n, r, t + n, r + g), e.lineTo(t + n, r + f - g), e.quadraticCurveTo(t + n, r + f, t + n - g, r + f), e.lineTo(t + g, r + f), e.quadraticCurveTo(t, r + f, t, r + f - g), e.lineTo(t, r + g), e.quadraticCurveTo(t, r, t + g, r), e.closePath();
6902
- }, $t = (e, t) => {
6900
+ const At = (e, t, r, n, h, m) => {
6901
+ e.beginPath(), e.moveTo(t + m, r), e.lineTo(t + n - m, r), e.quadraticCurveTo(t + n, r, t + n, r + m), e.lineTo(t + n, r + h - m), e.quadraticCurveTo(t + n, r + h, t + n - m, r + h), e.lineTo(t + m, r + h), e.quadraticCurveTo(t, r + h, t, r + h - m), e.lineTo(t, r + m), e.quadraticCurveTo(t, r, t + m, r), e.closePath();
6902
+ }, Ht = (e, t) => {
6903
6903
  if (!t.isIcon)
6904
6904
  return {
6905
6905
  x: t.x,
@@ -6910,11 +6910,11 @@ const yi = Ye((d, o) => {
6910
6910
  cy: t.y + t.height / 2
6911
6911
  };
6912
6912
  e.save(), e.font = `${t.fontStyle || ""} ${t.fontWeight || ""} ${t.fontSize}px ${t.fontFamily}`, e.textBaseline = "alphabetic", e.textAlign = "left";
6913
- const r = e.measureText(t.text), n = r.actualBoundingBoxAscent ?? t.fontSize * 0.8, f = r.actualBoundingBoxDescent ?? t.fontSize * 0.2, g = r.actualBoundingBoxLeft ?? 0, b = r.actualBoundingBoxRight ?? r.width, k = g + b, v = n + f, R = t.x, D = t.y, L = R - k / 2 - g, tt = D - v / 2 - n;
6913
+ const r = e.measureText(t.text), n = r.actualBoundingBoxAscent ?? t.fontSize * 0.8, h = r.actualBoundingBoxDescent ?? t.fontSize * 0.2, m = r.actualBoundingBoxLeft ?? 0, b = r.actualBoundingBoxRight ?? r.width, k = m + b, v = n + h, R = t.x, D = t.y, L = R - k / 2 - m, tt = D - v / 2 - n;
6914
6914
  return e.restore(), { x: L, y: tt, width: k, height: v, cx: R, cy: D };
6915
- }, he = (e, t) => {
6915
+ }, ge = (e, t) => {
6916
6916
  if (!t) return;
6917
- const r = 8, n = 8, f = 4, g = 30, b = $t(e, t), k = t.isIcon ? Math.max(r, 12) : r, v = {
6917
+ const r = 8, n = 8, h = 4, m = 30, b = Ht(e, t), k = t.isIcon ? Math.max(r, 12) : r, v = {
6918
6918
  x: -b.width / 2 - k,
6919
6919
  y: -b.height / 2 - k,
6920
6920
  w: b.width + k * 2,
@@ -6933,8 +6933,8 @@ const yi = Ye((d, o) => {
6933
6933
  v.y - 1,
6934
6934
  v.w + 2,
6935
6935
  v.h + 2,
6936
- f + 1
6937
- ), e.stroke(), e.strokeStyle = R, e.lineWidth = 2, e.setLineDash([8, 4]), At(e, v.x, v.y, v.w, v.h, f), e.stroke(), e.lineDashOffset = -(Date.now() / 50) % 12, e.strokeStyle = "#ffffff", e.lineWidth = 1, e.setLineDash([4, 8]), At(e, v.x, v.y, v.w, v.h, f), e.stroke(), e.setLineDash([]), e.lineDashOffset = 0, [
6936
+ h + 1
6937
+ ), e.stroke(), e.strokeStyle = R, e.lineWidth = 2, e.setLineDash([8, 4]), At(e, v.x, v.y, v.w, v.h, h), e.stroke(), e.lineDashOffset = -(Date.now() / 50) % 12, e.strokeStyle = "#ffffff", e.lineWidth = 1, e.setLineDash([4, 8]), At(e, v.x, v.y, v.w, v.h, h), e.stroke(), e.setLineDash([]), e.lineDashOffset = 0, [
6938
6938
  { x: v.x, y: v.y },
6939
6939
  { x: v.x + v.w, y: v.y },
6940
6940
  { x: v.x + v.w, y: v.y + v.h },
@@ -6957,11 +6957,11 @@ const yi = Ye((d, o) => {
6957
6957
  n
6958
6958
  );
6959
6959
  });
6960
- const D = 0, L = v.y - g;
6960
+ const D = 0, L = v.y - m;
6961
6961
  e.strokeStyle = "#3b82f6", e.lineWidth = 1, e.setLineDash([2, 2]), e.beginPath(), e.moveTo(D, L + 12), e.lineTo(D, v.y), e.stroke(), e.setLineDash([]), e.beginPath(), e.arc(D, L, 12, 0, 2 * Math.PI), e.fillStyle = "#f59e0b", e.fill(), e.strokeStyle = "#ffffff", e.lineWidth = 2, e.stroke(), e.strokeStyle = "#ffffff", e.lineWidth = 2, e.beginPath(), e.arc(D, L, 6, -Math.PI / 2, Math.PI, !1), e.stroke(), e.beginPath(), e.moveTo(D - 6, L), e.lineTo(D - 3, L - 3), e.lineTo(D - 3, L + 3), e.closePath(), e.fillStyle = "#ffffff", e.fill(), e.restore();
6962
- }, ge = (e, t) => {
6962
+ }, xe = (e, t) => {
6963
6963
  if (!t) return [];
6964
- const r = $t(e, t), n = t.isIcon ? Math.max(8, 12) : 8, f = 8, g = 30, b = (t.rotation || 0) * Math.PI / 180, k = {
6964
+ const r = Ht(e, t), n = t.isIcon ? Math.max(8, 12) : 8, h = 8, m = 30, b = (t.rotation || 0) * Math.PI / 180, k = {
6965
6965
  x: -r.width / 2 - n,
6966
6966
  y: -r.height / 2 - n,
6967
6967
  w: r.width + n * 2,
@@ -6971,20 +6971,20 @@ const yi = Ye((d, o) => {
6971
6971
  { x: k.x + k.w, y: k.y, type: "ne-resize" },
6972
6972
  { x: k.x + k.w, y: k.y + k.h, type: "se-resize" },
6973
6973
  { x: k.x, y: k.y + k.h, type: "sw-resize" },
6974
- { x: 0, y: k.y - g, type: "rotate" }
6974
+ { x: 0, y: k.y - m, type: "rotate" }
6975
6975
  ], R = Math.cos(b), D = Math.sin(b);
6976
6976
  return v.map((L) => ({
6977
6977
  x: r.cx + (L.x * R - L.y * D),
6978
6978
  y: r.cy + (L.x * D + L.y * R),
6979
6979
  type: L.type,
6980
- size: L.type === "rotate" ? 24 : f
6980
+ size: L.type === "rotate" ? 24 : h
6981
6981
  }));
6982
- }, Ht = (e, t, r) => {
6982
+ }, Gt = (e, t, r) => {
6983
6983
  if (!r) return null;
6984
6984
  const n = gt.current;
6985
6985
  if (!n) return null;
6986
- const f = n.getContext("2d"), g = ge(f, r);
6987
- for (const b of g) {
6986
+ const h = n.getContext("2d"), m = xe(h, r);
6987
+ for (const b of m) {
6988
6988
  const k = e - b.x, v = t - b.y;
6989
6989
  if (Math.sqrt(k * k + v * v) <= b.size / 2)
6990
6990
  return b.type;
@@ -6993,23 +6993,23 @@ const yi = Ye((d, o) => {
6993
6993
  }, Ft = ot(() => {
6994
6994
  if (H > 0) {
6995
6995
  const e = V[H - 1];
6996
- u(e.elements), F(e.selectedElement), P(H - 1);
6996
+ y(e.elements), F(e.selectedElement), P(H - 1);
6997
6997
  }
6998
6998
  }, [V, H]), bt = ot(() => {
6999
6999
  if (H < V.length - 1) {
7000
7000
  const e = V[H + 1];
7001
- u(e.elements), F(e.selectedElement), P(H + 1);
7001
+ y(e.elements), F(e.selectedElement), P(H + 1);
7002
7002
  }
7003
7003
  }, [V, H]), mt = (e) => M ? Math.round(e / It) * It : e;
7004
7004
  et(() => {
7005
7005
  if (j != null && j.sectionImage) {
7006
7006
  kt.current = null, wt.current = null;
7007
7007
  const e = gt.current;
7008
- if (e && e.getContext("2d").clearRect(0, 0, W, U), h && !yt)
7008
+ if (e && e.getContext("2d").clearRect(0, 0, W, U), f && !yt)
7009
7009
  return;
7010
7010
  const t = new Image();
7011
7011
  t.crossOrigin = "anonymous", t.onload = () => {
7012
- kt.current = t, Jt(t, Y);
7012
+ kt.current = t, Kt(t, Y);
7013
7013
  }, t.onerror = () => {
7014
7014
  console.error("Failed to load background image:", j.sectionImage), X();
7015
7015
  };
@@ -7021,10 +7021,10 @@ const yi = Ye((d, o) => {
7021
7021
  const e = (t) => {
7022
7022
  const r = document.activeElement;
7023
7023
  if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable))) {
7024
- if ((t.key === "Delete" || t.key === "Backspace") && x && !l) {
7024
+ if ((t.key === "Delete" || t.key === "Backspace") && g && !l) {
7025
7025
  t.preventDefault();
7026
- const f = x;
7027
- u((g) => g.filter((b) => b.id !== f.id)), F(null), lt();
7026
+ const h = g;
7027
+ y((m) => m.filter((b) => b.id !== h.id)), F(null), lt();
7028
7028
  }
7029
7029
  if (t.ctrlKey || t.metaKey)
7030
7030
  switch (t.key) {
@@ -7040,122 +7040,122 @@ const yi = Ye((d, o) => {
7040
7040
  return document.addEventListener("keydown", e), () => {
7041
7041
  document.removeEventListener("keydown", e);
7042
7042
  };
7043
- }, [x, l, Ft, bt, lt]);
7044
- const xe = (e) => {
7043
+ }, [g, l, Ft, bt, lt]);
7044
+ const ye = (e) => {
7045
7045
  const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
7046
7046
  return t ? {
7047
7047
  r: parseInt(t[1], 16),
7048
7048
  g: parseInt(t[2], 16),
7049
7049
  b: parseInt(t[3], 16)
7050
7050
  } : null;
7051
- }, dt = () => `element_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, ye = (e) => {
7051
+ }, ct = () => `element_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, ue = (e) => {
7052
7052
  e.strokeStyle = "#e0e0e0", e.lineWidth = 1, e.setLineDash([1, 1]);
7053
7053
  for (let t = 0; t <= W; t += It)
7054
7054
  e.beginPath(), e.moveTo(t, 0), e.lineTo(t, U), e.stroke();
7055
7055
  for (let t = 0; t <= U; t += It)
7056
7056
  e.beginPath(), e.moveTo(0, t), e.lineTo(W, t), e.stroke();
7057
7057
  e.setLineDash([]);
7058
- }, ue = (e, t) => {
7058
+ }, me = (e, t) => {
7059
7059
  e.save();
7060
7060
  const r = t.x + t.width / 2, n = t.y + t.height / 2;
7061
7061
  switch (e.translate(r, n), t.rotation && e.rotate(t.rotation * Math.PI / 180), e.translate(-t.width / 2, -t.height / 2), t.type) {
7062
7062
  case "text":
7063
- we(e, t);
7063
+ be(e, t);
7064
7064
  break;
7065
7065
  case "rectangle":
7066
- be(e, t);
7066
+ ve(e, t);
7067
7067
  break;
7068
7068
  case "circle":
7069
- ve(e, t);
7069
+ ke(e, t);
7070
7070
  break;
7071
7071
  case "triangle":
7072
- ke(e, t);
7072
+ Se(e, t);
7073
7073
  break;
7074
7074
  case "star":
7075
- Se(e, t);
7075
+ Fe(e, t);
7076
7076
  break;
7077
7077
  case "arrow":
7078
- Fe(e, t);
7078
+ Ce(e, t);
7079
7079
  break;
7080
7080
  case "diamond":
7081
- Ce(e, t);
7081
+ Te(e, t);
7082
7082
  break;
7083
7083
  case "hexagon":
7084
- Te(e, t);
7084
+ je(e, t);
7085
7085
  break;
7086
7086
  case "pentagon":
7087
- je(e, t);
7087
+ Ne(e, t);
7088
7088
  break;
7089
7089
  case "heart":
7090
- Ne(e, t);
7090
+ Ie(e, t);
7091
7091
  break;
7092
7092
  case "oval":
7093
- Ie(e, t);
7093
+ Ae(e, t);
7094
7094
  break;
7095
7095
  case "roundedRectangle":
7096
- Ae(e, t);
7096
+ Re(e, t);
7097
7097
  break;
7098
7098
  case "image":
7099
7099
  Ee(e, t);
7100
7100
  break;
7101
7101
  case "qrcode":
7102
- pe(e, t);
7102
+ we(e, t);
7103
7103
  break;
7104
7104
  case "barcode":
7105
- me(e, t);
7105
+ pe(e, t);
7106
7106
  break;
7107
7107
  case "sticker":
7108
- Be(e, t);
7108
+ ze(e, t);
7109
7109
  break;
7110
7110
  case "horizontalLine":
7111
- Re(e, t);
7111
+ De(e, t);
7112
7112
  break;
7113
7113
  case "embroidery":
7114
- ze(e, t);
7114
+ Be(e, t);
7115
7115
  break;
7116
7116
  }
7117
7117
  e.restore();
7118
- }, me = (e, t) => {
7118
+ }, pe = (e, t) => {
7119
7119
  if (t.imageObject)
7120
7120
  e.drawImage(t.imageObject, 0, 0, t.width, t.height);
7121
7121
  else if (t.src && !t.imageLoading) {
7122
7122
  t.imageLoading = !0;
7123
7123
  const r = new Image();
7124
7124
  r.onload = () => {
7125
- u(
7125
+ y(
7126
7126
  (n) => n.map(
7127
- (f) => f.id === t.id ? { ...f, imageObject: r, imageLoading: !1 } : f
7127
+ (h) => h.id === t.id ? { ...h, imageObject: r, imageLoading: !1 } : h
7128
7128
  )
7129
7129
  );
7130
7130
  }, r.onerror = () => {
7131
- u(
7131
+ y(
7132
7132
  (n) => n.map(
7133
- (f) => f.id === t.id ? { ...f, imageLoading: !1 } : f
7133
+ (h) => h.id === t.id ? { ...h, imageLoading: !1 } : h
7134
7134
  )
7135
7135
  );
7136
- }, r.src = t.src, e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading...", t.width / 2, t.height / 2);
7137
- } else t.imageLoading ? (e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading...", t.width / 2, t.height / 2)) : (e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("No Barcode", t.width / 2, t.height / 2));
7138
- }, pe = (e, t) => {
7136
+ }, r.src = t.src, e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Your customization", t.width / 2, t.height / 2);
7137
+ } else t.imageLoading ? (e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Your customization", t.width / 2, t.height / 2)) : (e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("No Barcode", t.width / 2, t.height / 2));
7138
+ }, we = (e, t) => {
7139
7139
  if (t.imageObject)
7140
7140
  e.drawImage(t.imageObject, 0, 0, t.width, t.height);
7141
7141
  else if (t.src && !t.imageLoading) {
7142
7142
  t.imageLoading = !0;
7143
7143
  const r = new Image();
7144
7144
  r.onload = () => {
7145
- u(
7145
+ y(
7146
7146
  (n) => n.map(
7147
- (f) => f.id === t.id ? { ...f, imageObject: r, imageLoading: !1 } : f
7147
+ (h) => h.id === t.id ? { ...h, imageObject: r, imageLoading: !1 } : h
7148
7148
  )
7149
7149
  );
7150
7150
  }, r.onerror = () => {
7151
- u(
7151
+ y(
7152
7152
  (n) => n.map(
7153
- (f) => f.id === t.id ? { ...f, imageLoading: !1 } : f
7153
+ (h) => h.id === t.id ? { ...h, imageLoading: !1 } : h
7154
7154
  )
7155
7155
  );
7156
7156
  }, r.src = t.src, e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading QR...", t.width / 2, t.height / 2);
7157
7157
  } else t.imageLoading ? (e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading QR...", t.width / 2, t.height / 2)) : (e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("No QR Data", t.width / 2, t.height / 2));
7158
- }, we = (e, t) => {
7158
+ }, be = (e, t) => {
7159
7159
  e.save();
7160
7160
  let r = t.text || "Text";
7161
7161
  if (t.textTransform)
@@ -7172,19 +7172,19 @@ const yi = Ye((d, o) => {
7172
7172
  }
7173
7173
  e.font = `${t.fontStyle || "normal"} ${t.fontWeight || "normal"} ${t.fontSize || 20}px ${t.fontFamily || "Arial"}`, e.fillStyle = t.fill || "#000000", e.textAlign = t.textAlign || "left", e.textBaseline = "top", t.opacity !== void 0 && (e.globalAlpha = t.opacity), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth);
7174
7174
  const n = r.split(`
7175
- `), f = (t.fontSize || 20) * (t.lineHeight || 1.2), g = Math.max(...n.map((k) => e.measureText(k).width)), b = n.length * f;
7175
+ `), h = (t.fontSize || 20) * (t.lineHeight || 1.2), m = Math.max(...n.map((k) => e.measureText(k).width)), b = n.length * h;
7176
7176
  if (t.backgroundColor && t.backgroundColor !== "transparent") {
7177
7177
  e.fillStyle = t.backgroundColor;
7178
7178
  const k = t.backgroundPadding || 4;
7179
7179
  e.fillRect(
7180
7180
  -k,
7181
7181
  -k,
7182
- g + k * 2,
7182
+ m + k * 2,
7183
7183
  b + k * 2
7184
7184
  ), e.fillStyle = t.fill || "#000000";
7185
7185
  }
7186
7186
  n.forEach((k, v) => {
7187
- const R = v * f, D = e.measureText(k).width;
7187
+ const R = v * h, D = e.measureText(k).width;
7188
7188
  t.stroke && t.strokeWidth > 0 && e.strokeText(k, 0, R), e.fillText(k, 0, R);
7189
7189
  const L = t.fontSize || 20, tt = t.decorationColor || t.fill || "#000000", xt = Math.max(1, L / 20);
7190
7190
  if (e.strokeStyle = tt, e.lineWidth = xt, t.textDecoration === "underline" || t.underline) {
@@ -7202,145 +7202,160 @@ const yi = Ye((d, o) => {
7202
7202
  typeof t.textDecoration == "string" && t.textDecoration.includes(" ") && t.textDecoration.split(" ").forEach((Ge) => {
7203
7203
  switch (Ge.trim()) {
7204
7204
  case "underline":
7205
- const ee = R + L + 2;
7206
- e.beginPath(), e.moveTo(0, ee), e.lineTo(D, ee), e.stroke();
7205
+ const ie = R + L + 2;
7206
+ e.beginPath(), e.moveTo(0, ie), e.lineTo(D, ie), e.stroke();
7207
7207
  break;
7208
7208
  case "overline":
7209
- const ie = R - 2;
7210
- e.beginPath(), e.moveTo(0, ie), e.lineTo(D, ie), e.stroke();
7209
+ const oe = R - 2;
7210
+ e.beginPath(), e.moveTo(0, oe), e.lineTo(D, oe), e.stroke();
7211
7211
  break;
7212
7212
  case "line-through":
7213
- const oe = R + L / 2;
7214
- e.beginPath(), e.moveTo(0, oe), e.lineTo(D, oe), e.stroke();
7213
+ const re = R + L / 2;
7214
+ e.beginPath(), e.moveTo(0, re), e.lineTo(D, re), e.stroke();
7215
7215
  break;
7216
7216
  }
7217
7217
  });
7218
7218
  }), e.restore();
7219
- }, be = (e, t) => {
7220
- t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fillRect(0, 0, t.width, t.height)), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.strokeRect(0, 0, t.width, t.height));
7221
7219
  }, ve = (e, t) => {
7222
- const r = Math.min(t.width, t.height) / 2, n = t.width / 2, f = t.height / 2;
7223
- e.beginPath(), e.arc(n, f, r, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7220
+ t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fillRect(0, 0, t.width, t.height)), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.strokeRect(0, 0, t.width, t.height));
7224
7221
  }, ke = (e, t) => {
7222
+ const r = Math.min(t.width, t.height) / 2, n = t.width / 2, h = t.height / 2;
7223
+ e.beginPath(), e.arc(n, h, r, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7224
+ }, Se = (e, t) => {
7225
7225
  const r = t.width / 2;
7226
7226
  t.height / 2, e.beginPath(), e.moveTo(r, 0), e.lineTo(0, t.height), e.lineTo(t.width, t.height), e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7227
- }, Se = (e, t) => {
7228
- const r = t.width / 2, n = t.height / 2, f = Math.min(t.width, t.height) / 2, g = f * 0.4, b = t.numPoints || 5;
7227
+ }, Fe = (e, t) => {
7228
+ const r = t.width / 2, n = t.height / 2, h = Math.min(t.width, t.height) / 2, m = h * 0.4, b = t.numPoints || 5;
7229
7229
  e.beginPath();
7230
7230
  for (let k = 0; k < b * 2; k++) {
7231
- const v = k % 2 === 0 ? f : g, R = k * Math.PI / b, D = r + Math.cos(R) * v, L = n + Math.sin(R) * v;
7231
+ const v = k % 2 === 0 ? h : m, R = k * Math.PI / b, D = r + Math.cos(R) * v, L = n + Math.sin(R) * v;
7232
7232
  k === 0 ? e.moveTo(D, L) : e.lineTo(D, L);
7233
7233
  }
7234
7234
  e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7235
- }, Fe = (e, t) => {
7236
- const r = t.width, n = t.height, f = r * 0.3;
7237
- e.beginPath(), e.moveTo(r / 2, 0), e.lineTo(r, n * 0.6), e.lineTo(r - f, n * 0.6), e.lineTo(r - f, n), e.lineTo(f, n), e.lineTo(f, n * 0.6), e.lineTo(0, n * 0.6), e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7238
7235
  }, Ce = (e, t) => {
7236
+ const r = t.width, n = t.height, h = r * 0.3;
7237
+ e.beginPath(), e.moveTo(r / 2, 0), e.lineTo(r, n * 0.6), e.lineTo(r - h, n * 0.6), e.lineTo(r - h, n), e.lineTo(h, n), e.lineTo(h, n * 0.6), e.lineTo(0, n * 0.6), e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7238
+ }, Te = (e, t) => {
7239
7239
  const r = t.width / 2, n = t.height / 2;
7240
7240
  e.beginPath(), e.moveTo(r, 0), e.lineTo(t.width, n), e.lineTo(r, t.height), e.lineTo(0, n), e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7241
- }, Te = (e, t) => {
7242
- const r = t.width / 2, n = t.height / 2, f = Math.min(t.width, t.height) / 2, g = 6;
7241
+ }, je = (e, t) => {
7242
+ const r = t.width / 2, n = t.height / 2, h = Math.min(t.width, t.height) / 2, m = 6;
7243
7243
  e.beginPath();
7244
- for (let b = 0; b < g; b++) {
7245
- const k = b * 2 * Math.PI / g - Math.PI / 2, v = r + f * Math.cos(k), R = n + f * Math.sin(k);
7244
+ for (let b = 0; b < m; b++) {
7245
+ const k = b * 2 * Math.PI / m - Math.PI / 2, v = r + h * Math.cos(k), R = n + h * Math.sin(k);
7246
7246
  b === 0 ? e.moveTo(v, R) : e.lineTo(v, R);
7247
7247
  }
7248
7248
  e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7249
- }, je = (e, t) => {
7250
- const r = t.width / 2, n = t.height / 2, f = Math.min(t.width, t.height) / 2, g = 5;
7249
+ }, Ne = (e, t) => {
7250
+ const r = t.width / 2, n = t.height / 2, h = Math.min(t.width, t.height) / 2, m = 5;
7251
7251
  e.beginPath();
7252
- for (let b = 0; b < g; b++) {
7253
- const k = b * 2 * Math.PI / g - Math.PI / 2, v = r + f * Math.cos(k), R = n + f * Math.sin(k);
7252
+ for (let b = 0; b < m; b++) {
7253
+ const k = b * 2 * Math.PI / m - Math.PI / 2, v = r + h * Math.cos(k), R = n + h * Math.sin(k);
7254
7254
  b === 0 ? e.moveTo(v, R) : e.lineTo(v, R);
7255
7255
  }
7256
7256
  e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7257
- }, Ne = (e, t) => {
7258
- const r = t.width, n = t.height, f = 0, g = 0;
7257
+ }, Ie = (e, t) => {
7258
+ const r = t.width, n = t.height, h = 0, m = 0;
7259
7259
  e.beginPath();
7260
7260
  const b = n * 0.3;
7261
- e.moveTo(f + r / 2, g + b), e.bezierCurveTo(
7262
- f + r / 2,
7263
- g,
7264
- f,
7265
- g,
7266
- f,
7267
- g + b
7261
+ e.moveTo(h + r / 2, m + b), e.bezierCurveTo(
7262
+ h + r / 2,
7263
+ m,
7264
+ h,
7265
+ m,
7266
+ h,
7267
+ m + b
7268
7268
  ), e.bezierCurveTo(
7269
- f,
7270
- g + (n + b) / 2,
7271
- f + r / 2,
7272
- g + (n + b) / 2,
7273
- f + r / 2,
7274
- g + n
7269
+ h,
7270
+ m + (n + b) / 2,
7271
+ h + r / 2,
7272
+ m + (n + b) / 2,
7273
+ h + r / 2,
7274
+ m + n
7275
7275
  ), e.bezierCurveTo(
7276
- f + r / 2,
7277
- g + (n + b) / 2,
7278
- f + r,
7279
- g + (n + b) / 2,
7280
- f + r,
7281
- g + b
7276
+ h + r / 2,
7277
+ m + (n + b) / 2,
7278
+ h + r,
7279
+ m + (n + b) / 2,
7280
+ h + r,
7281
+ m + b
7282
7282
  ), e.bezierCurveTo(
7283
- f + r,
7284
- g,
7285
- f + r / 2,
7286
- g,
7287
- f + r / 2,
7288
- g + b
7283
+ h + r,
7284
+ m,
7285
+ h + r / 2,
7286
+ m,
7287
+ h + r / 2,
7288
+ m + b
7289
7289
  ), e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7290
- }, Ie = (e, t) => {
7291
- const r = t.width / 2, n = t.height / 2, f = t.width / 2, g = t.height / 2;
7292
- e.beginPath(), e.ellipse(r, n, f, g, 0, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7293
7290
  }, Ae = (e, t) => {
7291
+ const r = t.width / 2, n = t.height / 2, h = t.width / 2, m = t.height / 2;
7292
+ e.beginPath(), e.ellipse(r, n, h, m, 0, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7293
+ }, Re = (e, t) => {
7294
7294
  const r = Math.min(t.width, t.height) * 0.1;
7295
7295
  At(e, 0, 0, t.width, t.height, r), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7296
- }, Re = (e, t) => {
7296
+ }, De = (e, t) => {
7297
7297
  e.save(), t.opacity !== void 0 && (e.globalAlpha = t.opacity), e.strokeStyle = t.stroke || t.fill || "#000000", e.lineWidth = t.strokeWidth || t.height || 2, e.lineCap = "round", e.beginPath(), e.moveTo(0, t.height / 2), e.lineTo(t.width, t.height / 2), e.stroke(), e.restore();
7298
- }, De = nt(/* @__PURE__ */ new Map()), Ee = (e, t) => {
7299
- const n = (() => {
7300
- if (typeof t.src == "string" && t.src.length > 0) return t.src;
7301
- const f = t.imageData;
7302
- return f instanceof HTMLImageElement || typeof f == "string" && f.length > 0 ? f : f && typeof f == "object" && typeof f.src == "string" && f.src.length > 0 ? f.src : null;
7303
- })();
7304
- if (n instanceof HTMLImageElement) {
7305
- if (n.complete && n.naturalWidth > 0 && n.naturalHeight > 0) {
7306
- e.drawImage(n, 0, 0, t.width, t.height);
7307
- return;
7308
- }
7309
- e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "14px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading...", t.width / 2, t.height / 2);
7310
- return;
7311
- }
7312
- if (typeof n == "string" && n.length > 0) {
7313
- const f = De.current;
7314
- let g = f.get(t.id);
7315
- if (g || (g = { img: null, error: null, loading: !1, src: n }, f.set(t.id, g)), g.src !== n && (g.img = null, g.error = null, g.loading = !1, g.src = n), g.img && g.img.complete && g.img.naturalWidth > 0 && g.img.naturalHeight > 0) {
7316
- e.drawImage(g.img, 0, 0, t.width, t.height);
7317
- return;
7298
+ }, Ee = (e, t) => {
7299
+ const r = t.src || t.imageData;
7300
+ if (r)
7301
+ try {
7302
+ if (r instanceof HTMLImageElement) {
7303
+ if (r.complete && r.naturalWidth > 0 && r.naturalHeight > 0) {
7304
+ e.drawImage(r, 0, 0, t.width, t.height);
7305
+ return;
7306
+ }
7307
+ } else if (typeof r == "string" && r.length > 0) {
7308
+ if (t._imageElement || (t._imageElement = new Image(), t._imageElement.crossOrigin = "anonymous", t._imageElement.onload = () => {
7309
+ X();
7310
+ }, t._imageElement.onerror = () => {
7311
+ console.error("Failed to load image:", r), t._imageLoadError = !0, X();
7312
+ }, t._imageElement.src = r), t._imageElement.complete && t._imageElement.naturalWidth > 0 && t._imageElement.naturalHeight > 0) {
7313
+ e.drawImage(t._imageElement, 0, 0, t.width, t.height);
7314
+ return;
7315
+ }
7316
+ if (t._imageLoadError) {
7317
+ e.fillStyle = "#ffebee", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#f44336", e.lineWidth = 2, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#f44336", e.font = "14px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Error loading image", t.width / 2, t.height / 2);
7318
+ return;
7319
+ }
7320
+ }
7321
+ e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.lineWidth = 1, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "14px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Your customization", t.width / 2, t.height / 2);
7322
+ } catch (n) {
7323
+ console.error("Error drawing image:", n), e.fillStyle = "#ffebee", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#f44336", e.lineWidth = 2, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#f44336", e.font = "14px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Error loading image", t.width / 2, t.height / 2);
7318
7324
  }
7319
- if (!g.loading && !g.error) {
7320
- g.loading = !0;
7321
- const b = new Image();
7322
- n.startsWith("data:") || (b.crossOrigin = "anonymous"), b.onload = () => {
7323
- g.img = b, g.loading = !1, X();
7324
- }, b.onerror = () => {
7325
- g.error = !0, g.loading = !1, console.error("Failed to load image:", n), X();
7326
- }, b.src = n, typeof b.decode == "function" && b.decode().catch(() => {
7327
- });
7325
+ else
7326
+ e.fillStyle = "#f8f8f8", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ddd", e.lineWidth = 1, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#999", e.font = "14px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("No Image", t.width / 2, t.height / 2);
7327
+ }, ze = (e, t) => {
7328
+ const r = t.src;
7329
+ if (r)
7330
+ try {
7331
+ if (r instanceof HTMLImageElement) {
7332
+ if (r.complete && r.naturalWidth > 0 && r.naturalHeight > 0) {
7333
+ e.drawImage(r, 0, 0, t.width, t.height);
7334
+ return;
7335
+ }
7336
+ } else if (typeof r == "string" && r.length > 0) {
7337
+ if (t._stickerElement || (t._stickerElement = new Image(), t._stickerElement.crossOrigin = "anonymous", t._stickerElement.onload = () => {
7338
+ X();
7339
+ }, t._stickerElement.onerror = () => {
7340
+ console.error("Failed to load sticker:", r), t._stickerLoadError = !0, X();
7341
+ }, t._stickerElement.src = r), t._stickerElement.complete && t._stickerElement.naturalWidth > 0 && t._stickerElement.naturalHeight > 0) {
7342
+ e.drawImage(t._stickerElement, 0, 0, t.width, t.height);
7343
+ return;
7344
+ }
7345
+ if (t._stickerLoadError) {
7346
+ Rt(e, t, "Failed to load", !0);
7347
+ return;
7348
+ }
7349
+ }
7350
+ Rt(e, t, "Your customization");
7351
+ } catch (n) {
7352
+ console.error("Error drawing sticker:", n), Rt(e, t, "Error", !0);
7328
7353
  }
7329
- g.error ? (e.fillStyle = "#ffebee", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#f44336", e.lineWidth = 2, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#f44336", e.font = "14px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Error loading image", t.width / 2, t.height / 2)) : (e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.lineWidth = 1, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "14px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading...", t.width / 2, t.height / 2));
7330
- return;
7331
- }
7332
- e.fillStyle = "#f8f8f8", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ddd", e.lineWidth = 1, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#999", e.font = "14px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("No Image", t.width / 2, t.height / 2);
7354
+ else
7355
+ Rt(e, t, "No Sticker");
7356
+ }, Rt = (e, t, r, n = !1) => {
7357
+ e.fillStyle = n ? "#ffebee" : "#f8f9fa", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = n ? "#f44336" : "#dee2e6", e.lineWidth = 2, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = n ? "#f44336" : "#6c757d", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText(r, t.width / 2, t.height / 2);
7333
7358
  }, Be = (e, t) => {
7334
- if (t.src && !t.imageLoading && !t.loadedImage) {
7335
- t.imageLoading = !0;
7336
- const r = new Image();
7337
- r.crossOrigin = "anonymous", r.onload = () => {
7338
- t.loadedImage = r, t.imageLoading = !1, X();
7339
- }, r.onerror = () => {
7340
- console.error("Failed to load sticker:", t.src), t.imageLoading = !1, e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.fillText("Failed to load", t.width / 2, t.height / 2);
7341
- }, r.src = t.src;
7342
- } else t.loadedImage ? e.drawImage(t.loadedImage, 0, 0, t.width, t.height) : t.imageLoading && (e.fillStyle = "#f8f9fa", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#dee2e6", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#6c757d", e.font = "12px Arial", e.textAlign = "center", e.fillText("Loading...", t.width / 2, t.height / 2));
7343
- }, ze = (e, t) => {
7344
7359
  if (t.imageObject && t.imageObject.complete && t.imageObject.naturalHeight !== 0)
7345
7360
  try {
7346
7361
  e.drawImage(t.imageObject, 0, 0, t.width, t.height);
@@ -7354,16 +7369,16 @@ const yi = Ye((d, o) => {
7354
7369
  r.complete && r.naturalHeight !== 0 ? (t.imageObject = r, t.imageLoading = !1, X()) : (t.imageLoading = !1, console.error("Image loaded but is invalid:", t.src));
7355
7370
  }, r.onerror = () => {
7356
7371
  t.imageLoading = !1, console.error("Failed to load embroidery image:", t.src), Ct(e, t, "Failed to load");
7357
- }, r.src = t.src, Ct(e, t, "Loading...");
7358
- } else t.imageLoading ? Ct(e, t, "Loading...") : Ct(e, t);
7372
+ }, r.src = t.src, Ct(e, t, "Your customization");
7373
+ } else t.imageLoading ? Ct(e, t, "Your customization") : Ct(e, t);
7359
7374
  }, Ct = (e, t, r = "Embroidery") => {
7360
7375
  e.fillStyle = "#f9f9f9", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ddd", e.lineWidth = 2, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#999", e.font = "24px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("🧵", t.width / 2, t.height / 2 - 10), e.fillStyle = "#666", e.font = "12px Arial", e.fillText(r, t.width / 2, t.height / 2 + 15);
7361
- }, Gt = (e, t, r) => {
7376
+ }, _t = (e, t, r) => {
7362
7377
  if (!r) return !1;
7363
- const n = r.x + r.width / 2, f = r.y + r.height / 2, g = e - n, b = t - f, k = -(r.rotation || 0) * Math.PI / 180, v = Math.cos(k), R = Math.sin(k), D = g * v - b * R, L = g * R + b * v, tt = r.width / 2, xt = r.height / 2;
7378
+ const n = r.x + r.width / 2, h = r.y + r.height / 2, m = e - n, b = t - h, k = -(r.rotation || 0) * Math.PI / 180, v = Math.cos(k), R = Math.sin(k), D = m * v - b * R, L = m * R + b * v, tt = r.width / 2, xt = r.height / 2;
7364
7379
  return D >= -tt && D <= tt && L >= -xt && L <= xt;
7365
7380
  }, We = ot(() => {
7366
- (C || I || w) && lt(), p(!1), T(!1), z(!1), B(null);
7381
+ (C || I || w) && lt(), p(!1), T(!1), B(!1), z(null);
7367
7382
  const e = gt.current;
7368
7383
  e && (e.style.cursor = "default");
7369
7384
  }, [C, I, w, lt]);
@@ -7371,32 +7386,32 @@ const yi = Ye((d, o) => {
7371
7386
  const e = (t) => {
7372
7387
  if (l) return;
7373
7388
  const r = document.activeElement;
7374
- if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable)) && ((t.ctrlKey || t.metaKey) && (t.key === "z" && !t.shiftKey ? (t.preventDefault(), Ft()) : (t.key === "z" && t.shiftKey || t.key === "y") && (t.preventDefault(), bt())), (t.key === "Delete" || t.key === "Backspace") && x && (Wt(x.id), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "d" && x && (Yt(x.id), t.preventDefault()), x && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t.key))) {
7389
+ if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable)) && ((t.ctrlKey || t.metaKey) && (t.key === "z" && !t.shiftKey ? (t.preventDefault(), Ft()) : (t.key === "z" && t.shiftKey || t.key === "y") && (t.preventDefault(), bt())), (t.key === "Delete" || t.key === "Backspace") && g && (Mt(g.id), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "d" && g && (qt(g.id), t.preventDefault()), g && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t.key))) {
7375
7390
  t.preventDefault();
7376
- const f = t.shiftKey ? 10 : 1;
7377
- let g = {};
7391
+ const h = t.shiftKey ? 10 : 1;
7392
+ let m = {};
7378
7393
  switch (t.key) {
7379
7394
  case "ArrowUp":
7380
- g.y = x.y - f;
7395
+ m.y = g.y - h;
7381
7396
  break;
7382
7397
  case "ArrowDown":
7383
- g.y = x.y + f;
7398
+ m.y = g.y + h;
7384
7399
  break;
7385
7400
  case "ArrowLeft":
7386
- g.x = x.x - f;
7401
+ m.x = g.x - h;
7387
7402
  break;
7388
7403
  case "ArrowRight":
7389
- g.x = x.x + f;
7404
+ m.x = g.x + h;
7390
7405
  break;
7391
7406
  }
7392
- _t(x.id, g), lt();
7407
+ Yt(g.id, m), lt();
7393
7408
  }
7394
7409
  };
7395
7410
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
7396
- }, [x, Ft, bt, l]);
7411
+ }, [g, Ft, bt, l]);
7397
7412
  const Me = (e, t = {}) => {
7398
7413
  const r = {
7399
- id: dt(),
7414
+ id: ct(),
7400
7415
  type: e,
7401
7416
  x: 50,
7402
7417
  y: 50,
@@ -7410,28 +7425,28 @@ const yi = Ye((d, o) => {
7410
7425
  };
7411
7426
  switch (e) {
7412
7427
  case "text":
7413
- r.id = dt(), r.text = t.text || "New Text", r.fontSize = t.fontSize || 20, r.fontFamily = t.fontFamily || "Arial", r.fontWeight = t.fontWeight || "normal", r.fontStyle = t.fontStyle || "normal", r.textAlign = t.textAlign || "left", r.width = 150, r.height = 50;
7428
+ r.id = ct(), r.text = t.text || "New Text", r.fontSize = t.fontSize || 20, r.fontFamily = t.fontFamily || "Arial", r.fontWeight = t.fontWeight || "normal", r.fontStyle = t.fontStyle || "normal", r.textAlign = t.textAlign || "left", r.width = 150, r.height = 50;
7414
7429
  break;
7415
7430
  case "icon":
7416
- r.id = dt(), r.text = t.text || "🎯", r.fontSize = t.fontSize || 48, r.fontFamily = t.fontFamily || "Arial", r.fontWeight = t.fontWeight || "normal", r.fontStyle = t.fontStyle || "normal", r.textAlign = "center", r.width = 80, r.height = 80, r.iconData = t.iconData || null, r.type = "text", r.isIcon = !0;
7431
+ r.id = ct(), r.text = t.text || "🎯", r.fontSize = t.fontSize || 48, r.fontFamily = t.fontFamily || "Arial", r.fontWeight = t.fontWeight || "normal", r.fontStyle = t.fontStyle || "normal", r.textAlign = "center", r.width = 80, r.height = 80, r.iconData = t.iconData || null, r.type = "text", r.isIcon = !0;
7417
7432
  break;
7418
7433
  case "image":
7419
- r.id = dt(), r.imageData = t.imageData || null, r.width = t.width || 200, r.height = t.height || 200;
7434
+ r.id = ct(), r.imageData = t.imageData || null, r.width = t.width || 200, r.height = t.height || 200;
7420
7435
  break;
7421
7436
  case "qrcode":
7422
- r.id = dt(), r.type = "qrcode", r.x = (t == null ? void 0 : t.x) || W / 2 - ((t == null ? void 0 : t.width) || 100) / 2, r.y = (t == null ? void 0 : t.y) || U / 2 - ((t == null ? void 0 : t.height) || 100) / 2, r.width = (t == null ? void 0 : t.width) || 100, r.height = (t == null ? void 0 : t.height) || 100, r.src = (t == null ? void 0 : t.src) || "", r.data = (t == null ? void 0 : t.data) || "", r.rotation = 0, r.opacity = 1;
7437
+ r.id = ct(), r.type = "qrcode", r.x = (t == null ? void 0 : t.x) || W / 2 - ((t == null ? void 0 : t.width) || 100) / 2, r.y = (t == null ? void 0 : t.y) || U / 2 - ((t == null ? void 0 : t.height) || 100) / 2, r.width = (t == null ? void 0 : t.width) || 100, r.height = (t == null ? void 0 : t.height) || 100, r.src = (t == null ? void 0 : t.src) || "", r.data = (t == null ? void 0 : t.data) || "", r.rotation = 0, r.opacity = 1;
7423
7438
  break;
7424
7439
  case "barcode":
7425
- r.id = dt(), r.type = "barcode", r.x = (t == null ? void 0 : t.x) || W / 2 - ((t == null ? void 0 : t.width) || 200) / 2, r.y = (t == null ? void 0 : t.y) || U / 2 - ((t == null ? void 0 : t.height) || 100) / 2, r.width = (t == null ? void 0 : t.width) || 200, r.height = (t == null ? void 0 : t.height) || 100, r.src = (t == null ? void 0 : t.src) || "", r.data = (t == null ? void 0 : t.data) || "", r.format = (t == null ? void 0 : t.format) || "CODE128", r.rotation = 0, r.opacity = 1, r.imageObject = (t == null ? void 0 : t.imageObject) || null;
7440
+ r.id = ct(), r.type = "barcode", r.x = (t == null ? void 0 : t.x) || W / 2 - ((t == null ? void 0 : t.width) || 200) / 2, r.y = (t == null ? void 0 : t.y) || U / 2 - ((t == null ? void 0 : t.height) || 100) / 2, r.width = (t == null ? void 0 : t.width) || 200, r.height = (t == null ? void 0 : t.height) || 100, r.src = (t == null ? void 0 : t.src) || "", r.data = (t == null ? void 0 : t.data) || "", r.format = (t == null ? void 0 : t.format) || "CODE128", r.rotation = 0, r.opacity = 1, r.imageObject = (t == null ? void 0 : t.imageObject) || null;
7426
7441
  break;
7427
7442
  case "sticker":
7428
- r.id = dt(), r.type = "sticker", r.imageData = (t == null ? void 0 : t.imageData) || null, r.width = t.width || 200, r.height = t.height || 200;
7443
+ r.id = ct(), r.type = "sticker", r.imageData = (t == null ? void 0 : t.imageData) || null, r.width = t.width || 200, r.height = t.height || 200;
7429
7444
  break;
7430
7445
  case "horizontalLine":
7431
- r.id = dt(), r.type = "horizontalLine", r.x = W / 2 - 100, r.y = U / 2 - 1, r.width = 200, r.height = 2, r.fill = "#000000", r.stroke = "#000000", r.strokeWidth = 2, r.rotation = 0, r.opacity = 1;
7446
+ r.id = ct(), r.type = "horizontalLine", r.x = W / 2 - 100, r.y = U / 2 - 1, r.width = 200, r.height = 2, r.fill = "#000000", r.stroke = "#000000", r.strokeWidth = 2, r.rotation = 0, r.opacity = 1;
7432
7447
  break;
7433
7448
  case "embroidery":
7434
- r.id = dt(), r.type = "embroidery", r.imageData = (t == null ? void 0 : t.imageData) || null, r.width = t.width || 200, r.height = t.height || 200;
7449
+ r.id = ct(), r.type = "embroidery", r.imageData = (t == null ? void 0 : t.imageData) || null, r.width = t.width || 200, r.height = t.height || 200;
7435
7450
  break;
7436
7451
  case "rectangle":
7437
7452
  case "circle":
@@ -7449,29 +7464,29 @@ const yi = Ye((d, o) => {
7449
7464
  console.warn(`Unknown element type: ${e}`);
7450
7465
  return;
7451
7466
  }
7452
- u((n) => [...n, r]), F(r), lt();
7453
- }, _t = (e, t) => {
7454
- u((r) => r.map(
7467
+ y((n) => [...n, r]), F(r), lt();
7468
+ }, Yt = (e, t) => {
7469
+ y((r) => r.map(
7455
7470
  (n) => n.id === e ? { ...n, ...t } : n
7456
- )), x && x.id === e && F((r) => ({ ...r, ...t }));
7457
- }, Wt = ot(() => {
7458
- x && (u((e) => e.filter((t) => t.id !== x.id)), F(null), lt());
7459
- }, [x, lt]), Yt = (e) => {
7471
+ )), g && g.id === e && F((r) => ({ ...r, ...t }));
7472
+ }, Mt = ot(() => {
7473
+ g && (y((e) => e.filter((t) => t.id !== g.id)), F(null), lt());
7474
+ }, [g, lt]), qt = (e) => {
7460
7475
  const t = c.find((r) => r.id === e);
7461
7476
  if (t) {
7462
7477
  const r = {
7463
7478
  ...t,
7464
- id: dt(),
7479
+ id: ct(),
7465
7480
  x: t.x + 20,
7466
7481
  y: t.y + 20
7467
7482
  };
7468
- u((n) => [...n, r]), F(r), lt();
7483
+ y((n) => [...n, r]), F(r), lt();
7469
7484
  }
7470
- }, qt = (e, t) => {
7471
- const r = c.findIndex((g) => g.id === e);
7485
+ }, Vt = (e, t) => {
7486
+ const r = c.findIndex((m) => m.id === e);
7472
7487
  if (r === -1) return;
7473
- const n = [...c], f = n[r];
7474
- t === "up" && r < n.length - 1 ? (n[r] = n[r + 1], n[r + 1] = f) : t === "down" && r > 0 ? (n[r] = n[r - 1], n[r - 1] = f) : t === "top" ? (n.splice(r, 1), n.push(f)) : t === "bottom" && (n.splice(r, 1), n.unshift(f)), u(n), lt();
7488
+ const n = [...c], h = n[r];
7489
+ t === "up" && r < n.length - 1 ? (n[r] = n[r + 1], n[r + 1] = h) : t === "down" && r > 0 ? (n[r] = n[r - 1], n[r - 1] = h) : t === "top" ? (n.splice(r, 1), n.push(h)) : t === "bottom" && (n.splice(r, 1), n.unshift(h)), y(n), lt();
7475
7490
  };
7476
7491
  ot(() => {
7477
7492
  j && Z((e) => ({
@@ -7496,13 +7511,13 @@ const yi = Ye((d, o) => {
7496
7511
  }));
7497
7512
  }, [j, c, Y]);
7498
7513
  Ve(o, () => ({
7499
- handleSectionChange: Vt,
7514
+ handleSectionChange: Xt,
7500
7515
  flushCurrentSectionDesign: Pe,
7501
7516
  // Export methods that return download-ready data
7502
- exportPrintReady: async (e = "png") => await zt(e, !1),
7503
- exportFullDesign: async (e = "png") => await zt(e, !0),
7517
+ exportPrintReady: async (e = "png") => await Wt(e, !1),
7518
+ exportFullDesign: async (e = "png") => await Wt(e, !0),
7504
7519
  // Access to the existing exportDesign method
7505
- exportDesign: zt,
7520
+ exportDesign: Wt,
7506
7521
  // Get canvas data for custom exports
7507
7522
  getCanvasData: () => St(),
7508
7523
  // NEW: Export methods that return JSON with File objects
@@ -7513,18 +7528,18 @@ const yi = Ye((d, o) => {
7513
7528
  selectedColor: t.selectedColor,
7514
7529
  canvasWidth: t.canvasWidth,
7515
7530
  canvasHeight: t.canvasHeight
7516
- }, f = {
7531
+ }, h = {
7517
7532
  ...t.sectionDesigns || {},
7518
7533
  [r]: n
7519
- }, g = s.sections && s.sections.length > 0 ? s.sections : [{
7534
+ }, m = s.sections && s.sections.length > 0 ? s.sections : [{
7520
7535
  id: r,
7521
7536
  sectionName: r,
7522
7537
  image: j == null ? void 0 : j.sectionImage,
7523
7538
  sectionImage: j == null ? void 0 : j.sectionImage
7524
7539
  }];
7525
- return await Et.current.exportAllSectionsAsJSON(
7526
- f,
7527
- g,
7540
+ return await zt.current.exportAllSectionsAsJSON(
7541
+ h,
7542
+ m,
7528
7543
  W,
7529
7544
  U,
7530
7545
  e,
@@ -7537,146 +7552,146 @@ const yi = Ye((d, o) => {
7537
7552
  exportCurrentSectionAsJSON: async (e = "png") => {
7538
7553
  try {
7539
7554
  const t = St();
7540
- return await Et.current.exportCurrentSectionAsJSON(t, e, yt);
7555
+ return await zt.current.exportCurrentSectionAsJSON(t, e, yt);
7541
7556
  } catch (t) {
7542
7557
  throw console.error("Export current section as JSON failed:", t), t;
7543
7558
  }
7544
7559
  }
7545
7560
  }));
7546
- const ut = nt(null), Mt = nt(!1), X = ot(() => {
7561
+ const ut = dt(null), Lt = dt(!1), X = ot(() => {
7547
7562
  const e = gt.current;
7548
- if (!e || Mt.current) return;
7549
- Mt.current = !0;
7563
+ if (!e || Lt.current) return;
7564
+ Lt.current = !0;
7550
7565
  const t = e.getContext("2d");
7551
- t.clearRect(0, 0, W, U), wt.current && t.drawImage(wt.current, 0, 0, W, U), J && ye(t), c.forEach((r) => {
7552
- t.save(), t.globalAlpha = r.opacity || 1, ue(t, r), t.restore();
7553
- }), x && he(t, x), Mt.current = !1;
7554
- }, [c, x, W, U, J]), vt = ot(() => {
7566
+ t.clearRect(0, 0, W, U), wt.current && t.drawImage(wt.current, 0, 0, W, U), J && ue(t), c.forEach((r) => {
7567
+ t.save(), t.globalAlpha = r.opacity || 1, me(t, r), t.restore();
7568
+ }), g && ge(t, g), Lt.current = !1;
7569
+ }, [c, g, W, U, J]), vt = ot(() => {
7555
7570
  ut.current && cancelAnimationFrame(ut.current), ut.current = requestAnimationFrame(() => {
7556
7571
  X(), ut.current = null;
7557
7572
  });
7558
7573
  }, [X]);
7559
7574
  et(() => {
7560
7575
  vt();
7561
- }, [c, x, W, U, J, vt]), et(() => {
7576
+ }, [c, g, W, U, J, vt]), et(() => {
7562
7577
  wt.current && vt();
7563
7578
  }, [wt.current, vt]), et(() => () => {
7564
7579
  ut.current && cancelAnimationFrame(ut.current);
7565
7580
  }, []);
7566
- const Lt = ot(() => {
7567
- X(), (C || I || w) && (ut.current = requestAnimationFrame(Lt));
7581
+ const Pt = ot(() => {
7582
+ X(), (C || I || w) && (ut.current = requestAnimationFrame(Pt));
7568
7583
  }, [X, C, I, w]);
7569
7584
  et(() => {
7570
- C || I || w ? Lt() : (ut.current && (cancelAnimationFrame(ut.current), ut.current = null), vt());
7571
- }, [C, I, w, Lt, vt]);
7585
+ C || I || w ? Pt() : (ut.current && (cancelAnimationFrame(ut.current), ut.current = null), vt());
7586
+ }, [C, I, w, Pt, vt]);
7572
7587
  const Ue = ot((e) => {
7573
7588
  if (l) return;
7574
- const r = gt.current.getBoundingClientRect(), n = (e.clientX - r.left) / q, f = (e.clientY - r.top) / q;
7575
- if (S({ x: n, y: f }), x) {
7576
- const b = Ht(n, f, x);
7589
+ const r = gt.current.getBoundingClientRect(), n = (e.clientX - r.left) / q, h = (e.clientY - r.top) / q;
7590
+ if (S({ x: n, y: h }), g) {
7591
+ const b = Gt(n, h, g);
7577
7592
  if (b) {
7578
7593
  if (b === "rotate") {
7579
- z(!0);
7580
- const k = x.x + x.width / 2, v = x.y + x.height / 2, R = Math.atan2(f - v, n - k) * 180 / Math.PI;
7594
+ B(!0);
7595
+ const k = g.x + g.width / 2, v = g.y + g.height / 2, R = Math.atan2(h - v, n - k) * 180 / Math.PI;
7581
7596
  S({
7582
7597
  x: n,
7583
- y: f,
7598
+ y: h,
7584
7599
  initialAngle: R,
7585
- initialRotation: x.rotation || 0
7600
+ initialRotation: g.rotation || 0
7586
7601
  });
7587
7602
  } else
7588
- T(!0), B(b), S({
7603
+ T(!0), z(b), S({
7589
7604
  x: n,
7590
- y: f,
7591
- initialWidth: x.width,
7592
- initialHeight: x.height,
7593
- initialX: x.x,
7594
- initialY: x.y
7605
+ y: h,
7606
+ initialWidth: g.width,
7607
+ initialHeight: g.height,
7608
+ initialX: g.x,
7609
+ initialY: g.y
7595
7610
  });
7596
7611
  return;
7597
7612
  }
7598
7613
  }
7599
- let g = null;
7614
+ let m = null;
7600
7615
  for (let b = c.length - 1; b >= 0; b--)
7601
- if (Gt(n, f, c[b])) {
7602
- g = c[b];
7616
+ if (_t(n, h, c[b])) {
7617
+ m = c[b];
7603
7618
  break;
7604
7619
  }
7605
- g ? (F(g), p(!0), S({
7620
+ m ? (F(m), p(!0), S({
7606
7621
  x: n,
7607
- y: f,
7608
- offsetX: n - g.x,
7609
- offsetY: f - g.y
7622
+ y: h,
7623
+ offsetX: n - m.x,
7624
+ offsetY: h - m.y
7610
7625
  })) : F(null), X();
7611
- }, [l, q, x, c, X]), Oe = ot((e) => {
7626
+ }, [l, q, g, c, X]), Oe = ot((e) => {
7612
7627
  if (l) return;
7613
- const t = gt.current, r = t.getBoundingClientRect(), n = (e.clientX - r.left) / q, f = (e.clientY - r.top) / q;
7614
- if (x && !C && !I && !w) {
7615
- const g = Ht(n, f, x);
7616
- g ? g === "rotate" ? t.style.cursor = "grab" : t.style.cursor = g : Gt(n, f, x) ? t.style.cursor = "move" : t.style.cursor = "default";
7628
+ const t = gt.current, r = t.getBoundingClientRect(), n = (e.clientX - r.left) / q, h = (e.clientY - r.top) / q;
7629
+ if (g && !C && !I && !w) {
7630
+ const m = Gt(n, h, g);
7631
+ m ? m === "rotate" ? t.style.cursor = "grab" : t.style.cursor = m : _t(n, h, g) ? t.style.cursor = "move" : t.style.cursor = "default";
7617
7632
  } else
7618
7633
  t.style.cursor = C ? "grabbing" : "default";
7619
- if (w && x) {
7620
- const g = x.x + x.width / 2, b = x.y + x.height / 2, v = Math.atan2(f - b, n - g) * 180 / Math.PI - E.initialAngle;
7634
+ if (w && g) {
7635
+ const m = g.x + g.width / 2, b = g.y + g.height / 2, v = Math.atan2(h - b, n - m) * 180 / Math.PI - E.initialAngle;
7621
7636
  let R = E.initialRotation + v;
7622
- e.shiftKey && (R = Math.round(R / 15) * 15), R = (R % 360 + 360) % 360, u(
7637
+ e.shiftKey && (R = Math.round(R / 15) * 15), R = (R % 360 + 360) % 360, y(
7623
7638
  (D) => D.map(
7624
- (L) => L.id === x.id ? { ...L, rotation: R } : L
7639
+ (L) => L.id === g.id ? { ...L, rotation: R } : L
7625
7640
  )
7626
7641
  ), F((D) => ({ ...D, rotation: R })), X();
7627
7642
  return;
7628
7643
  }
7629
- if (I && x && $) {
7630
- const g = n - E.x, b = f - E.y;
7644
+ if (I && g && $) {
7645
+ const m = n - E.x, b = h - E.y;
7631
7646
  let k = E.initialWidth, v = E.initialHeight, R = E.initialX, D = E.initialY;
7632
7647
  switch ($) {
7633
7648
  case "se-resize":
7634
- k = Math.max(20, E.initialWidth + g), v = Math.max(20, E.initialHeight + b);
7649
+ k = Math.max(20, E.initialWidth + m), v = Math.max(20, E.initialHeight + b);
7635
7650
  break;
7636
7651
  case "sw-resize":
7637
- k = Math.max(20, E.initialWidth - g), v = Math.max(20, E.initialHeight + b), R = E.initialX + (E.initialWidth - k);
7652
+ k = Math.max(20, E.initialWidth - m), v = Math.max(20, E.initialHeight + b), R = E.initialX + (E.initialWidth - k);
7638
7653
  break;
7639
7654
  case "ne-resize":
7640
- k = Math.max(20, E.initialWidth + g), v = Math.max(20, E.initialHeight - b), D = E.initialY + (E.initialHeight - v);
7655
+ k = Math.max(20, E.initialWidth + m), v = Math.max(20, E.initialHeight - b), D = E.initialY + (E.initialHeight - v);
7641
7656
  break;
7642
7657
  case "nw-resize":
7643
- k = Math.max(20, E.initialWidth - g), v = Math.max(20, E.initialHeight - b), R = E.initialX + (E.initialWidth - k), D = E.initialY + (E.initialHeight - v);
7658
+ k = Math.max(20, E.initialWidth - m), v = Math.max(20, E.initialHeight - b), R = E.initialX + (E.initialWidth - k), D = E.initialY + (E.initialHeight - v);
7644
7659
  break;
7645
7660
  }
7646
- if (e.shiftKey && x.type !== "text") {
7661
+ if (e.shiftKey && g.type !== "text") {
7647
7662
  const tt = E.initialWidth / E.initialHeight;
7648
7663
  $.includes("e"), v = k / tt, $.includes("n") && (D = E.initialY + (E.initialHeight - v));
7649
7664
  }
7650
7665
  M && (R = mt(R), D = mt(D), k = mt(k), v = mt(v));
7651
7666
  const L = {
7652
- ...x,
7667
+ ...g,
7653
7668
  x: R,
7654
7669
  y: D,
7655
7670
  width: k,
7656
7671
  height: v
7657
7672
  };
7658
- u(
7673
+ y(
7659
7674
  (tt) => tt.map(
7660
- (xt) => xt.id === x.id ? L : xt
7675
+ (xt) => xt.id === g.id ? L : xt
7661
7676
  )
7662
7677
  ), F(L), X();
7663
7678
  return;
7664
7679
  }
7665
- if (C && x) {
7666
- let g = n - E.offsetX, b = f - E.offsetY;
7667
- M && (g = mt(g), b = mt(b)), g = Math.max(0, Math.min(W - x.width, g)), b = Math.max(0, Math.min(U - x.height, b));
7680
+ if (C && g) {
7681
+ let m = n - E.offsetX, b = h - E.offsetY;
7682
+ M && (m = mt(m), b = mt(b)), m = Math.max(0, Math.min(W - g.width, m)), b = Math.max(0, Math.min(U - g.height, b));
7668
7683
  const k = {
7669
- ...x,
7670
- x: g,
7684
+ ...g,
7685
+ x: m,
7671
7686
  y: b
7672
7687
  };
7673
- u(
7688
+ y(
7674
7689
  (v) => v.map(
7675
- (R) => R.id === x.id ? k : R
7690
+ (R) => R.id === g.id ? k : R
7676
7691
  )
7677
7692
  ), F(k), X();
7678
7693
  }
7679
- }, [l, q, x, C, I, w, $, E, M, W, U, c, X]), Vt = ot((e) => {
7694
+ }, [l, q, g, C, I, w, $, E, M, W, U, c, X]), Xt = ot((e) => {
7680
7695
  j && Z((r) => ({
7681
7696
  ...r,
7682
7697
  [j.sectionName]: {
@@ -7693,29 +7708,29 @@ const yi = Ye((d, o) => {
7693
7708
  if (t) {
7694
7709
  const r = t.elements.map((n) => {
7695
7710
  if (n.type === "image" && n.src && !n.imageData) {
7696
- const f = new Image();
7697
- return f.onload = () => {
7698
- u(
7699
- (g) => g.map(
7700
- (b) => b.id === n.id ? { ...b, imageData: f } : b
7711
+ const h = new Image();
7712
+ return h.onload = () => {
7713
+ y(
7714
+ (m) => m.map(
7715
+ (b) => b.id === n.id ? { ...b, imageData: h } : b
7701
7716
  )
7702
7717
  ), X();
7703
- }, f.src = n.src, { ...n, imageData: f };
7718
+ }, h.src = n.src, { ...n, imageData: h };
7704
7719
  }
7705
7720
  return n;
7706
7721
  });
7707
- u(r), O(t.selectedColor || Y);
7722
+ y(r), O(t.selectedColor || Y);
7708
7723
  } else
7709
- u([]);
7710
- m(e), F(null);
7724
+ y([]);
7725
+ u(e), F(null);
7711
7726
  }, [j, c, Y, _, X]), Qe = ot((e) => {
7712
7727
  if (e && e.type.startsWith("image/")) {
7713
7728
  const t = new FileReader();
7714
7729
  t.onload = (r) => {
7715
7730
  const n = new Image();
7716
7731
  n.onload = () => {
7717
- const f = {
7718
- id: dt(),
7732
+ const h = {
7733
+ id: ct(),
7719
7734
  type: "image",
7720
7735
  x: mt(W / 2 - 100),
7721
7736
  y: mt(U / 2 - 100),
@@ -7727,8 +7742,8 @@ const yi = Ye((d, o) => {
7727
7742
  src: r.target.result,
7728
7743
  originalWidth: n.width,
7729
7744
  originalHeight: n.height
7730
- }, g = n.width / n.height;
7731
- f.width / f.height !== g && (f.width / g <= 200 ? f.height = f.width / g : f.width = f.height * g), u((b) => [...b, f]), F(f), lt();
7745
+ }, m = n.width / n.height;
7746
+ h.width / h.height !== m && (h.width / m <= 200 ? h.height = h.width / m : h.width = h.height * m), y((b) => [...b, h]), F(h), lt();
7732
7747
  }, n.onerror = () => {
7733
7748
  console.error("Failed to load uploaded image"), alert("Failed to load the uploaded image. Please try again.");
7734
7749
  }, n.src = r.target.result;
@@ -7737,7 +7752,7 @@ const yi = Ye((d, o) => {
7737
7752
  }, t.readAsDataURL(e);
7738
7753
  } else
7739
7754
  alert("Please select a valid image file.");
7740
- }, [W, U, mt, dt, lt]), Xt = ot(
7755
+ }, [W, U, mt, ct, lt]), Jt = ot(
7741
7756
  $e(() => {
7742
7757
  X();
7743
7758
  }, 16),
@@ -7745,49 +7760,49 @@ const yi = Ye((d, o) => {
7745
7760
  [X]
7746
7761
  );
7747
7762
  et(() => {
7748
- Bt.current || Xt();
7749
- }, [c, x, J, Xt]);
7763
+ Bt.current || Jt();
7764
+ }, [c, g, J, Jt]);
7750
7765
  function $e(e, t) {
7751
7766
  let r;
7752
- return function(...f) {
7753
- const g = () => {
7754
- clearTimeout(r), e(...f);
7767
+ return function(...h) {
7768
+ const m = () => {
7769
+ clearTimeout(r), e(...h);
7755
7770
  };
7756
- clearTimeout(r), r = setTimeout(g, t);
7771
+ clearTimeout(r), r = setTimeout(m, t);
7757
7772
  };
7758
7773
  }
7759
7774
  et(() => {
7760
- kt.current && Jt(kt.current, Y);
7775
+ kt.current && Kt(kt.current, Y);
7761
7776
  }, [Y]), et(() => {
7762
7777
  X();
7763
7778
  }, [X]);
7764
- const He = (e, t, r) => (0.2126 * e + 0.7152 * t + 0.0722 * r) / 255, Jt = ot((e, t) => {
7765
- const r = Ut.current, n = r.getContext("2d");
7779
+ const He = (e, t, r) => (0.2126 * e + 0.7152 * t + 0.0722 * r) / 255, Kt = ot((e, t) => {
7780
+ const r = Ot.current, n = r.getContext("2d");
7766
7781
  r.width = W, r.height = U, n.clearRect(0, 0, W, U), n.drawImage(e, 0, 0, W, U);
7767
- const f = n.getImageData(0, 0, W, U), g = f.data, b = xe(t);
7782
+ const h = n.getImageData(0, 0, W, U), m = h.data, b = ye(t);
7768
7783
  if (!b) {
7769
7784
  Bt.current = !1;
7770
7785
  return;
7771
7786
  }
7772
7787
  const { r: k, g: v, b: R } = b;
7773
- for (let L = 0; L < g.length; L += 4) {
7774
- if (g[L + 3] === 0) continue;
7775
- const xt = He(g[L], g[L + 1], g[L + 2]);
7776
- g[L] = Math.round(k * xt), g[L + 1] = Math.round(v * xt), g[L + 2] = Math.round(R * xt);
7788
+ for (let L = 0; L < m.length; L += 4) {
7789
+ if (m[L + 3] === 0) continue;
7790
+ const xt = He(m[L], m[L + 1], m[L + 2]);
7791
+ m[L] = Math.round(k * xt), m[L + 1] = Math.round(v * xt), m[L + 2] = Math.round(R * xt);
7777
7792
  }
7778
- n.putImageData(f, 0, 0);
7793
+ n.putImageData(h, 0, 0);
7779
7794
  const D = new Image();
7780
7795
  D.onload = () => {
7781
7796
  wt.current = s.plainColor === "Y" ? D : e, Bt.current = !1, X();
7782
7797
  }, D.src = r.toDataURL("image/png");
7783
- }, [W, U, X]), Kt = (e) => {
7798
+ }, [W, U, X]), Zt = (e) => {
7784
7799
  if (!K) return { horizontal: [], vertical: [] };
7785
7800
  const t = document.querySelector(".ruler-horizontal"), r = document.querySelector(".ruler-vertical");
7786
7801
  if (!t || !r)
7787
7802
  return { horizontal: [], vertical: [] };
7788
- const n = t.getBoundingClientRect(), f = r.getBoundingClientRect(), g = n.width, b = f.height, k = 50, v = [], R = [];
7789
- for (let D = k; D <= g; D += k)
7790
- D <= g - 20 && v.push({
7803
+ const n = t.getBoundingClientRect(), h = r.getBoundingClientRect(), m = n.width, b = h.height, k = 50, v = [], R = [];
7804
+ for (let D = k; D <= m; D += k)
7805
+ D <= m - 20 && v.push({
7791
7806
  position: D,
7792
7807
  value: Math.round(D / e)
7793
7808
  });
@@ -7797,12 +7812,12 @@ const yi = Ye((d, o) => {
7797
7812
  value: Math.round(D / e)
7798
7813
  });
7799
7814
  return { horizontal: v, vertical: R };
7800
- }, [Zt, te] = N({ horizontal: [], vertical: [] });
7815
+ }, [te, ee] = N({ horizontal: [], vertical: [] });
7801
7816
  return et(() => {
7802
7817
  const e = () => {
7803
7818
  setTimeout(() => {
7804
- const n = Kt(q);
7805
- te(n);
7819
+ const n = Zt(q);
7820
+ ee(n);
7806
7821
  }, 50);
7807
7822
  };
7808
7823
  e();
@@ -7816,8 +7831,8 @@ const yi = Ye((d, o) => {
7816
7831
  }, [q, K]), et(() => {
7817
7832
  if (K && !A) {
7818
7833
  const e = setTimeout(() => {
7819
- const t = Kt(q);
7820
- te(t);
7834
+ const t = Zt(q);
7835
+ ee(t);
7821
7836
  }, 100);
7822
7837
  return () => clearTimeout(e);
7823
7838
  }
@@ -7826,8 +7841,8 @@ const yi = Ye((d, o) => {
7826
7841
  di,
7827
7842
  {
7828
7843
  onAddElement: Me,
7829
- onDeleteElement: () => x && Wt(x.id),
7830
- onDuplicateElement: () => x && Yt(x.id),
7844
+ onDeleteElement: () => g && Mt(g.id),
7845
+ onDuplicateElement: () => g && qt(g.id),
7831
7846
  onUndo: Ft,
7832
7847
  onRedo: bt,
7833
7848
  onToggleGrid: () => st(!J),
@@ -7839,7 +7854,7 @@ const yi = Ye((d, o) => {
7839
7854
  showGrid: J,
7840
7855
  showRulers: K,
7841
7856
  snapToGrid: M,
7842
- selectedElement: x,
7857
+ selectedElement: g,
7843
7858
  theme: a,
7844
7859
  readOnly: l,
7845
7860
  apiKey: d.apiKey,
@@ -7848,7 +7863,7 @@ const yi = Ye((d, o) => {
7848
7863
  ) }),
7849
7864
  /* @__PURE__ */ i.jsxs("div", { className: "designer-content", children: [
7850
7865
  K && !A && /* @__PURE__ */ i.jsxs("div", { className: "rulers", children: [
7851
- /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal", children: /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal-numbers", children: Zt.horizontal.map((e, t) => /* @__PURE__ */ i.jsx(
7866
+ /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal", children: /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal-numbers", children: te.horizontal.map((e, t) => /* @__PURE__ */ i.jsx(
7852
7867
  "span",
7853
7868
  {
7854
7869
  className: "ruler-number horizontal",
@@ -7857,7 +7872,7 @@ const yi = Ye((d, o) => {
7857
7872
  },
7858
7873
  t
7859
7874
  )) }) }),
7860
- /* @__PURE__ */ i.jsx("div", { className: "ruler-vertical", children: /* @__PURE__ */ i.jsx("div", { className: "ruler-vertical-numbers", children: Zt.vertical.map((e, t) => /* @__PURE__ */ i.jsx(
7875
+ /* @__PURE__ */ i.jsx("div", { className: "ruler-vertical", children: /* @__PURE__ */ i.jsx("div", { className: "ruler-vertical-numbers", children: te.vertical.map((e, t) => /* @__PURE__ */ i.jsx(
7861
7876
  "span",
7862
7877
  {
7863
7878
  className: "ruler-number vertical",
@@ -7867,7 +7882,7 @@ const yi = Ye((d, o) => {
7867
7882
  t
7868
7883
  )) }) })
7869
7884
  ] }),
7870
- /* @__PURE__ */ i.jsx("div", { className: "canvas-container", ref: Dt, children: /* @__PURE__ */ i.jsx(
7885
+ /* @__PURE__ */ i.jsx("div", { className: "canvas-container", ref: Et, children: /* @__PURE__ */ i.jsx(
7871
7886
  "canvas",
7872
7887
  {
7873
7888
  ref: gt,
@@ -7888,10 +7903,10 @@ const yi = Ye((d, o) => {
7888
7903
  /* @__PURE__ */ i.jsx(
7889
7904
  fi,
7890
7905
  {
7891
- selectedElement: x,
7892
- onUpdate: _t,
7893
- onMoveLayer: qt,
7894
- availableFonts: fe,
7906
+ selectedElement: g,
7907
+ onUpdate: Yt,
7908
+ onMoveLayer: Vt,
7909
+ availableFonts: he,
7895
7910
  theme: a
7896
7911
  }
7897
7912
  ),
@@ -7899,10 +7914,10 @@ const yi = Ye((d, o) => {
7899
7914
  hi,
7900
7915
  {
7901
7916
  elements: c,
7902
- selectedElement: x,
7917
+ selectedElement: g,
7903
7918
  onSelectElement: F,
7904
- onMoveLayer: qt,
7905
- onDeleteElement: Wt,
7919
+ onMoveLayer: Vt,
7920
+ onDeleteElement: Mt,
7906
7921
  theme: a
7907
7922
  }
7908
7923
  )
@@ -7922,8 +7937,8 @@ const yi = Ye((d, o) => {
7922
7937
  className: `section-thumbnail compact ${j.sectionName === e.sectionName ? "active" : ""}`,
7923
7938
  onClick: (r) => {
7924
7939
  r.stopPropagation();
7925
- const n = s.sections.find((f) => f.sectionName === e.sectionName);
7926
- Vt(n);
7940
+ const n = s.sections.find((h) => h.sectionName === e.sectionName);
7941
+ Xt(n);
7927
7942
  },
7928
7943
  title: e.sectionName,
7929
7944
  children: [