1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3075],{32602:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var s in t)Object.defineProperty(e,s,{enumerable:!0,get:t[s]})}(t,{default:function(){return i},noSSR:function(){return n}});let a=s(38754);s(85893),s(67294);let r=a._(s(35491));function l(e){return{default:(null==e?void 0:e.default)||e}}function n(e,t){return delete t.webpack,delete t.modules,e(t)}function i(e,t){let s=r.default,a={loading:e=>{let{error:t,isLoading:s,pastDelay:a}=e;return null}};e instanceof Promise?a.loader=()=>e:"function"==typeof e?a.loader=e:"object"==typeof e&&(a={...a,...e});let i=(a={...a,...t}).loader;return(a.loadableGenerated&&(a={...a,...a.loadableGenerated},delete a.loadableGenerated),"boolean"!=typeof a.ssr||a.ssr)?s({...a,loader:()=>null!=i?i().then(l):Promise.resolve(l(()=>null))}):(delete a.webpack,delete a.modules,n(s,a))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},1159:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"LoadableContext",{enumerable:!0,get:function(){return a}});let a=s(38754)._(s(67294)).default.createContext(null)},35491:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return p}});let a=s(38754)._(s(67294)),r=s(1159),l=[],n=[],i=!1;function o(e){let t=e(),s={loading:!0,loaded:null,error:null};return s.promise=t.then(e=>(s.loading=!1,s.loaded=e,e)).catch(e=>{throw s.loading=!1,s.error=e,e}),s}class d{promise(){return this._res.promise}retry(){this._clearTimeouts(),this._res=this._loadFn(this._opts.loader),this._state={pastDelay:!1,timedOut:!1};let{_res:e,_opts:t}=this;e.loading&&("number"==typeof t.delay&&(0===t.delay?this._state.pastDelay=!0:this._delay=setTimeout(()=>{this._update({pastDelay:!0})},t.delay)),"number"==typeof t.timeout&&(this._timeout=setTimeout(()=>{this._update({timedOut:!0})},t.timeout))),this._res.promise.then(()=>{this._update({}),this._clearTimeouts()}).catch(e=>{this._update({}),this._clearTimeouts()}),this._update({})}_update(e){this._state={...this._state,error:this._res.error,loaded:this._res.loaded,loading:this._res.loading,...e},this._callbacks.forEach(e=>e())}_clearTimeouts(){clearTimeout(this._delay),clearTimeout(this._timeout)}getCurrentValue(){return this._state}subscribe(e){return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}constructor(e,t){this._loadFn=e,this._opts=t,this._callbacks=new Set,this._delay=null,this._timeout=null,this.retry()}}function c(e){return function(e,t){let s=Object.assign({loader:null,loading:null,delay:200,timeout:null,webpack:null,modules:null},t),l=null;function o(){if(!l){let t=new d(e,s);l={getCurrentValue:t.getCurrentValue.bind(t),subscribe:t.subscribe.bind(t),retry:t.retry.bind(t),promise:t.promise.bind(t)}}return l.promise()}if(!i){let e=s.webpack?s.webpack():s.modules;e&&n.push(t=>{for(let s of e)if(t.includes(s))return o()})}function c(e,t){!function(){o();let e=a.default.useContext(r.LoadableContext);e&&Array.isArray(s.modules)&&s.modules.forEach(t=>{e(t)})}();let n=a.default.useSyncExternalStore(l.subscribe,l.getCurrentValue,l.getCurrentValue);return a.default.useImperativeHandle(t,()=>({retry:l.retry}),[]),a.default.useMemo(()=>{var t;return n.loading||n.error?a.default.createElement(s.loading,{isLoading:n.loading,pastDelay:n.pastDelay,timedOut:n.timedOut,error:n.error,retry:l.retry}):n.loaded?a.default.createElement((t=n.loaded)&&t.default?t.default:t,e):null},[e,n])}return c.preload=()=>o(),c.displayName="LoadableComponent",a.default.forwardRef(c)}(o,e)}function x(e,t){let s=[];for(;e.length;){let a=e.pop();s.push(a(t))}return Promise.all(s).then(()=>{if(e.length)return x(e,t)})}c.preloadAll=()=>new Promise((e,t)=>{x(l).then(e,t)}),c.preloadReady=e=>(void 0===e&&(e=[]),new Promise(t=>{let s=()=>(i=!0,t());x(n,e).then(s,s)})),window.__NEXT_PRELOADREADY=c.preloadReady;let p=c},75772:function(e,t,s){"use strict";s.d(t,{Z:function(){return p}});var a=s(85893),r=s(53660),l=s(67294),n=s(59335),i=s(42746),o=s(25675),d=s.n(o),c=s(35103);let x=[1,2,3,4,5,6];function p({open:e,isMultiple:t=!1,quality:s,pages:o}){let p=(0,i.useTranslations)("generator"),[u,m]=(0,l.useState)(1),h=function(e,t){if(!e||!c.kX[e])return null;let[s,a]=c.kX[e],r=Math.max(1,Math.floor(t??1)),l=s*r,n=a*r;if(n<90)return{key:"loaderEtaSeconds",values:{min:l,max:n}};let i=Math.max(1,Math.round(l/60)),o=Math.max(i,Math.round(n/60));return i===o?{key:"loaderEtaAboutMinutes",values:{value:i}}:{key:"loaderEtaMinutes",values:{min:i,max:o}}}(s,o);return(0,l.useEffect)(()=>
1{if(!e){m(1);return}let t=setInterval(()=>{m(e=>e%x.length+1)},3500);return()=>clearInterval(t)},[e]),(0,a.jsx)(n.Dialog,{open:e,size:"sm",handler:()=>void 0,className:"focus-visible:outline-none rounded-[24px] overflow-hidden bg-white shadow-2xl",children:(0,a.jsxs)(n.DialogBody,{className:"!border-b-0 px-6 py-8 flex flex-col items-center",children:[(0,a.jsxs)("div",{className:"relative w-[236px] h-[236px] rounded-[18px] overflow-hidden bg-[#FAFAF9] ring-1 ring-[#ECE7F7] shadow-[0_12px_34px_rgba(107,70,193,0.14)]",children:[x.map(e=>(0,a.jsx)(d(),{src:(0,r.w)(`/images/generator/generator-img-${e}.webp`),width:472,height:472,priority:1===e,className:`absolute inset-0 w-full h-full object-cover transition-opacity duration-1000 ease-in-out ${u===e?"opacity-100":"opacity-0"}`,alt:""},e)),(0,a.jsxs)("div",{className:"absolute top-[10px] right-[10px] flex items-center gap-[5px] rounded-full bg-white/85 backdrop-blur-sm px-[9px] py-[4px] shadow-sm",children:[(0,a.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#8832D4",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-pulse",children:(0,a.jsx)("path",{d:"M12 3l1.8 4.9L18.7 9.6l-4.9 1.8L12 16.3l-1.8-4.9L5.3 9.6l4.9-1.8L12 3z"})}),(0,a.jsx)("span",{className:"text-[10.5px] font-bold text-[#8832D4] tracking-wide",children:"AI"})]})]}),(0,a.jsx)("div",{className:"gen-loader-track w-full lg:w-[86%] h-[7px] rounded-full bg-[#F0E9FF] mt-7 mb-5"}),(0,a.jsx)("h3",{className:"font-extrabold text-[#1a1a1a] text-[23px] lg:text-[26px] text-center leading-tight tracking-tight px-1",children:p(t?"loaderMultpleMsg1":"loaderMsg1")}),t&&(0,a.jsx)("p",{className:"text-center text-[15.5px] lg:text-[17px] text-[#6B46C1] font-bold mt-2.5 px-1",children:p("loaderMultipleMsg2")}),(0,a.jsx)("p",{className:"text-[14.5px] lg:text-[16px] text-center text-[#5A5754] font-semibold mt-2 px-2 leading-snug max-w-[92%]",children:p(t?"loaderMultipleMsg3":"loaderMsg3")}),!t&&(0,a.jsx)("p",{className:"text-[13.5px] lg:text-[14.5px] text-center text-[#5A5754] font-medium mt-3 px-2",children:p("loaderMsg4")}),h&&(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 mt-4 rounded-full bg-[#F5F3F0] px-3 py-[5px] text-[12.5px] font-semibold text-[#5A5754]",children:[(0,a.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,a.jsx)("path",{d:"M12 7v5l3 2"})]}),p(h.key,h.values)]}),t&&(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-[11.5px] font-semibold text-[#8832D4] bg-[#8832D4]/[0.08] rounded-full px-3 py-1 mt-4",children:[(0,a.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,a.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-[#8832D4] opacity-60"}),(0,a.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-[#8832D4]"})]}),p("activityCenterTitle")]})]})})}},43854:function(e,t,s){"use strict";s.d(t,{Z:function(){return c}});var a=s(85893),r=s(53660);s(67294);var l=s(11163),n=s(59335),i=s(42746),o=s(25675),d=s.n(o);function c({open:e,handleCancel:t,title:s,description:o,ctaLabel:c}){let x=(0,i.useTranslations)("generator"),p=(0,l.useRouter)(),u=s??x("upgradeDialogText1"),m=o??x("upgradeDialogLong1"),h=c??x("upgradeTextBtn");return(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(n.Dialog,{open:e,size:"xs",handler:()=>console.log(""),className:"focus-visible:outline-none rounded-3xl overflow-hidden",children:[(0,a.jsx)("div",{className:"absolute top-3 right-3 z-50",children:(0,a.jsx)(n.IconButton,{color:"blue-gray",size:"sm",variant:"text",onClick:t,className:"rounded-full hover:bg-gray-100",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"h-5 w-5 text-gray-500",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})}),(0,a.jsxs)(n.DialogBody,{className:"px-8 py-10 flex flex-col justify-center items-center",children:[(0,a.jsx)(d(),{src:(0,r.w)("/images/graph_upgrade-plan-business.png"),width:"180",height:"160",className:"m-auto mb-6",alt:"loading-generating-image"}),(0,a.jsx)("p",{className:"mt-0 mb-2 m-auto text-blackOne text-[20px] text-center relative w-full font-bold leading-tight",children:u}),(0,a.jsx)("p",{className:"mt-0 mb-8 m-auto text-gray-600 text-[15px] text-center relative w-full font-medium leading-relaxed px-4",children:m}),(0,a.jsx)("button",{type:"submit",className:`w-full text-white bg-linkTwo hover:bg-linkTwo/90 font-bold text-sm px-5 py-3 outline-none 2 text-center shadow-lg shadow-purple-500/30 rounded-full transition-all duration-300 cursor-pointer justify-center`,onClick:()=>p.push("/pricing"),children:h})]})]})})}},99942:function(e,t,s){"use strict";s.d(t,{EO:function(){return c},Gt:function(){return n},Z8:function(){return d},_P:function(){return r},bw:function(){return i},gp:function(){return o},sC:function(){return l},xg:function(){return x}});var a=s(52649);let r=async()=>{try{return a.Z.get("payments/payments")}catch(e){return console.log(e),{status:!1,message:e?.message}}},l=async()=>{try{return a.Z.get("payments/payment-methods")}catch(e){return console.log(e),{status:!1,message:e?.message}}},n=async(e,t=null)=>{try{return a.Z.post("payments/extra-credits/card/paid",{cardID:t,creditId:e})}catch(e){return console.log(e),{status:!1,message:e?.message}}},i=async e=>{try{return a.Z.post("payments/new-payment-method",{cardID:e})}catch(e){return console.log(e),{status:!1,message:e?.message}}},o=async e=>{try{return a.Z.post("payments/delete-payment-method",{paymentMethodId:e})}catch(e){return console.log(e),{status:!1,message:e?.message}}},d=async(e=null)=>{try{return a.Z.post("payments/resume-subscription",{cardID:e})}catch(e){return console.log(e),{status:!1,message:e?.message}}},c=async()=>{try{return a.Z.get("payments/cancel-subscription")}catch(e){return console.log(e),{status:!1,message:e?.message}}},x=async()=>
2{try{return a.Z.get("payments/cancel-trial-period")}catch(e){return console.log(e),{status:!1,message:e?.message}}}},113:function(e,t,s){"use strict";s.d(t,{HY:function(){return o},LR:function(){return d},VR:function(){return n},ao:function(){return i},ik:function(){return l},rj:function(){return r}});var a=s(52649);let r=async(e=null)=>{try{return a.Z.post("generator/options/list",{id:e})}catch(e){return console.log(e),{status:!1,message:e?.message}}},l=async e=>{try{return a.Z.post("generator/create/blackwhite/variations",{id:e})}catch(e){return console.log(e),{status:!1,message:e?.message}}},n=async e=>{try{return a.Z.post("generator/images/code",{code:e})}catch(e){return console.log(e),{status:!1,message:e?.message}}},i=async e=>{try{return a.Z.post("generator/image/delete",{id:e})}catch(e){return console.log(e),{status:!1,message:e?.message}}},o=async(e,t)=>{try{return a.Z.post("generator/images/variations",{id:e,variations:t})}catch(e){return console.log(e),{status:!1,message:e?.message}}},d=async()=>{try{return a.Z.get("generator/user/last-image")}catch(e){return console.log(e),{status:!1,message:e?.message}}}},2348:function(e,t,s){"use strict";var a=s(85893),r=s(67294),l=s(37868),n=s(59335),i=s(59718),o=s(91594),d=s(42746),c=s(48936),x=s(63434),p=s(14341);t.Z=({preview:e,setImgRaw:t,setPreview:s})=>{let u=(0,c.T)(),m=(0,d.useTranslations)("generator"),h=(0,r.useCallback)(e=>{let a=e[0];if(a){if(!["image/jpeg","image/png","image/gif","image/jpg"].includes(a.type)){u((0,x.CF)({message:m("errors.unsupportedFormat"),type:p.ToastType.ERROR}));return}s(URL.createObjectURL(a)),t(a)}},[]),g=(0,r.useCallback)(e=>{for(let t of e)for(let e of t.errors){if("file-too-large"===e.code){u((0,x.CF)({message:m("errors.5mbMaxAllowed"),type:p.ToastType.ERROR}));return}if("file-invalid-type"===e.code){u((0,x.CF)({message:m("errors.unsupportedFormat"),type:p.ToastType.ERROR}));return}}u((0,x.CF)({message:"Upload error",type:p.ToastType.ERROR}))},[u,m]),{getRootProps:f,getInputProps:b,open:y}=(0,l.uI)({onDrop:h,onDropRejected:g,noClick:!0,noKeyboard:!0,accept:{"image/*":[".jpeg",".jpg",".png",".gif"]},maxFiles:1,maxSize:5242880});return(0,a.jsxs)("div",{...f(),className:" border-2 border-dashed border-[#DDDAD6] rounded-2xl p-4 relative hover:border-purpleFour transition-colors flex items-center justify-center w-full mt-3 mb-3 bg-[#FAFAF8] min-h-[140px] max-h-[200px] ",children:[(0,a.jsx)("input",{...b()}),!e&&(0,a.jsxs)("div",{className:"flex flex-col text-center items-center",children:[(0,a.jsx)(i.Z,{className:"h-12 w-12 text-gray-400 mx-auto py-2"}),(0,a.jsx)(n.Typography,{variant:"h6",color:"gray",className:"mb-1 font-medium text-sm",children:m("dropTitle")}),(0,a.jsx)(n.Typography,{variant:"small",color:"gray",className:"mb-3 font-normal text-xs",children:"PNG, JPG or GIF (max. 5MB)"}),(0,a.jsx)("button",{className:"bg-white text-purpleOne border border-purpleOne rounded-full px-6 py-1.5 hover:bg-purple-50 transition-colors font-bold text-xs shadow-sm",onClick:y,children:m("selectImg")})]}),e&&(0,a.jsxs)("div",{className:"relative flex items-center justify-center bg-white p-2 rounded-xl shadow-sm border border-gray-200",children:[(0,a.jsx)("img",{src:e,alt:"Preview",className:"max-h-36 max-w-36 object-contain rounded-lg"}),(0,a.jsx)("div",{className:"absolute -top-2 -right-2 bg-white rounded-full shadow-md",children:(0,a.jsx)(n.IconButton,{variant:"text",size:"sm",color:"red",className:"rounded-full hover:bg-red-50",onClick:()=>{s(""),t(null)},children:(0,a.jsx)(o.Z,{className:"h-5 w-5"})})})]})]})}},71529:function(e,t,s){"use strict";var a=s(85893),r=s(73381),l=s(91297),n=s(35103),i=s(53660),o=s(67294),d=s(25675),c=s.n(d),x=s(9080),p=s(94239),u=s(96287),m=s(58537),h=s(42746),g=s(48936),f=s(16612),b=s(63434),y=s(14341),j=s(9473),w=s(11163),v=s(75772),N=s(43854),k=s(59335),C=s(113),L=s(22121),S=s(29844),T=s(52787),E=s(16891),F=s(70238),B=s(99942),_=s(51113),D=s(57784),I=s(87717),R=s(84128),P=s(91966),O=s(13114),M=s(2348),A=s(52956);let W={visualStylesSelect:"Cartoons",visualStylesInput:"",mainText:"",variations:1,imageSize:"1024x1024"},$={antiStress:"",expression:"",creativity:"",educational:"",bondings:"",mindfulness:"",textIdea:""};t.Z=({isFreePage:e})=>{let t=(0,h.useTranslations)("generator"),s=(0,S.ZK)(),d=(0,w.useRouter)(),z=(0,g.T)(),Z=(0,o.useRef)(null),{profile:q,pendingTutorialAction:G}=(0,j.v9)(e=>e.users),[H,V]=(0,o.useState)(W),[Y,U]=(0,o.useState)($),[J,K]=(0,o.useState)(1),[Q,X]=(0,o.useState)(1),[ee,et]=(0,o.useState)(50),[es,ea]=(0,o.useState)(50),[er,el]=(0,o.useState)("square"),[en,ei]=(0,o.useState)(!1),[eo,ed]=(0,o.useState)(!1),[ec,ex]=(0,o.useState)(!0),[ep,eu]=(0,o.useState)({}),[em,eh]=(0,o.useState)([]),[eg,ef]=(0,o.useState)(!1),[eb,ey]=(0,o.useState)(!1),[ej,ew]=(0,o.useState)(!1),[ev,eN]=(0,o.useState)(!1),[ek,eC]=(0,o.useState)(!1),[eL,eS]=(0,o.useState)(""),[eT,eE]=(0,o.useState)(!1),[eF,eB]=(0,o.useState)(!1),[e_,eD]=(0,o.useState)(!1),[eI,eR]=(0,o.useState)(!1),[eP,eO]=(0,o.useState)(!1),[eM,eA]=(0,o.useState)(!0),[eW,e$]=(0,o.useState)(!1),[ez,eZ]=(0,o.useState)(!1),[eq,eG]=(0,o.useState)(!1),[eH,eV]=(0,o.useState)([]),[eY,eU]=(0,o.useState)(""),[eJ,eK]=(0,o.useState)({prompts:""}),[eQ,eX]=(0,o.useState)(!1),[e0,e1]=(0,o.useState)(!0),[e2,e4]=(0,o.useState)(null),[e6,e5]=(0,o.useState)(""),[e3,e8]=(0,o.useState)(!0),[e9,e7]=(0,o.useState)("free"),[te,tt]=(0,o.useState)(""),[ts,ta]=(0,o.useState)(""),[tr,tl]=(0,o.useState)(""),[tn,ti]=(0,o.useState)("medium"),[to,td]=(0,o.useState)(""),tc="words"===e9&&!e,tx=(0,l.c)(!e&&!tc&&!!q.access_token),{data:tp,isLoading:tu}=(0,x.os)(tc),{mutate:tm,isPending:th}=(0,x.$2)(),tg=(0,o.useMemo)(()=>tp?.styles?.find(e=>e.id===ts)??null,[tp,ts]),[tf,tb]=(0,o.useState)("");(0,o.useEffect)(()=>
2{if(!d.isReady)return;let{type:e,style:t}=d.query;"string"==typeof e&&"words-names"===e.toLowerCase()&&(e7("words"),ex(!0)),"string"==typeof t&&t.trim()&&tb(t.trim().toLowerCase())},[d.isReady,d.query]),(0,o.useEffect)(()=>{!tp?.styles?.length||ts&&tp.styles.some(e=>e.id===ts)||ta(((tf?tp.styles.find(e=>e.id.toLowerCase()===tf):null)??tp.styles.find(e=>e.isDefault)??tp.styles[0]).id)},[tp,ts,tf]),(0,o.useEffect)(()=>{let e=tp?.backgroundDensities;e?.length&&(e.some(e=>e.id===tn)||ti((e.find(e=>e.isDefault)??e[0]).id))},[tp,tn]),(0,o.useEffect)(()=>{if(!tc||!te){td("");return}let e=(0,p.yd)(te,{maxLength:tp?.maxLength,maxWords:tp?.maxWords,styleMaxWordLength:tg?.maxWordLength});td(e.valid?"":e.code)},[tc,te,tp,tg]);let{data:ty}=(0,m.pF)();(0,o.useEffect)(()=>{"1"!==localStorage.getItem("ideasSpotlightDismissed")&&e8(!1)},[]);let tj=()=>{e8(!0);try{localStorage.setItem("ideasSpotlightDismissed","1")}catch{}},tw=!!ty&&!ty.hasCreatedIdeas&&!e3&&ec,{mutate:tv}=(0,x.LA)(),{streamedIdeas:tN,isStreaming:tk,start:tC,setStreamedIdeas:tL}=(0,x.ER)("generator/create/ideas/stream"),{mutate:tS}=(0,x.rW)(),{mutate:tT}=(0,x.fP)(),{mutate:tE,isPending:tF}=(0,x.Md)(),{data:tB,refetch:t_}=(0,x.lf)({skip:0}),tD=(0,o.useMemo)(()=>(tB??[]).some(e=>("single"===e.type||"sketch"===e.type||"word"===e.type)&&("pending"===e.status||"running"===e.status)),[tB]),{mutate:tI}=(0,x.Py)(),{mutate:tR}=(0,x.fr)(),{data:tP,isLoading:tO}=(0,x.J0)(),{data:tM,refetch:tA}=(0,x.He)(),tW=tk?tN:tN.length>0?tN:tM??[],{data:t$,isLoading:tz,refetch:tZ}=(0,x.gf)(),{data:tq}=(0,x.pY)(),{refetch:tG}=(0,u.Y)(),tH=(0,A.$)("generator"),tV=(e,t)=>{if(!e)return e;let s=e.toLowerCase(),a=s.endsWith("s")?s:s+"s",r=s.endsWith("s")?s.slice(0,-1):s;return t.find(t=>t.value===e)?.value??t.find(e=>String(e.value).toLowerCase()===s)?.value??t.find(e=>String(e.value).toLowerCase()===a)?.value??t.find(e=>String(e.value).toLowerCase()===r)?.value??t.find(e=>String(e["name-en"]).toLowerCase()===s)?.value??e},tY=e=>{let t=e.toLowerCase();if(t.includes("square"))return"square";if(t.includes("landscape"))return"landscape";if(t.includes("letter")||t.includes("a4")||t.includes("kdp")||t.includes("portrait"))return"portrait";let s=t.match(/(\d+(?:\.\d+)?)\s*[xÃ]\s*(\d+(?:\.\d+)?)/);if(s){let e=parseFloat(s[1]),t=parseFloat(s[2]);if(e&&t){let s=e/t;return s>1.1?"landscape":s<.9?"portrait":"square"}}return null};(0,o.useEffect)(()=>{tH&&(tH.prompt&&(eS(tH.prompt),e7("free"),eC(!0)),tH.prompt&&V(e=>({...e,mainText:tH.prompt})))},[tH]),(0,o.useEffect)(()=>{if(!tH?.style||!em?.length)return;let e=em[0]?.data??[];if(!e.length)return;let t=tV(tH.style,e);V(e=>({...e,visualStylesSelect:t,visualStylesInput:""}))},[tH,em]),(0,o.useEffect)(()=>{if(!tH?.size||!tq?.length)return;let e=tY(tH.size);if(!e)return;let t=tq.find(t=>t.label===e);t&&(el(t.label??"square"),K(t.credits??1),X((t.credits??1)*(H.variations??1)),ea(t.pos??50),V(e=>({...e,imageSize:t.value??"1024x1024"})))},[tH,tq]),(0,o.useEffect)(()=>(z((0,f.Je)("AI Drawing Creator")),window.addEventListener("resize",tQ),tQ(),tX(),()=>{window.removeEventListener("resize",tQ)}),[]);let tU=(0,o.useRef)(!1);(0,o.useEffect)(()=>{if(tU.current||!ty)return;tU.current=!0;let e=!q.plan||q.plan?.type==="free",t=!ty.hasGeneratedImage&&!ty.hasCreatedBook&&!ty.hasCreatedIdeas;e&&t&&!eL&&tK()},[ty]),(0,o.useEffect)(()=>{eL&&eK({...eJ,prompts:""})},[eL]),(0,o.useEffect)(()=>{if(!tq||!tq.length)return;let e=tq.find(e=>e.label===er);e&&(K(e.credits),X(e.credits*(H.variations??1)))},[tq]),(0,o.useEffect)(()=>{let e=setTimeout(()=>{let e=Z.current;e&&e.value&&(e.style.height="auto",e.style.height=Math.min(e.scrollHeight,200)+"px",e.style.overflowY=e.scrollHeight>200?"auto":"hidden")},350);return()=>clearTimeout(e)},[eL,ec,e9]),(0,o.useEffect)(()=>{"create_ideas"===G&&(ex(!1),setTimeout(()=>{z((0,f.D3)(""))},1e3))},[G]);let tJ=()=>setTimeout(()=>{document.querySelectorAll(".input-styles-wrapper textarea").forEach(e=>{e&&e.value&&(e.style.height="auto",e.style.height=`${e.scrollHeight}px`)})},300),tK=async()=>{if(eZ(!0),await (0,x.qx)("generator/create/single-idea/stream",{ideasNumber:1,language:s},{onIdea:e=>{eS(e),tJ()}})){eZ(!1);return}tS({ideasNumber:1,language:s},{onSuccess:e=>{eZ(!1),eS(e[0]),tJ()},onError:()=>eZ(!1)})},tQ=()=>
2{window?.innerHeight<750?document.querySelector(".option-form-select")?.classList.add("form-select-wrapper-resized"):document.querySelector(".option-form-select")?.classList.remove("form-select-wrapper-resized")},tX=()=>{let e=localStorage.getItem("currentPresetIdea");if(e){let t=JSON.parse(e),s=t?.optionsKey?{...H,...(0,S.oT)(t.optionsKey)}:{...H};if("create_ideas"!==G&&ex(!0),t?.isWordArt){e7("words"),tt(t.idea??""),tl(t.decoration??""),t.letterStyle&&ta(t.letterStyle),ti(t.backgroundDensity||tp?.backgroundDensities?.find(e=>e.isDefault)?.id||"medium"),localStorage.removeItem("currentPresetIdea");return}eS(t.idea),e7("free"),eC(!0),V({...H,...s}),localStorage.removeItem("currentPresetIdea")}},t0=async e=>{eh([{data:[...e.visualStyles.filter(e=>"65b99814c03d6caf6b84a430"!==e._id)],textCheckChange:"visualStyles",textOptionInput:"visualStylesInput",textOptionSelect:"visualStylesSelect",title:t("visualStylesTitle"),textTooltipInf:"infoTooltipStyles"}])},t1=(e,t)=>{let s=["longText","variations","imageSize"],a=e.replace("Select","").replace("Input","");if("text"===t){t4(a);return}!s.includes(a)&&e.includes("Input")?V({...H,[`${a}Input`]:t,[`${a}Select`]:""}):!s.includes(a)&&e.includes("Select")?V({...H,[`${a}Input`]:"",[`${a}Select`]:t}):V({...H,[a]:t})},t2=(e,t,s=!1)=>{s?U({...$,textIdea:t}):U({...$,textIdea:"",[e]:t})},t4=e=>{eu({...ep,[e]:!ep[e]}),V({...H,[`${e}Input`]:"",[`${e}Select`]:""})},t6=th||tF||en,t5=async()=>{H.variations=1;let a={...H};if(tc){let e=(0,p.yd)(te,{maxLength:tp?.maxLength,maxWords:tp?.maxWords,styleMaxWordLength:tg?.maxWordLength});if(!e.valid){td(e.code);return}if(!ts){z((0,b.CF)({message:t("wordStyleRequired"),type:y.ToastType.ERROR}));return}if(tD){z((0,b.CF)({message:t("singleJobInProgress"),type:y.ToastType.WARNING,timing:7e3}));return}tm({word:e.word,letterStyle:ts,imageSize:H.imageSize,decoration:tr,backgroundDensity:tn,isAutoImprove:eM,language:s},{onSuccess:()=>z((0,f.ym)(!0)),onError:e=>{t_(),t8(e)}});return}if(!eL||eL.length<3){eK({...eJ,prompts:t("drawingIdeaLengthErr")});return}if(eQ&&!e2){z((0,b.CF)({message:"Please upload an image",type:y.ToastType.ERROR}));return}let r=(0,S.Lg)(a,t,em);if(!r.status){z((0,b.CF)({message:r.err,type:y.ToastType.ERROR}));return}if(e){ei(!0),tT({...r.formData,mainIdea:eL},{onSuccess:()=>t3(),onError:e=>t8(e)});return}if(tD){z((0,b.CF)({message:t("singleJobInProgress"),type:y.ToastType.WARNING,timing:7e3}));return}if(!tx.ready)return;let l=(0,n.k7)(tx.option,1,eQ&&!!e2);if(void 0!==l&&q.credits<l){eE(!0);return}tE({quality:tx.quality,mainIdea:eL,visualStyle:r.formData.options.visualStyles,imageSize:r.formData.imageSize,isAutoImprove:eM,language:s,charImage:eQ?e2:null},{onSuccess:()=>{z((0,f.ym)(!0))},onError:e=>{t_(),t8(e)}})},t3=()=>{setTimeout(()=>{t9()},1e4)},t8=e=>{if(ei(!1),"Insufficient credits"===e){eE(!0);return}if("You have reached the limit of 5 images for today"===e&&q?.onTrialPeriod){eR(!0);return}"limit max free images"===e&&(tG(),z((0,f.$l)({...q,newAccount:!1})),d.push({pathname:"/pricing"})),z((0,b.CF)({message:e??"Unexpected Error",type:y.ToastType.ERROR}))},t9=async(e=40)=>{try{let e=await (0,C.LR)();if("string"==typeof e.data&&e.data.startsWith("ERR:")){eG(!0),ei(!1);return}await z((0,f.$l)({...q,credits:q.credits-sl(),maxFreeImages:0})),ei(!1),localStorage.setItem("storedImgDetail",JSON.stringify(e.data.metadata)),d.push("/images-gallery")}catch(s){e>0?setTimeout(()=>{t9(e-1)},3e3):(ei(!1),z((0,b.CF)({message:t("errors.generatedImg"),type:y.ToastType.ERROR})))}},t7=async()=>{let e={objective:"",topic:"",textIdea:""};if(""===(e=Y.textIdea?{...e,textIdea:Y.textIdea}:{...(0,S.RD)(Y)}).textIdea){z((0,b.CF)({message:t("textIdeaEmptyError"),type:y.ToastType.ERROR,timing:6e3}));return}eN(!0);let a={...e,language:s},r=()=>setTimeout(()=>{window.scrollTo({top:document.body.scrollHeight,behavior:"smooth"})},500),l=e=>{if("You have reached the maximum number of ideas allowed for your current plan"===e){ew(!0);return}z((0,b.CF)({message:e??"Unexpected Error",type:y.ToastType.ERROR}))};if(await tC(a,{onDone:({haveRemaining:e})=>{q.plan?.ideasLimit==="unlimit"||(tZ(),e||ew(!0))},onError:l})){eN(!1),tj(),r(),z((0,f.o_)()),tA().finally(()=>tL([]));return}tv(a,{onSuccess:e=>{tA(),q.plan?.ideasLimit==="unlimit"||(tZ(),e.haveRemaining||ew(!0)),tj(),z((0,f.o_)()),eN(!1),r()},onError:e=>{l(e),eN(!1)}})},se=()=>{ey(!1),eR(!1)},st=async()=>{eE(!1)},ss=async()=>
2{if(ed(!0),q.onTrialPeriod)try{await (0,B.xg)(),(0,f.In)(),await sa(),ed(!1),window.location.reload()}catch(e){console.log("error activating subs",e),ed(!1),st()}else d.push("/pricing")},sa=async()=>{let e=await (0,_.VW)();e.status&&z((0,f.$l)({...q,credits:e.user.credits,subscription:e.user.subscription,onTrialPeriod:e.user.onTrialPeriod??!1,plan:e.user.plan}))},sr=async()=>{tG(),z((0,f.$l)({...q,newAccount:!1})),d.push({pathname:"/pricing"})},sl=()=>e||tc?Number(((0,S.l8)(J.toString(),"gpt-image")*(H.variations??1)).toFixed(2)):(0,n.k7)(tx.option,1,eQ&&!!e2)??0,sn=()=>(Number(q.plan?.ideasLimit)??10)-(t$??0);return(0,o.useMemo)(()=>{tP&&(t0(tP),ef(!0))},[tP]),(0,o.useEffect)(()=>{em?.length&&em.flatMap(e=>e?.data??[]).forEach(e=>{if(!e?.icon)return;let t=new window.Image;t.decoding="async",t.src=(0,i.w)(e.icon)})},[em]),(0,o.useEffect)(()=>{eQ?(["Minimalist","Kawaii","Cartoons","Comic"].includes(H.visualStylesSelect)||V(e=>({...e,visualStylesSelect:"Cartoons",visualStylesInput:""})),eA(!1)):eA(!0)},[eQ]),(0,a.jsxs)("div",{className:`flex flex-col w-full ${e?"mt-10":"mt-[30px]"}`,children:[e&&(0,a.jsx)("div",{className:"flex justify-center md:justify-end md:mr-10 lg:mr-20",children:(0,a.jsx)("button",{type:"submit",className:`w-60 mt-20 mb-4 text-white border-greenOne bg-greenTwo border-[2px] hover:opacity-70 font-bold text-sm px-2 py-2 3 text-center shadow-green`,onClick:sr,children:t("btnTryPremium")})}),(0,a.jsxs)("p",{className:"mt-0 mb-4 m-auto font-bold text-blackOne text-[26px] md:text-[30px] text-center relative hidden",children:[t("title1"),(0,a.jsx)("span",{className:"text-purpleOne",children:t("title2")})]}),e&&(0,a.jsxs)("span",{className:"text-[12px] md:text-[16px] w-full text-center px-4 mb-8 text-blackOne",children:[t("subTitle1Demo"),(0,a.jsx)("span",{className:"font-bold",children:t("subTitle2Demo")}),t("subTitle3Demo"),(0,a.jsx)("span",{className:"font-bold",children:t("subTitle4Demo")})]}),(0,a.jsx)("div",{className:"flex items-center w-[90%] lg:w-[88%] m-auto mb-3",children:(0,a.jsxs)("p",{className:"text-[22px] font-bold text-[#1a1a1a] leading-tight",children:[t("title1"),(0,a.jsx)("span",{className:"text-purpleFour",children:t("title2")})]})}),(0,a.jsxs)("div",{className:"flex flex-row mb-4 bg-[#F0EDE8] p-[4px] rounded-[12px] w-[90%] lg:w-[88%] m-auto relative overflow-hidden",children:[(0,a.jsx)(P.E.div,{className:"absolute top-[4px] bottom-[4px] left-[4px] w-[calc(50%-4px)] bg-white rounded-[9px] z-0 shadow-sm",animate:{x:ec?"calc(100%)":"0%"},transition:{type:"spring",stiffness:350,damping:30}}),(0,a.jsx)("button",{type:"button",style:{WebkitTapHighlightColor:"transparent"},className:`flex-1 py-[8px] text-[13px] font-semibold text-center relative rounded-[9px] transition-colors duration-300 select-none z-[1] cursor-pointer 4 ${ec?"text-[#888] hover:text-[#6B46C1]":"text-[#6B46C1]"} flex flex-row items-center justify-center`,onClick:()=>{ex(!1)},children:(0,a.jsxs)("span",{className:"relative z-10 flex items-center gap-[6px]",children:[(0,a.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`transition-colors duration-300 ${ec?"text-[#8B5CF6]":""}`,children:[(0,a.jsx)("path",{d:"M12 2a7 7 0 0 1 7 7c0 2.6-1.4 4.9-3.5 6.2V17a1 1 0 0 1-1 1h-5a1 1 0 0 1-1-1v-1.8C6.4 13.9 5 11.6 5 9a7 7 0 0 1 7-7z"}),(0,a.jsx)("path",{d:"M9 21h6"}),(0,a.jsx)("path",{d:"M9 18h6"})]}),t("topBtn2"),ec&&(0,a.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"#A855F7",className:"idea-tab-spark","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M12 2l1.7 6.6L20 10l-6.3 1.4L12 18l-1.7-6.6L4 10l6.3-1.4L12 2z"})})]})}),(0,a.jsx)("button",{type:"button",style:{WebkitTapHighlightColor:"transparent"},className:`flex-1 py-[8px] text-[13px] font-semibold text-center relative rounded-[9px] transition-colors duration-300 select-none z-[1] cursor-pointer 5 ${ec?"text-[#1a1a1a]":"text-[#888] hover:text-[#555]"} flex flex-row items-center justify-center`,onClick:()=>ex(!0),children:(0,a.jsx)("span",{className:"relative z-10",children:t("topBtn1")})})]}),tw&&(0,a.jsx)("div",{className:"w-[90%] lg:w-[88%] m-auto -mt-[8px] mb-3 flex justify-start",children:(0,a.jsxs)("div",{className:"relative max-w-[330px] rounded-[12px] bg-gradient-to-br from-[#6B46C1] to-[#8B5CF6] text-white pl-[12px] pr-[30px] py-[10px] shadow-[0_10px_28px_rgba(107,70,193,0.30)]",style:{animation:"fadeIn .28s ease"},children:[(0,a.jsx)("span",{className:"absolute -top-[5px] left-[44px] w-[11px] h-[11px] rotate-45 bg-[#6B46C1]"}),(0,a.jsx)("button",{type:"button",onClick:tj,"aria-label":t("ideasSpotlightDismiss"),className:"absolute top-[6px] right-[7px] text-white/70 hover:text-white transition-colors",children:(0,a.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})}),(0,a.jsxs)("div",{className:"flex items-start gap-[9px]",children:[(0,a.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0 mt-[1px]",children:[(0,a.jsx)("path",{d:"M12 3l1.8 4.9L18.7 9.6l-4.9 1.8L12 16.3l-1.8-4.9L5.3 9.6l4.9-1.8L12 3z"}),(0,a.jsx)("path",{d:"M19 14l.7 1.9 1.9.7-1.9.7-.7 1.9-.7-1.9-1.9-.7 1.9-.7L19 14z"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[12.5px] font-bold leading-tight",children:t("ideasSpotlightTitle")}),(0,a.jsx)("p",{className:"text-[11.5px] text-white/90 leading-snug mt-[2px]",children:t("ideasSpotlightBody")})]})]})]})}),(0,a.jsx)("section",{className:`flex flex-col w-[90%] lg:w-[88%] m-auto relative px-4 pt-8 lg:px-6 pb-8 bg-white
6 border border-[#ECEAE7] rounded-[14px] mb-[80px] overflow-hidden`,children:(0,a.jsxs)(O.M,{mode:"wait",children:[!ec&&(0,a.jsxs)(P.E.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.25,ease:"easeInOut"},className:"flex flex-col mb-4 mt-0 gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col bg-[#FAFAF8] rounded-[14px] border border-[#F0EDE8] p-4 md:p-6",children:[(0,a.jsxs)("div",{className:"relative w-full",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-[6px]",children:[(0,a.jsxs)("div",{className:"flex items-center gap-[10px]",children:[(0,a.jsx)("label",{className:"text-[12px] font-semibold text-[#444]",children:t("longSinglePlaceholder")}),(0,a.jsx)(k.Tooltip,{className:"p-0 border-0 bg-transparent shadow-2xl shadow-black/25",placement:"bottom-start",content:(0,a.jsxs)("div",{className:"w-[272px] bg-white rounded-[14px] overflow-hidden border border-[#EDE8F5]",style:{boxShadow:"0 8px 32px rgba(107,70,193,0.15)"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-4 py-[10px] bg-gradient-to-r from-[#6B46C1] to-[#8B5CF6]",children:[(0,a.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M9 11l3 3L22 4"}),(0,a.jsx)("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]}),(0,a.jsx)("span",{className:"text-white text-[12px] font-bold tracking-wide",children:"Tips"})]}),(0,a.jsx)("div",{className:"px-4 pt-3 pb-1",children:(0,a.jsx)("p",{className:"text-[12px] font-medium text-[#444] leading-[1.55]",children:t("ideasTooltipText1")})}),(0,a.jsx)("div",{className:"px-4 pb-2 flex flex-col gap-[5px]",children:[t("ideasTooltipPoint1"),t("ideasTooltipPoint2"),t("ideasTooltipPoint3"),t("ideasTooltipPoint4"),t("ideasTooltipPoint5"),t("ideasTooltipPoint6")].map((e,t)=>(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("div",{className:"flex-shrink-0 w-[5px] h-[5px] rounded-full bg-[#6B46C1] mt-[6px]"}),(0,a.jsx)("span",{className:"text-[11.5px] text-[#444] leading-[1.5]",children:e.replace(/^[â¢\-]\s*/,"")})]},t))}),(0,a.jsx)("div",{className:"mx-4 h-[1px] bg-[#F0EBF9] my-2"}),(0,a.jsx)("div",{className:"px-4 pb-3",children:(0,a.jsx)("p",{className:"text-[11px] text-[#777] italic leading-[1.55]",children:t("ideasTooltipText2")})})]}),children:(0,a.jsxs)("div",{className:"flex items-center gap-[5px] border border-[#E8E5E1] bg-white hover:bg-[#F5F3F0] px-[10px] py-[4px] rounded-full cursor-pointer transition-colors duration-200 shadow-sm",children:[(0,a.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"#555",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,a.jsx)("path",{d:"M12 16v-4m0-4h.01"})]}),(0,a.jsx)("span",{className:"text-[11px] font-semibold text-[#444] leading-none",children:"Tips"})]})})]}),(0,a.jsxs)("span",{className:"text-[11px] text-[#ccc]",children:[Y.textIdea?.length??0,"/1000"]})]}),(0,a.jsx)(k.Textarea,{label:"",color:"purple",maxLength:1e3,className:"w-full !bg-white mb-1 !min-h-[122px] !border-[1.5px] !border-[#B0AEAB] !rounded-[10px]",containerProps:{className:"!min-w-0"},labelProps:{className:"hidden"},value:Y.textIdea,onChange:e=>{t2("longText",(e.target.value||"").slice(0,1e3),!0)}}),q.plan?.ideasLimit!=="unlimit"&&!tz&&(0,a.jsx)("p",{className:"text-[13px] font-medium text-[#6B46C1] mt-1 text-right",children:t(1===sn()?"singularAvailableIdeas":"availableIdeas",{count:sn()})})]}),(0,a.jsx)(k.Tooltip,{className:"border border-blue-gray-50 bg-white shadow-xl shadow-black/20",placement:"bottom",content:(0,a.jsx)("div",{className:"w-56 text-center",children:(0,a.jsx)(k.Typography,{variant:"small",className:"font-normal opacity-80 text-[13px] mb-[5px] text-blackOne",children:t("tooltipGenerateIdeas")})}),children:(0,a.jsxs)("button",{type:"submit",className:`inline-flex items-center justify-center gap-2 px-10 py-[13px] rounded-full text-white bg-purpleFour hover:bg-purpleFour/90 7 text-[15px] font-semibold transition-all mt-4 m-auto`,onClick:t7,disabled:ev,children:[(0,a.jsx)(c(),{src:(0,i.w)("/images/ideas-bulb-white.svg"),width:"20",height:"20",className:`${ev?"hidden":""}`,alt:"ideas-image"}),(0,a.jsx)("span",{className:"text-[14px]",children:ev?(0,a.jsx)(k.Spinner,{color:"purple",className:"m-auto"}):t((tM??[]).length>0?"btnGenerateNewIdeas":"btnGenerateIdeas")})]})})]}),tW.length>0&&(!ev||tk)&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-[2px]",children:[(0,a.jsxs)("div",{className:"flex items-center gap-[8px]",children:[(0,a.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#6B46C1",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M12 2a7 7 0 0 1 7 7c0 2.6-1.4 4.9-3.5 6.2V17a1 1 0 0 1-1 1h-5a1 1 0 0 1-1-1v-1.8C6.4 13.9 5 11.6 5 9a7 7 0 0 1 7-7z"}),(0,a.jsx)("path",{d:"M9 21h6"}),(0,a.jsx)("path",{d:"M9 18h6"})]}),(0,a.jsx)("p",{className:"text-[14px] font-semibold text-[#1a1a1a]",children:t("ideasGeneratedTitle")})]}),(0,a.jsxs)("span",{className:"text-[11px] text-[#6B46C1] font-semibold bg-[#F0E9FF] px-[10px] py-[4px] rounded-full leading-none",children:[tk&&(0,a.jsx)("span",{className:"inline-block w-[10px] h-[10px] mr-[6px] align-middle border-2 border-[#6
7B46C1] border-t-transparent rounded-full animate-spin"}),tW.length," ",1===tW.length?"idea":"ideas"]})]}),(0,a.jsx)(T.Z,{handleIdeaSelection:e=>{eS(e.split("<strong>")[0].trim()),ex(!0),e7("free"),eC(!0),setTimeout(()=>{window.scrollTo({top:0,behavior:"smooth"})},500)},ideasList:tW,copiedImg:eH,setCopiedImg:eV,isBookMode:!1})]})]},"ideas-tab"),ec&&(0,a.jsxs)(P.E.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.25,ease:"easeInOut"},className:"flex flex-col",children:[!e&&(0,a.jsxs)("div",{className:"flex flex-col mb-4 pb-4 border-b border-[#EFECE8]",children:[(0,a.jsx)("label",{className:"text-[12px] font-semibold text-[#444] mb-[8px]",children:t("pageTypeLabel")}),(0,a.jsx)("div",{className:"flex items-center gap-[8px] flex-wrap",children:[{key:"free",label:t("pageTypeScenes")},{key:"words",label:t("pageTypeWordsNames")}].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>{e7(e.key),eK({...eJ,prompts:""}),td(""),"words"===e.key&&(eX(!1),e4(null),e5(""))},className:`px-[16px] py-[7px] rounded-full text-[12.5px] font-semibold border transition-all duration-200 ${e9===e.key?"bg-[#6B46C1] border-[#6B46C1] text-white shadow-[0_2px_8px_-2px_rgba(107,70,193,0.45)]":"bg-white border-[#DDDAD6] text-[#555] hover:border-[#B9A6E3] hover:text-[#6B46C1]"}`,children:e.label},e.key))})]}),tc&&(0,a.jsxs)("div",{className:"flex flex-col md:flex-row gap-[14px] mb-4",children:[(0,a.jsxs)("div",{className:"flex-[2] flex flex-col",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-[6px]",children:[(0,a.jsx)("label",{className:"text-[12px] font-semibold text-[#444]",children:t("wordOrNameLabel")}),(0,a.jsxs)("div",{className:"flex items-center gap-[10px]",children:[(0,a.jsxs)("span",{className:`text-[11px] font-medium ${te.length>(tp?.maxLength??15)?"text-red-500":"text-[#909090]"}`,children:[te.length,"/",tp?.maxLength??15]}),(0,a.jsx)(k.Tooltip,{content:(0,a.jsx)("div",{className:"w-64 text-center",children:(0,a.jsx)(k.Typography,{variant:"small",color:"white",className:"font-normal opacity-80 text-[12px]",children:t("wordAiEnhanceTooltip")})}),placement:"bottom-end",className:"border border-blue-gray-50 bg-black px-4 py-3 shadow-xl shadow-black/10",children:(0,a.jsxs)("div",{className:"flex items-center gap-[6px] cursor-pointer",onClick:()=>eA(!eM),children:[(0,a.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#6B46C1",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})}),(0,a.jsx)("span",{className:"text-[12px] font-semibold text-[#6B46C1]",children:t("aiEnhanceTxt")}),(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),eA(!eM)},className:`relative w-[34px] h-[18px] rounded-full transition-colors duration-200 ${eM?"bg-[#6B46C1]":"bg-[#DDDAD6]"}`,children:(0,a.jsx)("span",{className:`absolute top-[2px] w-[14px] h-[14px] bg-white rounded-full shadow-sm transition-transform duration-200 ${eM?"left-[17px]":"left-[2px]"}`})})]})})]})]}),(0,a.jsx)("input",{type:"text",className:`w-full border rounded-[10px] px-4 py-[11px] text-[13px] text-[#1a1a1a] placeholder-[#bbb] focus:outline-none transition-colors bg-white ${to?"border-red-400 focus:border-red-500":"border-[#B0AEAB] focus:border-[#6B46C1]"}`,placeholder:t("wordOrNamePlaceholder"),value:te,onChange:e=>tt(e.target.value)}),to&&(0,a.jsxs)("div",{className:"flex items-center gap-[6px] mt-[6px] px-1",children:[(0,a.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,a.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,a.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),(0,a.jsx)("p",{className:"text-[12.5px] text-red-500",children:"WORD_TOO_LONG_FOR_STYLE"===to?t("wordErrTooLongForStyle",{style:tg?.label??"",max:tg?.maxWordLength??8}):t(`wordErr.${to}`)})]}),"WORD_TOO_LONG_FOR_STYLE"===to&&tp&&(0,a.jsxs)("div",{className:"flex items-center gap-[6px] mt-[8px] flex-wrap",children:[(0,a.jsx)("span",{className:"text-[11.5px] text-[#666]",children:t("wordTryAnotherStyle")}),tp.styles.filter(e=>e.id!==ts&&(null==e.maxWordLength||e.maxWordLength>=te.trim().length)).slice(0,3).map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>ta(e.id),className:"px-[10px] py-[3px] rounded-full border border-[#B9A6E3] text-[11.5px] font-semibold text-[#6B46C1] hover:bg-[#F3EEFC] transition-colors",children:e.label},e.id))]}),(0,a.jsxs)("div",{className:"flex flex-col mt-4",children:[(0,a.jsxs)("label",{className:"text-[12px] font-semibold text-[#444] mb-[6px]",children:[t("decorationLabel")," ",(0,a.jsx)("span",{className:"font-normal text-[#909090]",children:t("optionalTxt")})]}),(0,a.jsx)("input",{type:"text",className:"w-full border border-[#B0AEAB] rounded-[10px] px-4 py-[11px] text-[13px] text-[#1a1a1a] placeholder-[#bbb] focus:border-[#6
7B46C1] focus:outline-none transition-colors bg-white",placeholder:t("decorationPlaceholder"),value:tr,onChange:e=>tl(e.target.value)})]}),!!tp?.backgroundDensities?.length&&(0,a.jsxs)("div",{className:"flex flex-col mt-4",children:[(0,a.jsx)("label",{className:"text-[12px] font-semibold text-[#444] mb-[6px]",children:t("backgroundDensityLabel")}),(0,a.jsx)("div",{className:"flex items-center gap-[8px] flex-wrap",children:tp.backgroundDensities.map(e=>{let t=tn===e.id;return(0,a.jsx)("button",{type:"button","aria-pressed":t,onClick:()=>ti(e.id),className:`px-[14px] py-[7px] rounded-full text-[12.5px] font-semibold border transition-colors ${t?"bg-[#6B46C1] border-[#6B46C1] text-white":"bg-white border-[#B0AEAB] text-[#444] hover:border-[#6B46C1] hover:text-[#6B46C1]"}`,children:e.label},e.id)})}),["simple","medium","full"].includes(tn)&&(0,a.jsx)("span",{className:"text-[11px] text-[#909090] mt-[6px] leading-snug",children:t(`backgroundDensityHint.${tn}`)})]})]}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,a.jsx)("label",{className:"text-[12px] font-semibold text-[#444] mb-[6px]",children:t("letterStyleLabel")}),(0,a.jsx)("div",{className:"relative border border-[#B0AEAB] rounded-[10px] bg-white",children:(0,a.jsx)(k.Select,{label:"",className:"!min-w-[50px] select-option-generator !border-0 !rounded-[10px] !bg-transparent",disabled:tu||!tp?.styles?.length,value:ts,labelProps:{className:"hidden"},containerProps:{className:"!min-w-0 !border-0"},menuProps:{className:"z-[9999] max-h-[260px] overflow-y-auto"},onChange:e=>ta(e??""),selected:()=>tg?(0,a.jsx)("span",{className:"text-[13px] text-blackOne",children:tg.label}):null,children:(tp?.styles??[]).map(e=>(0,a.jsx)(k.Option,{value:e.id,className:"flex flex-row items-center gap-2",children:(0,a.jsx)("span",{className:"text-[13px] text-blackOne",children:e.label})},e.id))})}),tg?.reliability==="medium"&&(0,a.jsx)("span",{className:"text-[11px] text-[#909090] mt-[6px] leading-snug",children:tg.maxWordLength?t("letterStyleHintShort",{max:tg.maxWordLength}):t("letterStyleHintMedium")})]})]}),!tc&&(0,a.jsxs)("div",{className:"flex flex-col md:flex-row gap-[14px] mb-4",children:[(0,a.jsxs)("div",{className:"flex-[2] flex flex-col",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-[6px]",children:[(0,a.jsxs)("div",{className:"flex items-center gap-[10px]",children:[(0,a.jsx)("label",{className:"text-[12px] font-semibold text-[#444]",children:t("coloringIdea")}),(0,a.jsx)(k.Tooltip,{className:"p-0 border-0 bg-transparent shadow-2xl shadow-black/25",placement:"bottom-start",content:(0,a.jsxs)("div",{className:"w-[280px] bg-white rounded-[14px] overflow-hidden border border-[#EDE8F5]",style:{boxShadow:"0 8px 32px rgba(107,70,193,0.15)"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-4 py-[12px] bg-[#6B46C1]",children:[(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),(0,a.jsx)("span",{className:"text-white text-[13px] font-bold leading-tight",children:t("drawTipTitle")})]}),(0,a.jsx)("div",{className:"px-4 pt-3 pb-2 flex flex-col gap-[8px]",children:[t("drawTipPoint1"),t("drawTipPoint2"),t("drawTipPoint3")].map((e,t)=>(0,a.jsxs)("div",{className:"flex items-start gap-[8px]",children:[(0,a.jsx)("div",{className:"flex-shrink-0 w-[16px] h-[16px] rounded-full bg-[#EDE8F5] flex items-center justify-center mt-[1px]",children:(0,a.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"#6B46C1",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("polyline",{points:"20 6 9 17 4 12"})})}),(0,a.jsx)("span",{className:"text-[12px] text-[#333] leading-[1.5]",children:e})]},t))}),(0,a.jsx)("div",{className:"mx-4 h-[1px] bg-[#F0EBF9] my-1"}),(0,a.jsxs)("div",{className:"px-4 pt-2 pb-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-[6px] mb-[6px]",children:[(0,a.jsx)("div",{className:"w-[8px] h-[8px] rounded-full bg-[#10B981]"}),(0,a.jsx)("span",{className:"text-[11px] font-bold text-[#10B981] uppercase tracking-wide",children:t("drawTipPromptLabel")})]}),(0,a.jsxs)("p",{className:"text-[12px] text-[#333] italic leading-[1.55] mb-[6px]",children:['"',t("drawTipPromptExample"),'"']}),(0,a.jsxs)("p",{className:"text-[11px] text-[#888] leading-[1.5]",children:[(0,a.jsx)("span",{className:"font-semibold text-[#666]",children:t("drawTipWhyLabel")})," ",t("drawTipWhyText")]})]})]}),children:(0,a.jsxs)("div",{className:"flex items-center gap-[5px] border border-[#
7E8E5E1] bg-white hover:bg-[#F5F3F0] px-[10px] py-[4px] rounded-full cursor-pointer transition-colors duration-200 shadow-sm",children:[(0,a.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"#555",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,a.jsx)("path",{d:"M12 16v-4m0-4h.01"})]}),(0,a.jsx)("span",{className:"text-[11px] font-semibold text-[#444] leading-none",children:"Tips"})]})})]}),(0,a.jsx)(k.Tooltip,{content:(0,a.jsx)("div",{className:"w-64 text-center",children:(0,a.jsx)(k.Typography,{variant:"small",color:"white",className:"font-normal opacity-80 text-[12px]",children:t("autoImproveTooltip")})}),placement:"bottom-end",className:"border border-blue-gray-50 bg-black px-4 py-3 shadow-xl shadow-black/10",children:(0,a.jsxs)("div",{className:`flex items-center gap-[6px] ${eQ?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:()=>{eQ||eA(!eM)},children:[(0,a.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#6B46C1",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})}),(0,a.jsx)("span",{className:"text-[12px] font-semibold text-[#6B46C1]",children:t("aiEnhanceTxt")}),(0,a.jsx)("button",{type:"button",disabled:eQ,onClick:e=>{e.stopPropagation(),eQ||eA(!eM)},className:`relative w-[34px] h-[18px] rounded-full transition-colors duration-200 ${eM?"bg-[#6B46C1]":"bg-[#DDDAD6]"} ${eQ?"cursor-not-allowed":""}`,children:(0,a.jsx)("span",{className:`absolute top-[2px] w-[14px] h-[14px] bg-white rounded-full shadow-sm transition-transform duration-200 ${eM?"left-[17px]":"left-[2px]"}`})})]})})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("textarea",{ref:Z,className:"w-full border border-[#B0AEAB] rounded-[10px] px-4 py-[11px] text-[13px] text-[#1a1a1a] placeholder-[#bbb] focus:border-[#6B46C1] focus:outline-none transition-colors bg-white resize-none overflow-hidden",placeholder:t("ideaInputHolder"),value:eL,rows:1,style:{minHeight:"46px"},onInput:e=>{let t=e.target;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,200)+"px",t.style.overflowY=t.scrollHeight>200?"auto":"hidden"},onChange:e=>{eS(e.target.value),eK({...eJ,prompts:""})}}),ez&&(0,a.jsxs)("div",{className:"idea-loading absolute inset-0 rounded-[10px] border border-[#D8CDEC] flex items-center px-4 gap-[10px] pointer-events-none",children:[(0,a.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#6B46C1",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0 animate-pulse",children:[(0,a.jsx)("path",{d:"M12 3l1.8 4.9L18.7 9.6l-4.9 1.8L12 16.3l-1.8-4.9L5.3 9.6l4.9-1.8L12 3z"}),(0,a.jsx)("path",{d:"M19 14l.7 1.9 1.9.7-1.9.7-.7 1.9-.7-1.9-1.9-.7 1.9-.7L19 14z"})]}),(0,a.jsx)("span",{className:"text-[12px] font-semibold bg-gradient-to-r from-[#6B46C1] to-[#A855F7] bg-clip-text text-transparent",children:t("loadingIdeaPlaceholder")}),(0,a.jsxs)("div",{className:"flex gap-[5px] items-center ml-auto",children:[(0,a.jsx)("span",{className:"w-[6px] h-[6px] rounded-full bg-[#6B46C1] animate-bounce [animation-delay:0ms]"}),(0,a.jsx)("span",{className:"w-[6px] h-[6px] rounded-full bg-[#A855F7] animate-bounce [animation-delay:150ms]"}),(0,a.jsx)("span",{className:"w-[6px] h-[6px] rounded-full bg-[#C4B5E0] animate-bounce [animation-delay:300ms]"})]})]})]}),!eL&&!ez&&(0,a.jsxs)("button",{type:"button",onClick:()=>{ex(!1)},className:"group mt-[10px] self-start inline-flex items-center gap-[8px] pl-[12px] pr-[14px] py-[8px] rounded-full border border-[#E4D9F7] bg-gradient-to-r from-[#F6F0FF] to-[#FBF8FF] hover:from-[#EFE4FF] hover:to-[#F6EEFF] hover:border-[#C9B3F0] transition-all cursor-pointer",children:[(0,a.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"#6B46C1",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0 transition-transform duration-200 group-hover:scale-110",children:[(0,a.jsx)("path",{d:"M12 2a7 7 0 0 1 7 7c0 2.6-1.4 4.9-3.5 6.2V17a1 1 0 0 1-1 1h-5a1 1 0 0 1-1-1v-1.8C6.4 13.9 5 11.6 5 9a7 7 0 0 1 7-7z"}),(0,a.jsx)("path",{d:"M9 21h6"}),(0,a.jsx)("path",{d:"M9 18h6"})]}),(0,a.jsx)("span",{className:"text-[12.5px] font-semibold text-[#6B46C1] leading-none",children:t("ideaNudgeCta")}),(0,a.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#6B46C1",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0 transition-transform duration-200 group-hover:translate-x-[2px]",children:[(0,a.jsx)("path",{d:"M5 12h14"}),(0,a.jsx)("path",{d:"M13 6l6 6-6 6"})]})]})]}),(0,a.jsxs)("div",{className:`flex-1 flex flex-col ${eQ?"hidden":""}`,children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-[6px]",children:(0,a.jsx)("label",{className:"text-[12px] font-semibold text-[#444]",children:t("visualStylesTitle")})}),(0,a.jsx)("div",{className:"relative border border-[#B0AEAB] rounded-[10px] bg-white",children:em.map((e,t)=>(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)(k.Select,{label:"",className:"!min-w-[50px] select-option-generator !border-0 !rounded-[10px] !bg-transparent",disabled:tO,value:H[e.textOptionSelect],labelProps:{className:"hidden"},containerProps:{className:"!min-w-0 !border-0"},menuProps:{className:"z-[9999] max-h-[260px] overflow-y-auto"},onChange:t=>t1(e.textOptionSelect,t??""),selected:()=>{let t=H[e.textOptionSelect],s=e.data.find(e=>e.value===t);return s?(0,a.jsxs)("div",{className:"flex flex-row items-center gap-2",children:[(0,a.jsx)(c(),{src:(0,i.w)(s.icon),width:55,height:55,alt:s.value,className:"rounded"}),(0,a.jsx)("span",{className:"text-[13px] text-blackOne",children:s[`name-${q.language||"en"}`]})]}):null},children:e.data.map((e,t)=>(0,a.jsxs)(k.Option,{value:e.value,className:"flex flex-row items-center gap-2 transition-none duration-0 ease-linear",children:[(0,a.jsx)(c(),{src:(0,i.w)(e.icon),width:55,height:55,alt:e.value,className:"rounded",loading:"lazy"}),(0,a.jsx)("span",{className:"text-[13px] text-blackOne",children:e[`name-${q.language||"en"}`]})]},t))})},t))})]})]}),eJ.prompts&&!tc&&(0,a.jsxs)("div",{className:"flex items-center gap-[6px] mt-[-8px] mb-3 px-1",children:[(0,a.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,a.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,a.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),(0,a.jsx)("p",{className:"text-[12.5px] text-red-500",children:eJ.prompts})]}),(0,a.jsxs)("div",{className:`flex flex-col mb-4 p-4 px-[18px] rounded-[12px] border transition-colors duration-200 ${tc?"hidden":""} ${eQ?"bg-[#f3f0ff] border-[#ddd6fe]":"bg-[#F0F0F0] border-[#D1D1D1
7]"}`,children:[(0,a.jsxs)("div",{className:"flex flex-row justify-between items-start mb-[10px] gap-2",children:[(0,a.jsx)("div",{className:"flex flex-col gap-[3px] flex-1 min-w-0",children:(0,a.jsxs)("div",{className:"flex items-center gap-[6px] flex-wrap",children:[(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:eQ?"#6B46C1":"#757575",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})}),(0,a.jsx)("span",{className:`text-[13px] font-semibold transition-colors duration-200 ${eQ?"text-[#1a1a1a]":"text-[#616161]"}`,children:t("uploadReferenceImage")}),(0,a.jsx)("span",{className:`text-[11px] transition-colors duration-200 ${eQ?"text-[#7A6E8A]":"text-[#909090]"}`,children:t("charLockSubtitle")}),(0,a.jsx)("div",{className:"flex items-center gap-1 bg-[#F59E0B] px-[7px] py-[2px] rounded-[5px]",children:(0,a.jsx)("span",{className:"text-[10px] font-bold text-white uppercase tracking-wide",children:"PRO"})})]})}),(0,a.jsx)("button",{type:"button",role:"switch","aria-checked":eQ,"aria-label":t("uploadReferenceImage"),onClick:()=>{eX(!eQ),eQ&&(e4(null),e5(""))},className:`relative w-[36px] h-[20px] rounded-full transition-colors duration-200 flex-shrink-0 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-[#8832D4]/45 ${eQ?"bg-[#8832D4] hover:bg-[#7526bd]":"bg-[#BFBFBF] hover:bg-[#B29AD9]"}`,children:(0,a.jsx)("span",{className:`absolute top-[2px] w-[16px] h-[16px] bg-white rounded-full shadow-sm transition-transform duration-200 ${eQ?"left-[18px]":"left-[2px]"}`})})]}),(0,a.jsx)("p",{className:`text-[12px] whitespace-pre-line leading-[1.5] transition-colors duration-200 ${eQ?"text-[#7A6E8A]":"text-[#909090]"}`,children:t("uploadReferenceImageDesc")}),eQ&&(0,a.jsxs)(P.E.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3},className:"mt-3",children:[(0,a.jsxs)("div",{className:"mb-3 rounded-[8px] border border-[#FCD34D] bg-[#FFFBEB]",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>e1(!e0),className:"w-full flex items-center justify-between gap-2 px-[10px] py-[6px]",children:[(0,a.jsxs)("span",{className:"flex items-center gap-[6px]",children:[(0,a.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#B45309",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M9 18h6"}),(0,a.jsx)("path",{d:"M10 22h4"}),(0,a.jsx)("path",{d:"M12 2a7 7 0 0 0-4 12.6V17h8v-2.4A7 7 0 0 0 12 2z"})]}),(0,a.jsx)("span",{className:"text-[11.5px] font-bold text-[#B45309] uppercase tracking-wide",children:t("charLockTipTitle")})]}),(0,a.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#B45309",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:`transition-transform duration-200 ${e0?"rotate-180":""}`,children:(0,a.jsx)("polyline",{points:"6 9 12 15 18 9"})})]}),(0,a.jsx)(O.M,{initial:!1,children:e0&&(0,a.jsx)(P.E.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},className:"overflow-hidden",children:(0,a.jsxs)("div",{className:"px-[10px] pb-[8px]",children:[(0,a.jsx)("ul",{className:"flex flex-col gap-[3px] mb-[5px]",children:[t("charLockTipPoint1"),t("charLockTipPoint2"),t("charLockTipPoint3")].map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start gap-[6px]",children:[(0,a.jsx)("span",{className:"flex-shrink-0 mt-[6px] w-[3px] h-[3px] rounded-full bg-[#B45309]"}),(0,a.jsx)("span",{className:"text-[11.5px] text-[#3F2D08] leading-[1.4]",children:e})]},t))}),(0,a.jsx)("p",{className:"text-[11px] text-[#7A5A12] italic leading-[1.4]",children:t("charLockTipFooter")})]})})})]}),(0,a.jsx)(M.Z,{preview:e6,setPreview:e5,setImgRaw:e4})]})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center mb-4 bg-[#F5F3F0] rounded-[12px] border border-[#EAE7E3] p-[4px] gap-[4px] sm:gap-[8px]",children:[(0,a.jsx)("span",{className:"text-[11px] sm:text-[12px] font-semibold text-[#555] whitespace-nowrap pl-2 pt-[2px] text-center sm:text-left sm:pt-0 sm:pr-1",children:t("imageSizeTxt")}),(0,a.jsx)("div",{className:"flex sm:flex-1 bg-[#EAE7E3] rounded-[8px] p-[3px] gap-[2px] sm:gap-[3px]",children:(tq??[]).sort((e,t)=>
7e.pos-t.pos).map((s,r)=>{let l=er===s.label,n={portrait:{w:"w-[13px]",h:"h-[18px]"},square:{w:"w-[16px]",h:"h-[16px]"},landscape:{w:"w-[20px]",h:"h-[13px]"}}[s.label]??{w:"w-[16px]",h:"h-[16px]"};return(0,a.jsxs)("button",{type:"button",className:`flex flex-col items-center justify-center gap-[3px] py-[6px] px-[4px] sm:px-3 rounded-[6px] cursor-pointer flex-1 min-w-0 8 transition-all duration-200 ease-in-out select-none 9 ${l?"bg-white shadow-[0_1px_4px_rgba(0,0,0,0.10)]":"bg-transparent hover:bg-white/50"}`,onClick:()=>{ea(s.pos),el(s.label),K(s.credits),X(s.credits*H.variations),V({...H,imageSize:s.value??"1024x1024"})},children:[(0,a.jsx)("div",{className:`${n.w} ${n.h} rounded-[2px] border-[1.5px] transition-colors duration-200 flex-shrink-0 10 ${l?"border-[#6B46C1]":"border-[#aaa]"}`}),(0,a.jsxs)("span",{className:`text-[9px] sm:text-[11px] text-center leading-tight transition-colors duration-200 ${l?"text-[#6B46C1] font-semibold":"text-[#616161] font-normal"}`,children:[t(s.label)," ",(e||tc)&&(0,a.jsxs)(a.Fragment,{children:[s.credits," ",t("creditsTxt")]})]})]},r)})})]}),!e&&!tc&&(0,a.jsx)(r.ZP,{...tx,kind:"single",disabled:t6,hasReference:eQ}),(0,a.jsxs)("div",{className:"flex flex-col items-center mt-6",children:[tq&&tq.length>0&&(e||tc||tx.ready)&&(0,a.jsx)("p",{className:"text-[13px] text-[#555] font-medium mb-[10px]",children:t("creditsConsumed",{credits:sl()})}),(0,a.jsxs)("button",{type:"submit",className:`inline-flex items-center justify-center gap-2 px-10 py-[13px] rounded-full text-white bg-purpleFour hover:bg-purpleFour/90 11 text-[15px] font-semibold transition-all disabled:cursor-not-allowed ${t6?"opacity-80":""}`,onClick:t5,disabled:t6||!e&&!tc&&!tx.ready,"aria-busy":t6,children:[t6?(0,a.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2.4",strokeLinecap:"round",className:"animate-spin",children:(0,a.jsx)("path",{d:"M21 12a9 9 0 1 1-6.22-8.56"})}):(0,a.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,a.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,a.jsx)("polyline",{points:"21 15 16 10 5 21"})]}),(0,a.jsx)("span",{children:t6?t("btnGenerateStarting"):t("btnGenerate")})]})]}),e&&(0,a.jsxs)("span",{className:"text-[12px] md:text-[14px] w-full justify-center px-4 mb-3 font-bold hidden",children:[t("freeDrawings"),": ",2==q.maxFreeImages?"2":`${q.maxFreeImages}/2`," ",(0,a.jsx)("br",{})]})]},"images-tab")]})}),(0,a.jsx)(v.Z,{open:en}),(0,a.jsx)(N.Z,{open:eb,handleCancel:se}),(0,a.jsx)(D.Z,{open:eI,handleCancel:se,cancelSuscription:ss}),(0,a.jsx)(L.Z,{open:ej,handleCancel:()=>ew(!1)}),(0,a.jsx)(E.Z,{open:eT,confirmLoader:eo,handleConfirm:ss,handleCancel:st,warningType:!1,imgUrl:(0,i.w)("/images/credits-purchase_yellow.svg"),onTrialPeriod:q.onTrialPeriod,width:100,height:100}),(0,a.jsx)(F.Z,{open:e_,imageID:eY,handleCancel:()=>{eD(e=>!e)},displayImageEditionUrl:!0,isDemo:!0}),(0,a.jsx)(F.Z,{open:eF,imageID:eY,handleCancel:()=>{eE(!1),ei(!1),eB(!1),eU("")},handleGenerateVariations:()=>{},handleGenerateBlackwhiteVariation:()=>{},handleRemoveBg:()=>{},displayImageEditionUrl:!0,surface:"generator_detail"}),(0,a.jsx)(I.Z,{open:eq,handleCancel:()=>{eG(!1)},children:(0,a.jsx)(R.Z,{variant:"v2"})})]})}},91297:function(e,t,s){"use strict";s.d(t,{a:function(){return d},c:function(){return o}});var a=s(67294),r=s(78551),l=s(52649),n=s(35103);async function i(){let e=await l.Z.get("generator/quality-options"),t=e?.data?.qualities;if(!e.status||!Array.isArray(t)||!["low","medium"].every(e=>1===t.filter(t=>t.quality===e&&Number.isFinite(t.creditsPerImage)&&t.creditsPerImage>0&&Number.isFinite(t.charlockCredits)&&t.charlockCredits>=0).length))throw Error("Invalid quality catalogue");return t.filter(e=>"low"===e.quality||"medium"===e.quality)}function o(e){let[t,s]=(0,a.useState)("low"),l=(0,r.a)({queryKey:["generation-quality-options"],queryFn:i,enabled:e,retry:1}
11),n=l.data?.find(e=>e.quality===t);return{quality:t,setQuality:s,options:l.data??[],option:n,ready:e&&!!n&&!l.isError,loading:l.isPending,error:l.isError,retry:()=>{l.refetch()}}}function d(e,t,s){let r=(0,a.useRef)(s);r.current=s;let l="low"===t&&(0,n.HQ)(e);(0,a.useEffect)(()=>{l&&r.current()},[l])}},94239:function(e,t,s){"use strict";s.d(t,{yd:function(){return r}});let a=/^[\p{L}][\p{L}\s'-]*$/u;function r(e,t={}){let s=t.maxLength??15,r=t.maxWords??2,l=(e??"").replace(/\s+/g," ").trim();if(!l)return{valid:!1,code:"WORD_REQUIRED",word:l};if(l.length>s)return{valid:!1,code:"WORD_TOO_LONG",word:l};if(l.split(" ").length>r)return{valid:!1,code:"WORD_TOO_MANY_WORDS",word:l};if(!a.test(l))return{valid:!1,code:"WORD_INVALID_CHARS",word:l};let n=t.styleMaxWordLength;return"number"==typeof n&&l.length>n?{valid:!1,code:"WORD_TOO_LONG_FOR_STYLE",word:l}:{valid:!0,word:l}}},28860:function(e,t,s){e.exports=s(32602)},29726:function(e,t,s){"use strict";s.d(t,{N:function(){return i}});var a=s(72536),r=s(54948),l=class extends a.z{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:(0,r.Gm)()})}getOptimisticResult(e){return e.behavior=(0,r.Gm)(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){let{state:s}=e,a=super.createResult(e,t),{isFetching:l,isRefetching:n,isError:i,isRefetchError:o}=a,d=s.fetchMeta?.fetchMore?.direction,c=i&&"forward"===d,x=l&&"forward"===d,p=i&&"backward"===d,u=l&&"backward"===d;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,r.Qy)(t,s.data),hasPreviousPage:(0,r.ZF)(t,s.data),isFetchNextPageError:c,isFetchingNextPage:x,isFetchPreviousPageError:p,isFetchingPreviousPage:u,isRefetchError:o&&!c&&!p,isRefetching:n&&!x&&!u}}},n=s(7159);function i(e,t){return(0,n.r)(e,l,t)}},30749:function(e,t,s){"use strict";var a=s(67294);let r=a.forwardRef(function({title:e,titleId:t,...s},r){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},s),e?a.createElement("title",{id:t},e):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"}))});t.Z=r}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.