@mypixia/simplex-designer 2.10.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";require('./index_external.css');const f=require("react"),qi=require("qrcode"),Xi=require("react-barcode"),We=require("axios");var me={exports:{}},ae={};/**
1
+ "use strict";require('./index_external.css');const p=require("react"),Ga=require("qrcode"),_a=require("react-barcode"),xi=require("axios");var We={exports:{}},be={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var ri;function Qi(){if(ri)return ae;ri=1;var s=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function o(n,l,c){var d=null;if(c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+l.key),"key"in l){c={};for(var y in l)y!=="key"&&(c[y]=l[y])}else c=l;return l=c.ref,{$$typeof:s,type:n,key:d,ref:l!==void 0?l:null,props:c}}return ae.Fragment=a,ae.jsx=o,ae.jsxs=o,ae}var oe={};/**
9
+ */var Yi;function Ua(){if(Yi)return be;Yi=1;var r=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function s(n,l,h){var f=null;if(h!==void 0&&(f=""+h),l.key!==void 0&&(f=""+l.key),"key"in l){h={};for(var k in l)k!=="key"&&(h[k]=l[k])}else h=l;return l=h.ref,{$$typeof:r,type:n,key:f,ref:l!==void 0?l:null,props:h}}return be.Fragment=a,be.jsx=s,be.jsxs=s,be}var Se={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,17 +14,17 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var si;function Zi(){return si||(si=1,process.env.NODE_ENV!=="production"&&function(){function s(b){if(b==null)return null;if(typeof b=="function")return b.$$typeof===$?null:b.displayName||b.name||null;if(typeof b=="string")return b;switch(b){case R:return"Fragment";case T:return"Profiler";case p:return"StrictMode";case tt:return"Suspense";case K:return"SuspenseList";case yt:return"Activity"}if(typeof b=="object")switch(typeof b.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),b.$$typeof){case z:return"Portal";case q:return(b.displayName||"Context")+".Provider";case g:return(b._context.displayName||"Context")+".Consumer";case E:var D=b.render;return b=b.displayName,b||(b=D.displayName||D.name||"",b=b!==""?"ForwardRef("+b+")":"ForwardRef"),b;case it:return D=b.displayName||null,D!==null?D:s(b.type)||"Memo";case st:D=b._payload,b=b._init;try{return s(b(D))}catch{}}return null}function a(b){return""+b}function o(b){try{a(b);var D=!1}catch{D=!0}if(D){D=console;var Y=D.error,ot=typeof Symbol=="function"&&Symbol.toStringTag&&b[Symbol.toStringTag]||b.constructor.name||"Object";return Y.call(D,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",ot),a(b)}}function n(b){if(b===R)return"<>";if(typeof b=="object"&&b!==null&&b.$$typeof===st)return"<...>";try{var D=s(b);return D?"<"+D+">":"<...>"}catch{return"<...>"}}function l(){var b=U.A;return b===null?null:b.getOwner()}function c(){return Error("react-stack-top-frame")}function d(b){if(k.call(b,"key")){var D=Object.getOwnPropertyDescriptor(b,"key").get;if(D&&D.isReactWarning)return!1}return b.key!==void 0}function y(b,D){function Y(){N||(N=!0,console.error("%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)",D))}Y.isReactWarning=!0,Object.defineProperty(b,"key",{get:Y,configurable:!0})}function x(){var b=s(this.type);return B[b]||(B[b]=!0,console.error("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.")),b=this.props.ref,b!==void 0?b:null}function F(b,D,Y,ot,nt,ht,ft,vt){return Y=ht.ref,b={$$typeof:M,type:b,key:D,props:ht,_owner:nt},(Y!==void 0?Y:null)!==null?Object.defineProperty(b,"ref",{enumerable:!1,get:x}):Object.defineProperty(b,"ref",{enumerable:!1,value:null}),b._store={},Object.defineProperty(b._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(b,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(b,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ft}),Object.defineProperty(b,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:vt}),Object.freeze&&(Object.freeze(b.props),Object.freeze(b)),b}function w(b,D,Y,ot,nt,ht,ft,vt){var dt=D.children;if(dt!==void 0)if(ot)if(H(dt)){for(ot=0;ot<dt.length;ot++)j(dt[ot]);Object.freeze&&Object.freeze(dt)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else j(dt);if(k.call(D,"key")){dt=s(b);var At=Object.keys(D).filter(function(Bt){return Bt!=="key"});ot=0<At.length?"{key: someKey, "+At.join(": ..., ")+": ...}":"{key: someKey}",ct[dt+ot]||(At=0<At.length?"{"+At.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var qi;function Ya(){return qi||(qi=1,process.env.NODE_ENV!=="production"&&function(){function r(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===Ft?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case H:return"Fragment";case z:return"Profiler";case Q:return"StrictMode";case j:return"Suspense";case it:return"SuspenseList";case gt:return"Activity"}if(typeof u=="object")switch(typeof u.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),u.$$typeof){case I:return"Portal";case S:return(u.displayName||"Context")+".Provider";case T:return(u._context.displayName||"Context")+".Consumer";case L:var A=u.render;return u=u.displayName,u||(u=A.displayName||A.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case J:return A=u.displayName||null,A!==null?A:r(u.type)||"Memo";case xt:A=u._payload,u=u._init;try{return r(u(A))}catch{}}return null}function a(u){return""+u}function s(u){try{a(u);var A=!1}catch{A=!0}if(A){A=console;var _=A.error,at=typeof Symbol=="function"&&Symbol.toStringTag&&u[Symbol.toStringTag]||u.constructor.name||"Object";return _.call(A,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",at),a(u)}}function n(u){if(u===H)return"<>";if(typeof u=="object"&&u!==null&&u.$$typeof===xt)return"<...>";try{var A=r(u);return A?"<"+A+">":"<...>"}catch{return"<...>"}}function l(){var u=V.A;return u===null?null:u.getOwner()}function h(){return Error("react-stack-top-frame")}function f(u){if(O.call(u,"key")){var A=Object.getOwnPropertyDescriptor(u,"key").get;if(A&&A.isReactWarning)return!1}return u.key!==void 0}function k(u,A){function _(){rt||(rt=!0,console.error("%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)",A))}_.isReactWarning=!0,Object.defineProperty(u,"key",{get:_,configurable:!0})}function C(){var u=r(this.type);return mt[u]||(mt[u]=!0,console.error("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.")),u=this.props.ref,u!==void 0?u:null}function E(u,A,_,at,bt,dt,It,Ct){return _=dt.ref,u={$$typeof:B,type:u,key:A,props:dt,_owner:bt},(_!==void 0?_:null)!==null?Object.defineProperty(u,"ref",{enumerable:!1,get:C}):Object.defineProperty(u,"ref",{enumerable:!1,value:null}),u._store={},Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(u,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(u,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:It}),Object.defineProperty(u,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Ct}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u}function N(u,A,_,at,bt,dt,It,Ct){var pt=A.children;if(pt!==void 0)if(at)if(R(pt)){for(at=0;at<pt.length;at++)M(pt[at]);Object.freeze&&Object.freeze(pt)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else M(pt);if(O.call(A,"key")){pt=r(u);var jt=Object.keys(A).filter(function(te){return te!=="key"});at=0<jt.length?"{key: someKey, "+jt.join(": ..., ")+": ...}":"{key: someKey}",P[pt+at]||(jt=0<jt.length?"{"+jt.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,ot,dt,At,dt),ct[dt+ot]=!0)}if(dt=null,Y!==void 0&&(o(Y),dt=""+Y),d(D)&&(o(D.key),dt=""+D.key),"key"in D){Y={};for(var Et in D)Et!=="key"&&(Y[Et]=D[Et])}else Y=D;return dt&&y(Y,typeof b=="function"?b.displayName||b.name||"Unknown":b),F(b,dt,ht,nt,l(),Y,ft,vt)}function j(b){typeof b=="object"&&b!==null&&b.$$typeof===M&&b._store&&(b._store.validated=1)}var m=f,M=Symbol.for("react.transitional.element"),z=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),q=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),tt=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),it=Symbol.for("react.memo"),st=Symbol.for("react.lazy"),yt=Symbol.for("react.activity"),$=Symbol.for("react.client.reference"),U=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,k=Object.prototype.hasOwnProperty,H=Array.isArray,W=console.createTask?console.createTask:function(){return null};m={"react-stack-bottom-frame":function(b){return b()}};var N,B={},G=m["react-stack-bottom-frame"].bind(m,c)(),P=W(n(c)),ct={};oe.Fragment=R,oe.jsx=function(b,D,Y,ot,nt){var ht=1e4>U.recentlyCreatedOwnerStacks++;return w(b,D,Y,!1,ot,nt,ht?Error("react-stack-top-frame"):G,ht?W(n(b)):P)},oe.jsxs=function(b,D,Y,ot,nt){var ht=1e4>U.recentlyCreatedOwnerStacks++;return w(b,D,Y,!0,ot,nt,ht?Error("react-stack-top-frame"):G,ht?W(n(b)):P)}}()),oe}var ni;function Ji(){return ni||(ni=1,process.env.NODE_ENV==="production"?me.exports=Qi():me.exports=Zi()),me.exports}var t=Ji();const J=({name:s,size:a=24,color:o="#000000",...n})=>{const l={briefcase:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375 7.444 2.25 12 2.25s8.25 1.847 8.25 4.125zM12 12.75c4.556 0 8.25-1.847 8.25-4.125v-2.35c-1.64 1.263-4.54 2.1-8.25 2.1s-6.61-.837-8.25-2.1v2.35c0 2.278 3.694 4.125 8.25 4.125z",money:"M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2zm0 2c-4.418 0-8 3.582-8 8s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8zm1 8V9.5c0-.828.672-1.5 1.5-1.5S16 8.672 16 9.5V10h-1v-.5c0-.276-.224-.5-.5-.5s-.5.224-.5.5V12c0 .828-.672 1.5-1.5 1.5S11 12.828 11 12v-.5h1v.5c0 .276.224.5.5.5s.5-.224.5-.5z",chart:"M3 3v18h18v-2H5V3H3zm4 12V9h2v6H7zm4 0V7h2v8h-2zm4 0v-4h2v4h-2z",target:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm0 10c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z",laptop:"M20 18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2h-4zM4 6h16v10H4V6z",phone:"M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z",wifi:"M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.07 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z",camera:"M9 2l1.17 1H15v1H9.83L8.66 2H9zm-4 7h14l-1 9H6l-1-9zm7 8c1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3 1.34 3 3 3z",email:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z",message:"M20 2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4v3c0 .6.4 1 1 1h.5c.2 0 .4-.1.6-.2L15.5 18H20c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z",notification:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z",like:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z",share:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z",user:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z",users:"M16 4c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zM4 4c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zm5 0c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zM12 14v8H4v-8c0-2.66 5.33-4 8-4s8 1.34 8 4v8h-8z",cart:"M7 18c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12L8.1 13h7.45c.75 0 1.41-.41 1.75-1.03L21.7 4H5.21l-.94-2H1zm16 16c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z",bag:"M19 7h-3V6c0-2.76-2.24-5-5-5S6 3.24 6 6v1H3c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2zM8 6c0-1.66 1.34-3 3-3s3 1.34 3 3v1H8V6zm11 15H5V9h2v1c0 .55.45 1 1 1s1-.45 1-1V9h6v1c0 .55.45 1 1 1s1-.45 1-1V9h2v12z",gift:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h1v6c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2v-6h1c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2z",plane:"M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z",car:"M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.22.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z",location:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z",home:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z",coffee:"M2 21h18v-2H2v2zM20 8H3v10h17V8zM5 10h12v6H5v-6zM21 5V3h-2v2H3v2h16v-2z",pizza:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z",sun:"M6.76 4.84l-1.8-1.79-1.41 1.41 1.79 1.79 1.42-1.41zM4 10.5H1v2h3v-2zm9-9.95h-2V3.5h2V.55zm7.45 3.91l-1.41-1.41-1.79 1.79 1.41 1.41 1.79-1.79zm-3.21 13.7l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4zM20 10.5v2h3v-2h-3zm-8-5c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm-1 16.95h2V19.5h-2v2.95zm-7.45-3.91l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8z",cloud:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z",tree:"M16.5 12c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5-1.5-.67-1.5-1.5.67-1.5 1.5-1.5zM9 13c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm3-6c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1z",soccer:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z",basketball:"M17.09 11h4.86c-.16-1.61-.71-3.11-1.54-4.4-1.69.83-2.81 2.54-3.32 4.4zM6.91 11c-.51-1.86-1.63-3.57-3.32-4.4-.83 1.29-1.38 2.79-1.54 4.4h4.86z",music:"M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z",video:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z",gamepad:"M15 7.5V2H9v5.5l3 3 3-3zM7.5 9H2v6h5.5l3-3-3-3zM9 16.5V22h6v-5.5l-3-3-3 3zM16.5 9l3 3 3-3H22V2h-5.5z",health:"M9.8 17.3l4.2-4.2L18.2 17c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L15.4 11.4l4.2-4.2c.39-.39.39-1.02 0-1.41-.39-.39-1.02-.39-1.41 0L14 9.8l-4.2-4.2c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41l4.2 4.2-4.2 4.2c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0z",medical:"M19 8h-2v3h-3v2h3v3h2v-3h3v-2h-3V8zM4 6h9v2H4zm0 5h9v2H4zm0 5h6v2H4z",lock:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z",shield:"M12,1L3,5V11C3,16.55 6.84,21.74 12,23C17.16,21.74 21,16.55 21,11V5L12,1M12,7C13.4,7 14.8,8.6 14.8,10V11H15.7V16H8.3V11H9.2V10C9.2,8.6 10.6,7 12,7M12,8.2C11.2,8.2 10.5,8.7 10.5,10V11H13.5V10C13.5,8.7 12.8,8.2 12,8.2Z",wrench:"M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z",gear:"M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z",book:"M18 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 4h5v8l-2.5-1.5L6 12V4z",graduation:"M5 13.18v4L12 21l7-3.82v-4L12 17l-7-3.82zM12 3L1 9l11 6 9-4.91V17h2V9L12 3z",arrowUp:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z",arrowDown:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z",arrowLeft:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6z",arrowRight:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6z",close:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",check:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z",plus:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z",minus:"M19 13H5v-2h14v2z",sparkle:"M19 9l1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25L19 9zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12l-5.5-2.5zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25L19 15z",undo:"M12.5 8c-2.65 0-5.05 1.04-6.83 2.73L3 8v8h8l-2.81-2.81C9.62 11.85 10.97 11.2 12.5 11.2c2.96 0 5.48 1.87 6.44 4.5L21 14.9C19.72 11.04 16.42 8 12.5 8z",redo:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-3.92 0-7.22 3.04-8.5 6.9l2.06.77C5.98 13.07 8.47 11.2 11.5 11.2c1.53 0 2.88.65 3.81 1.69L13 15h7V8l-1.6 2.6z",text:"M5 4v3h5.5v12h3V7H19V4H5z",shapes:"M11 13.5v8h2v-8h8v-2h-8v-8h-2v8h-8v2h8z",upload:"M9 16h6v-6h4l-7-7-7 7h4v6zm-4 2h14v2H5v-2z",image:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z",sticker:"M21.99 4c0-1.1-.89-2-1.99-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14l4 4-.01-18zM18 14H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z",qrcode:"M3 11h2v2H3v-2zm8-6h2v4h-2V5zM3 3v6h6V3H3zm4 4H5V5h2v2zm-4 14h6v-6H3v6zm2-4h2v2H5v-2zM15 3v6h6V3h-6zm4 4h-2V5h2v2zm-4 8h2v2h2v2h-2v-2h-2v-2zm-2-2h2v2h-2v-2zm4 0h2v2h-2v-2zm2 4h2v2h-2v-2zm0-4h2v2h-2v-2zM11 13h2v4h-2v-4z",barcode:"M2 4h2v16H2V4zm4 0h1v16H6V4zm3 0h2v16H9V4zm4 0h1v16h-1V4zm3 0h2v16h-2V4zm4 0h2v16h-2V4z",thread:"M19.38 3.9L18.2 2.72a1.5 1.5 0 00-2.12 0l-1.41 1.41L3 15.79V21h5.21l11.66-11.66 1.41-1.41a1.5 1.5 0 000-2.12L19.38 3.9zM7.79 19H5v-2.79l9.95-9.95 2.79 2.79L7.79 19z",duplicate:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z",trash:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z",grid:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z",ruler:"M21 6H3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 10H3V8h2v4h2V8h2v4h2V8h2v4h2V8h2v4h2V8h2v4z",magnet:"M3 7v6c0 5.52 4.48 10 10 10h1V13h-2v8.95C7.83 21.45 5 18.05 5 14V7H3zm18 0h-2v7c0 4.05-2.83 7.45-7 7.95V13h-2v10h1c5.52 0 10-4.48 10-10V7z",rectangle:"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 12H5V7h14v10z",circle:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",triangle:"M12 2L1 21h22L12 2zm0 4l7.53 13H4.47L12 6z",star:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z",heart:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z",diamond:"M12 2L2 12l10 10 10-10L12 2zm0 2.83L19.17 12 12 19.17 4.83 12 12 4.83z",hexagon:"M12 2l-8.66 5v10L12 22l8.66-5V7L12 2zm6.66 13.87L12 19.87l-6.66-4V8.13L12 4.13l6.66 4v7.74z",pentagon:"M12 2L2 9l4 12h12l4-12L12 2z",oval:"M12 6c-4.42 0-8 2.69-8 6s3.58 6 8 6 8-2.69 8-6-3.58-6-8-6z",roundedRect:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z",horizontalLine:"M2 12h20",arrowShape:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z",rain:"M6 14c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97C6.22 4.56 8.51 3 11.2 3c2.31 0 4.36 1.25 5.46 3.1C17.43 6.04 18 6.96 18 8c0 1.1-.9 2-2 2H6zm2 6h2v2H8v-2zm4 0h2v2h-2v-2zm-2-3h2v2h-2v-2z",snow:"M22 11h-4.17l3.24-3.24-1.41-1.42L15.83 10H13V7.17l3.24-3.24-1.42-1.41L12 5.83 9.17 2.52 7.76 3.93 11 7.17V10H8.17l-3.24-3.24L3.52 8.17 6.76 11.41H2v2h4.17l-3.24 3.24 1.41 1.42L8.17 14H11v2.83l-3.24 3.24 1.42 1.41L12 18.17l2.83 3.31 1.41-1.41L13 16.83V14h2.83l3.24 3.24 1.42-1.41L17.24 12.59H22v-1z"},c=new Set(["horizontalLine","ruler"]),d=l[s];if(!d)return console.warn(`Icon "${s}" not found`),null;const y=c.has(s);return t.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:y?"none":o,stroke:y?o:void 0,strokeWidth:y?2:void 0,...n,children:t.jsx("path",{d})})},Gt=[{id:1,text:"DREAM BIG",category:"Motivational",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF6B35",hasBackground:!0,backgroundColor:"#1A1A1A",textAlign:"center",textTransform:"uppercase"},{id:2,text:"Never Give Up",category:"Motivational",fontSize:28,fontFamily:"Georgia",fontWeight:"bold",fill:"#2E8B57",fontStyle:"italic",textAlign:"center"},{id:3,text:"BE YOURSELF",category:"Motivational",fontSize:24,fontFamily:"Arial",fontWeight:"700",fill:"#FF1493",textTransform:"uppercase",letterSpacing:2},{id:4,text:"Stay Strong",category:"Motivational",fontSize:26,fontFamily:"Verdana",fontWeight:"bold",fill:"#4169E1",hasTextShadow:!0,textShadowX:2,textShadowY:2,textShadowBlur:4,textShadowColor:"#000000"},{id:5,text:"RISE & SHINE",category:"Motivational",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",hasBackground:!0,backgroundColor:"#8B0000",textAlign:"center"},{id:6,text:"Believe in Magic",category:"Motivational",fontSize:22,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB",textAlign:"center"},{id:7,text:"UNSTOPPABLE",category:"Motivational",fontSize:28,fontFamily:"Arial",fontWeight:"900",fill:"#DC143C",textTransform:"uppercase",letterSpacing:1.5},{id:8,text:"Chase Your Dreams",category:"Motivational",fontSize:24,fontFamily:"Georgia",fill:"#20B2AA",fontWeight:"600"},{id:9,text:"FEARLESS",category:"Motivational",fontSize:36,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center",hasBackground:!0,backgroundColor:"#000000"},{id:10,text:"Make It Happen",category:"Motivational",fontSize:26,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#32CD32"},{id:11,text:"BORN TO WIN",category:"Motivational",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#FFD700",hasBackground:!0,backgroundColor:"#800080",textAlign:"center"},{id:12,text:"Positive Vibes Only",category:"Motivational",fontSize:20,fontFamily:"Comic Sans MS",fill:"#FF69B4",fontWeight:"600"},{id:13,text:"LIMITLESS",category:"Motivational",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#1E90FF",textTransform:"uppercase",letterSpacing:3},{id:14,text:"Embrace The Journey",category:"Motivational",fontSize:22,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B4513"},{id:15,text:"STRENGTH WITHIN",category:"Motivational",fontSize:26,fontFamily:"Verdana",fontWeight:"bold",fill:"#696969",hasBackground:!0,backgroundColor:"#F0F8FF"},{id:16,text:"Create Your Own Sunshine",category:"Motivational",fontSize:18,fontFamily:"Palatino",fill:"#FF8C00",fontWeight:"600"},{id:17,text:"WARRIOR SPIRIT",category:"Motivational",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#B22222",textAlign:"center"},{id:18,text:"Keep Going",category:"Motivational",fontSize:30,fontFamily:"Arial",fontWeight:"700",fill:"#228B22"},{id:19,text:"FOCUS & WIN",category:"Motivational",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082",hasBackground:!0,backgroundColor:"#FFFF00"},{id:20,text:"Inspire Others",category:"Motivational",fontSize:26,fontFamily:"Georgia",fill:"#CD853F",fontStyle:"italic"},{id:21,text:"GAME CHANGER",category:"Motivational",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493",textAlign:"center"},{id:22,text:"Live With Purpose",category:"Motivational",fontSize:22,fontFamily:"Palatino",fill:"#2F4F4F",fontWeight:"600"},{id:23,text:"BREAKTHROUGH",category:"Motivational",fontSize:28,fontFamily:"Arial",fontWeight:"900",fill:"#DC143C",letterSpacing:2},{id:24,text:"Shine Bright",category:"Motivational",fontSize:32,fontFamily:"Verdana",fontWeight:"bold",fill:"#FFD700",hasTextShadow:!0,textShadowX:3,textShadowY:3,textShadowBlur:6,textShadowColor:"#000000"},{id:25,text:"NEVER SETTLE",category:"Motivational",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",hasBackground:!0,backgroundColor:"#000080"},{id:26,text:"CEO MINDSET",category:"Business",fontSize:28,fontFamily:"Arial",fontWeight:"bold",fill:"#2F4F4F",textAlign:"center",hasBackground:!0,backgroundColor:"#F5F5F5"},{id:27,text:"Innovation Starts Here",category:"Business",fontSize:20,fontFamily:"Trebuchet MS",fill:"#4169E1",fontWeight:"600"},{id:28,text:"PROFESSIONAL",category:"Business",fontSize:24,fontFamily:"Georgia",fontWeight:"bold",fill:"#000080",letterSpacing:1},{id:29,text:"Excellence Every Day",category:"Business",fontSize:22,fontFamily:"Verdana",fill:"#8B0000",fontWeight:"600"},{id:30,text:"LEADERSHIP",category:"Business",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#B8860B",textAlign:"center"},{id:31,text:"Think Different",category:"Business",fontSize:26,fontFamily:"Palatino",fontStyle:"italic",fill:"#696969"},{id:32,text:"RESULTS DRIVEN",category:"Business",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#DC143C",hasBackground:!0,backgroundColor:"#F0F8FF"},{id:33,text:"Strategic Vision",category:"Business",fontSize:22,fontFamily:"Georgia",fill:"#2E8B57",fontWeight:"700"},{id:34,text:"PRODUCTIVITY",category:"Business",fontSize:28,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:35,text:"Success Mindset",category:"Business",fontSize:24,fontFamily:"Verdana",fill:"#FF8C00",fontWeight:"600"},{id:36,text:"EXPERT LEVEL",category:"Business",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#000000",hasBackground:!0,backgroundColor:"#FFD700"},{id:37,text:"Quality First",category:"Business",fontSize:30,fontFamily:"Arial",fontWeight:"700",fill:"#228B22"},{id:38,text:"INTEGRITY",category:"Business",fontSize:32,fontFamily:"Georgia",fontWeight:"bold",fill:"#2F4F4F",textAlign:"center"},{id:39,text:"Growth Focused",category:"Business",fontSize:20,fontFamily:"Palatino",fill:"#20B2AA",fontWeight:"600"},{id:40,text:"COLLABORATION",category:"Business",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#9370DB"},{id:41,text:"Performance Matters",category:"Business",fontSize:22,fontFamily:"Verdana",fill:"#B22222",fontWeight:"700"},{id:42,text:"ACCOUNTABILITY",category:"Business",fontSize:26,fontFamily:"Arial",fontWeight:"800",fill:"#8B4513",letterSpacing:1.5},{id:43,text:"Vision to Reality",category:"Business",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#4169E1"},{id:44,text:"TRANSFORMATION",category:"Business",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center"},{id:45,text:"Excellence Standard",category:"Business",fontSize:22,fontFamily:"Palatino",fill:"#2E8B57",fontWeight:"600"},{id:46,text:"EFFICIENCY",category:"Business",fontSize:30,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#000080"},{id:47,text:"Forward Thinking",category:"Business",fontSize:24,fontFamily:"Verdana",fill:"#CD853F",fontWeight:"700"},{id:48,text:"ACHIEVEMENT",category:"Business",fontSize:26,fontFamily:"Arial",fontWeight:"bold",fill:"#B8860B",hasBackground:!0,backgroundColor:"#F5F5DC"},{id:49,text:"Strategic Excellence",category:"Business",fontSize:20,fontFamily:"Georgia",fill:"#696969",fontWeight:"600"},{id:50,text:"IMPACT MAKER",category:"Business",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#DC143C",textAlign:"center"},{id:51,text:"COFFEE FIRST",category:"Funny",fontSize:28,fontFamily:"Comic Sans MS",fontWeight:"bold",fill:"#8B4513",hasBackground:!0,backgroundColor:"#F5DEB3"},{id:52,text:"I'm Not Lazy, I'm Energy Efficient",category:"Funny",fontSize:16,fontFamily:"Arial",fill:"#FF69B4",fontWeight:"600"},{id:53,text:"SARCASM LOADING...",category:"Funny",fontSize:24,fontFamily:"Courier New",fontWeight:"bold",fill:"#32CD32",textAlign:"center"},{id:54,text:"Powered By Pizza",category:"Funny",fontSize:26,fontFamily:"Comic Sans MS",fill:"#FF6347",fontWeight:"700"},{id:55,text:"CTRL + ALT + DELETE MONDAY",category:"Funny",fontSize:18,fontFamily:"Courier New",fontWeight:"bold",fill:"#4169E1"},{id:56,text:"Brain 404 Error",category:"Funny",fontSize:22,fontFamily:"Arial",fill:"#FF1493",fontWeight:"600"},{id:57,text:"WEEKEND WARRIOR",category:"Funny",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",hasBackground:!0,backgroundColor:"#000080"},{id:58,text:"Adulting is Hard",category:"Funny",fontSize:24,fontFamily:"Comic Sans MS",fill:"#9370DB",fontWeight:"600"},{id:59,text:"PROCRASTINATION EXPERT",category:"Funny",fontSize:20,fontFamily:"Arial",fontWeight:"bold",fill:"#FF4500"},{id:60,text:"Netflix & Chill Champion",category:"Funny",fontSize:18,fontFamily:"Trebuchet MS",fill:"#DC143C",fontWeight:"600"},{id:61,text:"CHAOS COORDINATOR",category:"Funny",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#FF69B4",textAlign:"center"},{id:62,text:"I Speak Fluent Sarcasm",category:"Funny",fontSize:20,fontFamily:"Georgia",fontStyle:"italic",fill:"#2E8B57"},{id:63,text:"SLEEP IS FOR THE WEAK",category:"Funny",fontSize:22,fontFamily:"Arial",fontWeight:"800",fill:"#B22222"},{id:64,text:"Professional Overthinker",category:"Funny",fontSize:20,fontFamily:"Verdana",fill:"#4B0082",fontWeight:"600"},{id:65,text:"WIFI PASSWORD PLEASE",category:"Funny",fontSize:20,fontFamily:"Courier New",fontWeight:"bold",fill:"#32CD32"},{id:66,text:"Certified Couch Potato",category:"Funny",fontSize:22,fontFamily:"Comic Sans MS",fill:"#FF8C00",fontWeight:"700"},{id:67,text:"SOCIAL DISTANCING CHAMPION",category:"Funny",fontSize:16,fontFamily:"Arial",fontWeight:"bold",fill:"#20B2AA"},{id:68,text:"Powered By Caffeine",category:"Funny",fontSize:24,fontFamily:"Impact",fill:"#8B4513",fontWeight:"bold"},{id:69,text:"EMERGENCY CHOCOLATE NEEDED",category:"Funny",fontSize:18,fontFamily:"Comic Sans MS",fontWeight:"bold",fill:"#D2691E"},{id:70,text:"I'm Not Short, I'm Fun Size",category:"Funny",fontSize:20,fontFamily:"Trebuchet MS",fill:"#FF1493",fontWeight:"600"},{id:71,text:"CTRL + Z MY LIFE",category:"Funny",fontSize:26,fontFamily:"Courier New",fontWeight:"bold",fill:"#4169E1"},{id:72,text:"Error 404: Motivation Not Found",category:"Funny",fontSize:16,fontFamily:"Arial",fill:"#FF4500",fontWeight:"600"},{id:73,text:"PROFESSIONAL WEIRDO",category:"Funny",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#9370DB",textAlign:"center"},{id:74,text:"Snack Attack Mode",category:"Funny",fontSize:26,fontFamily:"Comic Sans MS",fill:"#FF6347",fontWeight:"700"},{id:75,text:"BATTERY LOW, NEED COFFEE",category:"Funny",fontSize:18,fontFamily:"Courier New",fontWeight:"bold",fill:"#8B4513"},{id:76,text:"Love You Forever",category:"Love",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#FF1493",textAlign:"center"},{id:77,text:"SOULMATES",category:"Love",fontSize:32,fontFamily:"Georgia",fontWeight:"bold",fill:"#DC143C",hasBackground:!0,backgroundColor:"#FFE4E1"},{id:78,text:"Better Together",category:"Love",fontSize:26,fontFamily:"Trebuchet MS",fill:"#FF69B4",fontWeight:"600"},{id:79,text:"ENDLESS LOVE",category:"Love",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#B22222",textAlign:"center"},{id:80,text:"You Complete Me",category:"Love",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B0000"},{id:81,text:"FOREVER & ALWAYS",category:"Love",fontSize:24,fontFamily:"Arial",fontWeight:"bold",fill:"#FF1493",letterSpacing:1},{id:82,text:"My Heart Belongs To You",category:"Love",fontSize:20,fontFamily:"Palatino",fill:"#DC143C",fontWeight:"600"},{id:83,text:"PURE LOVE",category:"Love",fontSize:34,fontFamily:"Impact",fontWeight:"bold",fill:"#FF69B4",hasTextShadow:!0,textShadowX:2,textShadowY:2,textShadowBlur:4,textShadowColor:"#000000"},{id:84,text:"Together Forever",category:"Love",fontSize:26,fontFamily:"Georgia",fill:"#8B0000",fontWeight:"700",textAlign:"center"},{id:85,text:"MATCH MADE IN HEAVEN",category:"Love",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#FF1493"},{id:86,text:"Love Story",category:"Love",fontSize:32,fontFamily:"Palatino",fontStyle:"italic",fill:"#B22222"},{id:87,text:"HEARTBEAT",category:"Love",fontSize:28,fontFamily:"Arial",fontWeight:"800",fill:"#DC143C",hasBackground:!0,backgroundColor:"#FFF0F5"},{id:88,text:"You Are My Sunshine",category:"Love",fontSize:22,fontFamily:"Georgia",fill:"#FF8C00",fontWeight:"600"},{id:89,text:"DESTINY",category:"Love",fontSize:36,fontFamily:"Impact",fontWeight:"bold",fill:"#8B0000",textAlign:"center"},{id:90,text:"True Love Waits",category:"Love",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#FF1493"},{id:91,text:"BELOVED",category:"Love",fontSize:30,fontFamily:"Georgia",fontWeight:"bold",fill:"#B22222",letterSpacing:2},{id:92,text:"Love Conquers All",category:"Love",fontSize:26,fontFamily:"Trebuchet MS",fill:"#DC143C",fontWeight:"700"},{id:93,text:"PERFECT MATCH",category:"Love",fontSize:24,fontFamily:"Arial",fontWeight:"bold",fill:"#FF69B4",hasBackground:!0,backgroundColor:"#000000"},{id:94,text:"Always & Forever",category:"Love",fontSize:28,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B0000",textAlign:"center"},{id:95,text:"ROMANCE",category:"Love",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493"},{id:96,text:"Love Never Fails",category:"Love",fontSize:24,fontFamily:"Palatino",fill:"#B22222",fontWeight:"600"},{id:97,text:"ETERNAL LOVE",category:"Love",fontSize:28,fontFamily:"Arial",fontWeight:"800",fill:"#DC143C",letterSpacing:1.5},{id:98,text:"Heart & Soul",category:"Love",fontSize:30,fontFamily:"Georgia",fill:"#8B0000",fontWeight:"bold"},{id:99,text:"PASSIONATE",category:"Love",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center"},{id:100,text:"Love Is Everything",category:"Love",fontSize:24,fontFamily:"Trebuchet MS",fill:"#FF1493",fontWeight:"700"},{id:101,text:"NO PAIN NO GAIN",category:"Sports",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center",hasBackground:!0,backgroundColor:"#000000"},{id:102,text:"Train Hard",category:"Sports",fontSize:32,fontFamily:"Arial",fontWeight:"900",fill:"#B22222"},{id:103,text:"CHAMPION MINDSET",category:"Sports",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#FFD700",hasBackground:!0,backgroundColor:"#000080"},{id:104,text:"Beast Mode ON",category:"Sports",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#32CD32"},{id:105,text:"STRONGER EVERY DAY",category:"Sports",fontSize:22,fontFamily:"Arial",fontWeight:"800",fill:"#2E8B57",letterSpacing:1},{id:106,text:"Victory Mindset",category:"Sports",fontSize:28,fontFamily:"Georgia",fontWeight:"bold",fill:"#B8860B"},{id:107,text:"GAME TIME",category:"Sports",fontSize:34,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493",textAlign:"center"},{id:108,text:"Push Your Limits",category:"Sports",fontSize:24,fontFamily:"Trebuchet MS",fill:"#4169E1",fontWeight:"700"},{id:109,text:"ATHLETIC EXCELLENCE",category:"Sports",fontSize:20,fontFamily:"Arial",fontWeight:"bold",fill:"#DC143C"},{id:110,text:"Fitness First",category:"Sports",fontSize:30,fontFamily:"Verdana",fontWeight:"bold",fill:"#228B22"},{id:111,text:"UNSTOPPABLE FORCE",category:"Sports",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",hasTextShadow:!0,textShadowX:3,textShadowY:3,textShadowBlur:6,textShadowColor:"#000000"},{id:112,text:"Sweat Equity",category:"Sports",fontSize:28,fontFamily:"Georgia",fill:"#8B4513",fontWeight:"700"},{id:113,text:"PERFORMANCE ZONE",category:"Sports",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:114,text:"Train Like A Champion",category:"Sports",fontSize:20,fontFamily:"Arial",fill:"#B22222",fontWeight:"600"},{id:115,text:"POWER WITHIN",category:"Sports",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF8C00",textAlign:"center"},{id:116,text:"Maximum Effort",category:"Sports",fontSize:26,fontFamily:"Verdana",fill:"#2E8B57",fontWeight:"800"},{id:117,text:"ELITE ATHLETE",category:"Sports",fontSize:28,fontFamily:"Arial",fontWeight:"900",fill:"#FFD700",hasBackground:!0,backgroundColor:"#8B0000"},{id:118,text:"Rise Above",category:"Sports",fontSize:30,fontFamily:"Georgia",fontWeight:"bold",fill:"#4169E1"},{id:119,text:"COMPETITIVE EDGE",category:"Sports",fontSize:22,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#DC143C"},{id:120,text:"Strength & Honor",category:"Sports",fontSize:26,fontFamily:"Impact",fill:"#2F4F4F",fontWeight:"bold"},{id:121,text:"WINNING ATTITUDE",category:"Sports",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#32CD32",letterSpacing:1.5},{id:122,text:"Never Give Up",category:"Sports",fontSize:32,fontFamily:"Verdana",fontWeight:"bold",fill:"#FF4500"},{id:123,text:"ENDURANCE",category:"Sports",fontSize:36,fontFamily:"Impact",fontWeight:"bold",fill:"#228B22",textAlign:"center"},{id:124,text:"Peak Performance",category:"Sports",fontSize:24,fontFamily:"Georgia",fill:"#B8860B",fontWeight:"700"},{id:125,text:"DEDICATION PAYS OFF",category:"Sports",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:126,text:"STYLE ICON",category:"Lifestyle",fontSize:30,fontFamily:"Palatino",fontWeight:"bold",fill:"#000000",hasBackground:!0,backgroundColor:"#FFD700"},{id:127,text:"Chic & Unique",category:"Lifestyle",fontSize:28,fontFamily:"Georgia",fontStyle:"italic",fill:"#FF1493"},{id:128,text:"TRENDSETTER",category:"Lifestyle",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#9370DB",textAlign:"center"},{id:129,text:"Fashion Forward",category:"Lifestyle",fontSize:24,fontFamily:"Trebuchet MS",fill:"#FF69B4",fontWeight:"600"},{id:130,text:"BOUTIQUE VIBES",category:"Lifestyle",fontSize:22,fontFamily:"Arial",fontWeight:"bold",fill:"#4169E1"},{id:131,text:"Effortlessly Elegant",category:"Lifestyle",fontSize:20,fontFamily:"Georgia",fontStyle:"italic",fill:"#2F4F4F"},{id:132,text:"LUXE LIFESTYLE",category:"Lifestyle",fontSize:28,fontFamily:"Palatino",fontWeight:"bold",fill:"#B8860B",letterSpacing:2},{id:133,text:"Vintage Soul",category:"Lifestyle",fontSize:32,fontFamily:"Georgia",fill:"#8B4513",fontWeight:"700"},{id:134,text:"MODERN CLASSIC",category:"Lifestyle",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#000000"},{id:135,text:"Street Style",category:"Lifestyle",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500"},{id:136,text:"SOPHISTICATED",category:"Lifestyle",fontSize:26,fontFamily:"Palatino",fontWeight:"bold",fill:"#2E8B57",hasBackground:!0,backgroundColor:"#F5F5F5"},{id:137,text:"Boho Chic",category:"Lifestyle",fontSize:28,fontFamily:"Georgia",fontStyle:"italic",fill:"#CD853F"},{id:138,text:"MINIMALIST",category:"Lifestyle",fontSize:32,fontFamily:"Arial",fontWeight:"300",fill:"#696969",letterSpacing:3},{id:139,text:"Glamorous Life",category:"Lifestyle",fontSize:24,fontFamily:"Trebuchet MS",fill:"#FFD700",fontWeight:"700"},{id:140,text:"HAUTE COUTURE",category:"Lifestyle",fontSize:22,fontFamily:"Palatino",fontWeight:"bold",fill:"#4B0082"},{id:141,text:"Urban Explorer",category:"Lifestyle",fontSize:26,fontFamily:"Impact",fill:"#32CD32",fontWeight:"bold"},{id:142,text:"AESTHETIC VIBES",category:"Lifestyle",fontSize:24,fontFamily:"Arial",fontWeight:"600",fill:"#FF69B4"},{id:143,text:"Lifestyle Goals",category:"Lifestyle",fontSize:28,fontFamily:"Georgia",fill:"#20B2AA",fontWeight:"600"},{id:144,text:"PREMIUM QUALITY",category:"Lifestyle",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#B22222"},{id:145,text:"Designer Dreams",category:"Lifestyle",fontSize:26,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:146,text:"CURATED STYLE",category:"Lifestyle",fontSize:24,fontFamily:"Arial",fontWeight:"700",fill:"#2F4F4F",letterSpacing:1},{id:147,text:"Fashion Statement",category:"Lifestyle",fontSize:22,fontFamily:"Georgia",fill:"#FF1493",fontWeight:"600"},{id:148,text:"ARTISAN CRAFTED",category:"Lifestyle",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#8B4513"},{id:149,text:"Timeless Elegance",category:"Lifestyle",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#000080"},{id:150,text:"SIGNATURE STYLE",category:"Lifestyle",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",textAlign:"center"},{id:151,text:"HAPPY BIRTHDAY",category:"Holidays",fontSize:32,fontFamily:"Comic Sans MS",fontWeight:"bold",fill:"#FF69B4",hasBackground:!0,backgroundColor:"#FFFF00",textAlign:"center"},{id:152,text:"Merry Christmas",category:"Holidays",fontSize:30,fontFamily:"Georgia",fill:"#B22222",fontWeight:"700",hasTextShadow:!0,textShadowX:2,textShadowY:2,textShadowBlur:4,textShadowColor:"#228B22"},{id:153,text:"CELEBRATION TIME",category:"Holidays",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700"},{id:154,text:"Happy New Year",category:"Holidays",fontSize:26,fontFamily:"Trebuchet MS",fill:"#4169E1",fontWeight:"700"},{id:155,text:"THANKFUL HEART",category:"Holidays",fontSize:24,fontFamily:"Georgia",fontWeight:"bold",fill:"#FF8C00",textAlign:"center"},{id:156,text:"Easter Blessings",category:"Holidays",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:157,text:"PARTY TIME",category:"Holidays",fontSize:34,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493",hasBackground:!0,backgroundColor:"#000000"},{id:158,text:"Halloween Spirit",category:"Holidays",fontSize:26,fontFamily:"Arial",fontWeight:"800",fill:"#FF4500"},{id:159,text:"FESTIVE MOOD",category:"Holidays",fontSize:30,fontFamily:"Georgia",fontWeight:"bold",fill:"#32CD32"},{id:160,text:"Valentine's Day",category:"Holidays",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#DC143C"},{id:161,text:"ANNIVERSARY JOY",category:"Holidays",fontSize:"22",fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#B8860B"},{id:162,text:"Graduation Day",category:"Holidays",fontSize:28,fontFamily:"Arial",fill:"#000080",fontWeight:"700"},{id:163,text:"SUMMER VIBES",category:"Holidays",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",textAlign:"center"},{id:164,text:"Winter Wonderland",category:"Holidays",fontSize:20,fontFamily:"Georgia",fill:"#4169E1",fontWeight:"600"},{id:165,text:"MOTHER'S DAY LOVE",category:"Holidays",fontSize:22,fontFamily:"Palatino",fontWeight:"bold",fill:"#FF69B4"},{id:166,text:"Father's Day Hero",category:"Holidays",fontSize:24,fontFamily:"Arial",fill:"#2F4F4F",fontWeight:"700"},{id:167,text:"SPRING AWAKENING",category:"Holidays",fontSize:26,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#32CD32"},{id:168,text:"Holiday Magic",category:"Holidays",fontSize:30,fontFamily:"Georgia",fontStyle:"italic",fill:"#9370DB"},{id:169,text:"FAMILY GATHERING",category:"Holidays",fontSize:20,fontFamily:"Arial",fontWeight:"600",fill:"#8B4513"},{id:170,text:"Wedding Bliss",category:"Holidays",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#FFD700"},{id:171,text:"FIREWORKS NIGHT",category:"Holidays",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500"},{id:172,text:"Autumn Leaves",category:"Holidays",fontSize:26,fontFamily:"Georgia",fill:"#D2691E",fontWeight:"600"},{id:173,text:"MILESTONE MOMENT",category:"Holidays",fontSize:22,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:174,text:"Special Occasion",category:"Holidays",fontSize:24,fontFamily:"Arial",fill:"#B22222",fontWeight:"700"},{id:175,text:"CHEERS TO LIFE",category:"Holidays",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#20B2AA",textAlign:"center"},{id:176,text:'"Life is Beautiful"',category:"Quotes",fontSize:26,fontFamily:"Georgia",fontStyle:"italic",fill:"#2E8B57",textAlign:"center"},{id:177,text:"CARPE DIEM",category:"Quotes",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#B8860B",letterSpacing:2},{id:178,text:'"Choose Happiness"',category:"Quotes",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#FF69B4"},{id:179,text:"LIVE LAUGH LOVE",category:"Quotes",fontSize:24,fontFamily:"Arial",fontWeight:"600",fill:"#DC143C",textAlign:"center"},{id:180,text:'"Dream Without Fear"',category:"Quotes",fontSize:22,fontFamily:"Georgia",fontStyle:"italic",fill:"#4169E1"},{id:181,text:"WISDOM WITHIN",category:"Quotes",fontSize:28,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#2F4F4F"},{id:182,text:'"Create Your Story"',category:"Quotes",fontSize:20,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:183,text:"INNER PEACE",category:"Quotes",fontSize:30,fontFamily:"Arial",fontWeight:"300",fill:"#20B2AA",letterSpacing:3},{id:184,text:'"Follow Your Heart"',category:"Quotes",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#FF1493"},{id:185,text:"GRATITUDE DAILY",category:"Quotes",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FF8C00"},{id:186,text:'"Embrace Change"',category:"Quotes",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#32CD32"},{id:187,text:"MINDFUL LIVING",category:"Quotes",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"600",fill:"#4B0082"},{id:188,text:'"Stay Curious"',category:"Quotes",fontSize:30,fontFamily:"Georgia",fontStyle:"italic",fill:"#B22222"},{id:189,text:"PURPOSE DRIVEN",category:"Quotes",fontSize:28,fontFamily:"Arial",fontWeight:"700",fill:"#8B4513"},{id:190,text:'"Find Your Why"',category:"Quotes",fontSize:26,fontFamily:"Palatino",fontStyle:"italic",fill:"#CD853F"},{id:191,text:"AUTHENTIC SELF",category:"Quotes",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500"},{id:192,text:'"Less is More"',category:"Quotes",fontSize:32,fontFamily:"Arial",fontWeight:"300",fill:"#696969",letterSpacing:2},{id:193,text:"PRESENT MOMENT",category:"Quotes",fontSize:26,fontFamily:"Georgia",fontWeight:"600",fill:"#2E8B57"},{id:194,text:'"Trust The Process"',category:"Quotes",fontSize:22,fontFamily:"Palatino",fontStyle:"italic",fill:"#4169E1"},{id:195,text:"BALANCED LIFE",category:"Quotes",fontSize:28,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#20B2AA"},{id:196,text:'"Spread Kindness"',category:"Quotes",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#FF69B4"},{id:197,text:"GROWTH MINDSET",category:"Quotes",fontSize:26,fontFamily:"Arial",fontWeight:"700",fill:"#32CD32"},{id:198,text:'"Be The Change"',category:"Quotes",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:199,text:"INFINITE POSSIBILITIES",category:"Quotes",fontSize:20,fontFamily:"Impact",fontWeight:"bold",fill:"#B8860B"},{id:200,text:'"Leave Your Mark"',category:"Quotes",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B0000",textAlign:"center"},{id:201,text:"OPEN",category:"Signage",fontSize:44,fontFamily:"Bebas Neue",fill:"#111827",textAlign:"center",letterSpacing:6},{id:202,text:"EST. 2024",category:"Signage",fontSize:34,fontFamily:"Staatliches",fill:"#374151",textAlign:"center",letterSpacing:3},{id:203,text:"VINTAGE",category:"Signage",fontSize:36,fontFamily:"Alfa Slab One",fill:"#6d4c41",textAlign:"center"},{id:204,text:"MARKET",category:"Signage",fontSize:38,fontFamily:"Anton",fill:"#1f2937",textAlign:"center",letterSpacing:8},{id:205,text:"WELCOME",category:"Signage",fontSize:40,fontFamily:"Bebas Neue",fill:"#0f766e",textAlign:"center",letterSpacing:5},{id:206,text:"OFF DUTY",category:"Streetwear",fontSize:38,fontFamily:"Archivo Black",fill:"#111827",textAlign:"center"},{id:207,text:"STAY HUMBLE",category:"Streetwear",fontSize:30,fontFamily:"Bebas Neue",fill:"#e11d48",textAlign:"center",letterSpacing:4},{id:208,text:"NO RULES",category:"Streetwear",fontSize:34,fontFamily:"Bungee",fill:"#7c3aed",textAlign:"center"},{id:209,text:"HYPE",category:"Streetwear",fontSize:44,fontFamily:"Titan One",fill:"#f59e0b",textAlign:"center"},{id:210,text:"BORN TO STAND OUT",category:"Streetwear",fontSize:24,fontFamily:"Anton",fill:"#111827",textAlign:"center",letterSpacing:2},{id:211,text:"Forever & Always",category:"Wedding",fontSize:38,fontFamily:"Great Vibes",fill:"#9d174d",textAlign:"center"},{id:212,text:"Mr & Mrs",category:"Wedding",fontSize:44,fontFamily:"Great Vibes",fill:"#3f3f46",textAlign:"center"},{id:213,text:"Just Married",category:"Wedding",fontSize:36,fontFamily:"Pacifico",fill:"#be123c",textAlign:"center"},{id:214,text:"Save the Date",category:"Wedding",fontSize:34,fontFamily:"Dancing Script",fontWeight:"700",fill:"#1f2937",textAlign:"center"},{id:215,text:"A",category:"Monogram",fontSize:72,fontFamily:"Playfair Display",fontWeight:"700",fill:"#1f2937",textAlign:"center"},{id:216,text:"M & J",category:"Monogram",fontSize:44,fontFamily:"Great Vibes",fill:"#7c2d12",textAlign:"center"},{id:217,text:"EST. YOU",category:"Monogram",fontSize:30,fontFamily:"Staatliches",fill:"#111827",textAlign:"center",letterSpacing:4},{id:218,text:"RETRO",category:"Retro",fontSize:40,fontFamily:"Bungee Inline",fill:"#0ea5e9",textAlign:"center"},{id:219,text:"Sunset Vibes",category:"Retro",fontSize:36,fontFamily:"Lobster",fill:"#ea580c",textAlign:"center"},{id:220,text:"Good Times",category:"Retro",fontSize:36,fontFamily:"Pacifico",fill:"#b45309",textAlign:"center"},{id:221,text:"CLASSIC",category:"Retro",fontSize:34,fontFamily:"Playfair Display",fontStyle:"italic",fontWeight:"700",fill:"#3f3f46",textAlign:"center",letterSpacing:3},{id:222,text:"ADVENTURE AWAITS",category:"Outdoors",fontSize:24,fontFamily:"Oswald",fontWeight:"700",fill:"#166534",textAlign:"center",letterSpacing:3},{id:223,text:"Wander",category:"Outdoors",fontSize:44,fontFamily:"Sacramento",fill:"#065f46",textAlign:"center"},{id:224,text:"MOUNTAIN TIME",category:"Outdoors",fontSize:28,fontFamily:"Bebas Neue",fill:"#0c4a6e",textAlign:"center",letterSpacing:3},{id:225,text:"Explore More",category:"Outdoors",fontSize:34,fontFamily:"Caveat",fontWeight:"700",fill:"#7c2d12",textAlign:"center"},{id:226,text:"Blessed",category:"Faith",fontSize:44,fontFamily:"Great Vibes",fill:"#6d28d9",textAlign:"center"},{id:227,text:"FAITH",category:"Faith",fontSize:40,fontFamily:"Staatliches",fill:"#1e3a8a",textAlign:"center",letterSpacing:4},{id:228,text:"Grateful",category:"Faith",fontSize:38,fontFamily:"Dancing Script",fontWeight:"700",fill:"#9a3412",textAlign:"center"},{id:229,text:"But First, Coffee",category:"Foodie",fontSize:30,fontFamily:"Pacifico",fill:"#5b3a29",textAlign:"center"},{id:230,text:"Taco Tuesday",category:"Foodie",fontSize:34,fontFamily:"Lobster",fill:"#ca8a04",textAlign:"center"},{id:231,text:"FRESH",category:"Foodie",fontSize:42,fontFamily:"Anton",fill:"#15803d",textAlign:"center",letterSpacing:2},{id:232,text:"Birthday Squad",category:"Kids",fontSize:32,fontFamily:"Caveat",fontWeight:"700",fill:"#db2777",textAlign:"center"},{id:233,text:"Party Time",category:"Kids",fontSize:36,fontFamily:"Pacifico",fill:"#7c3aed",textAlign:"center"},{id:234,text:"Little Legend",category:"Kids",fontSize:34,fontFamily:"Dancing Script",fontWeight:"700",fill:"#2563eb",textAlign:"center"},{id:235,text:"The Family",category:"Family",fontSize:40,fontFamily:"Great Vibes",fill:"#3f3f46",textAlign:"center"},{id:236,text:"Family",category:"Family",fontSize:46,fontFamily:"Sacramento",fill:"#9a3412",textAlign:"center"},{id:237,text:"HOME",category:"Family",fontSize:40,fontFamily:"Alfa Slab One",fill:"#374151",textAlign:"center",letterSpacing:6},{id:238,text:"Gather",category:"Family",fontSize:40,fontFamily:"Playfair Display",fontStyle:"italic",fontWeight:"700",fill:"#1f2937",textAlign:"center"},{id:239,text:"GOOD VIBES",category:"Music",fontSize:34,fontFamily:"Bebas Neue",fill:"#0891b2",textAlign:"center",letterSpacing:4},{id:240,text:"On Repeat",category:"Music",fontSize:36,fontFamily:"Lobster",fill:"#7c3aed",textAlign:"center"},{id:241,text:"GAME OVER",category:"Gaming",fontSize:34,fontFamily:"Bungee",fill:"#dc2626",textAlign:"center"},{id:242,text:"PLAYER ONE",category:"Gaming",fontSize:32,fontFamily:"Squada One",fill:"#16a34a",textAlign:"center",letterSpacing:2},{id:243,text:"CHAMPIONS",category:"Sports",fontSize:30,fontFamily:"Anton",fill:"#b45309",textAlign:"center",letterSpacing:4},{id:244,text:"TEAM SPIRIT",category:"Sports",fontSize:30,fontFamily:"Bebas Neue",fill:"#1d4ed8",textAlign:"center",letterSpacing:3},{id:245,text:"Dream Big",category:"Motivational",fontSize:40,fontFamily:"Pacifico",fill:"#db2777",textAlign:"center"},{id:246,text:"Hustle",category:"Motivational",fontSize:44,fontFamily:"Alfa Slab One",fill:"#111827",textAlign:"center"},{id:247,text:"Good Vibes Only",category:"Motivational",fontSize:34,fontFamily:"Dancing Script",fontWeight:"700",fill:"#0d9488",textAlign:"center"},{id:248,text:"BOLD",category:"Motivational",fontSize:46,fontFamily:"Bungee",fill:"#ea580c",textAlign:"center"},{id:249,text:"Love You More",category:"Love",fontSize:38,fontFamily:"Great Vibes",fill:"#be123c",textAlign:"center"},{id:250,text:"xoxo",category:"Love",fontSize:48,fontFamily:"Sacramento",fill:"#db2777",textAlign:"center"},{id:251,text:"Bonjour",category:"Calligraphy",fontSize:46,fontFamily:"Great Vibes",fill:"#1f2937",textAlign:"center"},{id:252,text:"Forever & Always",category:"Calligraphy",fontSize:40,fontFamily:"Allura",fill:"#be123c",textAlign:"center"},{id:253,text:"Cheers",category:"Calligraphy",fontSize:48,fontFamily:"Parisienne",fill:"#0f766e",textAlign:"center"},{id:254,text:"Sweet Dreams",category:"Calligraphy",fontSize:42,fontFamily:"Tangerine",fontWeight:"700",fill:"#7c3aed",textAlign:"center"},{id:255,text:"Hello Gorgeous",category:"Calligraphy",fontSize:38,fontFamily:"Dancing Script",fontWeight:"700",fill:"#db2777",textAlign:"center"},{id:256,text:"Stay Wild",category:"Calligraphy",fontSize:42,fontFamily:"Sacramento",fill:"#16a34a",textAlign:"center"},{id:257,text:"Adventure Awaits",category:"Calligraphy",fontSize:34,fontFamily:"Satisfy",fill:"#1d4ed8",textAlign:"center"},{id:258,text:"Handcrafted",category:"Calligraphy",fontSize:36,fontFamily:"Kaushan Script",fill:"#b45309",textAlign:"center"},{id:259,text:"Just Married",category:"Calligraphy",fontSize:42,fontFamily:"Great Vibes",fill:"#9d174d",textAlign:"center"},{id:260,text:"Celebrate",category:"Calligraphy",fontSize:40,fontFamily:"Yellowtail",fill:"#c026d3",textAlign:"center"},{id:261,text:"With Love",category:"Calligraphy",fontSize:44,fontFamily:"Cookie",fill:"#e11d48",textAlign:"center"},{id:262,text:"Wanderlust",category:"Calligraphy",fontSize:38,fontFamily:"Marck Script",fill:"#0891b2",textAlign:"center"},{id:263,text:"Grateful",category:"Calligraphy",fontSize:44,fontFamily:"Pacifico",fill:"#ea580c",textAlign:"center"},{id:264,text:"Magnifique",category:"Calligraphy",fontSize:40,fontFamily:"Allura",fill:"#4338ca",textAlign:"center"},{id:265,text:"Bloom",category:"Calligraphy",fontSize:52,fontFamily:"Parisienne",fill:"#db2777",textAlign:"center"},{id:266,text:"Bella Vita",category:"Calligraphy",fontSize:42,fontFamily:"Satisfy",fill:"#0d9488",textAlign:"center"}],He=["Arial","Helvetica","Times New Roman","Georgia","Verdana","Courier New","Tahoma","Trebuchet MS","Impact","Comic Sans MS"],Ki=new Set(He),Be=[{name:"System",fonts:He},{name:"Signage & Display",fonts:["Bebas Neue","Anton","Oswald","Archivo Black","Teko","Fjalla One","Saira Condensed","Squada One","Staatliches","Passion One","Alfa Slab One","Titan One","Bowlby One SC","Bungee","Bungee Inline"]},{name:"Sans Serif",fonts:["Roboto","Open Sans","Montserrat","Lato","Poppins","Inter","Raleway","Work Sans","Nunito","Rubik","Barlow","Kanit","Mukta"]},{name:"Serif",fonts:["Merriweather","Playfair Display","Lora","PT Serif","Cormorant Garamond","Libre Baskerville","EB Garamond","Crimson Text","Bitter"]},{name:"Slab Serif",fonts:["Roboto Slab","Arvo","Zilla Slab","Josefin Slab"]},{name:"Script & Handwriting",fonts:["Dancing Script","Pacifico","Great Vibes","Satisfy","Sacramento","Caveat","Kaushan Script","Lobster","Cookie","Allura","Parisienne","Yellowtail","Tangerine","Marck Script","Shadows Into Light","Permanent Marker","Homemade Apple"]},{name:"Decorative & Stencil",fonts:["Black Ops One","Stardos Stencil","Special Elite","Monoton","Faster One","Press Start 2P","Creepster","Righteous","Audiowide","Orbitron","Russo One","Wallpoet"]},{name:"Monospace",fonts:["Roboto Mono","Source Code Pro","JetBrains Mono","Space Mono","IBM Plex Mono"]}],ui=Be.reduce((s,a)=>s.concat(a.fonts),[]),ta=s=>Ki.has(s),ea="https://fonts.googleapis.com/css2",li=new Set(He),ia=s=>`family=${s.trim().replace(/\s+/g,"+")}:wght@400;700`,xe=s=>{if(typeof document>"u")return;const a=(s||[]).filter(n=>n&&!li.has(n));if(a.length===0)return;const o=10;for(let n=0;n<a.length;n+=o){const l=a.slice(n,n+o),c=document.createElement("link");c.rel="stylesheet",c.href=`${ea}?${l.map(ia).join("&")}&display=swap`,c.setAttribute("data-simplex-font","1"),document.head.appendChild(c),l.forEach(d=>li.add(d))}},mi=async s=>{if(!(!s||ta(s))&&(xe([s]),!(typeof document>"u"||!document.fonts||!document.fonts.load)))try{await Promise.all([document.fonts.load(`400 24px "${s}"`),document.fonts.load(`700 24px "${s}"`)])}catch{}},$e=async s=>{const a=Array.from(new Set((s||[]).filter(Boolean)));await Promise.all(a.map(mi))},Pe={business:{name:"Business & Office",icons:[{name:"briefcase",symbol:"💼",unicode:"💼"},{name:"chart-up",symbol:"📈",unicode:"📈"},{name:"chart-down",symbol:"📉",unicode:"📉"},{name:"graph",symbol:"📊",unicode:"📊"},{name:"clipboard",symbol:"📋",unicode:"📋"},{name:"calendar",symbol:"📅",unicode:"📅"},{name:"office",symbol:"🏢",unicode:"🏢"},{name:"bank",symbol:"🏦",unicode:"🏦"},{name:"money-bag",symbol:"💰",unicode:"💰"},{name:"credit-card",symbol:"💳",unicode:"💳"}]},technology:{name:"Technology",icons:[{name:"laptop",symbol:"💻",unicode:"💻"},{name:"phone",symbol:"📱",unicode:"📱"},{name:"desktop",symbol:"🖥️",unicode:"🖥️"},{name:"keyboard",symbol:"⌨️",unicode:"⌨️"},{name:"mouse",symbol:"🖱️",unicode:"🖱️"},{name:"printer",symbol:"🖨️",unicode:"🖨️"},{name:"wifi",symbol:"📶",unicode:"📶"},{name:"battery",symbol:"🔋",unicode:"🔋"},{name:"plug",symbol:"🔌",unicode:"🔌"},{name:"gear",symbol:"⚙️",unicode:"⚙️"}]},communication:{name:"Communication",icons:[{name:"email",symbol:"📧",unicode:"📧"},{name:"envelope",symbol:"✉️",unicode:"✉️"},{name:"phone-call",symbol:"📞",unicode:"📞"},{name:"message",symbol:"💬",unicode:"💬"},{name:"announcement",symbol:"📢",unicode:"📢"},{name:"megaphone",symbol:"📣",unicode:"📣"},{name:"satellite",symbol:"📡",unicode:"📡"},{name:"radio",symbol:"📻",unicode:"📻"},{name:"microphone",symbol:"🎤",unicode:"🎤"},{name:"speaker",symbol:"🔊",unicode:"🔊"}]},transport:{name:"Transportation",icons:[{name:"car",symbol:"🚗",unicode:"🚗"},{name:"truck",symbol:"🚛",unicode:"🚛"},{name:"bus",symbol:"🚌",unicode:"🚌"},{name:"airplane",symbol:"✈️",unicode:"✈️"},{name:"train",symbol:"🚆",unicode:"🚆"},{name:"ship",symbol:"🚢",unicode:"🚢"},{name:"bicycle",symbol:"🚴",unicode:"🚴"},{name:"motorcycle",symbol:"🏍️",unicode:"🏍️"},{name:"taxi",symbol:"🚕",unicode:"🚕"},{name:"rocket",symbol:"🚀",unicode:"🚀"}]},nature:{name:"Nature & Environment",icons:[{name:"tree",symbol:"🌳",unicode:"🌳"},{name:"leaf",symbol:"🍃",unicode:"🍃"},{name:"flower",symbol:"🌸",unicode:"🌸"},{name:"sun",symbol:"☀️",unicode:"☀️"},{name:"moon",symbol:"🌙",unicode:"🌙"},{name:"star",symbol:"⭐",unicode:"⭐"},{name:"cloud",symbol:"☁️",unicode:"☁️"},{name:"rainbow",symbol:"🌈",unicode:"🌈"},{name:"mountain",symbol:"⛰️",unicode:"⛰️"},{name:"globe",symbol:"🌍",unicode:"🌍"}]},symbols:{name:"Symbols & Signs",icons:[{name:"check",symbol:"✅",unicode:"✅"},{name:"cross",symbol:"❌",unicode:"❌"},{name:"warning",symbol:"⚠️",unicode:"⚠️"},{name:"info",symbol:"ℹ️",unicode:"ℹ️"},{name:"question",symbol:"❓",unicode:"❓"},{name:"exclamation",symbol:"❗",unicode:"❗"},{name:"lock",symbol:"🔒",unicode:"🔒"},{name:"unlock",symbol:"🔓",unicode:"🔓"},{name:"key",symbol:"🔑",unicode:"🔑"},{name:"shield",symbol:"🛡️",unicode:"🛡️"}]}},pi=()=>Object.values(Pe).flatMap(s=>s.icons.map(a=>({...a,category:s.name}))),aa=s=>pi().filter(o=>o.name.toLowerCase().includes(s.toLowerCase())||o.category.toLowerCase().includes(s.toLowerCase())),oa=({onSelectIcon:s,disabled:a=!1})=>{const[o,n]=f.useState(!1),[l,c]=f.useState(""),[d,y]=f.useState("all"),x=f.useRef(null);f.useEffect(()=>{const m=M=>{x.current&&!x.current.contains(M.target)&&n(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const F=m=>{s(m),n(!1),c("")},j=(()=>{let m=pi();if(l.trim()&&(m=aa(l)),d!=="all"){const M=Pe[d];M&&(m=m.filter(z=>z.category===M.name))}return m})();return t.jsxs("div",{className:"icon-selector",ref:x,children:[t.jsxs("button",{className:"toolbar-btn dropdown-trigger",disabled:a,onClick:()=>n(!o),title:"Add Icon",children:[t.jsx("span",{className:"icon",children:"🎯"}),t.jsx("span",{className:"label",children:"Icons"}),t.jsx("span",{className:"dropdown-arrow",children:"▼"})]}),o&&t.jsxs("div",{className:"icon-dropdown",children:[t.jsxs("div",{className:"icon-dropdown-header",children:[t.jsx("input",{type:"text",placeholder:"Search icons...",value:l,onChange:m=>c(m.target.value),className:"icon-search"}),t.jsxs("select",{value:d,onChange:m=>y(m.target.value),className:"category-select",children:[t.jsx("option",{value:"all",children:"All Categories"}),Object.entries(Pe).map(([m,M])=>t.jsx("option",{value:m,children:M.name},m))]})]}),t.jsx("div",{className:"icon-grid",children:j.length===0?t.jsx("div",{className:"no-icons",children:l?"No icons found":"No icons in this category"}):j.map((m,M)=>t.jsxs("button",{className:"icon-item",onClick:()=>F(m),title:`${m.name} (${m.category})`,children:[t.jsx("span",{className:"icon-symbol",children:m.symbol}),t.jsx("span",{className:"icon-name",children:m.name})]},`${m.name}-${M}`))}),t.jsx("div",{className:"icon-dropdown-footer",children:t.jsxs("span",{className:"icon-count",children:[j.length," icon",j.length!==1?"s":""]})})]})]})},ra=({isOpen:s,onClose:a,onAddQRCode:o,theme:n})=>{const[l,c]=f.useState(""),[d,y]=f.useState(""),[x,F]=f.useState(200),[w,j]=f.useState("M"),m=()=>{if(!l.trim())return;const R={width:x,errorCorrectionLevel:w,type:"image/png",quality:.92,margin:1,color:{dark:"#000000",light:"#FFFFFF"}};qi.toDataURL(l,R,(p,T)=>{if(p){console.error("QR Code generation error:",p);return}y(T)})},M=()=>{if(!d)return;const R=new Image;R.onload=()=>{o({type:"qrcode",src:d,data:l,width:x,height:x,x:100,y:100,imageObject:R}),z()},R.src=d},z=()=>{c(""),y(""),a()};return s?t.jsx("div",{className:"qr-modal-overlay",onClick:z,children:t.jsxs("div",{className:"qr-modal-content",onClick:R=>R.stopPropagation(),children:[t.jsxs("div",{className:"qr-modal-header",children:[t.jsx("h3",{children:"Generate QR Code"}),t.jsx("button",{className:"qr-modal-close",onClick:z,"aria-label":"Close",children:"×"})]}),t.jsxs("div",{className:"qr-modal-body",children:[t.jsxs("div",{className:"qr-form-group",children:[t.jsx("label",{htmlFor:"qr-data",children:"Enter Data (URL, Text, etc.)"}),t.jsx("textarea",{id:"qr-data",value:l,onChange:R=>c(R.target.value),placeholder:"https://example.com or any text...",rows:3})]}),t.jsxs("div",{className:"qr-options",children:[t.jsxs("div",{className:"qr-form-group",children:[t.jsx("label",{htmlFor:"qr-size",children:"Size (px)"}),t.jsx("input",{type:"number",id:"qr-size",value:x,onChange:R=>F(Math.max(50,Math.min(500,parseInt(R.target.value)||200))),min:"50",max:"500"})]}),t.jsxs("div",{className:"qr-form-group",children:[t.jsx("label",{htmlFor:"qr-error-level",children:"Error Correction"}),t.jsxs("select",{id:"qr-error-level",value:w,onChange:R=>j(R.target.value),children:[t.jsx("option",{value:"L",children:"Low (7%)"}),t.jsx("option",{value:"M",children:"Medium (15%)"}),t.jsx("option",{value:"Q",children:"Quartile (25%)"}),t.jsx("option",{value:"H",children:"High (30%)"})]})]})]}),t.jsx("div",{className:"qr-actions",children:t.jsx("button",{className:"qr-btn qr-btn-generate",onClick:m,disabled:!l.trim(),children:"Generate QR Code"})}),d&&t.jsxs("div",{className:"qr-preview",children:[t.jsx("h4",{children:"Preview"}),t.jsx("div",{className:"qr-preview-container",children:t.jsx("img",{src:d,alt:"QR Code Preview"})}),t.jsx("button",{className:"qr-btn qr-btn-add",onClick:M,style:{backgroundColor:(n==null?void 0:n.primaryColor)||"#3b82f6",borderColor:(n==null?void 0:n.primaryColor)||"#3b82f6"},children:"Add to Canvas"})]})]})]})}):null},sa=({isOpen:s,onClose:a,onAddBarcode:o,theme:n})=>{const[l,c]=f.useState(""),[d,y]=f.useState("CODE128"),[x,F]=f.useState(null),[w,j]=f.useState(2),[m,M]=f.useState(100),[z,R]=f.useState(20),[p,T]=f.useState("center"),[g,q]=f.useState("bottom"),[E,tt]=f.useState(10),K=f.useRef(null),it=[{value:"CODE128",label:"CODE128 (Most Common)"},{value:"EAN13",label:"EAN-13 (European Article Number)"},{value:"EAN8",label:"EAN-8 (Short EAN)"},{value:"UPC",label:"UPC (Universal Product Code)"},{value:"CODE39",label:"CODE39 (Alpha-numeric)"},{value:"ITF14",label:"ITF-14 (Shipping/Logistics)"},{value:"MSI",label:"MSI (Retail)"},{value:"pharmacode",label:"Pharmacode (Pharmaceutical)"},{value:"codabar",label:"Codabar (Libraries/Blood banks)"}],st=()=>{if(l.trim())try{F(t.jsx(Xi,{value:l,format:d,width:w,height:m,fontSize:z,textAlign:p,textPosition:g,margin:E,background:"#ffffff",lineColor:"#000000"}))}catch(k){console.error("Barcode generation error:",k),alert("Invalid data for selected barcode format. Please check your input.")}},yt=()=>{var k,H,W,N;if(!(!x||!K.current))try{const B=K.current.querySelector("svg");if(!B){console.error("No SVG element found in barcode");return}const G=document.createElement("canvas"),P=G.getContext("2d"),ct=B.getBoundingClientRect(),b=((H=(k=B.width)==null?void 0:k.baseVal)==null?void 0:H.value)||ct.width||200,D=((N=(W=B.height)==null?void 0:W.baseVal)==null?void 0:N.value)||ct.height||100;G.width=b,G.height=D;const Y=new XMLSerializer().serializeToString(B),ot=new Blob([Y],{type:"image/svg+xml;charset=utf-8"}),nt=URL.createObjectURL(ot),ht=new Image;ht.onload=()=>{P.drawImage(ht,0,0);const ft=G.toDataURL("image/png"),vt=new Image;vt.onload=()=>{o({type:"barcode",src:ft,data:l,format:d,width:b,height:D,x:100,y:100,imageObject:vt}),$()},vt.src=ft,URL.revokeObjectURL(nt)},ht.src=nt}catch(B){console.error("Error adding barcode to canvas:",B),alert("Failed to add barcode to canvas. Please try again.")}},$=()=>{c(""),F(null),y("CODE128"),j(2),M(100),R(20),a()},U=k=>({CODE128:"Supports all ASCII characters. Most versatile format.",EAN13:"Requires exactly 12 digits (13th is checksum). Used for retail products.",EAN8:"Requires exactly 7 digits (8th is checksum). Compact version of EAN-13.",UPC:"Requires exactly 11 digits (12th is checksum). Used in North America.",CODE39:"Supports letters, numbers, and some symbols. Widely used.",ITF14:"Requires exactly 13 digits (14th is checksum). Used for shipping containers.",MSI:"Numeric only. Used in retail inventory.",pharmacode:"Numbers 3-131070. Used in pharmaceutical industry.",codabar:"Supports 0-9, A-D, and symbols. Used in libraries."})[k]||"";return s?t.jsx("div",{className:"barcode-modal-overlay",onClick:$,children:t.jsxs("div",{className:"barcode-modal-content",onClick:k=>k.stopPropagation(),children:[t.jsxs("div",{className:"barcode-modal-header",children:[t.jsx("h3",{children:"Generate Barcode"}),t.jsx("button",{className:"barcode-modal-close",onClick:$,"aria-label":"Close",children:"×"})]}),t.jsxs("div",{className:"barcode-modal-body",children:[t.jsxs("div",{className:"barcode-form-group",children:[t.jsx("label",{htmlFor:"barcode-data",children:"Enter Data"}),t.jsx("input",{type:"text",id:"barcode-data",value:l,onChange:k=>c(k.target.value),placeholder:"Enter your data..."})]}),t.jsxs("div",{className:"barcode-form-group",children:[t.jsx("label",{htmlFor:"barcode-format",children:"Barcode Format"}),t.jsx("select",{id:"barcode-format",value:d,onChange:k=>y(k.target.value),children:it.map(k=>t.jsx("option",{value:k.value,children:k.label},k.value))}),t.jsx("small",{className:"format-description",children:U(d)})]}),t.jsxs("div",{className:"barcode-options",children:[t.jsxs("div",{className:"barcode-form-group",children:[t.jsx("label",{htmlFor:"barcode-width",children:"Bar Width"}),t.jsx("input",{type:"range",id:"barcode-width",min:"1",max:"4",step:"0.5",value:w,onChange:k=>j(parseFloat(k.target.value))}),t.jsxs("span",{className:"range-value",children:[w,"px"]})]}),t.jsxs("div",{className:"barcode-form-group",children:[t.jsx("label",{htmlFor:"barcode-height",children:"Height"}),t.jsx("input",{type:"range",id:"barcode-height",min:"50",max:"200",value:m,onChange:k=>M(parseInt(k.target.value))}),t.jsxs("span",{className:"range-value",children:[m,"px"]})]}),t.jsxs("div",{className:"barcode-form-group",children:[t.jsx("label",{htmlFor:"barcode-fontsize",children:"Font Size"}),t.jsx("input",{type:"range",id:"barcode-fontsize",min:"10",max:"30",value:z,onChange:k=>R(parseInt(k.target.value))}),t.jsxs("span",{className:"range-value",children:[z,"px"]})]}),t.jsxs("div",{className:"barcode-form-group",children:[t.jsx("label",{htmlFor:"text-position",children:"Text Position"}),t.jsxs("select",{id:"text-position",value:g,onChange:k=>q(k.target.value),children:[t.jsx("option",{value:"bottom",children:"Bottom"}),t.jsx("option",{value:"top",children:"Top"})]})]})]}),t.jsx("div",{className:"barcode-actions",children:t.jsx("button",{className:"barcode-btn barcode-btn-generate",onClick:st,disabled:!l.trim(),children:"Generate Barcode"})}),x&&t.jsxs("div",{className:"barcode-preview",children:[t.jsx("h4",{children:"Preview"}),t.jsx("div",{className:"barcode-preview-container",ref:K,children:x}),t.jsx("button",{className:"barcode-btn barcode-btn-add",onClick:yt,style:{backgroundColor:(n==null?void 0:n.primaryColor)||"#3b82f6",borderColor:(n==null?void 0:n.primaryColor)||"#3b82f6"},children:"Add to Canvas"})]})]})]})}):null},na=({theme:s})=>t.jsxs("div",{className:"premium-feature-container",style:{padding:"20px",backgroundColor:"#f8f9fa",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.05)",textAlign:"center",maxWidth:"400px",margin:"0 auto"},children:[t.jsx("div",{style:{marginBottom:"16px"},children:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"#ffc107"},children:[t.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),t.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]})}),t.jsx("h3",{style:{color:"#333",fontSize:"18px",fontWeight:"600",marginBottom:"12px"},children:"Premium Feature Access"}),t.jsx("p",{style:{color:"#555",fontSize:"15px",lineHeight:"1.5",marginBottom:"20px"},children:"Premium stickers feature requires a subscription to access."}),t.jsx("a",{href:"https://mypixia.com/developer",target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:(s==null?void 0:s.primaryColor)||"#4c5bf2",color:"white",padding:"10px 20px",borderRadius:"4px",textDecoration:"none",fontWeight:"500",transition:"background-color 0.2s ease"},children:"Get API Key"})]}),ci=()=>t.jsxs("div",{style:{textAlign:"center",padding:"40px"},children:[t.jsx("div",{style:{border:"4px solid #f3f3f3",borderTop:"4px solid #3498db",borderRadius:"50%",width:"40px",height:"40px",animation:"spin 2s linear infinite",margin:"0 auto 20px"}}),t.jsx("p",{children:"Loading..."}),t.jsx("style",{children:`
22
+ <%s key={someKey} {...props} />`,at,pt,jt,pt),P[pt+at]=!0)}if(pt=null,_!==void 0&&(s(_),pt=""+_),f(A)&&(s(A.key),pt=""+A.key),"key"in A){_={};for(var Pt in A)Pt!=="key"&&(_[Pt]=A[Pt])}else _=A;return pt&&k(_,typeof u=="function"?u.displayName||u.name||"Unknown":u),E(u,pt,dt,bt,l(),_,It,Ct)}function M(u){typeof u=="object"&&u!==null&&u.$$typeof===B&&u._store&&(u._store.validated=1)}var v=p,B=Symbol.for("react.transitional.element"),I=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),S=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),it=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),xt=Symbol.for("react.lazy"),gt=Symbol.for("react.activity"),Ft=Symbol.for("react.client.reference"),V=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=Object.prototype.hasOwnProperty,R=Array.isArray,nt=console.createTask?console.createTask:function(){return null};v={"react-stack-bottom-frame":function(u){return u()}};var rt,mt={},w=v["react-stack-bottom-frame"].bind(v,h)(),X=nt(n(h)),P={};Se.Fragment=H,Se.jsx=function(u,A,_,at,bt){var dt=1e4>V.recentlyCreatedOwnerStacks++;return N(u,A,_,!1,at,bt,dt?Error("react-stack-top-frame"):w,dt?nt(n(u)):X)},Se.jsxs=function(u,A,_,at,bt){var dt=1e4>V.recentlyCreatedOwnerStacks++;return N(u,A,_,!0,at,bt,dt?Error("react-stack-top-frame"):w,dt?nt(n(u)):X)}}()),Se}var Xi;function qa(){return Xi||(Xi=1,process.env.NODE_ENV==="production"?We.exports=Ua():We.exports=Ya()),We.exports}var e=qa();const K=({name:r,size:a=24,color:s="#000000",...n})=>{const l={briefcase:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375 7.444 2.25 12 2.25s8.25 1.847 8.25 4.125zM12 12.75c4.556 0 8.25-1.847 8.25-4.125v-2.35c-1.64 1.263-4.54 2.1-8.25 2.1s-6.61-.837-8.25-2.1v2.35c0 2.278 3.694 4.125 8.25 4.125z",money:"M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2zm0 2c-4.418 0-8 3.582-8 8s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8zm1 8V9.5c0-.828.672-1.5 1.5-1.5S16 8.672 16 9.5V10h-1v-.5c0-.276-.224-.5-.5-.5s-.5.224-.5.5V12c0 .828-.672 1.5-1.5 1.5S11 12.828 11 12v-.5h1v.5c0 .276.224.5.5.5s.5-.224.5-.5z",chart:"M3 3v18h18v-2H5V3H3zm4 12V9h2v6H7zm4 0V7h2v8h-2zm4 0v-4h2v4h-2z",target:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm0 10c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z",laptop:"M20 18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2h-4zM4 6h16v10H4V6z",phone:"M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z",wifi:"M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.07 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z",camera:"M9 2l1.17 1H15v1H9.83L8.66 2H9zm-4 7h14l-1 9H6l-1-9zm7 8c1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3 1.34 3 3 3z",email:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z",message:"M20 2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4v3c0 .6.4 1 1 1h.5c.2 0 .4-.1.6-.2L15.5 18H20c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z",notification:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z",like:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z",share:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z",user:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z",users:"M16 4c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zM4 4c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zm5 0c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zM12 14v8H4v-8c0-2.66 5.33-4 8-4s8 1.34 8 4v8h-8z",cart:"M7 18c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12L8.1 13h7.45c.75 0 1.41-.41 1.75-1.03L21.7 4H5.21l-.94-2H1zm16 16c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z",bag:"M19 7h-3V6c0-2.76-2.24-5-5-5S6 3.24 6 6v1H3c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2zM8 6c0-1.66 1.34-3 3-3s3 1.34 3 3v1H8V6zm11 15H5V9h2v1c0 .55.45 1 1 1s1-.45 1-1V9h6v1c0 .55.45 1 1 1s1-.45 1-1V9h2v12z",gift:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h1v6c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2v-6h1c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2z",plane:"M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z",car:"M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.22.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z",location:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z",home:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z",coffee:"M2 21h18v-2H2v2zM20 8H3v10h17V8zM5 10h12v6H5v-6zM21 5V3h-2v2H3v2h16v-2z",pizza:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z",sun:"M6.76 4.84l-1.8-1.79-1.41 1.41 1.79 1.79 1.42-1.41zM4 10.5H1v2h3v-2zm9-9.95h-2V3.5h2V.55zm7.45 3.91l-1.41-1.41-1.79 1.79 1.41 1.41 1.79-1.79zm-3.21 13.7l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4zM20 10.5v2h3v-2h-3zm-8-5c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm-1 16.95h2V19.5h-2v2.95zm-7.45-3.91l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8z",cloud:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z",tree:"M16.5 12c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5-1.5-.67-1.5-1.5.67-1.5 1.5-1.5zM9 13c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm3-6c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1z",soccer:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z",basketball:"M17.09 11h4.86c-.16-1.61-.71-3.11-1.54-4.4-1.69.83-2.81 2.54-3.32 4.4zM6.91 11c-.51-1.86-1.63-3.57-3.32-4.4-.83 1.29-1.38 2.79-1.54 4.4h4.86z",music:"M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z",video:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z",gamepad:"M15 7.5V2H9v5.5l3 3 3-3zM7.5 9H2v6h5.5l3-3-3-3zM9 16.5V22h6v-5.5l-3-3-3 3zM16.5 9l3 3 3-3H22V2h-5.5z",health:"M9.8 17.3l4.2-4.2L18.2 17c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L15.4 11.4l4.2-4.2c.39-.39.39-1.02 0-1.41-.39-.39-1.02-.39-1.41 0L14 9.8l-4.2-4.2c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41l4.2 4.2-4.2 4.2c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0z",medical:"M19 8h-2v3h-3v2h3v3h2v-3h3v-2h-3V8zM4 6h9v2H4zm0 5h9v2H4zm0 5h6v2H4z",lock:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z",shield:"M12,1L3,5V11C3,16.55 6.84,21.74 12,23C17.16,21.74 21,16.55 21,11V5L12,1M12,7C13.4,7 14.8,8.6 14.8,10V11H15.7V16H8.3V11H9.2V10C9.2,8.6 10.6,7 12,7M12,8.2C11.2,8.2 10.5,8.7 10.5,10V11H13.5V10C13.5,8.7 12.8,8.2 12,8.2Z",wrench:"M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z",gear:"M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z",book:"M18 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 4h5v8l-2.5-1.5L6 12V4z",graduation:"M5 13.18v4L12 21l7-3.82v-4L12 17l-7-3.82zM12 3L1 9l11 6 9-4.91V17h2V9L12 3z",arrowUp:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z",arrowDown:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z",arrowLeft:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6z",arrowRight:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6z",close:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",check:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z",plus:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z",minus:"M19 13H5v-2h14v2z",sparkle:"M19 9l1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25L19 9zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12l-5.5-2.5zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25L19 15z",undo:"M12.5 8c-2.65 0-5.05 1.04-6.83 2.73L3 8v8h8l-2.81-2.81C9.62 11.85 10.97 11.2 12.5 11.2c2.96 0 5.48 1.87 6.44 4.5L21 14.9C19.72 11.04 16.42 8 12.5 8z",redo:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-3.92 0-7.22 3.04-8.5 6.9l2.06.77C5.98 13.07 8.47 11.2 11.5 11.2c1.53 0 2.88.65 3.81 1.69L13 15h7V8l-1.6 2.6z",rotateRight:"M15.55 5.55L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45zM19.93 11c-.17-1.39-.72-2.73-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47h2.02zM13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03zm3.89-2.42l1.42 1.41c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.48z",rotateLeft:"M7.11 8.53L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47zM6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47zm1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.14-1.71-.48-2.46-1.03L7.1 18.32zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93z",text:"M5 4v3h5.5v12h3V7H19V4H5z",shapes:"M11 13.5v8h2v-8h8v-2h-8v-8h-2v8h-8v2h8z",upload:"M9 16h6v-6h4l-7-7-7 7h4v6zm-4 2h14v2H5v-2z",image:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z",sticker:"M21.99 4c0-1.1-.89-2-1.99-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14l4 4-.01-18zM18 14H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z",qrcode:"M3 11h2v2H3v-2zm8-6h2v4h-2V5zM3 3v6h6V3H3zm4 4H5V5h2v2zm-4 14h6v-6H3v6zm2-4h2v2H5v-2zM15 3v6h6V3h-6zm4 4h-2V5h2v2zm-4 8h2v2h2v2h-2v-2h-2v-2zm-2-2h2v2h-2v-2zm4 0h2v2h-2v-2zm2 4h2v2h-2v-2zm0-4h2v2h-2v-2zM11 13h2v4h-2v-4z",barcode:"M2 4h2v16H2V4zm4 0h1v16H6V4zm3 0h2v16H9V4zm4 0h1v16h-1V4zm3 0h2v16h-2V4zm4 0h2v16h-2V4z",thread:"M19.38 3.9L18.2 2.72a1.5 1.5 0 00-2.12 0l-1.41 1.41L3 15.79V21h5.21l11.66-11.66 1.41-1.41a1.5 1.5 0 000-2.12L19.38 3.9zM7.79 19H5v-2.79l9.95-9.95 2.79 2.79L7.79 19z",duplicate:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z",trash:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z",grid:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z",ruler:"M21 6H3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 10H3V8h2v4h2V8h2v4h2V8h2v4h2V8h2v4h2V8h2v4z",magnet:"M3 7v6c0 5.52 4.48 10 10 10h1V13h-2v8.95C7.83 21.45 5 18.05 5 14V7H3zm18 0h-2v7c0 4.05-2.83 7.45-7 7.95V13h-2v10h1c5.52 0 10-4.48 10-10V7z",rectangle:"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 12H5V7h14v10z",circle:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",triangle:"M12 2L1 21h22L12 2zm0 4l7.53 13H4.47L12 6z",star:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z",heart:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z",diamond:"M12 2L2 12l10 10 10-10L12 2zm0 2.83L19.17 12 12 19.17 4.83 12 12 4.83z",hexagon:"M12 2l-8.66 5v10L12 22l8.66-5V7L12 2zm6.66 13.87L12 19.87l-6.66-4V8.13L12 4.13l6.66 4v7.74z",pentagon:"M12 2L2 9l4 12h12l4-12L12 2z",oval:"M12 6c-4.42 0-8 2.69-8 6s3.58 6 8 6 8-2.69 8-6-3.58-6-8-6z",roundedRect:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z",horizontalLine:"M2 12h20",arrowShape:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z",rain:"M6 14c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97C6.22 4.56 8.51 3 11.2 3c2.31 0 4.36 1.25 5.46 3.1C17.43 6.04 18 6.96 18 8c0 1.1-.9 2-2 2H6zm2 6h2v2H8v-2zm4 0h2v2h-2v-2zm-2-3h2v2h-2v-2z",snow:"M22 11h-4.17l3.24-3.24-1.41-1.42L15.83 10H13V7.17l3.24-3.24-1.42-1.41L12 5.83 9.17 2.52 7.76 3.93 11 7.17V10H8.17l-3.24-3.24L3.52 8.17 6.76 11.41H2v2h4.17l-3.24 3.24 1.41 1.42L8.17 14H11v2.83l-3.24 3.24 1.42 1.41L12 18.17l2.83 3.31 1.41-1.41L13 16.83V14h2.83l3.24 3.24 1.42-1.41L17.24 12.59H22v-1z"},h=new Set(["horizontalLine","ruler"]),f=l[r];if(!f)return console.warn(`Icon "${r}" not found`),null;const k=h.has(r);return e.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:k?"none":s,stroke:k?s:void 0,strokeWidth:k?2:void 0,...n,children:e.jsx("path",{d:f})})},Jt=[{id:1,text:"DREAM BIG",category:"Motivational",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF6B35",hasBackground:!0,backgroundColor:"#1A1A1A",textAlign:"center",textTransform:"uppercase"},{id:2,text:"Never Give Up",category:"Motivational",fontSize:28,fontFamily:"Georgia",fontWeight:"bold",fill:"#2E8B57",fontStyle:"italic",textAlign:"center"},{id:3,text:"BE YOURSELF",category:"Motivational",fontSize:24,fontFamily:"Arial",fontWeight:"700",fill:"#FF1493",textTransform:"uppercase",letterSpacing:2},{id:4,text:"Stay Strong",category:"Motivational",fontSize:26,fontFamily:"Verdana",fontWeight:"bold",fill:"#4169E1",hasTextShadow:!0,textShadowX:2,textShadowY:2,textShadowBlur:4,textShadowColor:"#000000"},{id:5,text:"RISE & SHINE",category:"Motivational",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",hasBackground:!0,backgroundColor:"#8B0000",textAlign:"center"},{id:6,text:"Believe in Magic",category:"Motivational",fontSize:22,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB",textAlign:"center"},{id:7,text:"UNSTOPPABLE",category:"Motivational",fontSize:28,fontFamily:"Arial",fontWeight:"900",fill:"#DC143C",textTransform:"uppercase",letterSpacing:1.5},{id:8,text:"Chase Your Dreams",category:"Motivational",fontSize:24,fontFamily:"Georgia",fill:"#20B2AA",fontWeight:"600"},{id:9,text:"FEARLESS",category:"Motivational",fontSize:36,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center",hasBackground:!0,backgroundColor:"#000000"},{id:10,text:"Make It Happen",category:"Motivational",fontSize:26,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#32CD32"},{id:11,text:"BORN TO WIN",category:"Motivational",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#FFD700",hasBackground:!0,backgroundColor:"#800080",textAlign:"center"},{id:12,text:"Positive Vibes Only",category:"Motivational",fontSize:20,fontFamily:"Comic Sans MS",fill:"#FF69B4",fontWeight:"600"},{id:13,text:"LIMITLESS",category:"Motivational",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#1E90FF",textTransform:"uppercase",letterSpacing:3},{id:14,text:"Embrace The Journey",category:"Motivational",fontSize:22,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B4513"},{id:15,text:"STRENGTH WITHIN",category:"Motivational",fontSize:26,fontFamily:"Verdana",fontWeight:"bold",fill:"#696969",hasBackground:!0,backgroundColor:"#F0F8FF"},{id:16,text:"Create Your Own Sunshine",category:"Motivational",fontSize:18,fontFamily:"Palatino",fill:"#FF8C00",fontWeight:"600"},{id:17,text:"WARRIOR SPIRIT",category:"Motivational",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#B22222",textAlign:"center"},{id:18,text:"Keep Going",category:"Motivational",fontSize:30,fontFamily:"Arial",fontWeight:"700",fill:"#228B22"},{id:19,text:"FOCUS & WIN",category:"Motivational",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082",hasBackground:!0,backgroundColor:"#FFFF00"},{id:20,text:"Inspire Others",category:"Motivational",fontSize:26,fontFamily:"Georgia",fill:"#CD853F",fontStyle:"italic"},{id:21,text:"GAME CHANGER",category:"Motivational",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493",textAlign:"center"},{id:22,text:"Live With Purpose",category:"Motivational",fontSize:22,fontFamily:"Palatino",fill:"#2F4F4F",fontWeight:"600"},{id:23,text:"BREAKTHROUGH",category:"Motivational",fontSize:28,fontFamily:"Arial",fontWeight:"900",fill:"#DC143C",letterSpacing:2},{id:24,text:"Shine Bright",category:"Motivational",fontSize:32,fontFamily:"Verdana",fontWeight:"bold",fill:"#FFD700",hasTextShadow:!0,textShadowX:3,textShadowY:3,textShadowBlur:6,textShadowColor:"#000000"},{id:25,text:"NEVER SETTLE",category:"Motivational",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",hasBackground:!0,backgroundColor:"#000080"},{id:26,text:"CEO MINDSET",category:"Business",fontSize:28,fontFamily:"Arial",fontWeight:"bold",fill:"#2F4F4F",textAlign:"center",hasBackground:!0,backgroundColor:"#F5F5F5"},{id:27,text:"Innovation Starts Here",category:"Business",fontSize:20,fontFamily:"Trebuchet MS",fill:"#4169E1",fontWeight:"600"},{id:28,text:"PROFESSIONAL",category:"Business",fontSize:24,fontFamily:"Georgia",fontWeight:"bold",fill:"#000080",letterSpacing:1},{id:29,text:"Excellence Every Day",category:"Business",fontSize:22,fontFamily:"Verdana",fill:"#8B0000",fontWeight:"600"},{id:30,text:"LEADERSHIP",category:"Business",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#B8860B",textAlign:"center"},{id:31,text:"Think Different",category:"Business",fontSize:26,fontFamily:"Palatino",fontStyle:"italic",fill:"#696969"},{id:32,text:"RESULTS DRIVEN",category:"Business",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#DC143C",hasBackground:!0,backgroundColor:"#F0F8FF"},{id:33,text:"Strategic Vision",category:"Business",fontSize:22,fontFamily:"Georgia",fill:"#2E8B57",fontWeight:"700"},{id:34,text:"PRODUCTIVITY",category:"Business",fontSize:28,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:35,text:"Success Mindset",category:"Business",fontSize:24,fontFamily:"Verdana",fill:"#FF8C00",fontWeight:"600"},{id:36,text:"EXPERT LEVEL",category:"Business",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#000000",hasBackground:!0,backgroundColor:"#FFD700"},{id:37,text:"Quality First",category:"Business",fontSize:30,fontFamily:"Arial",fontWeight:"700",fill:"#228B22"},{id:38,text:"INTEGRITY",category:"Business",fontSize:32,fontFamily:"Georgia",fontWeight:"bold",fill:"#2F4F4F",textAlign:"center"},{id:39,text:"Growth Focused",category:"Business",fontSize:20,fontFamily:"Palatino",fill:"#20B2AA",fontWeight:"600"},{id:40,text:"COLLABORATION",category:"Business",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#9370DB"},{id:41,text:"Performance Matters",category:"Business",fontSize:22,fontFamily:"Verdana",fill:"#B22222",fontWeight:"700"},{id:42,text:"ACCOUNTABILITY",category:"Business",fontSize:26,fontFamily:"Arial",fontWeight:"800",fill:"#8B4513",letterSpacing:1.5},{id:43,text:"Vision to Reality",category:"Business",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#4169E1"},{id:44,text:"TRANSFORMATION",category:"Business",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center"},{id:45,text:"Excellence Standard",category:"Business",fontSize:22,fontFamily:"Palatino",fill:"#2E8B57",fontWeight:"600"},{id:46,text:"EFFICIENCY",category:"Business",fontSize:30,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#000080"},{id:47,text:"Forward Thinking",category:"Business",fontSize:24,fontFamily:"Verdana",fill:"#CD853F",fontWeight:"700"},{id:48,text:"ACHIEVEMENT",category:"Business",fontSize:26,fontFamily:"Arial",fontWeight:"bold",fill:"#B8860B",hasBackground:!0,backgroundColor:"#F5F5DC"},{id:49,text:"Strategic Excellence",category:"Business",fontSize:20,fontFamily:"Georgia",fill:"#696969",fontWeight:"600"},{id:50,text:"IMPACT MAKER",category:"Business",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#DC143C",textAlign:"center"},{id:51,text:"COFFEE FIRST",category:"Funny",fontSize:28,fontFamily:"Comic Sans MS",fontWeight:"bold",fill:"#8B4513",hasBackground:!0,backgroundColor:"#F5DEB3"},{id:52,text:"I'm Not Lazy, I'm Energy Efficient",category:"Funny",fontSize:16,fontFamily:"Arial",fill:"#FF69B4",fontWeight:"600"},{id:53,text:"SARCASM LOADING...",category:"Funny",fontSize:24,fontFamily:"Courier New",fontWeight:"bold",fill:"#32CD32",textAlign:"center"},{id:54,text:"Powered By Pizza",category:"Funny",fontSize:26,fontFamily:"Comic Sans MS",fill:"#FF6347",fontWeight:"700"},{id:55,text:"CTRL + ALT + DELETE MONDAY",category:"Funny",fontSize:18,fontFamily:"Courier New",fontWeight:"bold",fill:"#4169E1"},{id:56,text:"Brain 404 Error",category:"Funny",fontSize:22,fontFamily:"Arial",fill:"#FF1493",fontWeight:"600"},{id:57,text:"WEEKEND WARRIOR",category:"Funny",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",hasBackground:!0,backgroundColor:"#000080"},{id:58,text:"Adulting is Hard",category:"Funny",fontSize:24,fontFamily:"Comic Sans MS",fill:"#9370DB",fontWeight:"600"},{id:59,text:"PROCRASTINATION EXPERT",category:"Funny",fontSize:20,fontFamily:"Arial",fontWeight:"bold",fill:"#FF4500"},{id:60,text:"Netflix & Chill Champion",category:"Funny",fontSize:18,fontFamily:"Trebuchet MS",fill:"#DC143C",fontWeight:"600"},{id:61,text:"CHAOS COORDINATOR",category:"Funny",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#FF69B4",textAlign:"center"},{id:62,text:"I Speak Fluent Sarcasm",category:"Funny",fontSize:20,fontFamily:"Georgia",fontStyle:"italic",fill:"#2E8B57"},{id:63,text:"SLEEP IS FOR THE WEAK",category:"Funny",fontSize:22,fontFamily:"Arial",fontWeight:"800",fill:"#B22222"},{id:64,text:"Professional Overthinker",category:"Funny",fontSize:20,fontFamily:"Verdana",fill:"#4B0082",fontWeight:"600"},{id:65,text:"WIFI PASSWORD PLEASE",category:"Funny",fontSize:20,fontFamily:"Courier New",fontWeight:"bold",fill:"#32CD32"},{id:66,text:"Certified Couch Potato",category:"Funny",fontSize:22,fontFamily:"Comic Sans MS",fill:"#FF8C00",fontWeight:"700"},{id:67,text:"SOCIAL DISTANCING CHAMPION",category:"Funny",fontSize:16,fontFamily:"Arial",fontWeight:"bold",fill:"#20B2AA"},{id:68,text:"Powered By Caffeine",category:"Funny",fontSize:24,fontFamily:"Impact",fill:"#8B4513",fontWeight:"bold"},{id:69,text:"EMERGENCY CHOCOLATE NEEDED",category:"Funny",fontSize:18,fontFamily:"Comic Sans MS",fontWeight:"bold",fill:"#D2691E"},{id:70,text:"I'm Not Short, I'm Fun Size",category:"Funny",fontSize:20,fontFamily:"Trebuchet MS",fill:"#FF1493",fontWeight:"600"},{id:71,text:"CTRL + Z MY LIFE",category:"Funny",fontSize:26,fontFamily:"Courier New",fontWeight:"bold",fill:"#4169E1"},{id:72,text:"Error 404: Motivation Not Found",category:"Funny",fontSize:16,fontFamily:"Arial",fill:"#FF4500",fontWeight:"600"},{id:73,text:"PROFESSIONAL WEIRDO",category:"Funny",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#9370DB",textAlign:"center"},{id:74,text:"Snack Attack Mode",category:"Funny",fontSize:26,fontFamily:"Comic Sans MS",fill:"#FF6347",fontWeight:"700"},{id:75,text:"BATTERY LOW, NEED COFFEE",category:"Funny",fontSize:18,fontFamily:"Courier New",fontWeight:"bold",fill:"#8B4513"},{id:76,text:"Love You Forever",category:"Love",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#FF1493",textAlign:"center"},{id:77,text:"SOULMATES",category:"Love",fontSize:32,fontFamily:"Georgia",fontWeight:"bold",fill:"#DC143C",hasBackground:!0,backgroundColor:"#FFE4E1"},{id:78,text:"Better Together",category:"Love",fontSize:26,fontFamily:"Trebuchet MS",fill:"#FF69B4",fontWeight:"600"},{id:79,text:"ENDLESS LOVE",category:"Love",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#B22222",textAlign:"center"},{id:80,text:"You Complete Me",category:"Love",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B0000"},{id:81,text:"FOREVER & ALWAYS",category:"Love",fontSize:24,fontFamily:"Arial",fontWeight:"bold",fill:"#FF1493",letterSpacing:1},{id:82,text:"My Heart Belongs To You",category:"Love",fontSize:20,fontFamily:"Palatino",fill:"#DC143C",fontWeight:"600"},{id:83,text:"PURE LOVE",category:"Love",fontSize:34,fontFamily:"Impact",fontWeight:"bold",fill:"#FF69B4",hasTextShadow:!0,textShadowX:2,textShadowY:2,textShadowBlur:4,textShadowColor:"#000000"},{id:84,text:"Together Forever",category:"Love",fontSize:26,fontFamily:"Georgia",fill:"#8B0000",fontWeight:"700",textAlign:"center"},{id:85,text:"MATCH MADE IN HEAVEN",category:"Love",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#FF1493"},{id:86,text:"Love Story",category:"Love",fontSize:32,fontFamily:"Palatino",fontStyle:"italic",fill:"#B22222"},{id:87,text:"HEARTBEAT",category:"Love",fontSize:28,fontFamily:"Arial",fontWeight:"800",fill:"#DC143C",hasBackground:!0,backgroundColor:"#FFF0F5"},{id:88,text:"You Are My Sunshine",category:"Love",fontSize:22,fontFamily:"Georgia",fill:"#FF8C00",fontWeight:"600"},{id:89,text:"DESTINY",category:"Love",fontSize:36,fontFamily:"Impact",fontWeight:"bold",fill:"#8B0000",textAlign:"center"},{id:90,text:"True Love Waits",category:"Love",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#FF1493"},{id:91,text:"BELOVED",category:"Love",fontSize:30,fontFamily:"Georgia",fontWeight:"bold",fill:"#B22222",letterSpacing:2},{id:92,text:"Love Conquers All",category:"Love",fontSize:26,fontFamily:"Trebuchet MS",fill:"#DC143C",fontWeight:"700"},{id:93,text:"PERFECT MATCH",category:"Love",fontSize:24,fontFamily:"Arial",fontWeight:"bold",fill:"#FF69B4",hasBackground:!0,backgroundColor:"#000000"},{id:94,text:"Always & Forever",category:"Love",fontSize:28,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B0000",textAlign:"center"},{id:95,text:"ROMANCE",category:"Love",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493"},{id:96,text:"Love Never Fails",category:"Love",fontSize:24,fontFamily:"Palatino",fill:"#B22222",fontWeight:"600"},{id:97,text:"ETERNAL LOVE",category:"Love",fontSize:28,fontFamily:"Arial",fontWeight:"800",fill:"#DC143C",letterSpacing:1.5},{id:98,text:"Heart & Soul",category:"Love",fontSize:30,fontFamily:"Georgia",fill:"#8B0000",fontWeight:"bold"},{id:99,text:"PASSIONATE",category:"Love",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center"},{id:100,text:"Love Is Everything",category:"Love",fontSize:24,fontFamily:"Trebuchet MS",fill:"#FF1493",fontWeight:"700"},{id:101,text:"NO PAIN NO GAIN",category:"Sports",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",textAlign:"center",hasBackground:!0,backgroundColor:"#000000"},{id:102,text:"Train Hard",category:"Sports",fontSize:32,fontFamily:"Arial",fontWeight:"900",fill:"#B22222"},{id:103,text:"CHAMPION MINDSET",category:"Sports",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#FFD700",hasBackground:!0,backgroundColor:"#000080"},{id:104,text:"Beast Mode ON",category:"Sports",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#32CD32"},{id:105,text:"STRONGER EVERY DAY",category:"Sports",fontSize:22,fontFamily:"Arial",fontWeight:"800",fill:"#2E8B57",letterSpacing:1},{id:106,text:"Victory Mindset",category:"Sports",fontSize:28,fontFamily:"Georgia",fontWeight:"bold",fill:"#B8860B"},{id:107,text:"GAME TIME",category:"Sports",fontSize:34,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493",textAlign:"center"},{id:108,text:"Push Your Limits",category:"Sports",fontSize:24,fontFamily:"Trebuchet MS",fill:"#4169E1",fontWeight:"700"},{id:109,text:"ATHLETIC EXCELLENCE",category:"Sports",fontSize:20,fontFamily:"Arial",fontWeight:"bold",fill:"#DC143C"},{id:110,text:"Fitness First",category:"Sports",fontSize:30,fontFamily:"Verdana",fontWeight:"bold",fill:"#228B22"},{id:111,text:"UNSTOPPABLE FORCE",category:"Sports",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500",hasTextShadow:!0,textShadowX:3,textShadowY:3,textShadowBlur:6,textShadowColor:"#000000"},{id:112,text:"Sweat Equity",category:"Sports",fontSize:28,fontFamily:"Georgia",fill:"#8B4513",fontWeight:"700"},{id:113,text:"PERFORMANCE ZONE",category:"Sports",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:114,text:"Train Like A Champion",category:"Sports",fontSize:20,fontFamily:"Arial",fill:"#B22222",fontWeight:"600"},{id:115,text:"POWER WITHIN",category:"Sports",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FF8C00",textAlign:"center"},{id:116,text:"Maximum Effort",category:"Sports",fontSize:26,fontFamily:"Verdana",fill:"#2E8B57",fontWeight:"800"},{id:117,text:"ELITE ATHLETE",category:"Sports",fontSize:28,fontFamily:"Arial",fontWeight:"900",fill:"#FFD700",hasBackground:!0,backgroundColor:"#8B0000"},{id:118,text:"Rise Above",category:"Sports",fontSize:30,fontFamily:"Georgia",fontWeight:"bold",fill:"#4169E1"},{id:119,text:"COMPETITIVE EDGE",category:"Sports",fontSize:22,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#DC143C"},{id:120,text:"Strength & Honor",category:"Sports",fontSize:26,fontFamily:"Impact",fill:"#2F4F4F",fontWeight:"bold"},{id:121,text:"WINNING ATTITUDE",category:"Sports",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#32CD32",letterSpacing:1.5},{id:122,text:"Never Give Up",category:"Sports",fontSize:32,fontFamily:"Verdana",fontWeight:"bold",fill:"#FF4500"},{id:123,text:"ENDURANCE",category:"Sports",fontSize:36,fontFamily:"Impact",fontWeight:"bold",fill:"#228B22",textAlign:"center"},{id:124,text:"Peak Performance",category:"Sports",fontSize:24,fontFamily:"Georgia",fill:"#B8860B",fontWeight:"700"},{id:125,text:"DEDICATION PAYS OFF",category:"Sports",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:126,text:"STYLE ICON",category:"Lifestyle",fontSize:30,fontFamily:"Palatino",fontWeight:"bold",fill:"#000000",hasBackground:!0,backgroundColor:"#FFD700"},{id:127,text:"Chic & Unique",category:"Lifestyle",fontSize:28,fontFamily:"Georgia",fontStyle:"italic",fill:"#FF1493"},{id:128,text:"TRENDSETTER",category:"Lifestyle",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#9370DB",textAlign:"center"},{id:129,text:"Fashion Forward",category:"Lifestyle",fontSize:24,fontFamily:"Trebuchet MS",fill:"#FF69B4",fontWeight:"600"},{id:130,text:"BOUTIQUE VIBES",category:"Lifestyle",fontSize:22,fontFamily:"Arial",fontWeight:"bold",fill:"#4169E1"},{id:131,text:"Effortlessly Elegant",category:"Lifestyle",fontSize:20,fontFamily:"Georgia",fontStyle:"italic",fill:"#2F4F4F"},{id:132,text:"LUXE LIFESTYLE",category:"Lifestyle",fontSize:28,fontFamily:"Palatino",fontWeight:"bold",fill:"#B8860B",letterSpacing:2},{id:133,text:"Vintage Soul",category:"Lifestyle",fontSize:32,fontFamily:"Georgia",fill:"#8B4513",fontWeight:"700"},{id:134,text:"MODERN CLASSIC",category:"Lifestyle",fontSize:24,fontFamily:"Arial",fontWeight:"800",fill:"#000000"},{id:135,text:"Street Style",category:"Lifestyle",fontSize:30,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500"},{id:136,text:"SOPHISTICATED",category:"Lifestyle",fontSize:26,fontFamily:"Palatino",fontWeight:"bold",fill:"#2E8B57",hasBackground:!0,backgroundColor:"#F5F5F5"},{id:137,text:"Boho Chic",category:"Lifestyle",fontSize:28,fontFamily:"Georgia",fontStyle:"italic",fill:"#CD853F"},{id:138,text:"MINIMALIST",category:"Lifestyle",fontSize:32,fontFamily:"Arial",fontWeight:"300",fill:"#696969",letterSpacing:3},{id:139,text:"Glamorous Life",category:"Lifestyle",fontSize:24,fontFamily:"Trebuchet MS",fill:"#FFD700",fontWeight:"700"},{id:140,text:"HAUTE COUTURE",category:"Lifestyle",fontSize:22,fontFamily:"Palatino",fontWeight:"bold",fill:"#4B0082"},{id:141,text:"Urban Explorer",category:"Lifestyle",fontSize:26,fontFamily:"Impact",fill:"#32CD32",fontWeight:"bold"},{id:142,text:"AESTHETIC VIBES",category:"Lifestyle",fontSize:24,fontFamily:"Arial",fontWeight:"600",fill:"#FF69B4"},{id:143,text:"Lifestyle Goals",category:"Lifestyle",fontSize:28,fontFamily:"Georgia",fill:"#20B2AA",fontWeight:"600"},{id:144,text:"PREMIUM QUALITY",category:"Lifestyle",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#B22222"},{id:145,text:"Designer Dreams",category:"Lifestyle",fontSize:26,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:146,text:"CURATED STYLE",category:"Lifestyle",fontSize:24,fontFamily:"Arial",fontWeight:"700",fill:"#2F4F4F",letterSpacing:1},{id:147,text:"Fashion Statement",category:"Lifestyle",fontSize:22,fontFamily:"Georgia",fill:"#FF1493",fontWeight:"600"},{id:148,text:"ARTISAN CRAFTED",category:"Lifestyle",fontSize:20,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#8B4513"},{id:149,text:"Timeless Elegance",category:"Lifestyle",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#000080"},{id:150,text:"SIGNATURE STYLE",category:"Lifestyle",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",textAlign:"center"},{id:151,text:"HAPPY BIRTHDAY",category:"Holidays",fontSize:32,fontFamily:"Comic Sans MS",fontWeight:"bold",fill:"#FF69B4",hasBackground:!0,backgroundColor:"#FFFF00",textAlign:"center"},{id:152,text:"Merry Christmas",category:"Holidays",fontSize:30,fontFamily:"Georgia",fill:"#B22222",fontWeight:"700",hasTextShadow:!0,textShadowX:2,textShadowY:2,textShadowBlur:4,textShadowColor:"#228B22"},{id:153,text:"CELEBRATION TIME",category:"Holidays",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700"},{id:154,text:"Happy New Year",category:"Holidays",fontSize:26,fontFamily:"Trebuchet MS",fill:"#4169E1",fontWeight:"700"},{id:155,text:"THANKFUL HEART",category:"Holidays",fontSize:24,fontFamily:"Georgia",fontWeight:"bold",fill:"#FF8C00",textAlign:"center"},{id:156,text:"Easter Blessings",category:"Holidays",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:157,text:"PARTY TIME",category:"Holidays",fontSize:34,fontFamily:"Impact",fontWeight:"bold",fill:"#FF1493",hasBackground:!0,backgroundColor:"#000000"},{id:158,text:"Halloween Spirit",category:"Holidays",fontSize:26,fontFamily:"Arial",fontWeight:"800",fill:"#FF4500"},{id:159,text:"FESTIVE MOOD",category:"Holidays",fontSize:30,fontFamily:"Georgia",fontWeight:"bold",fill:"#32CD32"},{id:160,text:"Valentine's Day",category:"Holidays",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#DC143C"},{id:161,text:"ANNIVERSARY JOY",category:"Holidays",fontSize:"22",fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#B8860B"},{id:162,text:"Graduation Day",category:"Holidays",fontSize:28,fontFamily:"Arial",fill:"#000080",fontWeight:"700"},{id:163,text:"SUMMER VIBES",category:"Holidays",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#FFD700",textAlign:"center"},{id:164,text:"Winter Wonderland",category:"Holidays",fontSize:20,fontFamily:"Georgia",fill:"#4169E1",fontWeight:"600"},{id:165,text:"MOTHER'S DAY LOVE",category:"Holidays",fontSize:22,fontFamily:"Palatino",fontWeight:"bold",fill:"#FF69B4"},{id:166,text:"Father's Day Hero",category:"Holidays",fontSize:24,fontFamily:"Arial",fill:"#2F4F4F",fontWeight:"700"},{id:167,text:"SPRING AWAKENING",category:"Holidays",fontSize:26,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#32CD32"},{id:168,text:"Holiday Magic",category:"Holidays",fontSize:30,fontFamily:"Georgia",fontStyle:"italic",fill:"#9370DB"},{id:169,text:"FAMILY GATHERING",category:"Holidays",fontSize:20,fontFamily:"Arial",fontWeight:"600",fill:"#8B4513"},{id:170,text:"Wedding Bliss",category:"Holidays",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#FFD700"},{id:171,text:"FIREWORKS NIGHT",category:"Holidays",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500"},{id:172,text:"Autumn Leaves",category:"Holidays",fontSize:26,fontFamily:"Georgia",fill:"#D2691E",fontWeight:"600"},{id:173,text:"MILESTONE MOMENT",category:"Holidays",fontSize:22,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#4B0082"},{id:174,text:"Special Occasion",category:"Holidays",fontSize:24,fontFamily:"Arial",fill:"#B22222",fontWeight:"700"},{id:175,text:"CHEERS TO LIFE",category:"Holidays",fontSize:28,fontFamily:"Impact",fontWeight:"bold",fill:"#20B2AA",textAlign:"center"},{id:176,text:'"Life is Beautiful"',category:"Quotes",fontSize:26,fontFamily:"Georgia",fontStyle:"italic",fill:"#2E8B57",textAlign:"center"},{id:177,text:"CARPE DIEM",category:"Quotes",fontSize:32,fontFamily:"Impact",fontWeight:"bold",fill:"#B8860B",letterSpacing:2},{id:178,text:'"Choose Happiness"',category:"Quotes",fontSize:24,fontFamily:"Palatino",fontStyle:"italic",fill:"#FF69B4"},{id:179,text:"LIVE LAUGH LOVE",category:"Quotes",fontSize:24,fontFamily:"Arial",fontWeight:"600",fill:"#DC143C",textAlign:"center"},{id:180,text:'"Dream Without Fear"',category:"Quotes",fontSize:22,fontFamily:"Georgia",fontStyle:"italic",fill:"#4169E1"},{id:181,text:"WISDOM WITHIN",category:"Quotes",fontSize:28,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#2F4F4F"},{id:182,text:'"Create Your Story"',category:"Quotes",fontSize:20,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:183,text:"INNER PEACE",category:"Quotes",fontSize:30,fontFamily:"Arial",fontWeight:"300",fill:"#20B2AA",letterSpacing:3},{id:184,text:'"Follow Your Heart"',category:"Quotes",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#FF1493"},{id:185,text:"GRATITUDE DAILY",category:"Quotes",fontSize:26,fontFamily:"Impact",fontWeight:"bold",fill:"#FF8C00"},{id:186,text:'"Embrace Change"',category:"Quotes",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#32CD32"},{id:187,text:"MINDFUL LIVING",category:"Quotes",fontSize:24,fontFamily:"Trebuchet MS",fontWeight:"600",fill:"#4B0082"},{id:188,text:'"Stay Curious"',category:"Quotes",fontSize:30,fontFamily:"Georgia",fontStyle:"italic",fill:"#B22222"},{id:189,text:"PURPOSE DRIVEN",category:"Quotes",fontSize:28,fontFamily:"Arial",fontWeight:"700",fill:"#8B4513"},{id:190,text:'"Find Your Why"',category:"Quotes",fontSize:26,fontFamily:"Palatino",fontStyle:"italic",fill:"#CD853F"},{id:191,text:"AUTHENTIC SELF",category:"Quotes",fontSize:24,fontFamily:"Impact",fontWeight:"bold",fill:"#FF4500"},{id:192,text:'"Less is More"',category:"Quotes",fontSize:32,fontFamily:"Arial",fontWeight:"300",fill:"#696969",letterSpacing:2},{id:193,text:"PRESENT MOMENT",category:"Quotes",fontSize:26,fontFamily:"Georgia",fontWeight:"600",fill:"#2E8B57"},{id:194,text:'"Trust The Process"',category:"Quotes",fontSize:22,fontFamily:"Palatino",fontStyle:"italic",fill:"#4169E1"},{id:195,text:"BALANCED LIFE",category:"Quotes",fontSize:28,fontFamily:"Trebuchet MS",fontWeight:"bold",fill:"#20B2AA"},{id:196,text:'"Spread Kindness"',category:"Quotes",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#FF69B4"},{id:197,text:"GROWTH MINDSET",category:"Quotes",fontSize:26,fontFamily:"Arial",fontWeight:"700",fill:"#32CD32"},{id:198,text:'"Be The Change"',category:"Quotes",fontSize:28,fontFamily:"Palatino",fontStyle:"italic",fill:"#9370DB"},{id:199,text:"INFINITE POSSIBILITIES",category:"Quotes",fontSize:20,fontFamily:"Impact",fontWeight:"bold",fill:"#B8860B"},{id:200,text:'"Leave Your Mark"',category:"Quotes",fontSize:24,fontFamily:"Georgia",fontStyle:"italic",fill:"#8B0000",textAlign:"center"},{id:201,text:"OPEN",category:"Signage",fontSize:44,fontFamily:"Bebas Neue",fill:"#111827",textAlign:"center",letterSpacing:6},{id:202,text:"EST. 2024",category:"Signage",fontSize:34,fontFamily:"Staatliches",fill:"#374151",textAlign:"center",letterSpacing:3},{id:203,text:"VINTAGE",category:"Signage",fontSize:36,fontFamily:"Alfa Slab One",fill:"#6d4c41",textAlign:"center"},{id:204,text:"MARKET",category:"Signage",fontSize:38,fontFamily:"Anton",fill:"#1f2937",textAlign:"center",letterSpacing:8},{id:205,text:"WELCOME",category:"Signage",fontSize:40,fontFamily:"Bebas Neue",fill:"#0f766e",textAlign:"center",letterSpacing:5},{id:206,text:"OFF DUTY",category:"Streetwear",fontSize:38,fontFamily:"Archivo Black",fill:"#111827",textAlign:"center"},{id:207,text:"STAY HUMBLE",category:"Streetwear",fontSize:30,fontFamily:"Bebas Neue",fill:"#e11d48",textAlign:"center",letterSpacing:4},{id:208,text:"NO RULES",category:"Streetwear",fontSize:34,fontFamily:"Bungee",fill:"#7c3aed",textAlign:"center"},{id:209,text:"HYPE",category:"Streetwear",fontSize:44,fontFamily:"Titan One",fill:"#f59e0b",textAlign:"center"},{id:210,text:"BORN TO STAND OUT",category:"Streetwear",fontSize:24,fontFamily:"Anton",fill:"#111827",textAlign:"center",letterSpacing:2},{id:211,text:"Forever & Always",category:"Wedding",fontSize:38,fontFamily:"Great Vibes",fill:"#9d174d",textAlign:"center"},{id:212,text:"Mr & Mrs",category:"Wedding",fontSize:44,fontFamily:"Great Vibes",fill:"#3f3f46",textAlign:"center"},{id:213,text:"Just Married",category:"Wedding",fontSize:36,fontFamily:"Pacifico",fill:"#be123c",textAlign:"center"},{id:214,text:"Save the Date",category:"Wedding",fontSize:34,fontFamily:"Dancing Script",fontWeight:"700",fill:"#1f2937",textAlign:"center"},{id:215,text:"A",category:"Monogram",fontSize:72,fontFamily:"Playfair Display",fontWeight:"700",fill:"#1f2937",textAlign:"center"},{id:216,text:"M & J",category:"Monogram",fontSize:44,fontFamily:"Great Vibes",fill:"#7c2d12",textAlign:"center"},{id:217,text:"EST. YOU",category:"Monogram",fontSize:30,fontFamily:"Staatliches",fill:"#111827",textAlign:"center",letterSpacing:4},{id:218,text:"RETRO",category:"Retro",fontSize:40,fontFamily:"Bungee Inline",fill:"#0ea5e9",textAlign:"center"},{id:219,text:"Sunset Vibes",category:"Retro",fontSize:36,fontFamily:"Lobster",fill:"#ea580c",textAlign:"center"},{id:220,text:"Good Times",category:"Retro",fontSize:36,fontFamily:"Pacifico",fill:"#b45309",textAlign:"center"},{id:221,text:"CLASSIC",category:"Retro",fontSize:34,fontFamily:"Playfair Display",fontStyle:"italic",fontWeight:"700",fill:"#3f3f46",textAlign:"center",letterSpacing:3},{id:222,text:"ADVENTURE AWAITS",category:"Outdoors",fontSize:24,fontFamily:"Oswald",fontWeight:"700",fill:"#166534",textAlign:"center",letterSpacing:3},{id:223,text:"Wander",category:"Outdoors",fontSize:44,fontFamily:"Sacramento",fill:"#065f46",textAlign:"center"},{id:224,text:"MOUNTAIN TIME",category:"Outdoors",fontSize:28,fontFamily:"Bebas Neue",fill:"#0c4a6e",textAlign:"center",letterSpacing:3},{id:225,text:"Explore More",category:"Outdoors",fontSize:34,fontFamily:"Caveat",fontWeight:"700",fill:"#7c2d12",textAlign:"center"},{id:226,text:"Blessed",category:"Faith",fontSize:44,fontFamily:"Great Vibes",fill:"#6d28d9",textAlign:"center"},{id:227,text:"FAITH",category:"Faith",fontSize:40,fontFamily:"Staatliches",fill:"#1e3a8a",textAlign:"center",letterSpacing:4},{id:228,text:"Grateful",category:"Faith",fontSize:38,fontFamily:"Dancing Script",fontWeight:"700",fill:"#9a3412",textAlign:"center"},{id:229,text:"But First, Coffee",category:"Foodie",fontSize:30,fontFamily:"Pacifico",fill:"#5b3a29",textAlign:"center"},{id:230,text:"Taco Tuesday",category:"Foodie",fontSize:34,fontFamily:"Lobster",fill:"#ca8a04",textAlign:"center"},{id:231,text:"FRESH",category:"Foodie",fontSize:42,fontFamily:"Anton",fill:"#15803d",textAlign:"center",letterSpacing:2},{id:232,text:"Birthday Squad",category:"Kids",fontSize:32,fontFamily:"Caveat",fontWeight:"700",fill:"#db2777",textAlign:"center"},{id:233,text:"Party Time",category:"Kids",fontSize:36,fontFamily:"Pacifico",fill:"#7c3aed",textAlign:"center"},{id:234,text:"Little Legend",category:"Kids",fontSize:34,fontFamily:"Dancing Script",fontWeight:"700",fill:"#2563eb",textAlign:"center"},{id:235,text:"The Family",category:"Family",fontSize:40,fontFamily:"Great Vibes",fill:"#3f3f46",textAlign:"center"},{id:236,text:"Family",category:"Family",fontSize:46,fontFamily:"Sacramento",fill:"#9a3412",textAlign:"center"},{id:237,text:"HOME",category:"Family",fontSize:40,fontFamily:"Alfa Slab One",fill:"#374151",textAlign:"center",letterSpacing:6},{id:238,text:"Gather",category:"Family",fontSize:40,fontFamily:"Playfair Display",fontStyle:"italic",fontWeight:"700",fill:"#1f2937",textAlign:"center"},{id:239,text:"GOOD VIBES",category:"Music",fontSize:34,fontFamily:"Bebas Neue",fill:"#0891b2",textAlign:"center",letterSpacing:4},{id:240,text:"On Repeat",category:"Music",fontSize:36,fontFamily:"Lobster",fill:"#7c3aed",textAlign:"center"},{id:241,text:"GAME OVER",category:"Gaming",fontSize:34,fontFamily:"Bungee",fill:"#dc2626",textAlign:"center"},{id:242,text:"PLAYER ONE",category:"Gaming",fontSize:32,fontFamily:"Squada One",fill:"#16a34a",textAlign:"center",letterSpacing:2},{id:243,text:"CHAMPIONS",category:"Sports",fontSize:30,fontFamily:"Anton",fill:"#b45309",textAlign:"center",letterSpacing:4},{id:244,text:"TEAM SPIRIT",category:"Sports",fontSize:30,fontFamily:"Bebas Neue",fill:"#1d4ed8",textAlign:"center",letterSpacing:3},{id:245,text:"Dream Big",category:"Motivational",fontSize:40,fontFamily:"Pacifico",fill:"#db2777",textAlign:"center"},{id:246,text:"Hustle",category:"Motivational",fontSize:44,fontFamily:"Alfa Slab One",fill:"#111827",textAlign:"center"},{id:247,text:"Good Vibes Only",category:"Motivational",fontSize:34,fontFamily:"Dancing Script",fontWeight:"700",fill:"#0d9488",textAlign:"center"},{id:248,text:"BOLD",category:"Motivational",fontSize:46,fontFamily:"Bungee",fill:"#ea580c",textAlign:"center"},{id:249,text:"Love You More",category:"Love",fontSize:38,fontFamily:"Great Vibes",fill:"#be123c",textAlign:"center"},{id:250,text:"xoxo",category:"Love",fontSize:48,fontFamily:"Sacramento",fill:"#db2777",textAlign:"center"},{id:251,text:"Bonjour",category:"Calligraphy",fontSize:46,fontFamily:"Great Vibes",fill:"#1f2937",textAlign:"center"},{id:252,text:"Forever & Always",category:"Calligraphy",fontSize:40,fontFamily:"Allura",fill:"#be123c",textAlign:"center"},{id:253,text:"Cheers",category:"Calligraphy",fontSize:48,fontFamily:"Parisienne",fill:"#0f766e",textAlign:"center"},{id:254,text:"Sweet Dreams",category:"Calligraphy",fontSize:42,fontFamily:"Tangerine",fontWeight:"700",fill:"#7c3aed",textAlign:"center"},{id:255,text:"Hello Gorgeous",category:"Calligraphy",fontSize:38,fontFamily:"Dancing Script",fontWeight:"700",fill:"#db2777",textAlign:"center"},{id:256,text:"Stay Wild",category:"Calligraphy",fontSize:42,fontFamily:"Sacramento",fill:"#16a34a",textAlign:"center"},{id:257,text:"Adventure Awaits",category:"Calligraphy",fontSize:34,fontFamily:"Satisfy",fill:"#1d4ed8",textAlign:"center"},{id:258,text:"Handcrafted",category:"Calligraphy",fontSize:36,fontFamily:"Kaushan Script",fill:"#b45309",textAlign:"center"},{id:259,text:"Just Married",category:"Calligraphy",fontSize:42,fontFamily:"Great Vibes",fill:"#9d174d",textAlign:"center"},{id:260,text:"Celebrate",category:"Calligraphy",fontSize:40,fontFamily:"Yellowtail",fill:"#c026d3",textAlign:"center"},{id:261,text:"With Love",category:"Calligraphy",fontSize:44,fontFamily:"Cookie",fill:"#e11d48",textAlign:"center"},{id:262,text:"Wanderlust",category:"Calligraphy",fontSize:38,fontFamily:"Marck Script",fill:"#0891b2",textAlign:"center"},{id:263,text:"Grateful",category:"Calligraphy",fontSize:44,fontFamily:"Pacifico",fill:"#ea580c",textAlign:"center"},{id:264,text:"Magnifique",category:"Calligraphy",fontSize:40,fontFamily:"Allura",fill:"#4338ca",textAlign:"center"},{id:265,text:"Bloom",category:"Calligraphy",fontSize:52,fontFamily:"Parisienne",fill:"#db2777",textAlign:"center"},{id:266,text:"Bella Vita",category:"Calligraphy",fontSize:42,fontFamily:"Satisfy",fill:"#0d9488",textAlign:"center"}],ki=["Arial","Helvetica","Times New Roman","Georgia","Verdana","Courier New","Tahoma","Trebuchet MS","Impact","Comic Sans MS"],Xa=new Set(ki),bi=[{name:"System",fonts:ki},{name:"Signage & Display",fonts:["Bebas Neue","Anton","Oswald","Archivo Black","Teko","Fjalla One","Saira Condensed","Squada One","Staatliches","Passion One","Alfa Slab One","Titan One","Bowlby One SC","Bungee","Bungee Inline"]},{name:"Sans Serif",fonts:["Roboto","Open Sans","Montserrat","Lato","Poppins","Inter","Raleway","Work Sans","Nunito","Rubik","Barlow","Kanit","Mukta"]},{name:"Serif",fonts:["Merriweather","Playfair Display","Lora","PT Serif","Cormorant Garamond","Libre Baskerville","EB Garamond","Crimson Text","Bitter"]},{name:"Slab Serif",fonts:["Roboto Slab","Arvo","Zilla Slab","Josefin Slab"]},{name:"Script & Handwriting",fonts:["Dancing Script","Pacifico","Great Vibes","Satisfy","Sacramento","Caveat","Kaushan Script","Lobster","Cookie","Allura","Parisienne","Yellowtail","Tangerine","Marck Script","Shadows Into Light","Permanent Marker","Homemade Apple"]},{name:"Decorative & Stencil",fonts:["Black Ops One","Stardos Stencil","Special Elite","Monoton","Faster One","Press Start 2P","Creepster","Righteous","Audiowide","Orbitron","Russo One","Wallpoet"]},{name:"Monospace",fonts:["Roboto Mono","Source Code Pro","JetBrains Mono","Space Mono","IBM Plex Mono"]}],ia=bi.reduce((r,a)=>r.concat(a.fonts),[]),Qa=r=>Xa.has(r),Za="https://fonts.googleapis.com/css2",Qi=new Set(ki),Ka=r=>`family=${r.trim().replace(/\s+/g,"+")}:wght@400;700`,He=r=>{if(typeof document>"u")return;const a=(r||[]).filter(n=>n&&!Qi.has(n));if(a.length===0)return;const s=10;for(let n=0;n<a.length;n+=s){const l=a.slice(n,n+s),h=document.createElement("link");h.rel="stylesheet",h.href=`${Za}?${l.map(Ka).join("&")}&display=swap`,h.setAttribute("data-simplex-font","1"),document.head.appendChild(h),l.forEach(f=>Qi.add(f))}},aa=async r=>{if(!(!r||Qa(r))&&(He([r]),!(typeof document>"u"||!document.fonts||!document.fonts.load)))try{await Promise.all([document.fonts.load(`400 24px "${r}"`),document.fonts.load(`700 24px "${r}"`)])}catch{}},Ci=async r=>{const a=Array.from(new Set((r||[]).filter(Boolean)));await Promise.all(a.map(aa))},Si={business:{name:"Business & Office",icons:[{name:"briefcase",symbol:"💼",unicode:"💼"},{name:"chart-up",symbol:"📈",unicode:"📈"},{name:"chart-down",symbol:"📉",unicode:"📉"},{name:"graph",symbol:"📊",unicode:"📊"},{name:"clipboard",symbol:"📋",unicode:"📋"},{name:"calendar",symbol:"📅",unicode:"📅"},{name:"office",symbol:"🏢",unicode:"🏢"},{name:"bank",symbol:"🏦",unicode:"🏦"},{name:"money-bag",symbol:"💰",unicode:"💰"},{name:"credit-card",symbol:"💳",unicode:"💳"}]},technology:{name:"Technology",icons:[{name:"laptop",symbol:"💻",unicode:"💻"},{name:"phone",symbol:"📱",unicode:"📱"},{name:"desktop",symbol:"🖥️",unicode:"🖥️"},{name:"keyboard",symbol:"⌨️",unicode:"⌨️"},{name:"mouse",symbol:"🖱️",unicode:"🖱️"},{name:"printer",symbol:"🖨️",unicode:"🖨️"},{name:"wifi",symbol:"📶",unicode:"📶"},{name:"battery",symbol:"🔋",unicode:"🔋"},{name:"plug",symbol:"🔌",unicode:"🔌"},{name:"gear",symbol:"⚙️",unicode:"⚙️"}]},communication:{name:"Communication",icons:[{name:"email",symbol:"📧",unicode:"📧"},{name:"envelope",symbol:"✉️",unicode:"✉️"},{name:"phone-call",symbol:"📞",unicode:"📞"},{name:"message",symbol:"💬",unicode:"💬"},{name:"announcement",symbol:"📢",unicode:"📢"},{name:"megaphone",symbol:"📣",unicode:"📣"},{name:"satellite",symbol:"📡",unicode:"📡"},{name:"radio",symbol:"📻",unicode:"📻"},{name:"microphone",symbol:"🎤",unicode:"🎤"},{name:"speaker",symbol:"🔊",unicode:"🔊"}]},transport:{name:"Transportation",icons:[{name:"car",symbol:"🚗",unicode:"🚗"},{name:"truck",symbol:"🚛",unicode:"🚛"},{name:"bus",symbol:"🚌",unicode:"🚌"},{name:"airplane",symbol:"✈️",unicode:"✈️"},{name:"train",symbol:"🚆",unicode:"🚆"},{name:"ship",symbol:"🚢",unicode:"🚢"},{name:"bicycle",symbol:"🚴",unicode:"🚴"},{name:"motorcycle",symbol:"🏍️",unicode:"🏍️"},{name:"taxi",symbol:"🚕",unicode:"🚕"},{name:"rocket",symbol:"🚀",unicode:"🚀"}]},nature:{name:"Nature & Environment",icons:[{name:"tree",symbol:"🌳",unicode:"🌳"},{name:"leaf",symbol:"🍃",unicode:"🍃"},{name:"flower",symbol:"🌸",unicode:"🌸"},{name:"sun",symbol:"☀️",unicode:"☀️"},{name:"moon",symbol:"🌙",unicode:"🌙"},{name:"star",symbol:"⭐",unicode:"⭐"},{name:"cloud",symbol:"☁️",unicode:"☁️"},{name:"rainbow",symbol:"🌈",unicode:"🌈"},{name:"mountain",symbol:"⛰️",unicode:"⛰️"},{name:"globe",symbol:"🌍",unicode:"🌍"}]},symbols:{name:"Symbols & Signs",icons:[{name:"check",symbol:"✅",unicode:"✅"},{name:"cross",symbol:"❌",unicode:"❌"},{name:"warning",symbol:"⚠️",unicode:"⚠️"},{name:"info",symbol:"ℹ️",unicode:"ℹ️"},{name:"question",symbol:"❓",unicode:"❓"},{name:"exclamation",symbol:"❗",unicode:"❗"},{name:"lock",symbol:"🔒",unicode:"🔒"},{name:"unlock",symbol:"🔓",unicode:"🔓"},{name:"key",symbol:"🔑",unicode:"🔑"},{name:"shield",symbol:"🛡️",unicode:"🛡️"}]}},oa=()=>Object.values(Si).flatMap(r=>r.icons.map(a=>({...a,category:r.name}))),Ja=r=>oa().filter(s=>s.name.toLowerCase().includes(r.toLowerCase())||s.category.toLowerCase().includes(r.toLowerCase())),to=({onSelectIcon:r,disabled:a=!1})=>{const[s,n]=p.useState(!1),[l,h]=p.useState(""),[f,k]=p.useState("all"),C=p.useRef(null);p.useEffect(()=>{const v=B=>{C.current&&!C.current.contains(B.target)&&n(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[]);const E=v=>{r(v),n(!1),h("")},M=(()=>{let v=oa();if(l.trim()&&(v=Ja(l)),f!=="all"){const B=Si[f];B&&(v=v.filter(I=>I.category===B.name))}return v})();return e.jsxs("div",{className:"icon-selector",ref:C,children:[e.jsxs("button",{className:"toolbar-btn dropdown-trigger",disabled:a,onClick:()=>n(!s),title:"Add Icon",children:[e.jsx("span",{className:"icon",children:"🎯"}),e.jsx("span",{className:"label",children:"Icons"}),e.jsx("span",{className:"dropdown-arrow",children:"▼"})]}),s&&e.jsxs("div",{className:"icon-dropdown",children:[e.jsxs("div",{className:"icon-dropdown-header",children:[e.jsx("input",{type:"text",placeholder:"Search icons...",value:l,onChange:v=>h(v.target.value),className:"icon-search"}),e.jsxs("select",{value:f,onChange:v=>k(v.target.value),className:"category-select",children:[e.jsx("option",{value:"all",children:"All Categories"}),Object.entries(Si).map(([v,B])=>e.jsx("option",{value:v,children:B.name},v))]})]}),e.jsx("div",{className:"icon-grid",children:M.length===0?e.jsx("div",{className:"no-icons",children:l?"No icons found":"No icons in this category"}):M.map((v,B)=>e.jsxs("button",{className:"icon-item",onClick:()=>E(v),title:`${v.name} (${v.category})`,children:[e.jsx("span",{className:"icon-symbol",children:v.symbol}),e.jsx("span",{className:"icon-name",children:v.name})]},`${v.name}-${B}`))}),e.jsx("div",{className:"icon-dropdown-footer",children:e.jsxs("span",{className:"icon-count",children:[M.length," icon",M.length!==1?"s":""]})})]})]})},eo=({isOpen:r,onClose:a,onAddQRCode:s,theme:n})=>{const[l,h]=p.useState(""),[f,k]=p.useState(""),[C,E]=p.useState(200),[N,M]=p.useState("M"),v=()=>{if(!l.trim())return;const H={width:C,errorCorrectionLevel:N,type:"image/png",quality:.92,margin:1,color:{dark:"#000000",light:"#FFFFFF"}};Ga.toDataURL(l,H,(Q,z)=>{if(Q){console.error("QR Code generation error:",Q);return}k(z)})},B=()=>{if(!f)return;const H=new Image;H.onload=()=>{s({type:"qrcode",src:f,data:l,width:C,height:C,x:100,y:100,imageObject:H}),I()},H.src=f},I=()=>{h(""),k(""),a()};return r?e.jsx("div",{className:"qr-modal-overlay",onClick:I,children:e.jsxs("div",{className:"qr-modal-content",onClick:H=>H.stopPropagation(),children:[e.jsxs("div",{className:"qr-modal-header",children:[e.jsx("h3",{children:"Generate QR Code"}),e.jsx("button",{className:"qr-modal-close",onClick:I,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"qr-modal-body",children:[e.jsxs("div",{className:"qr-form-group",children:[e.jsx("label",{htmlFor:"qr-data",children:"Enter Data (URL, Text, etc.)"}),e.jsx("textarea",{id:"qr-data",value:l,onChange:H=>h(H.target.value),placeholder:"https://example.com or any text...",rows:3})]}),e.jsxs("div",{className:"qr-options",children:[e.jsxs("div",{className:"qr-form-group",children:[e.jsx("label",{htmlFor:"qr-size",children:"Size (px)"}),e.jsx("input",{type:"number",id:"qr-size",value:C,onChange:H=>E(Math.max(50,Math.min(500,parseInt(H.target.value)||200))),min:"50",max:"500"})]}),e.jsxs("div",{className:"qr-form-group",children:[e.jsx("label",{htmlFor:"qr-error-level",children:"Error Correction"}),e.jsxs("select",{id:"qr-error-level",value:N,onChange:H=>M(H.target.value),children:[e.jsx("option",{value:"L",children:"Low (7%)"}),e.jsx("option",{value:"M",children:"Medium (15%)"}),e.jsx("option",{value:"Q",children:"Quartile (25%)"}),e.jsx("option",{value:"H",children:"High (30%)"})]})]})]}),e.jsx("div",{className:"qr-actions",children:e.jsx("button",{className:"qr-btn qr-btn-generate",onClick:v,disabled:!l.trim(),children:"Generate QR Code"})}),f&&e.jsxs("div",{className:"qr-preview",children:[e.jsx("h4",{children:"Preview"}),e.jsx("div",{className:"qr-preview-container",children:e.jsx("img",{src:f,alt:"QR Code Preview"})}),e.jsx("button",{className:"qr-btn qr-btn-add",onClick:B,style:{backgroundColor:(n==null?void 0:n.primaryColor)||"#3b82f6",borderColor:(n==null?void 0:n.primaryColor)||"#3b82f6"},children:"Add to Canvas"})]})]})]})}):null},io=({isOpen:r,onClose:a,onAddBarcode:s,theme:n})=>{const[l,h]=p.useState(""),[f,k]=p.useState("CODE128"),[C,E]=p.useState(null),[N,M]=p.useState(2),[v,B]=p.useState(100),[I,H]=p.useState(20),[Q,z]=p.useState("center"),[T,S]=p.useState("bottom"),[L,j]=p.useState(10),it=p.useRef(null),J=[{value:"CODE128",label:"CODE128 (Most Common)"},{value:"EAN13",label:"EAN-13 (European Article Number)"},{value:"EAN8",label:"EAN-8 (Short EAN)"},{value:"UPC",label:"UPC (Universal Product Code)"},{value:"CODE39",label:"CODE39 (Alpha-numeric)"},{value:"ITF14",label:"ITF-14 (Shipping/Logistics)"},{value:"MSI",label:"MSI (Retail)"},{value:"pharmacode",label:"Pharmacode (Pharmaceutical)"},{value:"codabar",label:"Codabar (Libraries/Blood banks)"}],xt=()=>{if(l.trim())try{E(e.jsx(_a,{value:l,format:f,width:N,height:v,fontSize:I,textAlign:Q,textPosition:T,margin:L,background:"#ffffff",lineColor:"#000000"}))}catch(O){console.error("Barcode generation error:",O),alert("Invalid data for selected barcode format. Please check your input.")}},gt=()=>{var O,R,nt,rt;if(!(!C||!it.current))try{const mt=it.current.querySelector("svg");if(!mt){console.error("No SVG element found in barcode");return}const w=document.createElement("canvas"),X=w.getContext("2d"),P=mt.getBoundingClientRect(),u=((R=(O=mt.width)==null?void 0:O.baseVal)==null?void 0:R.value)||P.width||200,A=((rt=(nt=mt.height)==null?void 0:nt.baseVal)==null?void 0:rt.value)||P.height||100;w.width=u,w.height=A;const _=new XMLSerializer().serializeToString(mt),at=new Blob([_],{type:"image/svg+xml;charset=utf-8"}),bt=URL.createObjectURL(at),dt=new Image;dt.onload=()=>{X.drawImage(dt,0,0);const It=w.toDataURL("image/png"),Ct=new Image;Ct.onload=()=>{s({type:"barcode",src:It,data:l,format:f,width:u,height:A,x:100,y:100,imageObject:Ct}),Ft()},Ct.src=It,URL.revokeObjectURL(bt)},dt.src=bt}catch(mt){console.error("Error adding barcode to canvas:",mt),alert("Failed to add barcode to canvas. Please try again.")}},Ft=()=>{h(""),E(null),k("CODE128"),M(2),B(100),H(20),a()},V=O=>({CODE128:"Supports all ASCII characters. Most versatile format.",EAN13:"Requires exactly 12 digits (13th is checksum). Used for retail products.",EAN8:"Requires exactly 7 digits (8th is checksum). Compact version of EAN-13.",UPC:"Requires exactly 11 digits (12th is checksum). Used in North America.",CODE39:"Supports letters, numbers, and some symbols. Widely used.",ITF14:"Requires exactly 13 digits (14th is checksum). Used for shipping containers.",MSI:"Numeric only. Used in retail inventory.",pharmacode:"Numbers 3-131070. Used in pharmaceutical industry.",codabar:"Supports 0-9, A-D, and symbols. Used in libraries."})[O]||"";return r?e.jsx("div",{className:"barcode-modal-overlay",onClick:Ft,children:e.jsxs("div",{className:"barcode-modal-content",onClick:O=>O.stopPropagation(),children:[e.jsxs("div",{className:"barcode-modal-header",children:[e.jsx("h3",{children:"Generate Barcode"}),e.jsx("button",{className:"barcode-modal-close",onClick:Ft,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"barcode-modal-body",children:[e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-data",children:"Enter Data"}),e.jsx("input",{type:"text",id:"barcode-data",value:l,onChange:O=>h(O.target.value),placeholder:"Enter your data..."})]}),e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-format",children:"Barcode Format"}),e.jsx("select",{id:"barcode-format",value:f,onChange:O=>k(O.target.value),children:J.map(O=>e.jsx("option",{value:O.value,children:O.label},O.value))}),e.jsx("small",{className:"format-description",children:V(f)})]}),e.jsxs("div",{className:"barcode-options",children:[e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-width",children:"Bar Width"}),e.jsx("input",{type:"range",id:"barcode-width",min:"1",max:"4",step:"0.5",value:N,onChange:O=>M(parseFloat(O.target.value))}),e.jsxs("span",{className:"range-value",children:[N,"px"]})]}),e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-height",children:"Height"}),e.jsx("input",{type:"range",id:"barcode-height",min:"50",max:"200",value:v,onChange:O=>B(parseInt(O.target.value))}),e.jsxs("span",{className:"range-value",children:[v,"px"]})]}),e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"barcode-fontsize",children:"Font Size"}),e.jsx("input",{type:"range",id:"barcode-fontsize",min:"10",max:"30",value:I,onChange:O=>H(parseInt(O.target.value))}),e.jsxs("span",{className:"range-value",children:[I,"px"]})]}),e.jsxs("div",{className:"barcode-form-group",children:[e.jsx("label",{htmlFor:"text-position",children:"Text Position"}),e.jsxs("select",{id:"text-position",value:T,onChange:O=>S(O.target.value),children:[e.jsx("option",{value:"bottom",children:"Bottom"}),e.jsx("option",{value:"top",children:"Top"})]})]})]}),e.jsx("div",{className:"barcode-actions",children:e.jsx("button",{className:"barcode-btn barcode-btn-generate",onClick:xt,disabled:!l.trim(),children:"Generate Barcode"})}),C&&e.jsxs("div",{className:"barcode-preview",children:[e.jsx("h4",{children:"Preview"}),e.jsx("div",{className:"barcode-preview-container",ref:it,children:C}),e.jsx("button",{className:"barcode-btn barcode-btn-add",onClick:gt,style:{backgroundColor:(n==null?void 0:n.primaryColor)||"#3b82f6",borderColor:(n==null?void 0:n.primaryColor)||"#3b82f6"},children:"Add to Canvas"})]})]})]})}):null},ao=({theme:r})=>e.jsxs("div",{className:"premium-feature-container",style:{padding:"20px",backgroundColor:"#f8f9fa",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.05)",textAlign:"center",maxWidth:"400px",margin:"0 auto"},children:[e.jsx("div",{style:{marginBottom:"16px"},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"#ffc107"},children:[e.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),e.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]})}),e.jsx("h3",{style:{color:"#333",fontSize:"18px",fontWeight:"600",marginBottom:"12px"},children:"Premium Feature Access"}),e.jsx("p",{style:{color:"#555",fontSize:"15px",lineHeight:"1.5",marginBottom:"20px"},children:"Premium stickers feature requires a subscription to access."}),e.jsx("a",{href:"https://mypixia.com/developer",target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:(r==null?void 0:r.primaryColor)||"#4c5bf2",color:"white",padding:"10px 20px",borderRadius:"4px",textDecoration:"none",fontWeight:"500",transition:"background-color 0.2s ease"},children:"Get API Key"})]}),Zi=()=>e.jsxs("div",{style:{textAlign:"center",padding:"40px"},children:[e.jsx("div",{style:{border:"4px solid #f3f3f3",borderTop:"4px solid #3498db",borderRadius:"50%",width:"40px",height:"40px",animation:"spin 2s linear infinite",margin:"0 auto 20px"}}),e.jsx("p",{children:"Loading..."}),e.jsx("style",{children:`
23
23
  @keyframes spin {
24
24
  0% { transform: rotate(0deg); }
25
25
  100% { transform: rotate(360deg); }
26
26
  }
27
- `})]}),la=({isOpen:s,onClose:a,onAddSticker:o,theme:n,apiKey:l,apiEndpoint:c})=>{const[d,y]=f.useState([]),[x,F]=f.useState(!1),[w,j]=f.useState(null),[m,M]=f.useState(""),[z,R]=f.useState(""),[p,T]=f.useState({});f.useRef(null);const[g,q]=f.useState(!1),[E,tt]=f.useState(!1),[K,it]=f.useState(!1),st=`${c}/api/v1/designer`;f.useEffect(()=>{s&&l&&yt()},[s,l]);const yt=async()=>{const G=sessionStorage.getItem("apc_x_sub_status");G==="active"?(q(!0),tt(!0),U()):G==="inactive"?(q(!1),tt(!0)):(it(!0),await $())},$=async()=>{if(!l){q(!1),tt(!0),it(!1);return}const G=`${st}/get-subscription-status/${l}`;try{(await We.get(G)).data.object==="active"?(sessionStorage.setItem("apc_x_sub_status","active"),q(!0),U()):(sessionStorage.setItem("apc_x_sub_status","inactive"),q(!1))}catch(P){console.error("Subscription check failed:",P),sessionStorage.setItem("apc_x_sub_status","inactive"),q(!1)}finally{it(!1),tt(!0)}},U=async()=>{const G=sessionStorage.getItem("apc_stickers");if(G)try{const P=JSON.parse(G);y(P);return}catch{console.warn("Failed to parse cached stickers, fetching fresh data")}F(!0),j(null);try{const P=await We.get(`${st}/get-stickers`);if(P.data&&P.data.object&&P.data.object.contents){const ct=P.data.object.contents;y(ct),sessionStorage.setItem("apc_stickers",JSON.stringify(ct))}else throw new Error("Invalid response format")}catch(P){console.error("Error fetching stickers:",P),j("Failed to load stickers. Please try again.")}finally{F(!1)}},k=(G,P)=>{o({type:"sticker",src:G,name:P,width:100,height:100,x:100,y:100}),a()},H=G=>{T(P=>({...P,[G]:!P[G]}))},W=G=>{const P={};return G.forEach(ct=>{const b=ct.name.split("/");let D=P;b.forEach((Y,ot)=>{D[Y]||(D[Y]=ot===b.length-1?ct:{}),D=D[Y]})}),P},N=(G,P="",ct=0)=>t.jsx("div",{className:"sticker-tree-level",style:{paddingLeft:`${ct*15}px`},children:Object.keys(G).map(b=>{const D=`${P}/${b}`,Y=p[D];return G[b].type==="image"?!z||b.toLowerCase().includes(z.toLowerCase())?t.jsx("div",{className:"sticker-item",onClick:()=>k(G[b].url,b),children:t.jsx("div",{className:"sticker-preview",children:t.jsx("img",{src:G[b].url,alt:b,loading:"lazy",onError:nt=>{nt.target.style.display="none"}})})},D):null:t.jsxs("div",{className:"sticker-category",children:[t.jsxs("div",{className:"category-header",onClick:()=>H(D),children:[t.jsx("span",{className:`expand-icon ${Y?"expanded":""}`,children:"▶"}),t.jsx("span",{className:"category-name",children:b})]}),Y&&N(G[b],D,ct+1)]},D)})}),B=d.filter(G=>!z||G.name.toLowerCase().includes(z.toLowerCase()));return s?t.jsx("div",{className:"sticker-modal-overlay",onClick:a,children:t.jsxs("div",{className:"sticker-modal-content",onClick:G=>G.stopPropagation(),children:[t.jsxs("div",{className:"sticker-modal-header",children:[t.jsx("h3",{children:"Stickers"}),t.jsx("button",{className:"sticker-modal-close",onClick:a,"aria-label":"Close",children:"×"})]}),t.jsxs("div",{className:"sticker-modal-body",children:[K&&t.jsx(ci,{}),!g&&!K&&E&&t.jsx(na,{theme:n}),g&&E&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"sticker-modal-controls",children:t.jsx("div",{className:"search-container",children:t.jsx("input",{type:"text",placeholder:"Search stickers...",value:z,onChange:G=>R(G.target.value),className:"sticker-search"})})}),x&&t.jsx(ci,{}),w&&t.jsxs("div",{className:"sticker-error",children:[t.jsx("p",{children:w}),t.jsx("button",{onClick:U,children:"Retry"})]}),!x&&!w&&d.length>0&&t.jsx("div",{className:"sticker-grid",children:N(W(B))})]})]})]})}):null},ca=`
27
+ `})]}),oo=({isOpen:r,onClose:a,onAddSticker:s,theme:n,apiKey:l,apiEndpoint:h})=>{const[f,k]=p.useState([]),[C,E]=p.useState(!1),[N,M]=p.useState(null),[v,B]=p.useState(""),[I,H]=p.useState(""),[Q,z]=p.useState({});p.useRef(null);const[T,S]=p.useState(!1),[L,j]=p.useState(!1),[it,J]=p.useState(!1),xt=`${h}/api/v1/designer`;p.useEffect(()=>{r&&l&&gt()},[r,l]);const gt=async()=>{const w=sessionStorage.getItem("apc_x_sub_status");w==="active"?(S(!0),j(!0),V()):w==="inactive"?(S(!1),j(!0)):(J(!0),await Ft())},Ft=async()=>{if(!l){S(!1),j(!0),J(!1);return}const w=`${xt}/get-subscription-status/${l}`;try{(await xi.get(w)).data.object==="active"?(sessionStorage.setItem("apc_x_sub_status","active"),S(!0),V()):(sessionStorage.setItem("apc_x_sub_status","inactive"),S(!1))}catch(X){console.error("Subscription check failed:",X),sessionStorage.setItem("apc_x_sub_status","inactive"),S(!1)}finally{J(!1),j(!0)}},V=async()=>{const w=sessionStorage.getItem("apc_stickers");if(w)try{const X=JSON.parse(w);k(X);return}catch{console.warn("Failed to parse cached stickers, fetching fresh data")}E(!0),M(null);try{const X=await xi.get(`${xt}/get-stickers`);if(X.data&&X.data.object&&X.data.object.contents){const P=X.data.object.contents;k(P),sessionStorage.setItem("apc_stickers",JSON.stringify(P))}else throw new Error("Invalid response format")}catch(X){console.error("Error fetching stickers:",X),M("Failed to load stickers. Please try again.")}finally{E(!1)}},O=(w,X)=>{s({type:"sticker",src:w,name:X,width:100,height:100,x:100,y:100}),a()},R=w=>{z(X=>({...X,[w]:!X[w]}))},nt=w=>{const X={};return w.forEach(P=>{const u=P.name.split("/");let A=X;u.forEach((_,at)=>{A[_]||(A[_]=at===u.length-1?P:{}),A=A[_]})}),X},rt=(w,X="",P=0)=>e.jsx("div",{className:"sticker-tree-level",style:{paddingLeft:`${P*15}px`},children:Object.keys(w).map(u=>{const A=`${X}/${u}`,_=Q[A];return w[u].type==="image"?!I||u.toLowerCase().includes(I.toLowerCase())?e.jsx("div",{className:"sticker-item",onClick:()=>O(w[u].url,u),children:e.jsx("div",{className:"sticker-preview",children:e.jsx("img",{src:w[u].url,alt:u,loading:"lazy",onError:bt=>{bt.target.style.display="none"}})})},A):null:e.jsxs("div",{className:"sticker-category",children:[e.jsxs("div",{className:"category-header",onClick:()=>R(A),children:[e.jsx("span",{className:`expand-icon ${_?"expanded":""}`,children:"▶"}),e.jsx("span",{className:"category-name",children:u})]}),_&&rt(w[u],A,P+1)]},A)})}),mt=f.filter(w=>!I||w.name.toLowerCase().includes(I.toLowerCase()));return r?e.jsx("div",{className:"sticker-modal-overlay",onClick:a,children:e.jsxs("div",{className:"sticker-modal-content",onClick:w=>w.stopPropagation(),children:[e.jsxs("div",{className:"sticker-modal-header",children:[e.jsx("h3",{children:"Stickers"}),e.jsx("button",{className:"sticker-modal-close",onClick:a,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"sticker-modal-body",children:[it&&e.jsx(Zi,{}),!T&&!it&&L&&e.jsx(ao,{theme:n}),T&&L&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sticker-modal-controls",children:e.jsx("div",{className:"search-container",children:e.jsx("input",{type:"text",placeholder:"Search stickers...",value:I,onChange:w=>H(w.target.value),className:"sticker-search"})})}),C&&e.jsx(Zi,{}),N&&e.jsxs("div",{className:"sticker-error",children:[e.jsx("p",{children:N}),e.jsx("button",{onClick:V,children:"Retry"})]}),!C&&!N&&f.length>0&&e.jsx("div",{className:"sticker-grid",children:rt(nt(mt))})]})]})]})}):null},ro=`
28
28
  <defs>
29
29
  <linearGradient id="gloss" x1="0" y1="0" x2="1" y2="0">
30
30
  <stop offset="0" stop-color="#000" stop-opacity="0.28"/>
@@ -49,7 +49,7 @@ React keys must be passed directly to JSX without using spread:
49
49
  <filter id="lift" x="-30%" y="-30%" width="160%" height="160%">
50
50
  <feDropShadow dx="0.5" dy="1.1" stdDeviation="0.9" flood-color="#1a1208" flood-opacity="0.4"/>
51
51
  </filter>
52
- </defs>`,Se='fill="none" stroke="rgba(20,12,6,0.5)" stroke-width="1.3" stroke-dasharray="2.6 2" stroke-linecap="round"',O=(s,a,o,n,l="satin")=>`<circle cx="${s}" cy="${a}" r="${o}" fill="${n}"/><circle cx="${s}" cy="${a}" r="${o}" fill="url(#${l})"/><circle cx="${s}" cy="${a}" r="${o}" ${Se}/>`,bt=(s,a,o,n,l,c=0,d="satin")=>{const y=c?` transform="rotate(${c} ${s} ${a})"`:"";return`<ellipse cx="${s}" cy="${a}" rx="${o}" ry="${n}" fill="${l}"${y}/><ellipse cx="${s}" cy="${a}" rx="${o}" ry="${n}" fill="url(#${d})"${y}/><ellipse cx="${s}" cy="${a}" rx="${o}" ry="${n}" ${Se}${y}/>`},X=(s,a,o="satin")=>`<path d="${s}" fill="${a}"/><path d="${s}" fill="url(#${o})"/><path d="${s}" ${Se}/>`,Ct=(s,a,o,n,l,c=2,d="satin")=>`<rect x="${s}" y="${a}" width="${o}" height="${n}" rx="${c}" fill="${l}"/><rect x="${s}" y="${a}" width="${o}" height="${n}" rx="${c}" fill="url(#${d})"/><rect x="${s}" y="${a}" width="${o}" height="${n}" rx="${c}" ${Se}/>`,rt=(s,a,o=3)=>`<path d="${s}" fill="none" stroke="${a}" stroke-width="${o}" stroke-linecap="round"/><path d="${s}" fill="none" stroke="rgba(255,255,255,0.4)" stroke-width="${Math.max(.8,o*.35)}" stroke-linecap="round"/>`;let di=0;const Z=(s,a,o,n)=>{di+=1;const l=`<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 120 120">${ca}<g filter="url(#lift)"><g filter="url(#floss)" stroke-linejoin="round">${n}</g></g></svg>`;return{id:di,name:s,category:a,description:o,url:`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(l)}`}},Te=(s,a,o,n,l,c,d)=>[...Array(o)].map((y,x)=>{const F=360/o*x,w=F*Math.PI/180;return bt(s+Math.cos(w)*n,a+Math.sin(w)*n,l,c,d,F)}).join(""),Me=(s,a,o,n,l,c,d=3)=>[...Array(o)].map((y,x)=>{const F=360/o*x*Math.PI/180;return rt(`M${s+Math.cos(F)*n} ${a+Math.sin(F)*n} L${s+Math.cos(F)*l} ${a+Math.sin(F)*l}`,c,d)}).join(""),da=[Z("Rose","Floral","Satin rose",bt(60,58,26,26,"#e23b6d")+bt(60,58,17,17,"#f06292",0,"satinV")+O(60,58,8,"#ad1457")+X("M60 84 q4 16 -6 26","#2e7d32")),Z("Sunflower","Floral","Sunflower",Te(60,58,12,30,9,5,"#f4b400")+O(60,58,17,"#8d5524","satinV")),Z("Tulip","Floral","Tulip",X("M60 28 q18 6 16 30 q-16 -10 -16 -10 q0 0 -16 10 q-2 -24 16 -30 Z","#e23b6d")+X("M60 48 q8 4 7 20 q-7 -6 -7 -6 q0 0 -7 6 q-1 -16 7 -20 Z","#ad1457")+rt("M60 58 L60 96","#2e7d32",3)+X("M60 78 q14 -6 20 4 q-14 8 -20 -4 Z","#43a047")),Z("Daisy","Floral","Daisy",Te(60,58,10,26,11,5,"#ffffff")+O(60,58,12,"#ffca28")),Z("Cherry Blossom","Floral","Cherry blossom",Te(60,60,5,18,11,9,"#f8bbd0")+O(60,60,7,"#fff176")+Me(60,60,5,6,16,"#fce4ec",1.4)),Z("Lavender","Floral","Lavender sprig",rt("M60 100 C58 70 62 50 60 26","#5e7d3a",3)+[...Array(7)].map((s,a)=>bt(60+(a%2?6:-6),30+a*9,6,4,"#9575cd",a%2?25:-25)).join("")),Z("Pine Tree","Nature","Evergreen",Ct(56,86,8,16,"#795548")+X("M60 20 L82 56 L38 56 Z","#2e7d32")+X("M60 40 L88 82 L32 82 Z","#388e3c")),Z("Mountain","Nature","Mountain",X("M16 92 L52 36 L72 66 L88 44 L104 92 Z","#6d8299")+X("M52 36 L64 54 L40 54 Z","#ffffff")+O(92,30,9,"#ffd54f")),Z("Sun","Nature","Sunburst",Me(60,60,12,26,40,"#f9a825",3)+O(60,60,22,"#fbc02d")),Z("Leaf Sprig","Nature","Leaf sprig",rt("M60 96 C60 70 60 50 60 28","#2e7d32",3)+X("M60 70 q-22 -6 -26 -22 q24 0 26 22 Z","#43a047")+X("M60 52 q22 -6 26 -22 q-24 0 -26 22 Z","#66bb6a")+X("M60 38 q-18 -6 -22 -20 q20 0 22 20 Z","#43a047")),Z("Cactus","Nature","Potted cactus",X("M52 92 q-2 -34 8 -34 q10 0 8 34 Z","#2e7d32")+X("M52 70 q-16 0 -16 -14 q0 -8 6 -8 q10 0 10 14 Z","#43a047")+X("M68 64 q16 0 16 -14 q0 -8 -6 -8 q-10 0 -10 14 Z","#43a047")+Ct(46,92,28,16,"#c1502e",3)),Z("Mushroom","Nature","Toadstool",X("M30 64 q0 -34 30 -34 q30 0 30 34 Z","#e53935")+Ct(50,64,20,34,"#fff8e1",6)+O(46,50,4,"#fff")+O(60,44,5,"#fff")+O(74,52,4,"#fff")),Z("Acorn","Nature","Acorn",X("M40 56 q20 30 40 0 q-20 8 -40 0 Z","#a1683a")+X("M38 56 q22 -20 44 0 q-22 8 -44 0 Z","#6d4c2f")+rt("M60 30 L60 38","#6d4c2f",3)),Z("Butterfly","Animals","Butterfly",bt(44,50,16,13,"#7e57c2",-18)+bt(76,50,16,13,"#7e57c2",18,"satinV")+bt(46,76,12,10,"#9575cd",-12)+bt(74,76,12,10,"#9575cd",12,"satinV")+Ct(57,42,6,44,"#4527a0",3)+rt("M60 44 L52 30","#4527a0",2)+rt("M60 44 L68 30","#4527a0",2)),Z("Bee","Animals","Bumblebee",bt(60,64,22,16,"#fbc02d")+Ct(50,48,8,32,"#3e2723",2)+Ct(64,48,8,32,"#3e2723",2)+bt(40,54,12,7,"#e3f2fd",-25)+bt(80,54,12,7,"#e3f2fd",25)),Z("Ladybug","Animals","Ladybug",O(60,62,24,"#e53935")+rt("M60 38 L60 86","#3e2723",2)+O(60,40,9,"#3e2723")+O(50,56,4,"#3e2723")+O(70,56,4,"#3e2723")+O(50,72,4,"#3e2723")+O(70,72,4,"#3e2723")),Z("Cat","Animals","Cat face",O(60,64,26,"#9e9e9e")+X("M40 46 L36 24 L54 40 Z","#9e9e9e")+X("M80 46 L84 24 L66 40 Z","#9e9e9e")+O(51,62,3.4,"#212121")+O(69,62,3.4,"#212121")+X("M56 72 q4 4 8 0","#212121")),Z("Bird","Animals","Little bird",bt(58,62,22,17,"#42a5f5")+O(74,50,10,"#42a5f5")+X("M82 50 L96 54 L82 58 Z","#fb8c00")+O(77,48,2.4,"#212121")+X("M40 64 q-16 4 -18 16 q18 -2 22 -8 Z","#1e88e5")),Z("Fish","Animals","Tropical fish",bt(56,62,26,16,"#26c6da")+X("M82 62 L100 48 L100 76 Z","#0097a7")+O(44,58,2.6,"#063")+X("M56 46 q0 -10 -8 -12 q2 8 8 12 Z","#0097a7")),Z("Paw","Animals","Paw print",bt(60,72,14,11,"#6d4c41")+O(44,52,6,"#6d4c41")+O(58,44,6,"#6d4c41")+O(72,46,6,"#6d4c41")+O(82,58,5,"#6d4c41")),Z("Diamond","Geometric","Diamond",X("M60 20 L96 60 L60 100 L24 60 Z","#1e88e5")+X("M60 38 L78 60 L60 82 L42 60 Z","#64b5f6","satinV")),Z("Chevron","Geometric","Chevrons",[0,18,36].map((s,a)=>rt(`M24 ${42+s} L60 ${62+s} L96 ${42+s}`,["#1e88e5","#26a69a","#ef6c00"][a],5)).join("")),Z("Mandala","Geometric","Mandala",O(60,60,30,"#8e24aa")+O(60,60,20,"#ab47bc","satinV")+[...Array(8)].map((s,a)=>{const o=a*45*Math.PI/180;return O(60+Math.cos(o)*30,60+Math.sin(o)*30,5,"#f3e5f5")}).join("")+O(60,60,8,"#f3e5f5")),Z("Heart","Symbols","Heart",X("M60 92 C24 66 30 34 50 34 C58 34 60 42 60 46 C60 42 62 34 70 34 C90 34 96 66 60 92 Z","#e53935")),Z("Star","Symbols","Star",X("M60 22 L71 50 L101 50 L77 68 L86 98 L60 80 L34 98 L43 68 L19 50 L49 50 Z","#fbc02d")),Z("Crown","Symbols","Crown",X("M28 84 L34 46 L48 66 L60 40 L72 66 L86 46 L92 84 Z","#f9a825")+Ct(28,84,64,10,"#f57f17")+O(34,46,5,"#fdd835")+O(60,40,5,"#fdd835")+O(86,46,5,"#fdd835")),Z("Anchor","Symbols","Anchor",O(60,30,7,"#37474f")+rt("M60 36 L60 92","#455a64",5)+rt("M40 60 L80 60","#455a64",5)+X("M30 76 q6 22 30 22 q24 0 30 -22 q-12 14 -30 14 q-18 0 -30 -14 Z","#37474f")),Z("Lightning","Symbols","Lightning bolt",X("M64 18 L40 64 L56 64 L50 102 L84 50 L66 50 Z","#ffb300")),Z("Music Note","Symbols","Music note",O(46,84,11,"#5e35b1")+O(82,76,11,"#5e35b1")+Ct(54,30,6,54,"#5e35b1",3)+Ct(85,22,6,54,"#5e35b1",3)+X("M57 30 L91 22 L91 34 L57 42 Z","#5e35b1")),Z("Peace","Symbols","Peace sign",O(60,60,30,"#43a047")+rt("M60 30 L60 90","rgba(255,255,255,0.95)",4)+rt("M60 60 L38 82","rgba(255,255,255,0.95)",4)+rt("M60 60 L82 82","rgba(255,255,255,0.95)",4)),Z("Cupcake","Food","Cupcake",X("M38 64 L82 64 L74 98 L46 98 Z","#d7a86e")+X("M34 64 q6 -28 26 -28 q20 0 26 28 Z","#ec407a")+O(48,50,3,"#fff")+O(60,44,3,"#fff")+O(72,50,3,"#fff")+O(60,34,5,"#e53935")),Z("Cherries","Food","Cherries",O(46,84,12,"#e53935")+O(74,84,12,"#c62828")+rt("M46 72 C50 50 60 40 64 30","#2e7d32",2.5)+rt("M74 72 C70 52 66 42 64 30","#2e7d32",2.5)+X("M64 30 q14 -8 22 -2 q-12 8 -22 2 Z","#43a047")),Z("Coffee","Food","Coffee cup",X("M34 50 L84 50 L80 92 L38 92 Z","#6d4c41")+X("M84 56 q16 0 16 14 q0 14 -18 12","#6d4c41")+rt("M48 38 q4 -8 0 -14","#bcaaa4",2.5)+rt("M60 38 q4 -8 0 -14","#bcaaa4",2.5)+rt("M72 38 q4 -8 0 -14","#bcaaa4",2.5)),Z("Soccer Ball","Sports","Soccer ball",O(60,60,32,"#fafafa")+X("M60 44 L74 54 L69 72 L51 72 L46 54 Z","#212121")+Me(60,60,5,12,30,"#212121",2)),Z("Basketball","Sports","Basketball",O(60,60,32,"#ef6c00")+rt("M60 28 L60 92","#3e2723",2.5)+rt("M28 60 L92 60","#3e2723",2.5)+rt("M36 36 Q60 60 36 84","#3e2723",2.5)+rt("M84 36 Q60 60 84 84","#3e2723",2.5)),Z("Snowflake","Holiday","Snowflake",[...Array(6)].map((s,a)=>{const o=a*60*Math.PI/180,n=60+Math.cos(o)*38,l=60+Math.sin(o)*38,c=60+Math.cos(o)*22,d=60+Math.sin(o)*22;return rt(`M60 60 L${n} ${l}`,"#4fc3f7",3)+rt(`M${c} ${d} L${c+Math.cos(o+.5)*10} ${d+Math.sin(o+.5)*10}`,"#4fc3f7",2)+rt(`M${c} ${d} L${c+Math.cos(o-.5)*10} ${d+Math.sin(o-.5)*10}`,"#4fc3f7",2)}).join("")+O(60,60,5,"#81d4fa")),Z("Gift","Holiday","Gift box",Ct(34,54,52,44,"#e53935",4)+Ct(54,54,12,44,"#fff",2)+Ct(34,50,52,12,"#c62828",3)+X("M60 50 q-18 -22 -2 -22 q8 0 2 22 Z","#fbc02d")+X("M60 50 q18 -22 2 -22 q-8 0 -2 22 Z","#fbc02d")),Z("Holly","Holiday","Holly & berries",X("M40 60 q10 -22 22 -10 q-2 16 -22 10 Z","#2e7d32")+X("M80 60 q-10 -22 -22 -10 q2 16 22 10 Z","#388e3c")+X("M50 78 q10 -16 20 -6 q-4 14 -20 6 Z","#43a047")+O(56,64,5,"#e53935")+O(64,64,5,"#c62828")+O(60,72,5,"#e53935")),Z("Monogram","Text","Initial monogram",O(60,60,34,"#5e35b1")+O(60,60,34,"#5e35b1","satinV")+'<text x="60" y="75" text-anchor="middle" font-family="Georgia, serif" font-size="46" font-weight="700" fill="#ede7f6">A</text>')],ha=({isOpen:s,onClose:a,onAddEmbroidery:o,theme:n,apiKey:l,apiEndpoint:c})=>{const[d,y]=f.useState([]),[x,F]=f.useState(!1),[w,j]=f.useState(null),[m,M]=f.useState(""),[z,R]=f.useState("All"),p=f.useRef(null),T=["All","Floral","Nature","Geometric","Traditional","Sports","Hobbies","Food","Symbols","Holiday","Text"];f.useEffect(()=>{s&&y(da)},[s]);const g=E=>{o({type:"embroidery",src:E.url,name:E.name,description:E.description,category:E.category,width:120,height:120,x:100,y:100}),a()},q=d.filter(E=>{const tt=!m||E.name.toLowerCase().includes(m.toLowerCase())||E.description.toLowerCase().includes(m.toLowerCase()),K=z==="All"||E.category===z;return tt&&K});return s?t.jsx("div",{className:"embroidery-modal-overlay",onClick:a,children:t.jsxs("div",{className:"embroidery-modal-content",onClick:E=>E.stopPropagation(),ref:p,children:[t.jsxs("div",{className:"embroidery-modal-header",children:[t.jsx("h3",{children:"Choose an Embroidery Design"}),t.jsx("button",{className:"embroidery-modal-close",onClick:a,"aria-label":"Close",children:"×"})]}),t.jsxs("div",{className:"embroidery-modal-controls",children:[t.jsx("div",{className:"search-container",children:t.jsx("input",{type:"text",placeholder:"Search embroidery designs...",value:m,onChange:E=>M(E.target.value),className:"embroidery-search"})}),t.jsxs("div",{className:"category-filter",children:[t.jsx("label",{children:"Category:"}),t.jsx("select",{value:z,onChange:E=>R(E.target.value),className:"category-select",children:T.map(E=>t.jsx("option",{value:E,children:E},E))})]})]}),t.jsxs("div",{className:"embroidery-modal-body",children:[x&&t.jsxs("div",{className:"embroidery-loading",children:[t.jsx("div",{className:"loading-spinner"}),t.jsx("p",{children:"Loading embroidery designs..."})]}),w&&t.jsx("div",{className:"embroidery-error",children:t.jsx("p",{children:w})}),!x&&!w&&t.jsx("div",{className:"embroidery-grid",children:q.map(E=>t.jsxs("div",{className:"embroidery-item",onClick:()=>g(E),title:E.description,children:[t.jsx("div",{className:"embroidery-preview",children:t.jsx("img",{src:E.url,alt:E.name,loading:"lazy",onError:tt=>{console.error("Failed to load embroidery image:",E.url),tt.target.style.display="none"}})}),t.jsxs("div",{className:"embroidery-info",children:[t.jsx("div",{className:"embroidery-name",children:E.name}),t.jsx("div",{className:"embroidery-category",children:E.category})]})]},E.id))}),!x&&!w&&q.length===0&&t.jsx("div",{className:"no-embroideries",children:t.jsx("p",{children:"No embroidery designs found matching your search."})})]}),t.jsx("div",{className:"embroidery-modal-footer",children:t.jsxs("div",{className:"embroidery-disclaimer",children:[t.jsx("span",{className:"disclaimer-icon",children:"ℹ️"}),t.jsx("span",{children:"Sample embroidery designs for preview. Actual embroidered results may vary based on fabric and thread."})]})})]})}):null},fa=(s,a,o,n)=>`<text x="90" y="${66+1.3}" text-anchor="middle" font-family="${o}" font-weight="700" font-size="${a}" fill="rgba(0,0,0,0.4)">${s}</text><text x="90" y="${66-.8}" text-anchor="middle" font-family="${o}" font-weight="700" font-size="${a}" fill="rgba(255,255,255,0.22)">${s}</text><text x="90" y="66" text-anchor="middle" font-family="${o}" font-weight="700" font-size="${a}" fill="${n}">${s}</text>`,ga=(s,a,o,n,l)=>{const c=`<svg xmlns="http://www.w3.org/2000/svg" width="180" height="120" viewBox="0 0 180 120"><defs><linearGradient id="c" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${l[0]}"/><stop offset="1" stop-color="${l[1]}"/></linearGradient></defs><rect x="6" y="6" width="168" height="108" rx="14" fill="url(#c)"/><rect x="14" y="14" width="152" height="92" rx="9" fill="none" stroke="rgba(0,0,0,0.25)" stroke-width="2"/><rect x="14.5" y="14.5" width="151" height="91" rx="9" fill="none" stroke="rgba(255,255,255,0.25)" stroke-width="1"/>`+fa(s,a,o,n)+"</svg>";return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(c)}`};let hi=0;const Ft=(s,a,o,{text:n,font:l,sysFont:c,ink:d,card:y,size:x=40,weight:F=700,style:w="normal",previewSize:j=30})=>(hi+=1,{id:hi,name:s,category:a,description:o,url:ga(n,j,c,d,y),add:{text:n,fontFamily:l,fontSize:x,fontWeight:F,fontStyle:w,fill:d,textAlign:"center",width:300,height:90}}),fi=["#b07e4f","#7d4f28"],pe=["#f3e6cf","#e3cda6"],Ee=["#dfe4ea","#9aa4b1"],De=["#3a4651","#222a31"],ua=[Ft("Welcome","Signage","Bold welcome sign",{text:"WELCOME",font:"Bebas Neue",sysFont:"Impact, sans-serif",ink:"#3a2a1a",card:pe,size:46,previewSize:34}),Ft("Open","Signage","Shop open sign",{text:"OPEN",font:"Anton",sysFont:"Impact, sans-serif",ink:"#7a3b12",card:fi,size:54,previewSize:40}),Ft("Café","Signage","Café script sign",{text:"Café",font:"Pacifico",sysFont:'"Brush Script MT", cursive',ink:"#f5f5f5",card:De,size:50,previewSize:38}),Ft("Gather","Signage","Gather sign",{text:"gather",font:"Playfair Display",sysFont:"Georgia, serif",ink:"#2e2a26",card:pe,size:46,style:"italic",previewSize:36}),Ft("Family Name","Home","Family name plaque",{text:"The Smiths",font:"Great Vibes",sysFont:'"Brush Script MT", cursive',ink:"#3a2a1a",card:fi,size:48,previewSize:30}),Ft("Home Sweet Home","Home","Home sweet home",{text:"Home Sweet Home",font:"Dancing Script",sysFont:'"Brush Script MT", cursive',ink:"#3a2a1a",card:pe,size:40,previewSize:22}),Ft("House Number","Home","House number",{text:"123",font:"Alfa Slab One",sysFont:"Georgia, serif",ink:"#2b3036",card:Ee,size:64,previewSize:48}),Ft("Address","Home","Street address",{text:"21 OAK STREET",font:"Oswald",sysFont:"Arial, sans-serif",ink:"#f5f5f5",card:De,size:34,previewSize:18}),Ft("Mr & Mrs","Wedding","Wedding sign",{text:"Mr & Mrs",font:"Great Vibes",sysFont:'"Brush Script MT", cursive',ink:"#3a2a1a",card:pe,size:52,previewSize:34}),Ft("Joy","Celebrations","Holiday joy",{text:"Joy",font:"Sacramento",sysFont:'"Brush Script MT", cursive',ink:"#f5f5f5",card:De,size:60,previewSize:46}),Ft("Established","Celebrations","Established year",{text:"EST. 2024",font:"Staatliches",sysFont:"Impact, sans-serif",ink:"#2b3036",card:Ee,size:44,previewSize:30}),Ft("Office","Business","Office name plate",{text:"OFFICE",font:"Oswald",sysFont:"Arial, sans-serif",ink:"#2b3036",card:Ee,size:40,previewSize:30})],ma=({isOpen:s,onClose:a,onAddHandcraft:o,theme:n})=>{const[l,c]=f.useState([]),[d,y]=f.useState(""),[x,F]=f.useState("All"),w=f.useRef(null),j=["All","Signage","Business","Home","Wedding","Celebrations"];f.useEffect(()=>{s&&c(ua)},[s]);const m=z=>{o({...z.add}),a()},M=l.filter(z=>{const R=!d||z.name.toLowerCase().includes(d.toLowerCase())||z.description.toLowerCase().includes(d.toLowerCase()),p=x==="All"||z.category===x;return R&&p});return s?t.jsx("div",{className:"embroidery-modal-overlay",onClick:a,children:t.jsxs("div",{className:"embroidery-modal-content",onClick:z=>z.stopPropagation(),ref:w,children:[t.jsxs("div",{className:"embroidery-modal-header",children:[t.jsx("h3",{children:"Choose a Signage Template"}),t.jsx("button",{className:"embroidery-modal-close",onClick:a,"aria-label":"Close",children:"×"})]}),t.jsxs("div",{className:"embroidery-modal-controls",children:[t.jsx("div",{className:"search-container",children:t.jsx("input",{type:"text",placeholder:"Search signage & handcraft templates...",value:d,onChange:z=>y(z.target.value),className:"embroidery-search"})}),t.jsxs("div",{className:"category-filter",children:[t.jsx("label",{children:"Category:"}),t.jsx("select",{value:x,onChange:z=>F(z.target.value),className:"category-select",children:j.map(z=>t.jsx("option",{value:z,children:z},z))})]})]}),t.jsxs("div",{className:"embroidery-modal-body",children:[t.jsx("div",{className:"embroidery-grid",children:M.map(z=>t.jsxs("div",{className:"embroidery-item",onClick:()=>m(z),title:z.description,children:[t.jsx("div",{className:"embroidery-preview",children:t.jsx("img",{src:z.url,alt:z.name,loading:"lazy"})}),t.jsxs("div",{className:"embroidery-info",children:[t.jsx("div",{className:"embroidery-name",children:z.name}),t.jsx("div",{className:"embroidery-category",children:z.category})]})]},z.id))}),M.length===0&&t.jsx("div",{className:"no-embroideries",children:t.jsx("p",{children:"No templates found matching your search."})})]}),t.jsx("div",{className:"embroidery-modal-footer",children:t.jsxs("div",{className:"embroidery-disclaimer",children:[t.jsx("span",{className:"disclaimer-icon",children:"ℹ️"}),t.jsx("span",{children:"Sample signage templates — add one, then edit the text and resize it. Final engraving/finish may vary by material."})]})})]})}):null},pa=({isOpen:s,onClose:a,onAddText:o,theme:n})=>{const[l,c]=f.useState(""),[d,y]=f.useState("All");f.useEffect(()=>{if(!s)return;const m=Array.from(new Set(Gt.map(M=>M.fontFamily).filter(Boolean)));xe(m)},[s]);const x=f.useMemo(()=>{const m=Gt.reduce((M,z)=>(M[z.category]=(M[z.category]||0)+1,M),{});return[{name:"All",count:Gt.length},...Object.entries(m).map(([M,z])=>({name:M,count:z}))]},[Gt]),F=f.useMemo(()=>Gt.filter(m=>{const M=!l||m.text.toLowerCase().includes(l.toLowerCase())||m.category.toLowerCase().includes(l.toLowerCase()),z=d==="All"||m.category===d;return M&&z}),[Gt,l,d]),w=m=>{const M={...m,x:100,y:100};o("text",M),a()},j=()=>{o("text",{text:"Your Text Here",fontSize:24,fontFamily:"Arial",fill:"#000000",x:100,y:100}),a()};return s?t.jsx("div",{className:"text-templates-modal-overlay",onClick:a,children:t.jsxs("div",{className:"text-templates-modal",onClick:m=>m.stopPropagation(),children:[t.jsxs("div",{className:"modal-header",children:[t.jsx("h2",{children:"Text Templates"}),t.jsx("button",{className:"close-btn",onClick:a,"aria-label":"Close",children:"×"})]}),t.jsxs("div",{className:"modal-controls",children:[t.jsx("div",{className:"search-section",children:t.jsx("input",{type:"text",placeholder:"Search templates...",value:l,onChange:m=>c(m.target.value),className:"search-input"})}),t.jsx("div",{className:"category-tabs",children:x.map(m=>t.jsxs("button",{className:`category-tab ${d===m.name?"active":""}`,onClick:()=>y(m.name),children:[m.name,t.jsxs("span",{className:"count",children:["(",m.count,")"]})]},m.name))})]}),t.jsxs("div",{className:"templates-grid",children:[t.jsx("div",{className:"custom-text-option",onClick:j,children:t.jsxs("div",{className:"custom-text-preview",children:[t.jsx("div",{className:"custom-icon",children:"✏️"}),t.jsx("div",{className:"custom-label",children:"Create Custom Text"})]})}),F.map(m=>t.jsxs("div",{className:"template-item",onClick:()=>w(m),children:[t.jsx("div",{className:"template-preview",style:{fontFamily:m.fontFamily,fontSize:`${Math.min(m.fontSize*.6,18)}px`,fontWeight:m.fontWeight,fontStyle:m.fontStyle,color:m.fill,backgroundColor:m.hasBackground?m.backgroundColor:"transparent",textAlign:m.textAlign||"left",textTransform:m.textTransform||"none",letterSpacing:m.letterSpacing?`${m.letterSpacing}px`:"normal",textShadow:m.hasTextShadow?`${m.textShadowX}px ${m.textShadowY}px ${m.textShadowBlur}px ${m.textShadowColor}`:"none"},children:m.text}),t.jsxs("div",{className:"template-info",children:[t.jsx("span",{className:"template-category",children:m.category}),t.jsx("span",{className:"template-font",children:m.fontFamily})]})]},m.id))]}),t.jsx("div",{className:"modal-footer",children:t.jsxs("div",{className:"results-count",children:[F.length," template",F.length!==1?"s":""," found"]})})]})}):null},ya=({isOpen:s,onClose:a,onAddImage:o,theme:n,apiKey:l,apiEndpoint:c,aiEndpoint:d,onAIImageGenerate:y})=>{const[x,F]=f.useState(""),[w,j]=f.useState(null),[m,M]=f.useState(!1),[z,R]=f.useState(null),[p,T]=f.useState(null),g=f.useRef(null);if(f.useEffect(()=>{s&&(T(null),M(!1))},[s]),!s)return null;const q=(n==null?void 0:n.primaryColor)||"#4c5bf2",E=!m&&(x.trim().length>0||!!w),tt=U=>{var W;const k=(W=U.target.files)==null?void 0:W[0];if(!k||!k.type.startsWith("image/"))return;const H=new FileReader;H.onload=N=>j({dataUrl:N.target.result,name:k.name}),H.onerror=()=>T("Could not read that image. Please try another file."),H.readAsDataURL(k),U.target.value=""},K=()=>j(null),it=U=>{const k=U&&typeof U=="object"&&"object"in U?U.object:U;return k?typeof k=="string"?k:k.imageUrl||k.url||k.image||(k.imageBase64?`data:image/png;base64,${k.imageBase64}`:null):null},st=async()=>{var U,k;T(null),M(!0),R(null);try{const H={prompt:x.trim(),imageDataUrl:(w==null?void 0:w.dataUrl)||null};let W=null;if(typeof y=="function"){const N=await y(H);W=typeof N=="string"?N:it(N)}else{const N=d||(c?`${c}/api/v1/designer`:"");if(!N)throw new Error("AI image generation is not configured.");const B=await We.post(`${N}/generate-image`,{prompt:H.prompt,image:H.imageDataUrl,apiKey:l});W=it(B.data)}if(!W)throw new Error("No image was returned. Please try a different prompt.");R(W)}catch(H){console.error("AI image generation failed:",H),T(((k=(U=H==null?void 0:H.response)==null?void 0:U.data)==null?void 0:k.message)||(H==null?void 0:H.message)||"Image generation failed. Please try again.")}finally{M(!1)}},yt=()=>{if(!z)return;const U=new Image;U.crossOrigin="anonymous",U.onload=()=>{const H=U.naturalWidth||512,W=U.naturalHeight||512,N=Math.min(1,250/Math.max(H,W));o({imageData:U,src:z,width:Math.round(H*N),height:Math.round(W*N),originalWidth:H,originalHeight:W}),a()},U.onerror=()=>T("The generated image could not be loaded onto the canvas."),U.src=z},$=()=>{R(null),T(null)};return t.jsx("div",{className:"ai-modal-overlay",onClick:a,children:t.jsxs("div",{className:"ai-modal-content",onClick:U=>U.stopPropagation(),children:[t.jsxs("div",{className:"ai-modal-header",children:[t.jsx("h3",{children:"✨ AI Image Generator"}),t.jsx("button",{className:"ai-modal-close",onClick:a,"aria-label":"Close",children:"×"})]}),t.jsxs("div",{className:"ai-modal-body",children:[!z&&t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"ai-intro",children:["Generate ",t.jsx("strong",{children:"artwork, images, logos, icons, patterns"})," and much more — from a description, your own image, or both."]}),t.jsx("label",{className:"ai-field-label",htmlFor:"ai-prompt",children:"Describe what you want to create"}),t.jsx("textarea",{id:"ai-prompt",className:"ai-prompt",rows:4,placeholder:"e.g. a minimalist mountain logo · a bold retro sunset · a cute cartoon cat mascot · a seamless floral pattern",value:x,onChange:U=>F(U.target.value)}),t.jsxs("div",{className:"ai-ref-section",children:[t.jsx("span",{className:"ai-field-label",children:"Reference image (optional)"}),w?t.jsxs("div",{className:"ai-ref-preview",children:[t.jsx("img",{src:w.dataUrl,alt:w.name}),t.jsxs("div",{className:"ai-ref-meta",children:[t.jsx("span",{className:"ai-ref-name",children:w.name}),t.jsx("button",{type:"button",className:"ai-ref-remove",onClick:K,children:"Remove"})]})]}):t.jsx("button",{type:"button",className:"ai-upload-btn",onClick:()=>{var U;return(U=g.current)==null?void 0:U.click()},children:"+ Upload an image to transform"}),t.jsx("input",{ref:g,type:"file",accept:"image/*",style:{display:"none"},onChange:tt})]}),t.jsx("p",{className:"ai-hint",children:w?x.trim()?"Your image will be transformed using your description.":"Add a description to guide how your image is transformed.":"Describe an image to create one from scratch, or upload a reference to transform."}),p&&t.jsx("div",{className:"ai-error",children:p}),t.jsx("button",{type:"button",className:"ai-generate-btn",style:{backgroundColor:q,opacity:E?1:.6},disabled:!E,onClick:st,children:m?t.jsxs("span",{className:"ai-generating",children:[t.jsx("span",{className:"ai-spinner"})," Generating…"]}):"Generate image"})]}),z&&t.jsxs("div",{className:"ai-result",children:[t.jsx("div",{className:"ai-result-preview",children:t.jsx("img",{src:z,alt:"AI generated result"})}),p&&t.jsx("div",{className:"ai-error",children:p}),t.jsxs("div",{className:"ai-result-actions",children:[t.jsx("button",{type:"button",className:"ai-secondary-btn",onClick:$,children:"Start over"}),t.jsx("button",{type:"button",className:"ai-secondary-btn",onClick:st,disabled:m,children:m?"Regenerating…":"Regenerate"}),t.jsx("button",{type:"button",className:"ai-generate-btn",style:{backgroundColor:q},onClick:yt,children:"Add to design"})]})]})]})]})})},xa=[246,245,248,239,247,251],gi=xa.map(s=>Gt.find(a=>a.id===s)).filter(Boolean),ba=({onAddElement:s,onDeleteElement:a,onDuplicateElement:o,onUndo:n,onRedo:l,onToggleGrid:c,onToggleRulers:d,onToggleSnap:y,onTogglePrintGuides:x,onImageUpload:F,canUndo:w,canRedo:j,showGrid:m,showRulers:M,snapToGrid:z,showPrintGuides:R,selectedElement:p,theme:T,readOnly:g,mode:q="design",productionMethods:E,supportsEmbroidery:tt,apiKey:K,apiEndpoint:it,aiEnabled:st=!0,aiEndpoint:yt,onAIImageGenerate:$,isAuthenticated:U=!0,onRequireAuth:k})=>{const H=q==="customize",N=(E||[]).some(_=>String(_).toUpperCase()==="EMBROIDERY")||tt==="Y",B=(E||[]).some(_=>String(_).toUpperCase()==="HANDCRAFTED"),[G,P]=f.useState(!1),[ct,b]=f.useState(!1),[D,Y]=f.useState(!1),[ot,nt]=f.useState(!1),[ht,ft]=f.useState(!1),[vt,dt]=f.useState(!1),[At,Et]=f.useState(!1),[Bt,jt]=f.useState(!1),[Wt,V]=f.useState(!1),[Pt,Dt]=f.useState(!1),Jt=!H||Pt,re=_=>{const Nt=_.target.files[0];Nt&&Nt.type.startsWith("image/")&&F(Nt),_.target.value=""},Kt=_=>{s("icon",{iconData:_,text:_.symbol,fontSize:48,fontFamily:"Arial",fill:"#000000"})},It=_=>{s("qrcode",_)},Vt=_=>{s("barcode",_)},wt=_=>{s("sticker",_)},se=_=>{s("embroidery",_)},pt=_=>{s("text",_)},_t=(_,Nt)=>{s(_,Nt)},Ge=_=>{s("image",_)},kt=()=>{jt(!Bt),V(!1)},we=()=>{V(!Wt),jt(!1)},Ut=_=>{_==="custom"?s("text"):_==="templates"&&dt(!0),jt(!1)};f.useEffect(()=>{$e(gi.map(_=>_.fontFamily).filter(Boolean))},[]);const Lt=_=>{s("text",{..._}),jt(!1)},xt=_=>{s(_),V(!1)},et="#475569";return t.jsxs("div",{className:"toolbar",children:[t.jsxs("div",{className:"toolbar-section",children:[t.jsxs("div",{className:"toolbar-group",children:[t.jsxs("button",{className:"toolbar-btn compact",onClick:n,disabled:!w||g,title:"Undo (Ctrl+Z)",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"undo",size:18,color:!w||g?"#94a3b8":et})}),t.jsx("span",{className:"label",children:"Undo"})]}),t.jsxs("button",{className:"toolbar-btn compact",onClick:l,disabled:!j||g,title:"Redo (Ctrl+Y)",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"redo",size:18,color:!j||g?"#94a3b8":et})}),t.jsx("span",{className:"label",children:"Redo"})]})]}),t.jsx("div",{className:"toolbar-separator"}),st&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"toolbar-group",children:t.jsxs("button",{className:"toolbar-btn compact ai-btn",onClick:()=>{if(!U){k&&k();return}Et(!0)},disabled:g,title:"AI: generate artwork, images, logos, icons and much more",style:{color:g?"#94a3b8":"#6d28d9",background:g?void 0:"linear-gradient(135deg, #ede9fe, #f5f3ff)"},children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"sparkle",size:18,color:g?"#94a3b8":"#7c3aed"})}),t.jsx("span",{className:"label",children:"AI Image"})]})}),t.jsx("div",{className:"toolbar-separator"})]}),t.jsxs("div",{className:"toolbar-group",children:[t.jsxs("div",{className:"toolbar-dropdown",children:[t.jsxs("button",{className:"toolbar-btn compact dropdown-trigger",disabled:g,title:"Add Text",onClick:kt,children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"text",size:18,color:g?"#94a3b8":et})}),t.jsx("span",{className:"label",children:"Text"}),t.jsx("span",{className:`dropdown-arrow ${Bt?"open":""}`,children:"▾"})]}),t.jsxs("div",{className:`dropdown-menu text-design-menu ${Bt?"show":""}`,style:{minWidth:240},children:[t.jsxs("button",{onClick:()=>Ut("custom"),children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"text",size:16,color:et})})," Custom text"]}),t.jsx("div",{style:{padding:"6px 10px 2px",fontSize:11,fontWeight:700,color:"#94a3b8",textTransform:"uppercase",letterSpacing:.5},children:"Design ideas"}),gi.map(_=>t.jsx("button",{onClick:()=>Lt(_),title:`Add "${_.text}"`,style:{justifyContent:"flex-start"},children:t.jsx("span",{style:{fontFamily:`'${_.fontFamily}', cursive`,fontWeight:_.fontWeight||"normal",fontStyle:_.fontStyle||"normal",color:_.fill||"#111827",fontSize:18,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textTransform:_.textTransform||"none"},children:_.text})},_.id)),t.jsxs("button",{onClick:()=>Ut("templates"),style:{borderTop:"1px solid #e2e8f0",marginTop:4,color:"#2563eb",fontWeight:600},children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"book",size:16,color:"#2563eb"})})," More designs…"]})]})]}),H&&t.jsxs("button",{type:"button",className:`toolbar-btn compact ${Pt?"active":""}`,onClick:()=>Dt(_=>!_),title:"More tools (shapes, QR code, barcode, grid)",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"gear",size:18,color:Pt?"#ffffff":et})}),t.jsx("span",{className:"label",children:"More"}),t.jsx("span",{className:`dropdown-arrow ${Pt?"open":""}`,children:"▾"})]}),Jt&&t.jsxs("div",{className:"toolbar-dropdown",children:[t.jsxs("button",{className:"toolbar-btn compact dropdown-trigger",disabled:g,onClick:we,children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"shapes",size:18,color:g?"#94a3b8":et})}),t.jsx("span",{className:"label",children:"Shapes"}),t.jsx("span",{className:`dropdown-arrow ${Wt?"open":""}`,children:"▾"})]}),t.jsxs("div",{className:`dropdown-menu ${Wt?"show":""}`,children:[t.jsxs("button",{onClick:()=>xt("rectangle"),children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"rectangle",size:16,color:et})})," Rectangle"]}),t.jsxs("button",{onClick:()=>xt("circle"),children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"circle",size:16,color:et})})," Circle"]}),t.jsxs("button",{onClick:()=>xt("triangle"),children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"triangle",size:16,color:et})})," Triangle"]}),t.jsxs("button",{onClick:()=>xt("star"),children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"star",size:16,color:et})})," Star"]}),t.jsxs("button",{onClick:()=>xt("heart"),children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"heart",size:16,color:et})})," Heart"]}),t.jsxs("button",{onClick:()=>xt("arrow"),children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"arrowShape",size:16,color:et})})," Arrow"]}),t.jsxs("button",{onClick:()=>xt("diamond"),children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"diamond",size:16,color:et})})," Diamond"]}),t.jsxs("button",{onClick:()=>xt("hexagon"),children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"hexagon",size:16,color:et})})," Hexagon"]}),t.jsxs("button",{onClick:()=>xt("pentagon"),children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"pentagon",size:16,color:et})})," Pentagon"]}),t.jsxs("button",{onClick:()=>xt("oval"),children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"oval",size:16,color:et})})," Oval"]}),t.jsxs("button",{onClick:()=>xt("roundedRectangle"),children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"roundedRect",size:16,color:et})})," Rounded Rectangle"]}),t.jsxs("button",{onClick:()=>xt("horizontalLine"),children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"horizontalLine",size:16,color:et})})," Horizontal Line"]})]})]}),t.jsx("div",{className:"toolbar-separator"}),t.jsxs("label",{className:"toolbar-btn compact file-upload",style:{cursor:g?"not-allowed":"pointer"},children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"upload",size:18,color:g?"#94a3b8":et})}),t.jsx("span",{className:"label",children:"Upload"}),t.jsx("input",{type:"file",accept:"image/*",onChange:re,disabled:g})]}),t.jsx("div",{className:"toolbar-separator"}),t.jsx(oa,{onSelectIcon:Kt,theme:T,disabled:g}),t.jsxs("button",{className:"toolbar-btn compact",onClick:()=>Y(!0),disabled:g,title:"Add Sticker",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"sticker",size:18,color:g?"#94a3b8":et})}),t.jsx("span",{className:"label",children:"Stickers"})]}),Jt&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"toolbar-separator"}),t.jsxs("button",{className:"toolbar-btn compact",onClick:()=>P(!0),disabled:g,title:"Add QR Code",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"qrcode",size:18,color:g?"#94a3b8":et})}),t.jsx("span",{className:"label",children:"QR Code"})]}),t.jsxs("button",{className:"toolbar-btn compact",onClick:()=>b(!0),disabled:g,title:"Add Barcode",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"barcode",size:18,color:g?"#94a3b8":et})}),t.jsx("span",{className:"label",children:"Barcode"})]})]})]}),N&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"toolbar-separator"}),t.jsx("div",{className:"toolbar-group embroidery-group",children:t.jsxs("button",{className:"toolbar-btn compact",onClick:()=>nt(!0),disabled:g,title:"Add Embroidery Design",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"thread",size:18,color:g?"#94a3b8":et})}),t.jsx("span",{className:"label",children:"Embroidery"})]})})]}),B&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"toolbar-separator"}),t.jsx("div",{className:"toolbar-group handcraft-group",children:t.jsxs("button",{className:"toolbar-btn compact",onClick:()=>ft(!0),disabled:g,title:"Add a signage / handcraft template",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"briefcase",size:18,color:g?"#94a3b8":et})}),t.jsx("span",{className:"label",children:"Signage"})]})})]}),p&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"toolbar-separator"}),t.jsxs("div",{className:"toolbar-group",children:[t.jsxs("button",{className:"toolbar-btn compact success",onClick:o,disabled:g,title:"Duplicate Element (Ctrl+D)",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"duplicate",size:18,color:g?"#94a3b8":"#059669"})}),t.jsx("span",{className:"label",children:"Duplicate"})]}),t.jsxs("button",{className:"toolbar-btn compact danger",onClick:a,disabled:g,title:"Delete Element (Delete)",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"trash",size:18,color:g?"#94a3b8":"#dc2626"})}),t.jsx("span",{className:"label",children:"Delete"})]})]})]}),Jt&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"toolbar-separator"}),t.jsxs("div",{className:"toolbar-group",children:[t.jsxs("button",{className:`toolbar-btn compact ${m?"active":""}`,onClick:c,title:"Toggle Grid",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"grid",size:18,color:m?"#ffffff":et})}),t.jsx("span",{className:"label",children:"Grid"})]}),t.jsxs("button",{className:`toolbar-btn compact ${M?"active":""}`,onClick:d,title:"Toggle Rulers",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"ruler",size:18,color:M?"#ffffff":et})}),t.jsx("span",{className:"label",children:"Rulers"})]}),t.jsxs("button",{className:`toolbar-btn compact ${z?"active":""}`,onClick:y,title:"Snap to Grid",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"magnet",size:18,color:z?"#ffffff":et})}),t.jsx("span",{className:"label",children:"Snap"})]}),t.jsxs("button",{className:`toolbar-btn compact ${R?"active":""}`,onClick:x,title:"Toggle print area & safe-zone guides",children:[t.jsx("span",{className:"icon",children:t.jsx(J,{name:"rectangle",size:18,color:R?"#ffffff":et})}),t.jsx("span",{className:"label",children:"Print area"})]})]})]})]}),t.jsx(ra,{isOpen:G,onClose:()=>P(!1),onAddQRCode:It,theme:T}),t.jsx(sa,{isOpen:ct,onClose:()=>b(!1),onAddBarcode:Vt,theme:T}),t.jsx(la,{isOpen:D,onClose:()=>Y(!1),onAddSticker:wt,theme:T,apiKey:K,apiEndpoint:it}),t.jsx(ha,{isOpen:ot,onClose:()=>nt(!1),onAddEmbroidery:se,theme:T,apiKey:K,apiEndpoint:it}),t.jsx(ma,{isOpen:ht,onClose:()=>ft(!1),onAddHandcraft:pt,theme:T}),t.jsx(pa,{isOpen:vt,onClose:()=>dt(!1),onAddText:_t,theme:T}),st&&t.jsx(ya,{isOpen:At,onClose:()=>Et(!1),onAddImage:Ge,theme:T,apiKey:K,apiEndpoint:it,aiEndpoint:yt,onAIImageGenerate:$})]})},Sa=({value:s="Arial",onChange:a=()=>{},onFontLoaded:o=()=>{}})=>{const[n,l]=f.useState(!1),[c,d]=f.useState(""),y=f.useRef(null);f.useEffect(()=>{n&&xe(ui)},[n]),f.useEffect(()=>{if(!n)return;const w=m=>{y.current&&!y.current.contains(m.target)&&l(!1)},j=m=>{m.key==="Escape"&&l(!1)};return document.addEventListener("mousedown",w),document.addEventListener("keydown",j),()=>{document.removeEventListener("mousedown",w),document.removeEventListener("keydown",j)}},[n]);const x=f.useMemo(()=>{const w=c.trim().toLowerCase();return w?Be.map(j=>({...j,fonts:j.fonts.filter(m=>m.toLowerCase().includes(w))})).filter(j=>j.fonts.length>0):Be},[c]),F=async w=>{a(w),l(!1),d(""),await mi(w),o()};return t.jsxs("div",{ref:y,style:{position:"relative",width:"100%"},children:[t.jsxs("button",{type:"button",onClick:()=>l(w=>!w),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 10px",border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",cursor:"pointer",fontSize:14},title:"Choose a font",children:[t.jsx("span",{style:{fontFamily:`"${s}"`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s}),t.jsx("span",{style:{color:"#64748b",fontSize:12},children:"▾"})]}),n&&t.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:1e3,background:"#fff",border:"1px solid #cbd5e1",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.15)",maxHeight:320,display:"flex",flexDirection:"column",overflow:"hidden"},children:[t.jsx("input",{autoFocus:!0,value:c,onChange:w=>d(w.target.value),placeholder:"Search fonts…",style:{margin:8,padding:"6px 8px",border:"1px solid #e2e8f0",borderRadius:6,fontSize:13,outline:"none"}}),t.jsxs("div",{style:{overflowY:"auto",padding:"0 4px 6px"},children:[x.map(w=>t.jsxs("div",{children:[t.jsx("div",{style:{position:"sticky",top:0,background:"#f8fafc",color:"#64748b",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em",padding:"6px 8px"},children:w.name}),w.fonts.map(j=>t.jsx("button",{type:"button",onMouseEnter:()=>xe([j]),onClick:()=>F(j),style:{width:"100%",textAlign:"left",padding:"8px 10px",border:"none",borderRadius:6,cursor:"pointer",fontSize:16,fontFamily:`"${j}"`,background:j===s?"#eff6ff":"transparent",color:j===s?"#1d4ed8":"#0f172a"},children:j},j))]},w.name)),x.length===0&&t.jsxs("div",{style:{padding:12,color:"#94a3b8",fontSize:13},children:["No fonts match “",c,"”."]})]})]})]})},ye=[{name:"White",hex:"#FFFFFF"},{name:"Ecru",hex:"#F3EAD3"},{name:"Cream",hex:"#F7E9C3"},{name:"Silver",hex:"#C8CDD2"},{name:"Light Grey",hex:"#9AA0A6"},{name:"Steel Grey",hex:"#5F676E"},{name:"Charcoal",hex:"#33373B"},{name:"Black",hex:"#101113"},{name:"Pale Pink",hex:"#F6C5D3"},{name:"Rose",hex:"#E8638C"},{name:"Fuchsia",hex:"#D81B7A"},{name:"Red",hex:"#D11F2D"},{name:"Crimson",hex:"#9E1B2F"},{name:"Burgundy",hex:"#6E1F2C"},{name:"Peach",hex:"#F6A98C"},{name:"Orange",hex:"#F26A21"},{name:"Pumpkin",hex:"#D2541E"},{name:"Gold",hex:"#E8A317"},{name:"Yellow",hex:"#F4C500"},{name:"Lemon",hex:"#F2E54B"},{name:"Lime",hex:"#9BCB3C"},{name:"Kelly Green",hex:"#2E9E45"},{name:"Green",hex:"#1F7A3D"},{name:"Forest",hex:"#14532D"},{name:"Teal",hex:"#0E8C8C"},{name:"Mint",hex:"#9FE0C4"},{name:"Sky Blue",hex:"#5BB6E8"},{name:"Blue",hex:"#1C76C5"},{name:"Royal Blue",hex:"#1E40AF"},{name:"Navy",hex:"#16244C"},{name:"Turquoise",hex:"#22B5C9"},{name:"Lavender",hex:"#B9A6E0"},{name:"Purple",hex:"#7A3CB0"},{name:"Plum",hex:"#5B2A6B"},{name:"Tan",hex:"#C8A06A"},{name:"Brown",hex:"#7A4A26"},{name:"Coffee",hex:"#4A2F1C"},{name:"Gold Metallic",hex:"#C8A53B"},{name:"Silver Metallic",hex:"#B6BCC4"}];function Oe(s){if(!s)return null;let a=String(s).trim().replace("#","");if(a.length===3&&(a=a.split("").map(n=>n+n).join("")),a.length!==6)return null;const o=parseInt(a,16);return Number.isNaN(o)?null:{r:o>>16&255,g:o>>8&255,b:o&255}}function va(s,a){const o=(s.r+a.r)/2,n=s.r-a.r,l=s.g-a.g,c=s.b-a.b;return(2+o/256)*n*n+4*l*l+(2+(255-o)/256)*c*c}function wa(s){const a=Oe(s);if(!a)return ye[0];let o=ye[0],n=1/0;for(const l of ye){const c=Oe(l.hex),d=va(a,c);d<n&&(n=d,o=l)}return o}function ka(s){return Oe(s)?wa(s).hex:s}const Ie={widthIn:12,dpi:300,safeAreaPct:5},Ca=6e3;function ve(s){const a=s||{};return{widthIn:Number(a.widthIn)>0?Number(a.widthIn):Ie.widthIn,dpi:Number(a.dpi)>0?Number(a.dpi):Ie.dpi,safeAreaPct:Number.isFinite(Number(a.safeAreaPct))?Math.min(40,Math.max(0,Number(a.safeAreaPct))):Ie.safeAreaPct}}function Fa(s,a,o){const{widthIn:n,dpi:l}=ve(o);if(!(s>0))return 1;let d=n*l/s;d=Math.max(1,d);const y=Math.max(s,a||s),x=Ca/y;return Math.min(d,Math.max(1,x))}function ja(s,a){const{widthIn:o}=ve(a);return s>0?o/s:0}function Na(s,a,o){var y,x,F,w;if(!s||!["image","sticker","embroidery"].includes(s.type))return null;const l=s.originalWidth||s.naturalWidth||((y=s.imageObject)==null?void 0:y.naturalWidth)||((x=s._imageElement)==null?void 0:x.naturalWidth)||((F=s._stickerElement)==null?void 0:F.naturalWidth)||((w=s.imageData)==null?void 0:w.naturalWidth)||0;if(!(l>0))return null;const c=s.width||0;if(!(c>0))return null;const d=c*ja(a,o);return d>0?l/d:null}function za(s,a){const{dpi:o}=ve(a);return s==null?null:s>=o?{level:"good",color:"#16a34a",label:"Print quality: Excellent"}:s>=o/2?{level:"warn",color:"#d97706",label:"Print quality: Acceptable — may look soft"}:{level:"bad",color:"#dc2626",label:"Print quality: Too low — will look blurry"}}const Aa=({selectedElement:s,onUpdate:a,onMoveLayer:o,availableFonts:n,theme:l,isEmbroidery:c=!1,onFontLoaded:d=()=>{},canvasWidth:y,printConfig:x,onRemoveBackground:F})=>{const[w,j]=f.useState(!1),[m,M]=f.useState(!1),[z,R]=f.useState("");if(!s)return t.jsxs("div",{className:"properties-panel",children:[t.jsx("h3",{children:"Properties"}),t.jsx("p",{className:"no-selection",children:"Select an element to edit its properties"})]});const p=(k,H)=>{a(s.id,{[k]:H})},T=()=>{var k,H,W;return t.jsxs("div",{className:"property-group",children:[t.jsx("h4",{children:"Text Content"}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Text Content"}),t.jsx("textarea",{value:s.text||"",onChange:N=>p("text",N.target.value),rows:3,placeholder:"Enter your text here..."})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Font Family"}),t.jsx(Sa,{value:s.fontFamily||"Arial",onChange:N=>p("fontFamily",N),onFontLoaded:d})]}),t.jsxs("div",{className:"property-row",children:[t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Font Size"}),t.jsx("input",{type:"number",value:s.fontSize||20,onChange:N=>p("fontSize",parseInt(N.target.value)),min:"8",max:"200"})]}),t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Line Height"}),t.jsx("input",{type:"number",step:"0.1",value:s.lineHeight||1.2,onChange:N=>p("lineHeight",parseFloat(N.target.value)),min:"0.5",max:"3"})]})]}),t.jsxs("div",{className:"property-row",children:[t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Letter Spacing"}),t.jsx("input",{type:"number",step:"0.5",value:s.letterSpacing||0,onChange:N=>p("letterSpacing",parseFloat(N.target.value)||0),min:"-5",max:"50"})]}),t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Outline Width"}),t.jsx("input",{type:"number",step:"0.5",value:s.strokeWidth||0,onChange:N=>p("strokeWidth",parseFloat(N.target.value)||0),min:"0",max:"20"})]})]}),(s.strokeWidth||0)>0&&t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Outline Color"}),t.jsx("input",{type:"color",value:s.stroke||"#000000",onChange:N=>p("stroke",N.target.value)})]}),t.jsxs("div",{className:"property-row",children:[t.jsxs("label",{children:["Curve ",s.curve?`(${s.curve}°)`:""]}),t.jsxs("div",{className:"input-group",style:{display:"flex",alignItems:"center",gap:8,width:"100%"},children:[t.jsx("input",{type:"range",min:"-180",max:"180",step:"1",value:s.curve||0,onChange:N=>p("curve",parseInt(N.target.value,10)),style:{flex:1}}),t.jsx("button",{type:"button",onClick:()=>p("curve",0),title:"Reset to straight",style:{padding:"2px 8px"},children:"Reset"})]})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Font Weight"}),t.jsxs("div",{className:"button-group",children:[t.jsx("button",{className:s.fontWeight==="lighter"||s.fontWeight==="300"?"active":"",onClick:()=>p("fontWeight","300"),title:"Light",children:"Light"}),t.jsx("button",{className:!s.fontWeight||s.fontWeight==="normal"||s.fontWeight==="400"?"active":"",onClick:()=>p("fontWeight","normal"),title:"Normal",children:"Normal"}),t.jsx("button",{className:s.fontWeight==="bold"||s.fontWeight==="700"?"active":"",onClick:()=>p("fontWeight","bold"),title:"Bold",children:t.jsx("strong",{children:"Bold"})})]})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Text Style"}),t.jsxs("div",{className:"button-group",children:[t.jsx("button",{className:s.fontStyle==="italic"?"active":"",onClick:()=>p("fontStyle",s.fontStyle==="italic"?"normal":"italic"),title:"Italic",children:t.jsx("em",{children:"I"})}),t.jsx("button",{className:(k=s.textDecoration)!=null&&k.includes("underline")?"active":"",onClick:()=>{const N=s.textDecoration||"",B=N.split(" ").filter(G=>G&&G!=="underline");N.includes("underline")||B.push("underline"),p("textDecoration",B.join(" ").trim())},title:"Underline",children:t.jsx("u",{children:"U"})}),t.jsx("button",{className:(H=s.textDecoration)!=null&&H.includes("overline")?"active":"",onClick:()=>{const N=s.textDecoration||"",B=N.split(" ").filter(G=>G&&G!=="overline");N.includes("overline")||B.push("overline"),p("textDecoration",B.join(" ").trim())},title:"Overline",children:t.jsx("span",{style:{textDecoration:"overline"},children:"O"})}),t.jsx("button",{className:(W=s.textDecoration)!=null&&W.includes("line-through")?"active":"",onClick:()=>{const N=s.textDecoration||"",B=N.split(" ").filter(G=>G&&G!=="line-through");N.includes("line-through")||B.push("line-through"),p("textDecoration",B.join(" ").trim())},title:"Strikethrough",children:t.jsx("s",{children:"S"})})]})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Text Transform"}),t.jsxs("div",{className:"button-group",children:[t.jsx("button",{className:!s.textTransform||s.textTransform==="none"?"active":"",onClick:()=>p("textTransform","none"),title:"Normal",children:"Aa"}),t.jsx("button",{className:s.textTransform==="uppercase"?"active":"",onClick:()=>p("textTransform","uppercase"),title:"Uppercase",children:"AA"}),t.jsx("button",{className:s.textTransform==="lowercase"?"active":"",onClick:()=>p("textTransform","lowercase"),title:"Lowercase",children:"aa"}),t.jsx("button",{className:s.textTransform==="capitalize"?"active":"",onClick:()=>p("textTransform","capitalize"),title:"Capitalize",children:"Aa"})]})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Text Alignment"}),t.jsxs("div",{className:"button-group",children:[t.jsx("button",{className:!s.textAlign||s.textAlign==="left"?"active":"",onClick:()=>p("textAlign","left"),title:"Left Align",children:"⬅"}),t.jsx("button",{className:s.textAlign==="center"?"active":"",onClick:()=>p("textAlign","center"),title:"Center Align",children:"↔"}),t.jsx("button",{className:s.textAlign==="right"?"active":"",onClick:()=>p("textAlign","right"),title:"Right Align",children:"➡"}),t.jsx("button",{className:s.textAlign==="justify"?"active":"",onClick:()=>p("textAlign","justify"),title:"Justify",children:"≡"})]})]}),t.jsx("div",{className:"property-row",children:t.jsxs("div",{className:"color-input-group",children:[t.jsxs("div",{className:"color-input-item",children:[t.jsx("label",{children:c?"Thread Color":"Text Color"}),t.jsx("input",{type:"color",value:s.fill||"#000000",onChange:N=>p("fill",N.target.value)}),c&&t.jsx("div",{title:"Real thread colours",style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:6,maxWidth:200},children:ye.map(N=>t.jsx("button",{type:"button",title:N.name,onClick:()=>p("fill",N.hex),style:{width:16,height:16,padding:0,borderRadius:"50%",background:N.hex,border:(s.fill||"").toLowerCase()===N.hex.toLowerCase()?"2px solid #2563eb":"1px solid #cbd5e1",cursor:"pointer"}},N.hex))})]}),t.jsxs("div",{className:"color-input-item",children:[t.jsx("label",{children:"Background Color"}),t.jsxs("div",{className:"color-with-toggle",children:[t.jsx("input",{type:"color",value:s.backgroundColor||"#ffffff",onChange:N=>p("backgroundColor",N.target.value),disabled:!s.hasBackground}),t.jsx("button",{className:`toggle-btn ${s.hasBackground?"active":""}`,onClick:()=>p("hasBackground",!s.hasBackground),title:s.hasBackground?"Remove background":"Add background",children:s.hasBackground?"👁":"👁‍🗨"})]})]})]})}),w&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"property-row",children:[t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Letter Spacing"}),t.jsx("input",{type:"number",step:"0.1",value:s.letterSpacing||0,onChange:N=>p("letterSpacing",parseFloat(N.target.value)),min:"-5",max:"10"})]}),t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Word Spacing"}),t.jsx("input",{type:"number",step:"0.1",value:s.wordSpacing||0,onChange:N=>p("wordSpacing",parseFloat(N.target.value)),min:"-10",max:"20"})]})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Text Shadow"}),t.jsxs("div",{className:"text-shadow-controls",children:[t.jsx("div",{className:"shadow-toggle",children:t.jsx("button",{className:`toggle-btn ${s.hasTextShadow?"active":""}`,onClick:()=>p("hasTextShadow",!s.hasTextShadow),children:s.hasTextShadow?"Remove Shadow":"Add Shadow"})}),s.hasTextShadow&&t.jsxs("div",{className:"shadow-properties",children:[t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"H-Offset"}),t.jsx("input",{type:"number",value:s.textShadowX||2,onChange:N=>p("textShadowX",parseInt(N.target.value)),min:"-20",max:"20"})]}),t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"V-Offset"}),t.jsx("input",{type:"number",value:s.textShadowY||2,onChange:N=>p("textShadowY",parseInt(N.target.value)),min:"-20",max:"20"})]}),t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Blur"}),t.jsx("input",{type:"number",value:s.textShadowBlur||4,onChange:N=>p("textShadowBlur",parseInt(N.target.value)),min:"0",max:"20"})]}),t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Shadow Color"}),t.jsx("input",{type:"color",value:s.textShadowColor||"#000000",onChange:N=>p("textShadowColor",N.target.value)})]})]})]})]}),t.jsx("div",{className:"property-row",children:t.jsxs("div",{className:"color-input-group",children:[t.jsxs("div",{className:"color-input-item",children:[t.jsx("label",{children:"Stroke Color"}),t.jsx("input",{type:"color",value:s.stroke||"#000000",onChange:N=>p("stroke",N.target.value)})]}),t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Stroke Width"}),t.jsx("input",{type:"number",value:s.strokeWidth||0,onChange:N=>p("strokeWidth",parseInt(N.target.value)),min:"0",max:"20"})]})]})}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Text Opacity"}),t.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.opacity||1,onChange:N=>p("opacity",parseFloat(N.target.value))}),t.jsxs("span",{children:[Math.round((s.opacity||1)*100),"%"]})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Font Variant"}),t.jsxs("select",{value:s.fontVariant||"normal",onChange:N=>p("fontVariant",N.target.value),children:[t.jsx("option",{value:"normal",children:"Normal"}),t.jsx("option",{value:"small-caps",children:"Small Caps"})]})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Writing Mode"}),t.jsxs("select",{value:s.writingMode||"horizontal-tb",onChange:N=>p("writingMode",N.target.value),children:[t.jsx("option",{value:"horizontal-tb",children:"Horizontal"}),t.jsx("option",{value:"vertical-rl",children:"Vertical Right-to-Left"}),t.jsx("option",{value:"vertical-lr",children:"Vertical Left-to-Right"})]})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Text Direction"}),t.jsxs("div",{className:"button-group",children:[t.jsx("button",{className:!s.direction||s.direction==="ltr"?"active":"",onClick:()=>p("direction","ltr"),title:"Left to Right",children:"LTR"}),t.jsx("button",{className:s.direction==="rtl"?"active":"",onClick:()=>p("direction","rtl"),title:"Right to Left",children:"RTL"})]})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Background Padding"}),t.jsx("input",{type:"number",value:s.backgroundPadding||5,onChange:N=>p("backgroundPadding",parseInt(N.target.value)),min:"0",max:"50",disabled:!s.hasBackground})]})]})]})},g=()=>t.jsxs("div",{className:"property-group",children:[t.jsx("h4",{children:"Shape Properties"}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Fill Color"}),t.jsx("input",{type:"color",value:s.fill||"#000000",onChange:k=>p("fill",k.target.value)})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Stroke Color"}),t.jsx("input",{type:"color",value:s.stroke||"#000000",onChange:k=>p("stroke",k.target.value)})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Stroke Width"}),t.jsx("input",{type:"number",value:s.strokeWidth||2,onChange:k=>p("strokeWidth",parseInt(k.target.value)),min:"0",max:"20"})]}),s.type==="star"&&t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Star Points"}),t.jsx("input",{type:"number",value:s.numPoints||5,onChange:k=>p("numPoints",parseInt(k.target.value)),min:"3",max:"20"})]}),s.type==="roundedRectangle"&&t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Corner Radius"}),t.jsx("input",{type:"number",value:s.cornerRadius||10,onChange:k=>p("cornerRadius",parseInt(k.target.value)),min:"0",max:"50"})]})]}),q=async()=>{if(!(!F||m)){M(!0),R("");try{await F(s)}catch{R("Could not remove the background. Please try again.")}finally{M(!1)}}},E=["image","sticker","embroidery"],tt=()=>!F||!E.includes(s.type)?null:t.jsxs("div",{className:"property-group",children:[t.jsx("button",{type:"button",className:"remove-bg-btn",onClick:q,disabled:m,style:{width:"100%",padding:"9px 12px",borderRadius:8,border:"1px solid #cbd5e1",background:m?"#f1f5f9":"#fff",color:"#334155",fontSize:13,fontWeight:600,cursor:m?"wait":"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:m?"Removing background…":"✂️ Remove background"}),z&&t.jsx("div",{style:{marginTop:6,fontSize:12,color:"#dc2626"},children:z})]}),K=()=>t.jsxs("div",{className:"property-group",children:[t.jsx("h4",{children:"Image Properties"}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Opacity"}),t.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.opacity||1,onChange:k=>p("opacity",parseFloat(k.target.value))}),t.jsxs("span",{children:[Math.round((s.opacity||1)*100),"%"]})]}),w&&t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Border Radius"}),t.jsx("input",{type:"number",value:s.borderRadius||0,onChange:k=>p("borderRadius",parseInt(k.target.value)),min:"0",max:"50"})]})]}),it=()=>t.jsxs("div",{className:"property-group",children:[t.jsx("h4",{children:"Position & Size"}),t.jsxs("div",{className:"property-row",children:[t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"X"}),t.jsx("input",{type:"number",value:Math.round(s.x)||0,onChange:k=>p("x",parseInt(k.target.value))})]}),t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Y"}),t.jsx("input",{type:"number",value:Math.round(s.y)||0,onChange:k=>p("y",parseInt(k.target.value))})]})]}),t.jsxs("div",{className:"property-row",children:[t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Width"}),t.jsx("input",{type:"number",value:Math.round(s.width)||0,onChange:k=>p("width",parseInt(k.target.value)),min:"1"})]}),t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Height"}),t.jsx("input",{type:"number",value:Math.round(s.height)||0,onChange:k=>p("height",parseInt(k.target.value)),min:"1"})]})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Rotation"}),t.jsx("input",{type:"range",min:"-180",max:"180",value:s.rotation||0,onChange:k=>p("rotation",parseInt(k.target.value))}),t.jsxs("span",{children:[s.rotation||0,"°"]})]})]}),st=()=>t.jsxs("div",{className:"property-group",children:[t.jsx("h4",{children:"Line Properties"}),t.jsxs("div",{className:"property-row",children:[t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Line Width"}),t.jsx("input",{type:"number",value:s.strokeWidth||s.height||2,onChange:k=>{const H=parseInt(k.target.value);p("strokeWidth",H),p("height",H)},min:"1",max:"50"})]}),t.jsxs("div",{className:"input-group",children:[t.jsx("label",{children:"Length"}),t.jsx("input",{type:"number",value:s.width||200,onChange:k=>p("width",parseInt(k.target.value)),min:"10",max:"1000"})]})]}),t.jsxs("div",{className:"property-row",children:[t.jsx("label",{children:"Line Color"}),t.jsxs("div",{className:"color-input-group",children:[t.jsx("input",{type:"color",value:s.stroke||s.fill||"#000000",onChange:k=>{p("stroke",k.target.value),p("fill",k.target.value)}}),t.jsx("input",{type:"text",value:s.stroke||s.fill||"#000000",onChange:k=>{p("stroke",k.target.value),p("fill",k.target.value)},placeholder:"#000000"})]})]})]}),yt=()=>t.jsxs("div",{className:"property-group",children:[t.jsx("h4",{children:"Layer Controls"}),t.jsxs("div",{className:"button-group vertical",children:[t.jsx("button",{onClick:()=>o(s.id,"top"),children:"Bring to Front"}),t.jsx("button",{onClick:()=>o(s.id,"up"),children:"Bring Forward"}),t.jsx("button",{onClick:()=>o(s.id,"down"),children:"Send Backward"}),t.jsx("button",{onClick:()=>o(s.id,"bottom"),children:"Send to Back"})]})]}),$=["rectangle","circle","triangle","star","arrow","diamond","hexagon","pentagon","heart","oval","roundedRectangle"],U=()=>{const k=Na(s,y,x);if(k==null)return null;const H=za(k,x);return H?t.jsxs("div",{className:"property-group dpi-meter",style:{borderLeft:`4px solid ${H.color}`,paddingLeft:10},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx("span",{style:{width:9,height:9,borderRadius:"50%",background:H.color,flex:"0 0 auto"}}),t.jsxs("strong",{style:{color:H.color,fontSize:13},children:[Math.round(k)," DPI"]})]}),t.jsx("div",{style:{fontSize:12,color:"#475569",marginTop:2},children:H.label}),H.level!=="good"&&t.jsx("div",{style:{fontSize:11,color:"#64748b",marginTop:4},children:"Make it smaller on the canvas or upload a higher-resolution image."})]}):null};return t.jsxs("div",{className:"properties-panel",children:[t.jsxs("div",{className:"panel-header",children:[t.jsx("h3",{children:"Properties"}),t.jsx("span",{className:"element-type",children:s.type})]}),t.jsxs("div",{className:"panel-content",children:[U(),tt(),s.type==="text"&&T(),$.includes(s.type)&&g(),s.type==="image"&&K(),s.type==="horizontalLine"&&st(),it(),yt(),t.jsx("div",{className:"property-group",children:t.jsxs("button",{className:"toggle-advanced",onClick:()=>j(!w),children:[w?"Hide":"Show"," Advanced Options"]})})]})]})},Ta=({elements:s,selectedElement:a,onSelectElement:o,onMoveLayer:n,onDeleteElement:l,theme:c})=>{const d=(x,F)=>{switch(x){case"text":return"T";case"rectangle":return"▭";case"circle":return"●";case"triangle":return"▲";case"star":return"★";case"arrow":return"➤";case"diamond":return"◆";case"hexagon":return"⬡";case"pentagon":return"⬟";case"heart":return"♥";case"oval":return"⬭";case"roundedRectangle":return"▢";case"horizontalLine":return"―";case"image":return"🖼";case"qrcode":return"⬚";case"barcode":return"|||";case"sticker":return"🎭";case"embroidery":return"🧵";default:return"?"}},y=x=>{var F,w;if(x.type==="text")return x.isIcon&&x.iconData?`Icon: ${x.iconData.name}`:((F=x.text)==null?void 0:F.substring(0,20))+(((w=x.text)==null?void 0:w.length)>20?"...":"")||"Text";if(x.type==="qrcode")return`QR Code: ${(x.data||"").substring(0,15)+((x.data||"").length>15?"...":"")}`;if(x.type==="barcode"){const j=x.format||"CODE128",m=x.data||"";return`Barcode (${j}): ${m.substring(0,10)+(m.length>10?"...":"")}`}return x.type==="sticker"?`Sticker: ${(x.name||"Untitled").substring(0,15)}`:x.type==="embroidery"?`Embroidery: ${(x.name||"Design").substring(0,15)}`:x.type.charAt(0).toUpperCase()+x.type.slice(1)};return t.jsxs("div",{className:"layers-panel",children:[t.jsxs("div",{className:"panel-header",children:[t.jsx("h3",{children:"Layers"}),t.jsx("span",{className:"layer-count",children:s.length})]}),t.jsx("div",{className:"layers-list",children:s.length===0?t.jsx("div",{className:"no-layers",children:"No elements added yet"}):[...s].reverse().map((x,F)=>t.jsxs("div",{className:`layer-item ${(a==null?void 0:a.id)===x.id?"selected":""}`,onClick:()=>o(x),children:[t.jsxs("div",{className:"layer-info",children:[t.jsx("span",{className:"layer-icon",children:d(x.type)}),t.jsx("span",{className:"layer-name",children:y(x)})]}),t.jsxs("div",{className:"layer-controls",children:[t.jsx("button",{className:"layer-btn",onClick:w=>{w.stopPropagation(),n(x.id,"up")},disabled:F===0,title:"Move Up",children:"↑"}),t.jsx("button",{className:"layer-btn",onClick:w=>{w.stopPropagation(),n(x.id,"down")},disabled:F===s.length-1,title:"Move Down",children:"↓"}),t.jsx("button",{className:"layer-btn delete",onClick:w=>{w.stopPropagation(),l(x.id)},title:"Delete",children:"×"})]})]},x.id))})]})};let Le=null;function Ma(){if(Le)return Le;if(typeof document>"u")return null;const s=document.createElement("canvas");s.width=6,s.height=6;const a=s.getContext("2d");return a.strokeStyle="rgba(255,255,255,0.34)",a.lineWidth=1.7,a.lineCap="round",a.beginPath(),a.moveTo(-2,8),a.lineTo(8,-2),a.stroke(),a.strokeStyle="rgba(0,0,0,0.16)",a.lineWidth=1.1,a.beginPath(),a.moveTo(1.5,8),a.lineTo(8,1.5),a.stroke(),Le=s,s}function Re(s){return s?(s.productionMethods||[]).map(o=>String(o).toUpperCase()).includes("EMBROIDERY")||s.supportsEmbroidery==="Y":!1}function be(s,a,o,{fontSize:n=20,color:l="#1f6feb"}={}){const c=ka(l||"#1f6feb"),d=s.globalAlpha===void 0?1:s.globalAlpha,y=(()=>{const x=Ma();try{return x?s.createPattern(x,"repeat"):null}catch{return null}})();s.save(),s.shadowColor="rgba(0,0,0,0.40)",s.shadowBlur=Math.max(1,n*.05),s.shadowOffsetX=.4,s.shadowOffsetY=Math.max(.8,n*.06),s.fillStyle=c,s.fillText(a,0,o),s.restore(),s.save(),s.fillStyle=c,s.fillText(a,0,o),y&&(s.globalAlpha=d*.85,s.fillStyle=y,s.fillText(a,0,o),s.globalAlpha=d),s.lineJoin="round",s.lineWidth=Math.max(1,n*.05),s.strokeStyle="rgba(28,16,8,0.55)",s.setLineDash&&s.setLineDash([Math.max(2,n*.13),Math.max(1.5,n*.1)]),s.strokeText(a,0,o),s.setLineDash&&s.setLineDash([]),s.restore()}class Ea{constructor(){this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d")}_prepareCanvas(a,o,n=1){const l=n>0?n:1;this.canvas.width=Math.round(a*l),this.canvas.height=Math.round(o*l),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.setTransform(l,0,0,l,0,0),this.ctx.imageSmoothingEnabled=!0,this.ctx.imageSmoothingQuality="high"}async exportAllSections(a,o,n,l,c="png",d=!0,y=null,x=1){const F={};try{const w=[];for(const j of o){const m=a[j.id||j.sectionName];((m==null?void 0:m.elements)||[]).forEach(M=>{M&&M.type==="text"&&M.fontFamily&&w.push(M.fontFamily)})}await $e(w),typeof document<"u"&&document.fonts&&document.fonts.ready&&await document.fonts.ready}catch{}for(const w of o){const j=w.id||w.sectionName,m=a[j];if(!m||!m.elements||m.elements.length===0){console.log(`Skipping section ${j} - no elements`);continue}if(this._prepareCanvas(n,l,x),d){const z=w.image||w.sectionImage;if(z)try{const R=await this.loadImage(z);this.ctx.drawImage(R,0,0,n,l)}catch(R){console.warn("Failed to load background image:",R)}}for(const z of m.elements)await this.drawElement(z);const M=this.canvas.toDataURL(`image/${c}`,c==="jpeg"?.9:void 0);F[j]={dataUrl:M,blob:await this.dataUrlToBlob(M)}}return F}async downloadExports(a,o="design"){const n=Object.keys(a);if(n.length===0){alert("No designs to export");return}if(n.length===1){const l=n[0],{blob:c}=a[l],d=URL.createObjectURL(c),y=document.createElement("a");y.href=d,y.download=`${o}-${l}.png`,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(d)}else for(const l of n){const{blob:c}=a[l],d=URL.createObjectURL(c),y=document.createElement("a");y.href=d,y.download=`${o}-${l}.png`,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(d),await new Promise(x=>setTimeout(x,100))}}async loadImage(a){return new Promise((o,n)=>{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>o(l),l.onerror=n,l.src=a})}getLuma(a,o,n){return(.2126*a+.7152*o+.0722*n)/255}async processImageColor(a,o){const n=document.createElement("canvas"),l=n.getContext("2d");n.width=a.width,n.height=a.height,l.clearRect(0,0,n.width,n.height),l.drawImage(a,0,0);const c=l.getImageData(0,0,n.width,n.height),d=c.data,y=this.hexToRgb(o);if(!y){console.warn("Invalid target color:",o);return}const{r:x,g:F,b:w}=y;for(let j=0;j<d.length;j+=4){if(d[j+3]===0)continue;const M=this.getLuma(d[j],d[j+1],d[j+2]);d[j]=Math.round(x*M),d[j+1]=Math.round(F*M),d[j+2]=Math.round(w*M)}return l.putImageData(c,0,0),this.processedImage=new Image,new Promise(j=>{this.processedImage.onload=()=>{j()},this.processedImage.onerror=()=>{console.error("Failed to create processed image"),j()},this.processedImage.src=n.toDataURL("image/png")})}async drawElement(a){this.ctx.save();const o=a.x+a.width/2,n=a.y+a.height/2;switch(this.ctx.translate(o,n),a.rotation&&this.ctx.rotate(a.rotation*Math.PI/180),this.ctx.translate(-a.width/2,-a.height/2),a.type){case"text":this.drawText(a);break;case"rectangle":this.drawRectangle(a);break;case"circle":this.drawCircle(a);break;case"triangle":this.drawTriangle(a);break;case"star":this.drawStar(a);break;case"arrow":this.drawArrow(a);break;case"diamond":this.drawDiamond(a);break;case"hexagon":this.drawHexagon(a);break;case"pentagon":this.drawPentagon(a);break;case"heart":this.drawHeart(a);break;case"oval":this.drawOval(a);break;case"roundedRectangle":this.drawRoundedRectangle(a);break;case"qrcode":await this.drawQRCode(a);break;case"barcode":await this.drawBarcode(a);break;case"horizontalLine":this.drawHorizontalLine(a);break;case"sticker":await this.drawSticker(a);break;case"embroidery":await this.drawEmbroidery(a);break;case"image":await this.drawImage(a);break}this.ctx.restore()}drawText(a){let o=a.text||"Text";switch(a.textTransform){case"uppercase":o=o.toUpperCase();break;case"lowercase":o=o.toLowerCase();break;case"capitalize":o=o.replace(/\b\w/g,d=>d.toUpperCase());break}this.ctx.font=`${a.fontStyle||"normal"} ${a.fontWeight||"normal"} ${a.fontSize||20}px ${a.fontFamily||"Arial"}`,this.ctx.letterSpacing=`${a.letterSpacing||0}px`,this.ctx.fillStyle=a.fill||"#000000",this.ctx.textAlign=a.textAlign||"left",this.ctx.textBaseline="top",a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth);const n=o.split(`
53
- `),l=(a.fontSize||20)*(a.lineHeight||1.2),c=this.embroidery&&a.type==="text"&&!a.isIcon;if(a.curve&&Math.abs(a.curve)>=1){const d=Math.max(...n.map(y=>this.ctx.measureText(y).width));this.drawCurvedText(a,n.join(" "),d,c);return}n.forEach((d,y)=>{const x=y*l;c?be(this.ctx,d,x,{fontSize:a.fontSize||20,color:a.fill||"#000000"}):(a.stroke&&a.strokeWidth>0&&this.ctx.strokeText(d,0,x),this.ctx.fillText(d,0,x))})}drawCurvedText(a,o,n,l=!1){const c=this.ctx,d=Array.from(o);if(d.length===0)return;const y=a.fontSize||20,x=d.map(tt=>c.measureText(tt).width),F=x.reduce((tt,K)=>tt+K,0)||1,w=Math.max(1e-4,Math.abs(a.curve)*Math.PI/180),j=F/w,m=a.curve>=0?1:-1,M=(n||F)/2,z=m*j+y/2,R=a.stroke&&a.strokeWidth>0,p=typeof a.textDecoration=="string"?a.textDecoration:"",T={underline:p.includes("underline")||!!a.underline,overline:p.includes("overline")||!!a.overline,strike:p.includes("line-through")||!!a.strikethrough},g=T.underline||T.overline||T.strike,q=a.decorationColor||a.fill||"#000000",E=Math.max(1,y/20);c.textAlign="center",c.textBaseline="middle",c.save(),c.translate(M,z),c.rotate(-m*w/2);for(let tt=0;tt<d.length;tt++){const K=x[tt]/j;if(c.rotate(m*K/2),c.save(),c.translate(0,-m*j),l?be(c,d[tt],0,{fontSize:y,color:a.fill||"#000000"}):(R&&c.strokeText(d[tt],0,0),c.fillText(d[tt],0,0)),g){const it=x[tt];c.strokeStyle=q,c.lineWidth=E,c.setLineDash&&c.setLineDash([]),T.underline&&(c.beginPath(),c.moveTo(-it/2,y/2+2),c.lineTo(it/2,y/2+2),c.stroke()),T.overline&&(c.beginPath(),c.moveTo(-it/2,-(y/2+2)),c.lineTo(it/2,-(y/2+2)),c.stroke()),T.strike&&(c.beginPath(),c.moveTo(-it/2,0),c.lineTo(it/2,0),c.stroke())}c.restore(),c.rotate(m*K/2)}c.restore()}drawRectangle(a){a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fillRect(0,0,a.width,a.height)),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.strokeRect(0,0,a.width,a.height))}drawCircle(a){const o=Math.min(a.width,a.height)/2,n=a.width/2,l=a.height/2;this.ctx.beginPath(),this.ctx.arc(n,l,o,0,2*Math.PI),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawTriangle(a){const o=a.width/2;this.ctx.beginPath(),this.ctx.moveTo(o,0),this.ctx.lineTo(0,a.height),this.ctx.lineTo(a.width,a.height),this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawStar(a){const o=a.width/2,n=a.height/2,l=Math.min(a.width,a.height)/2,c=l*.4,d=a.numPoints||5;this.ctx.beginPath();for(let y=0;y<d*2;y++){const x=y%2===0?l:c,F=y*Math.PI/d,w=o+Math.cos(F)*x,j=n+Math.sin(F)*x;y===0?this.ctx.moveTo(w,j):this.ctx.lineTo(w,j)}this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawArrow(a){const o=a.width,n=a.height,l=o*.3;this.ctx.beginPath(),this.ctx.moveTo(o/2,0),this.ctx.lineTo(o,n*.6),this.ctx.lineTo(o-l,n*.6),this.ctx.lineTo(o-l,n),this.ctx.lineTo(l,n),this.ctx.lineTo(l,n*.6),this.ctx.lineTo(0,n*.6),this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}async dataUrlToBlob(a){return new Promise(o=>{const n=document.createElement("canvas"),l=n.getContext("2d"),c=new Image;c.onload=()=>{n.width=c.width,n.height=c.height,l.drawImage(c,0,0),n.toBlob(o)},c.src=a})}hexToRgb(a){const o=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return o?{r:parseInt(o[1],16),g:parseInt(o[2],16),b:parseInt(o[3],16)}:null}drawDiamond(a){const o=a.width/2,n=a.height/2;this.ctx.beginPath(),this.ctx.moveTo(o,0),this.ctx.lineTo(a.width,n),this.ctx.lineTo(o,a.height),this.ctx.lineTo(0,n),this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawHexagon(a){const o=a.width/2,n=a.height/2,l=Math.min(a.width,a.height)/2,c=6;this.ctx.beginPath();for(let d=0;d<c;d++){const y=d*2*Math.PI/c-Math.PI/2,x=o+l*Math.cos(y),F=n+l*Math.sin(y);d===0?this.ctx.moveTo(x,F):this.ctx.lineTo(x,F)}this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawPentagon(a){const o=a.width/2,n=a.height/2,l=Math.min(a.width,a.height)/2,c=5;this.ctx.beginPath();for(let d=0;d<c;d++){const y=d*2*Math.PI/c-Math.PI/2,x=o+l*Math.cos(y),F=n+l*Math.sin(y);d===0?this.ctx.moveTo(x,F):this.ctx.lineTo(x,F)}this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawHeart(a){const o=a.width,n=a.height,l=0,c=0;this.ctx.beginPath();const d=n*.3;this.ctx.moveTo(l+o/2,c+d),this.ctx.bezierCurveTo(l+o/2,c,l,c,l,c+d),this.ctx.bezierCurveTo(l,c+(n+d)/2,l+o/2,c+(n+d)/2,l+o/2,c+n),this.ctx.bezierCurveTo(l+o/2,c+(n+d)/2,l+o,c+(n+d)/2,l+o,c+d),this.ctx.bezierCurveTo(l+o,c,l+o/2,c,l+o/2,c+d),this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawOval(a){const o=a.width/2,n=a.height/2,l=a.width/2,c=a.height/2;this.ctx.beginPath(),this.ctx.ellipse(o,n,l,c,0,0,2*Math.PI),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawRoundedRectangle(a){const o=Math.min(a.width,a.height)*.1;this.drawRoundedRect(0,0,a.width,a.height,o),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawRoundedRect(a,o,n,l,c){this.ctx.beginPath(),this.ctx.moveTo(a+c,o),this.ctx.lineTo(a+n-c,o),this.ctx.quadraticCurveTo(a+n,o,a+n,o+c),this.ctx.lineTo(a+n,o+l-c),this.ctx.quadraticCurveTo(a+n,o+l,a+n-c,o+l),this.ctx.lineTo(a+c,o+l),this.ctx.quadraticCurveTo(a,o+l,a,o+l-c),this.ctx.lineTo(a,o+c),this.ctx.quadraticCurveTo(a,o,a+c,o),this.ctx.closePath()}async drawQRCode(a){if(a.imageObject)this.ctx.drawImage(a.imageObject,0,0,a.width,a.height);else if(a.src)try{const o=await this.loadImage(a.src);this.ctx.drawImage(o,0,0,a.width,a.height)}catch(o){console.warn("Failed to load QR code image for export:",o),this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("QR Error",a.width/2,a.height/2)}else this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("No QR Data",a.width/2,a.height/2)}async drawBarcode(a){if(a.imageObject)this.ctx.drawImage(a.imageObject,0,0,a.width,a.height);else if(a.src)try{const o=await this.loadImage(a.src);this.ctx.drawImage(o,0,0,a.width,a.height)}catch(o){console.warn("Failed to load barcode image for export:",o),this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Barcode Error",a.width/2,a.height/2)}else this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("No Barcode Data",a.width/2,a.height/2)}drawHorizontalLine(a){this.ctx.save(),a.opacity!==void 0&&(this.ctx.globalAlpha=a.opacity),this.ctx.strokeStyle=a.stroke||a.fill||"#000000",this.ctx.lineWidth=a.strokeWidth||a.height||2,this.ctx.lineCap="round",this.ctx.beginPath(),this.ctx.moveTo(0,a.height/2),this.ctx.lineTo(a.width,a.height/2),this.ctx.stroke(),this.ctx.restore()}async drawSticker(a){try{let o=null;if(a.imageObject)o=a.imageObject;else if(a.imageData)o=a.imageData;else if(a.src||a.image){const n=a.src||a.image;o=await this.loadImage(n)}else a.data&&a.data.image&&(o=await this.loadImage(a.data.image));o?(a.opacity!==void 0&&(this.ctx.globalAlpha=a.opacity),this.ctx.drawImage(o,0,0,a.width,a.height)):(this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Sticker",a.width/2,a.height/2))}catch(o){console.warn("Failed to draw sticker:",o),this.ctx.fillStyle="#ffebee",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#f44336",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#f44336",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Error",a.width/2,a.height/2)}}async drawEmbroidery(a){try{let o=null;if(a.imageObject)o=a.imageObject;else if(a.imageData)o=a.imageData;else if(a.src||a.image){const n=a.src||a.image;o=await this.loadImage(n)}else a.data&&a.data.image&&(o=await this.loadImage(a.data.image));o?(a.opacity!==void 0&&(this.ctx.globalAlpha=a.opacity),this.ctx.drawImage(o,0,0,a.width,a.height)):(this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Embroidery",a.width/2,a.height/2))}catch(o){console.warn("Failed to draw embroidery:",o),this.ctx.fillStyle="#ffebee",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#f44336",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#f44336",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Error",a.width/2,a.height/2)}}async drawImage(a){try{let o=null;if(a.imageObject&&a.imageObject instanceof HTMLImageElement)o=a.imageObject;else if(a.imageData){if(a.imageData instanceof HTMLImageElement)o=a.imageData;else if(typeof a.imageData=="string")try{o=await this.loadImage(a.imageData)}catch(n){console.warn("Failed to load image from imageData URL:",a.imageData,n),o=await this.loadImageWithFallback(a.imageData)}}else if(a.src)try{o=await this.loadImage(a.src)}catch(n){console.warn("Failed to load image from src:",a.src,n),o=await this.loadImageWithFallback(a.src)}else if(a.image)try{o=await this.loadImage(a.image)}catch(n){console.warn("Failed to load image from image property:",a.image,n),o=await this.loadImageWithFallback(a.image)}o?(a.opacity!==void 0&&(this.ctx.globalAlpha=a.opacity),this.ctx.drawImage(o,0,0,a.width,a.height)):this.drawImagePlaceholder(a)}catch(o){console.error("Failed to draw image element:",o),this.drawImagePlaceholder(a)}}async loadImageWithFallback(a){return new Promise(o=>{const n=new Image;n.onload=()=>o(n),n.onerror=()=>{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>o(l),l.onerror=()=>{console.warn("All image loading attempts failed for:",a),o(null)},l.src=a},n.src=a})}drawImagePlaceholder(a){this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.lineWidth=2,this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Image",a.width/2,a.height/2-8),this.ctx.fillText("Not Found",a.width/2,a.height/2+8)}async blobToFile(a,o,n="image/png"){return new File([a],o,{type:n,lastModified:Date.now()})}async exportAllSectionsAsJSON(a,o,n,l,c="png",d=null,y=1){var z,R;const x=[],F=[],w=Math.min(y,2),j={};for(const p of o){const T=p.sectionName,g=a[T];if(!g||!g.elements||g.elements.length===0){console.log(`Skipping section ${T} - no elements`);continue}const q=p.image||p.sectionImage,E={...g,backgroundImage:q,sectionImage:q,sectionName:T,selectedColor:g.selectedColor||"#FFFFFF",canvasWidth:n,canvasHeight:l};j[T]=E;const tt=await this.exportSectionAsBlob(g,p,n,l,c,!0,d,w);if(tt){const it=await this.blobToFile(tt,`${T}-full.${c}`,`image/${c}`);x.push({sectionName:T,sectionImage:it})}const K=await this.exportSectionAsBlob(g,p,n,l,c,!1,d,y);if(K){const it=await this.blobToFile(K,`${T}-print.${c}`,`image/${c}`);F.push({sectionName:T,sectionImage:it})}}const m=((z=o[0])==null?void 0:z.image)||((R=o[0])==null?void 0:R.sectionImage),M={sections:j,canvasWidth:n,canvasHeight:l,sectionImage:m,format:c,timestamp:new Date().toISOString(),version:"1.0",...d&&{initData:{sectionImage:d.sectionImage,sections:d.sections?Object.keys(d.sections):[]}},product:{sections:o.map(p=>({sectionName:p.sectionName||p.id,sectionImage:p.image||p.sectionImage,id:p.id||p.sectionName}))}};return{fullDesign:x,printReady:F,designFile:JSON.stringify(M)}}async exportSectionAsBlob(a,o,n,l,c="png",d=!0,y=null,x=1){try{if(this._prepareCanvas(n,l,x),d){const F=o.image||o.sectionImage;if(F)try{const w=await this.loadImage(F);this.ctx.drawImage(w,0,0,n,l)}catch(w){console.warn("Failed to load background image:",w)}}for(const F of a.elements)await this.drawElement(F);return new Promise(F=>{this.canvas.toBlob(F,`image/${c}`,c==="jpeg"?.9:void 0)})}catch(F){return console.error("Error exporting section as blob:",F),null}}async exportCurrentSectionAsJSON(a,o="png",n=null,l=1){var R,p,T;const c=Math.min(l,2),d=((R=a.activeSection)==null?void 0:R.sectionName)||"main",y=((p=a.activeSection)==null?void 0:p.sectionImage)||((T=a.activeSection)==null?void 0:T.image),x={elements:a.elements,selectedColor:a.selectedColor,canvasWidth:a.canvasWidth,canvasHeight:a.canvasHeight,backgroundImage:y,sectionImage:y,sectionName:d,zoomLevel:a.zoomLevel,showGrid:a.showGrid,snapToGrid:a.snapToGrid},F={id:d,sectionName:d,image:y,sectionImage:y},w=[],j=[],m=await this.exportSectionAsBlob(x,F,a.canvasWidth,a.canvasHeight,o,!0,n,c);if(m){const g=await this.blobToFile(m,`${d}-full.${o}`,`image/${o}`);w.push({sectionName:d,sectionImage:g})}const M=await this.exportSectionAsBlob(x,F,a.canvasWidth,a.canvasHeight,o,!1,n,l);if(M){const g=await this.blobToFile(M,`${d}-print.${o}`,`image/${o}`);j.push({sectionName:d,sectionImage:g})}const z={sections:{[d]:x},canvasWidth:a.canvasWidth,canvasHeight:a.canvasHeight,sectionImage:y,format:o,timestamp:new Date().toISOString(),version:"1.0",...n&&{initData:{sectionImage:n.sectionImage,sections:n.sections?Object.keys(n.sections):[]}},productInfo:{sections:[{sectionName:d,sectionImage:y,id:d}]}};return{fullDesign:w,printReady:j,designFile:JSON.stringify(z)}}}const Da=["rectangle","circle","triangle","star","heart","diamond","hexagon","pentagon","oval","roundedRectangle"];function Ia(s){const a=Array.isArray(s)?s:[],o=[];a.some(l=>l&&l.type==="text"&&!l.isIcon&&(l.fontSize||20)<14)&&o.push("Small text may not stitch cleanly — keep letters bold and reasonably large."),a.some(l=>l&&(l.type==="image"||l.type==="sticker"))&&o.push("Photos & gradients can’t be embroidered — they’ll be simplified to solid thread colours.");const n=new Set;return a.forEach(l=>{l&&(l.type==="text"||Da.includes(l.type))&&l.fill&&n.add(String(l.fill).toLowerCase())}),n.size>8&&o.push(`Your design uses ${n.size} colours — more thread colours can increase the price.`),o}class La{constructor(a="localStorage"){this.storage=a==="sessionStorage"?sessionStorage:localStorage,this.STORAGE_PREFIX="mypixia_canvas_",this.DESIGNS_LIST_KEY="mypixia_saved_designs"}saveDesign(a,o){var n;try{const l=this.generateDesignId(a),c=new Date().toISOString(),d={id:l,name:a,timestamp:c,version:"1.0",canvasData:{elements:o.elements||[],canvasWidth:o.canvasWidth||800,canvasHeight:o.canvasHeight||600,selectedColor:o.selectedColor||"#FF0000",activeSection:o.activeSection||null,product:o.product||null,sectionDesigns:o.sectionDesigns||{},zoomLevel:o.zoomLevel||1,showGrid:o.showGrid||!1,snapToGrid:o.snapToGrid||!0},metadata:{elementCount:((n=o.elements)==null?void 0:n.length)||0,lastModified:c,thumbnail:o.thumbnail||null}};return this.storage.setItem(this.STORAGE_PREFIX+l,JSON.stringify(d)),this.updateDesignsList(l,a,c),{success:!0,designId:l,message:"Design saved successfully"}}catch(l){return console.error("Error saving design:",l),{success:!1,error:l.message}}}loadDesign(a){try{let o=a;if(!a.startsWith("design_")){const d=this.getAllDesigns().find(y=>y.name===a);if(!d)return{success:!1,error:"Design not found"};o=d.id}const n=this.storage.getItem(this.STORAGE_PREFIX+o);return n?{success:!0,data:JSON.parse(n)}:{success:!1,error:"Design not found"}}catch(o){return console.error("Error loading design:",o),{success:!1,error:o.message}}}getAllDesigns(){try{const a=this.storage.getItem(this.DESIGNS_LIST_KEY);return a?JSON.parse(a):[]}catch(a){return console.error("Error getting designs list:",a),[]}}deleteDesign(a){try{this.storage.removeItem(this.STORAGE_PREFIX+a);const n=this.getAllDesigns().filter(l=>l.id!==a);return this.storage.setItem(this.DESIGNS_LIST_KEY,JSON.stringify(n)),{success:!0,message:"Design deleted successfully"}}catch(o){return console.error("Error deleting design:",o),{success:!1,error:o.message}}}exportDesignAsFile(a){try{const o=this.loadDesign(a);if(!o.success)return o;const n=o.data,l=JSON.stringify(n,null,2),c=new Blob([l],{type:"application/json"}),d=URL.createObjectURL(c),y=document.createElement("a");return y.href=d,y.download=`${n.name}_${n.id}.json`,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(d),{success:!0,message:"Design exported successfully"}}catch(o){return console.error("Error exporting design:",o),{success:!1,error:o.message}}}importDesignFromFile(a){return new Promise(o=>{try{const n=new FileReader;n.onload=l=>{try{const c=JSON.parse(l.target.result);if(!this.validateDesignData(c)){o({success:!1,error:"Invalid design file format"});return}const d=this.generateDesignId(c.name+"_imported");c.id=d,c.name+="_imported",c.timestamp=new Date().toISOString(),c.metadata.lastModified=c.timestamp,this.storage.setItem(this.STORAGE_PREFIX+d,JSON.stringify(c)),this.updateDesignsList(d,c.name,c.timestamp),o({success:!0,data:c,message:"Design imported successfully"})}catch{o({success:!1,error:"Failed to parse design file"})}},n.readAsText(a)}catch(n){o({success:!1,error:n.message})}})}autoSave(a,o){const n=this.STORAGE_PREFIX+"autosave_"+a;try{const l={timestamp:new Date().toISOString(),canvasData:o};return this.storage.setItem(n,JSON.stringify(l)),!0}catch(l){return console.error("Auto-save failed:",l),!1}}loadAutoSave(a){const o=this.STORAGE_PREFIX+"autosave_"+a;try{const n=this.storage.getItem(o);return n?JSON.parse(n):null}catch(n){return console.error("Failed to load auto-save:",n),null}}clearAutoSave(a){const o=this.STORAGE_PREFIX+"autosave_"+a;this.storage.removeItem(o)}getStorageInfo(){const a=this.getAllDesigns();let o=0;return a.forEach(n=>{const l=this.storage.getItem(this.STORAGE_PREFIX+n.id);l&&(o+=new Blob([l]).size)}),{designCount:a.length,totalSize:o,totalSizeFormatted:this.formatBytes(o),storageLimit:this.getStorageLimit()}}clearAllDesigns(){try{return this.getAllDesigns().forEach(o=>{this.storage.removeItem(this.STORAGE_PREFIX+o.id)}),this.storage.removeItem(this.DESIGNS_LIST_KEY),{success:!0,message:"All designs cleared"}}catch(a){return{success:!1,error:a.message}}}generateDesignId(a){const o=Date.now(),n=Math.random().toString(36).substring(2,8);return`design_${o}_${n}`}updateDesignsList(a,o,n){const l=this.getAllDesigns(),c=l.findIndex(y=>y.id===a),d={id:a,name:o,timestamp:n,lastModified:n};c>=0?l[c]=d:l.push(d),l.sort((y,x)=>new Date(x.timestamp)-new Date(y.timestamp)),this.storage.setItem(this.DESIGNS_LIST_KEY,JSON.stringify(l))}validateDesignData(a){return a&&a.id&&a.name&&a.canvasData&&Array.isArray(a.canvasData.elements)}formatBytes(a){if(a===0)return"0 Bytes";const o=1024,n=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(a)/Math.log(o));return parseFloat((a/Math.pow(o,l)).toFixed(2))+" "+n[l]}getStorageLimit(){try{if("storage"in navigator&&"estimate"in navigator.storage)return navigator.storage.estimate().then(a=>a.quota)}catch{console.warn("Unable to estimate storage quota")}return"Unknown"}}const Ra=(s,a)=>{let o;return function(...l){const c=()=>{clearTimeout(o),s(...l)};clearTimeout(o),o=setTimeout(c,a)}},yi=f.forwardRef((s,a)=>{var oi;const{theme:o={primaryColor:"#000000",secondaryColor:"#cf7e52",tertiaryColor:"#FFFFFF"},readOnly:n=!1,mode:l="design",initialColor:c,product:d={name:"Premium Crew Neck T-Shirt",category:"Tshirts",description:"Men's crew neck t-shirts",plainColor:"N",mainImage:"https://static.mypixia.com/dev/products/7/e011a73a-f20a-489b-bea8-91a23da56fc4.png",colorSettings:["#FF0000","#0000FF","#008000","#000000","#FFFFFF","#808080","#FFFF00"],sections:[{sectionName:"Front",sectionImage:"https://static.mypixia.com/prod/products/96ca4acb-c426-4619-a2c4-7acd95b78451.png"},{sectionName:"Sleeve-left",sectionImage:"https://static.mypixia.com/prod/products/27b8c138-af4e-4ea0-833d-88b10fbd3cf7.png"},{sectionName:"Back",sectionImage:"https://static.mypixia.com/prod/products/d4c53776-7b7d-41c5-a6b5-2bf5876cd26e.png"}]},initFile:y,initDesignContent:x,printConfig:F,aiEnabled:w=!0,aiEndpoint:j,onAIImageGenerate:m,isAuthenticated:M=!0,onRequireAuth:z,onRemoveBackground:R}=s,[p,T]=f.useState([]),[g,q]=f.useState(null),[E,tt]=f.useState(!1),[K,it]=f.useState(!1),[st,yt]=f.useState(!1),[$,U]=f.useState({x:0,y:0}),[k,H]=f.useState(null),[W,N]=f.useState(600),[B,G]=f.useState(600),[P,ct]=f.useState(1),[b,D]=f.useState(c||((oi=d.colorSettings)==null?void 0:oi[0])),[Y,ot]=f.useState(!1),[nt,ht]=f.useState(l!=="customize"),[ft,vt]=f.useState(!0),[dt,At]=f.useState(!1),[Et,Bt]=f.useState(l!=="customize"),jt=ve(F),Wt=Fa(W,B,jt),[V,Pt]=f.useState(d.sections[0]),[Dt,Jt]=f.useState(!1),[re,Kt]=f.useState(!1),[It,Vt]=f.useState({}),[wt,se]=f.useState([]),[pt,_t]=f.useState(-1),[Ge]=f.useState(new La("localStorage")),kt=f.useRef(null),we=f.useRef(null),Ut=f.useRef(null),Lt=f.useRef(null),xt=f.useRef(null),et=f.useRef(new Ea),_=f.useRef(!1),[Nt,Ve]=f.useState(null),ut=f.useCallback(()=>{const i={elements:JSON.parse(JSON.stringify(p)),selectedElement:g?{...g}:null,timestamp:Date.now()},e=wt.slice(0,pt+1);e.push(i),e.length>50?e.shift():_t(pt+1),se(e)},[p,g,wt,pt]),te=f.useCallback(()=>({elements:p,canvasWidth:W,canvasHeight:B,selectedColor:b,activeSection:V,product:d,sectionDesigns:It,zoomLevel:P,showGrid:Y,snapToGrid:ft,selectedElement:g?{...g}:null,canvasRef:kt}),[p,W,B,b,V,d,It,P,Y,ft,g]),_e=i=>{if(i.sections&&typeof i.sections=="object"){const e=Object.keys(i.sections)[0],r=i.sections[e];if(r&&r.elements){T(r.elements||[]),N(r.canvasWidth||800),G(r.canvasHeight||600),D(r.selectedColor||d.colorSettings[0]),ct(r.zoomLevel||1),ot(r.showGrid||!1),vt(r.snapToGrid||!0),q(null),i.sections&&Vt(i.sections);const h=d.sections.find(u=>u.sectionName===e);h&&Pt(h),se([]),_t(-1),setTimeout(()=>{ut()},100);return}}};f.useEffect(()=>{const e=setTimeout(async()=>{if(p.length===0&&wt.length<=1)if(x)try{const r=JSON.parse(x);Ve(r),_e(r)}catch(r){console.error("Error loading design file:",r),console.warn("Using default text instead")}else if(y)try{const r=await fetch(y);if(r.ok){const h=await r.text();if(h.trim()){const u=JSON.parse(h.trim());Ve(u),_e(u)}}else console.warn("Failed to load design file, using default text")}catch(r){console.error("Error loading design file:",r),console.warn("Using default text instead")}else{const h="Arial",u="Change me",v=document.createElement("canvas").getContext("2d");v.font=`24px ${h}`;const C=v.measureText(u).width,L={id:St(),type:"text",x:W/2-C/2,y:B/2-24/2,width:C,height:24,text:u,fontSize:24,fontFamily:h,fontWeight:"normal",fontStyle:"normal",textAlign:"left",fill:"#000000",stroke:"",strokeWidth:0,rotation:0,opacity:1};T([L]),q(L),setTimeout(()=>{ut()},100)}},300);return()=>clearTimeout(e)},[y,x,d.colorSettings,d.sections]);const ke=f.useCallback((i="png",e=!0)=>{const r=te();return d.sections,et.current.exportAllSections({[(V==null?void 0:V.sectionName)||"main"]:r},[{id:(V==null?void 0:V.sectionName)||"main",sectionName:(V==null?void 0:V.sectionName)||"main",image:V==null?void 0:V.sectionImage,sectionImage:V==null?void 0:V.sectionImage}],W,B,i,e,Nt,Wt)},[te,d.sections,V,W,B,Wt]),xi=ui,ne=20;f.useEffect(()=>{const i=()=>Jt(window.innerWidth<768);return i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),f.useEffect(()=>{const i=document.createElement("canvas");i.width=W,i.height=B,xt.current=i},[W,B]),f.useEffect(()=>{wt.length===0&&ut()},[]);const le=(i,e,r,h,u,S)=>{i.beginPath(),i.moveTo(e+S,r),i.lineTo(e+h-S,r),i.quadraticCurveTo(e+h,r,e+h,r+S),i.lineTo(e+h,r+u-S),i.quadraticCurveTo(e+h,r+u,e+h-S,r+u),i.lineTo(e+S,r+u),i.quadraticCurveTo(e,r+u,e,r+u-S),i.lineTo(e,r+S),i.quadraticCurveTo(e,r,e+S,r),i.closePath()},Ce=(i,e)=>{if(e.type==="text"&&!e.isIcon){i.save(),i.font=`${e.fontStyle||"normal"} ${e.fontWeight||"normal"} ${e.fontSize||20}px ${e.fontFamily||"Arial"}`;try{i.letterSpacing=`${e.letterSpacing||0}px`}catch{}let mt=e.text||"Text";switch(e.textTransform){case"uppercase":mt=mt.toUpperCase();break;case"lowercase":mt=mt.toLowerCase();break;case"capitalize":mt=mt.replace(/\b\w/g,Qt=>Qt.toUpperCase());break}const Xt=mt.split(`
54
- `),gt=Math.max(1,...Xt.map(Qt=>i.measureText(Qt||" ").width)),Mt=(e.fontSize||20)*(e.lineHeight||1.2),Ot=Math.max(e.fontSize||20,Xt.length*Mt);i.restore();const Ht=e.textAlign||"left",$t=Ht==="center"?e.x-gt/2:Ht==="right"?e.x-gt:e.x,ge=e.y;return{x:$t,y:ge,width:gt,height:Ot,cx:$t+gt/2,cy:ge+Ot/2}}if(!e.isIcon)return{x:e.x,y:e.y,width:e.width,height:e.height,cx:e.x+e.width/2,cy:e.y+e.height/2};i.save(),i.font=`${e.fontStyle||""} ${e.fontWeight||""} ${e.fontSize}px ${e.fontFamily}`,i.textBaseline="alphabetic",i.textAlign="left";const r=i.measureText(e.text),h=r.actualBoundingBoxAscent??e.fontSize*.8,u=r.actualBoundingBoxDescent??e.fontSize*.2,S=r.actualBoundingBoxLeft??0,v=r.actualBoundingBoxRight??r.width,A=S+v,C=h+u,L=e.x,I=e.y,Q=L-A/2-S,lt=I-C/2-h;return i.restore(),{x:Q,y:lt,width:A,height:C,cx:L,cy:I}},bi=(i,e)=>{if(!e)return;const r=8,h=8,u=4,S=30,v=Ce(i,e),A=e.isIcon?Math.max(r,12):r,C={x:-v.width/2-A,y:-v.height/2-A,w:v.width+A*2,h:v.height+A*2};i.save(),i.translate(v.cx,v.cy),e.rotation&&i.rotate(e.rotation*Math.PI/180);const L=i.createLinearGradient(C.x,C.y,C.x+C.w,C.y+C.h);L.addColorStop(0,"#3b82f6"),L.addColorStop(.5,"#1d4ed8"),L.addColorStop(1,"#3b82f6"),i.strokeStyle="rgba(59,130,246,.3)",i.lineWidth=3,le(i,C.x-1,C.y-1,C.w+2,C.h+2,u+1),i.stroke(),i.strokeStyle=L,i.lineWidth=2,i.setLineDash([8,4]),le(i,C.x,C.y,C.w,C.h,u),i.stroke(),i.lineDashOffset=-(Date.now()/50)%12,i.strokeStyle="#ffffff",i.lineWidth=1,i.setLineDash([4,8]),le(i,C.x,C.y,C.w,C.h,u),i.stroke(),i.setLineDash([]),i.lineDashOffset=0,[{x:C.x,y:C.y},{x:C.x+C.w,y:C.y},{x:C.x+C.w,y:C.y+C.h},{x:C.x,y:C.y+C.h}].forEach(lt=>{i.fillStyle="rgba(0,0,0,.2)",i.fillRect(lt.x-h/2+1,lt.y-h/2+1,h,h),i.fillStyle="#ffffff",i.fillRect(lt.x-h/2,lt.y-h/2,h,h),i.strokeStyle="#3b82f6",i.lineWidth=1,i.strokeRect(lt.x-h/2,lt.y-h/2,h,h)});const I=0,Q=C.y-S;i.strokeStyle="#3b82f6",i.lineWidth=1,i.setLineDash([2,2]),i.beginPath(),i.moveTo(I,Q+12),i.lineTo(I,C.y),i.stroke(),i.setLineDash([]),i.beginPath(),i.arc(I,Q,12,0,2*Math.PI),i.fillStyle="#f59e0b",i.fill(),i.strokeStyle="#ffffff",i.lineWidth=2,i.stroke(),i.strokeStyle="#ffffff",i.lineWidth=2,i.beginPath(),i.arc(I,Q,6,-Math.PI/2,Math.PI,!1),i.stroke(),i.beginPath(),i.moveTo(I-6,Q),i.lineTo(I-3,Q-3),i.lineTo(I-3,Q+3),i.closePath(),i.fillStyle="#ffffff",i.fill(),i.restore()},Si=(i,e)=>{if(!e)return[];const r=Ce(i,e),h=e.isIcon?Math.max(8,12):8,u=8,S=30,v=(e.rotation||0)*Math.PI/180,A={x:-r.width/2-h,y:-r.height/2-h,w:r.width+h*2,h:r.height+h*2},C=[{x:A.x,y:A.y,type:"nw-resize"},{x:A.x+A.w,y:A.y,type:"ne-resize"},{x:A.x+A.w,y:A.y+A.h,type:"se-resize"},{x:A.x,y:A.y+A.h,type:"sw-resize"},{x:0,y:A.y-S,type:"rotate"}],L=Math.cos(v),I=Math.sin(v);return C.map(Q=>({x:r.cx+(Q.x*L-Q.y*I),y:r.cy+(Q.x*I+Q.y*L),type:Q.type,size:Q.type==="rotate"?24:u}))},Ue=(i,e,r)=>{if(!r)return null;const h=kt.current;if(!h)return null;const u=h.getContext("2d"),S=Si(u,r);for(const v of S){const A=i-v.x,C=e-v.y;if(Math.sqrt(A*A+C*C)<=v.size/2)return v.type}return null},ee=f.useCallback(()=>{if(pt>0){const i=wt[pt-1];T(i.elements),q(i.selectedElement),_t(pt-1)}},[wt,pt]),Yt=f.useCallback(()=>{if(pt<wt.length-1){const i=wt[pt+1];T(i.elements),q(i.selectedElement),_t(pt+1)}},[wt,pt]),Rt=i=>ft?Math.round(i/ne)*ne:i;f.useEffect(()=>{if(V!=null&&V.sectionImage){Ut.current=null,Lt.current=null;const i=kt.current;if(i&&i.getContext("2d").clearRect(0,0,W,B),y&&!Nt)return;const e=new Image;e.crossOrigin="anonymous",e.onload=()=>{Ut.current=e,Lt.current=e,at()},e.onerror=()=>{console.error("Failed to load background image:",V.sectionImage),at()},e.src=V.sectionImage}else Ut.current=null,Lt.current=null,at()},[V,Nt]),f.useEffect(()=>{const i=e=>{const r=document.activeElement;if(!(r&&(r.tagName==="INPUT"||r.tagName==="TEXTAREA"||r.tagName==="SELECT"||r.isContentEditable))){if((e.key==="Delete"||e.key==="Backspace")&&g&&!n){e.preventDefault();const u=g;T(S=>S.filter(v=>v.id!==u.id)),q(null),ut()}if(e.ctrlKey||e.metaKey)switch(e.key){case"z":e.shiftKey?(e.preventDefault(),Yt()):(e.preventDefault(),ee());break;case"y":e.preventDefault(),Yt();break}}};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[g,n,ee,Yt,ut]);const St=()=>`element_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,vi=i=>{i.strokeStyle="#e0e0e0",i.lineWidth=1,i.setLineDash([1,1]);for(let e=0;e<=W;e+=ne)i.beginPath(),i.moveTo(e,0),i.lineTo(e,B),i.stroke();for(let e=0;e<=B;e+=ne)i.beginPath(),i.moveTo(0,e),i.lineTo(W,e),i.stroke();i.setLineDash([])},wi=(i,e)=>{i.save();const r=e.x+e.width/2,h=e.y+e.height/2;switch(i.translate(r,h),e.rotation&&i.rotate(e.rotation*Math.PI/180),i.translate(-e.width/2,-e.height/2),e.type){case"text":ji(i,e);break;case"rectangle":Ni(i,e);break;case"circle":zi(i,e);break;case"triangle":Ai(i,e);break;case"star":Ti(i,e);break;case"arrow":Mi(i,e);break;case"diamond":Ei(i,e);break;case"hexagon":Di(i,e);break;case"pentagon":Ii(i,e);break;case"heart":Li(i,e);break;case"oval":Ri(i,e);break;case"roundedRectangle":Wi(i,e);break;case"image":Pi(i,e);break;case"qrcode":Ci(i,e);break;case"barcode":ki(i,e);break;case"sticker":Oi(i,e);break;case"horizontalLine":Bi(i,e);break;case"embroidery":Hi(i,e);break}i.restore()},ki=(i,e)=>{if(e.imageObject)i.drawImage(e.imageObject,0,0,e.width,e.height);else if(e.src&&!e.imageLoading){e.imageLoading=!0;const r=new Image;r.onload=()=>{T(h=>h.map(u=>u.id===e.id?{...u,imageObject:r,imageLoading:!1}:u))},r.onerror=()=>{T(h=>h.map(u=>u.id===e.id?{...u,imageLoading:!1}:u))},r.src=e.src,i.fillStyle="#f0f0f0",i.fillRect(0,0,e.width,e.height),i.strokeStyle="#ccc",i.strokeRect(0,0,e.width,e.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Your customization",e.width/2,e.height/2)}else e.imageLoading?(i.fillStyle="#f0f0f0",i.fillRect(0,0,e.width,e.height),i.strokeStyle="#ccc",i.strokeRect(0,0,e.width,e.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Your customization",e.width/2,e.height/2)):(i.fillStyle="#f0f0f0",i.fillRect(0,0,e.width,e.height),i.strokeStyle="#ccc",i.strokeRect(0,0,e.width,e.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("No Barcode",e.width/2,e.height/2))},Ci=(i,e)=>{if(e.imageObject)i.drawImage(e.imageObject,0,0,e.width,e.height);else if(e.src&&!e.imageLoading){e.imageLoading=!0;const r=new Image;r.onload=()=>{T(h=>h.map(u=>u.id===e.id?{...u,imageObject:r,imageLoading:!1}:u))},r.onerror=()=>{T(h=>h.map(u=>u.id===e.id?{...u,imageLoading:!1}:u))},r.src=e.src,i.fillStyle="#f0f0f0",i.fillRect(0,0,e.width,e.height),i.strokeStyle="#ccc",i.strokeRect(0,0,e.width,e.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Loading QR...",e.width/2,e.height/2)}else e.imageLoading?(i.fillStyle="#f0f0f0",i.fillRect(0,0,e.width,e.height),i.strokeStyle="#ccc",i.strokeRect(0,0,e.width,e.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Loading QR...",e.width/2,e.height/2)):(i.fillStyle="#f0f0f0",i.fillRect(0,0,e.width,e.height),i.strokeStyle="#ccc",i.strokeRect(0,0,e.width,e.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("No QR Data",e.width/2,e.height/2))},Fi=(i,e,r,h,u=!1)=>{const S=Array.from(e);if(S.length===0)return;const v=r.fontSize||20,A=S.map(zt=>i.measureText(zt).width),C=A.reduce((zt,ue)=>zt+ue,0)||1,L=Math.max(1e-4,Math.abs(r.curve)*Math.PI/180),I=C/L,Q=r.curve>=0?1:-1,lt=(h||C)/2,mt=Q*I+v/2,Xt=r.stroke&&r.strokeWidth>0,gt=typeof r.textDecoration=="string"?r.textDecoration:"",Mt={underline:gt.includes("underline")||!!r.underline,overline:gt.includes("overline")||!!r.overline,strike:gt.includes("line-through")||!!r.strikethrough},Ot=Mt.underline||Mt.overline||Mt.strike,Ht=r.decorationColor||r.fill||"#000000",$t=Math.max(1,v/20),ge=i.textAlign,Qt=i.textBaseline;i.textAlign="center",i.textBaseline="middle",i.save(),i.translate(lt,mt),i.rotate(-Q*L/2);for(let zt=0;zt<S.length;zt++){const ue=A[zt]/I;if(i.rotate(Q*ue/2),i.save(),i.translate(0,-Q*I),u?be(i,S[zt],0,{fontSize:v,color:r.fill||"#000000"}):(Xt&&i.strokeText(S[zt],0,0),i.fillText(S[zt],0,0)),Ot){const Zt=A[zt];i.strokeStyle=Ht,i.lineWidth=$t,i.setLineDash&&i.setLineDash([]),Mt.underline&&(i.beginPath(),i.moveTo(-Zt/2,v/2+2),i.lineTo(Zt/2,v/2+2),i.stroke()),Mt.overline&&(i.beginPath(),i.moveTo(-Zt/2,-(v/2+2)),i.lineTo(Zt/2,-(v/2+2)),i.stroke()),Mt.strike&&(i.beginPath(),i.moveTo(-Zt/2,0),i.lineTo(Zt/2,0),i.stroke())}i.restore(),i.rotate(Q*ue/2)}i.restore(),i.textAlign=ge,i.textBaseline=Qt},ji=(i,e)=>{i.save();let r=e.text||"Text";if(e.textTransform)switch(e.textTransform){case"uppercase":r=r.toUpperCase();break;case"lowercase":r=r.toLowerCase();break;case"capitalize":r=r.replace(/\b\w/g,C=>C.toUpperCase());break}i.font=`${e.fontStyle||"normal"} ${e.fontWeight||"normal"} ${e.fontSize||20}px ${e.fontFamily||"Arial"}`,i.letterSpacing=`${e.letterSpacing||0}px`,i.fillStyle=e.fill||"#000000",i.textAlign=e.textAlign||"left",i.textBaseline="top",e.opacity!==void 0&&(i.globalAlpha=e.opacity),e.stroke&&e.strokeWidth>0&&(i.strokeStyle=e.stroke,i.lineWidth=e.strokeWidth);const h=r.split(`
55
- `),u=(e.fontSize||20)*(e.lineHeight||1.2),S=Math.max(...h.map(C=>i.measureText(C).width)),v=h.length*u;if(e.backgroundColor&&e.backgroundColor!=="transparent"){i.fillStyle=e.backgroundColor;const C=e.backgroundPadding||4;i.fillRect(-C,-C,S+C*2,v+C*2),i.fillStyle=e.fill||"#000000"}(e.hasTextShadow||e.textShadowColor)&&(i.shadowColor=e.textShadowColor||"rgba(0,0,0,0.5)",i.shadowBlur=e.textShadowBlur!=null?e.textShadowBlur:4,i.shadowOffsetX=e.textShadowX!=null?e.textShadowX:2,i.shadowOffsetY=e.textShadowY!=null?e.textShadowY:2);const A=Re(d)&&e.type==="text"&&!e.isIcon;if(e.curve&&Math.abs(e.curve)>=1){Fi(i,h.join(" "),e,S,A),i.restore();return}h.forEach((C,L)=>{const I=L*u,Q=i.measureText(C).width;A?be(i,C,I,{fontSize:e.fontSize||20,color:e.fill||"#000000"}):(e.stroke&&e.strokeWidth>0&&i.strokeText(C,0,I),i.fillText(C,0,I));const lt=e.fontSize||20,mt=e.decorationColor||e.fill||"#000000",Xt=Math.max(1,lt/20);if(i.strokeStyle=mt,i.lineWidth=Xt,e.textDecoration==="underline"||e.underline){const gt=I+lt+2;i.beginPath(),i.moveTo(0,gt),i.lineTo(Q,gt),i.stroke()}if(e.textDecoration==="overline"||e.overline){const gt=I-2;i.beginPath(),i.moveTo(0,gt),i.lineTo(Q,gt),i.stroke()}if(e.textDecoration==="line-through"||e.strikethrough){const gt=I+lt/2;i.beginPath(),i.moveTo(0,gt),i.lineTo(Q,gt),i.stroke()}typeof e.textDecoration=="string"&&e.textDecoration.includes(" ")&&e.textDecoration.split(" ").forEach(Mt=>{switch(Mt.trim()){case"underline":const Ot=I+lt+2;i.beginPath(),i.moveTo(0,Ot),i.lineTo(Q,Ot),i.stroke();break;case"overline":const Ht=I-2;i.beginPath(),i.moveTo(0,Ht),i.lineTo(Q,Ht),i.stroke();break;case"line-through":const $t=I+lt/2;i.beginPath(),i.moveTo(0,$t),i.lineTo(Q,$t),i.stroke();break}})}),i.restore()},Ni=(i,e)=>{e.fill&&e.fill!=="transparent"&&(i.fillStyle=e.fill,i.fillRect(0,0,e.width,e.height)),e.stroke&&e.strokeWidth>0&&(i.strokeStyle=e.stroke,i.lineWidth=e.strokeWidth,i.strokeRect(0,0,e.width,e.height))},zi=(i,e)=>{const r=Math.min(e.width,e.height)/2,h=e.width/2,u=e.height/2;i.beginPath(),i.arc(h,u,r,0,2*Math.PI),e.fill&&e.fill!=="transparent"&&(i.fillStyle=e.fill,i.fill()),e.stroke&&e.strokeWidth>0&&(i.strokeStyle=e.stroke,i.lineWidth=e.strokeWidth,i.stroke())},Ai=(i,e)=>{const r=e.width/2;e.height/2,i.beginPath(),i.moveTo(r,0),i.lineTo(0,e.height),i.lineTo(e.width,e.height),i.closePath(),e.fill&&e.fill!=="transparent"&&(i.fillStyle=e.fill,i.fill()),e.stroke&&e.strokeWidth>0&&(i.strokeStyle=e.stroke,i.lineWidth=e.strokeWidth,i.stroke())},Ti=(i,e)=>{const r=e.width/2,h=e.height/2,u=Math.min(e.width,e.height)/2,S=u*.4,v=e.numPoints||5;i.beginPath();for(let A=0;A<v*2;A++){const C=A%2===0?u:S,L=A*Math.PI/v,I=r+Math.cos(L)*C,Q=h+Math.sin(L)*C;A===0?i.moveTo(I,Q):i.lineTo(I,Q)}i.closePath(),e.fill&&e.fill!=="transparent"&&(i.fillStyle=e.fill,i.fill()),e.stroke&&e.strokeWidth>0&&(i.strokeStyle=e.stroke,i.lineWidth=e.strokeWidth,i.stroke())},Mi=(i,e)=>{const r=e.width,h=e.height,u=r*.3;i.beginPath(),i.moveTo(r/2,0),i.lineTo(r,h*.6),i.lineTo(r-u,h*.6),i.lineTo(r-u,h),i.lineTo(u,h),i.lineTo(u,h*.6),i.lineTo(0,h*.6),i.closePath(),e.fill&&e.fill!=="transparent"&&(i.fillStyle=e.fill,i.fill()),e.stroke&&e.strokeWidth>0&&(i.strokeStyle=e.stroke,i.lineWidth=e.strokeWidth,i.stroke())},Ei=(i,e)=>{const r=e.width/2,h=e.height/2;i.beginPath(),i.moveTo(r,0),i.lineTo(e.width,h),i.lineTo(r,e.height),i.lineTo(0,h),i.closePath(),e.fill&&e.fill!=="transparent"&&(i.fillStyle=e.fill,i.fill()),e.stroke&&e.strokeWidth>0&&(i.strokeStyle=e.stroke,i.lineWidth=e.strokeWidth,i.stroke())},Di=(i,e)=>{const r=e.width/2,h=e.height/2,u=Math.min(e.width,e.height)/2,S=6;i.beginPath();for(let v=0;v<S;v++){const A=v*2*Math.PI/S-Math.PI/2,C=r+u*Math.cos(A),L=h+u*Math.sin(A);v===0?i.moveTo(C,L):i.lineTo(C,L)}i.closePath(),e.fill&&e.fill!=="transparent"&&(i.fillStyle=e.fill,i.fill()),e.stroke&&e.strokeWidth>0&&(i.strokeStyle=e.stroke,i.lineWidth=e.strokeWidth,i.stroke())},Ii=(i,e)=>{const r=e.width/2,h=e.height/2,u=Math.min(e.width,e.height)/2,S=5;i.beginPath();for(let v=0;v<S;v++){const A=v*2*Math.PI/S-Math.PI/2,C=r+u*Math.cos(A),L=h+u*Math.sin(A);v===0?i.moveTo(C,L):i.lineTo(C,L)}i.closePath(),e.fill&&e.fill!=="transparent"&&(i.fillStyle=e.fill,i.fill()),e.stroke&&e.strokeWidth>0&&(i.strokeStyle=e.stroke,i.lineWidth=e.strokeWidth,i.stroke())},Li=(i,e)=>{const r=e.width,h=e.height,u=0,S=0;i.beginPath();const v=h*.3;i.moveTo(u+r/2,S+v),i.bezierCurveTo(u+r/2,S,u,S,u,S+v),i.bezierCurveTo(u,S+(h+v)/2,u+r/2,S+(h+v)/2,u+r/2,S+h),i.bezierCurveTo(u+r/2,S+(h+v)/2,u+r,S+(h+v)/2,u+r,S+v),i.bezierCurveTo(u+r,S,u+r/2,S,u+r/2,S+v),i.closePath(),e.fill&&e.fill!=="transparent"&&(i.fillStyle=e.fill,i.fill()),e.stroke&&e.strokeWidth>0&&(i.strokeStyle=e.stroke,i.lineWidth=e.strokeWidth,i.stroke())},Ri=(i,e)=>{const r=e.width/2,h=e.height/2,u=e.width/2,S=e.height/2;i.beginPath(),i.ellipse(r,h,u,S,0,0,2*Math.PI),e.fill&&e.fill!=="transparent"&&(i.fillStyle=e.fill,i.fill()),e.stroke&&e.strokeWidth>0&&(i.strokeStyle=e.stroke,i.lineWidth=e.strokeWidth,i.stroke())},Wi=(i,e)=>{const r=Math.min(e.width,e.height)*.1;le(i,0,0,e.width,e.height,r),e.fill&&e.fill!=="transparent"&&(i.fillStyle=e.fill,i.fill()),e.stroke&&e.strokeWidth>0&&(i.strokeStyle=e.stroke,i.lineWidth=e.strokeWidth,i.stroke())},Bi=(i,e)=>{i.save(),e.opacity!==void 0&&(i.globalAlpha=e.opacity),i.strokeStyle=e.stroke||e.fill||"#000000",i.lineWidth=e.strokeWidth||e.height||2,i.lineCap="round",i.beginPath(),i.moveTo(0,e.height/2),i.lineTo(e.width,e.height/2),i.stroke(),i.restore()},Pi=(i,e)=>{const r=e.src||e.imageData;if(r)try{if(r instanceof HTMLImageElement){if(r.complete&&r.naturalWidth>0&&r.naturalHeight>0){i.drawImage(r,0,0,e.width,e.height);return}}else if(typeof r=="string"&&r.length>0){if(e._imageElement||(e._imageElement=new Image,e._imageElement.crossOrigin="anonymous",e._imageElement.onload=()=>{at()},e._imageElement.onerror=()=>{console.error("Failed to load image:",r),e._imageLoadError=!0,at()},e._imageElement.src=r),e._imageElement.complete&&e._imageElement.naturalWidth>0&&e._imageElement.naturalHeight>0){i.drawImage(e._imageElement,0,0,e.width,e.height);return}if(e._imageLoadError){i.fillStyle="#ffebee",i.fillRect(0,0,e.width,e.height),i.strokeStyle="#f44336",i.lineWidth=2,i.strokeRect(0,0,e.width,e.height),i.fillStyle="#f44336",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Error loading image",e.width/2,e.height/2);return}}i.fillStyle="#f0f0f0",i.fillRect(0,0,e.width,e.height),i.strokeStyle="#ccc",i.lineWidth=1,i.strokeRect(0,0,e.width,e.height),i.fillStyle="#666",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Your customization",e.width/2,e.height/2)}catch(h){console.error("Error drawing image:",h),i.fillStyle="#ffebee",i.fillRect(0,0,e.width,e.height),i.strokeStyle="#f44336",i.lineWidth=2,i.strokeRect(0,0,e.width,e.height),i.fillStyle="#f44336",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Error loading image",e.width/2,e.height/2)}else i.fillStyle="#f8f8f8",i.fillRect(0,0,e.width,e.height),i.strokeStyle="#ddd",i.lineWidth=1,i.strokeRect(0,0,e.width,e.height),i.fillStyle="#999",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("No Image",e.width/2,e.height/2)},Oi=(i,e)=>{const r=e.src;if(r)try{if(r instanceof HTMLImageElement){if(r.complete&&r.naturalWidth>0&&r.naturalHeight>0){i.drawImage(r,0,0,e.width,e.height);return}}else if(typeof r=="string"&&r.length>0){if(e._stickerElement||(e._stickerElement=new Image,e._stickerElement.crossOrigin="anonymous",e._stickerElement.onload=()=>{at()},e._stickerElement.onerror=()=>{console.error("Failed to load sticker:",r),e._stickerLoadError=!0,at()},e._stickerElement.src=r),e._stickerElement.complete&&e._stickerElement.naturalWidth>0&&e._stickerElement.naturalHeight>0){i.drawImage(e._stickerElement,0,0,e.width,e.height);return}if(e._stickerLoadError){ce(i,e,"Failed to load",!0);return}}ce(i,e,"Your customization")}catch(h){console.error("Error drawing sticker:",h),ce(i,e,"Error",!0)}else ce(i,e,"No Sticker")},ce=(i,e,r,h=!1)=>{i.fillStyle=h?"#ffebee":"#f8f9fa",i.fillRect(0,0,e.width,e.height),i.strokeStyle=h?"#f44336":"#dee2e6",i.lineWidth=2,i.strokeRect(0,0,e.width,e.height),i.fillStyle=h?"#f44336":"#6c757d",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText(r,e.width/2,e.height/2)},Hi=(i,e)=>{if(e.imageObject&&e.imageObject.complete&&e.imageObject.naturalHeight!==0)try{i.drawImage(e.imageObject,0,0,e.width,e.height)}catch(r){console.error("Error drawing embroidery image:",r),ie(i,e,"Error loading image")}else if(e.src&&!e.imageLoading){e.imageLoading=!0;const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{r.complete&&r.naturalHeight!==0?(e.imageObject=r,e.imageLoading=!1,at()):(e.imageLoading=!1,console.error("Image loaded but is invalid:",e.src))},r.onerror=()=>{e.imageLoading=!1,console.error("Failed to load embroidery image:",e.src),ie(i,e,"Failed to load")},r.src=e.src,ie(i,e,"Your customization")}else e.imageLoading?ie(i,e,"Your customization"):ie(i,e)},ie=(i,e,r="Embroidery")=>{i.fillStyle="#f9f9f9",i.fillRect(0,0,e.width,e.height),i.strokeStyle="#ddd",i.lineWidth=2,i.strokeRect(0,0,e.width,e.height),i.fillStyle="#999",i.font="24px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("🧵",e.width/2,e.height/2-10),i.fillStyle="#666",i.font="12px Arial",i.fillText(r,e.width/2,e.height/2+15)},Ye=(i,e,r)=>{if(!r)return!1;const h=r.x+r.width/2,u=r.y+r.height/2,S=i-h,v=e-u,A=-(r.rotation||0)*Math.PI/180,C=Math.cos(A),L=Math.sin(A),I=S*C-v*L,Q=S*L+v*C,lt=r.width/2,mt=r.height/2;return I>=-lt&&I<=lt&&Q>=-mt&&Q<=mt},$i=f.useCallback(()=>{(E||K||st)&&ut(),tt(!1),it(!1),yt(!1),H(null);const i=kt.current;i&&(i.style.cursor="default")},[E,K,st,ut]);f.useEffect(()=>{const i=e=>{if(n)return;const r=document.activeElement;if(!(r&&(r.tagName==="INPUT"||r.tagName==="TEXTAREA"||r.tagName==="SELECT"||r.isContentEditable))&&((e.ctrlKey||e.metaKey)&&(e.key==="z"&&!e.shiftKey?(e.preventDefault(),ee()):(e.key==="z"&&e.shiftKey||e.key==="y")&&(e.preventDefault(),Yt())),(e.key==="Delete"||e.key==="Backspace")&&g&&(he(g.id),e.preventDefault()),(e.ctrlKey||e.metaKey)&&e.key==="d"&&g&&(Fe(g.id),e.preventDefault()),g&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key))){e.preventDefault();const u=e.shiftKey?10:1;let S={};switch(e.key){case"ArrowUp":S.y=g.y-u;break;case"ArrowDown":S.y=g.y+u;break;case"ArrowLeft":S.x=g.x-u;break;case"ArrowRight":S.x=g.x+u;break}de(g.id,S),ut()}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[g,ee,Yt,n]);const qe=(i,e={})=>{const r={id:St(),type:i,x:50,y:50,width:100,height:100,fill:"#000000",stroke:"#000000",strokeWidth:0,rotation:0,...e};switch(i){case"text":r.id=St(),r.text=e.text||"New Text",r.fontSize=e.fontSize||20,r.fontFamily=e.fontFamily||"Arial",r.fontWeight=e.fontWeight||"normal",r.fontStyle=e.fontStyle||"normal",r.textAlign=e.textAlign||"left",r.width=e.width||150,r.height=e.height||50;break;case"icon":r.id=St(),r.text=e.text||"🎯",r.fontSize=e.fontSize||48,r.fontFamily=e.fontFamily||"Arial",r.fontWeight=e.fontWeight||"normal",r.fontStyle=e.fontStyle||"normal",r.textAlign="center",r.width=80,r.height=80,r.iconData=e.iconData||null,r.type="text",r.isIcon=!0;break;case"image":r.id=St(),r.imageData=e.imageData||null,r.width=e.width||200,r.height=e.height||200;break;case"qrcode":r.id=St(),r.type="qrcode",r.x=(e==null?void 0:e.x)||W/2-((e==null?void 0:e.width)||100)/2,r.y=(e==null?void 0:e.y)||B/2-((e==null?void 0:e.height)||100)/2,r.width=(e==null?void 0:e.width)||100,r.height=(e==null?void 0:e.height)||100,r.src=(e==null?void 0:e.src)||"",r.data=(e==null?void 0:e.data)||"",r.rotation=0,r.opacity=1;break;case"barcode":r.id=St(),r.type="barcode",r.x=(e==null?void 0:e.x)||W/2-((e==null?void 0:e.width)||200)/2,r.y=(e==null?void 0:e.y)||B/2-((e==null?void 0:e.height)||100)/2,r.width=(e==null?void 0:e.width)||200,r.height=(e==null?void 0:e.height)||100,r.src=(e==null?void 0:e.src)||"",r.data=(e==null?void 0:e.data)||"",r.format=(e==null?void 0:e.format)||"CODE128",r.rotation=0,r.opacity=1,r.imageObject=(e==null?void 0:e.imageObject)||null;break;case"sticker":r.id=St(),r.type="sticker",r.imageData=(e==null?void 0:e.imageData)||null,r.width=e.width||200,r.height=e.height||200;break;case"horizontalLine":r.id=St(),r.type="horizontalLine",r.x=W/2-100,r.y=B/2-1,r.width=200,r.height=2,r.fill="#000000",r.stroke="#000000",r.strokeWidth=2,r.rotation=0,r.opacity=1;break;case"embroidery":r.id=St(),r.type="embroidery",r.imageData=(e==null?void 0:e.imageData)||null,r.width=e.width||200,r.height=e.height||200;break;case"rectangle":case"circle":case"triangle":case"star":case"arrow":case"diamond":case"hexagon":case"pentagon":case"heart":case"oval":case"roundedRectangle":break;default:console.warn(`Unknown element type: ${i}`);return}T(h=>[...h,r]),q(r),ut()},de=(i,e)=>{T(r=>r.map(h=>h.id===i?{...h,...e}:h)),g&&g.id===i&&q(r=>({...r,...e}))},Xe=async i=>{var S,v,A;if(!i||typeof R!="function")return;const e=i.src||i.image||(i.imageData instanceof HTMLImageElement?i.imageData.src:i.imageData)||((S=i._imageElement)==null?void 0:S.src)||((v=i._stickerElement)==null?void 0:v.src)||((A=i._embroideryElement)==null?void 0:A.src);if(!e)throw new Error("No image to process");const r=await R(e),h=typeof r=="string"?r:URL.createObjectURL(r),u=new Image;u.crossOrigin="anonymous",await new Promise((C,L)=>{u.onload=C,u.onerror=()=>L(new Error("Processed image failed to load")),u.src=h}),de(i.id,{src:h,image:h,imageData:h,_imageElement:null,_stickerElement:null,_embroideryElement:null,_imageLoadError:!1,originalWidth:u.naturalWidth,originalHeight:u.naturalHeight,bgRemoved:!0}),ut(),at()},he=f.useCallback(()=>{g&&(T(i=>i.filter(e=>e.id!==g.id)),q(null),ut())},[g,ut]),Fe=i=>{const e=p.find(r=>r.id===i);if(e){const r={...e,id:St(),x:e.x+20,y:e.y+20};T(h=>[...h,r]),q(r),ut()}},Qe=i=>{if(!g)return;const e={width:Math.max(10,(g.width||0)*i),height:Math.max(10,(g.height||0)*i)};(g.type==="text"||g.isIcon)&&(e.fontSize=Math.max(6,Math.round((g.fontSize||20)*i))),de(g.id,e),ut()},fe=(i,e)=>{const r=p.findIndex(S=>S.id===i);if(r===-1)return;const h=[...p],u=h[r];e==="up"&&r<h.length-1?(h[r]=h[r+1],h[r+1]=u):e==="down"&&r>0?(h[r]=h[r-1],h[r-1]=u):e==="top"?(h.splice(r,1),h.push(u)):e==="bottom"&&(h.splice(r,1),h.unshift(u)),T(h),ut()};f.useCallback(()=>{V&&Vt(i=>({...i,[V.sectionName]:{elements:[...p],selectedColor:b}}))},[V,p,b]);const[,Gi]=f.useReducer(i=>i+1,0);setTimeout(()=>{Gi()},20);const Vi=f.useCallback(()=>{V&&Vt(i=>({...i,[V.sectionName]:{elements:[...p],selectedColor:b}}))},[V,p,b]);f.useImperativeHandle(a,()=>({handleSectionChange:Je,flushCurrentSectionDesign:Vi,addImageFromUrl:(i,e={})=>{if(!i)return;const r=e.width||220,h=e.height||220;qe("image",{imageData:i,src:i,width:r,height:h,x:Math.max(0,(W-r)/2),y:Math.max(0,(B-h)/2)})},exportPrintReady:async(i="png")=>await ke(i,!1),exportFullDesign:async(i="png")=>await ke(i,!0),exportDesign:ke,getCanvasData:()=>te(),exportAllDesignsAsJSON:async(i="png")=>{try{const e=te(),r=(V==null?void 0:V.sectionName)||"main",h={elements:e.elements,selectedColor:e.selectedColor,canvasWidth:e.canvasWidth,canvasHeight:e.canvasHeight},u={...e.sectionDesigns||{},[r]:h},S=d.sections&&d.sections.length>0?d.sections:[{id:r,sectionName:r,image:V==null?void 0:V.sectionImage,sectionImage:V==null?void 0:V.sectionImage}];return await et.current.exportAllSectionsAsJSON(u,S,W,B,i,Nt,Wt)}catch(e){throw console.error("Export as JSON failed:",e),e}},exportCurrentSectionAsJSON:async(i="png")=>{try{const e=te();return await et.current.exportCurrentSectionAsJSON(e,i,Nt,Wt)}catch(e){throw console.error("Export current section as JSON failed:",e),e}}}));const Tt=f.useRef(null),je=f.useRef(!1),at=f.useCallback(()=>{const i=kt.current;if(!i||je.current)return;je.current=!0;const e=i.getContext("2d");e.clearRect(0,0,W,B),Lt.current&&e.drawImage(Lt.current,0,0,W,B),Y&&vi(e),p.forEach(r=>{e.save(),e.globalAlpha=r.opacity||1,wi(e,r),e.restore()}),g&&bi(e,g),je.current=!1},[p,g,W,B,Y]),Ne=f.useRef(at);f.useEffect(()=>{Ne.current=at},[at]);const Ze=f.useRef(!1);f.useEffect(()=>{Ze.current=E||K||st},[E,K,st]);const qt=f.useCallback(()=>{Tt.current&&cancelAnimationFrame(Tt.current),Tt.current=requestAnimationFrame(()=>{Ne.current(),Tt.current=null})},[]);f.useEffect(()=>{et.current&&(et.current.embroidery=Re(d))},[d]),f.useEffect(()=>{const i=(p||[]).filter(r=>r&&r.type==="text"&&r.fontFamily).map(r=>r.fontFamily);if(i.length===0)return;let e=!1;return $e(i).then(()=>{e||at()}),()=>{e=!0}},[p,at]),f.useEffect(()=>{qt()},[p,g,W,B,Y,qt]),f.useEffect(()=>{Lt.current&&qt()},[Lt.current,qt]),f.useEffect(()=>()=>{Tt.current&&cancelAnimationFrame(Tt.current)},[]);const ze=f.useCallback(()=>{Ne.current(),Ze.current&&(Tt.current=requestAnimationFrame(ze))},[]);f.useEffect(()=>{E||K||st?ze():(Tt.current&&(cancelAnimationFrame(Tt.current),Tt.current=null),qt())},[E,K,st,ze,qt]);const _i=f.useCallback(i=>{if(n)return;const r=kt.current.getBoundingClientRect(),h=(i.clientX-r.left)/P,u=(i.clientY-r.top)/P;if(U({x:h,y:u}),g){const v=Ue(h,u,g);if(v){if(v==="rotate"){yt(!0);const A=g.x+g.width/2,C=g.y+g.height/2,L=Math.atan2(u-C,h-A)*180/Math.PI;U({x:h,y:u,initialAngle:L,initialRotation:g.rotation||0})}else it(!0),H(v),U({x:h,y:u,initialWidth:g.width,initialHeight:g.height,initialX:g.x,initialY:g.y});return}}let S=null;for(let v=p.length-1;v>=0;v--)if(Ye(h,u,p[v])){S=p[v];break}S?(q(S),tt(!0),U({x:h,y:u,offsetX:h-S.x,offsetY:u-S.y})):q(null),at()},[n,P,g,p,at]),Ui=f.useCallback(i=>{if(n)return;const e=kt.current,r=e.getBoundingClientRect(),h=(i.clientX-r.left)/P,u=(i.clientY-r.top)/P;if(g&&!E&&!K&&!st){const S=Ue(h,u,g);S?S==="rotate"?e.style.cursor="grab":e.style.cursor=S:Ye(h,u,g)?e.style.cursor="move":e.style.cursor="default"}else e.style.cursor=E?"grabbing":"default";if(st&&g){const S=g.x+g.width/2,v=g.y+g.height/2,C=Math.atan2(u-v,h-S)*180/Math.PI-$.initialAngle;let L=$.initialRotation+C;i.shiftKey&&(L=Math.round(L/15)*15),L=(L%360+360)%360,T(I=>I.map(Q=>Q.id===g.id?{...Q,rotation:L}:Q)),q(I=>({...I,rotation:L})),at();return}if(K&&g&&k){const S=h-$.x,v=u-$.y;let A=$.initialWidth,C=$.initialHeight,L=$.initialX,I=$.initialY;switch(k){case"se-resize":A=Math.max(20,$.initialWidth+S),C=Math.max(20,$.initialHeight+v);break;case"sw-resize":A=Math.max(20,$.initialWidth-S),C=Math.max(20,$.initialHeight+v),L=$.initialX+($.initialWidth-A);break;case"ne-resize":A=Math.max(20,$.initialWidth+S),C=Math.max(20,$.initialHeight-v),I=$.initialY+($.initialHeight-C);break;case"nw-resize":A=Math.max(20,$.initialWidth-S),C=Math.max(20,$.initialHeight-v),L=$.initialX+($.initialWidth-A),I=$.initialY+($.initialHeight-C);break}if(i.shiftKey&&g.type!=="text"){const lt=$.initialWidth/$.initialHeight;k.includes("e"),C=A/lt,k.includes("n")&&(I=$.initialY+($.initialHeight-C))}ft&&(L=Rt(L),I=Rt(I),A=Rt(A),C=Rt(C));const Q={...g,x:L,y:I,width:A,height:C};T(lt=>lt.map(mt=>mt.id===g.id?Q:mt)),q(Q),at();return}if(E&&g){let S=h-$.offsetX,v=u-$.offsetY;ft&&(S=Rt(S),v=Rt(v)),S=Math.max(0,Math.min(W-g.width,S)),v=Math.max(0,Math.min(B-g.height,v));const A={...g,x:S,y:v};T(C=>C.map(L=>L.id===g.id?A:L)),q(A),at()}},[n,P,g,E,K,st,k,$,ft,W,B,p,at]),Je=f.useCallback(i=>{V&&Vt(r=>({...r,[V.sectionName]:{elements:p.map(h=>h.type==="image"?{...h,imageData:h.imageData,src:h.src}:h),selectedColor:b}}));const e=It[i.sectionName];if(e){const r=e.elements.map(h=>{if(h.type==="image"&&h.src&&!h.imageData){const u=new Image;return u.onload=()=>{T(S=>S.map(v=>v.id===h.id?{...v,imageData:u}:v)),at()},u.src=h.src,{...h,imageData:u}}return h});T(r),D(e.selectedColor||b)}else T([]);Pt(i),q(null)},[V,p,b,It,at]),Yi=f.useCallback(i=>{if(i&&i.type.startsWith("image/")){const e=new FileReader;e.onload=r=>{const h=new Image;h.onload=()=>{const u={id:St(),type:"image",x:Rt(W/2-100),y:Rt(B/2-100),width:Math.min(h.width,200),height:Math.min(h.height,200),rotation:0,imageData:h,src:r.target.result,originalWidth:h.width,originalHeight:h.height},S=h.width/h.height;u.width/u.height!==S&&(u.width/S<=200?u.height=u.width/S:u.width=u.height*S),T(v=>[...v,u]),q(u),ut()},h.onerror=()=>{console.error("Failed to load uploaded image"),alert("Failed to load the uploaded image. Please try again.")},h.src=r.target.result},e.onerror=()=>{console.error("Failed to read file"),alert("Failed to read the file. Please try again.")},e.readAsDataURL(i)}else alert("Please select a valid image file.")},[W,B,Rt,St,ut]),Ke=f.useCallback(Ra(()=>{at()},16),[at]);f.useEffect(()=>{_.current||Ke()},[p,g,Y,Ke]),f.useEffect(()=>{at()},[at]);const ti=i=>{if(!nt)return{horizontal:[],vertical:[]};const e=document.querySelector(".ruler-horizontal"),r=document.querySelector(".ruler-vertical");if(!e||!r)return{horizontal:[],vertical:[]};const h=e.getBoundingClientRect(),u=r.getBoundingClientRect(),S=h.width,v=u.height,A=50,C=[],L=[];for(let I=A;I<=S;I+=A)I<=S-20&&C.push({position:I,value:Math.round(I/i)});for(let I=A;I<=v;I+=A)I<=v-15&&L.push({position:I,value:Math.round(I/i)});return{horizontal:C,vertical:L}},[ei,ii]=f.useState({horizontal:[],vertical:[]});f.useEffect(()=>{const i=()=>{setTimeout(()=>{const h=ti(P);ii(h)},50)};i();let e;const r=()=>{clearTimeout(e),e=setTimeout(i,150)};return window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r),clearTimeout(e)}},[P,nt]),f.useEffect(()=>{if(nt&&!Dt){const i=setTimeout(()=>{const e=ti(P);ii(e)},100);return()=>clearTimeout(i)}},[nt,Dt,P]);const Ae=Re(d),ai=Ae?Ia(p):[];return t.jsxs("div",{className:"pure-canvas-designer",children:[t.jsx("div",{className:"designer-header",children:t.jsx(ba,{onAddElement:qe,onDeleteElement:()=>g&&he(g.id),onDuplicateElement:()=>g&&Fe(g.id),onUndo:ee,onRedo:Yt,onToggleGrid:()=>ot(!Y),onToggleRulers:()=>ht(!nt),onToggleSnap:()=>vt(!ft),onTogglePrintGuides:()=>Bt(i=>!i),onImageUpload:Yi,canUndo:pt>0,canRedo:pt<wt.length-1,showGrid:Y,showRulers:nt,snapToGrid:ft,showPrintGuides:Et,selectedElement:g,theme:o,readOnly:n,mode:l,productionMethods:d==null?void 0:d.productionMethods,supportsEmbroidery:d==null?void 0:d.supportsEmbroidery,apiKey:s.apiKey,apiEndpoint:s.apiEndpoint,aiEnabled:w,aiEndpoint:j,onAIImageGenerate:m,isAuthenticated:M,onRequireAuth:z})}),Ae&&!dt&&t.jsxs("div",{role:"note",style:{display:"flex",gap:10,alignItems:"flex-start",margin:"8px 12px",padding:"10px 12px",background:"#fff7ed",border:"1px solid #fed7aa",borderRadius:8,color:"#7c2d12",fontSize:13,lineHeight:1.4},children:[t.jsx("span",{style:{fontSize:16,lineHeight:1},children:"🧵"}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("strong",{children:"Embroidery preview"})," — this is how your design will be stitched. Colours are matched to real thread.",ai.length>0&&t.jsx("ul",{style:{margin:"6px 0 0",paddingLeft:18},children:ai.map((i,e)=>t.jsx("li",{children:i},e))})]}),t.jsx("button",{type:"button",onClick:()=>At(!0),"aria-label":"Dismiss",style:{background:"none",border:"none",cursor:"pointer",fontSize:18,color:"#9a3412",lineHeight:1},children:"×"})]}),t.jsxs("div",{className:"designer-content",children:[nt&&!Dt&&t.jsxs("div",{className:"rulers",children:[t.jsx("div",{className:"ruler-horizontal",children:t.jsx("div",{className:"ruler-horizontal-numbers",children:ei.horizontal.map((i,e)=>t.jsx("span",{className:"ruler-number horizontal",style:{left:`${i.position}px`},children:i.value},e))})}),t.jsx("div",{className:"ruler-vertical",children:t.jsx("div",{className:"ruler-vertical-numbers",children:ei.vertical.map((i,e)=>t.jsx("span",{className:"ruler-number vertical",style:{top:`${i.position}px`},children:i.value},e))})})]}),t.jsxs("div",{className:"canvas-container",ref:we,children:[Dt&&t.jsx("button",{type:"button",className:"mobile-panel-toggle","aria-label":"Open tools & properties",title:"Tools & properties",onClick:()=>Kt(i=>!i),style:{position:"absolute",top:8,right:8,zIndex:40,width:42,height:42,borderRadius:10,border:"1px solid #e2e8f0",background:"#ffffff",boxShadow:"0 2px 10px rgba(0,0,0,0.18)",fontSize:20,lineHeight:1,color:"#334155",cursor:"pointer"},children:"☰"}),t.jsxs("div",{className:"canvas-stage",style:{position:"relative",width:W,height:B,transform:`scale(${P})`,transformOrigin:"top left"},children:[t.jsx("canvas",{ref:kt,width:W,height:B,onMouseDown:_i,onMouseMove:Ui,onMouseUp:$i,style:{display:"block",border:"1px solid #e2e8f0",cursor:E?"grabbing":"default"}}),Et&&t.jsxs("div",{className:"print-guides-overlay","aria-hidden":"true",style:{position:"absolute",top:0,left:0,width:W,height:B,pointerEvents:"none"},children:[t.jsx("div",{style:{position:"absolute",inset:0,border:"1px solid rgba(37, 99, 235, 0.55)"}}),t.jsx("div",{style:{position:"absolute",top:`${jt.safeAreaPct}%`,left:`${jt.safeAreaPct}%`,right:`${jt.safeAreaPct}%`,bottom:`${jt.safeAreaPct}%`,border:"1px dashed rgba(37, 99, 235, 0.9)"},children:t.jsx("span",{style:{position:"absolute",top:2,left:4,fontSize:10,lineHeight:1.4,color:"rgba(37, 99, 235, 0.9)",background:"rgba(255,255,255,0.6)",padding:"0 3px",borderRadius:2,userSelect:"none"},children:"Safe area"})})]}),g&&!n&&(()=>{const i=kt.current&&kt.current.getContext("2d"),e=i?Ce(i,g):{cx:g.x+(g.width||0)/2,y:g.y},r=e.cx,h=e.y,u=["image","sticker","embroidery"].includes(g.type),S={width:30,height:30,border:"none",background:"transparent",borderRadius:6,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0};return t.jsx("div",{style:{position:"absolute",left:r,top:h,pointerEvents:"none",zIndex:30},children:t.jsxs("div",{className:"element-action-toolbar",onMouseDown:v=>v.stopPropagation(),style:{transform:`translate(-50%, calc(-100% - 12px)) scale(${1/(P||1)})`,transformOrigin:"bottom center",pointerEvents:"auto",display:"flex",alignItems:"center",gap:2,padding:"3px 4px",background:"#ffffff",border:"1px solid #e2e8f0",borderRadius:8,boxShadow:"0 4px 14px rgba(0,0,0,0.18)",whiteSpace:"nowrap"},children:[t.jsx("button",{style:S,title:"Shrink",onClick:v=>{v.stopPropagation(),Qe(.9)},children:t.jsx(J,{name:"minus",size:18,color:"#334155"})}),t.jsx("button",{style:S,title:"Enlarge",onClick:v=>{v.stopPropagation(),Qe(1.1)},children:t.jsx(J,{name:"plus",size:18,color:"#334155"})}),t.jsx("button",{style:S,title:"Duplicate",onClick:v=>{v.stopPropagation(),Fe(g.id)},children:t.jsx(J,{name:"duplicate",size:18,color:"#334155"})}),t.jsx("button",{style:S,title:"Bring to front",onClick:v=>{v.stopPropagation(),fe(g.id,"top")},children:t.jsx(J,{name:"arrowUp",size:18,color:"#334155"})}),t.jsx("button",{style:S,title:"Send to back",onClick:v=>{v.stopPropagation(),fe(g.id,"bottom")},children:t.jsx(J,{name:"arrowDown",size:18,color:"#334155"})}),u&&R&&t.jsx("button",{style:S,title:"Remove background",onClick:v=>{v.stopPropagation(),Xe(g).catch(()=>{})},children:t.jsx("span",{style:{fontSize:16,lineHeight:1},children:"✂️"})}),t.jsx("span",{style:{width:1,height:20,background:"#e2e8f0",margin:"0 2px"}}),t.jsx("button",{style:S,title:"Delete",onClick:v=>{v.stopPropagation(),he()},children:t.jsx(J,{name:"trash",size:18,color:"#dc2626"})})]})})})()]})]}),Dt&&re&&t.jsx("div",{className:"mobile-panel-backdrop",onClick:()=>Kt(!1),style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:999}}),t.jsxs("div",{className:`side-panels${Dt?" mobile":""}${re?" mobile-open":""}`,children:[Dt&&t.jsx("button",{type:"button",className:"mobile-panel-close","aria-label":"Close",onClick:()=>Kt(!1),style:{alignSelf:"flex-end",margin:8,width:32,height:32,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",fontSize:18,lineHeight:1,cursor:"pointer",color:"#334155"},children:"×"}),t.jsx(Aa,{selectedElement:g,onUpdate:de,onMoveLayer:fe,availableFonts:xi,theme:o,isEmbroidery:Ae,onFontLoaded:at,canvasWidth:W,printConfig:jt,onRemoveBackground:R?Xe:null}),l!=="customize"&&t.jsx(Ta,{elements:p,selectedElement:g,onSelectElement:q,onMoveLayer:fe,onDeleteElement:he,theme:o})]})]}),t.jsxs("div",{className:"designer-footer",children:[t.jsxs("div",{className:"section-thumbnails",children:[t.jsxs("label",{className:"section-thumbnails-label",children:["Available sections for : ",t.jsx("u",{children:d.name})]}),t.jsx("div",{className:"thumbnails-container",children:d.sections.map(i=>{const e=It[i.sectionName]&&It[i.sectionName].elements&&It[i.sectionName].elements.length>0;return t.jsxs("div",{className:`section-thumbnail compact ${V.sectionName===i.sectionName?"active":""}`,onClick:r=>{r.stopPropagation();const h=d.sections.find(u=>u.sectionName===i.sectionName);Je(h)},title:i.sectionName,children:[t.jsxs("div",{className:"thumbnail-image-container compact",children:[t.jsx("img",{src:i.sectionImage,alt:i.sectionName,className:"thumbnail-image compact",onError:r=>{r.target.style.display="none",r.target.nextSibling.style.display="flex"}}),t.jsx("div",{className:"thumbnail-placeholder compact",style:{display:"none"},children:t.jsx("span",{className:"placeholder-icon",children:"📐"})}),e&&t.jsx("div",{className:"content-indicator compact",children:t.jsx("svg",{className:"checkmark compact",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:t.jsx("path",{d:"M20 6L9 17l-5-5"})})})]}),t.jsx("span",{className:"thumbnail-label compact",children:i.sectionName})]},i.sectionName)})})]}),t.jsxs("div",{className:"zoom-controls-enhanced compact",children:[t.jsx("label",{className:"zoom-label",children:"Zoom:"}),t.jsxs("div",{className:"zoom-buttons-container compact",children:[t.jsx("button",{className:"zoom-button compact zoom-out",onClick:()=>ct(Math.max(.25,P-.25)),disabled:P<=.25,title:"Zoom Out",children:t.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("path",{d:"M21 21l-4.35-4.35"}),t.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),t.jsxs("div",{className:"zoom-display compact",children:[t.jsxs("span",{className:"zoom-percentage compact",children:[Math.round(P*100),"%"]}),t.jsx("div",{className:"zoom-slider-container compact",children:t.jsx("input",{type:"range",min:"0.25",max:"4",step:"0.25",value:P,onChange:i=>ct(parseFloat(i.target.value)),className:"zoom-slider compact"})})]}),t.jsx("button",{className:"zoom-button compact zoom-in",onClick:()=>ct(Math.min(4,P+.25)),disabled:P>=4,title:"Zoom In",children:t.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("path",{d:"M21 21l-4.35-4.35"}),t.jsx("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),t.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),t.jsx("button",{className:"zoom-reset compact",onClick:()=>ct(1),title:"Reset Zoom (100%)",children:t.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M3 3l18 18"}),t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("path",{d:"M21 21l-4.35-4.35"})]})})]})]})]})]})});yi.displayName="Mypixia";module.exports=yi;
52
+ </defs>`,Ve='fill="none" stroke="rgba(20,12,6,0.5)" stroke-width="1.3" stroke-dasharray="2.6 2" stroke-linecap="round"',U=(r,a,s,n,l="satin")=>`<circle cx="${r}" cy="${a}" r="${s}" fill="${n}"/><circle cx="${r}" cy="${a}" r="${s}" fill="url(#${l})"/><circle cx="${r}" cy="${a}" r="${s}" ${Ve}/>`,At=(r,a,s,n,l,h=0,f="satin")=>{const k=h?` transform="rotate(${h} ${r} ${a})"`:"";return`<ellipse cx="${r}" cy="${a}" rx="${s}" ry="${n}" fill="${l}"${k}/><ellipse cx="${r}" cy="${a}" rx="${s}" ry="${n}" fill="url(#${f})"${k}/><ellipse cx="${r}" cy="${a}" rx="${s}" ry="${n}" ${Ve}${k}/>`},Z=(r,a,s="satin")=>`<path d="${r}" fill="${a}"/><path d="${r}" fill="url(#${s})"/><path d="${r}" ${Ve}/>`,Rt=(r,a,s,n,l,h=2,f="satin")=>`<rect x="${r}" y="${a}" width="${s}" height="${n}" rx="${h}" fill="${l}"/><rect x="${r}" y="${a}" width="${s}" height="${n}" rx="${h}" fill="url(#${f})"/><rect x="${r}" y="${a}" width="${s}" height="${n}" rx="${h}" ${Ve}/>`,ct=(r,a,s=3)=>`<path d="${r}" fill="none" stroke="${a}" stroke-width="${s}" stroke-linecap="round"/><path d="${r}" fill="none" stroke="rgba(255,255,255,0.4)" stroke-width="${Math.max(.8,s*.35)}" stroke-linecap="round"/>`;let Ki=0;const tt=(r,a,s,n)=>{Ki+=1;const l=`<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 120 120">${ro}<g filter="url(#lift)"><g filter="url(#floss)" stroke-linejoin="round">${n}</g></g></svg>`;return{id:Ki,name:r,category:a,description:s,url:`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(l)}`}},hi=(r,a,s,n,l,h,f)=>[...Array(s)].map((k,C)=>{const E=360/s*C,N=E*Math.PI/180;return At(r+Math.cos(N)*n,a+Math.sin(N)*n,l,h,f,E)}).join(""),fi=(r,a,s,n,l,h,f=3)=>[...Array(s)].map((k,C)=>{const E=360/s*C*Math.PI/180;return ct(`M${r+Math.cos(E)*n} ${a+Math.sin(E)*n} L${r+Math.cos(E)*l} ${a+Math.sin(E)*l}`,h,f)}).join(""),so=[tt("Rose","Floral","Satin rose",At(60,58,26,26,"#e23b6d")+At(60,58,17,17,"#f06292",0,"satinV")+U(60,58,8,"#ad1457")+Z("M60 84 q4 16 -6 26","#2e7d32")),tt("Sunflower","Floral","Sunflower",hi(60,58,12,30,9,5,"#f4b400")+U(60,58,17,"#8d5524","satinV")),tt("Tulip","Floral","Tulip",Z("M60 28 q18 6 16 30 q-16 -10 -16 -10 q0 0 -16 10 q-2 -24 16 -30 Z","#e23b6d")+Z("M60 48 q8 4 7 20 q-7 -6 -7 -6 q0 0 -7 6 q-1 -16 7 -20 Z","#ad1457")+ct("M60 58 L60 96","#2e7d32",3)+Z("M60 78 q14 -6 20 4 q-14 8 -20 -4 Z","#43a047")),tt("Daisy","Floral","Daisy",hi(60,58,10,26,11,5,"#ffffff")+U(60,58,12,"#ffca28")),tt("Cherry Blossom","Floral","Cherry blossom",hi(60,60,5,18,11,9,"#f8bbd0")+U(60,60,7,"#fff176")+fi(60,60,5,6,16,"#fce4ec",1.4)),tt("Lavender","Floral","Lavender sprig",ct("M60 100 C58 70 62 50 60 26","#5e7d3a",3)+[...Array(7)].map((r,a)=>At(60+(a%2?6:-6),30+a*9,6,4,"#9575cd",a%2?25:-25)).join("")),tt("Pine Tree","Nature","Evergreen",Rt(56,86,8,16,"#795548")+Z("M60 20 L82 56 L38 56 Z","#2e7d32")+Z("M60 40 L88 82 L32 82 Z","#388e3c")),tt("Mountain","Nature","Mountain",Z("M16 92 L52 36 L72 66 L88 44 L104 92 Z","#6d8299")+Z("M52 36 L64 54 L40 54 Z","#ffffff")+U(92,30,9,"#ffd54f")),tt("Sun","Nature","Sunburst",fi(60,60,12,26,40,"#f9a825",3)+U(60,60,22,"#fbc02d")),tt("Leaf Sprig","Nature","Leaf sprig",ct("M60 96 C60 70 60 50 60 28","#2e7d32",3)+Z("M60 70 q-22 -6 -26 -22 q24 0 26 22 Z","#43a047")+Z("M60 52 q22 -6 26 -22 q-24 0 -26 22 Z","#66bb6a")+Z("M60 38 q-18 -6 -22 -20 q20 0 22 20 Z","#43a047")),tt("Cactus","Nature","Potted cactus",Z("M52 92 q-2 -34 8 -34 q10 0 8 34 Z","#2e7d32")+Z("M52 70 q-16 0 -16 -14 q0 -8 6 -8 q10 0 10 14 Z","#43a047")+Z("M68 64 q16 0 16 -14 q0 -8 -6 -8 q-10 0 -10 14 Z","#43a047")+Rt(46,92,28,16,"#c1502e",3)),tt("Mushroom","Nature","Toadstool",Z("M30 64 q0 -34 30 -34 q30 0 30 34 Z","#e53935")+Rt(50,64,20,34,"#fff8e1",6)+U(46,50,4,"#fff")+U(60,44,5,"#fff")+U(74,52,4,"#fff")),tt("Acorn","Nature","Acorn",Z("M40 56 q20 30 40 0 q-20 8 -40 0 Z","#a1683a")+Z("M38 56 q22 -20 44 0 q-22 8 -44 0 Z","#6d4c2f")+ct("M60 30 L60 38","#6d4c2f",3)),tt("Butterfly","Animals","Butterfly",At(44,50,16,13,"#7e57c2",-18)+At(76,50,16,13,"#7e57c2",18,"satinV")+At(46,76,12,10,"#9575cd",-12)+At(74,76,12,10,"#9575cd",12,"satinV")+Rt(57,42,6,44,"#4527a0",3)+ct("M60 44 L52 30","#4527a0",2)+ct("M60 44 L68 30","#4527a0",2)),tt("Bee","Animals","Bumblebee",At(60,64,22,16,"#fbc02d")+Rt(50,48,8,32,"#3e2723",2)+Rt(64,48,8,32,"#3e2723",2)+At(40,54,12,7,"#e3f2fd",-25)+At(80,54,12,7,"#e3f2fd",25)),tt("Ladybug","Animals","Ladybug",U(60,62,24,"#e53935")+ct("M60 38 L60 86","#3e2723",2)+U(60,40,9,"#3e2723")+U(50,56,4,"#3e2723")+U(70,56,4,"#3e2723")+U(50,72,4,"#3e2723")+U(70,72,4,"#3e2723")),tt("Cat","Animals","Cat face",U(60,64,26,"#9e9e9e")+Z("M40 46 L36 24 L54 40 Z","#9e9e9e")+Z("M80 46 L84 24 L66 40 Z","#9e9e9e")+U(51,62,3.4,"#212121")+U(69,62,3.4,"#212121")+Z("M56 72 q4 4 8 0","#212121")),tt("Bird","Animals","Little bird",At(58,62,22,17,"#42a5f5")+U(74,50,10,"#42a5f5")+Z("M82 50 L96 54 L82 58 Z","#fb8c00")+U(77,48,2.4,"#212121")+Z("M40 64 q-16 4 -18 16 q18 -2 22 -8 Z","#1e88e5")),tt("Fish","Animals","Tropical fish",At(56,62,26,16,"#26c6da")+Z("M82 62 L100 48 L100 76 Z","#0097a7")+U(44,58,2.6,"#063")+Z("M56 46 q0 -10 -8 -12 q2 8 8 12 Z","#0097a7")),tt("Paw","Animals","Paw print",At(60,72,14,11,"#6d4c41")+U(44,52,6,"#6d4c41")+U(58,44,6,"#6d4c41")+U(72,46,6,"#6d4c41")+U(82,58,5,"#6d4c41")),tt("Diamond","Geometric","Diamond",Z("M60 20 L96 60 L60 100 L24 60 Z","#1e88e5")+Z("M60 38 L78 60 L60 82 L42 60 Z","#64b5f6","satinV")),tt("Chevron","Geometric","Chevrons",[0,18,36].map((r,a)=>ct(`M24 ${42+r} L60 ${62+r} L96 ${42+r}`,["#1e88e5","#26a69a","#ef6c00"][a],5)).join("")),tt("Mandala","Geometric","Mandala",U(60,60,30,"#8e24aa")+U(60,60,20,"#ab47bc","satinV")+[...Array(8)].map((r,a)=>{const s=a*45*Math.PI/180;return U(60+Math.cos(s)*30,60+Math.sin(s)*30,5,"#f3e5f5")}).join("")+U(60,60,8,"#f3e5f5")),tt("Heart","Symbols","Heart",Z("M60 92 C24 66 30 34 50 34 C58 34 60 42 60 46 C60 42 62 34 70 34 C90 34 96 66 60 92 Z","#e53935")),tt("Star","Symbols","Star",Z("M60 22 L71 50 L101 50 L77 68 L86 98 L60 80 L34 98 L43 68 L19 50 L49 50 Z","#fbc02d")),tt("Crown","Symbols","Crown",Z("M28 84 L34 46 L48 66 L60 40 L72 66 L86 46 L92 84 Z","#f9a825")+Rt(28,84,64,10,"#f57f17")+U(34,46,5,"#fdd835")+U(60,40,5,"#fdd835")+U(86,46,5,"#fdd835")),tt("Anchor","Symbols","Anchor",U(60,30,7,"#37474f")+ct("M60 36 L60 92","#455a64",5)+ct("M40 60 L80 60","#455a64",5)+Z("M30 76 q6 22 30 22 q24 0 30 -22 q-12 14 -30 14 q-18 0 -30 -14 Z","#37474f")),tt("Lightning","Symbols","Lightning bolt",Z("M64 18 L40 64 L56 64 L50 102 L84 50 L66 50 Z","#ffb300")),tt("Music Note","Symbols","Music note",U(46,84,11,"#5e35b1")+U(82,76,11,"#5e35b1")+Rt(54,30,6,54,"#5e35b1",3)+Rt(85,22,6,54,"#5e35b1",3)+Z("M57 30 L91 22 L91 34 L57 42 Z","#5e35b1")),tt("Peace","Symbols","Peace sign",U(60,60,30,"#43a047")+ct("M60 30 L60 90","rgba(255,255,255,0.95)",4)+ct("M60 60 L38 82","rgba(255,255,255,0.95)",4)+ct("M60 60 L82 82","rgba(255,255,255,0.95)",4)),tt("Cupcake","Food","Cupcake",Z("M38 64 L82 64 L74 98 L46 98 Z","#d7a86e")+Z("M34 64 q6 -28 26 -28 q20 0 26 28 Z","#ec407a")+U(48,50,3,"#fff")+U(60,44,3,"#fff")+U(72,50,3,"#fff")+U(60,34,5,"#e53935")),tt("Cherries","Food","Cherries",U(46,84,12,"#e53935")+U(74,84,12,"#c62828")+ct("M46 72 C50 50 60 40 64 30","#2e7d32",2.5)+ct("M74 72 C70 52 66 42 64 30","#2e7d32",2.5)+Z("M64 30 q14 -8 22 -2 q-12 8 -22 2 Z","#43a047")),tt("Coffee","Food","Coffee cup",Z("M34 50 L84 50 L80 92 L38 92 Z","#6d4c41")+Z("M84 56 q16 0 16 14 q0 14 -18 12","#6d4c41")+ct("M48 38 q4 -8 0 -14","#bcaaa4",2.5)+ct("M60 38 q4 -8 0 -14","#bcaaa4",2.5)+ct("M72 38 q4 -8 0 -14","#bcaaa4",2.5)),tt("Soccer Ball","Sports","Soccer ball",U(60,60,32,"#fafafa")+Z("M60 44 L74 54 L69 72 L51 72 L46 54 Z","#212121")+fi(60,60,5,12,30,"#212121",2)),tt("Basketball","Sports","Basketball",U(60,60,32,"#ef6c00")+ct("M60 28 L60 92","#3e2723",2.5)+ct("M28 60 L92 60","#3e2723",2.5)+ct("M36 36 Q60 60 36 84","#3e2723",2.5)+ct("M84 36 Q60 60 84 84","#3e2723",2.5)),tt("Snowflake","Holiday","Snowflake",[...Array(6)].map((r,a)=>{const s=a*60*Math.PI/180,n=60+Math.cos(s)*38,l=60+Math.sin(s)*38,h=60+Math.cos(s)*22,f=60+Math.sin(s)*22;return ct(`M60 60 L${n} ${l}`,"#4fc3f7",3)+ct(`M${h} ${f} L${h+Math.cos(s+.5)*10} ${f+Math.sin(s+.5)*10}`,"#4fc3f7",2)+ct(`M${h} ${f} L${h+Math.cos(s-.5)*10} ${f+Math.sin(s-.5)*10}`,"#4fc3f7",2)}).join("")+U(60,60,5,"#81d4fa")),tt("Gift","Holiday","Gift box",Rt(34,54,52,44,"#e53935",4)+Rt(54,54,12,44,"#fff",2)+Rt(34,50,52,12,"#c62828",3)+Z("M60 50 q-18 -22 -2 -22 q8 0 2 22 Z","#fbc02d")+Z("M60 50 q18 -22 2 -22 q-8 0 -2 22 Z","#fbc02d")),tt("Holly","Holiday","Holly & berries",Z("M40 60 q10 -22 22 -10 q-2 16 -22 10 Z","#2e7d32")+Z("M80 60 q-10 -22 -22 -10 q2 16 22 10 Z","#388e3c")+Z("M50 78 q10 -16 20 -6 q-4 14 -20 6 Z","#43a047")+U(56,64,5,"#e53935")+U(64,64,5,"#c62828")+U(60,72,5,"#e53935")),tt("Monogram","Text","Initial monogram",U(60,60,34,"#5e35b1")+U(60,60,34,"#5e35b1","satinV")+'<text x="60" y="75" text-anchor="middle" font-family="Georgia, serif" font-size="46" font-weight="700" fill="#ede7f6">A</text>')],no=({isOpen:r,onClose:a,onAddEmbroidery:s,theme:n,apiKey:l,apiEndpoint:h})=>{const[f,k]=p.useState([]),[C,E]=p.useState(!1),[N,M]=p.useState(null),[v,B]=p.useState(""),[I,H]=p.useState("All"),Q=p.useRef(null),z=["All","Floral","Nature","Geometric","Traditional","Sports","Hobbies","Food","Symbols","Holiday","Text"];p.useEffect(()=>{r&&k(so)},[r]);const T=L=>{s({type:"embroidery",src:L.url,name:L.name,description:L.description,category:L.category,width:120,height:120,x:100,y:100}),a()},S=f.filter(L=>{const j=!v||L.name.toLowerCase().includes(v.toLowerCase())||L.description.toLowerCase().includes(v.toLowerCase()),it=I==="All"||L.category===I;return j&&it});return r?e.jsx("div",{className:"embroidery-modal-overlay",onClick:a,children:e.jsxs("div",{className:"embroidery-modal-content",onClick:L=>L.stopPropagation(),ref:Q,children:[e.jsxs("div",{className:"embroidery-modal-header",children:[e.jsx("h3",{children:"Choose an Embroidery Design"}),e.jsx("button",{className:"embroidery-modal-close",onClick:a,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"embroidery-modal-controls",children:[e.jsx("div",{className:"search-container",children:e.jsx("input",{type:"text",placeholder:"Search embroidery designs...",value:v,onChange:L=>B(L.target.value),className:"embroidery-search"})}),e.jsxs("div",{className:"category-filter",children:[e.jsx("label",{children:"Category:"}),e.jsx("select",{value:I,onChange:L=>H(L.target.value),className:"category-select",children:z.map(L=>e.jsx("option",{value:L,children:L},L))})]})]}),e.jsxs("div",{className:"embroidery-modal-body",children:[C&&e.jsxs("div",{className:"embroidery-loading",children:[e.jsx("div",{className:"loading-spinner"}),e.jsx("p",{children:"Loading embroidery designs..."})]}),N&&e.jsx("div",{className:"embroidery-error",children:e.jsx("p",{children:N})}),!C&&!N&&e.jsx("div",{className:"embroidery-grid",children:S.map(L=>e.jsxs("div",{className:"embroidery-item",onClick:()=>T(L),title:L.description,children:[e.jsx("div",{className:"embroidery-preview",children:e.jsx("img",{src:L.url,alt:L.name,loading:"lazy",onError:j=>{console.error("Failed to load embroidery image:",L.url),j.target.style.display="none"}})}),e.jsxs("div",{className:"embroidery-info",children:[e.jsx("div",{className:"embroidery-name",children:L.name}),e.jsx("div",{className:"embroidery-category",children:L.category})]})]},L.id))}),!C&&!N&&S.length===0&&e.jsx("div",{className:"no-embroideries",children:e.jsx("p",{children:"No embroidery designs found matching your search."})})]}),e.jsx("div",{className:"embroidery-modal-footer",children:e.jsxs("div",{className:"embroidery-disclaimer",children:[e.jsx("span",{className:"disclaimer-icon",children:"ℹ️"}),e.jsx("span",{children:"Sample embroidery designs for preview. Actual embroidered results may vary based on fabric and thread."})]})})]})}):null},lo=(r,a,s,n)=>`<text x="90" y="${66+1.3}" text-anchor="middle" font-family="${s}" font-weight="700" font-size="${a}" fill="rgba(0,0,0,0.4)">${r}</text><text x="90" y="${66-.8}" text-anchor="middle" font-family="${s}" font-weight="700" font-size="${a}" fill="rgba(255,255,255,0.22)">${r}</text><text x="90" y="66" text-anchor="middle" font-family="${s}" font-weight="700" font-size="${a}" fill="${n}">${r}</text>`,co=(r,a,s,n,l)=>{const h=`<svg xmlns="http://www.w3.org/2000/svg" width="180" height="120" viewBox="0 0 180 120"><defs><linearGradient id="c" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${l[0]}"/><stop offset="1" stop-color="${l[1]}"/></linearGradient></defs><rect x="6" y="6" width="168" height="108" rx="14" fill="url(#c)"/><rect x="14" y="14" width="152" height="92" rx="9" fill="none" stroke="rgba(0,0,0,0.25)" stroke-width="2"/><rect x="14.5" y="14.5" width="151" height="91" rx="9" fill="none" stroke="rgba(255,255,255,0.25)" stroke-width="1"/>`+lo(r,a,s,n)+"</svg>";return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(h)}`};let Ji=0;const Wt=(r,a,s,{text:n,font:l,sysFont:h,ink:f,card:k,size:C=40,weight:E=700,style:N="normal",previewSize:M=30})=>(Ji+=1,{id:Ji,name:r,category:a,description:s,url:co(n,M,h,f,k),add:{text:n,fontFamily:l,fontSize:C,fontWeight:E,fontStyle:N,fill:f,textAlign:"center",width:300,height:90}}),ta=["#b07e4f","#7d4f28"],Be=["#f3e6cf","#e3cda6"],ui=["#dfe4ea","#9aa4b1"],gi=["#3a4651","#222a31"],ho=[Wt("Welcome","Signage","Bold welcome sign",{text:"WELCOME",font:"Bebas Neue",sysFont:"Impact, sans-serif",ink:"#3a2a1a",card:Be,size:46,previewSize:34}),Wt("Open","Signage","Shop open sign",{text:"OPEN",font:"Anton",sysFont:"Impact, sans-serif",ink:"#7a3b12",card:ta,size:54,previewSize:40}),Wt("Café","Signage","Café script sign",{text:"Café",font:"Pacifico",sysFont:'"Brush Script MT", cursive',ink:"#f5f5f5",card:gi,size:50,previewSize:38}),Wt("Gather","Signage","Gather sign",{text:"gather",font:"Playfair Display",sysFont:"Georgia, serif",ink:"#2e2a26",card:Be,size:46,style:"italic",previewSize:36}),Wt("Family Name","Home","Family name plaque",{text:"The Smiths",font:"Great Vibes",sysFont:'"Brush Script MT", cursive',ink:"#3a2a1a",card:ta,size:48,previewSize:30}),Wt("Home Sweet Home","Home","Home sweet home",{text:"Home Sweet Home",font:"Dancing Script",sysFont:'"Brush Script MT", cursive',ink:"#3a2a1a",card:Be,size:40,previewSize:22}),Wt("House Number","Home","House number",{text:"123",font:"Alfa Slab One",sysFont:"Georgia, serif",ink:"#2b3036",card:ui,size:64,previewSize:48}),Wt("Address","Home","Street address",{text:"21 OAK STREET",font:"Oswald",sysFont:"Arial, sans-serif",ink:"#f5f5f5",card:gi,size:34,previewSize:18}),Wt("Mr & Mrs","Wedding","Wedding sign",{text:"Mr & Mrs",font:"Great Vibes",sysFont:'"Brush Script MT", cursive',ink:"#3a2a1a",card:Be,size:52,previewSize:34}),Wt("Joy","Celebrations","Holiday joy",{text:"Joy",font:"Sacramento",sysFont:'"Brush Script MT", cursive',ink:"#f5f5f5",card:gi,size:60,previewSize:46}),Wt("Established","Celebrations","Established year",{text:"EST. 2024",font:"Staatliches",sysFont:"Impact, sans-serif",ink:"#2b3036",card:ui,size:44,previewSize:30}),Wt("Office","Business","Office name plate",{text:"OFFICE",font:"Oswald",sysFont:"Arial, sans-serif",ink:"#2b3036",card:ui,size:40,previewSize:30})],fo=({isOpen:r,onClose:a,onAddHandcraft:s,theme:n})=>{const[l,h]=p.useState([]),[f,k]=p.useState(""),[C,E]=p.useState("All"),N=p.useRef(null),M=["All","Signage","Business","Home","Wedding","Celebrations"];p.useEffect(()=>{r&&h(ho)},[r]);const v=I=>{s({...I.add}),a()},B=l.filter(I=>{const H=!f||I.name.toLowerCase().includes(f.toLowerCase())||I.description.toLowerCase().includes(f.toLowerCase()),Q=C==="All"||I.category===C;return H&&Q});return r?e.jsx("div",{className:"embroidery-modal-overlay",onClick:a,children:e.jsxs("div",{className:"embroidery-modal-content",onClick:I=>I.stopPropagation(),ref:N,children:[e.jsxs("div",{className:"embroidery-modal-header",children:[e.jsx("h3",{children:"Choose a Signage Template"}),e.jsx("button",{className:"embroidery-modal-close",onClick:a,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"embroidery-modal-controls",children:[e.jsx("div",{className:"search-container",children:e.jsx("input",{type:"text",placeholder:"Search signage & handcraft templates...",value:f,onChange:I=>k(I.target.value),className:"embroidery-search"})}),e.jsxs("div",{className:"category-filter",children:[e.jsx("label",{children:"Category:"}),e.jsx("select",{value:C,onChange:I=>E(I.target.value),className:"category-select",children:M.map(I=>e.jsx("option",{value:I,children:I},I))})]})]}),e.jsxs("div",{className:"embroidery-modal-body",children:[e.jsx("div",{className:"embroidery-grid",children:B.map(I=>e.jsxs("div",{className:"embroidery-item",onClick:()=>v(I),title:I.description,children:[e.jsx("div",{className:"embroidery-preview",children:e.jsx("img",{src:I.url,alt:I.name,loading:"lazy"})}),e.jsxs("div",{className:"embroidery-info",children:[e.jsx("div",{className:"embroidery-name",children:I.name}),e.jsx("div",{className:"embroidery-category",children:I.category})]})]},I.id))}),B.length===0&&e.jsx("div",{className:"no-embroideries",children:e.jsx("p",{children:"No templates found matching your search."})})]}),e.jsx("div",{className:"embroidery-modal-footer",children:e.jsxs("div",{className:"embroidery-disclaimer",children:[e.jsx("span",{className:"disclaimer-icon",children:"ℹ️"}),e.jsx("span",{children:"Sample signage templates — add one, then edit the text and resize it. Final engraving/finish may vary by material."})]})})]})}):null},uo=({isOpen:r,onClose:a,onAddText:s,theme:n})=>{const[l,h]=p.useState(""),[f,k]=p.useState("All");p.useEffect(()=>{if(!r)return;const v=Array.from(new Set(Jt.map(B=>B.fontFamily).filter(Boolean)));He(v)},[r]);const C=p.useMemo(()=>{const v=Jt.reduce((B,I)=>(B[I.category]=(B[I.category]||0)+1,B),{});return[{name:"All",count:Jt.length},...Object.entries(v).map(([B,I])=>({name:B,count:I}))]},[Jt]),E=p.useMemo(()=>Jt.filter(v=>{const B=!l||v.text.toLowerCase().includes(l.toLowerCase())||v.category.toLowerCase().includes(l.toLowerCase()),I=f==="All"||v.category===f;return B&&I}),[Jt,l,f]),N=v=>{const B={...v,x:100,y:100};s("text",B),a()},M=()=>{s("text",{text:"Your Text Here",fontSize:24,fontFamily:"Arial",fill:"#000000",x:100,y:100}),a()};return r?e.jsx("div",{className:"text-templates-modal-overlay",onClick:a,children:e.jsxs("div",{className:"text-templates-modal",onClick:v=>v.stopPropagation(),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:"Text Templates"}),e.jsx("button",{className:"close-btn",onClick:a,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"modal-controls",children:[e.jsx("div",{className:"search-section",children:e.jsx("input",{type:"text",placeholder:"Search templates...",value:l,onChange:v=>h(v.target.value),className:"search-input"})}),e.jsx("div",{className:"category-tabs",children:C.map(v=>e.jsxs("button",{className:`category-tab ${f===v.name?"active":""}`,onClick:()=>k(v.name),children:[v.name,e.jsxs("span",{className:"count",children:["(",v.count,")"]})]},v.name))})]}),e.jsxs("div",{className:"templates-grid",children:[e.jsx("div",{className:"custom-text-option",onClick:M,children:e.jsxs("div",{className:"custom-text-preview",children:[e.jsx("div",{className:"custom-icon",children:"✏️"}),e.jsx("div",{className:"custom-label",children:"Create Custom Text"})]})}),E.map(v=>e.jsxs("div",{className:"template-item",onClick:()=>N(v),children:[e.jsx("div",{className:"template-preview",style:{fontFamily:v.fontFamily,fontSize:`${Math.min(v.fontSize*.6,18)}px`,fontWeight:v.fontWeight,fontStyle:v.fontStyle,color:v.fill,backgroundColor:v.hasBackground?v.backgroundColor:"transparent",textAlign:v.textAlign||"left",textTransform:v.textTransform||"none",letterSpacing:v.letterSpacing?`${v.letterSpacing}px`:"normal",textShadow:v.hasTextShadow?`${v.textShadowX}px ${v.textShadowY}px ${v.textShadowBlur}px ${v.textShadowColor}`:"none"},children:v.text}),e.jsxs("div",{className:"template-info",children:[e.jsx("span",{className:"template-category",children:v.category}),e.jsx("span",{className:"template-font",children:v.fontFamily})]})]},v.id))]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"results-count",children:[E.length," template",E.length!==1?"s":""," found"]})})]})}):null},go=({isOpen:r,onClose:a,onAddImage:s,theme:n,apiKey:l,apiEndpoint:h,aiEndpoint:f,onAIImageGenerate:k})=>{const[C,E]=p.useState(""),[N,M]=p.useState(null),[v,B]=p.useState(!1),[I,H]=p.useState(null),[Q,z]=p.useState(null),T=p.useRef(null);if(p.useEffect(()=>{r&&(z(null),B(!1))},[r]),!r)return null;const S=(n==null?void 0:n.primaryColor)||"#4c5bf2",L=!v&&(C.trim().length>0||!!N),j=V=>{var nt;const O=(nt=V.target.files)==null?void 0:nt[0];if(!O||!O.type.startsWith("image/"))return;const R=new FileReader;R.onload=rt=>M({dataUrl:rt.target.result,name:O.name}),R.onerror=()=>z("Could not read that image. Please try another file."),R.readAsDataURL(O),V.target.value=""},it=()=>M(null),J=V=>{const O=V&&typeof V=="object"&&"object"in V?V.object:V;return O?typeof O=="string"?O:O.imageUrl||O.url||O.image||(O.imageBase64?`data:image/png;base64,${O.imageBase64}`:null):null},xt=async()=>{var V,O;z(null),B(!0),H(null);try{const R={prompt:C.trim(),imageDataUrl:(N==null?void 0:N.dataUrl)||null};let nt=null;if(typeof k=="function"){const rt=await k(R);nt=typeof rt=="string"?rt:J(rt)}else{const rt=f||(h?`${h}/api/v1/designer`:"");if(!rt)throw new Error("AI image generation is not configured.");const mt=await xi.post(`${rt}/generate-image`,{prompt:R.prompt,image:R.imageDataUrl,apiKey:l});nt=J(mt.data)}if(!nt)throw new Error("No image was returned. Please try a different prompt.");H(nt)}catch(R){console.error("AI image generation failed:",R),z(((O=(V=R==null?void 0:R.response)==null?void 0:V.data)==null?void 0:O.message)||(R==null?void 0:R.message)||"Image generation failed. Please try again.")}finally{B(!1)}},gt=()=>{if(!I)return;const V=new Image;V.crossOrigin="anonymous",V.onload=()=>{const R=V.naturalWidth||512,nt=V.naturalHeight||512,rt=Math.min(1,250/Math.max(R,nt));s({imageData:V,src:I,width:Math.round(R*rt),height:Math.round(nt*rt),originalWidth:R,originalHeight:nt}),a()},V.onerror=()=>z("The generated image could not be loaded onto the canvas."),V.src=I},Ft=()=>{H(null),z(null)};return e.jsx("div",{className:"ai-modal-overlay",onClick:a,children:e.jsxs("div",{className:"ai-modal-content",onClick:V=>V.stopPropagation(),children:[e.jsxs("div",{className:"ai-modal-header",children:[e.jsx("h3",{children:"✨ AI Image Generator"}),e.jsx("button",{className:"ai-modal-close",onClick:a,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"ai-modal-body",children:[!I&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"ai-intro",children:["Generate ",e.jsx("strong",{children:"artwork, images, logos, icons, patterns"})," and much more — from a description, your own image, or both."]}),e.jsx("label",{className:"ai-field-label",htmlFor:"ai-prompt",children:"Describe what you want to create"}),e.jsx("textarea",{id:"ai-prompt",className:"ai-prompt",rows:4,placeholder:"e.g. a minimalist mountain logo · a bold retro sunset · a cute cartoon cat mascot · a seamless floral pattern",value:C,onChange:V=>E(V.target.value)}),e.jsxs("div",{className:"ai-ref-section",children:[e.jsx("span",{className:"ai-field-label",children:"Reference image (optional)"}),N?e.jsxs("div",{className:"ai-ref-preview",children:[e.jsx("img",{src:N.dataUrl,alt:N.name}),e.jsxs("div",{className:"ai-ref-meta",children:[e.jsx("span",{className:"ai-ref-name",children:N.name}),e.jsx("button",{type:"button",className:"ai-ref-remove",onClick:it,children:"Remove"})]})]}):e.jsx("button",{type:"button",className:"ai-upload-btn",onClick:()=>{var V;return(V=T.current)==null?void 0:V.click()},children:"+ Upload an image to transform"}),e.jsx("input",{ref:T,type:"file",accept:"image/*",style:{display:"none"},onChange:j})]}),e.jsx("p",{className:"ai-hint",children:N?C.trim()?"Your image will be transformed using your description.":"Add a description to guide how your image is transformed.":"Describe an image to create one from scratch, or upload a reference to transform."}),Q&&e.jsx("div",{className:"ai-error",children:Q}),e.jsx("button",{type:"button",className:"ai-generate-btn",style:{backgroundColor:S,opacity:L?1:.6},disabled:!L,onClick:xt,children:v?e.jsxs("span",{className:"ai-generating",children:[e.jsx("span",{className:"ai-spinner"})," Generating…"]}):"Generate image"})]}),I&&e.jsxs("div",{className:"ai-result",children:[e.jsx("div",{className:"ai-result-preview",children:e.jsx("img",{src:I,alt:"AI generated result"})}),Q&&e.jsx("div",{className:"ai-error",children:Q}),e.jsxs("div",{className:"ai-result-actions",children:[e.jsx("button",{type:"button",className:"ai-secondary-btn",onClick:Ft,children:"Start over"}),e.jsx("button",{type:"button",className:"ai-secondary-btn",onClick:xt,disabled:v,children:v?"Regenerating…":"Regenerate"}),e.jsx("button",{type:"button",className:"ai-generate-btn",style:{backgroundColor:S},onClick:gt,children:"Add to design"})]})]})]})]})})},mo=[246,245,248,239,247,251],ea=mo.map(r=>Jt.find(a=>a.id===r)).filter(Boolean),po=({onAddElement:r,onDeleteElement:a,onDuplicateElement:s,onUndo:n,onRedo:l,onToggleGrid:h,onToggleRulers:f,onToggleSnap:k,onTogglePrintGuides:C,onImageUpload:E,canUndo:N,canRedo:M,showGrid:v,showRulers:B,snapToGrid:I,showPrintGuides:H,selectedElement:Q,theme:z,readOnly:T,mode:S="design",productionMethods:L,supportsEmbroidery:j,apiKey:it,apiEndpoint:J,aiEnabled:xt=!0,aiEndpoint:gt,onAIImageGenerate:Ft,isAuthenticated:V=!0,onRequireAuth:O})=>{const R=S==="customize",rt=(L||[]).some(q=>String(q).toUpperCase()==="EMBROIDERY")||j==="Y",mt=(L||[]).some(q=>String(q).toUpperCase()==="HANDCRAFTED"),[w,X]=p.useState(!1),[P,u]=p.useState(!1),[A,_]=p.useState(!1),[at,bt]=p.useState(!1),[dt,It]=p.useState(!1),[Ct,pt]=p.useState(!1),[jt,Pt]=p.useState(!1),[te,ve]=p.useState(!1),[ee,ie]=p.useState(!1),[wt,qt]=p.useState(!1),[Y,we]=p.useState(!1),Ot=!R||Y;p.useEffect(()=>{V&&te&&(Pt(!0),ve(!1))},[V,te]);const _e=q=>{const Gt=q.target.files[0];Gt&&Gt.type.startsWith("image/")&&E(Gt),q.target.value=""},Ue=q=>{r("icon",{iconData:q,text:q.symbol,fontSize:48,fontFamily:"Arial",fill:"#000000"})},ne=q=>{r("qrcode",q)},Vt=q=>{r("barcode",q)},ae=q=>{r("sticker",q)},Lt=q=>{r("embroidery",q)},ke=q=>{r("text",q)},Tt=(q,Gt)=>{r(q,Gt)},oe=q=>{r("image",q)},ji=()=>{ie(!ee),qt(!1)},Dt=()=>{qt(!wt),ie(!1)},Ce=q=>{q==="custom"?r("text"):q==="templates"&&pt(!0),ie(!1)};p.useEffect(()=>{Ci(ea.map(q=>q.fontFamily).filter(Boolean))},[]);const le=q=>{r("text",{...q}),ie(!1)},yt=q=>{r(q),qt(!1)},ot="#475569";return e.jsxs("div",{className:"toolbar",children:[e.jsxs("div",{className:"toolbar-section",children:[e.jsxs("div",{className:"toolbar-group",children:[e.jsxs("button",{className:"toolbar-btn compact",onClick:n,disabled:!N||T,title:"Undo (Ctrl+Z)",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"undo",size:18,color:!N||T?"#94a3b8":ot})}),e.jsx("span",{className:"label",children:"Undo"})]}),e.jsxs("button",{className:"toolbar-btn compact",onClick:l,disabled:!M||T,title:"Redo (Ctrl+Y)",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"redo",size:18,color:!M||T?"#94a3b8":ot})}),e.jsx("span",{className:"label",children:"Redo"})]})]}),e.jsx("div",{className:"toolbar-separator"}),xt&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-group",children:e.jsxs("button",{className:"toolbar-btn compact ai-btn",onClick:()=>{if(!V){ve(!0),O&&O();return}Pt(!0)},disabled:T,title:"AI: generate artwork, images, logos, icons and much more",style:{color:T?"#94a3b8":"#6d28d9",background:T?void 0:"linear-gradient(135deg, #ede9fe, #f5f3ff)"},children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"sparkle",size:18,color:T?"#94a3b8":"#7c3aed"})}),e.jsx("span",{className:"label",children:"AI Image"})]})}),e.jsx("div",{className:"toolbar-separator"})]}),e.jsxs("div",{className:"toolbar-group",children:[e.jsxs("div",{className:"toolbar-dropdown",children:[e.jsxs("button",{className:"toolbar-btn compact dropdown-trigger",disabled:T,title:"Add Text",onClick:ji,children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"text",size:18,color:T?"#94a3b8":ot})}),e.jsx("span",{className:"label",children:"Text"}),e.jsx("span",{className:`dropdown-arrow ${ee?"open":""}`,children:"▾"})]}),e.jsxs("div",{className:`dropdown-menu text-design-menu ${ee?"show":""}`,style:{minWidth:240},children:[e.jsxs("button",{onClick:()=>Ce("custom"),children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"text",size:16,color:ot})})," Custom text"]}),e.jsx("div",{style:{padding:"6px 10px 2px",fontSize:11,fontWeight:700,color:"#94a3b8",textTransform:"uppercase",letterSpacing:.5},children:"Design ideas"}),ea.map(q=>e.jsx("button",{onClick:()=>le(q),title:`Add "${q.text}"`,style:{justifyContent:"flex-start"},children:e.jsx("span",{style:{fontFamily:`'${q.fontFamily}', cursive`,fontWeight:q.fontWeight||"normal",fontStyle:q.fontStyle||"normal",color:q.fill||"#111827",fontSize:18,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textTransform:q.textTransform||"none"},children:q.text})},q.id)),e.jsxs("button",{onClick:()=>Ce("templates"),style:{borderTop:"1px solid #e2e8f0",marginTop:4,color:"#2563eb",fontWeight:600},children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"book",size:16,color:"#2563eb"})})," More designs…"]})]})]}),R&&e.jsxs("button",{type:"button",className:`toolbar-btn compact ${Y?"active":""}`,onClick:()=>we(q=>!q),title:"More tools (shapes, QR code, barcode, grid)",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"gear",size:18,color:Y?"#ffffff":ot})}),e.jsx("span",{className:"label",children:"More"}),e.jsx("span",{className:`dropdown-arrow ${Y?"open":""}`,children:"▾"})]}),Ot&&e.jsxs("div",{className:"toolbar-dropdown",children:[e.jsxs("button",{className:"toolbar-btn compact dropdown-trigger",disabled:T,onClick:Dt,children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"shapes",size:18,color:T?"#94a3b8":ot})}),e.jsx("span",{className:"label",children:"Shapes"}),e.jsx("span",{className:`dropdown-arrow ${wt?"open":""}`,children:"▾"})]}),e.jsxs("div",{className:`dropdown-menu ${wt?"show":""}`,children:[e.jsxs("button",{onClick:()=>yt("rectangle"),children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"rectangle",size:16,color:ot})})," Rectangle"]}),e.jsxs("button",{onClick:()=>yt("circle"),children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"circle",size:16,color:ot})})," Circle"]}),e.jsxs("button",{onClick:()=>yt("triangle"),children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"triangle",size:16,color:ot})})," Triangle"]}),e.jsxs("button",{onClick:()=>yt("star"),children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"star",size:16,color:ot})})," Star"]}),e.jsxs("button",{onClick:()=>yt("heart"),children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"heart",size:16,color:ot})})," Heart"]}),e.jsxs("button",{onClick:()=>yt("arrow"),children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"arrowShape",size:16,color:ot})})," Arrow"]}),e.jsxs("button",{onClick:()=>yt("diamond"),children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"diamond",size:16,color:ot})})," Diamond"]}),e.jsxs("button",{onClick:()=>yt("hexagon"),children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"hexagon",size:16,color:ot})})," Hexagon"]}),e.jsxs("button",{onClick:()=>yt("pentagon"),children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"pentagon",size:16,color:ot})})," Pentagon"]}),e.jsxs("button",{onClick:()=>yt("oval"),children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"oval",size:16,color:ot})})," Oval"]}),e.jsxs("button",{onClick:()=>yt("roundedRectangle"),children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"roundedRect",size:16,color:ot})})," Rounded Rectangle"]}),e.jsxs("button",{onClick:()=>yt("horizontalLine"),children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"horizontalLine",size:16,color:ot})})," Horizontal Line"]})]})]}),e.jsx("div",{className:"toolbar-separator"}),e.jsxs("label",{className:"toolbar-btn compact file-upload",style:{cursor:T?"not-allowed":"pointer"},children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"upload",size:18,color:T?"#94a3b8":ot})}),e.jsx("span",{className:"label",children:"Upload"}),e.jsx("input",{type:"file",accept:"image/*",onChange:_e,disabled:T})]}),e.jsx("div",{className:"toolbar-separator"}),e.jsx(to,{onSelectIcon:Ue,theme:z,disabled:T}),e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>_(!0),disabled:T,title:"Add Sticker",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"sticker",size:18,color:T?"#94a3b8":ot})}),e.jsx("span",{className:"label",children:"Stickers"})]}),Ot&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-separator"}),e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>X(!0),disabled:T,title:"Add QR Code",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"qrcode",size:18,color:T?"#94a3b8":ot})}),e.jsx("span",{className:"label",children:"QR Code"})]}),e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>u(!0),disabled:T,title:"Add Barcode",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"barcode",size:18,color:T?"#94a3b8":ot})}),e.jsx("span",{className:"label",children:"Barcode"})]})]})]}),rt&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-separator"}),e.jsx("div",{className:"toolbar-group embroidery-group",children:e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>bt(!0),disabled:T,title:"Add Embroidery Design",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"thread",size:18,color:T?"#94a3b8":ot})}),e.jsx("span",{className:"label",children:"Embroidery"})]})})]}),mt&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-separator"}),e.jsx("div",{className:"toolbar-group handcraft-group",children:e.jsxs("button",{className:"toolbar-btn compact",onClick:()=>It(!0),disabled:T,title:"Add a signage / handcraft template",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"briefcase",size:18,color:T?"#94a3b8":ot})}),e.jsx("span",{className:"label",children:"Signage"})]})})]}),Q&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-separator"}),e.jsxs("div",{className:"toolbar-group",children:[e.jsxs("button",{className:"toolbar-btn compact success",onClick:s,disabled:T,title:"Duplicate Element (Ctrl+D)",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"duplicate",size:18,color:T?"#94a3b8":"#059669"})}),e.jsx("span",{className:"label",children:"Duplicate"})]}),e.jsxs("button",{className:"toolbar-btn compact danger",onClick:a,disabled:T,title:"Delete Element (Delete)",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"trash",size:18,color:T?"#94a3b8":"#dc2626"})}),e.jsx("span",{className:"label",children:"Delete"})]})]})]}),Ot&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbar-separator"}),e.jsxs("div",{className:"toolbar-group",children:[e.jsxs("button",{className:`toolbar-btn compact ${v?"active":""}`,onClick:h,title:"Toggle Grid",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"grid",size:18,color:v?"#ffffff":ot})}),e.jsx("span",{className:"label",children:"Grid"})]}),e.jsxs("button",{className:`toolbar-btn compact ${B?"active":""}`,onClick:f,title:"Toggle Rulers",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"ruler",size:18,color:B?"#ffffff":ot})}),e.jsx("span",{className:"label",children:"Rulers"})]}),e.jsxs("button",{className:`toolbar-btn compact ${I?"active":""}`,onClick:k,title:"Snap to Grid",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"magnet",size:18,color:I?"#ffffff":ot})}),e.jsx("span",{className:"label",children:"Snap"})]}),e.jsxs("button",{className:`toolbar-btn compact ${H?"active":""}`,onClick:C,title:"Toggle print area & safe-zone guides",children:[e.jsx("span",{className:"icon",children:e.jsx(K,{name:"rectangle",size:18,color:H?"#ffffff":ot})}),e.jsx("span",{className:"label",children:"Print area"})]})]})]})]}),e.jsx(eo,{isOpen:w,onClose:()=>X(!1),onAddQRCode:ne,theme:z}),e.jsx(io,{isOpen:P,onClose:()=>u(!1),onAddBarcode:Vt,theme:z}),e.jsx(oo,{isOpen:A,onClose:()=>_(!1),onAddSticker:ae,theme:z,apiKey:it,apiEndpoint:J}),e.jsx(no,{isOpen:at,onClose:()=>bt(!1),onAddEmbroidery:Lt,theme:z,apiKey:it,apiEndpoint:J}),e.jsx(fo,{isOpen:dt,onClose:()=>It(!1),onAddHandcraft:ke,theme:z}),e.jsx(uo,{isOpen:Ct,onClose:()=>pt(!1),onAddText:Tt,theme:z}),xt&&e.jsx(go,{isOpen:jt,onClose:()=>Pt(!1),onAddImage:oe,theme:z,apiKey:it,apiEndpoint:J,aiEndpoint:gt,onAIImageGenerate:Ft})]})},yo=({value:r="Arial",onChange:a=()=>{},onFontLoaded:s=()=>{}})=>{const[n,l]=p.useState(!1),[h,f]=p.useState(""),k=p.useRef(null);p.useEffect(()=>{n&&He(ia)},[n]),p.useEffect(()=>{if(!n)return;const N=v=>{k.current&&!k.current.contains(v.target)&&l(!1)},M=v=>{v.key==="Escape"&&l(!1)};return document.addEventListener("mousedown",N),document.addEventListener("keydown",M),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",M)}},[n]);const C=p.useMemo(()=>{const N=h.trim().toLowerCase();return N?bi.map(M=>({...M,fonts:M.fonts.filter(v=>v.toLowerCase().includes(N))})).filter(M=>M.fonts.length>0):bi},[h]),E=async N=>{a(N),l(!1),f(""),await aa(N),s()};return e.jsxs("div",{ref:k,style:{position:"relative",width:"100%"},children:[e.jsxs("button",{type:"button",onClick:()=>l(N=>!N),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 10px",border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",cursor:"pointer",fontSize:14},title:"Choose a font",children:[e.jsx("span",{style:{fontFamily:`"${r}"`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),e.jsx("span",{style:{color:"#64748b",fontSize:12},children:"▾"})]}),n&&e.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:1e3,background:"#fff",border:"1px solid #cbd5e1",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.15)",maxHeight:320,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsx("input",{autoFocus:!0,value:h,onChange:N=>f(N.target.value),placeholder:"Search fonts…",style:{margin:8,padding:"6px 8px",border:"1px solid #e2e8f0",borderRadius:6,fontSize:13,outline:"none"}}),e.jsxs("div",{style:{overflowY:"auto",padding:"0 4px 6px"},children:[C.map(N=>e.jsxs("div",{children:[e.jsx("div",{style:{position:"sticky",top:0,background:"#f8fafc",color:"#64748b",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em",padding:"6px 8px"},children:N.name}),N.fonts.map(M=>e.jsx("button",{type:"button",onMouseEnter:()=>He([M]),onClick:()=>E(M),style:{width:"100%",textAlign:"left",padding:"8px 10px",border:"none",borderRadius:6,cursor:"pointer",fontSize:16,fontFamily:`"${M}"`,background:M===r?"#eff6ff":"transparent",color:M===r?"#1d4ed8":"#0f172a"},children:M},M))]},N.name)),C.length===0&&e.jsxs("div",{style:{padding:12,color:"#94a3b8",fontSize:13},children:["No fonts match “",h,"”."]})]})]})]})},Oe=[{name:"White",hex:"#FFFFFF"},{name:"Ecru",hex:"#F3EAD3"},{name:"Cream",hex:"#F7E9C3"},{name:"Silver",hex:"#C8CDD2"},{name:"Light Grey",hex:"#9AA0A6"},{name:"Steel Grey",hex:"#5F676E"},{name:"Charcoal",hex:"#33373B"},{name:"Black",hex:"#101113"},{name:"Pale Pink",hex:"#F6C5D3"},{name:"Rose",hex:"#E8638C"},{name:"Fuchsia",hex:"#D81B7A"},{name:"Red",hex:"#D11F2D"},{name:"Crimson",hex:"#9E1B2F"},{name:"Burgundy",hex:"#6E1F2C"},{name:"Peach",hex:"#F6A98C"},{name:"Orange",hex:"#F26A21"},{name:"Pumpkin",hex:"#D2541E"},{name:"Gold",hex:"#E8A317"},{name:"Yellow",hex:"#F4C500"},{name:"Lemon",hex:"#F2E54B"},{name:"Lime",hex:"#9BCB3C"},{name:"Kelly Green",hex:"#2E9E45"},{name:"Green",hex:"#1F7A3D"},{name:"Forest",hex:"#14532D"},{name:"Teal",hex:"#0E8C8C"},{name:"Mint",hex:"#9FE0C4"},{name:"Sky Blue",hex:"#5BB6E8"},{name:"Blue",hex:"#1C76C5"},{name:"Royal Blue",hex:"#1E40AF"},{name:"Navy",hex:"#16244C"},{name:"Turquoise",hex:"#22B5C9"},{name:"Lavender",hex:"#B9A6E0"},{name:"Purple",hex:"#7A3CB0"},{name:"Plum",hex:"#5B2A6B"},{name:"Tan",hex:"#C8A06A"},{name:"Brown",hex:"#7A4A26"},{name:"Coffee",hex:"#4A2F1C"},{name:"Gold Metallic",hex:"#C8A53B"},{name:"Silver Metallic",hex:"#B6BCC4"}];function vi(r){if(!r)return null;let a=String(r).trim().replace("#","");if(a.length===3&&(a=a.split("").map(n=>n+n).join("")),a.length!==6)return null;const s=parseInt(a,16);return Number.isNaN(s)?null:{r:s>>16&255,g:s>>8&255,b:s&255}}function xo(r,a){const s=(r.r+a.r)/2,n=r.r-a.r,l=r.g-a.g,h=r.b-a.b;return(2+s/256)*n*n+4*l*l+(2+(255-s)/256)*h*h}function bo(r){const a=vi(r);if(!a)return Oe[0];let s=Oe[0],n=1/0;for(const l of Oe){const h=vi(l.hex),f=xo(a,h);f<n&&(n=f,s=l)}return s}function So(r){return vi(r)?bo(r).hex:r}const mi={widthIn:12,dpi:300,safeAreaPct:5},vo=6e3;function Ge(r){const a=r||{};return{widthIn:Number(a.widthIn)>0?Number(a.widthIn):mi.widthIn,dpi:Number(a.dpi)>0?Number(a.dpi):mi.dpi,safeAreaPct:Number.isFinite(Number(a.safeAreaPct))?Math.min(40,Math.max(0,Number(a.safeAreaPct))):mi.safeAreaPct}}function wo(r,a,s){const{widthIn:n,dpi:l}=Ge(s);if(!(r>0))return 1;let f=n*l/r;f=Math.max(1,f);const k=Math.max(r,a||r),C=vo/k;return Math.min(f,Math.max(1,C))}function wi(r,a){const{widthIn:s}=Ge(a);return r>0?s/r:0}function ra(r,a,s){var k,C,E,N;if(!r||!["image","sticker","embroidery"].includes(r.type))return null;const l=r.originalWidth||r.naturalWidth||((k=r.imageObject)==null?void 0:k.naturalWidth)||((C=r._imageElement)==null?void 0:C.naturalWidth)||((E=r._stickerElement)==null?void 0:E.naturalWidth)||((N=r.imageData)==null?void 0:N.naturalWidth)||0;if(!(l>0))return null;const h=r.width||0;if(!(h>0))return null;const f=h*wi(a,s);return f>0?l/f:null}function sa(r,a){const{dpi:s}=Ge(a);return r==null?null:r>=s?{level:"good",color:"#16a34a",label:"Print quality: Excellent"}:r>=s/2?{level:"warn",color:"#d97706",label:"Print quality: Acceptable — may look soft"}:{level:"bad",color:"#dc2626",label:"Print quality: Too low — will look blurry"}}const ko=({selectedElement:r,selectedCount:a=0,onUpdate:s,onMoveLayer:n,onAlignSelection:l,onDistributeSelection:h,onDeleteSelection:f,availableFonts:k,theme:C,isEmbroidery:E=!1,onFontLoaded:N=()=>{},canvasWidth:M,canvasHeight:v,printConfig:B,onRemoveBackground:I})=>{const[H,Q]=p.useState(!1),[z,T]=p.useState(!1),[S,L]=p.useState("");if(a>1)return e.jsxs("div",{className:"properties-panel",children:[e.jsx("h3",{children:"Properties"}),e.jsxs("div",{className:"property-group",children:[e.jsxs("h4",{children:[a," elements selected"]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Align"}),e.jsxs("div",{className:"align-buttons",children:[e.jsx("button",{type:"button",title:"Align left",onClick:()=>l==null?void 0:l("left"),children:"⬅"}),e.jsx("button",{type:"button",title:"Center horizontally",onClick:()=>l==null?void 0:l("hcenter"),children:"⬌"}),e.jsx("button",{type:"button",title:"Align right",onClick:()=>l==null?void 0:l("right"),children:"➡"}),e.jsx("button",{type:"button",title:"Align top",onClick:()=>l==null?void 0:l("top"),children:"⬆"}),e.jsx("button",{type:"button",title:"Center vertically",onClick:()=>l==null?void 0:l("vcenter"),children:"⬍"}),e.jsx("button",{type:"button",title:"Align bottom",onClick:()=>l==null?void 0:l("bottom"),children:"⬇"})]})]}),a>2&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Distribute"}),e.jsxs("div",{className:"align-buttons",children:[e.jsx("button",{type:"button",title:"Distribute horizontally",onClick:()=>h==null?void 0:h("h"),children:"↔"}),e.jsx("button",{type:"button",title:"Distribute vertically",onClick:()=>h==null?void 0:h("v"),children:"↕"})]})]}),e.jsx("div",{className:"property-row",children:e.jsxs("button",{type:"button",className:"multi-delete-btn",onClick:()=>f==null?void 0:f(),children:["Delete ",a," elements"]})})]})]});if(!r)return e.jsxs("div",{className:"properties-panel",children:[e.jsx("h3",{children:"Properties"}),e.jsx("p",{className:"no-selection",children:"Select an element to edit its properties"})]});const j=(w,X)=>{s(r.id,{[w]:X})},it=()=>{var w,X,P;return e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Text Content"}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Content"}),e.jsx("textarea",{value:r.text||"",onChange:u=>j("text",u.target.value),rows:3,placeholder:"Enter your text here..."})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Font Family"}),e.jsx(yo,{value:r.fontFamily||"Arial",onChange:u=>j("fontFamily",u),onFontLoaded:N})]}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Font Size"}),e.jsx("input",{type:"number",value:r.fontSize||20,onChange:u=>j("fontSize",parseInt(u.target.value)),min:"8",max:"200"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Line Height"}),e.jsx("input",{type:"number",step:"0.1",value:r.lineHeight||1.2,onChange:u=>j("lineHeight",parseFloat(u.target.value)),min:"0.5",max:"3"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Letter Spacing"}),e.jsx("input",{type:"number",step:"0.5",value:r.letterSpacing||0,onChange:u=>j("letterSpacing",parseFloat(u.target.value)||0),min:"-5",max:"50"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Outline Width"}),e.jsx("input",{type:"number",step:"0.5",value:r.strokeWidth||0,onChange:u=>j("strokeWidth",parseFloat(u.target.value)||0),min:"0",max:"20"})]})]}),(r.strokeWidth||0)>0&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Outline Color"}),e.jsx("input",{type:"color",value:r.stroke||"#000000",onChange:u=>j("stroke",u.target.value)})]}),e.jsxs("div",{className:"property-row",children:[e.jsxs("label",{children:["Curve ",r.curve?`(${r.curve}°)`:""]}),e.jsxs("div",{className:"input-group",style:{display:"flex",alignItems:"center",gap:8,width:"100%"},children:[e.jsx("input",{type:"range",min:"-180",max:"180",step:"1",value:r.curve||0,onChange:u=>j("curve",parseInt(u.target.value,10)),style:{flex:1}}),e.jsx("button",{type:"button",onClick:()=>j("curve",0),title:"Reset to straight",style:{padding:"2px 8px"},children:"Reset"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Font Weight"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:r.fontWeight==="lighter"||r.fontWeight==="300"?"active":"",onClick:()=>j("fontWeight","300"),title:"Light",children:"Light"}),e.jsx("button",{className:!r.fontWeight||r.fontWeight==="normal"||r.fontWeight==="400"?"active":"",onClick:()=>j("fontWeight","normal"),title:"Normal",children:"Normal"}),e.jsx("button",{className:r.fontWeight==="bold"||r.fontWeight==="700"?"active":"",onClick:()=>j("fontWeight","bold"),title:"Bold",children:e.jsx("strong",{children:"Bold"})})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Style"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:r.fontStyle==="italic"?"active":"",onClick:()=>j("fontStyle",r.fontStyle==="italic"?"normal":"italic"),title:"Italic",children:e.jsx("em",{children:"I"})}),e.jsx("button",{className:(w=r.textDecoration)!=null&&w.includes("underline")?"active":"",onClick:()=>{const u=r.textDecoration||"",A=u.split(" ").filter(_=>_&&_!=="underline");u.includes("underline")||A.push("underline"),j("textDecoration",A.join(" ").trim())},title:"Underline",children:e.jsx("u",{children:"U"})}),e.jsx("button",{className:(X=r.textDecoration)!=null&&X.includes("overline")?"active":"",onClick:()=>{const u=r.textDecoration||"",A=u.split(" ").filter(_=>_&&_!=="overline");u.includes("overline")||A.push("overline"),j("textDecoration",A.join(" ").trim())},title:"Overline",children:e.jsx("span",{style:{textDecoration:"overline"},children:"O"})}),e.jsx("button",{className:(P=r.textDecoration)!=null&&P.includes("line-through")?"active":"",onClick:()=>{const u=r.textDecoration||"",A=u.split(" ").filter(_=>_&&_!=="line-through");u.includes("line-through")||A.push("line-through"),j("textDecoration",A.join(" ").trim())},title:"Strikethrough",children:e.jsx("s",{children:"S"})})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Transform"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:!r.textTransform||r.textTransform==="none"?"active":"",onClick:()=>j("textTransform","none"),title:"Normal",children:"Aa"}),e.jsx("button",{className:r.textTransform==="uppercase"?"active":"",onClick:()=>j("textTransform","uppercase"),title:"Uppercase",children:"AA"}),e.jsx("button",{className:r.textTransform==="lowercase"?"active":"",onClick:()=>j("textTransform","lowercase"),title:"Lowercase",children:"aa"}),e.jsx("button",{className:r.textTransform==="capitalize"?"active":"",onClick:()=>j("textTransform","capitalize"),title:"Capitalize",children:"Aa"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Alignment"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:!r.textAlign||r.textAlign==="left"?"active":"",onClick:()=>j("textAlign","left"),title:"Left Align",children:"⬅"}),e.jsx("button",{className:r.textAlign==="center"?"active":"",onClick:()=>j("textAlign","center"),title:"Center Align",children:"↔"}),e.jsx("button",{className:r.textAlign==="right"?"active":"",onClick:()=>j("textAlign","right"),title:"Right Align",children:"➡"}),e.jsx("button",{className:r.textAlign==="justify"?"active":"",onClick:()=>j("textAlign","justify"),title:"Justify",children:"≡"})]})]}),e.jsx("div",{className:"property-row",children:e.jsxs("div",{className:"color-input-group",children:[e.jsxs("div",{className:"color-input-item",children:[e.jsx("label",{children:E?"Thread Color":"Text Color"}),e.jsx("input",{type:"color",value:r.fill||"#000000",onChange:u=>j("fill",u.target.value)}),E&&e.jsx("div",{title:"Real thread colours",style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:6,maxWidth:200},children:Oe.map(u=>e.jsx("button",{type:"button",title:u.name,onClick:()=>j("fill",u.hex),style:{width:16,height:16,padding:0,borderRadius:"50%",background:u.hex,border:(r.fill||"").toLowerCase()===u.hex.toLowerCase()?"2px solid #2563eb":"1px solid #cbd5e1",cursor:"pointer"}},u.hex))})]}),e.jsxs("div",{className:"color-input-item",children:[e.jsx("label",{children:"Background Color"}),e.jsxs("div",{className:"color-with-toggle",children:[e.jsx("input",{type:"color",value:r.backgroundColor||"#ffffff",onChange:u=>j("backgroundColor",u.target.value),disabled:!r.hasBackground}),e.jsx("button",{className:`toggle-btn ${r.hasBackground?"active":""}`,onClick:()=>j("hasBackground",!r.hasBackground),title:r.hasBackground?"Remove background":"Add background",children:r.hasBackground?"👁":"👁‍🗨"})]})]})]})}),H&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Letter Spacing"}),e.jsx("input",{type:"number",step:"0.1",value:r.letterSpacing||0,onChange:u=>j("letterSpacing",parseFloat(u.target.value)),min:"-5",max:"10"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Word Spacing"}),e.jsx("input",{type:"number",step:"0.1",value:r.wordSpacing||0,onChange:u=>j("wordSpacing",parseFloat(u.target.value)),min:"-10",max:"20"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Shadow"}),e.jsxs("div",{className:"text-shadow-controls",children:[e.jsx("div",{className:"shadow-toggle",children:e.jsx("button",{className:`toggle-btn ${r.hasTextShadow?"active":""}`,onClick:()=>j("hasTextShadow",!r.hasTextShadow),children:r.hasTextShadow?"Remove Shadow":"Add Shadow"})}),r.hasTextShadow&&e.jsxs("div",{className:"shadow-properties",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"H-Offset"}),e.jsx("input",{type:"number",value:r.textShadowX||2,onChange:u=>j("textShadowX",parseInt(u.target.value)),min:"-20",max:"20"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"V-Offset"}),e.jsx("input",{type:"number",value:r.textShadowY||2,onChange:u=>j("textShadowY",parseInt(u.target.value)),min:"-20",max:"20"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Blur"}),e.jsx("input",{type:"number",value:r.textShadowBlur||4,onChange:u=>j("textShadowBlur",parseInt(u.target.value)),min:"0",max:"20"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Shadow Color"}),e.jsx("input",{type:"color",value:r.textShadowColor||"#000000",onChange:u=>j("textShadowColor",u.target.value)})]})]})]})]}),e.jsx("div",{className:"property-row",children:e.jsxs("div",{className:"color-input-group",children:[e.jsxs("div",{className:"color-input-item",children:[e.jsx("label",{children:"Stroke Color"}),e.jsx("input",{type:"color",value:r.stroke||"#000000",onChange:u=>j("stroke",u.target.value)})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Stroke Width"}),e.jsx("input",{type:"number",value:r.strokeWidth||0,onChange:u=>j("strokeWidth",parseInt(u.target.value)),min:"0",max:"20"})]})]})}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Opacity"}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:r.opacity||1,onChange:u=>j("opacity",parseFloat(u.target.value))}),e.jsxs("span",{children:[Math.round((r.opacity||1)*100),"%"]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Font Variant"}),e.jsxs("select",{value:r.fontVariant||"normal",onChange:u=>j("fontVariant",u.target.value),children:[e.jsx("option",{value:"normal",children:"Normal"}),e.jsx("option",{value:"small-caps",children:"Small Caps"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Writing Mode"}),e.jsxs("select",{value:r.writingMode||"horizontal-tb",onChange:u=>j("writingMode",u.target.value),children:[e.jsx("option",{value:"horizontal-tb",children:"Horizontal"}),e.jsx("option",{value:"vertical-rl",children:"Vertical Right-to-Left"}),e.jsx("option",{value:"vertical-lr",children:"Vertical Left-to-Right"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Text Direction"}),e.jsxs("div",{className:"button-group",children:[e.jsx("button",{className:!r.direction||r.direction==="ltr"?"active":"",onClick:()=>j("direction","ltr"),title:"Left to Right",children:"LTR"}),e.jsx("button",{className:r.direction==="rtl"?"active":"",onClick:()=>j("direction","rtl"),title:"Right to Left",children:"RTL"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Background Padding"}),e.jsx("input",{type:"number",value:r.backgroundPadding||5,onChange:u=>j("backgroundPadding",parseInt(u.target.value)),min:"0",max:"50",disabled:!r.hasBackground})]})]})]})},J=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Shape Properties"}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Fill Color"}),e.jsx("input",{type:"color",value:r.fill||"#000000",onChange:w=>j("fill",w.target.value)})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Stroke Color"}),e.jsx("input",{type:"color",value:r.stroke||"#000000",onChange:w=>j("stroke",w.target.value)})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Stroke Width"}),e.jsx("input",{type:"number",value:r.strokeWidth||2,onChange:w=>j("strokeWidth",parseInt(w.target.value)),min:"0",max:"20"})]}),r.type==="star"&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Star Points"}),e.jsx("input",{type:"number",value:r.numPoints||5,onChange:w=>j("numPoints",parseInt(w.target.value)),min:"3",max:"20"})]}),r.type==="roundedRectangle"&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Corner Radius"}),e.jsx("input",{type:"number",value:r.cornerRadius||10,onChange:w=>j("cornerRadius",parseInt(w.target.value)),min:"0",max:"50"})]})]}),xt=async()=>{if(!(!I||z)){T(!0),L("");try{await I(r)}catch{L("Could not remove the background. Please try again.")}finally{T(!1)}}},gt=["image","sticker","embroidery"],Ft=()=>!I||!gt.includes(r.type)?null:e.jsxs("div",{className:"property-group",children:[e.jsx("button",{type:"button",className:"remove-bg-btn",onClick:xt,disabled:z,style:{width:"100%",padding:"9px 12px",borderRadius:8,border:"1px solid #cbd5e1",background:z?"#f1f5f9":"#fff",color:"#334155",fontSize:13,fontWeight:600,cursor:z?"wait":"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:z?"Removing background…":"✂️ Remove background"}),S&&e.jsx("div",{style:{marginTop:6,fontSize:12,color:"#dc2626"},children:S})]}),V=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Image Properties"}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Opacity"}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:r.opacity||1,onChange:w=>j("opacity",parseFloat(w.target.value))}),e.jsxs("span",{children:[Math.round((r.opacity||1)*100),"%"]})]}),H&&e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Border Radius"}),e.jsx("input",{type:"number",value:r.borderRadius||0,onChange:w=>j("borderRadius",parseInt(w.target.value)),min:"0",max:"50"})]})]}),O=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Position & Size"}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"X"}),e.jsx("input",{type:"number",value:Math.round(r.x)||0,onChange:w=>j("x",parseInt(w.target.value))})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Y"}),e.jsx("input",{type:"number",value:Math.round(r.y)||0,onChange:w=>j("y",parseInt(w.target.value))})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Width"}),e.jsx("input",{type:"number",value:Math.round(r.width)||0,onChange:w=>j("width",parseInt(w.target.value)),min:"1"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Height"}),e.jsx("input",{type:"number",value:Math.round(r.height)||0,onChange:w=>j("height",parseInt(w.target.value)),min:"1"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Rotation"}),e.jsx("input",{type:"range",min:"-180",max:"180",value:r.rotation||0,onChange:w=>j("rotation",parseInt(w.target.value))}),e.jsxs("span",{children:[r.rotation||0,"°"]})]}),M?e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Align"}),e.jsxs("div",{className:"align-buttons",children:[e.jsx("button",{type:"button",title:"Align left",onClick:()=>j("x",0),children:"⬅"}),e.jsx("button",{type:"button",title:"Center horizontally",onClick:()=>j("x",Math.round((M-(r.width||0))/2)),children:"⬌"}),e.jsx("button",{type:"button",title:"Align right",onClick:()=>j("x",Math.round(M-(r.width||0))),children:"➡"}),v?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",title:"Align top",onClick:()=>j("y",0),children:"⬆"}),e.jsx("button",{type:"button",title:"Center vertically",onClick:()=>j("y",Math.round((v-(r.height||0))/2)),children:"⬍"}),e.jsx("button",{type:"button",title:"Align bottom",onClick:()=>j("y",Math.round(v-(r.height||0))),children:"⬇"})]}):null]})]}):null,e.jsxs("div",{className:"property-row lock-toggles",children:[r.type!=="text"&&e.jsxs("label",{className:"lock-toggle",children:[e.jsx("input",{type:"checkbox",checked:!!r.lockAspect,onChange:w=>j("lockAspect",w.target.checked)}),"Lock aspect ratio"]}),e.jsxs("label",{className:"lock-toggle",children:[e.jsx("input",{type:"checkbox",checked:!!r.locked,onChange:w=>j("locked",w.target.checked)}),"Lock position"]})]})]}),R=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Line Properties"}),e.jsxs("div",{className:"property-row",children:[e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Line Width"}),e.jsx("input",{type:"number",value:r.strokeWidth||r.height||2,onChange:w=>{const X=parseInt(w.target.value);j("strokeWidth",X),j("height",X)},min:"1",max:"50"})]}),e.jsxs("div",{className:"input-group",children:[e.jsx("label",{children:"Length"}),e.jsx("input",{type:"number",value:r.width||200,onChange:w=>j("width",parseInt(w.target.value)),min:"10",max:"1000"})]})]}),e.jsxs("div",{className:"property-row",children:[e.jsx("label",{children:"Line Color"}),e.jsxs("div",{className:"color-input-group",children:[e.jsx("input",{type:"color",value:r.stroke||r.fill||"#000000",onChange:w=>{j("stroke",w.target.value),j("fill",w.target.value)}}),e.jsx("input",{type:"text",value:r.stroke||r.fill||"#000000",onChange:w=>{j("stroke",w.target.value),j("fill",w.target.value)},placeholder:"#000000"})]})]})]}),nt=()=>e.jsxs("div",{className:"property-group",children:[e.jsx("h4",{children:"Layer Controls"}),e.jsxs("div",{className:"button-group vertical",children:[e.jsx("button",{onClick:()=>n(r.id,"top"),children:"Bring to Front"}),e.jsx("button",{onClick:()=>n(r.id,"up"),children:"Bring Forward"}),e.jsx("button",{onClick:()=>n(r.id,"down"),children:"Send Backward"}),e.jsx("button",{onClick:()=>n(r.id,"bottom"),children:"Send to Back"})]})]}),rt=["rectangle","circle","triangle","star","arrow","diamond","hexagon","pentagon","heart","oval","roundedRectangle"],mt=()=>{const w=ra(r,M,B);if(w==null)return null;const X=sa(w,B);return X?e.jsxs("div",{className:"property-group dpi-meter",style:{borderLeft:`4px solid ${X.color}`,paddingLeft:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:9,height:9,borderRadius:"50%",background:X.color,flex:"0 0 auto"}}),e.jsxs("strong",{style:{color:X.color,fontSize:13},children:[Math.round(w)," DPI"]})]}),e.jsx("div",{style:{fontSize:12,color:"#475569",marginTop:2},children:X.label}),X.level!=="good"&&e.jsx("div",{style:{fontSize:11,color:"#64748b",marginTop:4},children:"Make it smaller on the canvas or upload a higher-resolution image."})]}):null};return e.jsxs("div",{className:"properties-panel",children:[e.jsxs("div",{className:"panel-header",children:[e.jsx("h3",{children:"Properties"}),e.jsx("span",{className:"element-type",children:r.type})]}),e.jsxs("div",{className:"panel-content",children:[mt(),Ft(),r.type==="text"&&it(),rt.includes(r.type)&&J(),r.type==="image"&&V(),r.type==="horizontalLine"&&R(),O(),nt(),e.jsx("div",{className:"property-group",children:e.jsxs("button",{className:"toggle-advanced",onClick:()=>Q(!H),children:[H?"Hide":"Show"," Advanced Options"]})})]})]})},Co=({elements:r,selectedElement:a,onSelectElement:s,onMoveLayer:n,onDeleteElement:l,theme:h})=>{const f=(C,E)=>{switch(C){case"text":return"T";case"rectangle":return"▭";case"circle":return"●";case"triangle":return"▲";case"star":return"★";case"arrow":return"➤";case"diamond":return"◆";case"hexagon":return"⬡";case"pentagon":return"⬟";case"heart":return"♥";case"oval":return"⬭";case"roundedRectangle":return"▢";case"horizontalLine":return"―";case"image":return"🖼";case"qrcode":return"⬚";case"barcode":return"|||";case"sticker":return"🎭";case"embroidery":return"🧵";default:return"?"}},k=C=>{var E,N;if(C.type==="text")return C.isIcon&&C.iconData?`Icon: ${C.iconData.name}`:((E=C.text)==null?void 0:E.substring(0,20))+(((N=C.text)==null?void 0:N.length)>20?"...":"")||"Text";if(C.type==="qrcode")return`QR Code: ${(C.data||"").substring(0,15)+((C.data||"").length>15?"...":"")}`;if(C.type==="barcode"){const M=C.format||"CODE128",v=C.data||"";return`Barcode (${M}): ${v.substring(0,10)+(v.length>10?"...":"")}`}return C.type==="sticker"?`Sticker: ${(C.name||"Untitled").substring(0,15)}`:C.type==="embroidery"?`Embroidery: ${(C.name||"Design").substring(0,15)}`:C.type.charAt(0).toUpperCase()+C.type.slice(1)};return e.jsxs("div",{className:"layers-panel",children:[e.jsxs("div",{className:"panel-header",children:[e.jsx("h3",{children:"Layers"}),e.jsx("span",{className:"layer-count",children:r.length})]}),e.jsx("div",{className:"layers-list",children:r.length===0?e.jsx("div",{className:"no-layers",children:"No elements added yet"}):[...r].reverse().map((C,E)=>e.jsxs("div",{className:`layer-item ${(a==null?void 0:a.id)===C.id?"selected":""}`,onClick:()=>s(C),children:[e.jsxs("div",{className:"layer-info",children:[e.jsx("span",{className:"layer-icon",children:f(C.type)}),e.jsx("span",{className:"layer-name",children:k(C)})]}),e.jsxs("div",{className:"layer-controls",children:[e.jsx("button",{className:"layer-btn",onClick:N=>{N.stopPropagation(),n(C.id,"up")},disabled:E===0,title:"Move Up",children:"↑"}),e.jsx("button",{className:"layer-btn",onClick:N=>{N.stopPropagation(),n(C.id,"down")},disabled:E===r.length-1,title:"Move Down",children:"↓"}),e.jsx("button",{className:"layer-btn delete",onClick:N=>{N.stopPropagation(),l(C.id)},title:"Delete",children:"×"})]})]},C.id))})]})};let pi=null;function jo(){if(pi)return pi;if(typeof document>"u")return null;const r=document.createElement("canvas");r.width=6,r.height=6;const a=r.getContext("2d");return a.strokeStyle="rgba(255,255,255,0.34)",a.lineWidth=1.7,a.lineCap="round",a.beginPath(),a.moveTo(-2,8),a.lineTo(8,-2),a.stroke(),a.strokeStyle="rgba(0,0,0,0.16)",a.lineWidth=1.1,a.beginPath(),a.moveTo(1.5,8),a.lineTo(8,1.5),a.stroke(),pi=r,r}function yi(r){return r?(r.productionMethods||[]).map(s=>String(s).toUpperCase()).includes("EMBROIDERY")||r.supportsEmbroidery==="Y":!1}function $e(r,a,s,{fontSize:n=20,color:l="#1f6feb"}={}){const h=So(l||"#1f6feb"),f=r.globalAlpha===void 0?1:r.globalAlpha,k=(()=>{const C=jo();try{return C?r.createPattern(C,"repeat"):null}catch{return null}})();r.save(),r.shadowColor="rgba(0,0,0,0.40)",r.shadowBlur=Math.max(1,n*.05),r.shadowOffsetX=.4,r.shadowOffsetY=Math.max(.8,n*.06),r.fillStyle=h,r.fillText(a,0,s),r.restore(),r.save(),r.fillStyle=h,r.fillText(a,0,s),k&&(r.globalAlpha=f*.85,r.fillStyle=k,r.fillText(a,0,s),r.globalAlpha=f),r.lineJoin="round",r.lineWidth=Math.max(1,n*.05),r.strokeStyle="rgba(28,16,8,0.55)",r.setLineDash&&r.setLineDash([Math.max(2,n*.13),Math.max(1.5,n*.1)]),r.strokeText(a,0,s),r.setLineDash&&r.setLineDash([]),r.restore()}class Fo{constructor(){this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d")}_prepareCanvas(a,s,n=1){const l=n>0?n:1;this.canvas.width=Math.round(a*l),this.canvas.height=Math.round(s*l),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.setTransform(l,0,0,l,0,0),this.ctx.imageSmoothingEnabled=!0,this.ctx.imageSmoothingQuality="high"}async exportAllSections(a,s,n,l,h="png",f=!0,k=null,C=1){const E={};try{const N=[];for(const M of s){const v=a[M.id||M.sectionName];((v==null?void 0:v.elements)||[]).forEach(B=>{B&&B.type==="text"&&B.fontFamily&&N.push(B.fontFamily)})}await Ci(N),typeof document<"u"&&document.fonts&&document.fonts.ready&&await document.fonts.ready}catch{}for(const N of s){const M=N.id||N.sectionName,v=a[M];if(!v||!v.elements||v.elements.length===0){console.log(`Skipping section ${M} - no elements`);continue}if(this._prepareCanvas(n,l,C),f){const I=N.image||N.sectionImage;if(I)try{const H=await this.loadImage(I);this.ctx.drawImage(H,0,0,n,l)}catch(H){console.warn("Failed to load background image:",H)}}for(const I of v.elements)await this.drawElement(I);const B=this.canvas.toDataURL(`image/${h}`,h==="jpeg"?.9:void 0);E[M]={dataUrl:B,blob:await this.dataUrlToBlob(B)}}return E}async downloadExports(a,s="design"){const n=Object.keys(a);if(n.length===0){alert("No designs to export");return}if(n.length===1){const l=n[0],{blob:h}=a[l],f=URL.createObjectURL(h),k=document.createElement("a");k.href=f,k.download=`${s}-${l}.png`,document.body.appendChild(k),k.click(),document.body.removeChild(k),URL.revokeObjectURL(f)}else for(const l of n){const{blob:h}=a[l],f=URL.createObjectURL(h),k=document.createElement("a");k.href=f,k.download=`${s}-${l}.png`,document.body.appendChild(k),k.click(),document.body.removeChild(k),URL.revokeObjectURL(f),await new Promise(C=>setTimeout(C,100))}}async loadImage(a){return new Promise((s,n)=>{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>s(l),l.onerror=n,l.src=a})}getLuma(a,s,n){return(.2126*a+.7152*s+.0722*n)/255}async processImageColor(a,s){const n=document.createElement("canvas"),l=n.getContext("2d");n.width=a.width,n.height=a.height,l.clearRect(0,0,n.width,n.height),l.drawImage(a,0,0);const h=l.getImageData(0,0,n.width,n.height),f=h.data,k=this.hexToRgb(s);if(!k){console.warn("Invalid target color:",s);return}const{r:C,g:E,b:N}=k;for(let M=0;M<f.length;M+=4){if(f[M+3]===0)continue;const B=this.getLuma(f[M],f[M+1],f[M+2]);f[M]=Math.round(C*B),f[M+1]=Math.round(E*B),f[M+2]=Math.round(N*B)}return l.putImageData(h,0,0),this.processedImage=new Image,new Promise(M=>{this.processedImage.onload=()=>{M()},this.processedImage.onerror=()=>{console.error("Failed to create processed image"),M()},this.processedImage.src=n.toDataURL("image/png")})}async drawElement(a){this.ctx.save();const s=a.x+a.width/2,n=a.y+a.height/2;switch(this.ctx.translate(s,n),a.rotation&&this.ctx.rotate(a.rotation*Math.PI/180),this.ctx.translate(-a.width/2,-a.height/2),a.type){case"text":this.drawText(a);break;case"rectangle":this.drawRectangle(a);break;case"circle":this.drawCircle(a);break;case"triangle":this.drawTriangle(a);break;case"star":this.drawStar(a);break;case"arrow":this.drawArrow(a);break;case"diamond":this.drawDiamond(a);break;case"hexagon":this.drawHexagon(a);break;case"pentagon":this.drawPentagon(a);break;case"heart":this.drawHeart(a);break;case"oval":this.drawOval(a);break;case"roundedRectangle":this.drawRoundedRectangle(a);break;case"qrcode":await this.drawQRCode(a);break;case"barcode":await this.drawBarcode(a);break;case"horizontalLine":this.drawHorizontalLine(a);break;case"sticker":await this.drawSticker(a);break;case"embroidery":await this.drawEmbroidery(a);break;case"image":await this.drawImage(a);break}this.ctx.restore()}drawText(a){let s=a.text||"Text";switch(a.textTransform){case"uppercase":s=s.toUpperCase();break;case"lowercase":s=s.toLowerCase();break;case"capitalize":s=s.replace(/\b\w/g,f=>f.toUpperCase());break}this.ctx.font=`${a.fontStyle||"normal"} ${a.fontWeight||"normal"} ${a.fontSize||20}px ${a.fontFamily||"Arial"}`,this.ctx.letterSpacing=`${a.letterSpacing||0}px`,this.ctx.fillStyle=a.fill||"#000000",this.ctx.textAlign=a.textAlign||"left",this.ctx.textBaseline="top",a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth);const n=s.split(`
53
+ `),l=(a.fontSize||20)*(a.lineHeight||1.2),h=this.embroidery&&a.type==="text"&&!a.isIcon;if(a.curve&&Math.abs(a.curve)>=1){const f=Math.max(...n.map(k=>this.ctx.measureText(k).width));this.drawCurvedText(a,n.join(" "),f,h);return}n.forEach((f,k)=>{const C=k*l;h?$e(this.ctx,f,C,{fontSize:a.fontSize||20,color:a.fill||"#000000"}):(a.stroke&&a.strokeWidth>0&&this.ctx.strokeText(f,0,C),this.ctx.fillText(f,0,C))})}drawCurvedText(a,s,n,l=!1){const h=this.ctx,f=Array.from(s);if(f.length===0)return;const k=a.fontSize||20,C=f.map(j=>h.measureText(j).width),E=C.reduce((j,it)=>j+it,0)||1,N=Math.max(1e-4,Math.abs(a.curve)*Math.PI/180),M=E/N,v=a.curve>=0?1:-1,B=(n||E)/2,I=v*M+k/2,H=a.stroke&&a.strokeWidth>0,Q=typeof a.textDecoration=="string"?a.textDecoration:"",z={underline:Q.includes("underline")||!!a.underline,overline:Q.includes("overline")||!!a.overline,strike:Q.includes("line-through")||!!a.strikethrough},T=z.underline||z.overline||z.strike,S=a.decorationColor||a.fill||"#000000",L=Math.max(1,k/20);h.textAlign="center",h.textBaseline="middle",h.save(),h.translate(B,I),h.rotate(-v*N/2);for(let j=0;j<f.length;j++){const it=C[j]/M;if(h.rotate(v*it/2),h.save(),h.translate(0,-v*M),l?$e(h,f[j],0,{fontSize:k,color:a.fill||"#000000"}):(H&&h.strokeText(f[j],0,0),h.fillText(f[j],0,0)),T){const J=C[j];h.strokeStyle=S,h.lineWidth=L,h.setLineDash&&h.setLineDash([]),z.underline&&(h.beginPath(),h.moveTo(-J/2,k/2+2),h.lineTo(J/2,k/2+2),h.stroke()),z.overline&&(h.beginPath(),h.moveTo(-J/2,-(k/2+2)),h.lineTo(J/2,-(k/2+2)),h.stroke()),z.strike&&(h.beginPath(),h.moveTo(-J/2,0),h.lineTo(J/2,0),h.stroke())}h.restore(),h.rotate(v*it/2)}h.restore()}drawRectangle(a){a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fillRect(0,0,a.width,a.height)),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.strokeRect(0,0,a.width,a.height))}drawCircle(a){const s=Math.min(a.width,a.height)/2,n=a.width/2,l=a.height/2;this.ctx.beginPath(),this.ctx.arc(n,l,s,0,2*Math.PI),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawTriangle(a){const s=a.width/2;this.ctx.beginPath(),this.ctx.moveTo(s,0),this.ctx.lineTo(0,a.height),this.ctx.lineTo(a.width,a.height),this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawStar(a){const s=a.width/2,n=a.height/2,l=Math.min(a.width,a.height)/2,h=l*.4,f=a.numPoints||5;this.ctx.beginPath();for(let k=0;k<f*2;k++){const C=k%2===0?l:h,E=k*Math.PI/f,N=s+Math.cos(E)*C,M=n+Math.sin(E)*C;k===0?this.ctx.moveTo(N,M):this.ctx.lineTo(N,M)}this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawArrow(a){const s=a.width,n=a.height,l=s*.3;this.ctx.beginPath(),this.ctx.moveTo(s/2,0),this.ctx.lineTo(s,n*.6),this.ctx.lineTo(s-l,n*.6),this.ctx.lineTo(s-l,n),this.ctx.lineTo(l,n),this.ctx.lineTo(l,n*.6),this.ctx.lineTo(0,n*.6),this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}async dataUrlToBlob(a){return new Promise(s=>{const n=document.createElement("canvas"),l=n.getContext("2d"),h=new Image;h.onload=()=>{n.width=h.width,n.height=h.height,l.drawImage(h,0,0),n.toBlob(s)},h.src=a})}hexToRgb(a){const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return s?{r:parseInt(s[1],16),g:parseInt(s[2],16),b:parseInt(s[3],16)}:null}drawDiamond(a){const s=a.width/2,n=a.height/2;this.ctx.beginPath(),this.ctx.moveTo(s,0),this.ctx.lineTo(a.width,n),this.ctx.lineTo(s,a.height),this.ctx.lineTo(0,n),this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawHexagon(a){const s=a.width/2,n=a.height/2,l=Math.min(a.width,a.height)/2,h=6;this.ctx.beginPath();for(let f=0;f<h;f++){const k=f*2*Math.PI/h-Math.PI/2,C=s+l*Math.cos(k),E=n+l*Math.sin(k);f===0?this.ctx.moveTo(C,E):this.ctx.lineTo(C,E)}this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawPentagon(a){const s=a.width/2,n=a.height/2,l=Math.min(a.width,a.height)/2,h=5;this.ctx.beginPath();for(let f=0;f<h;f++){const k=f*2*Math.PI/h-Math.PI/2,C=s+l*Math.cos(k),E=n+l*Math.sin(k);f===0?this.ctx.moveTo(C,E):this.ctx.lineTo(C,E)}this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawHeart(a){const s=a.width,n=a.height,l=0,h=0;this.ctx.beginPath();const f=n*.3;this.ctx.moveTo(l+s/2,h+f),this.ctx.bezierCurveTo(l+s/2,h,l,h,l,h+f),this.ctx.bezierCurveTo(l,h+(n+f)/2,l+s/2,h+(n+f)/2,l+s/2,h+n),this.ctx.bezierCurveTo(l+s/2,h+(n+f)/2,l+s,h+(n+f)/2,l+s,h+f),this.ctx.bezierCurveTo(l+s,h,l+s/2,h,l+s/2,h+f),this.ctx.closePath(),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawOval(a){const s=a.width/2,n=a.height/2,l=a.width/2,h=a.height/2;this.ctx.beginPath(),this.ctx.ellipse(s,n,l,h,0,0,2*Math.PI),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawRoundedRectangle(a){const s=Math.min(a.width,a.height)*.1;this.drawRoundedRect(0,0,a.width,a.height,s),a.fill&&a.fill!=="transparent"&&(this.ctx.fillStyle=a.fill,this.ctx.fill()),a.stroke&&a.strokeWidth>0&&(this.ctx.strokeStyle=a.stroke,this.ctx.lineWidth=a.strokeWidth,this.ctx.stroke())}drawRoundedRect(a,s,n,l,h){this.ctx.beginPath(),this.ctx.moveTo(a+h,s),this.ctx.lineTo(a+n-h,s),this.ctx.quadraticCurveTo(a+n,s,a+n,s+h),this.ctx.lineTo(a+n,s+l-h),this.ctx.quadraticCurveTo(a+n,s+l,a+n-h,s+l),this.ctx.lineTo(a+h,s+l),this.ctx.quadraticCurveTo(a,s+l,a,s+l-h),this.ctx.lineTo(a,s+h),this.ctx.quadraticCurveTo(a,s,a+h,s),this.ctx.closePath()}async drawQRCode(a){if(a.imageObject)this.ctx.drawImage(a.imageObject,0,0,a.width,a.height);else if(a.src)try{const s=await this.loadImage(a.src);this.ctx.drawImage(s,0,0,a.width,a.height)}catch(s){console.warn("Failed to load QR code image for export:",s),this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("QR Error",a.width/2,a.height/2)}else this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("No QR Data",a.width/2,a.height/2)}async drawBarcode(a){if(a.imageObject)this.ctx.drawImage(a.imageObject,0,0,a.width,a.height);else if(a.src)try{const s=await this.loadImage(a.src);this.ctx.drawImage(s,0,0,a.width,a.height)}catch(s){console.warn("Failed to load barcode image for export:",s),this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Barcode Error",a.width/2,a.height/2)}else this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("No Barcode Data",a.width/2,a.height/2)}drawHorizontalLine(a){this.ctx.save(),a.opacity!==void 0&&(this.ctx.globalAlpha=a.opacity),this.ctx.strokeStyle=a.stroke||a.fill||"#000000",this.ctx.lineWidth=a.strokeWidth||a.height||2,this.ctx.lineCap="round",this.ctx.beginPath(),this.ctx.moveTo(0,a.height/2),this.ctx.lineTo(a.width,a.height/2),this.ctx.stroke(),this.ctx.restore()}async drawSticker(a){try{let s=null;if(a.imageObject)s=a.imageObject;else if(a.imageData)s=a.imageData;else if(a.src||a.image){const n=a.src||a.image;s=await this.loadImage(n)}else a.data&&a.data.image&&(s=await this.loadImage(a.data.image));s?(a.opacity!==void 0&&(this.ctx.globalAlpha=a.opacity),this.ctx.drawImage(s,0,0,a.width,a.height)):(this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Sticker",a.width/2,a.height/2))}catch(s){console.warn("Failed to draw sticker:",s),this.ctx.fillStyle="#ffebee",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#f44336",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#f44336",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Error",a.width/2,a.height/2)}}async drawEmbroidery(a){try{let s=null;if(a.imageObject)s=a.imageObject;else if(a.imageData)s=a.imageData;else if(a.src||a.image){const n=a.src||a.image;s=await this.loadImage(n)}else a.data&&a.data.image&&(s=await this.loadImage(a.data.image));s?(a.opacity!==void 0&&(this.ctx.globalAlpha=a.opacity),this.ctx.drawImage(s,0,0,a.width,a.height)):(this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Embroidery",a.width/2,a.height/2))}catch(s){console.warn("Failed to draw embroidery:",s),this.ctx.fillStyle="#ffebee",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#f44336",this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#f44336",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Error",a.width/2,a.height/2)}}async drawImage(a){try{let s=null;if(a.imageObject&&a.imageObject instanceof HTMLImageElement)s=a.imageObject;else if(a.imageData){if(a.imageData instanceof HTMLImageElement)s=a.imageData;else if(typeof a.imageData=="string")try{s=await this.loadImage(a.imageData)}catch(n){console.warn("Failed to load image from imageData URL:",a.imageData,n),s=await this.loadImageWithFallback(a.imageData)}}else if(a.src)try{s=await this.loadImage(a.src)}catch(n){console.warn("Failed to load image from src:",a.src,n),s=await this.loadImageWithFallback(a.src)}else if(a.image)try{s=await this.loadImage(a.image)}catch(n){console.warn("Failed to load image from image property:",a.image,n),s=await this.loadImageWithFallback(a.image)}s?(a.opacity!==void 0&&(this.ctx.globalAlpha=a.opacity),this.ctx.drawImage(s,0,0,a.width,a.height)):this.drawImagePlaceholder(a)}catch(s){console.error("Failed to draw image element:",s),this.drawImagePlaceholder(a)}}async loadImageWithFallback(a){return new Promise(s=>{const n=new Image;n.onload=()=>s(n),n.onerror=()=>{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>s(l),l.onerror=()=>{console.warn("All image loading attempts failed for:",a),s(null)},l.src=a},n.src=a})}drawImagePlaceholder(a){this.ctx.fillStyle="#f0f0f0",this.ctx.fillRect(0,0,a.width,a.height),this.ctx.strokeStyle="#ccc",this.ctx.lineWidth=2,this.ctx.strokeRect(0,0,a.width,a.height),this.ctx.fillStyle="#666",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Image",a.width/2,a.height/2-8),this.ctx.fillText("Not Found",a.width/2,a.height/2+8)}async blobToFile(a,s,n="image/png"){return new File([a],s,{type:n,lastModified:Date.now()})}async exportAllSectionsAsJSON(a,s,n,l,h="png",f=null,k=1){var I,H;const C=[],E=[],N=Math.min(k,2),M={};for(const Q of s){const z=Q.sectionName,T=a[z];if(!T||!T.elements||T.elements.length===0){console.log(`Skipping section ${z} - no elements`);continue}const S=Q.image||Q.sectionImage,L={...T,backgroundImage:S,sectionImage:S,sectionName:z,selectedColor:T.selectedColor||"#FFFFFF",canvasWidth:n,canvasHeight:l};M[z]=L;const j=await this.exportSectionAsBlob(T,Q,n,l,h,!0,f,N);if(j){const J=await this.blobToFile(j,`${z}-full.${h}`,`image/${h}`);C.push({sectionName:z,sectionImage:J})}const it=await this.exportSectionAsBlob(T,Q,n,l,h,!1,f,k);if(it){const J=await this.blobToFile(it,`${z}-print.${h}`,`image/${h}`);E.push({sectionName:z,sectionImage:J})}}const v=((I=s[0])==null?void 0:I.image)||((H=s[0])==null?void 0:H.sectionImage),B={sections:M,canvasWidth:n,canvasHeight:l,sectionImage:v,format:h,timestamp:new Date().toISOString(),version:"1.0",...f&&{initData:{sectionImage:f.sectionImage,sections:f.sections?Object.keys(f.sections):[]}},product:{sections:s.map(Q=>({sectionName:Q.sectionName||Q.id,sectionImage:Q.image||Q.sectionImage,id:Q.id||Q.sectionName}))}};return{fullDesign:C,printReady:E,designFile:JSON.stringify(B)}}async exportSectionAsBlob(a,s,n,l,h="png",f=!0,k=null,C=1){try{if(this._prepareCanvas(n,l,C),f){const E=s.image||s.sectionImage;if(E)try{const N=await this.loadImage(E);this.ctx.drawImage(N,0,0,n,l)}catch(N){console.warn("Failed to load background image:",N)}}for(const E of a.elements)await this.drawElement(E);return new Promise(E=>{this.canvas.toBlob(E,`image/${h}`,h==="jpeg"?.9:void 0)})}catch(E){return console.error("Error exporting section as blob:",E),null}}async exportCurrentSectionAsJSON(a,s="png",n=null,l=1){var H,Q,z;const h=Math.min(l,2),f=((H=a.activeSection)==null?void 0:H.sectionName)||"main",k=((Q=a.activeSection)==null?void 0:Q.sectionImage)||((z=a.activeSection)==null?void 0:z.image),C={elements:a.elements,selectedColor:a.selectedColor,canvasWidth:a.canvasWidth,canvasHeight:a.canvasHeight,backgroundImage:k,sectionImage:k,sectionName:f,zoomLevel:a.zoomLevel,showGrid:a.showGrid,snapToGrid:a.snapToGrid},E={id:f,sectionName:f,image:k,sectionImage:k},N=[],M=[],v=await this.exportSectionAsBlob(C,E,a.canvasWidth,a.canvasHeight,s,!0,n,h);if(v){const T=await this.blobToFile(v,`${f}-full.${s}`,`image/${s}`);N.push({sectionName:f,sectionImage:T})}const B=await this.exportSectionAsBlob(C,E,a.canvasWidth,a.canvasHeight,s,!1,n,l);if(B){const T=await this.blobToFile(B,`${f}-print.${s}`,`image/${s}`);M.push({sectionName:f,sectionImage:T})}const I={sections:{[f]:C},canvasWidth:a.canvasWidth,canvasHeight:a.canvasHeight,sectionImage:k,format:s,timestamp:new Date().toISOString(),version:"1.0",...n&&{initData:{sectionImage:n.sectionImage,sections:n.sections?Object.keys(n.sections):[]}},productInfo:{sections:[{sectionName:f,sectionImage:k,id:f}]}};return{fullDesign:N,printReady:M,designFile:JSON.stringify(I)}}}const No=["rectangle","circle","triangle","star","heart","diamond","hexagon","pentagon","oval","roundedRectangle"];function zo(r){const a=Array.isArray(r)?r:[],s=[];a.some(l=>l&&l.type==="text"&&!l.isIcon&&(l.fontSize||20)<14)&&s.push("Small text may not stitch cleanly — keep letters bold and reasonably large."),a.some(l=>l&&(l.type==="image"||l.type==="sticker"))&&s.push("Photos & gradients can’t be embroidered — they’ll be simplified to solid thread colours.");const n=new Set;return a.forEach(l=>{l&&(l.type==="text"||No.includes(l.type))&&l.fill&&n.add(String(l.fill).toLowerCase())}),n.size>8&&s.push(`Your design uses ${n.size} colours — more thread colours can increase the price.`),s}class To{constructor(a="localStorage"){this.storage=a==="sessionStorage"?sessionStorage:localStorage,this.STORAGE_PREFIX="mypixia_canvas_",this.DESIGNS_LIST_KEY="mypixia_saved_designs"}saveDesign(a,s){var n;try{const l=this.generateDesignId(a),h=new Date().toISOString(),f={id:l,name:a,timestamp:h,version:"1.0",canvasData:{elements:s.elements||[],canvasWidth:s.canvasWidth||800,canvasHeight:s.canvasHeight||600,selectedColor:s.selectedColor||"#FF0000",activeSection:s.activeSection||null,product:s.product||null,sectionDesigns:s.sectionDesigns||{},zoomLevel:s.zoomLevel||1,showGrid:s.showGrid||!1,snapToGrid:s.snapToGrid||!0},metadata:{elementCount:((n=s.elements)==null?void 0:n.length)||0,lastModified:h,thumbnail:s.thumbnail||null}};return this.storage.setItem(this.STORAGE_PREFIX+l,JSON.stringify(f)),this.updateDesignsList(l,a,h),{success:!0,designId:l,message:"Design saved successfully"}}catch(l){return console.error("Error saving design:",l),{success:!1,error:l.message}}}loadDesign(a){try{let s=a;if(!a.startsWith("design_")){const f=this.getAllDesigns().find(k=>k.name===a);if(!f)return{success:!1,error:"Design not found"};s=f.id}const n=this.storage.getItem(this.STORAGE_PREFIX+s);return n?{success:!0,data:JSON.parse(n)}:{success:!1,error:"Design not found"}}catch(s){return console.error("Error loading design:",s),{success:!1,error:s.message}}}getAllDesigns(){try{const a=this.storage.getItem(this.DESIGNS_LIST_KEY);return a?JSON.parse(a):[]}catch(a){return console.error("Error getting designs list:",a),[]}}deleteDesign(a){try{this.storage.removeItem(this.STORAGE_PREFIX+a);const n=this.getAllDesigns().filter(l=>l.id!==a);return this.storage.setItem(this.DESIGNS_LIST_KEY,JSON.stringify(n)),{success:!0,message:"Design deleted successfully"}}catch(s){return console.error("Error deleting design:",s),{success:!1,error:s.message}}}exportDesignAsFile(a){try{const s=this.loadDesign(a);if(!s.success)return s;const n=s.data,l=JSON.stringify(n,null,2),h=new Blob([l],{type:"application/json"}),f=URL.createObjectURL(h),k=document.createElement("a");return k.href=f,k.download=`${n.name}_${n.id}.json`,document.body.appendChild(k),k.click(),document.body.removeChild(k),URL.revokeObjectURL(f),{success:!0,message:"Design exported successfully"}}catch(s){return console.error("Error exporting design:",s),{success:!1,error:s.message}}}importDesignFromFile(a){return new Promise(s=>{try{const n=new FileReader;n.onload=l=>{try{const h=JSON.parse(l.target.result);if(!this.validateDesignData(h)){s({success:!1,error:"Invalid design file format"});return}const f=this.generateDesignId(h.name+"_imported");h.id=f,h.name+="_imported",h.timestamp=new Date().toISOString(),h.metadata.lastModified=h.timestamp,this.storage.setItem(this.STORAGE_PREFIX+f,JSON.stringify(h)),this.updateDesignsList(f,h.name,h.timestamp),s({success:!0,data:h,message:"Design imported successfully"})}catch{s({success:!1,error:"Failed to parse design file"})}},n.readAsText(a)}catch(n){s({success:!1,error:n.message})}})}autoSave(a,s){const n=this.STORAGE_PREFIX+"autosave_"+a;try{const l={timestamp:new Date().toISOString(),canvasData:s};return this.storage.setItem(n,JSON.stringify(l)),!0}catch(l){return console.error("Auto-save failed:",l),!1}}loadAutoSave(a){const s=this.STORAGE_PREFIX+"autosave_"+a;try{const n=this.storage.getItem(s);return n?JSON.parse(n):null}catch(n){return console.error("Failed to load auto-save:",n),null}}clearAutoSave(a){const s=this.STORAGE_PREFIX+"autosave_"+a;this.storage.removeItem(s)}getStorageInfo(){const a=this.getAllDesigns();let s=0;return a.forEach(n=>{const l=this.storage.getItem(this.STORAGE_PREFIX+n.id);l&&(s+=new Blob([l]).size)}),{designCount:a.length,totalSize:s,totalSizeFormatted:this.formatBytes(s),storageLimit:this.getStorageLimit()}}clearAllDesigns(){try{return this.getAllDesigns().forEach(s=>{this.storage.removeItem(this.STORAGE_PREFIX+s.id)}),this.storage.removeItem(this.DESIGNS_LIST_KEY),{success:!0,message:"All designs cleared"}}catch(a){return{success:!1,error:a.message}}}generateDesignId(a){const s=Date.now(),n=Math.random().toString(36).substring(2,8);return`design_${s}_${n}`}updateDesignsList(a,s,n){const l=this.getAllDesigns(),h=l.findIndex(k=>k.id===a),f={id:a,name:s,timestamp:n,lastModified:n};h>=0?l[h]=f:l.push(f),l.sort((k,C)=>new Date(C.timestamp)-new Date(k.timestamp)),this.storage.setItem(this.DESIGNS_LIST_KEY,JSON.stringify(l))}validateDesignData(a){return a&&a.id&&a.name&&a.canvasData&&Array.isArray(a.canvasData.elements)}formatBytes(a){if(a===0)return"0 Bytes";const s=1024,n=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(a)/Math.log(s));return parseFloat((a/Math.pow(s,l)).toFixed(2))+" "+n[l]}getStorageLimit(){try{if("storage"in navigator&&"estimate"in navigator.storage)return navigator.storage.estimate().then(a=>a.quota)}catch{console.warn("Unable to estimate storage quota")}return"Unknown"}}const Mo=(r,a)=>{let s;return function(...l){const h=()=>{clearTimeout(s),r(...l)};clearTimeout(s),s=setTimeout(h,a)}},Pe=[{key:"make-it-yours",title:"Make it yours",body:"Add your text, upload a logo, or drag artwork straight onto the product to bring your design to life."},{key:"start-creating",title:"Start creating",body:"Drop in your logo, type a slogan, or add artwork — your custom product takes shape as you go."},{key:"design-in-seconds",title:"Design yours in seconds",body:"Add text or upload an image to get started — no design skills needed."}],na=p.forwardRef((r,a)=>{var _i;const{theme:s={primaryColor:"#000000",secondaryColor:"#cf7e52",tertiaryColor:"#FFFFFF"},readOnly:n=!1,mode:l="design",initialColor:h,product:f={name:"Premium Crew Neck T-Shirt",category:"Tshirts",description:"Men's crew neck t-shirts",plainColor:"N",mainImage:"https://static.mypixia.com/dev/products/7/e011a73a-f20a-489b-bea8-91a23da56fc4.png",colorSettings:["#FF0000","#0000FF","#008000","#000000","#FFFFFF","#808080","#FFFF00"],sections:[{sectionName:"Front",sectionImage:"https://static.mypixia.com/prod/products/96ca4acb-c426-4619-a2c4-7acd95b78451.png"},{sectionName:"Sleeve-left",sectionImage:"https://static.mypixia.com/prod/products/27b8c138-af4e-4ea0-833d-88b10fbd3cf7.png"},{sectionName:"Back",sectionImage:"https://static.mypixia.com/prod/products/d4c53776-7b7d-41c5-a6b5-2bf5876cd26e.png"}]},initFile:k,initDesignContent:C,printConfig:E,aiEnabled:N=!0,aiEndpoint:M,onAIImageGenerate:v,isAuthenticated:B=!0,onRequireAuth:I,onRemoveBackground:H,emptyStateVariant:Q=0}=r,[z,T]=p.useState([]),[S,L]=p.useState(null),[j,it]=p.useState([]),[J,xt]=p.useState(!1),[gt,Ft]=p.useState(!1),[V,O]=p.useState(!1),[R,nt]=p.useState({x:0,y:0}),[rt,mt]=p.useState(null),[w,X]=p.useState(600),[P,u]=p.useState(600),[A,_]=p.useState(1),[at,bt]=p.useState(h||((_i=f.colorSettings)==null?void 0:_i[0])),[dt,It]=p.useState(!1),[Ct,pt]=p.useState(l!=="customize"),[jt,Pt]=p.useState(!0),[te,ve]=p.useState(!1),[ee,ie]=p.useState(l!=="customize"),wt=Ge(E),qt=wo(w,P,wt);p.useEffect(()=>{if(!S){it(i=>i.length?[]:i);return}it(i=>i.length>1&&i.includes(S.id)?i:[S.id])},[S]);const[Y,we]=p.useState(f.sections[0]),[Ot,_e]=p.useState(!1),[Ue,ne]=p.useState(!1),[Vt,ae]=p.useState({}),[Lt,ke]=p.useState([]),[Tt,oe]=p.useState(-1),[ji]=p.useState(new To("localStorage")),Dt=p.useRef(null),Ce=p.useRef(null),le=p.useRef(null),yt=p.useRef(null),ot=p.useRef({v:[],h:[]}),q=p.useRef([]),Gt=p.useRef([]),Ye=p.useRef(null),ce=p.useRef(null),de=p.useRef(null),Fi=p.useRef(null),he=p.useRef(null),_t=p.useRef(null),la=p.useRef(null),fe=p.useRef(new Fo),ca=p.useRef(!1),[ue,Ni]=p.useState(null),ut=p.useCallback(()=>{const i={elements:JSON.parse(JSON.stringify(z)),selectedElement:S?{...S}:null,timestamp:Date.now()},t=Lt.slice(0,Tt+1);t.push(i),t.length>50?t.shift():oe(Tt+1),ke(t)},[z,S,Lt,Tt]),ge=p.useCallback(()=>({elements:z,canvasWidth:w,canvasHeight:P,selectedColor:at,activeSection:Y,product:f,sectionDesigns:Vt,zoomLevel:A,showGrid:dt,snapToGrid:jt,selectedElement:S?{...S}:null,canvasRef:Dt}),[z,w,P,at,Y,f,Vt,A,dt,jt,S]),zi=i=>{if(i.sections&&typeof i.sections=="object"){const t=Object.keys(i.sections)[0],o=i.sections[t];if(o&&o.elements){T(o.elements||[]),X(o.canvasWidth||800),u(o.canvasHeight||600),bt(o.selectedColor||f.colorSettings[0]),_(o.zoomLevel||1),It(o.showGrid||!1),Pt(o.snapToGrid||!0),L(null),i.sections&&ae(i.sections);const c=f.sections.find(m=>m.sectionName===t);c&&we(c),ke([]),oe(-1),setTimeout(()=>{ut()},100);return}}};p.useEffect(()=>{const t=setTimeout(async()=>{if(z.length===0&&Lt.length<=1){if(C)try{const o=JSON.parse(C);Ni(o),zi(o)}catch(o){console.error("Error loading design file:",o),console.warn("Using default text instead")}else if(k)try{const o=await fetch(k);if(o.ok){const c=await o.text();if(c.trim()){const m=JSON.parse(c.trim());Ni(m),zi(m)}}else console.warn("Failed to load design file, using default text")}catch(o){console.error("Error loading design file:",o),console.warn("Using default text instead")}}},300);return()=>clearTimeout(t)},[k,C,f.colorSettings,f.sections]);const qe=p.useCallback((i="png",t=!0)=>{const o=ge();return f.sections,fe.current.exportAllSections({[(Y==null?void 0:Y.sectionName)||"main"]:o},[{id:(Y==null?void 0:Y.sectionName)||"main",sectionName:(Y==null?void 0:Y.sectionName)||"main",image:Y==null?void 0:Y.sectionImage,sectionImage:Y==null?void 0:Y.sectionImage}],w,P,i,t,ue,qt)},[ge,f.sections,Y,w,P,qt]),da=ia,je=20;p.useEffect(()=>{const i=()=>_e(window.innerWidth<768);return i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),p.useEffect(()=>{const i=document.createElement("canvas");i.width=w,i.height=P,la.current=i},[w,P]),p.useEffect(()=>{Lt.length===0&&ut()},[]);const Xt=(i,t,o,c,m,g)=>{i.beginPath(),i.moveTo(t+g,o),i.lineTo(t+c-g,o),i.quadraticCurveTo(t+c,o,t+c,o+g),i.lineTo(t+c,o+m-g),i.quadraticCurveTo(t+c,o+m,t+c-g,o+m),i.lineTo(t+g,o+m),i.quadraticCurveTo(t,o+m,t,o+m-g),i.lineTo(t,o+g),i.quadraticCurveTo(t,o,t+g,o),i.closePath()},Fe=(i,t)=>{if(t.type==="text"&&!t.isIcon){i.save(),i.font=`${t.fontStyle||"normal"} ${t.fontWeight||"normal"} ${t.fontSize||20}px ${t.fontFamily||"Arial"}`;try{i.letterSpacing=`${t.letterSpacing||0}px`}catch{}let et=t.text||"Text";switch(t.textTransform){case"uppercase":et=et.toUpperCase();break;case"lowercase":et=et.toLowerCase();break;case"capitalize":et=et.replace(/\b\w/g,kt=>kt.toUpperCase());break}const ht=et.split(`
54
+ `),W=Math.max(1,...ht.map(kt=>i.measureText(kt||" ").width)),lt=(t.fontSize||20)*(t.lineHeight||1.2),Mt=Math.max(t.fontSize||20,ht.length*lt);i.restore();const St=t.textAlign||"left",vt=St==="center"?t.x-W/2:St==="right"?t.x-W:t.x,Nt=t.y;return{x:vt,y:Nt,width:W,height:Mt,cx:vt+W/2,cy:Nt+Mt/2}}if(!t.isIcon)return{x:t.x,y:t.y,width:t.width,height:t.height,cx:t.x+t.width/2,cy:t.y+t.height/2};i.save(),i.font=`${t.fontStyle||""} ${t.fontWeight||""} ${t.fontSize}px ${t.fontFamily}`,i.textBaseline="alphabetic",i.textAlign="left";const o=i.measureText(t.text),c=o.actualBoundingBoxAscent??t.fontSize*.8,m=o.actualBoundingBoxDescent??t.fontSize*.2,g=o.actualBoundingBoxLeft??0,x=o.actualBoundingBoxRight??o.width,d=g+x,y=c+m,b=t.x,F=t.y,D=b-d/2-g,G=F-y/2-c;return i.restore(),{x:D,y:G,width:d,height:y,cx:b,cy:F}},ha=(i,t)=>{if(!t)return;const o=8,c=8,m=4,g=30,x=Fe(i,t),d=t.isIcon?Math.max(o,12):o,y={x:-x.width/2-d,y:-x.height/2-d,w:x.width+d*2,h:x.height+d*2};i.save(),i.translate(x.cx,x.cy),t.rotation&&i.rotate(t.rotation*Math.PI/180);const b=i.createLinearGradient(y.x,y.y,y.x+y.w,y.y+y.h);if(b.addColorStop(0,"#3b82f6"),b.addColorStop(.5,"#1d4ed8"),b.addColorStop(1,"#3b82f6"),i.strokeStyle="rgba(59,130,246,.3)",i.lineWidth=3,Xt(i,y.x-1,y.y-1,y.w+2,y.h+2,m+1),i.stroke(),i.strokeStyle=b,i.lineWidth=2,i.setLineDash([8,4]),Xt(i,y.x,y.y,y.w,y.h,m),i.stroke(),i.lineDashOffset=-(Date.now()/50)%12,i.strokeStyle="#ffffff",i.lineWidth=1,i.setLineDash([4,8]),Xt(i,y.x,y.y,y.w,y.h,m),i.stroke(),i.setLineDash([]),i.lineDashOffset=0,t.locked){i.restore();return}[{x:y.x,y:y.y},{x:y.x+y.w,y:y.y},{x:y.x+y.w,y:y.y+y.h},{x:y.x,y:y.y+y.h}].forEach(G=>{i.fillStyle="rgba(0,0,0,.2)",i.fillRect(G.x-c/2+1,G.y-c/2+1,c,c),i.fillStyle="#ffffff",i.fillRect(G.x-c/2,G.y-c/2,c,c),i.strokeStyle="#3b82f6",i.lineWidth=1,i.strokeRect(G.x-c/2,G.y-c/2,c,c)});const F=0,D=y.y-g;i.strokeStyle="#3b82f6",i.lineWidth=1,i.setLineDash([2,2]),i.beginPath(),i.moveTo(F,D+12),i.lineTo(F,y.y),i.stroke(),i.setLineDash([]),i.beginPath(),i.arc(F,D,12,0,2*Math.PI),i.fillStyle="#f59e0b",i.fill(),i.strokeStyle="#ffffff",i.lineWidth=2,i.stroke(),i.strokeStyle="#ffffff",i.lineWidth=2,i.beginPath(),i.arc(F,D,6,-Math.PI/2,Math.PI,!1),i.stroke(),i.beginPath(),i.moveTo(F-6,D),i.lineTo(F-3,D-3),i.lineTo(F-3,D+3),i.closePath(),i.fillStyle="#ffffff",i.fill(),i.restore()},fa=(i,t)=>{if(!t)return[];const o=Fe(i,t),c=t.isIcon?Math.max(8,12):8,m=8,g=30,x=(t.rotation||0)*Math.PI/180,d={x:-o.width/2-c,y:-o.height/2-c,w:o.width+c*2,h:o.height+c*2},y=[{x:d.x,y:d.y,type:"nw-resize"},{x:d.x+d.w,y:d.y,type:"ne-resize"},{x:d.x+d.w,y:d.y+d.h,type:"se-resize"},{x:d.x,y:d.y+d.h,type:"sw-resize"},{x:0,y:d.y-g,type:"rotate"}],b=Math.cos(x),F=Math.sin(x);return y.map(D=>({x:o.cx+(D.x*b-D.y*F),y:o.cy+(D.x*F+D.y*b),type:D.type,size:D.type==="rotate"?24:m}))},Ti=(i,t,o)=>{if(!o)return null;const c=Dt.current;if(!c)return null;const m=c.getContext("2d"),g=fa(m,o);for(const x of g){const d=i-x.x,y=t-x.y;if(Math.sqrt(d*d+y*y)<=x.size/2)return x.type}return null},me=p.useCallback(()=>{if(Tt>0){const i=Lt[Tt-1];T(i.elements),L(i.selectedElement),oe(Tt-1)}},[Lt,Tt]),re=p.useCallback(()=>{if(Tt<Lt.length-1){const i=Lt[Tt+1];T(i.elements),L(i.selectedElement),oe(Tt+1)}},[Lt,Tt]),Ut=i=>jt?Math.round(i/je)*je:i;p.useEffect(()=>{if(Y!=null&&Y.sectionImage){le.current=null,yt.current=null;const i=Dt.current;if(i&&i.getContext("2d").clearRect(0,0,w,P),k&&!ue)return;const t=new Image;t.crossOrigin="anonymous",t.onload=()=>{le.current=t,yt.current=t,st()},t.onerror=()=>{console.error("Failed to load background image:",Y.sectionImage),st()},t.src=Y.sectionImage}else le.current=null,yt.current=null,st()},[Y,ue]),p.useEffect(()=>{const i=t=>{const o=document.activeElement;if(!(o&&(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"||o.isContentEditable))){if((t.key==="Delete"||t.key==="Backspace")&&S&&!n){t.preventDefault();const m=S;T(g=>g.filter(x=>x.id!==m.id)),L(null),ut()}if(t.ctrlKey||t.metaKey)switch(t.key){case"z":t.shiftKey?(t.preventDefault(),re()):(t.preventDefault(),me());break;case"y":t.preventDefault(),re();break}}};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[S,n,me,re,ut]);const Et=()=>`element_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,ua=i=>{i.strokeStyle="#e0e0e0",i.lineWidth=1,i.setLineDash([1,1]);for(let t=0;t<=w;t+=je)i.beginPath(),i.moveTo(t,0),i.lineTo(t,P),i.stroke();for(let t=0;t<=P;t+=je)i.beginPath(),i.moveTo(0,t),i.lineTo(w,t),i.stroke();i.setLineDash([])},ga=(i,t)=>{i.save();const o=t.x+t.width/2,c=t.y+t.height/2;switch(i.translate(o,c),t.rotation&&i.rotate(t.rotation*Math.PI/180),i.translate(-t.width/2,-t.height/2),t.type){case"text":xa(i,t);break;case"rectangle":ba(i,t);break;case"circle":Sa(i,t);break;case"triangle":va(i,t);break;case"star":wa(i,t);break;case"arrow":ka(i,t);break;case"diamond":Ca(i,t);break;case"hexagon":ja(i,t);break;case"pentagon":Fa(i,t);break;case"heart":Na(i,t);break;case"oval":za(i,t);break;case"roundedRectangle":Ta(i,t);break;case"image":Aa(i,t);break;case"qrcode":pa(i,t);break;case"barcode":ma(i,t);break;case"sticker":Ea(i,t);break;case"horizontalLine":Ma(i,t);break;case"embroidery":Ia(i,t);break}i.restore()},ma=(i,t)=>{if(t.imageObject)i.drawImage(t.imageObject,0,0,t.width,t.height);else if(t.src&&!t.imageLoading){t.imageLoading=!0;const o=new Image;o.onload=()=>{T(c=>c.map(m=>m.id===t.id?{...m,imageObject:o,imageLoading:!1}:m))},o.onerror=()=>{T(c=>c.map(m=>m.id===t.id?{...m,imageLoading:!1}:m))},o.src=t.src,i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Your customization",t.width/2,t.height/2)}else t.imageLoading?(i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Your customization",t.width/2,t.height/2)):(i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("No Barcode",t.width/2,t.height/2))},pa=(i,t)=>{if(t.imageObject)i.drawImage(t.imageObject,0,0,t.width,t.height);else if(t.src&&!t.imageLoading){t.imageLoading=!0;const o=new Image;o.onload=()=>{T(c=>c.map(m=>m.id===t.id?{...m,imageObject:o,imageLoading:!1}:m))},o.onerror=()=>{T(c=>c.map(m=>m.id===t.id?{...m,imageLoading:!1}:m))},o.src=t.src,i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Loading QR...",t.width/2,t.height/2)}else t.imageLoading?(i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Loading QR...",t.width/2,t.height/2)):(i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("No QR Data",t.width/2,t.height/2))},ya=(i,t,o,c,m=!1)=>{const g=Array.from(t);if(g.length===0)return;const x=o.fontSize||20,d=g.map(zt=>i.measureText(zt).width),y=d.reduce((zt,Yt)=>zt+Yt,0)||1,b=Math.max(1e-4,Math.abs(o.curve)*Math.PI/180),F=y/b,D=o.curve>=0?1:-1,G=(c||y)/2,et=D*F+x/2,ht=o.stroke&&o.strokeWidth>0,W=typeof o.textDecoration=="string"?o.textDecoration:"",lt={underline:W.includes("underline")||!!o.underline,overline:W.includes("overline")||!!o.overline,strike:W.includes("line-through")||!!o.strikethrough},Mt=lt.underline||lt.overline||lt.strike,St=o.decorationColor||o.fill||"#000000",vt=Math.max(1,x/20),Nt=i.textAlign,kt=i.textBaseline;i.textAlign="center",i.textBaseline="middle",i.save(),i.translate(G,et),i.rotate(-D*b/2);for(let zt=0;zt<g.length;zt++){const Yt=d[zt]/F;if(i.rotate(D*Yt/2),i.save(),i.translate(0,-D*F),m?$e(i,g[zt],0,{fontSize:x,color:o.fill||"#000000"}):(ht&&i.strokeText(g[zt],0,0),i.fillText(g[zt],0,0)),Mt){const Bt=d[zt];i.strokeStyle=St,i.lineWidth=vt,i.setLineDash&&i.setLineDash([]),lt.underline&&(i.beginPath(),i.moveTo(-Bt/2,x/2+2),i.lineTo(Bt/2,x/2+2),i.stroke()),lt.overline&&(i.beginPath(),i.moveTo(-Bt/2,-(x/2+2)),i.lineTo(Bt/2,-(x/2+2)),i.stroke()),lt.strike&&(i.beginPath(),i.moveTo(-Bt/2,0),i.lineTo(Bt/2,0),i.stroke())}i.restore(),i.rotate(D*Yt/2)}i.restore(),i.textAlign=Nt,i.textBaseline=kt},xa=(i,t)=>{i.save();let o=t.text||"Text";if(t.textTransform)switch(t.textTransform){case"uppercase":o=o.toUpperCase();break;case"lowercase":o=o.toLowerCase();break;case"capitalize":o=o.replace(/\b\w/g,y=>y.toUpperCase());break}i.font=`${t.fontStyle||"normal"} ${t.fontWeight||"normal"} ${t.fontSize||20}px ${t.fontFamily||"Arial"}`,i.letterSpacing=`${t.letterSpacing||0}px`,i.fillStyle=t.fill||"#000000",i.textAlign=t.textAlign||"left",i.textBaseline="top",t.opacity!==void 0&&(i.globalAlpha=t.opacity),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth);const c=o.split(`
55
+ `),m=(t.fontSize||20)*(t.lineHeight||1.2),g=Math.max(...c.map(y=>i.measureText(y).width)),x=c.length*m;if(t.backgroundColor&&t.backgroundColor!=="transparent"){i.fillStyle=t.backgroundColor;const y=t.backgroundPadding||4;i.fillRect(-y,-y,g+y*2,x+y*2),i.fillStyle=t.fill||"#000000"}(t.hasTextShadow||t.textShadowColor)&&(i.shadowColor=t.textShadowColor||"rgba(0,0,0,0.5)",i.shadowBlur=t.textShadowBlur!=null?t.textShadowBlur:4,i.shadowOffsetX=t.textShadowX!=null?t.textShadowX:2,i.shadowOffsetY=t.textShadowY!=null?t.textShadowY:2);const d=yi(f)&&t.type==="text"&&!t.isIcon;if(t.curve&&Math.abs(t.curve)>=1){ya(i,c.join(" "),t,g,d),i.restore();return}c.forEach((y,b)=>{const F=b*m,D=i.measureText(y).width;d?$e(i,y,F,{fontSize:t.fontSize||20,color:t.fill||"#000000"}):(t.stroke&&t.strokeWidth>0&&i.strokeText(y,0,F),i.fillText(y,0,F));const G=t.fontSize||20,et=t.decorationColor||t.fill||"#000000",ht=Math.max(1,G/20);if(i.strokeStyle=et,i.lineWidth=ht,t.textDecoration==="underline"||t.underline){const W=F+G+2;i.beginPath(),i.moveTo(0,W),i.lineTo(D,W),i.stroke()}if(t.textDecoration==="overline"||t.overline){const W=F-2;i.beginPath(),i.moveTo(0,W),i.lineTo(D,W),i.stroke()}if(t.textDecoration==="line-through"||t.strikethrough){const W=F+G/2;i.beginPath(),i.moveTo(0,W),i.lineTo(D,W),i.stroke()}typeof t.textDecoration=="string"&&t.textDecoration.includes(" ")&&t.textDecoration.split(" ").forEach(lt=>{switch(lt.trim()){case"underline":const Mt=F+G+2;i.beginPath(),i.moveTo(0,Mt),i.lineTo(D,Mt),i.stroke();break;case"overline":const St=F-2;i.beginPath(),i.moveTo(0,St),i.lineTo(D,St),i.stroke();break;case"line-through":const vt=F+G/2;i.beginPath(),i.moveTo(0,vt),i.lineTo(D,vt),i.stroke();break}})}),i.restore()},ba=(i,t)=>{t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fillRect(0,0,t.width,t.height)),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.strokeRect(0,0,t.width,t.height))},Sa=(i,t)=>{const o=Math.min(t.width,t.height)/2,c=t.width/2,m=t.height/2;i.beginPath(),i.arc(c,m,o,0,2*Math.PI),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},va=(i,t)=>{const o=t.width/2;t.height/2,i.beginPath(),i.moveTo(o,0),i.lineTo(0,t.height),i.lineTo(t.width,t.height),i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},wa=(i,t)=>{const o=t.width/2,c=t.height/2,m=Math.min(t.width,t.height)/2,g=m*.4,x=t.numPoints||5;i.beginPath();for(let d=0;d<x*2;d++){const y=d%2===0?m:g,b=d*Math.PI/x,F=o+Math.cos(b)*y,D=c+Math.sin(b)*y;d===0?i.moveTo(F,D):i.lineTo(F,D)}i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},ka=(i,t)=>{const o=t.width,c=t.height,m=o*.3;i.beginPath(),i.moveTo(o/2,0),i.lineTo(o,c*.6),i.lineTo(o-m,c*.6),i.lineTo(o-m,c),i.lineTo(m,c),i.lineTo(m,c*.6),i.lineTo(0,c*.6),i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Ca=(i,t)=>{const o=t.width/2,c=t.height/2;i.beginPath(),i.moveTo(o,0),i.lineTo(t.width,c),i.lineTo(o,t.height),i.lineTo(0,c),i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},ja=(i,t)=>{const o=t.width/2,c=t.height/2,m=Math.min(t.width,t.height)/2,g=6;i.beginPath();for(let x=0;x<g;x++){const d=x*2*Math.PI/g-Math.PI/2,y=o+m*Math.cos(d),b=c+m*Math.sin(d);x===0?i.moveTo(y,b):i.lineTo(y,b)}i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Fa=(i,t)=>{const o=t.width/2,c=t.height/2,m=Math.min(t.width,t.height)/2,g=5;i.beginPath();for(let x=0;x<g;x++){const d=x*2*Math.PI/g-Math.PI/2,y=o+m*Math.cos(d),b=c+m*Math.sin(d);x===0?i.moveTo(y,b):i.lineTo(y,b)}i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Na=(i,t)=>{const o=t.width,c=t.height,m=0,g=0;i.beginPath();const x=c*.3;i.moveTo(m+o/2,g+x),i.bezierCurveTo(m+o/2,g,m,g,m,g+x),i.bezierCurveTo(m,g+(c+x)/2,m+o/2,g+(c+x)/2,m+o/2,g+c),i.bezierCurveTo(m+o/2,g+(c+x)/2,m+o,g+(c+x)/2,m+o,g+x),i.bezierCurveTo(m+o,g,m+o/2,g,m+o/2,g+x),i.closePath(),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},za=(i,t)=>{const o=t.width/2,c=t.height/2,m=t.width/2,g=t.height/2;i.beginPath(),i.ellipse(o,c,m,g,0,0,2*Math.PI),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Ta=(i,t)=>{const o=Math.min(t.width,t.height)*.1;Xt(i,0,0,t.width,t.height,o),t.fill&&t.fill!=="transparent"&&(i.fillStyle=t.fill,i.fill()),t.stroke&&t.strokeWidth>0&&(i.strokeStyle=t.stroke,i.lineWidth=t.strokeWidth,i.stroke())},Ma=(i,t)=>{i.save(),t.opacity!==void 0&&(i.globalAlpha=t.opacity),i.strokeStyle=t.stroke||t.fill||"#000000",i.lineWidth=t.strokeWidth||t.height||2,i.lineCap="round",i.beginPath(),i.moveTo(0,t.height/2),i.lineTo(t.width,t.height/2),i.stroke(),i.restore()},Aa=(i,t)=>{const o=t.src||t.imageData;if(o)try{if(o instanceof HTMLImageElement){if(o.complete&&o.naturalWidth>0&&o.naturalHeight>0){i.drawImage(o,0,0,t.width,t.height);return}}else if(typeof o=="string"&&o.length>0){if(t._imageElement||(t._imageElement=new Image,t._imageElement.crossOrigin="anonymous",t._imageElement.onload=()=>{st()},t._imageElement.onerror=()=>{console.error("Failed to load image:",o),t._imageLoadError=!0,st()},t._imageElement.src=o),t._imageElement.complete&&t._imageElement.naturalWidth>0&&t._imageElement.naturalHeight>0){i.drawImage(t._imageElement,0,0,t.width,t.height);return}if(t._imageLoadError){i.fillStyle="#ffebee",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#f44336",i.lineWidth=2,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#f44336",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Error loading image",t.width/2,t.height/2);return}}i.fillStyle="#f0f0f0",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ccc",i.lineWidth=1,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#666",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Your customization",t.width/2,t.height/2)}catch(c){console.error("Error drawing image:",c),i.fillStyle="#ffebee",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#f44336",i.lineWidth=2,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#f44336",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("Error loading image",t.width/2,t.height/2)}else i.fillStyle="#f8f8f8",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ddd",i.lineWidth=1,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#999",i.font="14px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("No Image",t.width/2,t.height/2)},Ea=(i,t)=>{const o=t.src;if(o)try{if(o instanceof HTMLImageElement){if(o.complete&&o.naturalWidth>0&&o.naturalHeight>0){i.drawImage(o,0,0,t.width,t.height);return}}else if(typeof o=="string"&&o.length>0){if(t._stickerElement||(t._stickerElement=new Image,t._stickerElement.crossOrigin="anonymous",t._stickerElement.onload=()=>{st()},t._stickerElement.onerror=()=>{console.error("Failed to load sticker:",o),t._stickerLoadError=!0,st()},t._stickerElement.src=o),t._stickerElement.complete&&t._stickerElement.naturalWidth>0&&t._stickerElement.naturalHeight>0){i.drawImage(t._stickerElement,0,0,t.width,t.height);return}if(t._stickerLoadError){Ne(i,t,"Failed to load",!0);return}}Ne(i,t,"Your customization")}catch(c){console.error("Error drawing sticker:",c),Ne(i,t,"Error",!0)}else Ne(i,t,"No Sticker")},Ne=(i,t,o,c=!1)=>{i.fillStyle=c?"#ffebee":"#f8f9fa",i.fillRect(0,0,t.width,t.height),i.strokeStyle=c?"#f44336":"#dee2e6",i.lineWidth=2,i.strokeRect(0,0,t.width,t.height),i.fillStyle=c?"#f44336":"#6c757d",i.font="12px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText(o,t.width/2,t.height/2)},Ia=(i,t)=>{if(t.imageObject&&t.imageObject.complete&&t.imageObject.naturalHeight!==0)try{i.drawImage(t.imageObject,0,0,t.width,t.height)}catch(o){console.error("Error drawing embroidery image:",o),pe(i,t,"Error loading image")}else if(t.src&&!t.imageLoading){t.imageLoading=!0;const o=new Image;o.crossOrigin="anonymous",o.onload=()=>{o.complete&&o.naturalHeight!==0?(t.imageObject=o,t.imageLoading=!1,st()):(t.imageLoading=!1,console.error("Image loaded but is invalid:",t.src))},o.onerror=()=>{t.imageLoading=!1,console.error("Failed to load embroidery image:",t.src),pe(i,t,"Failed to load")},o.src=t.src,pe(i,t,"Your customization")}else t.imageLoading?pe(i,t,"Your customization"):pe(i,t)},pe=(i,t,o="Embroidery")=>{i.fillStyle="#f9f9f9",i.fillRect(0,0,t.width,t.height),i.strokeStyle="#ddd",i.lineWidth=2,i.strokeRect(0,0,t.width,t.height),i.fillStyle="#999",i.font="24px Arial",i.textAlign="center",i.textBaseline="middle",i.fillText("🧵",t.width/2,t.height/2-10),i.fillStyle="#666",i.font="12px Arial",i.fillText(o,t.width/2,t.height/2+15)},Mi=(i,t,o)=>{if(!o)return!1;const c=o.x+o.width/2,m=o.y+o.height/2,g=i-c,x=t-m,d=-(o.rotation||0)*Math.PI/180,y=Math.cos(d),b=Math.sin(d),F=g*y-x*b,D=g*b+x*y,G=o.width/2,et=o.height/2;return F>=-G&&F<=G&&D>=-et&&D<=et},Ai=p.useCallback(()=>{if(_t.current){const t=_t.current;_t.current=null;const o=Math.min(t.x0,t.x1),c=Math.min(t.y0,t.y1),m=Math.abs(t.x1-t.x0),g=Math.abs(t.y1-t.y0);if(m>3&&g>3){const x=z.filter(y=>{const b=y.width||0,F=y.height||0;return y.x<o+m&&y.x+b>o&&y.y<c+g&&y.y+F>c}),d=x.map(y=>y.id);it(d),L(d.length?x[x.length-1]:null)}$t()}(J||gt||V)&&ut(),he.current=null,ot.current={v:[],h:[]},q.current=[],Gt.current=[],Ye.current=null,xt(!1),Ft(!1),O(!1),mt(null);const i=Dt.current;i&&(i.style.cursor="default")},[J,gt,V,ut,z]);p.useEffect(()=>{const i=t=>{if(n)return;const o=document.activeElement;if(o&&(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"||o.isContentEditable))return;const m=j.length>1?j:S?[S.id]:[];if((t.ctrlKey||t.metaKey)&&(t.key==="z"&&!t.shiftKey?(t.preventDefault(),me()):(t.key==="z"&&t.shiftKey||t.key==="y")&&(t.preventDefault(),re())),t.key==="Delete"||t.key==="Backspace"){const g=m.filter(x=>{const d=z.find(y=>y.id===x);return d&&!d.locked});g.length&&(T(x=>x.filter(d=>!g.includes(d.id))),L(null),it([]),ut(),t.preventDefault())}if((t.ctrlKey||t.metaKey)&&t.key==="d"&&S&&(Ze(S.id),t.preventDefault()),t.key==="Escape"&&(S||m.length)&&(L(null),it([]),t.preventDefault()),(t.ctrlKey||t.metaKey)&&t.key==="c"&&m.length&&(Fi.current=m.map(g=>z.find(x=>x.id===g)).filter(Boolean).map(g=>({...g})),t.preventDefault()),(t.ctrlKey||t.metaKey)&&t.key==="v"){const g=Fi.current;if(g&&g.length){const x=g.map(d=>({...d,id:Et(),x:(d.x||0)+20,y:(d.y||0)+20}));T(d=>[...d,...x]),it(x.length>1?x.map(d=>d.id):[]),L(x[x.length-1]),ut(),t.preventDefault()}}if(m.length&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(t.key)){t.preventDefault();const g=t.shiftKey?10:1;let x=0,d=0;switch(t.key){case"ArrowUp":d=-g;break;case"ArrowDown":d=g;break;case"ArrowLeft":x=-g;break;case"ArrowRight":x=g;break}const y=m.filter(b=>{const F=z.find(D=>D.id===b);return F&&!F.locked});if(y.length)if(T(b=>b.map(F=>y.includes(F.id)?{...F,x:F.x+x,y:F.y+d}:F)),L(b=>b&&y.includes(b.id)?{...b,x:b.x+x,y:b.y+d}:b),ut(),y.length===1&&S){const b=S.x+x,F=S.y+d,D=wi(w,wt),G=et=>et>=10?Math.round(et).toString():et>=1?et.toFixed(1):et.toFixed(2);ce.current={cx:b+(S.width||0)/2,y:F+(S.height||0)+8,label:D>0?`x ${G(b*D)}" y ${G(F*D)}"`:`x ${Math.round(b)} y ${Math.round(F)}`},$t(),de.current&&clearTimeout(de.current),de.current=setTimeout(()=>{ce.current=null,$t()},1e3)}else $t()}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[S,j,z,me,re,n,w,wt]);const Xe=(i,t={})=>{const o={id:Et(),type:i,x:50,y:50,width:100,height:100,fill:"#000000",stroke:"#000000",strokeWidth:0,rotation:0,...t};switch(i){case"text":o.id=Et(),o.text=t.text||"New Text",o.fontSize=t.fontSize||20,o.fontFamily=t.fontFamily||"Arial",o.fontWeight=t.fontWeight||"normal",o.fontStyle=t.fontStyle||"normal",o.textAlign=t.textAlign||"left",o.width=t.width||150,o.height=t.height||50;break;case"icon":o.id=Et(),o.text=t.text||"🎯",o.fontSize=t.fontSize||48,o.fontFamily=t.fontFamily||"Arial",o.fontWeight=t.fontWeight||"normal",o.fontStyle=t.fontStyle||"normal",o.textAlign="center",o.width=80,o.height=80,o.iconData=t.iconData||null,o.type="text",o.isIcon=!0;break;case"image":o.id=Et(),o.imageData=t.imageData||null,o.width=t.width||200,o.height=t.height||200;break;case"qrcode":o.id=Et(),o.type="qrcode",o.x=(t==null?void 0:t.x)||w/2-((t==null?void 0:t.width)||100)/2,o.y=(t==null?void 0:t.y)||P/2-((t==null?void 0:t.height)||100)/2,o.width=(t==null?void 0:t.width)||100,o.height=(t==null?void 0:t.height)||100,o.src=(t==null?void 0:t.src)||"",o.data=(t==null?void 0:t.data)||"",o.rotation=0,o.opacity=1;break;case"barcode":o.id=Et(),o.type="barcode",o.x=(t==null?void 0:t.x)||w/2-((t==null?void 0:t.width)||200)/2,o.y=(t==null?void 0:t.y)||P/2-((t==null?void 0:t.height)||100)/2,o.width=(t==null?void 0:t.width)||200,o.height=(t==null?void 0:t.height)||100,o.src=(t==null?void 0:t.src)||"",o.data=(t==null?void 0:t.data)||"",o.format=(t==null?void 0:t.format)||"CODE128",o.rotation=0,o.opacity=1,o.imageObject=(t==null?void 0:t.imageObject)||null;break;case"sticker":o.id=Et(),o.type="sticker",o.imageData=(t==null?void 0:t.imageData)||null,o.width=t.width||200,o.height=t.height||200;break;case"horizontalLine":o.id=Et(),o.type="horizontalLine",o.x=w/2-100,o.y=P/2-1,o.width=200,o.height=2,o.fill="#000000",o.stroke="#000000",o.strokeWidth=2,o.rotation=0,o.opacity=1;break;case"embroidery":o.id=Et(),o.type="embroidery",o.imageData=(t==null?void 0:t.imageData)||null,o.width=t.width||200,o.height=t.height||200;break;case"rectangle":case"circle":case"triangle":case"star":case"arrow":case"diamond":case"hexagon":case"pentagon":case"heart":case"oval":case"roundedRectangle":break;default:console.warn(`Unknown element type: ${i}`);return}T(c=>[...c,o]),L(o),ut()},La=()=>{Xe("text",{text:"Your text",fontSize:32,width:220,height:48,x:w/2-220/2,y:P/2-48/2})},Da=()=>{const i=document.createElement("input");i.type="file",i.accept="image/*",i.onchange=t=>{const o=t.target.files&&t.target.files[0];o&&o.type.startsWith("image/")&&ei(o)},i.click()},ze=(i,t)=>{T(o=>o.map(c=>c.id===i?{...c,...t}:c)),S&&S.id===i&&L(o=>({...o,...t}))},Ei=async i=>{var g,x,d;if(!i||typeof H!="function")return;const t=i.src||i.image||(i.imageData instanceof HTMLImageElement?i.imageData.src:i.imageData)||((g=i._imageElement)==null?void 0:g.src)||((x=i._stickerElement)==null?void 0:x.src)||((d=i._embroideryElement)==null?void 0:d.src);if(!t)throw new Error("No image to process");const o=await H(t),c=typeof o=="string"?o:URL.createObjectURL(o),m=new Image;m.crossOrigin="anonymous",await new Promise((y,b)=>{m.onload=y,m.onerror=()=>b(new Error("Processed image failed to load")),m.src=c}),ze(i.id,{src:c,image:c,imageData:c,_imageElement:null,_stickerElement:null,_embroideryElement:null,_imageLoadError:!1,originalWidth:m.naturalWidth,originalHeight:m.naturalHeight,bgRemoved:!0}),ut(),st()},Qe=p.useCallback(()=>{S&&(T(i=>i.filter(t=>t.id!==S.id)),L(null),ut())},[S,ut]),Ze=i=>{const t=z.find(o=>o.id===i);if(t){const o={...t,id:Et(),x:t.x+20,y:t.y+20};T(c=>[...c,o]),L(o),ut()}},Ra=i=>{const t=i||(S==null?void 0:S.id);t&&(T(o=>o.map(c=>c.id===t?{...c,locked:!c.locked}:c)),L(o=>o&&o.id===t?{...o,locked:!o.locked}:o),ut())},Ii=i=>{if(!S||S.locked)return;const t={width:Math.max(10,(S.width||0)*i),height:Math.max(10,(S.height||0)*i)};(S.type==="text"||S.isIcon)&&(t.fontSize=Math.max(6,Math.round((S.fontSize||20)*i))),ze(S.id,t),ut()},Li=i=>{if(!S||S.locked)return;const t=(((S.rotation||0)+i)%360+360)%360;ze(S.id,{rotation:t}),ut()},Di=i=>{const t=z.filter(c=>j.includes(c.id));if(t.length<2)return;const o={};i(t,o),T(c=>c.map(m=>o[m.id]?{...m,...o[m.id]}:m)),L(c=>c&&o[c.id]?{...c,...o[c.id]}:c),ut()},Wa=i=>Di((t,o)=>{const c=Math.min(...t.map(b=>b.x)),m=Math.max(...t.map(b=>b.x+(b.width||0))),g=Math.min(...t.map(b=>b.y)),x=Math.max(...t.map(b=>b.y+(b.height||0))),d=(c+m)/2,y=(g+x)/2;t.forEach(b=>{b.locked||(i==="left"?o[b.id]={x:c}:i==="right"?o[b.id]={x:m-(b.width||0)}:i==="hcenter"?o[b.id]={x:d-(b.width||0)/2}:i==="top"?o[b.id]={y:g}:i==="bottom"?o[b.id]={y:x-(b.height||0)}:i==="vcenter"&&(o[b.id]={y:y-(b.height||0)/2}))})}),Ba=i=>Di((t,o)=>{if(t.length<3)return;const c=G=>i==="h"?G.width||0:G.height||0,m=G=>i==="h"?G.x:G.y,g=[...t].sort((G,et)=>m(G)-m(et)),x=g[0],d=g[g.length-1],y=m(d)+c(d)-m(x),b=g.reduce((G,et)=>G+c(et),0),F=(y-b)/(g.length-1);let D=m(x)+c(x)+F;g.forEach((G,et)=>{et===0||et===g.length-1||(G.locked||(o[G.id]=i==="h"?{x:D}:{y:D}),D+=c(G)+F)})}),Pa=()=>{j.length&&(T(i=>i.filter(t=>!j.includes(t.id))),L(null),it([]),ut())},Ri=(i,t)=>{const o=z.findIndex(g=>g.id===i);if(o===-1)return;const c=[...z],m=c[o];t==="up"&&o<c.length-1?(c[o]=c[o+1],c[o+1]=m):t==="down"&&o>0?(c[o]=c[o-1],c[o-1]=m):t==="top"?(c.splice(o,1),c.push(m)):t==="bottom"&&(c.splice(o,1),c.unshift(m)),T(c),ut()};p.useCallback(()=>{Y&&ae(i=>({...i,[Y.sectionName]:{elements:[...z],selectedColor:at}}))},[Y,z,at]);const[,Oa]=p.useReducer(i=>i+1,0);setTimeout(()=>{Oa()},20);const Ha=p.useCallback(()=>{Y&&ae(i=>({...i,[Y.sectionName]:{elements:[...z],selectedColor:at}}))},[Y,z,at]);p.useImperativeHandle(a,()=>({handleSectionChange:Bi,flushCurrentSectionDesign:Ha,addImageFromUrl:(i,t={})=>{if(!i)return;const o=t.width||220,c=t.height||220;Xe("image",{imageData:i,src:i,width:o,height:c,x:Math.max(0,(w-o)/2),y:Math.max(0,(P-c)/2)})},exportPrintReady:async(i="png")=>await qe(i,!1),exportFullDesign:async(i="png")=>await qe(i,!0),exportDesign:qe,getCanvasData:()=>ge(),exportAllDesignsAsJSON:async(i="png")=>{try{const t=ge(),o=(Y==null?void 0:Y.sectionName)||"main",c={elements:t.elements,selectedColor:t.selectedColor,canvasWidth:t.canvasWidth,canvasHeight:t.canvasHeight},m={...t.sectionDesigns||{},[o]:c},g=f.sections&&f.sections.length>0?f.sections:[{id:o,sectionName:o,image:Y==null?void 0:Y.sectionImage,sectionImage:Y==null?void 0:Y.sectionImage}];return await fe.current.exportAllSectionsAsJSON(m,g,w,P,i,ue,qt)}catch(t){throw console.error("Export as JSON failed:",t),t}},exportCurrentSectionAsJSON:async(i="png")=>{try{const t=ge();return await fe.current.exportCurrentSectionAsJSON(t,i,ue,qt)}catch(t){throw console.error("Export current section as JSON failed:",t),t}}}));const Ht=p.useRef(null),Ke=p.useRef(!1),st=p.useCallback(()=>{const i=Dt.current;if(!i||Ke.current)return;Ke.current=!0;const t=i.getContext("2d");if(t.clearRect(0,0,w,P),yt.current&&t.drawImage(yt.current,0,0,w,P),dt&&ua(t),z.forEach(d=>{t.save(),t.globalAlpha=d.opacity||1,ga(t,d),t.restore()}),j.length>1?(t.save(),t.strokeStyle="#3b82f6",t.lineWidth=1.5,t.setLineDash([4,3]),j.forEach(d=>{const y=z.find(D=>D.id===d);if(!y)return;const b=Fe(t,y),F=4;t.save(),t.translate(b.cx,b.cy),y.rotation&&t.rotate(y.rotation*Math.PI/180),t.strokeRect(-b.width/2-F,-b.height/2-F,b.width+F*2,b.height+F*2),t.restore()}),t.restore()):S&&ha(t,S),_t.current){const d=_t.current,y=Math.min(d.x0,d.x1),b=Math.min(d.y0,d.y1),F=Math.abs(d.x1-d.x0),D=Math.abs(d.y1-d.y0);t.save(),t.fillStyle="rgba(59,130,246,0.12)",t.strokeStyle="#3b82f6",t.lineWidth=1,t.setLineDash([4,3]),t.fillRect(y,b,F,D),t.strokeRect(y,b,F,D),t.restore()}const o=ot.current;o&&(o.v&&o.v.length||o.h&&o.h.length)&&(t.save(),t.strokeStyle="#ec4899",t.lineWidth=1,t.setLineDash([5,4]),(o.v||[]).forEach(d=>{t.beginPath(),t.moveTo(d,0),t.lineTo(d,P),t.stroke()}),(o.h||[]).forEach(d=>{t.beginPath(),t.moveTo(0,d),t.lineTo(w,d),t.stroke()}),t.restore());const c=q.current;c&&c.length&&(t.save(),t.strokeStyle="#ef4444",t.fillStyle="#ef4444",t.lineWidth=1,t.font="11px sans-serif",t.textAlign="center",t.textBaseline="middle",c.forEach(d=>{t.beginPath(),t.moveTo(d.x1,d.y1),t.lineTo(d.x2,d.y2),t.stroke();const y=d.y1===d.y2,b=4;t.beginPath(),y?(t.moveTo(d.x1,d.y1-b),t.lineTo(d.x1,d.y1+b),t.moveTo(d.x2,d.y2-b),t.lineTo(d.x2,d.y2+b)):(t.moveTo(d.x1-b,d.y1),t.lineTo(d.x1+b,d.y1),t.moveTo(d.x2-b,d.y2),t.lineTo(d.x2+b,d.y2)),t.stroke();const F=(d.x1+d.x2)/2,D=(d.y1+d.y2)/2,G=`${d.label}`,ht=t.measureText(G).width+8,W=15;t.fillStyle="#ef4444",Xt(t,F-ht/2,D-W/2,ht,W,3),t.fill(),t.fillStyle="#ffffff",t.fillText(G,F,D+.5),t.fillStyle="#ef4444"}),t.restore());const m=Gt.current;m&&m.length&&(t.save(),t.strokeStyle="#a855f7",t.fillStyle="#a855f7",t.lineWidth=1,t.font="11px sans-serif",t.textAlign="center",t.textBaseline="middle",m.forEach(d=>{t.beginPath(),t.moveTo(d.x1,d.y1),t.lineTo(d.x2,d.y2),t.stroke();const y=d.y1===d.y2,b=4;t.beginPath(),y?(t.moveTo(d.x1,d.y1-b),t.lineTo(d.x1,d.y1+b),t.moveTo(d.x2,d.y2-b),t.lineTo(d.x2,d.y2+b)):(t.moveTo(d.x1-b,d.y1),t.lineTo(d.x1+b,d.y1),t.moveTo(d.x2-b,d.y2),t.lineTo(d.x2+b,d.y2)),t.stroke();const F=(d.x1+d.x2)/2,D=(d.y1+d.y2)/2,G=`${d.label}`,ht=t.measureText(G).width+8,W=15;t.fillStyle="#a855f7",Xt(t,F-ht/2,D-W/2,ht,W,3),t.fill(),t.fillStyle="#ffffff",t.fillText(G,F,D+.5),t.fillStyle="#a855f7"}),t.restore());const g=Ye.current;if(g){t.save(),t.font="11px sans-serif",t.textAlign="center",t.textBaseline="middle";const y=t.measureText(g.label).width+10,b=16,F=Math.max(y/2,Math.min(w-y/2,g.cx)),D=Math.min(P-b/2,g.y+b/2);t.fillStyle="#1d4ed8",Xt(t,F-y/2,D-b/2,y,b,3),t.fill(),t.fillStyle="#ffffff",t.fillText(g.label,F,D+.5),t.restore()}const x=ce.current;if(x){t.save(),t.font="11px sans-serif",t.textAlign="center",t.textBaseline="middle";const y=t.measureText(x.label).width+10,b=16,F=Math.max(y/2,Math.min(w-y/2,x.cx)),D=Math.min(P-b/2,x.y+b/2);t.fillStyle="#1d4ed8",Xt(t,F-y/2,D-b/2,y,b,3),t.fill(),t.fillStyle="#ffffff",t.fillText(x.label,F,D+.5),t.restore()}Ke.current=!1},[z,S,j,w,P,dt]),Je=p.useRef(st);p.useEffect(()=>{Je.current=st},[st]);const Wi=p.useRef(!1);p.useEffect(()=>{Wi.current=J||gt||V},[J,gt,V]);const $t=p.useCallback(()=>{Ht.current&&cancelAnimationFrame(Ht.current),Ht.current=requestAnimationFrame(()=>{Je.current(),Ht.current=null})},[]);p.useEffect(()=>{fe.current&&(fe.current.embroidery=yi(f))},[f]),p.useEffect(()=>{const i=(z||[]).filter(o=>o&&o.type==="text"&&o.fontFamily).map(o=>o.fontFamily);if(i.length===0)return;let t=!1;return Ci(i).then(()=>{t||st()}),()=>{t=!0}},[z,st]),p.useEffect(()=>{$t()},[z,S,j,w,P,dt,$t]),p.useEffect(()=>{yt.current&&$t()},[yt.current,$t]),p.useEffect(()=>()=>{Ht.current&&cancelAnimationFrame(Ht.current)},[]);const ti=p.useCallback(()=>{Je.current(),Wi.current&&(Ht.current=requestAnimationFrame(ti))},[]);p.useEffect(()=>{J||gt||V?ti():(Ht.current&&(cancelAnimationFrame(Ht.current),Ht.current=null),$t())},[J,gt,V,ti,$t]);const $a=p.useCallback(i=>{if(n)return;const t=Dt.current,o=t.getBoundingClientRect(),c=(i.clientX-o.left)/A,m=(i.clientY-o.top)/A;if(i.pointerId!=null&&t.setPointerCapture)try{t.setPointerCapture(i.pointerId)}catch{}if(ce.current&&(ce.current=null,de.current&&clearTimeout(de.current)),nt({x:c,y:m}),S&&!S.locked&&j.length<=1){const d=Ti(c,m,S);if(d){if(d==="rotate"){O(!0);const y=S.x+S.width/2,b=S.y+S.height/2,F=Math.atan2(m-b,c-y)*180/Math.PI;nt({x:c,y:m,initialAngle:F,initialRotation:S.rotation||0})}else Ft(!0),mt(d),nt({x:c,y:m,initialWidth:S.width,initialHeight:S.height,initialX:S.x,initialY:S.y});return}}let g=null;for(let d=z.length-1;d>=0;d--)if(Mi(c,m,z[d])){g=z[d];break}const x=j.length>1?j:S?[S.id]:[];if(i.shiftKey&&g){const d=x.includes(g.id),y=d?x.filter(F=>F!==g.id):[...x,g.id];it(y);const b=d?y[y.length-1]:g.id;L(b&&z.find(F=>F.id===b)||null),st();return}if(g&&x.length>1&&x.includes(g.id)){const d=z.filter(y=>x.includes(y.id)&&!y.locked);d.length&&(xt(!0),he.current={startX:c,startY:m,items:d.map(y=>({id:y.id,x:y.x,y:y.y}))},nt({x:c,y:m}));return}if(g){he.current=null,L(g),g.locked||(xt(!0),nt({x:c,y:m,offsetX:c-g.x,offsetY:m-g.y})),st();return}L(null),_t.current={x0:c,y0:m,x1:c,y1:m},st()},[n,A,S,j,z,st]),Va=p.useCallback(i=>{if(n)return;const t=Dt.current,o=t.getBoundingClientRect(),c=(i.clientX-o.left)/A,m=(i.clientY-o.top)/A;if(_t.current){_t.current={..._t.current,x1:c,y1:m},t.style.cursor="crosshair",st();return}if(J&&he.current){const g=he.current;let x=c-g.startX,d=m-g.startY;const y=W=>{const lt=z.find(Mt=>Mt.id===W);return lt&&lt.width||0},b=W=>{const lt=z.find(Mt=>Mt.id===W);return lt&&lt.height||0},F=Math.min(...g.items.map(W=>W.x)),D=Math.max(...g.items.map(W=>W.x+y(W.id))),G=Math.min(...g.items.map(W=>W.y)),et=Math.max(...g.items.map(W=>W.y+b(W.id)));x=Math.max(-F,Math.min(w-D,x)),d=Math.max(-G,Math.min(P-et,d));const ht={};g.items.forEach(W=>{ht[W.id]={x:W.x+x,y:W.y+d}}),T(W=>W.map(lt=>ht[lt.id]?{...lt,...ht[lt.id]}:lt)),L(W=>W&&ht[W.id]?{...W,...ht[W.id]}:W),t.style.cursor="grabbing",st();return}if(S&&!J&&!gt&&!V){const g=Ti(c,m,S);g?g==="rotate"?t.style.cursor="grab":t.style.cursor=g:Mi(c,m,S)?t.style.cursor="move":t.style.cursor="default"}else t.style.cursor=J?"grabbing":"default";if(V&&S){const g=S.x+S.width/2,x=S.y+S.height/2,y=Math.atan2(m-x,c-g)*180/Math.PI-R.initialAngle;let b=R.initialRotation+y;i.shiftKey&&(b=Math.round(b/15)*15),b=(b%360+360)%360,T(F=>F.map(D=>D.id===S.id?{...D,rotation:b}:D)),L(F=>({...F,rotation:b})),st();return}if(gt&&S&&rt){const g=c-R.x,x=m-R.y;let d=R.initialWidth,y=R.initialHeight,b=R.initialX,F=R.initialY;switch(rt){case"se-resize":d=Math.max(20,R.initialWidth+g),y=Math.max(20,R.initialHeight+x);break;case"sw-resize":d=Math.max(20,R.initialWidth-g),y=Math.max(20,R.initialHeight+x),b=R.initialX+(R.initialWidth-d);break;case"ne-resize":d=Math.max(20,R.initialWidth+g),y=Math.max(20,R.initialHeight-x),F=R.initialY+(R.initialHeight-y);break;case"nw-resize":d=Math.max(20,R.initialWidth-g),y=Math.max(20,R.initialHeight-x),b=R.initialX+(R.initialWidth-d),F=R.initialY+(R.initialHeight-y);break}if((i.shiftKey||S.lockAspect)&&S.type!=="text"){const W=R.initialWidth/R.initialHeight;rt.includes("e"),y=d/W,rt.includes("n")&&(F=R.initialY+(R.initialHeight-y))}jt&&(b=Ut(b),F=Ut(F),d=Ut(d),y=Ut(y));const D={...S,x:b,y:F,width:d,height:y},G=wi(w,wt),et=W=>W>=10?Math.round(W).toString():W>=1?W.toFixed(1):W.toFixed(2),ht=G>0?`${et(d*G)}" × ${et(y*G)}"`:`${Math.round(d)} × ${Math.round(y)} px`;Ye.current={cx:b+d/2,y:F+y+8,label:ht},T(W=>W.map(lt=>lt.id===S.id?D:lt)),L(D),st();return}if(J&&S){let g=c-R.offsetX,x=m-R.offsetY;jt&&(g=Ut(g),x=Ut(x));const d=6/(A||1),y=S.width,b=S.height,F=z.filter($=>$.id!==S.id),D=[0,w/2,w],G=[0,P/2,P];F.forEach($=>{D.push($.x,$.x+($.width||0)/2,$.x+($.width||0)),G.push($.y,$.y+($.height||0)/2,$.y+($.height||0))});const et=($,Qt,Ee)=>{const Ie=[0,Qt/2,Qt];let se=null;return Ie.forEach(Le=>{Ee.forEach(Zt=>{const Kt=Math.abs($+Le-Zt);Kt<=d&&(!se||Kt<se.d)&&(se={d:Kt,snapped:Zt-Le,line:Zt})})}),se},ht={v:[],h:[]},W=et(g,y,D);W&&(g=W.snapped,ht.v.push(W.line));const lt=et(x,b,G);lt&&(x=lt.snapped,ht.h.push(lt.line)),ot.current=ht,g=Math.max(0,Math.min(w-S.width,g)),x=Math.max(0,Math.min(P-S.height,x));const Mt=()=>{const $=g,Qt=g+y,Ee=x,Ie=x+b,se=ft=>Math.min(Ie,ft.y+(ft.height||0))-Math.max(Ee,ft.y),Le=ft=>Math.min(Qt,ft.x+(ft.width||0))-Math.max($,ft.x);let Zt=null,Kt=null,De=null,Re=null;return F.forEach(ft=>{const ci=ft.x+(ft.width||0),di=ft.y+(ft.height||0);se(ft)>0&&(ci<=$&&(!Zt||ci>Zt.edge)&&(Zt={edge:ci,el:ft}),ft.x>=Qt&&(!Kt||ft.x<Kt.edge)&&(Kt={edge:ft.x,el:ft})),Le(ft)>0&&(di<=Ee&&(!De||di>De.edge)&&(De={edge:di,el:ft}),ft.y>=Ie&&(!Re||ft.y<Re.edge)&&(Re={edge:ft.y,el:ft}))}),{L:Zt,R:Kt,T:De,B:Re}};let{L:St,R:vt,T:Nt,B:kt}=Mt();if(!W&&St&&vt){const $=(St.edge+vt.edge-y)/2;Math.abs(g-$)<=d&&(g=$)}if(!lt&&Nt&&kt){const $=(Nt.edge+kt.edge-b)/2;Math.abs(x-$)<=d&&(x=$)}g=Math.max(0,Math.min(w-S.width,g)),x=Math.max(0,Math.min(P-S.height,x)),{L:St,R:vt,T:Nt,B:kt}=Mt();const zt=g,Yt=g+y,Bt=x,Te=x+b,Me=$=>(Math.max(Bt,$.y)+Math.min(Te,$.y+($.height||0)))/2,Ae=$=>(Math.max(zt,$.x)+Math.min(Yt,$.x+($.width||0)))/2,ai=St?Math.round(zt-St.edge):null,oi=vt?Math.round(vt.edge-Yt):null,ri=Nt?Math.round(Bt-Nt.edge):null,si=kt?Math.round(kt.edge-Te):null,ni=St&&vt&&ai===oi,li=Nt&&kt&&ri===si,ye=[];if(St&&!ni){const $=Me(St.el);ye.push({x1:St.edge,y1:$,x2:zt,y2:$,label:ai})}if(vt&&!ni){const $=Me(vt.el);ye.push({x1:Yt,y1:$,x2:vt.edge,y2:$,label:oi})}if(Nt&&!li){const $=Ae(Nt.el);ye.push({x1:$,y1:Nt.edge,x2:$,y2:Bt,label:ri})}if(kt&&!li){const $=Ae(kt.el);ye.push({x1:$,y1:Te,x2:$,y2:kt.edge,label:si})}q.current=ye;const xe=[];if(ni){const $=(Me(St.el)+Me(vt.el))/2;xe.push({x1:St.edge,y1:$,x2:zt,y2:$,label:ai}),xe.push({x1:Yt,y1:$,x2:vt.edge,y2:$,label:oi})}if(li){const $=(Ae(Nt.el)+Ae(kt.el))/2;xe.push({x1:$,y1:Nt.edge,x2:$,y2:Bt,label:ri}),xe.push({x1:$,y1:Te,x2:$,y2:kt.edge,label:si})}Gt.current=xe;const Ui={...S,x:g,y:x};T($=>$.map(Qt=>Qt.id===S.id?Ui:Qt)),L(Ui),st()}},[n,A,S,J,gt,V,rt,R,jt,w,P,z,st]),Bi=p.useCallback(i=>{Y&&ae(o=>({...o,[Y.sectionName]:{elements:z.map(c=>c.type==="image"?{...c,imageData:c.imageData,src:c.src}:c),selectedColor:at}}));const t=Vt[i.sectionName];if(t){const o=t.elements.map(c=>{if(c.type==="image"&&c.src&&!c.imageData){const m=new Image;return m.onload=()=>{T(g=>g.map(x=>x.id===c.id?{...x,imageData:m}:x)),st()},m.src=c.src,{...c,imageData:m}}return c});T(o),bt(t.selectedColor||at)}else T([]);we(i),L(null)},[Y,z,at,Vt,st]),ei=p.useCallback(i=>{if(i&&i.type.startsWith("image/")){const t=new FileReader;t.onload=o=>{const c=new Image;c.onload=()=>{const m={id:Et(),type:"image",x:Ut(w/2-100),y:Ut(P/2-100),width:Math.min(c.width,200),height:Math.min(c.height,200),rotation:0,imageData:c,src:o.target.result,originalWidth:c.width,originalHeight:c.height},g=c.width/c.height;m.width/m.height!==g&&(m.width/g<=200?m.height=m.width/g:m.width=m.height*g),T(x=>[...x,m]),L(m),ut()},c.onerror=()=>{console.error("Failed to load uploaded image"),alert("Failed to load the uploaded image. Please try again.")},c.src=o.target.result},t.onerror=()=>{console.error("Failed to read file"),alert("Failed to read the file. Please try again.")},t.readAsDataURL(i)}else alert("Please select a valid image file.")},[w,P,Ut,Et,ut]),Pi=p.useCallback(Mo(()=>{st()},16),[st]);p.useEffect(()=>{ca.current||Pi()},[z,S,dt,Pi]),p.useEffect(()=>{st()},[st]);const Oi=i=>{if(!Ct)return{horizontal:[],vertical:[]};const t=document.querySelector(".ruler-horizontal"),o=document.querySelector(".ruler-vertical");if(!t||!o)return{horizontal:[],vertical:[]};const c=t.getBoundingClientRect(),m=o.getBoundingClientRect(),g=c.width,x=m.height,d=50,y=[],b=[];for(let F=d;F<=g;F+=d)F<=g-20&&y.push({position:F,value:Math.round(F/i)});for(let F=d;F<=x;F+=d)F<=x-15&&b.push({position:F,value:Math.round(F/i)});return{horizontal:y,vertical:b}},[Hi,$i]=p.useState({horizontal:[],vertical:[]});p.useEffect(()=>{const i=()=>{setTimeout(()=>{const c=Oi(A);$i(c)},50)};i();let t;const o=()=>{clearTimeout(t),t=setTimeout(i,150)};return window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o),clearTimeout(t)}},[A,Ct]),p.useEffect(()=>{if(Ct&&!Ot){const i=setTimeout(()=>{const t=Oi(A);$i(t)},100);return()=>clearTimeout(i)}},[Ct,Ot,A]);const ii=yi(f),Vi=ii?zo(z):[],Gi=e.jsxs(e.Fragment,{children:[e.jsx(ko,{selectedElement:S,selectedCount:j.length,onUpdate:ze,onMoveLayer:Ri,onAlignSelection:Wa,onDistributeSelection:Ba,onDeleteSelection:Pa,availableFonts:da,theme:s,isEmbroidery:ii,onFontLoaded:st,canvasWidth:w,canvasHeight:P,printConfig:wt,onRemoveBackground:H?Ei:null}),l!=="customize"&&e.jsx(Co,{elements:z,selectedElement:S,onSelectElement:i=>{it(i?[i.id]:[]),L(i)},onMoveLayer:Ri,onDeleteElement:Qe,theme:s})]});return e.jsxs("div",{className:"pure-canvas-designer",children:[e.jsx("div",{className:"designer-header",children:e.jsx(po,{onAddElement:Xe,onDeleteElement:()=>S&&Qe(S.id),onDuplicateElement:()=>S&&Ze(S.id),onUndo:me,onRedo:re,onToggleGrid:()=>It(!dt),onToggleRulers:()=>pt(!Ct),onToggleSnap:()=>Pt(!jt),onTogglePrintGuides:()=>ie(i=>!i),onImageUpload:ei,canUndo:Tt>0,canRedo:Tt<Lt.length-1,showGrid:dt,showRulers:Ct,snapToGrid:jt,showPrintGuides:ee,selectedElement:S,theme:s,readOnly:n,mode:l,productionMethods:f==null?void 0:f.productionMethods,supportsEmbroidery:f==null?void 0:f.supportsEmbroidery,apiKey:r.apiKey,apiEndpoint:r.apiEndpoint,aiEnabled:N,aiEndpoint:M,onAIImageGenerate:v,isAuthenticated:B,onRequireAuth:I})}),ii&&!te&&e.jsxs("div",{role:"note",style:{display:"flex",gap:10,alignItems:"flex-start",margin:"8px 12px",padding:"10px 12px",background:"#fff7ed",border:"1px solid #fed7aa",borderRadius:8,color:"#7c2d12",fontSize:13,lineHeight:1.4},children:[e.jsx("span",{style:{fontSize:16,lineHeight:1},children:"🧵"}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("strong",{children:"Embroidery preview"})," — this is how your design will be stitched. Colours are matched to real thread.",Vi.length>0&&e.jsx("ul",{style:{margin:"6px 0 0",paddingLeft:18},children:Vi.map((i,t)=>e.jsx("li",{children:i},t))})]}),e.jsx("button",{type:"button",onClick:()=>ve(!0),"aria-label":"Dismiss",style:{background:"none",border:"none",cursor:"pointer",fontSize:18,color:"#9a3412",lineHeight:1},children:"×"})]}),e.jsxs("div",{className:"designer-content",children:[Ct&&!Ot&&e.jsxs("div",{className:"rulers",children:[e.jsx("div",{className:"ruler-horizontal",children:e.jsx("div",{className:"ruler-horizontal-numbers",children:Hi.horizontal.map((i,t)=>e.jsx("span",{className:"ruler-number horizontal",style:{left:`${i.position}px`},children:i.value},t))})}),e.jsx("div",{className:"ruler-vertical",children:e.jsx("div",{className:"ruler-vertical-numbers",children:Hi.vertical.map((i,t)=>e.jsx("span",{className:"ruler-number vertical",style:{top:`${i.position}px`},children:i.value},t))})})]}),e.jsxs("div",{className:"canvas-container",ref:Ce,onDragOver:i=>{n||i.preventDefault()},onDrop:i=>{var o;if(n)return;i.preventDefault();const t=[...((o=i.dataTransfer)==null?void 0:o.files)||[]].find(c=>c.type.startsWith("image/"));t&&ei(t)},children:[Ot&&e.jsx("button",{type:"button",className:"mobile-panel-toggle","aria-label":"Open tools & properties",title:"Tools & properties",onClick:()=>ne(i=>!i),style:{position:"absolute",top:8,right:8,zIndex:40,width:42,height:42,borderRadius:10,border:"1px solid #e2e8f0",background:"#ffffff",boxShadow:"0 2px 10px rgba(0,0,0,0.18)",fontSize:20,lineHeight:1,color:"#334155",cursor:"pointer"},children:"☰"}),!n&&z.length>0&&(()=>{const i=[],t=((wt==null?void 0:wt.safeAreaPct)||0)/100;if(t){const c=w*t,m=P*t,g=w*(1-t),x=P*(1-t);z.some(y=>y.x<c-.5||y.y<m-.5||y.x+(y.width||0)>g+.5||y.y+(y.height||0)>x+.5)&&i.push({key:"safe",text:"Some artwork is outside the safe print area and may be cut off."})}return z.some(c=>{var g;const m=ra(c,w,wt);return m!=null&&((g=sa(m,wt))==null?void 0:g.level)==="bad"})&&i.push({key:"dpi",text:"An image is low-resolution and may print blurry — try a larger file or smaller size."}),i.length?e.jsx("div",{style:{position:"absolute",top:8,left:"50%",transform:"translateX(-50%)",zIndex:35,maxWidth:"92%",display:"flex",flexDirection:"column",gap:6},children:i.map(c=>e.jsxs("div",{role:"status",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:8,background:"#fffbeb",border:"1px solid #fcd34d",color:"#92400e",fontSize:12,lineHeight:1.3,boxShadow:"0 2px 10px rgba(0,0,0,0.12)"},children:[e.jsx("span",{"aria-hidden":"true",children:"⚠️"}),c.text]},c.key))}):null})(),e.jsxs("div",{className:"canvas-stage",style:{position:"relative",width:w,height:P,transform:`scale(${A})`,transformOrigin:"top left"},children:[e.jsx("canvas",{ref:Dt,width:w,height:P,onPointerDown:$a,onPointerMove:Va,onPointerUp:Ai,onPointerCancel:Ai,style:{display:"block",border:"1px solid #e2e8f0",cursor:J?"grabbing":"default",touchAction:"none"}}),!n&&z.length===0&&(()=>{const i=Pe[(typeof Q=="number"?Q:Pe.findIndex(o=>o.key===Q))%Pe.length]||Pe[0],t={display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:8,cursor:"pointer",fontSize:13,fontWeight:600,lineHeight:1};return e.jsxs("div",{style:{position:"absolute",inset:0,zIndex:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,pointerEvents:"none",textAlign:"center",padding:24,color:"#0f172a"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:"50%",background:"rgba(255,255,255,0.92)",border:"1px dashed #94a3b8"},children:e.jsx(K,{name:"image",size:26,color:"#475569"})}),e.jsx("div",{style:{fontSize:17,fontWeight:800,color:"#0f172a"},children:i.title}),e.jsx("div",{style:{fontSize:13,fontWeight:600,maxWidth:260,lineHeight:1.45,color:"#334155"},children:i.body}),e.jsxs("div",{style:{display:"flex",gap:8,pointerEvents:"auto",marginTop:2},children:[e.jsxs("button",{type:"button",style:{...t,background:(s==null?void 0:s.primaryColor)||"#0f172a",color:"#ffffff",border:"none"},onClick:La,children:[e.jsx(K,{name:"text",size:16,color:"#ffffff"})," Add text"]}),e.jsxs("button",{type:"button",style:{...t,background:"#ffffff",color:"#0f172a",border:"1px solid #cbd5e1"},onClick:Da,children:[e.jsx(K,{name:"upload",size:16,color:"#0f172a"})," Upload image"]})]})]})})(),ee&&e.jsxs("div",{className:"print-guides-overlay","aria-hidden":"true",style:{position:"absolute",top:0,left:0,width:w,height:P,pointerEvents:"none"},children:[e.jsx("div",{style:{position:"absolute",inset:0,border:"1px solid rgba(37, 99, 235, 0.55)"}}),e.jsx("div",{style:{position:"absolute",top:`${wt.safeAreaPct}%`,left:`${wt.safeAreaPct}%`,right:`${wt.safeAreaPct}%`,bottom:`${wt.safeAreaPct}%`,border:"1px dashed rgba(37, 99, 235, 0.9)"},children:e.jsx("span",{style:{position:"absolute",top:2,left:4,fontSize:10,lineHeight:1.4,color:"rgba(37, 99, 235, 0.9)",background:"rgba(255,255,255,0.6)",padding:"0 3px",borderRadius:2,userSelect:"none"},children:"Safe area"})})]}),S&&!n&&j.length<=1&&(()=>{const i=Dt.current&&Dt.current.getContext("2d"),t=i?Fe(i,S):{cx:S.x+(S.width||0)/2,y:S.y},o=t.cx,c=t.y,m=["image","sticker","embroidery"].includes(S.type),g=!!S.locked,x={width:30,height:30,border:"none",background:"transparent",borderRadius:6,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0};return e.jsx("div",{style:{position:"absolute",left:o,top:c,pointerEvents:"none",zIndex:30},children:e.jsxs("div",{className:"element-action-toolbar",onMouseDown:d=>d.stopPropagation(),style:{transform:`translate(-50%, calc(-100% - 12px)) scale(${1/(A||1)})`,transformOrigin:"bottom center",pointerEvents:"auto",display:"flex",alignItems:"center",gap:2,padding:"3px 4px",background:"#ffffff",border:"1px solid #e2e8f0",borderRadius:8,boxShadow:"0 4px 14px rgba(0,0,0,0.18)",whiteSpace:"nowrap"},children:[!g&&e.jsxs(e.Fragment,{children:[e.jsx("button",{style:x,title:"Shrink",onClick:d=>{d.stopPropagation(),Ii(.9)},children:e.jsx(K,{name:"minus",size:18,color:"#334155"})}),e.jsx("button",{style:x,title:"Enlarge",onClick:d=>{d.stopPropagation(),Ii(1.1)},children:e.jsx(K,{name:"plus",size:18,color:"#334155"})}),e.jsx("button",{style:x,title:"Duplicate",onClick:d=>{d.stopPropagation(),Ze(S.id)},children:e.jsx(K,{name:"duplicate",size:18,color:"#334155"})}),e.jsx("button",{style:x,title:"Rotate left 15°",onClick:d=>{d.stopPropagation(),Li(-15)},children:e.jsx(K,{name:"rotateLeft",size:18,color:"#334155"})}),e.jsx("button",{style:x,title:"Rotate right 15°",onClick:d=>{d.stopPropagation(),Li(15)},children:e.jsx(K,{name:"rotateRight",size:18,color:"#334155"})}),m&&H&&e.jsx("button",{style:x,title:"Remove background",onClick:d=>{d.stopPropagation(),Ei(S).catch(()=>{})},children:e.jsx("span",{style:{fontSize:16,lineHeight:1},children:"✂️"})})]}),e.jsx("button",{style:{...x,background:g?"#eef2ff":"transparent"},title:g?"Unlock":"Lock position",onClick:d=>{d.stopPropagation(),Ra(S.id)},children:e.jsx(K,{name:"lock",size:18,color:g?"#4f46e5":"#334155"})}),!g&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{width:1,height:20,background:"#e2e8f0",margin:"0 2px"}}),e.jsx("button",{style:x,title:"Delete",onClick:d=>{d.stopPropagation(),Qe()},children:e.jsx(K,{name:"trash",size:18,color:"#dc2626"})})]})]})})})()]})]}),!Ot&&e.jsx("div",{className:"side-panels",children:Gi})]}),e.jsxs("div",{className:"designer-footer",children:[e.jsxs("div",{className:"section-thumbnails",children:[e.jsxs("label",{className:"section-thumbnails-label",children:["Available sections for : ",e.jsx("u",{children:f.name})]}),e.jsx("div",{className:"thumbnails-container",children:f.sections.map(i=>{const t=Vt[i.sectionName]&&Vt[i.sectionName].elements&&Vt[i.sectionName].elements.length>0;return e.jsxs("div",{className:`section-thumbnail compact ${Y.sectionName===i.sectionName?"active":""}`,onClick:o=>{o.stopPropagation();const c=f.sections.find(m=>m.sectionName===i.sectionName);Bi(c)},title:i.sectionName,children:[e.jsxs("div",{className:"thumbnail-image-container compact",children:[e.jsx("img",{src:i.sectionImage,alt:i.sectionName,className:"thumbnail-image compact",onError:o=>{o.target.style.display="none",o.target.nextSibling.style.display="flex"}}),e.jsx("div",{className:"thumbnail-placeholder compact",style:{display:"none"},children:e.jsx("span",{className:"placeholder-icon",children:"📐"})}),t&&e.jsx("div",{className:"content-indicator compact",children:e.jsx("svg",{className:"checkmark compact",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})})]}),e.jsx("span",{className:"thumbnail-label compact",children:i.sectionName})]},i.sectionName)})})]}),e.jsxs("div",{className:"zoom-controls-enhanced compact",children:[e.jsx("label",{className:"zoom-label",children:"Zoom:"}),e.jsxs("div",{className:"zoom-buttons-container compact",children:[e.jsx("button",{className:"zoom-button compact zoom-out",onClick:()=>_(Math.max(.25,A-.25)),disabled:A<=.25,title:"Zoom Out",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsxs("div",{className:"zoom-display compact",children:[e.jsxs("span",{className:"zoom-percentage compact",children:[Math.round(A*100),"%"]}),e.jsx("div",{className:"zoom-slider-container compact",children:e.jsx("input",{type:"range",min:"0.25",max:"4",step:"0.25",value:A,onChange:i=>_(parseFloat(i.target.value)),className:"zoom-slider compact"})})]}),e.jsx("button",{className:"zoom-button compact zoom-in",onClick:()=>_(Math.min(4,A+.25)),disabled:A>=4,title:"Zoom In",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"}),e.jsx("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsx("button",{className:"zoom-reset compact",onClick:()=>_(1),title:"Reset Zoom (100%)",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M3 3l18 18"}),e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]})})]})]})]}),Ot&&Ue&&e.jsx("div",{className:"mobile-panel-modal-overlay",onClick:()=>ne(!1),style:{position:"fixed",inset:0,zIndex:1e4,background:"rgba(15,23,42,0.5)",display:"flex",alignItems:"flex-end",justifyContent:"center"},children:e.jsxs("div",{className:"mobile-panel-modal",role:"dialog","aria-modal":"true","aria-label":"Edit design",onClick:i=>i.stopPropagation(),style:{background:"#ffffff",width:"100%",maxWidth:560,maxHeight:"85vh",borderTopLeftRadius:16,borderTopRightRadius:16,display:"flex",flexDirection:"column",boxShadow:"0 -8px 30px rgba(0,0,0,0.25)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #e2e8f0",borderTopLeftRadius:16,borderTopRightRadius:16,flex:"0 0 auto"},children:[e.jsx("span",{style:{fontSize:15,fontWeight:700,color:"#0f172a"},children:"Edit design"}),e.jsx("button",{type:"button","aria-label":"Close",onClick:()=>ne(!1),style:{width:32,height:32,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",fontSize:18,lineHeight:1,cursor:"pointer",color:"#334155"},children:"×"})]}),e.jsx("div",{style:{overflowY:"auto",WebkitOverflowScrolling:"touch",padding:12},children:Gi})]})})]})});na.displayName="Mypixia";module.exports=na;