PageSourceSearch

https://www.studioe.ai/assets/ModelTryOn-CQAWKU5_.js

js studioe.ai collected 2026-10-05 14:28:51 UTC 198,784 bytes, 515 lines download raw bytes

1import{j as e}from"./jsx-runtime-CqrCmrYQ.js";import{r as o,a as Ra,b as Yo,L as Ui}from"./vendor-react-DWiRq_5Q.js";import{s as re}from"./secureTransport-BT8gXiVx.js";import{toast as y}from"./react-toastify.esm-dODcvvAN.js";import{u as qo,a as Jo}from"./GenerationContext-Bg2gbUZ8.js";import{u as Qo}from"./AuthContext-D_aQViLm.js";import{D as ts}from"./DropdownMenu-Jz4QorZx.js";import{C as Xo}from"./fitPresets-C321BtcG.js";import{L as as,e as Zo}from"./index-D4pxbIbR.js";import{a as Ie,h as $s,c as Ws,e as Ja,aa as wr,I as el,l as tl,u as al,k as ss,F as sl,J as rl,m as il,i as Ai}from"./index-COyPRzeT.js";import{t as Ce}from"./cloudinaryOps-Ct2fKHRk.js";import{G as Li,a as Bi,b as Oi,c as Ii}from"./index-D61P43nu.js";import{P as rs}from"./index-DpHmcKyI.js";import{m as Ye,p as qe,s as Je}from"./uploadPrep-LCedjOzL.js";import{T as ol}from"./TutorialVideoModal-DrnfL1Fo.js";import{I as Ri,F as ll}from"./ImagePreviewModal-BaSKrc23.js";import{u as nl}from"./useLeaveGuard-D9VZ19qO.js";import{L as Ve}from"./LockedButton-5TXcm2L2.js";import{T as Ke}from"./TokenCostPill-DyxFPAvf.js";import{W as cl,M as Qa,O as dl}from"./workflowBreakdownContent--W8eHYZC.js";import ul from"./FAQSection-CAj-ZYm5.js";import{M as ml}from"./faqs-CEBO1K8K.js";import{F as Aa,a as ie,r as Lt,d as Hs}from"./featureTokens-CK05Y9US.js";import{S as hl}from"./ScrollReveal-Dknkigl8.js";import{a as fl}from"./index-pQbIoZ8J.js";import{J as pl}from"./jszip.min-BBttjx9z.js";import{A as gl}from"./aspectRatios-BcXvHWfU.js";import"./vendor-redux-BFhIuSuA.js";import"./errorReporter-D_obZs0p.js";import"./index-oUOk0ci8.js";import"./subscription-BI2A8kyt.js";import"./index.esm-DaNjdss9.js";import"./AuthModalContext-Dn1r-5W7.js";import"./moreLikeThis-mCri96A2.js";import"./editorUsage-B6bN9lIs.js";import"./ContentPolicyNotice-CojnmPIX.js";import"./videoMotionPresets-1uctfSHn.js";import"./SubscribeCtaLink-BYi2BTMJ.js";import"./metaPixel-Dqi1DP_N.js";function bl({isOpen:r,candidates:f,onSelect:d}){const[p,v]=o.useState(null);return!r||!Array.isArray(f)||f.length===0?null:Ra.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",style:{animation:"posePickerFadeIn 140ms ease-out"},children:[e.jsxs("div",{className:"w-full max-w-3xl mx-4 bg-[#16181a] shadow-2xl border border-[#27272A] rounded-xl overflow-hidden flex flex-col",style:{animation:"posePickerScaleIn 180ms cubic-bezier(.25,.8,.25,1)"},children:[e.jsxs("div",{className:"px-5 py-4 border-b border-[#27272A]",children:[e.jsx("h2",{className:"text-base font-semibold text-white",children:"Select the result that best matches your desired pose"}),e.jsxs("p",{className:"mt-2.5 text-xs text-amber-400/90 leading-relaxed",children:[e.jsx("span",{className:"font-semibold",children:"Note:"})," You can refine the selected pose afterwards using the AI Edit."]})]}),e.jsx("div",{className:"p-4 sm:p-5 overflow-x-auto sm:overflow-x-visible",children:e.jsx("div",{className:"flex gap-3 sm:grid sm:grid-cols-3 sm:gap-4",children:f.map((n,N)=>e.jsxs("div",{className:"relative flex-shrink-0 w-[60vw] sm:w-auto",children:[e.jsxs("button",{type:"button",onClick:()=>d(n,N),className:"group relative w-full rounded-xl overflow-hidden border-2 border-gray-700 hover:border-blue-500 focus:border-blue-500 focus:outline-none transition-all cursor-pointer bg-black/20 aspect-[3/4] active:scale-[0.97]",children:[e.jsx("img",{src:Ce(n),alt:`Pose option ${N+1}`,className:"w-full h-full object-cover",draggable:!1}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-[5] pointer-events-none",children:e.jsx("div",{className:"bg-gradient-to-t from-black/70 to-transparent px-2.5 pt-5 pb-2",children:e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[e.jsx("span",{className:"h-1 w-1 rounded-full bg-blue-400 flex-shrink-0"}),e.jsx("span",{className:"text-white/80 drop-shadow-sm",children:e.jsx("span",{className:"font-bold",children:"Preview quality"})})]})})}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors pointer-events-none"}),e.jsx("div",{className:"absolute top-2 left-2 w-7 h-7 rounded-full bg-black/60 backdrop-blur-sm flex items-center justify-center border border-white/20",children:e.jsx("span",{className:"text-xs font-bold text-white",children:N+1})}),e.jsx("div",{className:"absolute bottom-2.5 right-2.5 z-10",children:e.jsx("span",{className:"inline-flex items-center gap-1.5 px-3.5 py-1.5 bg-blue-600 group-hover:bg-blue-500 rounded-full text-xs font-semibold text-white shadow-lg transition-colors",children:"Select"})})]}),e.jsx("button",{type:"button",onClick:m=>{m.stopPropagation(),v(n)},className:"absolute top-2 right-2 z-10 p-2 bg-black/50 hover:bg-black/70 backdrop-blur-sm rounded-lg text-gray-300 hover:text-white transition-all border border-white/10 cursor-pointer",title:"View enlarged","aria-label":`View pose option ${N+1} enlarged`,children:e.jsx(as,{className:"w-4 h-4"})})]},N))})})]}),p&&e.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/60 backdrop-blur-sm",role:"dialog","aria-modal":"true",onClick:()=>v(null),style:{animation:"posePickerFadeIn 140ms ease-out"},children:e.jsxs("div",{className:"relative flex items-center justify-center max-w-[90vw] max-h-[90vh] bg-[#16181A] rounded-xl shadow-2xl border border-[#27272A] p-4",onClick:n=>n.stopPropagation(),style:{animation:"posePickerScaleIn 180ms cubic-bezier(.25,.8,.25,1)"},children:[e.jsxs("button",{type:"button",onClick:()=>v(null),className:"absolute top-2 left-2 inline-flex items-center gap-2 px-3 h-9 rounded-md bg-[#252525] hover:bg-[#2f2f2f] text-gray-100 border border-white/10 focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer z-10","aria-label":"Close zoom preview",title:"Close",children:[e.jsx(Ie,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Close"})]}),e.jsx("img",{src:Ce(p),alt:"Pose option enlarged",className:"max-w-full max-h-[85vh] object-contain rounded-lg"})]})}),e.jsx("style",{children:`
2        @keyframes posePickerFadeIn {
3          from { opacity: 0 }
4          to   { opacity: 1 }
5        }
6        @keyframes posePickerScaleIn {
7          from { transform: scale(.92); opacity: 0 }
8          to   { transform: scale(1);   opacity: 1 }
9        }
10      `})]}),document.body)}const xl=[{key:"top",label:"Top",icon:Li},{key:"bottom",label:"Bottom",icon:Bi},{key:"shoes",label:"Shoes",icon:Oi},{key:"hat",label:"Hat",icon:Ii},{key:"accessory1",label:"Accessory 1 (eg. Necklace)",icon:rs},{key:"accessory2",label:"Accessory 2 (eg. Purse)",icon:rs},{key:"accessory3",label:"Accessory 3 (eg. Scarf)",icon:rs}],Pi={back:{title:"Back View References",subtitle:"Upload back-side photos of your garments for more accurate results",confirmBtn:"Generate Back View",tip:"These images help the AI understand how each garment looks from behind (stitching, pockets, prints, labels, etc.). You don’t need to upload all — even one or tw
10o references can improve accuracy.",altLabel:r=>`${r} back view`,noSlots:"No garments to show back view references for."},side:{title:"Side View References",subtitle:"Upload side-angle photos of your garments for more accurate results",confirmBtn:"Generate Side View",tip:"These images help the AI understand how each garment looks from the side (profile seams, silhouette, drape, construction, etc.). You don’t need to upload all — even one or two references can improve accuracy.",altLabel:r=>`${r} side view`,noSlots:"No garments to show side view references for."},pose:{title:"Garment References for Pose",subtitle:"Upload reference photos of your garments from the target angle for more accurate results",confirmBtn:"Apply Pose",tip:"These images help the AI understand how each garment looks from the target angle. You don’t need to upload all — even one or two references can improve accuracy.",altLabel:r=>`${r} reference`,noSlots:"No garments to show references for."}};function wl({isOpen:r,onClose:f,onConfirm:d,activeSlots:p=[],viewType:v="back"}){const n=o.useRef(!1),N=o.useRef({}),[m,H]=o.useState({}),[O,_]=o.useState({}),[J,L]=o.useState({}),pe=Object.values(m).some(Boolean),oe=xl.filter(S=>p.includes(S.key)),ae=o.useCallback(async(S,W)=>{if(W)try{const Z=await Ye(W),$=await qe(Z);H(P=>({...P,[S]:$}));const Xe=URL.createObjectURL($);_(P=>{const D=P[S];return D&&D.startsWith("blob:")&&URL.revokeObjectURL(D),{...P,[S]:Xe}})}catch(Z){Je(Z)}},[]),Qe=o.useCallback(S=>{H(W=>({...W,[S]:null})),_(W=>{const Z=W[S];return Z&&Z.startsWith("blob:")&&URL.revokeObjectURL(Z),{...W,[S]:null}})},[]),Ae=()=>{d(m),H({}),_({}),L({})},Me=()=>{if(!pe){ue();return}Ae()},ue=()=>{d({}),H({}),_({}),L({})},X=()=>{H({}),_({}),L({}),f()};if(!r)return null;const q=Pi[v]||Pi.back;return Ra.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",style:{animation:"backViewFadeIn 140ms ease-out"},role:"dialog","aria-modal":"true",onMouseDown:S=>{n.current=S.target===S.currentTarget},onClick:S=>{S.target===S.currentTarget&&n.current&&X(),n.current=!1},children:[e.jsxs("div",{className:"w-full max-w-2xl bg-[#16181A] border border-[#27272A] rounded-xl shadow-2xl overflow-hidden flex flex-col max-h-[85vh]",style:{animation:"backViewScaleIn 180ms cubic-bezier(.25,.8,.25,1)"},onClick:S=>S.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[#27272A]",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-white",children:q.title}),e.jsx("p",{className:"mt-0.5 text-xs text-gray-400",children:q.subtitle})]}),e.jsx("button",{type:"button",onClick:X,className:"h-8 w-8 flex items-center justify-center rounded hover:bg-red-600/20 text-red-400 hover:text-red-300 cursor-pointer transition-colors","aria-label":"Close",title:"Close",children:e.jsx(Ie,{size:18})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 sm:p-5 space-y-3",style:{scrollbarWidth:"thin",scrollbarColor:"#27272A #16181A"},children:[oe.length===0&&e.jsx("div",{className:"text-center py-8 text-sm text-gray-500",children:q.noSlots}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:oe.map(({key:S,label:W,icon:Z})=>{const $=O[S],Xe=!!J[S];return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold text-white",children:W}),$&&e.jsx("button",{onClick:()=>Qe(S),className:"text-xs text-red-400 hover:text-red-300 cursor-pointer",children:"Remove"})]}),e.jsxs("label",{className:`group block aspect-square rounded-lg border-2 border-dashed bg-[#0a0a0a]/60 cursor-pointer overflow-hidden transition-all ${Xe?"border-blue-500 ring-2 ring-blue-500/40":"border-gray-700 hover:border-blue-500"}`,onDragOver:P=>{P.preventDefault(),L(D=>({...D,[S]:!0}))},onDragLeave:P=>{P.preventDefault(),L(D=>({...D,[S]:!1}))},onDrop:P=>{var Ze,et;P.preventDefault(),L(ge=>({...ge,[S]:!1}));const D=(et=(Ze=P.dataTransfer)==null?void 0:Ze.files)==null?void 0:et[0];D&&ae(S,D)},children:[e.jsx("input",{ref:P=>N.current[S]=P,type:"file",accept:"image/png, image/jpeg, image/webp, image/heic, image/heif, .heic, .heif",className:"hidden",onChange:P=>{var Ze;const D=(Ze=P.target.files)==null?void 0:Ze[0];D&&ae(S,D),P.target.value=""}}),$?e.jsxs("div",{className:"relative w-full h-full",children:[e.jsx("img",{src:$,alt:q.altLabel(W),className:"w-full h-full object-contain",draggable:!1}
10),e.jsx("div",{className:"absolute top-1.5 left-1.5 w-5 h-5 rounded-full bg-green-500/90 flex items-center justify-center",children:e.jsx($s,{className:"w-3 h-3 text-white"})})]}):e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center px-4",children:[e.jsx(Z,{className:"mx-auto h-12 w-12 text-gray-500/80"}),e.jsx("span",{className:"mt-2 inline-block text-sm font-medium text-blue-400 group-hover:text-blue-300 underline decoration-dotted",children:"Click to upload"}),e.jsx("p",{className:"mt-1 text-xs text-gray-400",children:"or Drag & drop"})]})]})]},S)})}),e.jsx("div",{className:"mt-2 p-3 bg-blue-500/5 border border-blue-500/10 rounded-lg",children:e.jsxs("p",{className:"text-[11px] text-blue-300/80 leading-relaxed",children:[e.jsx("span",{className:"font-semibold",children:"Tip:"})," ",q.tip]})})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-3 border-t border-[#27272A]",children:[e.jsx("button",{type:"button",disabled:pe,onClick:Me,className:`${pe?"opacity-0 cursor-[default]":""} px-4 py-2 text-xs font-medium text-gray-400 hover:text-white transition-colors cursor-pointer`,children:"Generate without references"}),e.jsx("button",{type:"button",onClick:Ae,disabled:!pe,className:"px-5 py-2 bg-blue-600 hover:bg-blue-500 disabled:bg-gray-700 disabled:text-gray-500 rounded-full text-xs font-semibold text-white transition-all disabled:cursor-not-allowed cursor-pointer",children:q.confirmBtn})]})]}),e.jsx("style",{children:`
11        @keyframes backViewFadeIn {
12          from { opacity: 0 }
13          to   { opacity: 1 }
14        }
15        @keyframes backViewScaleIn {
16          from { transform: scale(.92); opacity: 0 }
17          to   { transform: scale(1);   opacity: 1 }
18        }
19      `})]}),document.body)}const Ar="studioe:tryOnSession:v1",Rr="studioe:tryOnSession:enc:v1",yl=6*60*60*1e3,vl=1;function M(r,f=4e3){if(typeof r!="string")return null;const d=r.trim();return d?d.length>f?d.slice(0,f):d:null}function z(r){const f=M(r,8e3);return f&&(/^https?:\/\//i.test(f)||/^data:/i.test(f))?f:null}function yr(r,f=10){return Array.isArray(r)?r.slice(0,f).map(d=>z(d)).filter(Boolean):[]}function vr(r,f=10,d=256){return Array.isArray(r)?r.slice(0,f).map(p=>M(p,d)||""):[]}function kr(r){if(!r||typeof r!="object")return null;const f=typeof r.ts=="number"?r.ts:Date.now();if(Date.now()-f>yl)return null;const d={v:vl,ts:f};return r.runId&&(d.runId=M(r.runId,128)),typeof r.stage=="number"&&(d.stage=r.stage),r.combinedSceneUrl&&(d.combinedSceneUrl=z(r.combinedSceneUrl)),r.aspectRatio&&(d.aspectRatio=M(r.aspectRatio,32)),r.outfitResolution&&(d.outfitResolution=M(r.outfitResolution,8)),r.setupResolution&&(d.setupResolution=M(r.setupResolution,8)),r.renderedSetupResolution&&(d.renderedSetupResolution=M(r.renderedSetupResolution,8)),r.renderedResolution&&(d.renderedResolution=M(r.renderedResolution,8)),Array.isArray(r.sceneHistory)&&r.sceneHistory.length&&(d.sceneHistory=yr(r.sceneHistory,20)),typeof r.selectedSceneIdx=="number"&&(d.selectedSceneIdx=r.selectedSceneIdx),r.sceneSavedId&&(d.sceneSavedId=M(r.sceneSavedId,128)),r.sceneLoadedFromSaved&&(d.sceneLoadedFromSaved=!0),r.garmentTopPreview&&(d.garmentTopPreview=z(r.garmentTopPreview)),r.garmentBottomPreview&&(d.garmentBottomPreview=z(r.garmentBottomPreview)),r.garmentShoesPreview&&(d.garmentShoesPreview=z(r.garmentShoesPreview)),r.garmentHatPreview&&(d.garmentHatPreview=z(r.garmentHatPreview)),Array.isArray(r.accessoryPreviews)&&r.accessoryPreviews.length&&(d.accessoryPreviews=yr(r.accessoryPreviews,3)),r.selectedTopGarmentUrl&&(d.selectedTopGarmentUrl=z(r.selectedTopGarmentUrl)),r.selectedBottomGarmentUrl&&(d.selectedBottomGarmentUrl=z(r.selectedBottomGarmentUrl)),r.selectedShoesGarmentUrl&&(d.selectedShoesGarmentUrl=z(r.selectedShoesGarmentUrl)),r.selectedHatGarmentUrl&&(d.selectedHatGarmentUrl=z(r.selectedHatGarmentUrl)),Array.isArray(r.selectedAccessoryUrls)&&r.selectedAccessoryUrls.length&&(d.selectedAccessoryUrls=r.selectedAccessoryUrls.slice(0,3).map(p=>z(p))),r.topFitStyle&&(d.topFitStyle=M(r.topFitStyle,128)),r.bottomFitStyle&&(d.bottomFitStyle=M(r.bottomFitStyle,128)),r.shoesFitStyle&&(d.shoesFitStyle=M(r.shoesFitStyle,128)),r.hatFitStyle&&(d.hatFitStyle=M(r.hatFitStyle,128)),Array.isArray(r.accessoryFitStyles)&&(d.accessoryFitStyles=vr(r.accessoryFitStyles,3,128)),r.topFitMode&&(d.topFitMode=M(r.topFitMode,32)),r.bottomFitMode&&(d.bottomFitMode=M(r.bottomFitMode,32)),r.shoesFitMode&&(d.shoesFitMode=M(r.shoesFitMode,32)),r.hatFitMode&&(d.hatFitMode=M(r.hatFitMode,32)),Array.isArray(r.accessoryFitModes)&&(d.accessoryFitModes=vr(r.accessoryFitModes,3,32)),r.topCustomFit&&(d.topCustomFit=M(r.topCustomFit,200)),r.bottomCustomFit&&(d.bottomCustomFit=M(r.bottomCustomFit,200)),r.shoesCustomFit&&(d.shoesCustomFit=M(r.
19shoesCustomFit,200)),r.hatCustomFit&&(d.hatCustomFit=M(r.hatCustomFit,200)),Array.isArray(r.accessoryCustomFits)&&(d.accessoryCustomFits=vr(r.accessoryCustomFits,3,200)),r.fitRefTopPreview&&(d.fitRefTopPreview=z(r.fitRefTopPreview)),r.fitRefBottomPreview&&(d.fitRefBottomPreview=z(r.fitRefBottomPreview)),r.fitRefShoesPreview&&(d.fitRefShoesPreview=z(r.fitRefShoesPreview)),r.fitRefHatPreview&&(d.fitRefHatPreview=z(r.fitRefHatPreview)),Array.isArray(r.fitRefAccessoryPreviews)&&r.fitRefAccessoryPreviews.length&&(d.fitRefAccessoryPreviews=r.fitRefAccessoryPreviews.slice(0,3).map(p=>z(p)||"")),r.finalUrl&&(d.finalUrl=z(r.finalUrl)),r.currentView&&(d.currentView=M(r.currentView,64)),typeof r.selectedResultIdx=="number"&&(d.selectedResultIdx=r.selectedResultIdx),r.views&&typeof r.views=="object"&&(d.views={},r.views.original&&(d.views.original=z(r.views.original)),r.views.side&&(d.views.side=z(r.views.side)),r.views.back&&(d.views.back=z(r.views.back)),Array.isArray(r.views.posed)&&r.views.posed.length&&(d.views.posed=yr(r.views.posed,10))),Array.isArray(r.resultHistory)&&r.resultHistory.length&&(d.resultHistory=r.resultHistory.slice(0,30).map(p=>{if(typeof p=="string")return{url:z(p)};if(p&&typeof p=="object"){const v={};return p.url&&(v.url=z(p.url)),p.label&&(v.label=M(p.label,128)),typeof p.ts=="number"&&(v.ts=p.ts),v}return null}).filter(Boolean)),d}function Sr(r){const f=String.fromCharCode(...r);return btoa(f)}function Cr(r){const f=atob(r),d=new Uint8Array(f.length);for(let p=0;p<f.length;p++)d[p]=f.charCodeAt(p);return d}async function Mi(){const r="studioe:lastSession:aesKey:v1";try{const p=localStorage.getItem(r);if(p){const v=Cr(p);return await crypto.subtle.importKey("raw",v,{name:"AES-GCM"},!1,["encrypt","decrypt"])}}catch{}const f=crypto.getRandomValues(new Uint8Array(32)),d=await crypto.subtle.importKey("raw",f,{name:"AES-GCM"},!1,["encrypt","decrypt"]);try{localStorage.setItem(r,Sr(f))}catch{}return d}async function jl(r){const f=await Mi(),d=crypto.getRandomValues(new Uint8Array(12)),p=new TextEncoder().encode(JSON.stringify(r)),v=await crypto.subtle.encrypt({name:"AES-GCM",iv:d},f,p);return{v:1,iv:Sr(d),ct:Sr(new Uint8Array(v))}}async function Nl(r){if(!r||typeof r!="object"||r.v!==1||!r.iv||!r.ct)return null;const f=await Mi(),d=Cr(r.iv),p=Cr(r.ct),v=await crypto.subtle.decrypt({name:"AES-GCM",iv:d},f,p),n=new TextDecoder().decode(v);return JSON.parse(n)}function Fe(r,f="file.png",d="image/png"){try{const p=String(r||"");if(!p.startsWith("data:"))return null;const v=p.match(/^data:([^;]+);base64,(.*)$/);if(!v)return null;const n=v[1]||d,N=v[2]||"",m=atob(N),H=m.length,O=new Uint8Array(H);for(let _=0;_<H;_++)O[_]=m.charCodeAt(_);return new File([O],f,{type:n||d})}catch{return null}}function kl(){try{localStorage.removeItem(Rr)}catch{}try{localStorage.removeItem(Ar)}catch{}}async function Sl(){try{const r=localStorage.getItem(Rr);if(r){const f=JSON.parse(r),d=await Nl(f),p=kr(d);if(p)return p}}catch{}try{const r=localStorage.getItem(Ar);if(!r)return null;const f=JSON.parse(r);return kr(f)}catch{return null}}function Cl(r){const f=kr(r);return f?((async()=>{try{const d=await jl(f);localStorage.setItem(Rr,JSON.stringify(d))}catch{}try{localStorage.setItem(Ar,JSON.stringify(f))}catch{}})(),!0):!1}const Di=[{id:"bg0",url:"/try-on/backgrounds/bg0.webp",label:"White Infinity Studio",prompt:`Scene Definition: White Infinity Studio
20A high-key, professional studio environment featuring a seamless "infinity" transition between the wall and the floor. The setting is purely monochromatic white, designed for high-end commercial isolation. The ground plane is indistinguishable from the backdrop, creating an airy, ethereal space that prioritizes the subject's silhouette and color accuracy. There are no architectural details, textures, or props to distract from the central focus.
21
22Lighting Logic: High-Key Softbox Diffusion
23Bright, wrap-around studio lighting that eliminates high-contrast shadows. The primary illumination is highly diffused, coming from multiple directions to create a nearly shadowless environment. A very faint, soft-edged contact shadow exists directly beneath where a subject would stand, providing a subtle sense of grounding without defining a hard floor line. The light is neutral (5500K), ensuring no color cast on the white surfaces.
24
25Camera Constraints: Eye-Level Commercial Framing
26The camera is positioned at a neutral height, approximately mid-torso for a standing adult, maintaining a 0-degree tilt to ensure zero vertical distortion. The lens perspective mimics a 50mm to 85mm prime lens, preserving natural human proportions and flat geometry. The framing is centered with ample negative space on all sides, specifically calibrated for versatile e-commerce cropping and responsive web design.
27
28Environmental Behavior: Infinite Uniformity
29The environment behaves as a "light box," where surfaces reflect light evenly to maintain a consistent white value across the entire frame. Any shadows are treated as soft ambient occlusion rather than directional cast shadows. The backdrop remains stable and uniform regardless of subject movement, ensuring that multiple assets generated in this space can be layered or swapped with perfect visual continuity.
30No Model attached`},{id:"bg1",url:"/try-on/backgrounds/bg1.webp",label:"Minimalist Interior Corner",prompt:`Scene definition:
31A minimalist interior corner with two textured walls meeting at a sharp vertical seam, a flat floor plane, and a single window opening on the right side. One decorative object (a vase with dried grasses) sits on the floor near the corner. Dominant background type: wall + floor plane set (interior corner), not a seamless sweep/cyclorama. Two warm beige/tan walls meet at a vertical corner line slightly right of center. Wall surfaces show subtle mottling/patchy texture consistent with a plaster-like finish; no visible patterns, artwork, or signage. Floor plane is visible across the bottom half of the frame; matte appearance with faint tonal variation. A rectangular window opening is on the right wall with a light-toned frame and simple internal grid. A single light-colored vase sits on the floor near the corner with tall, feathery dried stems fanning upward.
32
33Lighting logic:
34Directional light enters through the right-side window, projecting a bright patch onto the left wall and floor and creating distinct window-grid and plant shadows. Shadows are mostly crisp with slight softening, indicating a strong key with limited diffusion. Primary light direction is from camera-right toward camera-left. Contrast is high between sunlit areas and shaded areas. Color cast is warm overall.
35
36Camera constraints:
37Portrait/vertical framing. Viewpoint is slightly offset so both walls and the floor plane are visible. Camera appears close to level with minimal convergence. The frame includes part of the ceiling at the top.
38
39Environmental behaviour:
40Objects placed on the floor will need to match strong, right-to-left directional shadows and the sunlit patch boundaries for realistic integration. Grounding: a placed subject should show a contact shadow on the floor consistent with the existing light direction.
41No Model attached`},{id:"bg2",url:"/try-on/backgrounds/bg2.webp",label:"Industrial Studio Corner",prompt:`Scene definition:
42An indoor studio-like corner with a flat wall and a concrete floor, framed by tall grid windows on the left and a high exposed ceiling. The space is mostly empty except for two potted plants, creating a clean but not fully seamless background. Dominant background type: wall + floor plane (hard corner), not a seamless paper sweep. Main wall surface appears smooth and painted in a light warm-white/cream tone. Floor is a continuous concrete slab with visible stains, subtle cracks/patch marks. Large multi-pane industrial-style window wall occupies the left side of frame. Two potted palm-like plants in terracotta-colored pots.
43
44Lighting logic:
45Strong directional sunlight enters from the left through the window grid, creating hard-edged rectangular light patches and shadows on the wall and floor. Overall lighting is high-contrast with bright highlights and deep shadow regions. Shadow edges are crisp and well-defined, indicating hard light (direct sun). Light direction: from camera-left toward camera-right.
46
47Camera constraints:
48Portrait orientation with a straight-on view toward the wall and slight inclusion of the left window bank. Perspective looks natural with minimal wide-angle distortion. Subject placement zone: central wall area between the two plants.
49
50Environmental behaviour:
51A subject placed on the floor in front of the wall will inherit pronounced window-grid shadows and directional sunlight. Contact shadow expectation: a subject on the floor would cast a shadow consistent with strong side light from the left, with sharp edges in sunlit zones.
52No Model attached`},{id:"bg3",url:"/try-on/backgrounds/bg3.webp",label:"Light Concrete Wall",prompt:`Scene definition:
53A wall-and-floor plane scene dominated by a light grey, concrete-like surface with visible seams and surface speckling. No props or furniture are present. Background type: vertical wall + horizontal floor plane with a visible wall–floor transition line. Wall surface: light grey, concrete-like texture with scattered dark speckles/pits and subtle tonal blotching. Visible construction details: a vertical seam/joint line runs near the center of the wall.
54
55Lighting logic:
56Lighting is strongly directional, producing a large bright patch on the wall and floor with distinct shadow shapes cast across them. Shadow edges are moderately defined, indicating a relatively focused source with some diffusion. A dominant bright area falls diagonally across the wall.
57
58Camera constraints:
59Portrait frame; composition centered around the wall's vertical seam. Perspective reads as mostly straight-on to the wall. Camera appears level with minimal tilt.
60
61Environmental behaviour:
62A placed subject would need to respect the existing directional light and the pre-existing shadow bands. Grounding: a subject placed on the floor should exhibit contact shading consistent with the floor plane. The wall's large bright patch creates a high-contrast backdrop.
63No Model attached`},{id:"bg4",url:"/try-on/backgrounds/bg4.webp",label:"Grey Studio with Window",prompt:`Scene definition:
64Minimal interior set featuring a large, mottled light-to-mid gray wall with a matching gray floor plane, plus a floor-to-ceiling window on camera-right. The scene is clean and unoccupied, with visible sun-cast shadow patterns across both planes. Dominant background type: wall + floor plane with a straight, visible wall–floor seam. Wall surface appears evenly coated with a cloudy/mottled texture.
65
66Lighting logic:
67Primary illumination reads as natural daylight entering from the window on camera-right, producing long diagonal shadow bands and dappled patterns on the wall and floor. Shadow edges are soft-to-medium, indicating filtered or diffused sunlight. Brightness is strongest closest to the window.
68
69Camera constraints:
70Portrait-oriented framing captures a full corner slice: ceiling-to-floor coverage, with the window anchored on the right and large negative space on the left. Camera appears slightly elevated relative to the floor.
71
72Environmental behaviour:
73A placed subject would be grounded by the strong directional light and the existing window-grid shadow pattern. Subject grounding: expect a contact shadow on the floor that projects toward camera-left 
73(away from the window light). Matte surfaces imply low reflectivity.
74No Model attached`},{id:"bg5",url:"/try-on/backgrounds/bg5.webp",label:"Newspaper Corner Set",prompt:`Scene definition:
75A corner-style set is fully lined with overlapping newspaper sheets, creating two vertical planes meeting at a visible corner seam. Wall coverage: newspaper pages are layered edge-to-edge with overlaps. Color tone: grayscale/black ink on off-white paper. Texture: frequent creases, ripples, and buckling across the papers. Ground plane: a light (near-white) floor surface is visible beneath the draped paper.
76
77Lighting logic:
78Illumination appears soft and diffuse, with gentle shadows formed mainly by paper folds and curled edges. Overall softness suggests diffuse light or a small source with close proximity. Contrast level: moderate; printed blacks are visible.
79
80Camera constraints:
81Portrait orientation; tall framing prioritizes vertical wall area. Viewpoint: angled toward the corner so both walls are visible. Tilt: likely slight downward tilt.
82
83Environmental behaviour:
84A subject placed in this scene would visually "sit" against a highly patterned, non-uniform background with many scale cues. Compositing difficulty: high for "clean catalog" swaps because the background includes readable text and high-frequency detail.
85No Model attached`},{id:"bg6",url:"/try-on/backgrounds/bg6.webp",label:"Dark Interior with Window",prompt:`Scene definition:
86Minimal interior corner scene with two dark, smooth wall planes meeting above a dark plank floor, plus a tall grid-framed window on the camera-right. No furniture, props, or decor are visible. Walls appear very dark (near-black/charcoal) with a smooth, uniform finish. Floor is a dark plank surface with visible board seams.
87
88Lighting logic:
89Strong directional light enters through the camera-right window, creating high-contrast, window-grid shadows on the wall and floor. Shadow edges are fairly crisp with slight softness. Light direction: from camera-right toward camera-left. Overall contrast is high with bright highlights near window vs very dark walls.
90
91Camera constraints:
92Portrait-oriented framing emphasizes vertical lines and negative space. Camera appears slightly elevated relative to the floor with slight downward tilt to include the floor plane.
93
94Environmental behaviour:
95A placed subject would be grounded by the strong directional light and the existing window-grid shadow pattern. If the subject is placed within the lit patch, it should inherit hard-edged shadowing consistent with the window-grid pattern.
96No Model attached`},{id:"bg7",url:"/try-on/backgrounds/bg7.webp",label:"Cement Wall with Window Shadow",prompt:`Scene definition:
97A minimal wall + floor plane set with a light gray, cement/concrete-like textured wall and a smooth light-gray floor. The most prominent visual element is the large window-grid shadow cast across the wall and partly onto the floor. Wall color: light gray with subtle tonal variation. Wall texture: visibly rough/porous with patchy marks.
98
99Lighting logic:
100The scene is lit by a strong directional light source that creates a large, angled window-grid shadow across the wall and onto the floor. Light direction: coming from camera-left and slightly above. Shadow hardness: moderately soft edges on the grid lines.
101
102Camera constraints:
103Portrait framing. Wall occupies most of the frame; floor takes the bottom portion. Camera tilt: appears level or very slightly downward.
104
105Environmental behaviour:
106A subject placed in this scene would be strongly affected by the window-grid shadow and uneven illumination. Ground contact: the floor is matte enough that a subject would read with a soft contact shadow. Compositing difficulty: the large, high-contrast window shadow pattern makes clean product swaps harder unless the same lighting/shadow overlay is consistently applied.
107No Model attached`},{id:"bg8",url:"/try-on/backgrounds/bg8.webp",label:"Light Grey Mottled Wall",prompt:`Scene definition:
108A minimal wall + floor plane with a light gray, mottled surface on both planes and a clear horizontal floor–wall boundary line. No props or set elements are present. Wall color: very light gray with uneven tonal patches. Wall texture: visible vertical streaking/drip-like marks. Floor color: light gray with blotchy discoloration.
109
110Lighting logic:
111Lighting is soft and low-contrast overall, with a noticeable brightness lift on the floor toward camera-right. No strong, crisp shadows or highlight hotspots. Shadow evidence: no defined object shadows present. Floor illumination: brighter area on the floor toward camera-right.
112
113Camera constraints:
114Portrait (vertical) framing. Perspective: straight-on to the wall plane. Camera tilt: minimal; the transition line is close to horizontal.
115
116Environmental behaviour:
117A subject placed on the floor would read as grounded with soft contact shadows and minimal reflections. Grounding: expect a soft, diffuse contact shadow under feet/products. Backgroun
117d consistency: highly repeatable look if the same soft gradient is maintained.
118No Model attached`},{id:"bg9",url:"/try-on/backgrounds/bg9.webp",label:"Neutral Warm Backdrop",prompt:`Scene definition:
119A single, near-uniform neutral backdrop fills the frame, with no visible objects or set elements. Overall tone: very light warm grey / beige, with subtle warm-pinkish patches. Texture presence: light, cloud-like mottling. Cleanliness: no visible stains, scuffs, logos, seams. Ground plane: not visible; no horizon line or contact surface cues.
120
121Lighting logic:
122Lighting appears very even and diffuse across the backdrop. Contrast is low; the surface transitions are gentle with no deep blacks or bright hotspots. Color cast: slightly warm overall (beige/cream tendency).
123
124Camera constraints:
125Not clearly visible due to lack of geometric references. Framing: background-only, tightly cropped; no margins indicate a set boundary.
126
127Environmental behaviour:
128This background supports clean compositing due to the lack of objects and the low-contrast surface variation. Subject grounding: contact placement is not inherently defined; contact shadows would need to be generated/added for realism.
129No Model attached`},{id:"bg10",url:"/try-on/backgrounds/bg10.webp",label:"Dark Studio Gradient",prompt:`Scene definition:
130A very dark, minimal set with a wall-like backdrop and a visible ground plane at the bottom of the frame. Overall color tone: near-black with a subtle green/teal cast. Backdrop shows a centered lightened area (vignette/spotlight effect) with darker edges. Floor plane: visible in the bottom portion with a brighter center and darker perimeter.
131
132Lighting logic:
133Lighting appears soft and centrally biased, creating a top-center brightening on the backdrop and a gentle hotspot on the floor. Falloff: visible radial/vertical falloff from center to edges. The overhead source is the dominant light.
134
135Camera constraints:
136Portrait frame. Composition centers the overhead fixture near the upper middle. Camera appears front-facing and stable with a level horizon/transition line.
137
138Environmental behaviour:
139A subject placed on the bottom floor plane would be top-lit and grounded by a soft contact shadow. The center-weighted vignette means inserted subjects should be centered to avoid looking "cut out."
140No Model attached`},{id:"bg11",url:"/try-on/backgrounds/bg11.webp",label:"Cast Concrete Corner",prompt:`Scene definition:
141A two-wall corner interior with a visible floor plane, dominated by cast-concrete-style surfaces with heavy vertical streaking and scattered dark speckling. No props or set dressing. Two vertical wall planes meet at a central corner seam. Wall surfaces show strong vertical streaks consistent with runoff/aging.
142
143Lighting logic:
144Illumination is soft and low-contrast with minimal distinct cast shadows, suggesting diffuse lighting. Left wall is consistently darker than the right wall. Overall contrast is moderate-low.
145
146Camera constraints:
147Portrait orientation; the corner seam runs nearly vertical and near the center. Camera is aimed toward the corner rather than a single wall; both wall planes are visible. Camera appears close to level.
148
149Environmental behaviour:
150A placed subject would ground cleanly via contact on the matte floor, with soft, localized contact shadow expected. The corner provides a clear spatial reference for scale and alignment.
151No Model attached`},{id:"bg12",url:"/try-on/backgrounds/bg12.webp",label:"Dark to Light Gradient",prompt:`Scene definition:
152A minimal, prop-free background consisting of a dark upper field and a light lower ground plane with a soft, blurred transition between them. Upper area color: deep charcoal with a cool blue/teal tint. Lower area color: pale gray to near-white, brightest toward the center-bottom.
153
154Lighting logic:
155The scene is lit very softly with a broad, diffuse illumination that concentrates on the lower center and falls off smoothly upward. Overall contrast (dark upper region against bright lower region) but with gentle gradients.
156
157Camera constraints:
158Portrait frame with the scene filling the entire image. Horizon placement: the floor-to-backdrop transition sits in the lower third.
159
160Environmental behaviour:
161A subject placed on the lower light area would read cleanly and be easy to composite. Contact shadow expectation: a soft, diffuse shadow directly beneath the subject. Compositing suitability: high, due to absence of props/patterns.
162No Model attached`},{id:"bg13",url:"/try-on/backgrounds/bg13.webp",label:"Wood Panel Interior",prompt:`Scene definition:
163An indoor wall + floor plane set viewed at an angle, dominated by a wood-textured wall and a blue carpeted floor. Visible props include a wall sconce, small circular wall plaque, framed picture, and a pedestal with a vase. Wall surface: vertical wood-grain texture with a warm brown tone.
164
165Lighting logic:
166Primary illumination is strongly suggested by the wall sconce on the left, creating a warm, localized bright area. Light falloff visible across the wall. Shadow quality: soft-edged shadows under furniture.
167
168Camera constraints:
169Portrait framing. Perspective: angled view along the wall. Shallow depth-of-field blurs edges compared to central area.
170
171Environmental behaviour:
172A subject placed on the carpet would ground with soft, low-contrast contact shadows consistent with the matte floor and warm wall lighting. The scene contains fixed decor elements that may complicate repeatable, distraction-free compositing.
173No Model attached`},{id:"bg14",url:"/try-on/backgrounds/bg14.webp",label:"Beige Room with Window",prompt:`Scene definition:
174A small interior corner space with two intersecting beige walls, a red carpeted floor, and a windowed wall on camera-right. Includes window with blinds and sheer curtain, radiator, wall-mounted AC unit, and outlets. Walls: light beige/cream tone with visible vertical linear texture/seams.
175
176Lighting logic:
177Primary illumination appears to be diffused daylight entering from the window on camera-right. Shadow edge quality: soft transitions on the radiator and along wall areas. Contrast: moderate.
178
179Camera constraints:
180Viewpoint: angled toward the corner, capturing both adjacent walls. Wide field of view for environmental context. Camera height: around mid-room height relative to radiator and window sill.
181
182Environmental behaviour:
183A composited subject would need to be placed on the red carpet area. Contact shadows would be expected to be soft and directionally influenced by the window light from camera-right. Best placement zone: carpeted space in the lower center/left, away from the radiator.
184No Model attached`},{id:"bg15",url:"/try-on/backgrounds/bg15.webp",label:"Urban Wall with Vehicle",prompt:`Scene definition:
185Outdoor wall + street-ground scene with a large vehicle occupying the midground, and a weathered wall as the dominant background surface. Backgroun
185d: a tall, warm brown/orange wall with irregular light-gray patches and stains. Ground: a dark gray asphalt strip. Visible objects: a Bronze / tan metallic (golden-brown) sedan in clean side profile.
186
187Vehicle specification:
188Type (style/era): Vintage / classic luxury saloon (retro executive sedan vibe, late-70s/80s styling)
189Body type: 4-door sedan (saloon)
190Colour: Bronze / tan metallic (golden-brown)
191
192Lighting logic:
193Soft, diffuse lighting with minimal hard-edged shadows and moderate overall contrast. No crisp shadow edges visible. Color cast is warm overall.
194
195Camera constraints:
196Portrait-oriented frame with a straight, side-on view. Camera appears positioned at approximately around the mid-body/door-line of the vehicle.
197
198Environmental behaviour:
199A subject placed into this scene would need to respect the outdoor ground contact and the existing midground occlusion. Grounding: expect a soft contact shadow on the asphalt. The vehicle blocks the wall–ground junction, limiting clean placement options.
200No Model attached`},{id:"bg16",url:"/try-on/backgrounds/bg16.webp",label:"Studio Shooting Bay",prompt:`Scene definition:
201An indoor studio shooting bay with a neutral grey seamless sweep filling the wall-to-floor transition, with lighting equipment and support stands visibly framing the scene. Background color: cool neutral grey. The sweep surface appears smooth and matte. Two vertical light modifiers with grid patterns visible on left and right edges.
202
203Lighting logic:
204The scene is lit with large, diffused sources visible in-frame, producing a soft, low-contrast illumination with gentle falloff across the grey sweep. The sweep shows a mild gradient (darker upper/side regions, brighter lower center).
205
206Camera constraints:
207Portrait-oriented frame. The camera is positioned facing the sweep with generally straight verticals and a centered view. Framing includes lighting gear intruding from both sides.
208
209Environmental behaviour:
210A subject placed near the center of the sweep would sit on a smooth, uninterrupted floor plane with no visible seams. Expected soft contact shadows directly under a subject. The sweep transition is smooth, supporting full-body placements.
211No Model attached`},{id:"bg17",url:"/try-on/backgrounds/bg17.webp",label:"Dark Studio with Overhead Light",prompt:`Scene definition:
212A simple interior corner setup with a light grey floor plane and dark walls/ceiling, with a bright overhead light fixture visible near the top of the frame. Upper background tone: near-black/charcoal. Floor plane: light grey to near-white, with a strong brightness gradient.
213
214Lighting logic:
215Lighting is primarily top-down from a single, diffused overhead source visible in-frame. Strong brightness on the floor and rapid falloff into the darker walls/ceiling. Light softness appears high: transitions are smooth.
216
217Camera constraints:
218Portrait-oriented, includes both the floor plane and the ceiling light fixture. Camera angled upward enough to capture overhead elements while showing large floor area.
219
220Environmental behaviour:
221A subject placed on the floor plane would be strongly top-lit with a localized contact shadow beneath. The visible overhead light fixture is a prominent element that may need to be cropped for clean e-commerce swaps.
222No Model attached`},{id:"bg18",url:"/try-on/backgrounds/bg18.webp",label:"Chain-Link Fence",prompt:`Scene definition:
223A close-up view of a chain-link fence in the foreground with a red/orange wall-like surface behind it. Foreground element: chain-link mesh spans the full frame. Background surface color: warm red/orange overall, with a lighter circular area near the center.
224
225Lighting logic:
226Lighting appears relatively even and soft across the frame, with gentle tonal falloff toward the corners. No strong directional shadows. Color cast is warm throughout.
227
228Camera constraints:
229Near perpendicular to the fence/wall plane. Portrait framing; the scene fills the entire frame edge-to-edge.
230
231Environmental behaviour:
232This scene behaves more like a layered texture (foreground fence + background wall) than a clean e-commerce set. Contact shadows on a ground plane are not applicable as no floor surface is visible. Best suited for stylized/editorial product placements.
233No Model attached`},{id:"bg19",url:"/try-on/backgrounds/bg19.webp",label:"Rolling Hills Landscape",prompt:`Scene definition:
234Outdoor rolling-hill landscape with dry grass foreground and a clear sky. Foreground: dense, straw-colored dry grass. Midground: rounded, tan/brown hills with sparse vegetation. A narrow dirt track/path and a paved road with white roadside posts visible. Backgroun
234d: a distant mountain/ridge silhouette through atmospheric haze.
235
236Lighting logic:
237Natural daylight with generally even illumination and gentle shading across the hills. Contrast is moderate. Color cast trends warm on the ground with cool blue sky.
238
239Camera constraints:
240Portrait-oriented, slightly elevated viewpoint. Horizon is high-to-mid frame with distant ridgelines against the sky.
241
242Environmental behaviour:
243A composited subject would need careful grounding due to the uneven, highly textured grass/earth. Contact shadow behavior: not clearly predictable due to uneven terrain. Better for lifestyle/outdoor context than for standardized "studio-catalog" repeatability.
244No Model attached`},{id:"bg20",url:"/try-on/backgrounds/bg20.webp",label:"Warm Red-Orange Gradient",prompt:`Scene definition:
245A warm, abstract red–orange gradient backdrop with soft tonal mottling and no distinct objects or set features. Palette is warm and saturated: deep burgundy/maroon in the upper area transitioning into orange-red through the middle. Lower third shifts to a lighter peach/salmon tone.
246
247Lighting logic:
248Diffuse, low-contrast illumination with a noticeable brighter "hotspot" area toward the right side. Light quality appears soft; transitions between tones are smooth.
249
250Camera constraints:
251Minimal geometric information. Composition suggests a stable, centered background plate. Perspective, lens characteristics, and camera height cannot be confidently inferred.
252
253Environmental behaviour:
254This background should composite cleanly for e-commerce products due to its minimal detail, but grounding will require careful shadow and floor definition since a true floor plane is not explicit. Warm background tones may introduce perceived color spill onto subjects.
255No Model attached`},{id:"bg21",url:"/try-on/backgrounds/bg21.webp",label:"Wood Panel Lifestyle Set",prompt:`Scene definition:
256A staged interior wall + floor plane set featuring large wood-grain wall panels and a muted green floor surface, with minimal decor furniture partially in frame. Wall surface: multiple large rectangular panels with visible wood-grain patterns. Floor plane: muted olive/green, soft-textured surface. Props include a low dark cabinet with vases and books, and a beige upholstered chair.
257
258Lighting logic:
259Soft, diffuse lighting with low contrast and gentle shadowing. Shadow quality: soft-edged shadows under furniture. Light direction is subtle; warm cast is present.
260
261Camera constraints:
262Portrait orientation. Camera positioned facing the wall plane with a stable, straight framing. Large wall area in the upper center for clean background use.
263
264Environmental behaviour:
265A composited subject placed on the floor plane would ground with soft, short contact shadows. The wood-grain pattern can visually compete with fine garment edges. Existing decor (vases/books) can introduce unwanted style cues.
266No Model attached`},{id:"bg22",url:"/try-on/backgrounds/bg22.webp",label:"Brown Paper Sweep Studio",prompt:`Scene definition:
267Indoor photo studio corner featuring a warm brown seamless paper sweep (floor-to-wall transition) surrounded by dark studio walls and visible staging equipment. Paper color is a muted warm brown / terracotta tone. The sweep curves from a vertical backdrop down onto the floor. Visible equipment includes a metal step ladder, light stand, and decorative column.
268
269Lighting logic:
270Soft, centered illumination brightens the middle of the paper sweep while the surrounding studio remains significantly darker. The paper shows a gentle hotspot/brightened region near the center-right.
271
272Camera constraints:
273Camera is positioned facing the sweep nearly straight-on. Full width of the paper visible with a strip of studio floor. Portrait orientation.
274
275Environmental behaviour:
276A subject placed on the paper floor would ground cleanly with soft contact shadow on the warm sweep. Consistent catalog compositing requires cropping or removing visible studio equipment at the sides. The center of the paper is the most uniform region.
277No Model attached`},{id:"bg23",url:"/try-on/backgrounds/bg23.webp",label:"Plain Neutral Backdrop",prompt:`Scene definition:
278A plain, smooth neutral backdrop fills most of the frame, with a faint ground plane visible along the bottom edge and a soft wall–floor transition. Overall color tone: warm gray / taupe with a muted, low-saturation look. No props, furniture, signage, or environmental markers.
279
280Lighting logic:
281Lighting cues are limited. Broad brightness variation suggests soft, diffuse illumination. Shadow edges are soft with minimal definition.
282
283Camera constraints:
284The camera appears roughly front-facing toward the backdrop. Stable horizontal seam line. Portrait orientation.
285
286Environmental behaviour:
287A subject would sit against a neutral field with minimal distractions. The uneven gradient and dark corners could complicate consistent catalog compositing without background normalization. Expected grounding with soft, diffuse contact shadow.
288No Model attached`},{id:"bg24",url:"/try-on/backgrounds/bg24.webp",label:"Green Curtain Set",prompt:`Scene definition:
289An indoor set-style background dominated by a dark green, full-height draped curtain with a light floor plane and a small cluster of props at the lower left. Backgroun
289d surface: dark green curtain with dense vertical pleats. Floor plane: light, warm off-white/cream surface. Visible props: a small metallic pedestal side table with a book and cup; a rectangular patterned rug at the bottom edge.
290
291Lighting logic:
292Lighting reads as soft and controlled with gentle highlights on the curtain folds. Shadow edges appear soft, indicating diffused light. Warm-neutral color on floor and table.
293
294Camera constraints:
295Portrait-oriented with a centered wall area. Camera appears positioned facing the curtain fairly straight-on.
296
297Environmental behaviour:
298A composited subject would ground well on the light floor plane with soft contact shadows. The rug's pattern can clash with product textures. Best suited for styled editorial-catalog looks.
299No Model attached`},{id:"bg25",url:"/try-on/backgrounds/bg25.webp",label:"Neutral Studio Sweep",prompt:`Scene definition:
300A minimal, neutral studio sweep/cove fills the frame, with a smooth light-gray wall transitioning into a light-gray floor plane. Overall color tone: neutral light gray. Backgroun
300d uniformity: mostly uniform, with a gentle gradient. Clear tonal falloff/vignette at edges.
301
302Lighting logic:
303Lighting appears soft and diffuse with low contrast, producing broad gradients rather than defined shadows. Light distribution: brighter in the lower portion (floor area).
304
305Camera constraints:
306Portrait orientation. Straight-on composition with a level horizontal seam line. Minimal perspective distortion.
307
308Environmental behaviour:
309A subject would be grounded by a soft contact shadow near the feet. The plain background supports clean compositing for catalog-style product imagery. Gradient matching important to avoid a pasted-on look.
310No Model attached`},{id:"bg26",url:"/try-on/backgrounds/bg26.webp",label:"Urban Night Crosswalk",prompt:`Scene definition:
311A dim, urban street-level scene with a zebra crosswalk in the foreground and a dark building façade (windows + central glass door) in the background. Ground plane: asphalt roadway with multiple white crosswalk bars. Building façade is very dark with window panels and a centered door. Visible film-style edge artifacts/light leaks.
312
313Lighting logic:
314Very low ambient light with most background detail in shadow. Crosswalk stripes appear as the brightest structured element. Warm vertical band on the right edge appears like a light leak effect.
315
316Camera constraints:
317Portrait-oriented, mostly straight-on framing. Central door is close to the frame's center. Camera appears across the street at roughly standing height.
318
319Environmental behaviour:
320A subject placed on the roadway/crosswalk would be grounded by the strong geometric pattern. Very dark background requires strong subject lighting for separation. Light-leak borders would need removal for consistent e-commerce use.
321No Model attached`},{id:"bg27",url:"/try-on/backgrounds/bg27.webp",label:"Urban Sidewalk Scene",prompt:`Scene definition:
322Urban sidewalk + building facade background with multiple fixed street elements. Visible: bike racks, poles, signage, and a bicycle. Back wall: light off-white/cream facade with rectangular paneling. Ground plane: grey sidewalk/asphalt surface with visible seams. Foreground curb with a rough, pebbled texture.
323
324Lighting logic:
325Diffuse daylight illumination with low-contrast shading. Shadow edges under the racks appear soft and faint. Color cast is neutral-to-cool.
326
327Camera constraints:
328Slightly angled street-level framing capturing both facade and sidewalk. Mild perspective convergence with a diagonal curb leading line.
329
330Environmental behaviour:
331A subject placed on the sidewalk would require clear contact shadows at the feet. Foreground bike racks create occlusion that must be respected. Pavement texture is detailed, requiring accurate edge blending.
332No Model attached`},{id:"bg28",url:"/try-on/backgrounds/bg28.webp",label:"Industrial Brick Wall",prompt:`Scene definition:
333An indoor, industrial-looking corner space with a painted brick wall and a concrete floor. Back wall: white/light-painted brick with large irregular patches of darker exposed brick. Floor: grey concrete with visible cracks and stain patches. A Silver / grey metallic vehicle is shown in the foreground in side profile.
334
335Vehicle specification:
336Type (style/era): Classic sporty coupe / retro performance street car (80s–90s vibe)
337Body type: 2-door coupe
338Colour: Silver / grey metallic
339
340Lighting logic:
341Primary illumination is from above, producing soft shadows and a clear rectangular light reflection in the vehicle's window. Overall shadows appear soft-edged and low contrast.
342
343Camera constraints:
344Camera positioned roughly parallel to the main wall plane. Stable, side-on profile view with minimal perspective distortion.
345
346Environmental behaviour:
347A composited subject would need to match soft overhead lighting and low-contrast grounding shadows on a rough concrete floor. The textured brick wall supports gritty/industrial styling.
348No Model attached`},{id:"bg29",url:"/try-on/backgrounds/bg29.webp",label:"Raw Concrete Wall",prompt:`Scene definition:
349Industrial wall + floor plane made of unfinished concrete, with heavy surface wear. Wall material: cast concrete with visible formwork panel seams. Wall color tone: off-white to very light grey with mottled discoloration. Visible utility elements: multiple light-colored pipes run horizontally near the top-left. Floor: rough concrete slab with stains and wear patterns.
350
351Lighting logic:
352Overall illumination is soft and low-contrast. Shadow edges are not distinct; light appears diffuse. Wall highlights: gentle, broad tonal variation.
353
354Camera constraints:
355Camera positioned low-to-mid height, aimed toward a wall at a slight angle. Framing preserves both wall texture and a usable floor str
355ip. Portrait orientation.
356
357Environmental behaviour:
358Subjects placed on the concrete floor will read as naturally grounded. The background works best when the product styling embraces texture rather than requiring pristine minimalism.
359No Model attached`},{id:"bg30",url:"/try-on/backgrounds/bg30.webp",label:"Light Interior with Curtains",prompt:`Scene definition:
360A minimal interior corner scene with a flat wall and floor plane, plus sheer curtains along the left edge. Palette: very light (off-white/cream). Wall color: warm off-white, largely uniform. Floor plane: light gray/off-white with a smooth, matte look. Sheer, off-white curtains hang on the left side.
361
362Lighting logic:
363Strong natural-looking directional light entering from the left, creating rectangular patches of sunlight and shadow on the floor. Shadow edges are moderately defined. The curtain diffuses the overall illumination.
364
365Camera constraints:
366Camera positioned low-to-mid height facing an interior corner. The frame is weighted to the right-side wall. Portrait orientation.
367
368Environmental behaviour:
369A subject placed on the floor would be grounded by soft ambient contact shadow. The scene supports clean compositing due to minimal clutter. Lighting consistency depends on matching the window-cast pattern.
370No Model attached`},{id:"bg31",url:"/try-on/backgrounds/bg31.webp",label:"Simple Wall + Floor",prompt:`Scene definition:
371A minimal, near-monochrome studio-style background with a clean wall + floor plane split by a faint horizontal seam line. Overall color: very light warm gray / off-white. Wall occupies roughly the upper 75% of the frame; floor occupies roughly the lower 25%.
372
373Lighting logic:
374Lighting appears extremely soft and even with minimal contrast. Illumination is broadly uniform. Shadow direction is not clearly visible due to no defined shadows.
375
376Camera constraints:
377Camera view is straight-on with a level horizontal seam line. Portrait orientation. Framing prioritizes large negative space on the wall.
378
379Environmental behaviour:
380A composited product would "sit" on the lower floor area, with the seam line acting as a clear grounding reference. Background stability is high with no patterns, props, or strong gradients.
381No Model attached`},{id:"bg32",url:"/try-on/backgrounds/bg32.webp",label:"Desert Ridge Landscape",prompt:`Scene definition:
382An outdoor arid landscape with a textured ground plane leading into layered, eroded hills under a pale sky. Foreground: uneven rocky ledge with small stones/gravel. Midground includes a darker sloped drop-off leading to the valley floor. Background: distant mountain/ridge silhouettes. Palette: warm browns and golds with bright, overexposed sky.
383
384Lighting logic:
385Low sun from the right side, producing warm, golden illumination with noticeable atmospheric haze. Highlights are strongest on right-facing surfaces. Long tonal gradient across the valley.
386
387Camera constraints:
388Portrait-oriented frame with a low-to-mid vantage. Camera looking across a broad ground plane toward layered hills. Strong depth layering from foreground to horizon.
389
390Environmental behaviour:
391A subject would need strong grounding cues to match the uneven rocky ledge and pronounced right-to-left lighting gradient. Best placement on the lower foreground ridge area.
392No Model attached`},{id:"bg33",url:"/try-on/backgrounds/bg33.webp",label:"Stratified Rock Face",prompt:`Scene definition:
393A close-framed view of a cut, stratified rock face with warm beige-to-cream banding and sandy debris at the base. Wall surface shows pronounced horizontal/curved sediment-like banding with multiple vertical fractures/cut seams. Ground plane: sandy, matte surface at the bottom.
394
395Lighting logic:
396Soft, even illumination with low-contrast shading. Shadow edges are not sharply defined. Any shading reads as gentle falloff in crevices. Color cast is warm beige.
397
398Camera constraints:
399Portrait orientation, tightly framed on the rock wall. Perspective reads as mostly head-on. Composition centers on a prominent vertical seam.
400
401Environmental behaviour:
402A subject placed on the sandy bottom would need a diffuse, low-contrast contact shadow. The wall is strong horizontal banding can compete with apparel edges. Best placement on the smoother mid-wall areas.
403No Model attached`},{id:"bg34",url:"/try-on/backgrounds/bg34.webp",label:"Arid Hillside Road",prompt:`Scene definition:
404An outdoor arid hillside landscape with rolling tan/brown hills, sparse dry grass, and a winding paved road in the mid-right. Foreground: dense, straw-like dry grass. Midground: rounded hills with patchy vegetation. A paved road curves through with white roadside posts/markers.
405
406Lighting logic:
407Direct outdoor daylight with generally even illumination. Shadow direction cues are minimal. Contrast is moderate. Color cast trends warm on the ground with cool blue sky.
408
409Camera constraints:
410Portrait-oriented. Slightly elevated viewpoint looking across layered hills. Horizon is high with the road providing a leading curve.
411
412Environmental behaviour:
413A composited subject would need careful grounding due to uneven, highly textured grass. Scale cues from road width and posts. Better for outdoor-lifestyle context than neutral e-commerce catalog.
414No Model attached`},{id:"bg35",url:"/try-on/backgrounds/bg35.webp",label:"Saturated Red Field",prompt:`Scene definition:
415A single-color red background fills the entire frame with subtle tonal variation. The frame is overwhelmingly a saturated red field with slight gradients. No objects, furniture, or environmental markers are present. Surface appears largely matte.
416
417Lighting logic:
418Diffuse, low-contrast illumination. Brightness is uneven with a brighter region toward the upper area. Low-to-moderate contrast with smooth transitions.
419
420Camera constraints:
421Minimal geometric information available. The image reads as a flat, front-facing capture of a red field.
422
423Environmental behaviour:
424This background is highly distraction-free and repeatable. No natural "grounding" plane; contact shadowing would need to be created during compositing. Strong red field increases risk of perceived color spill on light/neutral products.
425No Model attached`},{id:"bg36",url:"/try-on/backgrounds/bg36.webp",label:"Arid Cracked Earth",prompt:`Scene definition:
426An outdoor arid landscape with a textured ground plane leading into layered, eroded hills. Foreground: cracked, polygonal mud pattern with irregular fissures. Midground: flatter earth transitioning into chalky/mineral-like band. Background: eroded hills/ridges with distinct stratified bands in tan/beige, reddish-brown, and muted greenish patches.
427
428Lighting logic:
429Soft and low-contrast with even exposure. Shadow edges are not visible; diffuse/soft illumination. Contrast is moderate-to-low. Color cast trends warm on the terrain.
430
431Camera constraints:
432Portrait-oriented. Low-to-mid vantage looking across a broad ground plane toward hills. Strong depth separation from foreground to background.
433
434Environmental behaviour:
435A subject would need to follow irregular grass clumps and uneven ground for grounding. Strong depth cues require appropriate sharpness/blur behavior. Best compositing zone: the flatter mid-foreground before the mineral band.
436No Model attached`},{id:"bg37",url:"/try-on/backgrounds/bg37.webp",label:"Off-White Wall + Wood Floor",prompt:`Scene definition:
437A clean wall + floor plane interior setup: an off-white painted wall meets a medium-brown wood plank floor with a thin baseboard line at the transition. Wall color: off-white/very light warm gray. Floor: long rectangular wood planks with visible grain and knot-like markings. No objects, furniture, or fixtures visible.
438
439Lighting logic:
440Lighting is soft and diffuse, with a noticeable brightness gradient strongest on the right side. Shadows are minimal with very soft edges. Color cast trends slightly warm overall.
441
442Camera constraints:
443Camera positioned facing the wall nearly straight-on. Floor planks create mild perspective convergence. Vertical lines remain mostly upright. Portrait orientation.
444
445Environmental behaviour:
446A subject placed on the floor would ground cleanly with a soft contact shadow. The baseboard line provides a stable horizon reference for consistent placement. Simple geometry supports repeatable compositing.
447No Model attached`},{id:"bg38",url:"/try-on/backgrounds/bg38.webp",label:"Pale Rock Wall",prompt:`Scene definition:
448A vertical, light-colored rock face fills most of the frame, meeting a matching pale rock ground plane at the bottom edge. Wall color: off-white to pale beige with scattered warmer tan/orange patches. Surface character: heavily fractured rock with blocky breaks, shallow ledges, and irregular fissures. Ground plane: pale rock slab with prominent cracks and veins.
449
450Lighting logic:
451Soft, even illumination across both wall and ground. Shadow edges are not sharply defined. 
451Contrast is low-to-moderate. Color cast is warm beige.
452
453Camera constraints:
454Portrait orientation. Camera aimed mostly straight-on toward the rock wall. Minimal perspective distortion.
455
456Environmental behaviour:
457A subject placed on the rock slab would need soft contact shadows matching the diffuse lighting. Ground is irregular with cracks. Best placement on comparatively smoother mid-wall areas to reduce visual collision.
458No Model attached`},{id:"bg39",url:"/try-on/backgrounds/bg39.webp",label:"Warm Grey Wall + Floor",prompt:`Scene definition:
459A minimal wall + floor plane set with a visible horizontal wall–floor junction line and no props or furniture. Wall color: warm off-white / light beige with subtle tonal variation. Wall texture: faint mottling and patchy discoloration. Floor color: light-to-mid grey with irregular mottled patches.
460
461Lighting logic:
462Overall illumination is soft and even with low contrast. Shadow evidence not visible. Light softness appears very soft. Contrast level is low.
463
464Camera constraints:
465Camera appears level. Straight-on composition with level horizontal junction line. Portrait orientation. Framing prioritizes large negative space on the wall.
466
467Environmental behaviour:
468A subject placed on the floor plane would read as grounded with soft contact shadows. The visible junction line provides a clear anchor for scale and alignment. Background is repeatable and consistent.
469No Model attached`},{id:"bg40",url:"/try-on/backgrounds/bg40.webp",label:"Bright Interior with Seating",prompt:`Scene definition:
470Minimal, bright interior corner with a wall + floor plane and large neutral rug, framed by a tall window with sheer curtains and two low-profile upholstered seating pieces. Wall color: uniform matte white/light off-white. Lower wall: wainscoting/paneling. Floor: light-toned wood with plank seams. Large light neutral rug covering most of visible floor. Furniture includes a modular, low, tufted upholstered sofa.
471
472Lighting logic:
473Soft, diffuse illumination enters primarily from the window on the left. Shadow edges are very soft. Overall contrast is low. Color cast appears neutral to slightly warm.
474
475Camera constraints:
476Camera positioned at a low-to-mid height, angled slightly toward the corner. Stable verticals with minimal distortion. Portrait orientation.
477
478Environmental behaviour:
479A subject placed on the rug would ground naturally with soft, diffuse contact shadows. Best placement: center-right on the rug in front of the blank right wall. The neutral palette means light garments may need added edge definition.
480No Model attached`}];Di[0].prompt;const U="https://api.studioe.ai";function jr(r){return r==="2K"?ie.TRYON_SCENE_GENERATE_2K:r==="1K"?ie.TRYON_SCENE_GENERATE_1K:ie.TRYON_SCENE_GENERATE_4K}function Fi(r){return r==="4K"?ie.TRYON_APPLY_OUTFIT_4K:r==="2K"?ie.TRYON_APPLY_OUTFIT_2K:ie.TRYON_APPLY_OUTFIT_1K}function Nr(r){return r==="4K"?"1.5–4.5 minutes":r==="2K"?"1–2.5 minutes":"50 seconds – 1.5 minutes"}function Al(r){return r==="4K"?"1–4 minutes":r==="2K"?"55 seconds – 2 minutes":"35–55 seconds"}function Rl(){return e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Couldn’t composite this image."}),e.jsxs("div",{className:"mt-1 text-sm opacity-90",children:["This is often caused by a corrupted image. Try a different garment or accessory. If the problem persists,"," ",e.jsx(Ui,{to:"/contact",className:"underline font-medium",children:"contact support"}),"."]})]})}function Q(r){return new Promise((f,d)=>{const p=new FileReader;p.onload=()=>{const v=String(p.result||""),n=v.split(",").pop();f({dataUrl:v,base64:n||""})},p.onerror=v=>d(v),p.readAsDataURL(r)})}function te(r){var d;const f=typeof r=="string"?r.trim():"";return f?/^https?:\/\//i.test(f)||/^data:/i.test(f)?f:typeof window<"u"&&((d=window.location)!=null&&d.origin)?`${window.location.origin}${f.startsWith("/")?"":"/"}${f}`:f:""}function Xa({label:r,value:f,onChange:d,options:p,disabled:v}){if(!Array.isArray(p)||p.length===0)return null;const n=[{value:"",label:"As is"},...p.map(m=>({value:m,label:m}))],N=f||"As is";return e.jsx("div",{className:"space-y-1",children:e.jsx(ts,{options:n,selectedValue:f||"",onSelect:m=>d(m),disabled:v,className:"w-full",buttonContent:e.jsx("span",{className:"flex items-center justify-between gap-2 w-full",children:e.jsx("span",{className:"truncate",title:f?`Fit Style: ${f}`:`Fit Style: As is (${r})`,children:N})}),buttonClassName:"!bg-[#252525] hover:!bg-[#2f2f2f] !border-0 !rounded-lg !px-3 !py-2 !text-xs !leading-4 !font-medium",menuClassName:"!bg-[#0f1115] !border-gray-700"})})}function Za({value:r,onChange:f,disabled:d,placeholder:p,rightPad:v=!1}){return e.jsx("input",{type:"text",value:r,onChange:n=>
480f(n.target.value),maxLength:200,disabled:d,placeholder:p,className:`w-full bg-[#252525] hover:bg-[#2f2f2f] border-0 rounded-lg px-3 py-2 text-xs leading-4 font-medium text-white placeholder:text-gray-500 disabled:opacity-50 ${v?"pr-12":""}`})}function es({preview:r,dragActive:f,disabled:d,onRemove:p,onFileSelect:v,setDragActive:n,itemLabel:N="garment"}){return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-400",children:"Fit Reference"}),e.jsx(Xo,{modalTitle:"Fit Reference",modalIcon:e.jsx(Ai,{className:"w-5 h-5"}),content:e.jsxs("div",{className:"space-y-2 text-sm text-gray-300",children:[e.jsxs("p",{children:["Upload a photo showing how this ",N," should"," ",e.jsx("span",{className:"text-white font-medium",children:"fit and drape on a body"}),"."]}),e.jsxs("p",{children:["Only the"," ",e.jsx("span",{className:"text-white font-medium",children:"silhouette, volume, and drape"})," ","are used from this image. Colors, prints, and design details are ignored."]}),e.jsx("p",{className:"text-gray-500 text-xs",children:"This works alongside Fit Style. The verbal preset or custom instruction acts as a refinement on top of the visual reference."})]}),contentClassName:"max-w-full",children:e.jsx("button",{type:"button",className:"text-gray-500 hover:text-gray-300 transition-colors cursor-pointer","aria-label":"Learn about fit reference",children:e.jsx(Ai,{className:"w-3.5 h-3.5"})})})]}),r&&e.jsx("button",{onClick:p,disabled:d,className:"text-[10px] text-red-400 hover:text-red-300 disabled:opacity-50",children:"Remove"})]}),e.jsxs("label",{className:`group block rounded-lg border-2 border-dashed bg-[#0a0a0a]/60 cursor-pointer overflow-hidden transition-all ${d?"opacity-60 cursor-not-allowed":""} ${f?"border-purple-500 ring-2 ring-purple-500/40":r?"border-purple-500/40":"border-gray-700 hover:border-purple-500/50"}`,onDragOver:m=>{m.preventDefault(),!d&&n(!0)},onDragLeave:m=>{m.preventDefault(),n(!1)},onDrop:async m=>{var O,_;if(m.preventDefault(),n(!1),d)return;const H=(_=(O=m.dataTransfer)==null?void 0:O.files)==null?void 0:_[0];H&&await v(H)},children:[e.jsx("input",{type:"file",accept:"image/png, image/jpeg, image/webp, image/heic, image/heif, .heic, .heif",className:"hidden",disabled:d,onChange:async m=>{var O;const H=(O=m.target.files)==null?void 0:O[0];H&&await v(H),m.target.value=""}}),r?e.jsx("div",{className:"h-24",children:e.jsx("img",{src:r,alt:`${N} fit ref`,className:"w-full h-full object-contain"})}):e.jsxs("div",{className:"h-20 flex flex-col items-center justify-center text-center px-3",children:[e.jsx(ss,{className:"w-5 h-5 text-purple-400/50 mb-1"}),e.jsx("span",{className:"text-[11px] font-medium text-purple-400/80 group-hover:text-purple-300 underline decoration-dotted",children:"Upload fit example"}),e.jsx("p",{className:"hidden sm:block mt-0.5 text-[10px] text-gray-500",children:"or drag & drop"})]})]})]})}function Ti({bgPreview:r,bgInputRef:f,setBgPreview:d,setBackgroundPrompt:p,bgFile:v,setBgFile:n,label:N,preview:m,onFileSelect:H,loading:O,description:_,dragActive:J,onDragOver:L,onDragLeave:pe,onDrop:oe,inputRef:ae,processingActive:Qe,processingTitle:Ae,overlay:Me,alternativeActionLabel:ue,onAlternativeAction:X,internalLabel:q,internalLabelIcon:S}){const W=N==="Background"||r!==void 0,Z=N&&N.trim()!=="";return e.jsxs("div",{className:"space-y-2",children:[Z&&e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("h3",{className:"text-sm font-semibold text-white",children:N})}),e.jsxs("label",{className:`group relative w-full h-[230px] rounded-xl flex items-center justify-center overflow-hidden border-2 ${O?"border-gray-700 cursor-not-allowed":J?"border-blue-500 ring-2 ring-blue-500 ring-opacity-50":"border-dashed border-gray-700 hover:border-gray-600 cursor-pointer"} bg-[#0A0A0A]/60 transition-all`,onDragOver:O?void 0:L,onDragLeave:O?void 0:pe,onDrop:O?void 0:oe,children:[e.jsx("input",{ref:ae,type:"file",accept:"image/png, image/jpeg, image/webp, image/heic, image/heif, .heic, .heif",onChange:H,disabled:O,className:"hidden"}),Me?e.jsx("div",{className:"absolute inset-0 pointer-events-none z-[1]",children:Me}):null,q&&!m&&e.jsxs("div",{className:"absolute top-3 left-3 z-10 flex items-center gap-1.5 pointer-events-none",children:[S&&e.jsx("span",{className:"text-blue-400",children:S}),e.jsx("span",{className:"text-xs font-semibold text-white/80",children:q})]}),m?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:m,alt:N,className:"w-full h-full object-contain pointer-events-none"}),!W&&_&&e.jsx("div",{className:"absolute top-3 right-3 z-10",children:_}),W&&e.jsxs("button",{type:"button",disabled:O,onClick:$=>{$.preventDefault(),$.stopPropagation(),n(null),d(null),p(""),f!=null&&f.current&&(f.current.value="")},className:"absolute top-3 right-3 z-10 px-2.5 py-1.5 bg-black/70 backdrop-blur-sm rounded-lg text-xs font-medium text-gray-300 hover:text-white hover:bg-black/80 transition-all disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-1.5",children:[e.jsx(Ie,{className:"w-3.5 h-3.5"}),"Clear"]}),Qe&&e.jsxs("div",{className:"absolute inset-0 z-[60] flex items-center justify-center","aria-live":"polite","aria-busy":"true",children:[e.jsx("div",{className:"absolute inset-0 scan-dim"}),e.jsx("div",{className:"absolute inset-0 scan-lines"}),e.jsx("div",{className:"absolute inset-0 scan-lines-angled"}),e.jsx("div",{className:"absolute left-0 w-full scan-line-sweep"}),e.jsx("div",{className:"absolute inset-0 scan-grid-lines"}),e.jsx("div",{className:"scan-grid-reactive",children:e.jsx("div",{className:"scan-grid-reactive-band"})}),e.jsxs("div",{className:"relative flex flex-col items-center justify-center text-center px-6 z-[50]",children:[e.jsxs("div",{className:"relative mb-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-full border-4 border-blue-700/30 border-t-[#4169e1] animate-spin"}),e.jsx("div",{className:"absolute inset-0 rounded-full animate-ping bg-blue-500/20"})]}),e.jsx("p",{className:"text-sm font-medium text-indigo-50 scan-text-front",children:Ae})]})]})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"text-center px-4",children:[e.jsx(ss,{className:"mx-auto h-10 w-10 text-gray-500"}),e.jsx("span",{className:"mt-2 inline-block text-sm font-medium text-blue-400 hover:text-blue-300 underline decoration-dotted",children:"Click to upload"}),e.jsx("p",{className:"hidden sm:block mt-1 text-xs text-gray-400",children:"or drag & drop"}),ue&&X&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-4 flex items-center gap-2 justify-center",children:[e.jsx("div",{className:"h-px w-8 bg-gray-600"}),e.jsx("span",{className:"text-[11px] text-gray-500 uppercase tracking-wide",children:"or"}),e.jsx("div",{className:"h-px w-8 bg-gray-600"})]}),e.jsx("button",{type:"button",onClick:$=>{$.preventDefault(),$.stopPropagation(),X()},disabled:O,className:"mt-3 px-4 py-2 text-[12px] font-medium text-blue-400 hover:text-blue-300 bg-white/5 hover:bg-white/10 border border-white/10 rounded-full transition-all disabled:opacity-50 cursor-pointer",children:ue})]})]})})]})]})}function Ei({value:r,onChange:f,loading:d,label:p}){const[v,n]=o.useState(!1);return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-gray-400",children:p}),e.jsxs("button",{type:"button",disabled:d||!r,onClick:()=>n(!v),className:"text-xs text-gray-400 hover:text-white transition-colors disabled:opacity-50",children:[v?"Collapse":"Expand"," (",(r==null?void 0:r.length)||0," chars)"]})]}),e.jsx("textarea",{value:r,onChange:N=>f(N.target.value),rows:v?12:4,disabled:d,className:"w-full rounded-lg bg-[#0f1115] border border-white/10 p-3 text-sm text-white placeholder-gray-500 disabled:opacity-50 resize-none",placeholder:"Generated prompt will appear here..."})]})}function wn(){var pi,gi,bi,xi,wi,yi,vi,ji,Ni,ki,Si,Ci;
480const r=Yo(),[f,d]=o.useState(1),[p,v]=o.useState(null),[n,N]=o.useState(!1),[m,H]=o.useState(!1),[O,_]=o.useState("Applying outfit..."),[J,L]=o.useState(""),[pe,oe]=o.useState("initial"),[ae,Qe]=o.useState("new"),[Ae,Me]=o.useState(!1),[ue,X]=o.useState(null),[q,S]=o.useState(new Set),[W,Z]=o.useState(null),[$,Xe]=o.useState(null),[P,D]=o.useState(""),[Ze,et]=o.useState(!1),ge=o.useRef(null),[tt,is]=o.useState(null),[at,Pa]=o.useState(null),[be,Re]=o.useState(""),[zi,os]=o.useState(!1),Pe=o.useRef(null),[_i,ls]=o.useState(!1),[Wi,ns]=o.useState(!1),[B,De]=o.useState(null),[Pr,Fa]=o.useState(null),[ze,st]=o.useState(!1),[Ta,Ea]=o.useState([]),[Ua,Bt]=o.useState(0),Hi=o.useRef(null),[Fr,xe]=o.useState(!0),[$i,Ot]=o.useState(!1),[Gi,Tr]=o.useState(!1),[cs,La]=o.useState(null),[ds,Gs]=o.useState(!1),[Er,Vs]=o.useState(null),[Ur,us]=o.useState(null),[Lr,Br]=o.useState(!1),[Vi,Ki]=o.useState(""),[Yi,qi]=o.useState(new Set),Or="https://youtu.be/CpxA1_ammRA",[Ji,Ks]=o.useState(!1),[K,ms]=o.useState("4K"),[Ba,hs]=o.useState("4K"),[G,It]=o.useState("4K"),[rt,fs]=o.useState("4K"),[me,ps]=o.useState("auto"),[Pl,Ir]=o.useState(!1),Qi=o.useRef(null),Xi=()=>{kl(),oe("initial"),Qe("new"),d(1),v(null),N(!1),H(!1),_("Applying outfit..."),L(""),ps("auto"),It(Bs),fs(Bs),ms(Bs),hs(Bs),Me(!1),X(null),S(new Set),Z(null),Xe(null),D(""),et(!1),ge!=null&&ge.current&&(ge.current.value=""),is(null),Pa(null),Re(""),os(!1),ns(!1),Pe!=null&&Pe.current&&(Pe.current.value=""),De(null),Fa(null),st(!1),Ea([]),Bt(0),xe(!0),Ot(!1),Oa(null),Mt(null),Ia(null),Dt(null),Ma(null),zt(null),Da(null),_t(null),za([]),Wt([]),it(null),ot(null),lt(null),nt(null),ct([]),$t(""),Vt(""),Yt(""),Jt(""),Qt(["","",""]),Zt("preset"),ta("preset"),sa("preset"),ia("preset"),la(["preset","preset","preset"]),na(""),ca(""),da(""),ua(""),ma(["","",""]),vs(null),Zs(!1),pa({original:null,side:null,back:null,posed:[]}),ga("original"),to(!1),ba(!1),He([]),Oe(0),Ga(""),ks(null),Ss(null),er(!1),ar(null),Gs(!1),As(!1),Rs(!1),Ps(!1),Fs(!1),Ts([!1,!1,!1]),ft(null),pt(null),kt(null),gt(null),bt(null),St(null),xt(null),wt(null),Ct(null),yt(null),vt(null),At(null),jt([null,null,null]),Nt(["","",""]),Rt(["","",""])},[we,Oa]=o.useState(null),[Te,Mt]=o.useState(null),[ye,Ia]=o.useState(null),[Ee,Dt]=o.useState(null),[ve,Ma]=o.useState(null),[Ue,zt]=o.useState(null),[je,Da]=o.useState(null),[Le,_t]=o.useState(null),[he,za]=o.useState([]),[Ne,Wt]=o.useState([]),[le,it]=o.useState(null),[ne,ot]=o.useState(null),[ce,lt]=o.useState(null),[de,nt]=o.useState(null),[se,ct]=o.useState([]),[Ht,$t]=o.useState(""),[Gt,Vt]=o.useState(""),[Kt,Yt]=o.useState(""),[qt,Jt]=o.useState(""),[_e,Qt]=o.useState(["","",""]),[Xt,Zt]=o.useState("preset"),[ea,ta]=o.useState("preset"),[aa,sa]=o.useState("preset"),[ra,ia]=o.useState("preset"),[oa,la]=o.useState(["preset","preset","preset"]),[dt,na]=o.useState(""),[ut,ca]=o.useState(""),[mt,da]=o.useState(""),[ht,ua]=o.useState(""),[Be,ma]=o.useState(["","",""]),[gs,ft]=o.useState(null),[_a,pt]=o.useState(null),[bs,gt]=o.useState(null),[Wa,bt]=o.useState(null),[xs,xt]=o.useState(null),[Ha,wt]=o.useState(null),[ws,yt]=o.useState(null),[$a,vt]=o.useState(null),[ys,jt]=o.useState([null,null,null]),[ha,Nt]=o.useState(["","",""]),[Ys,kt]=o.useState(null),[qs,St]=o.useState(null),[Js,Ct]=o.useState(null),[Qs,At]=o.useState(null),[Xs,Rt]=o.useState(["","",""]),[ee,vs]=o.useState(null),[fa,Zs]=o.useState(!1),[Zi,Mr]=o.useState(""),[V,pa]=o.useState({original:null,side:null,back:null,posed:[]}),[We,ga]=o.useState("original"),[eo,to]=o.useState(!1),[ao,ba]=o.useState(!1),[A,He]=o.useState([]),[I,Oe]=o.useState(0),so=o.useRef(null),[Dr,Ga]=o.useState(""),js=150,xa=o.useMemo(()=>String(Dr||"").replace(/\s+/g," ").trimStart(),[Dr]),ro=js-xa.length<=20,[Ns,ks]=o.useState(null),[wa,Ss]=o.useState(null),[Pt,er]=o.useState(!1),[io,tr]=o.useState(!1),Va=o.useRef(null),[zr,oo]=o.useState("front"),[lo,Cs]=o.useState(!1),[_r,ar]=o.useState(null),F=n||fa||eo||Pt||ds;nl({when:F});const no=!!V.side||!!V.back||Array.isArray(V.posed)&&V.posed.length>0,ya=o.useCallback(()=>{var t;if(We.startsWith("posed-")){const a=parseInt(We.replace("posed-",""),10);return((t=V.posed)==null?void 0:t[a])||null}return V[We]||null}
480,[We,V]),[co,As]=o.useState(!1),[uo,Rs]=o.useState(!1),[mo,Ps]=o.useState(!1),[ho,Fs]=o.useState(!1),[fo,Ts]=o.useState([!1,!1,!1]),[po,go]=o.useState(!1),[bo,xo]=o.useState(!1),[wo,yo]=o.useState(!1),[vo,jo]=o.useState(!1),[No,ko]=o.useState([!1,!1,!1]),{user:w,setCreditBalance:ke}=Qo(),{savedGenerations:Tl,removeGeneration:sr}=qo(),[rr,ir]=o.useState([]),[Wr,Hr]=o.useState(0),[or,So]=o.useState(!1),[Ka,$r]=o.useState(!1),[Gr,Vr]=o.useState(!1),Es=o.useCallback(async({page:t,append:a})=>{if(w&&!Ka){$r(!0);try{const s=await re(`${U}/api/tryon-scenes/list`,{page:t,limit:12},{method:"POST"}),l=Array.isArray(s==null?void 0:s.items)?s.items:[];ir(c=>a?[...c,...l]:l),Hr((s==null?void 0:s.page)||t),So(!!(s!=null&&s.hasMore)),Vr(!0)}catch{}finally{$r(!1)}}},[U,w,Ka]);o.useEffect(()=>{w&&ae==="saved"&&(Gr||Es({page:1,append:!1}))},[U,Es,Gr,ae,w]);const Kr=o.useRef(null);o.useEffect(()=>{if(ae!=="saved"||!or||Ka)return;const t=Kr.current;if(!t)return;const a=new IntersectionObserver(s=>{const l=s&&s[0];l!=null&&l.isIntersecting&&Es({page:Wr+1,append:!0})},{root:null,rootMargin:"600px 0px",threshold:.01});return a.observe(t),()=>a.disconnect()},[U,Es,or,Ka,Wr,ae]);const Us=(w==null?void 0:w.role)==="admin",Ls=w==null?void 0:w.subscriptionStatus,va=String((w==null?void 0:w.subscriptionTier)||"").toLowerCase(),lr=Ls==="active"||Ls==="active-cancelled"||Ls==="paused"||Ls==="past_due",Yr=lr&&(va==="lite"||va==="pro"||va==="elite"),ja=lr&&(va==="pro"||va==="elite"),Na=lr&&va==="elite",Co=t=>Us||t==="1K"?!0:t==="2K"?ja:t==="4K"?Na:!0,nr=(t,a)=>{if(!Co(t)){const s=t==="2K"?"Pro":"Elite";y.info(`Upgrade to ${s} to access ${t} resolution`),r("/pricing");return}a(t)},cr=o.useMemo(()=>[{value:"1K",label:"1K – Standard Quality"},{value:"2K",label:ja?"2K – High Definition":"2K – High Definition (Pro)"},{value:"4K",label:Na?"4K – DSLR Print Quality":"4K – DSLR Print Quality (Elite)"}],[ja,Na]),Bs=Na?"4K":ja?"2K":"1K",qr=o.useRef(!1);o.useEffect(()=>{if(qr.current||!w)return;qr.current=!0;const t=Na?"4K":ja?"2K":"1K",a={"1K":1,"2K":2,"4K":3};a[K]>a[t]&&ms(t),a[G]>a[t]&&It(t)},[w,Na,ja]),o.useEffect(()=>{if(p)return;const t=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID()||`run_${Date.now()}_${Math.random().toString(16).slice(2)}`;v(t)},[p]);const Se=o.useCallback(async(t={})=>{try{const a=C=>!C||typeof C!="string"||C.startsWith("data:")||C.startsWith("blob:")?null:C,s=a(t.garmentTopPreview??Te),l=a(t.garmentBottomPreview??Ee),c=a(t.garmentShoesPreview??Ue),u=a(t.garmentHatPreview??Le),g=(t.accessoryPreviews??Ne??[]).map(a).filter(Boolean),b=a(t.fitRefTopPreview??_a),h=a(t.fitRefBottomPreview??Wa),k=a(t.fitRefShoesPreview??Ha),i=a(t.fitRefHatPreview??$a),x=(t.fitRefAccessoryPreviews??ha??[]).map(a).filter(Boolean),T={ts:Date.now(),stage:t.stage??f,runId:t.runId??p,combinedSceneUrl:t.combinedSceneUrl??B,aspectRatio:t.aspectRatio??me,outfitResolution:t.outfitResolution??G,setupResolution:t.setupResolution??K,renderedSetupResolution:t.renderedSetupResolution??Ba,renderedResolution:t.renderedResolution??rt,sceneHistory:t.sceneHistory??Ta,selectedSceneIdx:t.selectedSceneIdx??Ua,sceneSavedId:t.sceneSavedId??ue,sceneLoadedFromSaved:t.sceneLoadedFromSaved??ze,garmentTopPreview:s,garmentBottomPreview:l,garmentShoesPreview:c,garmentHatPreview:u,accessoryPreviews:g,selectedTopGarmentUrl:t.selectedTopGarmentUrl??le,selectedBottomGarmentUrl:t.selectedBottomGarmentUrl??ne,selectedShoesGarmentUrl:t.selectedShoesGarmentUrl??ce,selectedHatGarmentUrl:t.selectedHatGarmentUrl??de,selectedAccessoryUrls:t.selectedAccessoryUrls??se,topFitStyle:t.topFitStyle??Ht,bottomFitStyle:t.bottomFitStyle??Gt,shoesFitStyle:t.shoesFitStyle??Kt,hatFitStyle:t.hatFitStyle??qt,accessoryFitStyles:t.accessoryFitStyles??_e,topFitMode:t.topFitMode??Xt,bottomFitMode:t.bottomFitMode??ea,shoesFitMode:t.shoesFitMode??aa,hatFitMode:t.hatFitMode??ra,accessoryFitModes:t.accessoryFitModes??oa,topCustomFit:t.topCustomFit??dt,bottomCustomFit:t.bottomCustomFit??ut,shoesCustomFit:t.shoesCustomFit??mt,hatCustomFit:t.hatCustomFit??ht,accessoryCustomFits:t.accessoryCustomFits??Be,fitRefTopPreview:b,fitRefBottomPreview:h,fitRefShoesPreview:k,fitRefHatPreview:i,fitRefAccessoryPreviews:x,finalUrl:t.finalUrl??ee,views:t.views??V,currentView:t.currentView??We,resultHistory:t.resultHistory??A,selectedResultIdx:t.selectedResultIdx??I};Cl(T)}catch{}},[f,p,B,me,G,K,Ba,rt,Ta,Ua,ue,ze,Te,Ee,Ue,Le,Ne,le,ne,ce,de,se,Ht,Gt,Kt,qt,_e,Xt,ea,aa,ra,oa,dt,ut,mt,ht,Be,_a,Wa,Ha,$a,ha,ee,V,We,A,I]),dr=o.useRef(!1);o.useEffect(()=>{dr.current||(dr.current=!0,(async()=>{var t,a,s,l,c,u,g,b,h,k;try{const i=await Sl();if(!i||f!==1||B)return;if(i.runId&&v(i.runId),i.aspectRatio&&ps(i.aspectRatio),i.outfitResolution&&It(i.outfitResolution),i.setupResolution&&ms(i.setupResolution),i.renderedSetupRes
480olution&&hs(i.renderedSetupResolution),i.renderedResolution&&fs(i.renderedResolution),i.combinedSceneUrl&&De(i.combinedSceneUrl),(t=i.sceneHistory)!=null&&t.length&&Ea(i.sceneHistory),typeof i.selectedSceneIdx=="number"&&Bt(i.selectedSceneIdx),i.sceneSavedId&&X(i.sceneSavedId),i.sceneLoadedFromSaved&&st(!0),i.runId&&U)try{const x=await re(`${U}/api/model-try-on/run-prompts`,{runId:i.runId},{method:"POST"});x!=null&&x.modelPrompt&&D(x.modelPrompt),x!=null&&x.backgroundPrompt&&Re(x.backgroundPrompt),x!=null&&x.backgroundPrompt&&ns(!0)}catch{}if(i.garmentTopPreview&&(Mt(i.garmentTopPreview),!i.garmentTopPreview.startsWith("data:")&&!i.garmentTopPreview.startsWith("blob:")&&it(i.garmentTopPreview)),i.garmentBottomPreview&&(Dt(i.garmentBottomPreview),!i.garmentBottomPreview.startsWith("data:")&&!i.garmentBottomPreview.startsWith("blob:")&&ot(i.garmentBottomPreview)),i.garmentShoesPreview&&(zt(i.garmentShoesPreview),!i.garmentShoesPreview.startsWith("data:")&&!i.garmentShoesPreview.startsWith("blob:")&&lt(i.garmentShoesPreview)),i.garmentHatPreview&&(_t(i.garmentHatPreview),!i.garmentHatPreview.startsWith("data:")&&!i.garmentHatPreview.startsWith("blob:")&&nt(i.garmentHatPreview)),(a=i.accessoryPreviews)!=null&&a.length){Wt(i.accessoryPreviews);const x=i.accessoryPreviews.map(T=>T&&!T.startsWith("data:")&&!T.startsWith("blob:")?T:null);x.some(Boolean)&&ct(x)}if((s=i.garmentTopPreview)!=null&&s.startsWith("data:")){const x=Fe(i.garmentTopPreview,"top.png");x&&Oa(x)}if((l=i.garmentBottomPreview)!=null&&l.startsWith("data:")){const x=Fe(i.garmentBottomPreview,"bottom.png");x&&Ia(x)}if((c=i.garmentShoesPreview)!=null&&c.startsWith("data:")){const x=Fe(i.garmentShoesPreview,"shoes.png");x&&Ma(x)}if((u=i.garmentHatPreview)!=null&&u.startsWith("data:")){const x=Fe(i.garmentHatPreview,"hat.png");x&&Da(x)}if((g=i.accessoryPreviews)!=null&&g.length){const x=i.accessoryPreviews.map((T,C)=>T!=null&&T.startsWith("data:")?Fe(T,`acc${C}.png`):null);x.some(Boolean)&&za(x)}if(i.selectedTopGarmentUrl&&it(i.selectedTopGarmentUrl),i.selectedBottomGarmentUrl&&ot(i.selectedBottomGarmentUrl),i.selectedShoesGarmentUrl&&lt(i.selectedShoesGarmentUrl),i.selectedHatGarmentUrl&&nt(i.selectedHatGarmentUrl),(b=i.selectedAccessoryUrls)!=null&&b.length&&ct(i.selectedAccessoryUrls),i.topFitStyle&&$t(i.topFitStyle),i.bottomFitStyle&&Vt(i.bottomFitStyle),i.shoesFitStyle&&Yt(i.shoesFitStyle),i.hatFitStyle&&Jt(i.hatFitStyle),i.accessoryFitStyles&&Qt(i.accessoryFitStyles),i.topFitMode&&Zt(i.topFitMode),i.bottomFitMode&&ta(i.bottomFitMode),i.shoesFitMode&&sa(i.shoesFitMode),i.hatFitMode&&ia(i.hatFitMode),i.accessoryFitModes&&la(i.accessoryFitModes),i.topCustomFit&&na(i.topCustomFit),i.bottomCustomFit&&ca(i.bottomCustomFit),i.shoesCustomFit&&da(i.shoesCustomFit),i.hatCustomFit&&ua(i.hatCustomFit),i.accessoryCustomFits&&ma(i.accessoryCustomFits),i.fitRefTopPreview)if(pt(i.fitRefTopPreview),i.fitRefTopPreview.startsWith("data:")){const x=Fe(i.fitRefTopPreview,"fitref-top.png");x&&ft(x)}else kt(i.fitRefTopPreview);if(i.fitRefBottomPreview)if(bt(i.fitRefBottomPreview),i.fitRefBottomPreview.startsWith("data:")){const x=Fe(i.fitRefBottomPreview,"fitref-bottom.png");x&&gt(x)}else St(i.fitRefBottomPreview);if(i.fitRefShoesPreview)if(wt(i.fitRefShoesPreview),i.fitRefShoesPreview.startsWith("data:")){const x=Fe(i.fitRefShoesPreview,"fitref-shoes.png");x&&xt(x)}else Ct(i.fitRefShoesPreview);if(i.fitRefHatPreview)if(vt(i.fitRefHatPreview),i.fitRefHatPreview.startsWith("data:")){const x=Fe(i.fitRefHatPreview,"fitref-hat.png");x&&yt(x)}else At(i.fitRefHatPreview);if((h=i.fitRefAccessoryPreviews)!=null&&h.length){Nt(i.fitRefAccessoryPreviews);const x=i.fitRefAccessoryPreviews.map((C,R)=>C!=null&&C.startsWith("data:")?Fe(C,`fitref-acc${R}.png`):null);x.some(Boolean)&&jt(x);const T=i.fitRefAccessoryPreviews.map(C=>C&&!C.startsWith("data:")?C:"");T.some(Boolean)&&Rt(T)}i.finalUrl&&vs(i.finalUrl),i.views&&pa(i.views),i.currentView&&ga(i.currentView),(k=i.resultHistory)!=null&&k.length&&He(i.resultHistory),typeof i.selectedResultIdx=="number"&&Oe(i.selectedResultIdx),i.stage===3&&i.finalUrl?(d(3),xe(!1)):i.stage>
480=2&&i.combinedSceneUrl?(d(2),xe(!1)):i.stage===1&&i.combinedSceneUrl&&(i.sceneLoadedFromSaved&&d(2),xe(!1))}catch{}})())},[]);const Jr=dr.current;o.useEffect(()=>{if(!Jr||!p||f<1||!B)return;const t=setTimeout(()=>{Se()},500);return()=>clearTimeout(t)},[Jr,p,f,B,G,rt,Ht,Gt,Kt,qt,_e,Xt,ea,aa,ra,oa,dt,ut,mt,ht,Be,le,ne,ce,de,se,Te,Ee,Ue,Le,Ne,_a,Wa,Ha,$a,ha,Se]);const Ao=6,Os=o.useMemo(()=>(Array.isArray(rr)?rr:[]).filter(a=>{if(!((a==null?void 0:a.imageUrl)||(a==null?void 0:a.url)))return!1;if(a!=null&&a.modelPrompt&&(a!=null&&a.backgroundPrompt))return!0;const l=a!=null&&a.meta&&typeof a.meta=="object"?a.meta:null;return!(l!=null&&l.modelPrompt&&(l!=null&&l.backgroundPrompt))?!1:(a==null?void 0:a.type)==="model_try_on"&&(a==null?void 0:a.subtype)==="scene"||(a==null?void 0:a.type)==="tryon-scene"}),[rr]);Os.length>=Ao;const Qr=async t=>{if(!(!t||n))try{const a=await Ye(t,U),s=await qe(a);Z(s);const l=URL.createObjectURL(s);Xe(l),D("")}catch(a){Je(a,"Error uploading model image")}},Xr=async t=>{if(!(!t||n))try{const a=await Ye(t,U),s=await qe(a);is(s);const l=URL.createObjectURL(s);Pa(l),Re(""),ns(!1)}catch(a){Je(a,"Error uploading background image")}},$e=async({rawFile:t,kind:a})=>{if(!(!t||n))try{const s=await Ye(t,U),l=await qe(s),c=URL.createObjectURL(l);a==="top"?(Oa(l),Mt(c),it(null)):a==="bottom"?(Ia(l),Dt(c),ot(null)):a==="shoes"?(Ma(l),zt(c),lt(null)):a==="hat"&&(Da(l),_t(c),nt(null))}catch(s){Je(s,`Error uploading ${a}`)}},Is=async({rawFile:t,kind:a})=>{if(!(!t||n))try{const s=await Ye(t,U),l=await qe(s),c=URL.createObjectURL(l);a==="top"?(ft(l),pt(c),kt(null)):a==="bottom"?(gt(l),bt(c),St(null)):a==="shoes"?(xt(l),wt(c),Ct(null)):a==="hat"&&(yt(l),vt(c),At(null))}catch(s){Je(s,`Error uploading ${a} fit reference`)}},Ro=async({rawFile:t,index:a})=>{if(!(!t||n||m)&&!(a<0||a>2))try{const s=await Ye(t,U),l=await qe(s),c=URL.createObjectURL(l);jt(u=>{const g=Array.isArray(u)?[...u]:[null,null,null];return g[a]=l,g}),Nt(u=>{const g=Array.isArray(u)?[...u]:["","",""];return g[a]=c,g}),Rt(u=>{const g=Array.isArray(u)?[...u]:["","",""];return g[a]="",g})}catch(s){Je(s,`Error uploading accessory ${a+1} fit reference`)}},Zr=async({rawFile:t,index:a})=>{if(t&&!(n||m)&&!(a<0||a>2))try{const s=await Ye(t,U),l=await qe(s),c=URL.createObjectURL(l);za(u=>{const g=Array.isArray(u)?[...u]:[];return g[a]=l,g}),Wt(u=>{const g=Array.isArray(u)?[...u]:[];return g[a]=c,g}),ct(u=>{const g=Array.isArray(u)?[...u]:[];return g[a]=null,g})}catch(s){Je(s,`Error uploading accessory ${a+1}`)}},ur=async(t,a)=>{try{let s;a?s=ie.TRYON_SCENE_REGENERATE:s=jr(K);const l=await Hs(s,{count:1,beforeBalance:w==null?void 0:w.creditBalance,user:w,runId:p});return typeof(l==null?void 0:l.creditBalance)=="number"&&ke(l.creditBalance),{ok:!0,featureKey:s,debited:(l==null?void 0:l.debited)||0}}catch(s){if(t==null||t(),(s==null?void 0:s.code)==="SERVER_OFFLINE")return{ok:!1};if((s==null?void 0:s.code)==="SUBSCRIPTION_PAUSED")return y.error("Your subscription is paused. Resume your subscription to continue."),{ok:!1};if((s==null?void 0:s.code)==="INSUFFICIENT_TOKENS")return y.error("You’ve used all your credits — upgrade your plan to continue."),{ok:!1};if((s==null?void 0:s.code)==="ELITE_REQUIRED"||/elite/i.test((s==null?void 0:s.message)||""))return y.info("This feature is for Elite members. Upgrade to unlock it.",{autoClose:6e3}),{ok:!1};throw s}},mr=async()=>{var a;if(!W&&!$){y.error("Add a model image to get started.");return}if(!tt&&!at){y.error("Add a background image to get started.");return}L("Analyzing uploaded images…"),N(!0);const t=await ur(()=>{N(!1),L("")},!1);if(t!=null&&t.ok)try{let s=P,l=be;if(!P&&W){L("Analyzing uploaded model…");const c=await Q(W),u=await re(`${U}/api/model-try-on/analyze-model`,{runId:p,image:{data:c.base64,mimeType:W.type}});if(u!=null&&u.ok&&(u!=null&&u.prompt))s=u.prompt,D(u.prompt);else throw new Error("Failed to analyze model")}if(!be&&tt&&!Wi){L("Analyzing uploaded background…");const c=await Q(tt),u=await re(`${U}/api/model-try-on/analyze-background`,{runId:p,image:{data:c.base64,mimeType:tt.type}});if(u!=null&&u.ok&&(u!=null&&u.prompt))l=u.prompt,Re(u.prompt);else throw new Error("Failed to analyze background")}if(L(""),y.success("Analysis complete!"),String(s||"").trim()&&String(l||"").trim()){L("Generating scene and model...");const c=await re(`${U}/api/model-try-on/generate-combined`,{runId:p,modelPrompt:String(s||"").trim(),backgroundPrompt:String(l||"").trim(),isRegenerate:pe==="regenerate",aspectRatio:me,resolution:K});if(c!=null&&c.ok&&((a=c==null?void 0:c.imageUrls)!=null&&a[0])){const u=c.imageUrls[0];De(u),hs(K),Ea([u]),Bt(0),X(null),st(!1),xe(!1),oe("initial"),y.success("Model generated, you’re ready to style!"),Se({stage:1,combinedScene
480Url:u,sceneHistory:[u],selectedSceneIdx:0,renderedSetupResolution:K})}else throw new Error("Failed to generate model")}}catch(s){if(console.error(s),(s==null?void 0:s.code)==="SERVER_OFFLINE")return;if((t==null?void 0:t.debited)>0){const l=await Lt(t.featureKey,t.debited);(l==null?void 0:l.creditBalance)!=null&&ke(l.creditBalance)}y.error("Couldn’t analyze those images. Try again in a moment.")}finally{N(!1),L("")}},ei=async()=>{var t;if(pe||oe("initial"),(!P.trim()||!be.trim())&&(W||tt)){await mr();return}if(!(!P.trim()||!be.trim())){L("Generating scene and model..."),N(!0);try{L("Generating scene and model...");const a=await re(`${U}/api/model-try-on/generate-combined`,{runId:p,modelPrompt:P.trim(),backgroundPrompt:be.trim(),isRegenerate:pe==="regenerate",aspectRatio:me,resolution:K});if(a!=null&&a.ok&&((t=a==null?void 0:a.imageUrls)!=null&&t[0])){const s=a.imageUrls[0];De(s),hs(K),Ea([s]),Bt(0),X(null),st(!1),xe(!1),oe("initial"),L(""),y.success("Model generated, you’re ready to style."),Se({stage:1,combinedSceneUrl:s,sceneHistory:[s],selectedSceneIdx:0,renderedSetupResolution:K})}else throw new Error("Failed to generate model")}catch(a){console.error(a),y.error("Model generation didn’t work that time. Please retry.")}finally{N(!1),L(""),oe("initial")}}},[ti,ai]=o.useState(""),Ms=150,Ft=o.useMemo(()=>String(ti||"").replace(/\s+/g," ").trimStart(),[ti]),Po=Ms-Ft.length<=20,Fo=async()=>{var s;if(n)return;const t=String(Ft||"").trim();if(!t){y.error("Add a quick note for what you want changed first.");return}if(!P.trim()||!be.trim()){y.error("Generate a model first, then you can refine it.");return}if(!B){y.error("We’re missing the current model image. Please generate again.");return}const a=await ur(()=>{N(!1),L(""),oe("initial")},!0);if(a!=null&&a.ok){L("Regenerating scene..."),N(!0);try{const l=await re(`${U}/api/model-try-on/regenerate-edit`,{runId:p,sceneImageUrl:B,regenInstructions:t,aspectRatio:me,resolution:Ba});if(l!=null&&l.ok&&((s=l==null?void 0:l.imageUrls)!=null&&s[0])){const c=l.imageUrls[0],g=[...Ta.slice(0,Ua+1),c],b=g.length-1;Ea(g),Bt(b),De(c),X(null),st(!1),xe(!1),oe("initial"),L(""),ai(""),y.success("Update applied, model regenerated!"),Se({combinedSceneUrl:c,sceneHistory:g,selectedSceneIdx:b})}else throw new Error("Failed to regenerate model")}catch(l){if(console.error(l),(l==null?void 0:l.code)==="SERVER_OFFLINE")return;if((a==null?void 0:a.debited)>0){const c=await Lt(a.featureKey,a.debited);(c==null?void 0:c.creditBalance)!=null&&ke(c.creditBalance)}y.error("Couldn’t update the model. Please try again.")}finally{N(!1),L("")}}},To=async()=>{var l;if(F)return;const t=String(xa||"").trim();if(!t){y.error("Add a quick note for what you want changed first.");return}const a=A[I];if(!(a!=null&&a.url)){y.error("No image selected to edit.");return}const s=await ur(()=>{N(!1)},!0);if(s!=null&&s.ok){N(!0);try{const c=await re(`${U}/api/model-try-on/regenerate-edit`,{runId:p,sceneImageUrl:a.url,regenInstructions:t,aspectRatio:me,resolution:rt});if(c!=null&&c.ok&&((l=c==null?void 0:c.imageUrls)!=null&&l[0])){const u=c.imageUrls[0],g=A.filter(i=>i.type==="edit").length+1,b={url:u,label:`Edit ${g}`,type:"edit"},h=[...A,b],k=h.length-1;He(h),Oe(k),Ga(""),y.success("Edit applied!"),Se({resultHistory:h,selectedResultIdx:k})}else throw new Error("Failed to edit result")}catch(c){if(console.error(c),(c==null?void 0:c.code)==="SERVER_OFFLINE")return;if((s==null?void 0:s.debited)>0){const u=await Lt(s.featureKey,s.debited);(u==null?void 0:u.creditBalance)!=null&&ke(u.creditBalance)}y.error("Couldn't edit the image. Please try again.")}finally{N(!1)}}},Ds=({title:t})=>e.jsxs("div",{className:"absolute inset-0 z-[60] flex items-center justify-center","aria-live":"polite","aria-busy":"true",children:[e.jsx("div",{className:"absolute inset-0 scan-dim"}),e.jsx("div",{className:"absolute inset-0 scan-lines"}),e.jsx("div",{className:"absolute inset-0 scan-lines-angled"}),e.jsx("div",{className:"absolute left-0 w-full scan-line-sweep"}),e.jsx("div",{className:"absolute inset-0 scan-grid-lines"}),e.jsx("div",{className:"scan-grid-reactive",children:e.jsx("div",{className:"scan-grid-reactive-band"})}),e.jsxs("div",{className:"relative flex flex-col items-center justify-center text-center px-6",children:[e.jsxs("div",{className:"relative mb-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-full border-4 border-blue-700/30 border-t-[#4169e1] animate-spin"}),e.jsx("div",{className:"absolute inset-0 rounded-full animate-ping bg-blue-500/20"})]}),e.jsx("p",{className:"text-sm font-medium text-indigo-50 scan-text-front",children:t})]})]}),Eo=o.useCallback(t=>{Pa(t.url),Re(t.prompt),ns(!0),ls(!1)},[]),Uo=_i?Ra.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",style:{animation:"fadeIn 140ms ease-out"},onClick:t=>{t.target===t.currentTarget&&ls(!1)},children:[e.jsxs("div",{className:"w-full max-w-4xl mx-4 max-h-[85vh] bg-[#16181A] border border-[#27272A] rounded-xl shadow-2xl flex flex-col overflow-hidden",style:{animation:"scaleIn 180ms cubic-bezier(.25,.8,.25,1)"},children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 bg-gradient-to-b from-[#16181A]/90 to-[#16181A]/60 text-gray-200 border-b border-[#27272A]",children:[e.jsx("button",{onClick:()=>ls(!1),className:"flex items-center justify-center h-7 w-7 rounded hover:bg-red-600/20 text-red-400 hover:text-red-300 focus:outline-none focus:ring-2 focus:ring-red-500 cursor-pointer","aria-label":"Close background picker",children:e.jsx(Ie,{size:16})}),e.jsx("h2",{className:"text-sm font-semibold text-white",children:"Our Backgroun
480ds Library"})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto overscroll-contain p-4",children:e.jsx("div",{className:"grid gap-3 grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",children:Di.map(t=>e.jsx("button",{onClick:()=>Eo(t),className:"group relative block w-full min-w-0 rounded-md overflow-hidden border border-[#27272A] hover:border-[#326CB4] transition-colors focus:outline-none focus:ring-2 focus:ring-[#326CB4] cursor-pointer p-0 aspect-[3/4]",title:t.label,children:e.jsxs("div",{className:"relative w-full h-full",children:[e.jsx("img",{src:t.url,alt:t.label,className:"absolute inset-0 w-full h-full object-cover rounded-md",loading:"lazy",style:{display:"block"}}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors"}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 px-1.5 py-1 bg-gradient-to-t from-black/70 to-transparent",children:e.jsx("span",{className:"text-[10px] text-white font-medium line-clamp-2 leading-tight",children:t.label})})]})},t.id))})})]}),e.jsx("style",{children:`
481        @keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
482        @keyframes scaleIn { from { transform: scale(.92); opacity:0 } to { transform: scale(1); opacity:1 } }
483      `})]}),document.body):null,Lo=t=>{var s,l;const a=(t==null?void 0:t.imageUrl)||(t==null?void 0:t.url);
483De(a),D((t==null?void 0:t.modelPrompt)||((s=t==null?void 0:t.meta)==null?void 0:s.modelPrompt)||""),Re((t==null?void 0:t.backgroundPrompt)||((l=t==null?void 0:t.meta)==null?void 0:l.backgroundPrompt)||""),Fa(t==null?void 0:t._id),X((t==null?void 0:t._id)||!0),t!=null&&t.aspectRatio&&ps(t.aspectRatio),st(!0),Oa(null),Mt(null),Ia(null),Dt(null),Ma(null),zt(null),Da(null),_t(null),za([]),Wt([]),it(null),ot(null),lt(null),nt(null),ct([]),$t(""),Vt(""),Yt(""),Jt(""),Qt(["","",""]),Zt("preset"),ta("preset"),sa("preset"),ia("preset"),la(["preset","preset","preset"]),na(""),ca(""),da(""),ua(""),ma(["","",""]),ft(null),pt(null),kt(null),gt(null),bt(null),St(null),xt(null),wt(null),Ct(null),yt(null),vt(null),At(null),jt([null,null,null]),Nt(["","",""]),Rt(["","",""]),vs(null),pa({original:null,side:null,back:null,posed:[]}),ga("original"),He([]),Oe(0),Ga(""),It("4K"),fs("4K"),xe(!0),d(2),Se({stage:2,combinedSceneUrl:a,sceneLoadedFromSaved:!0}),window.scrollTo({top:0,behavior:"smooth"})},Bo=async t=>{const a=t==null?void 0:t._id;if(!a){y.error("Can't delete this item.");return}try{const s=!!(t!=null&&t.modelPrompt&&(t!=null&&t.backgroundPrompt)),l=await re(s?`${U}/api/tryon-scenes/delete`:`${U}/api/generations/delete`,s?{sceneId:a}:{id:a},{method:"POST"});if(!(l!=null&&l.ok)){y.error((l==null?void 0:l.error)||"Couldn’t delete, please try again.");return}s?(ir(u=>Array.isArray(u)?u.filter(g=>(g==null?void 0:g._id)!==a):[]),Pr===a&&Fa(null)):sr==null||sr(a),(t==null?void 0:t.type)==="tryon-scene"&&Pr===a&&Fa(null);const c=(t==null?void 0:t.imageUrl)||(t==null?void 0:t.url);c&&B===c&&(De(null),D(""),Re("")),y.success("Deleted, it’s gone for good.")}catch(s){console.error(s),y.error("Delete didn’t go through. Please try again.")}},si=async(t,a="Saved Scene",s=null)=>{if(!t){y.error("No scene to save.");return}if(!P.trim()||!be.trim()){y.error("Missing prompts - generate a scene first.");return}if(s&&q.has(s)){y.info("This view is already saved.");return}if(!Ae)try{Me(!0);const l=await re(`${U}/api/tryon-scenes`,{imageUrl:te(t),label:a,modelPrompt:P.trim(),backgroundPrompt:be.trim(),runId:p,aspectRatio:me},{method:"POST"}),c=l==null?void 0:l.scene;if(c)s&&S(u=>new Set([...u,s])),X(c==null?void 0:c._id),y.success("Scene saved! You can load it to skip setup next time."),Vr(!1),Hr(0),ir([]);else throw new Error((l==null?void 0:l.error)||"Save failed")}catch(l){console.error(l),y.error((l==null?void 0:l.message)||"Couldn't save scene.")}finally{Me(!1)}},ri=async()=>{var s,l;if(!(we||ye||ve||je||he.some(Boolean)||le||ne||ce||de||se.some(Boolean))){y.error("Pick at least one garment to apply.");return}N(!0),H(!0),_("Applying outfit...");const a=[];try{try{const b=[we||le,ye||ne,ve||ce,je||de,...se,...he].filter(Boolean),h=Fi(G),k=await Hs(h,{count:1,beforeBalance:w==null?void 0:w.creditBalance,user:w,runId:p});typeof(k==null?void 0:k.creditBalance)=="number"&&ke(k.creditBalance),(k==null?void 0:k.debited)>0&&a.push({key:h,amount:k.debited})}catch(b){if((b==null?void 0:b.code)==="SERVER_OFFLINE")return;if((b==null?void 0:b.code)==="INSUFFICIENT_TOKENS"){y.error("You’ve used all your credits — upgrade your plan to continue.");return}if((b==null?void 0:b.code)==="ELITE_REQUIRED"||/elite/i.test((b==null?void 0:b.message)||"")){y.info("This feature is for Elite members. Upgrade to unlock it.",{autoClose:3500});return}for(const h of a){const k=await Lt(h.key,h.amount);(k==null?void 0:k.creditBalance)!=null&&ke(k.creditBalance)}throw b}const c={runId:p,modelImageUrl:te(B),backgroundImageUrl:te(B),aspectRatio:me,resolution:G};if(we){const b=await Q(we);c.garmentTop={data:b.base64,mimeType:we.type}}else le&&(c.garmentTop={url:te(le)});if(ye){const b=await Q(ye);c.garmentBottom={data:b.base64,mimeType:ye.type}}else ne&&(c.garmentBottom={url:te(ne)});if(ve){const b=await Q(ve);c.garmentShoes={data:b.base64,mimeType:ve.type}}else ce&&(c.garmentShoes={url:te(ce)});if(je){const b=await Q(je);c.garmentHat={data:b.base64,mimeType:je.type}}else de&&(c.garmentHat={url:te(de)});const u=[];for(let b=0;b<3;b++)if(he[b]){const h=await Q(he[b]);u.push({data:h.base64,mimeType:he[b].type})}else se[b]&&u.push({url:te(se[b])});u.length&&(c.garmentAccessory=u);const g=await re(`${U}/api/model-try-on/composite`,c);if(g!=null&&g.ok&&((s=g==null?void 0:g.imageUrls)!=null&&s[0])){let b=g.imageUrls[0];const h=g.uploadedAssets||{};h.garmentTopUrl&&(Mt(h.garmentTopUrl),it(h.garmentTopUrl)),h.garmentBottomUrl&&(Dt(h.garmentBottomUrl),ot(h.garmentBottomUrl)),h.garmentShoesUrl&&(zt(h.garmentShoesUrl),lt(h.garmentShoesUrl)),h.garmentHatUrl&&(_t(h.garmentHatUrl),nt(h.garmentHatUrl)),Array.isArray(h.garmentAccessoryUrls)&&h.garmentAccessoryUrls.length&&(Wt(R=>{const E=[...R];
483return h.garmentAccessoryUrls.forEach((fe,Y)=>{fe&&Y<3&&(E[Y]=fe)}),E}),ct(R=>{const E=[...R];return h.garmentAccessoryUrls.forEach((fe,Y)=>{fe&&Y<3&&(E[Y]=fe)}),E}));const k=[Ht,Gt,Kt,qt,...Array.isArray(_e)?_e.slice(0,3):[]].filter(Boolean),i=[dt,ut,mt,ht,...Array.isArray(Be)?Be.slice(0,3):[]].map(R=>String(R||"").trim()).filter(Boolean),x=[gs||Ys,bs||qs,xs||Js,ws||Qs,...(ys||[]).slice(0,3),...(Xs||[]).slice(0,3)].filter(Boolean),T=k.length>0||i.length>0||x.length>0;let C={};if(T){_("Applying fit preferences...");const R={runId:p,outfitImageUrl:b,aspectRatio:me,resolution:G,fitStyles:{top:Ht||"",bottom:Gt||"",shoes:Kt||"",hat:qt||"",accessories:Array.isArray(_e)?_e.slice(0,3).map(j=>j||""):["","",""]},fitInstructions:{top:String(dt||"").slice(0,200),bottom:String(ut||"").slice(0,200),shoes:String(mt||"").slice(0,200),hat:String(ht||"").slice(0,200),accessories:Array.isArray(Be)?Be.slice(0,3).map(j=>String(j||"").slice(0,200)):["","",""]}};if(gs){const j=await Q(gs);R.fitRefTop={data:j.base64,mimeType:gs.type}}else Ys&&(R.fitRefTopUrl=te(Ys));if(bs){const j=await Q(bs);R.fitRefBottom={data:j.base64,mimeType:bs.type}}else qs&&(R.fitRefBottomUrl=te(qs));if(xs){const j=await Q(xs);R.fitRefShoes={data:j.base64,mimeType:xs.type}}else Js&&(R.fitRefShoesUrl=te(Js));if(ws){const j=await Q(ws);R.fitRefHat={data:j.base64,mimeType:ws.type}}else Qs&&(R.fitRefHatUrl=te(Qs));const E=[],fe=[];for(let j=0;j<3;j++)if(ys[j]){const Ut=await Q(ys[j]);E.push({data:Ut.base64,mimeType:ys[j].type})}else Xs[j]&&fe.push(te(Xs[j]));E.length?R.fitRefAccessory=E:fe.length&&(R.fitRefAccessoryUrls=fe);const Y=await re(`${U}/api/model-try-on/apply-fit`,R);if(Y!=null&&Y.ok&&((l=Y==null?void 0:Y.imageUrls)!=null&&l[0])){b=Y.imageUrls[0];const j=Y.uploadedFitRefs||{};C=j,j.fitRefTopUrl&&(pt(j.fitRefTopUrl),kt(j.fitRefTopUrl),ft(null)),j.fitRefBottomUrl&&(bt(j.fitRefBottomUrl),St(j.fitRefBottomUrl),gt(null)),j.fitRefShoesUrl&&(wt(j.fitRefShoesUrl),Ct(j.fitRefShoesUrl),xt(null)),j.fitRefHatUrl&&(vt(j.fitRefHatUrl),At(j.fitRefHatUrl),yt(null)),Array.isArray(j.fitRefAccessoryUrls)&&j.fitRefAccessoryUrls.length&&(Nt(Ut=>{const Ge=[...Ut];return j.fitRefAccessoryUrls.forEach((Ca,qa)=>{Ca&&(Ge[qa]=Ca)}),Ge}),Rt(Ut=>{const Ge=[...Ut];return j.fitRefAccessoryUrls.forEach((Ca,qa)=>{Ca&&(Ge[qa]=Ca)}),Ge}),jt(Ut=>{const Ge=[...Ut];return j.fitRefAccessoryUrls.forEach((Ca,qa)=>{Ge[qa]=null}),Ge}))}else console.warn("Fit edit pass failed, using garment-only result.",Y==null?void 0:Y.error),y.warn("Couldn't apply fit preferences. Showing the outfit without fit adjustments.",{autoClose:6e3})}vs(b),pa({original:b,side:null,back:null,posed:null}),ga("original"),He([{url:b,label:"Original",type:"original"}]),Oe(0),Ga(""),fs(G),d(3),y.success("Outfit applied!"),Se({stage:3,renderedResolution:G,finalUrl:b,views:{original:b,side:null,back:null,posed:null},resultHistory:[{url:b,label:"Original",type:"original"}],selectedResultIdx:0,garmentTopPreview:h.garmentTopUrl||Te,garmentBottomPreview:h.garmentBottomUrl||Ee,garmentShoesPreview:h.garmentShoesUrl||Ue,garmentHatPreview:h.garmentHatUrl||Le,accessoryPreviews:Array.isArray(h.garmentAccessoryUrls)&&h.garmentAccessoryUrls.length?h.garmentAccessoryUrls.slice(0,3).map((R,E)=>R||Ne[E]||""):Ne,fitRefTopPreview:C.fitRefTopUrl||_a,fitRefBottomPreview:C.fitRefBottomUrl||Wa,fitRefShoesPreview:C.fitRefShoesUrl||Ha,fitRefHatPreview:C.fitRefHatUrl||$a,fitRefAccessoryPreviews:Array.isArray(C.fitRefAccessoryUrls)&&C.fitRefAccessoryUrls.length?C.fitRefAccessoryUrls.slice(0,3).map((R,E)=>R||ha[E]||""):ha}),window.scrollTo({top:0,behavior:"smooth"})}else throw new Error((g==null?void 0:g.error)||"Composite failed")}catch(c){if(console.error(c),(c==null?void 0:c.code)!=="SERVER_OFFLINE"&&(a==null?void 0:a.length)>0)for(const u of a){const g=await Lt(u.key,u.amount);(g==null?void 0:g.creditBalance)!=null&&ke(g.creditBalance)}y.error(e.jsx(Rl,{}),{autoClose:1e4})}finally{N(!1),H(!1),_("Applying outfit...")}},hr=async(t,a={})=>{var c;if(fa)return;Zs(!0),ba(!1),Mr(t==="side"?"Changing to Side Profile View…":"Changing to Back View…");let l=null;try{try{const i=await Hs(ie.TRYON_ROTATE_VIEW,{count:1,beforeBalance:w==null?void 0:w.creditBalance,user:w,runId:p});typeof(i==null?void 0:i.creditBalance)=="number"&&ke(i.creditBalance),(i==null?void 0:i.debited)>0&&(l={key:ie.TRYON_ROTATE_VIEW,amount:i.debited})}catch(i){if((i==null?void 0:i.code)==="SERVER_OFFLINE")return;if((i==null?void 0:i.code)==="INSUFFICIENT_TOKENS"){y.error("You’ve used all your credits — upgrade your plan to continue.");return}if((i==null?void 0:i.code)==="ELITE_REQUIRED"||/elite/i.test((i==null?void 0:i.message)||"")){y.info("This feature is for Elite members. Upgrade to unlock it.",{autoClose:3500});return}throw i}const u=`${U}/api/model-try-on/rotate-view`,g=A[I],b=te((g==null?void 0:g.url)||(V==null?void 0:V.original)||ee),h={runId:p,imageUrl:b,view:t==="side"?"left"
483:t,aspectRatio:me,resolution:rt};if((t==="back"||t==="side")&&a&&typeof a=="object"){const i={};for(const[x,T]of Object.entries(a)){if(!T)continue;const C=await Q(T);i[x]={data:C.base64,mimeType:T.type}}Object.keys(i).length>0&&(h.garmentRefs=i)}const k=await re(u,h);if(k!=null&&k.ok&&((c=k==null?void 0:k.imageUrls)!=null&&c[0])){const i=k.imageUrls[0],x={...V,[t]:i};pa(x),ga(t);const T=t==="side"?"Side":"Back",C=A.filter(Y=>Y.type===t).length,R=C>0?`${T} ${C+1}`:T,E=[...A,{url:i,label:R,type:t}],fe=E.length-1;He(E),Oe(fe),Se({views:x,currentView:t,resultHistory:E,selectedResultIdx:fe})}else throw new Error("Rotation failed")}catch(u){if(console.error(u),(u==null?void 0:u.code)!=="SERVER_OFFLINE"&&l){const g=await Lt(l.key,l.amount);(g==null?void 0:g.creditBalance)!=null&&ke(g.creditBalance)}y.error("Couldn’t generate that angle. Please try again.")}finally{Zs(!1),Mr("")}},ii=async t=>{if(t)try{const a=await Ye(t),s=await qe(a);ks(s);const{dataUrl:l}=await Q(s);Ss(l)}catch(a){Je(a)}},fr=async(t={})=>{var s;if(Pt)return;if(!Ns&&!wa){y.error("Please upload a pose reference image first.");return}er(!0),ba(!1);let a=null;try{try{const h=await Hs(ie.TRYON_APPLY_POSE,{count:1,beforeBalance:w==null?void 0:w.creditBalance,user:w,runId:p});typeof(h==null?void 0:h.creditBalance)=="number"&&ke(h.creditBalance),(h==null?void 0:h.debited)>0&&(a={key:ie.TRYON_APPLY_POSE,amount:h.debited})}catch(h){if((h==null?void 0:h.code)==="SERVER_OFFLINE")return;if((h==null?void 0:h.code)==="INSUFFICIENT_TOKENS"){y.error("You've used all your credits — upgrade your plan to continue.");return}if((h==null?void 0:h.code)==="ELITE_REQUIRED"||/elite/i.test((h==null?void 0:h.message)||"")){y.info("This feature is for Elite members. Upgrade to unlock it.",{autoClose:3500});return}throw h}const l=`${U}/api/model-try-on/apply-pose`,c=A[I],u=te((c==null?void 0:c.url)||(V==null?void 0:V.original)||ee);let g={runId:p,imageUrl:u,aspectRatio:me,poseView:zr,resolution:rt};if(Ns){const h=await Q(Ns);g.poseReference={data:h.base64,mimeType:Ns.type}}else wa&&(g.poseReferenceUrl=wa);if(zr!=="front"&&t&&typeof t=="object"){const h={};for(const[k,i]of Object.entries(t)){if(!i)continue;const x=await Q(i);h[k]={data:x.base64,mimeType:i.type}}Object.keys(h).length>0&&(g.garmentRefs=h)}const b=await re(l,g);if(b!=null&&b.ok&&((s=b==null?void 0:b.imageUrls)!=null&&s.length))ar(b.imageUrls);else throw new Error("Pose application failed")}catch(l){if(console.error(l),(l==null?void 0:l.code)!=="SERVER_OFFLINE"&&a){const c=await Lt(a.key,a.amount);(c==null?void 0:c.creditBalance)!=null&&ke(c.creditBalance)}y.error("Couldn't apply the pose. Please try again.")}finally{er(!1)}},Oo=o.useCallback(t=>{var b;const s=`posed-${((b=V.posed)==null?void 0:b.length)||0}`,l={...V,posed:[...V.posed||[],t]},c=A.filter(h=>h.type==="pose").length+1,u=[...A,{url:t,label:`Pose ${c}`,type:"pose"}],g=u.length-1;pa(l),ga(s),He(u),Oe(g),ks(null),Ss(null),ar(null),y.success("Pose applied successfully!"),Se({views:l,currentView:s,resultHistory:u,selectedResultIdx:g})},[V,A,Se]),Io=()=>{var a;((a=A[I])!=null&&a.url||ya()||ee)&&Tr(!0)},Mo=async()=>{const t=A.length>0?A:[];if(t.length===0){y.info("No images to export.",{autoClose:3e3});return}Gs(!0);try{const a=new pl;for(let u=0;u<t.length;u++){const g=t[u],b=g.url;if(!b)continue;let h;try{const i=await fetch(b,{mode:"cors"});if(!i.ok)throw new Error("Fetch failed");const x=await i.blob();(i.headers.get("content-type")||x.type||"").split(";")[0].trim()==="image/jpeg"&&(h=x)}catch{h=null}if(!h){const i=await new Promise((C,R)=>{const E=new Image;E.crossOrigin="anonymous",E.onload=()=>C(E),E.onerror=R,E.src=b}),x=document.createElement("canvas");x.width=i.naturalWidth,x.height=i.naturalHeight;const T=x.getContext("2d");T.imageSmoothingEnabled=!0,T.imageSmoothingQuality="high",T.drawImage(i,0,0),h=await new Promise((C,R)=>x.toBlob(E=>E?C(E):R(new Error("Canvas export failed")),"image/jpeg",1))}const k=(g.label||`image-${u+1}`).replace(/[\\/:*?"<>|]/g,"").replace(/\s+/g,"-");a.file(`${k}.jpg`,h)}const s=await a.generateAsync({type:"blob"}),l=URL.createObjectURL(s),c=document.createElement("a");c.href=l,c.download="Try-On-Export.zip",document.body.appendChild(c),c.click(),c.remove(),setTimeout(()=>URL.revokeObjectURL(l),2e3),y.success(`Exported ${t.length} image${t.length>
4831?"s":""} as ZIP.`,{autoClose:3e3})}catch(a){console.error("Export all error:",a),y.error("Failed to export images. Please try again.",{autoClose:4e3})}finally{Gs(!1)}},Do=($||W)&&(at||tt),pr=P.trim()&&be.trim(),Ya=Number((w==null?void 0:w.creditBalance)??0),oi=(pi=Aa)==null?void 0:pi[jr(K)],li=(gi=Aa)==null?void 0:gi[jr(Ba)],Tt=(bi=Aa)==null?void 0:bi[ie.TRYON_SCENE_REGENERATE],zs=(xi=Aa)==null?void 0:xi[ie.TRYON_ROTATE_VIEW],_s=(wi=Aa)==null?void 0:wi[ie.TRYON_APPLY_POSE],ni=oi,gr=Ya>=ni,ka=Tt>0?Ya>=Tt:!0,zo=zs>0?Ya>=zs:!0,_o=_s>0?Ya>=_s:!0,ci=o.useCallback(async()=>{if(window.scrollTo({top:0,behavior:"smooth"}),!!gr){if(!pr){await mr();return}await ei()}},[gr,pr,mr,ei]),Wo=o.useCallback(async()=>{await ci()},[ci]),Et=o.useCallback(t=>{switch(t){case"setup":xe(!0),d(1);break;case"scene-ready":xe(!1),d(1);break;case"outfit":d(2);break;case"result":d(3);break}},[]),br=[{src:"/hero_images/tryon-1.webp",label:"Try-On"},{src:"/hero_images/tryon-2.webp",label:"Try-On"},{src:"/hero_images/tryon-3.webp",label:"Try-On"},{src:"/hero_images/tryon-4.webp",label:"Try-On"},{src:"/hero_images/tryon-5.webp",label:"Try-On"},{src:"/hero_images/tryon-6.webp",label:"Try-On"},{src:"/hero_images/tryon-7.webp",label:"Try-On"},{src:"/hero_images/tryon-8.webp",label:"Try-On"},{src:"/hero_images/tryon-9.webp",label:"Try-On"}],xr=128,Ho=br.length,di=xr*Ho;function $o(){return e.jsxs("div",{className:"block lg:hidden mt-6 -mx-4 sm:mx-0",children:[e.jsx("div",{className:"relative overflow-hidden",style:{maskImage:"linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%)",WebkitMaskImage:"linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%)"},children:e.jsxs("div",{className:"mobile-slide-track flex py-2",style:{width:`${di*2}px`},children:[br.map((t,a)=>e.jsx("div",{className:"slide flex-shrink-0",style:{width:`${xr}px`,paddingRight:"8px"},children:e.jsx("div",{className:"relative w-[120px] h-[180px] rounded-[13px] overflow-hidden ring-1 ring-white/10 shadow-md bg-white/5",children:e.jsx("img",{src:t.src,alt:t.label,loading:"lazy",decoding:"async",className:"w-full h-full object-cover"})})},`slide-0-${a}`)),br.map((t,a)=>e.jsx("div",{className:"slide flex-shrink-0",style:{width:`${xr}px`,paddingRight:"8px"},children:e.jsx("div",{className:"relative w-[120px] h-[180px] rounded-[13px] overflow-hidden ring-1 ring-white/10 shadow-md bg-white/5",children:e.jsx("img",{src:t.src,alt:t.label,loading:"lazy",decoding:"async",className:"w-full h-full object-cover"})})},`slide-1-${a}`))]})}),e.jsx("style",{children:`
484        .mobile-slide-track {
485          animation: mobileScroll 28s linear infinite;
486        }
487        @keyframes mobileScroll {
488          0% { transform: translateX(0); }
489          100% { transform: translateX(-${di}px); }
490        }
491      `})]})}o.useMemo(()=>[we||le,ye||ne,ve||ce,je||de,...se,...he].filter(Boolean).length,[we,le,ye,ne,ve,ce,je,de,se,he]);const Sa=o.useMemo(()=>{var t;return((t=Aa)==null?void 0:t[Fi(G)])||0},[G]),ui=Sa>0?Ya>=Sa:!0,mi=Nr(G),hi=Nr(K),Go=Nr(Ba),fi=Al(rt),Vo=o.useMemo(()=>{const t=[];(we||le)&&t.push("top"),(ye||ne)&&t.push("bottom"),(ve||ce)&&t.push("shoes"),(je||de)&&t.push("hat");for(let a=0;a<3;a++)(he[a]||se[a])&&t.push(`accessory${a+1}`);return t},[we,le,ye,ne,ve,ce,je,de,he,se]),Ko=o.useCallback(t=>{const a=cs;La(null),a==="back"?hr("back",t):a==="side"?hr("side",t):a==="pose"&&fr(t)},[cs,hr,fr]);return e.jsxs("div",{className:"min-h-screen text-white p-4 sm:p-8 font-sans relative",children:[e.jsxs("div",{className:"absolute inset-0 pointer-events-none overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-900"}),e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(900px_circle_at_15%_10%,rgba(160,200,230,0.20),transparent_55%),radial-gradient(900px_circle_at_85%_20%,rgba(180,200,220,0.14),transparent_55%),radial-gradient(1000px_circle_at_50%_90%,rgba(160,190,210,0.10),transparent_60%)]"}),e.jsx("div",{className:"absolute inset-0 opacity-[0.10] [background-image:linear-gradient(to_right,rgba(255,255,255,0.12)_1px,transparent_1px),linear-gradient(to_bottom,rgba(255,255,255,0.12)_1px,transparent_1px)] [background-size:88px_88px]"})]}),e.jsx("style",{children:`
492        @keyframes tryonScrollUp {
493          0% { transform: translateY(0); }
494          100% { transform: translateY(-50%); }
495        }
496        @keyframes tryonScrollDown {
497          0% { transform: translateY(-50%); }
498          100% { transform: translateY(0); }
499        }
500      `}),e.jsx(hl,{children:e.jsxs("div",{className:"pt-20 max-w-6xl mx-auto",children:[$i&&B&&Ra.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",role:"dialog","aria-modal":"true",onClick:()=>Ot(!1),style:{animation:"fadeIn 140ms ease-out"},children:[e.jsxs("div",{className:"relative flex items-center justify-center max-w-[90vw] max-h-[90vh] bg-[#16181A] rounded-xl shadow-2xl border border-[#27272A] p-4",onClick:t=>t.stopPropagation(),style:{animation:"scaleIn 180ms cubic-bezier(.25,.8,.25,1)"},children:[e.jsxs("button",{type:"button",onClick:()=>Ot(!1),className:"absolute top-2 left-2 inline-flex items-center gap-2 px-3 h-9 rounded-md bg-[#252525] hover:bg-[#2f2f2f] text-gray-100 border border-white/10 focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer z-10","aria-label":"Close zoom preview",title:"Close",children:[e.jsx(Ie,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Close"})]}),e.jsx("img",{src:Ce(B),alt:"Model enlarged",className:"max-w-full max-h-[85vh] object-contain rounded-lg"})]}),e.jsx("style",{children:`
501                @keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
502                @keyframes scaleIn { from { transform: scale(.92); opacity:0 } to { transform: scale(1); opacity:1 } }
503              `})]}),document.body),ao&&(((yi=A[I])==null?void 0:yi.url)||ya()||ee)&&Ra.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",role:"dialog","aria-modal":"true",onClick:()=>ba(!1),style:{animation:"fadeIn 140ms ease-out"},children:[e.jsxs("div",{className:"relative flex items-center justify-center max-w-[90vw] max-h-[90vh] bg-[#16181A] rounded-xl shadow-2xl border border-[#27272A] p-4",onClick:t=>t.stopPropagation(),style:{animation:"scaleIn 180ms cubic-bezier(.25,.8,.25,1)"},children:[e.jsxs("button",{type:"button",onClick:()=>ba(!1),className:"absolute top-2 left-2 inline-flex items-center gap-2 px-3 h-9 rounded-md bg-[#252525] hover:bg-[#2f2f2f] text-gray-100 border border-white/10 focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer z-10","aria-label":"Close zoom preview",title:"Close",children:[e.jsx(Ie,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Close"})]}),e.jsx("img",{src:Ce(((vi=A[I])==null?void 0:vi.url)||ya()||ee),alt:((ji=A[I])==null?void 0:ji.label)||`${We} view enlarged`,className:"max-w-full max-h-[85vh] object-contain rounded-lg"})]}),e.jsx("style",{children:`
504                @keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
505                @keyframes scaleIn { from { transform: scale(.92); opacity:0 } to { transform: scale(1); opacity:1 } }
506              `})]}),document.body),Ur&&e.jsx(Ri,{url:Ur,defaultFilename:"saved-model",onClose:()=>{us(null)},enableAiEdit:!0,enableBackdrop:!1,enableExportRemoveBg:!1,onEdited:t=>{us(t)}}),e.jsxs("div",{className:"pb-12",children:[f===1&&e.jsxs("div",{className:"relative",children:[!Fr&&B&&!ze&&e.jsx("div",{className:"flex flex-col sm:flex-row gap-4",children:e.jsx("div",{className:"w-full",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("button",{type:"button",disabled:F||m,onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),Et("setup")},className:"inline-flex items-center gap-1 text-sm sm:text-md font-medium text-gray-200 hover:text-white transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(Ws,{className:"w-3.5 h-3.5"}),"Back To Setup"]}),e.jsxs("button",{type:"button",disabled:F||m,onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),d(2)},className:"inline-flex items-center gap-1 text-sm sm:text-md font-medium text-gray-200 hover:text-white transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:["Apply Outfit",e.jsx(Ja,{className:"w-3.5 h-3.5"})]})]}),e.jsxs("div",{className:"grid lg:grid-cols-12 gap-6 items-start",children:[e.jsxs("div",{className:"lg:col-span-6 bg-[#0f1115] rounded-2xl border border-gray-800 p-5 flex flex-col min-w-0",children:[e.jsx("div",{children:e.jsx("h2",{className:"text-xl font-semibold text-white mb-3",children:"Your scene and model are ready!"})}),e.jsxs("div",{className:"relative rounded-xl overflow-hidden border border-white/10 flex-1 flex items-center justify-center",children:[e.jsx("img",{src:Ce(B),alt:"Combined model",className:"w-full max-h-[350px] object-contain"}),n&&pe==="regenerate"&&e.jsx(Ds,{title:"Regenerating scene..."}),e.jsx("button",{type:"button",onClick:()=>Ot(!0),disabled:n,className:"absolute top-3 right-3 z-[0] p-2 bg-black/50 hover:bg-black/70 backdrop-blur-sm rounded-full text-gray-300 hover:text-white transition-all border border-white/10",title:"View enlarged","aria-label":"View enlarged",children:e.jsx(as,{className:"w-4 h-4"})}),!n&&e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 z-[1] pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 backdrop-blur-[6px]",style:{maskImage:"linear-gradient(to bottom, transparent 0%, black 50%)",WebkitMaskImage:"linear-gradient(to bottom, transparent 0%, black 50%)"}}),e.jsxs("div",{className:"relative bg-gradient-to-t from-black/70 via-black/40 to-transparent px-3.5 pt-8 pb-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-400 animate-pulse flex-shrink-0"}),e.jsxs("span",{className:"text-amber-300 drop-shadow-sm font-bold",children:["This is not the final outfit"," ",e.jsx("span",{className:"font-normal text-amber-200/90",children:"— you'll apply your outfit next"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-400 animate-pulse flex-shrink-0"}),e.jsxs("span",{className:"text-amber-300 drop-shadow-sm font-bold",children:["This is a preview image"," ",e.jsx("span",{className:"font-normal text-amber-200/90",children:"— you can export up to 4K after"})]})]})]})]})]}),Ta.length>1&&e.jsx("div",{className:"mt-3",children:e.jsx("div",{ref:Hi,className:"flex gap-2 overflow-x-auto pb-1 scrollbar-thin scrollbar-thumb-gray-700 scrollbar-track-transparent",children:Ta.map((t,a)=>e.jsxs("button",{onClick:()=>{n||(Bt(a),De(t),X(null))},disabled:n,className:`group relative w-[60px] sm:w-[70px] rounded-md overflow-hidden border-2 transition-all flex-shrink-0 ${Ua===a?"border-blue-500 ring-2 ring-blue-500/50":"border-gray-700 hover:border-gray-600"} disabled:opacity-50`,title:a===0?"Original":`Edit ${a}`,children:[e.jsx("div",{className:"aspect-[3/4] bg-black/20",children:e.jsx("img",{src:Ce(t),alt:a===0?"Original":`Edit ${a}`,className:"w-full h-full object-cover",draggable:!1})}),e.jsx("div",{className:`absolute bottom-0 left-0 right-0 px-1 py-0.5 text-[9px] font-medium text-center ${Ua===a?"bg-blue-600":"bg-black/80 group-hover:bg-black/90"}`,children:a===0?"Original":`Edit ${a}`})]},`scene-v-${a}`))})}),!ze&&e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-white",children:"Save this scene and model?"}),e.jsxs("p",{className:"text-[12px] text-gray-500",children:["Skip setup & save"," ",li," tokens next time"]})]}),e.jsxs("button",{type:"button",onClick:()=>
506si(B,"Saved Scene"),disabled:n||Ae||ue,className:`flex items-center gap-2 px-4 py-2.5 rounded-full border transition-all ${ue?"bg-green-900/20 border-green-700/50":"bg-blue-600 hover:bg-blue-500 border-blue-500"} disabled:opacity-50 disabled:cursor-not-allowed`,title:ue?"Scene already saved":"Save scene to load later",children:[ue?e.jsx($s,{className:"w-4 h-4 text-green-400"}):e.jsx(wr,{className:"w-4 h-4 text-white"}),e.jsx("span",{className:"text-sm font-medium text-white",children:Ae?"Saving...":ue?"Saved!":"Save Scene And Model"})]})]})})]}),e.jsx("div",{className:"lg:col-span-6 bg-[#0f1115] rounded-2xl border border-gray-800 p-6 flex flex-col",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-medium text-gray-300",children:"Would you like to change anything?"})}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{value:Ft,onChange:t=>{ka&&ai(String(t.target.value||"").slice(0,Ms))},rows:2,disabled:!ka||n,maxLength:Ms,placeholder:"e.g., shorten the hair, zoom in on the face, change expression, make the background more neon and futuristic...",className:"w-full rounded-xl bg-[#1a1a1d] border border-white/10 p-3 pr-20 pb-7 text-sm text-white placeholder-gray-500 disabled:opacity-50 resize-none"}),e.jsxs("span",{className:`absolute bottom-3 right-3 text-[11px] ${Po?"text-amber-300":"text-gray-500"}`,children:[Ft.length,"/",Ms]})]}),ka?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"block sm:hidden",children:(w==null?void 0:w.role)!=="admin"&&e.jsx(Ke,{cost:Tt})}),e.jsxs("button",{type:"button",onClick:async()=>{n||!Ft.trim()||(oe("regenerate"),st(!1),Fa(null),X(null),await Fo())},disabled:n||!pr||!Ft.trim(),className:"w-full inline-flex items-center justify-center gap-2 px-4 py-3 bg-blue-600 hover:bg-blue-500 rounded-full text-sm font-medium transition-all disabled:opacity-50 disabled:cursor-not-allowed",title:Ft.trim()?"Regenerate model with your notes":"Enter notes to enable regeneration",children:[e.jsx(el,{className:"w-4 h-4"}),"Regenerate",e.jsx("span",{className:"hidden sm:block",children:(w==null?void 0:w.role)!=="admin"&&e.jsx(Ke,{cost:Tt})})]}),e.jsxs("div",{className:"text-[11px] text-gray-500",children:["Estimated wait:"," ",Go," (depending on network & complexity of items)"]})]}):e.jsx(Ve,{label:`Need ${Tt} To Access Regenerate`,modalTab:"tokens",size:"md",fullWidth:!0})]}),e.jsx("div",{className:"border-t border-gray-800"}),e.jsx("button",{onClick:()=>d(2),disabled:n,className:"w-full inline-flex items-center justify-center gap-2 px-4 py-4 bg-blue-600 hover:bg-blue-500 rounded-full text-sm font-semibold transition-all disabled:opacity-50",children:"Continue to Outfit →"})]})})]})]})})}),Fr&&e.jsxs("div",{className:`grid ${n?"":"lg:grid-cols-[minmax(450px,580px)_1fr]"} gap-8`,children:[e.jsxs("div",{className:"w-full max-w-full",children:[!n&&e.jsxs("header",{className:"mb-5 sm:mb-0",children:[e.jsxs("h1",{className:"text-3xl sm:text-4xl md:text-5xl font-bold leading-tight tracking-tight mb-4",children:[e.jsx("span",{className:"text-white",children:"Model"})," ",e.jsx("span",{className:"bg-gradient-to-r from-blue-500 to-indigo-500 bg-clip-text text-transparent",children:"Try-On"})]}),e.jsx("p",{className:"text-gray-400 text-lg max-w-2xl mb-5",children:ae==="saved"?"Select a saved model to skip setup and go straight to outfits.":"Create ultra realistic models built for e-commerce."}),ae==="new"&&e.jsxs("ul",{className:"text-sm sm:text-base max-w-lg text-gray-400 space-y-2 mb-5",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("svg",{className:"w-5 h-5 text-blue-500 flex-shrink-0 mt-0.5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),e.jsx("span",{children:"DSLR RAW quality exports with true studio realism"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("svg",{className:"w-5 h-5 text-blue-500 flex-shrink-0 mt-0.5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),e.jsx("span",{children:"Exact fit control: baggy, tailored, relaxed, or tight"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("svg",{className:"w-5 h-5 text-blue-500 flex-shrink-0 mt-0.5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),e.jsx("span",{children:"Locked models, lighting, and backgrounds for brand consistency"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("svg",{className:"w-5 h-5 text-blue-500 flex-shrink-0 mt-0.5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),e.jsx("span",{children:"Custom poses and angles from your own references"})]})]}),ae==="new"&&e.jsxs("button",{type:"button",onClick:()=>Ks(!0),className:"inline-flex items-center gap-2.5 w-[200px] pl-3 py-1 bg-white/[0.04] hover:bg-white/[0.08] border border-white/[0.10] hover:border-white/20 rounded-full transition-all cursor-pointer group",children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center",children:e.jsx(tl,{className:"w-3.5 h-3.5 text-white ml-0.5 fill-current"})}),e.jsx("span",{className:"text-sm font-medium text-gray-300 group-hover:text-white transition-colors",children:"Watch Tutorial"})]})]}),ae==="saved"&&!n&&e.jsxs("div",{className:`w-full ${Os.length===0?"flex flex-col items-start":""}`,children:[e.jsx("div",{className:"mb-4",children:e.jsxs("button",{type:"button",onClick:()=>Qe("new"),className:"inline-flex items-center gap-1.5 text-sm text-blue-400 hover:text-blue-300 transition-colors cursor-pointer group",children:[e.jsx(Ws,{className:"w-3.5 h-3.5 group-hover:-translate-x-0.5 transition-transform"}),"Create New Model"]})}),Os.length>0?e.jsxs("div",{className:"max-h-[600px] overflow-y-auto pr-1 w-full",children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6",children:Os.map(t=>e.jsxs("div",{className:"group relative rounded-2xl border border-[#252629] bg-[#16181A] p-4 flex flex-col shadow-lg",children:[e.jsxs("div",{className:`${Er===t._id?"pointer-events-none select-none blur-[3px] opacity-40":""} transition`,children:[e.jsx("div",{className:"w-full h-[225px] sm:h-64 roun
506ded-xl overflow-hidden flex items-center justify-center mb-3 bg-[#111111] border border-[#252629] cursor-pointer",onClick:()=>{if(n)return;const a=t.imageUrl||t.url;us(a)},children:e.jsx("img",{src:Ce(t.imageUrl||t.url),alt:t.label||"Model",className:"w-full h-full object-contain",loading:"lazy"})}),e.jsxs("div",{className:"flex flex-col gap-1.5 mt-auto",children:[e.jsxs("div",{className:"flex gap-1.5",children:[e.jsxs("button",{type:"button",onClick:()=>{if(n)return;const a=t.imageUrl||t.url;us(a)},disabled:n,className:`flex-1 h-9 rounded-full text-white text-xs font-semibold flex items-center justify-center gap-1.5 transition-colors ${n?"bg-gray-800 text-gray-400 cursor-not-allowed":"bg-[#2E7D32] hover:bg-[#338A3E] active:bg-[#1B5E20] cursor-pointer"}`,children:[e.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})}),e.jsx("span",{className:"hidden sm:inline",children:"Edit / Export"}),e.jsx("span",{className:"sm:hidden",children:"Export"})]}),e.jsx("button",{type:"button",onClick:a=>{a.stopPropagation(),!n&&Vs(t._id)},disabled:n,className:`w-9 h-9 rounded-full text-white flex items-center justify-center transition-colors flex-shrink-0 ${n?"bg-gray-800 text-gray-400 cursor-not-allowed":"bg-red-600/80 hover:bg-red-600 cursor-pointer"}`,title:"Delete model",children:e.jsx(al,{className:"w-3.5 h-3.5"})})]}),e.jsxs("button",{type:"button",onClick:()=>Lo(t),disabled:n,className:"w-full h-9 rounded-full bg-blue-600/90 hover:bg-blue-600 text-white text-xs font-semibold transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-1.5 cursor-pointer",children:[e.jsx(Ja,{className:"w-3.5 h-3.5"}),"Apply new outfit"]})]})]}),Er===t._id&&e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center p-2",children:e.jsxs("div",{className:"w-full rounded-xl p-3 text-center",children:[e.jsx("p",{className:"text-[13px] text-gray-100",children:"Are you sure you want to delete this?"}),e.jsxs("div",{className:"mt-2 flex flex-col gap-2",children:[e.jsx("button",{type:"button",onClick:a=>{a.stopPropagation(),Vs(null),Bo(t)},className:"w-full h-8 rounded-full bg-red-600/80 hover:bg-red-600 text-white text-[12px] font-medium transition-colors",children:"Confirm"}),e.jsx("button",{type:"button",onClick:a=>{a.stopPropagation(),Vs(null)},className:"w-full h-8 rounded-full bg-gray-700 hover:bg-gray-600 text-white text-[12px] font-medium transition-colors",children:"Cancel"})]})]})})]},t._id))}),or&&e.jsx("div",{ref:Kr,className:"h-8 w-full","aria-hidden":"true"}),Ka&&e.jsx("div",{className:"text-xs text-gray-500 text-center pt-2",children:"Loading more…"})]}):e.jsx("div",{className:"text-sm text-gray-400 mb-4",children:"No saved models yet"})]}),(ae==="new"||n)&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-1 items-start",children:[n&&e.jsx("div",{className:"flex flex-col gap-4 w-full sm:max-w-3xl sm:mx-auto animate-fade-in-up",children:e.jsx("div",{className:"relative flex flex-col sm:flex-row gap-3",children:(()=>{const t=J.toLowerCase(),a=t.includes("generating"),s=(t.includes("model")||t.includes("analyzing uploaded images"))&&!a,l=t.includes("background")&&!a,c=l||a,u=a;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`flex-1 relative rounded-xl overflow-hidden border border-gray-700 bg-[#0A0A0A]/60 transition-all duration-300 ${a?"blur-[2px]":""}`,children:[e.jsx("div",{className:"aspect-[4/5] sm:aspect-square w-full max-h-[280px] sm:max-h-[320px]",children:$?e.jsx("img",{src:$,alt:"Model",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(ss,{className:"w-10 h-10 text-gray-600"})})}),s&&e.jsxs("div",{className:"absolute inset-0 z-[60] flex items-center justify-center","aria-live":"polite","aria-busy":"true",children:[e.jsx("div",{className:"absolute inset-0 scan-dim"}),e.jsx("div",{className:"absolute inset-0 scan-lines"}),e.jsx("div",{className:"absolute inset-0 scan-lines-angled"}),e.jsx("div",{className:"absolute left-0 w-full scan-line-sweep"}),e.jsx("div",{className:"absolute inset-0 scan-grid-lines"}),e.jsx("div",{className:"scan-grid-reactive",children:e.jsx("div",{className:"scan-grid-reactive-band"})}),e.jsxs("div",{className:"relative flex flex-col items-center justify-center text-center px-4 z-[70]",children:[e.jsxs("div",{className:"relative mb-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-full border-4 border-blue-700/30 border-t-[#4169e1] animate-spin"}),e.jsx("div",{className:"absolute inset-0 rounded-full animate-ping bg-blue-500/20"})]}),e.jsx("p",{className:"text-xs font-medium text-indigo-50 scan-text-front",children:"Analyzing model..."})]})]}),c&&e.jsx("div",{className:"absolute inset-0 z-[60] flex items-center justify-center bg-black/40",children:e.jsx("div",{className:"w-12 h-12 rounded-full bg-green-500/20 border-2 border-green-500 flex items-center justify-center",children:e.jsx("svg",{className:"w-6 h-6 text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})})}),e.jsx("div",{className:"absolute bottom-2 left-2 right-2 z-[70]",children:e.jsxs("div",{className:"flex items-center gap-1.5 bg-black/70 backdrop-blur-sm rounded-lg px-2 py-1.5",children:[e.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",className:"h-3.5 w-3.5 text-blue-300 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"8",r:"3"}),e.jsx("path",{d:"M5 20c1.6-4 4.2-6 7-6s5.4 2 7 6"})]}),e.jsx("span",{className:"text-[11px] font-medium text-white",children:"Your Model"})]})})]}),e.jsxs("div",{className:`flex-1 relative rounded-xl overflow-hidden border border-gray-700 bg-[#0A0A0A]/60 transition-all duration-300 ${a?"blur-[2px]":""}`,children:[e.jsx("div",{className:"aspect-[4/5] sm:aspect-square w-full max-h-[280px] sm:max-h-[320px]",children:at?e.jsx("img",{src:at,alt:"Backgroun
506d",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(ss,{className:"w-10 h-10 text-gray-600"})})}),l&&e.jsxs("div",{className:"absolute inset-0 z-[60] flex items-center justify-center","aria-live":"polite","aria-busy":"true",children:[e.jsx("div",{className:"absolute inset-0 scan-dim"}),e.jsx("div",{className:"absolute inset-0 scan-lines"}),e.jsx("div",{className:"absolute inset-0 scan-lines-angled"}),e.jsx("div",{className:"absolute left-0 w-full scan-line-sweep"}),e.jsx("div",{className:"absolute inset-0 scan-grid-lines"}),e.jsx("div",{className:"scan-grid-reactive",children:e.jsx("div",{className:"scan-grid-reactive-band"})}),e.jsxs("div",{className:"relative flex flex-col items-center justify-center text-center px-4 z-[70]",children:[e.jsxs("div",{className:"relative mb-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-full border-4 border-blue-700/30 border-t-[#4169e1] animate-spin"}),e.jsx("div",{className:"absolute inset-0 rounded-full animate-ping bg-blue-500/20"})]}),e.jsx("p",{className:"text-xs font-medium text-indigo-50 scan-text-front",children:"Analyzing background..."})]})]}),u&&e.jsx("div",{className:"absolute inset-0 z-[60] flex items-center justify-center bg-black/40",children:e.jsx("div",{className:"w-12 h-12 rounded-full bg-green-500/20 border-2 border-green-500 flex items-center justify-center",children:e.jsx("svg",{className:"w-6 h-6 text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})})}),s&&e.jsx("div",{className:"absolute inset-0 z-[60] bg-black/50"}),e.jsx("div",{className:"absolute bottom-2 left-2 right-2 z-[70]",children:e.jsxs("div",{className:"flex items-center gap-1.5 bg-black/70 backdrop-blur-sm rounded-lg px-2 py-1.5",children:[e.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",className:"h-3.5 w-3.5 text-blue-300 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 7h16"}),e.jsx("path",{d:"M4 17h16"}),e.jsx("path",{d:"M7 4v16"}),e.jsx("path",{d:"M17 4v16"})]}),e.jsx("span",{className:"text-[11px] font-medium text-white",children:"Your background"})]})})]}),a&&e.jsx("div",{className:"absolute inset-0 z-[80] flex items-center justify-center pointer-events-none",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center px-6",children:[e.jsxs("div",{className:"relative mb-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-full border-4 border-blue-700/30 border-t-[#4169e1] animate-spin"}),e.jsx("div",{className:"absolute inset-0 rounded-full animate-ping bg-blue-500/20"})]}),e.jsx("p",{className:"text-lg font-semibold text-white drop-shadow-lg",children:J||"Generating scene and model…"}),e.jsxs("p",{className:"text-sm text-gray-300 drop-shadow-lg",children:["Estimated wait:"," ",hi," (depending on network & complexity of items)"]})]})})]})})()})}),!n&&e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("button",{type:"button",onClick:()=>Qe("saved"),className:"inline-flex justify-center sm:justify-end items-center gap-1.5 text-sm text-blue-400 hover:text-blue-300 transition-colors cursor-pointer group",children:["Your Saved Models",e.jsx(wr,{className:"w-3.5 h-3.5 group-hover:-translate-x-0.5 transition-transform"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"w-full",children:[e.jsx("div",{className:"flex items-center gap-1.5 mb-1.5",children:e.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-blue-400",children:"Step 1"})}),e.jsx(Ti,{label:"",internalLabel:"Model Photo",internalLabelIcon:e.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"8",r:"3"}),e.jsx("path",{d:"M5 20c1.6-4 4.2-6 7-6s5.4 2 7 6"})]}
506),preview:$,description:$?e.jsxs("button",{type:"button",disabled:n,onClick:t=>{t.preventDefault(),t.stopPropagation(),Z(null),Xe(null),D(""),ge!=null&&ge.current&&(ge.current.value="")},className:"px-2.5 py-1.5 bg-black/70 backdrop-blur-sm rounded-lg text-xs font-medium text-gray-300 hover:text-white hover:bg-black/80 transition-all disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-1.5",title:"Clear model",children:[e.jsx(Ie,{className:"w-3.5 h-3.5"}),"Clear"]}):null,onFileSelect:t=>{var a;return((a=t.target.files)==null?void 0:a[0])&&Qr(t.target.files[0])},loading:n,dragActive:Ze,onDragOver:t=>{t.preventDefault(),et(!0)},onDragLeave:t=>{t.preventDefault(),et(!1)},onDrop:t=>{var a;t.preventDefault(),et(!1),(a=t.dataTransfer.files)!=null&&a[0]&&Qr(t.dataTransfer.files[0])},inputRef:ge,overlay:!$&&!W?e.jsx("div",{className:"absolute right-3 top-3 flex items-center gap-2",children:e.jsx("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-amber-500/20 border border-amber-500/30 text-[11px] font-semibold text-amber-200",children:"Headshot Only"})}):null,processingActive:n&&(J.toLowerCase().includes("model")||J.toLowerCase().includes("analyzing uploaded images")),processingTitle:J.toLowerCase().includes("analyzing")?"Analyzing model…":J.toLowerCase().includes("generating model")?"Generating model…":J}),Us&&P&&e.jsx("div",{className:"mt-3",children:e.jsx(Ei,{value:P,onChange:D,loading:n,label:"Model Description (Admin only)"})})]}),e.jsxs("div",{className:"w-full",children:[e.jsx("div",{className:"flex items-center gap-1.5 mb-1.5",children:e.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-blue-400",children:"Step 2"})}),e.jsx(Ti,{bgPreview:at,bgInputRef:Pe,setBgPreview:Pa,setBackgroundPrompt:Re,bgFile:tt,setBgFile:is,label:"",internalLabel:"Background",internalLabelIcon:e.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 7h16"}),e.jsx("path",{d:"M4 17h16"}),e.jsx("path",{d:"M7 4v16"}),e.jsx("path",{d:"M17 4v16"})]}),preview:at,description:at?e.jsxs("button",{type:"button",disabled:n,onClick:t=>{t.preventDefault(),t.stopPropagation(),is(null),Pa(null),Re(""),Pe!=null&&Pe.current&&(Pe.current.value="")},className:"px-2.5 py-1.5 bg-black/70 backdrop-blur-sm rounded-lg text-xs font-medium text-gray-300 hover:text-white hover:bg-black/80 transition-all disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-1.5",title:"Clear background",children:[e.jsx(Ie,{className:"w-3.5 h-3.5"}),"Clear"]}):null,onFileSelect:t=>{var a;return((a=t.target.files)==null?void 0:a[0])&&Xr(t.target.files[0])},loading:n,dragActive:zi,onDragOver:t=>{t.preventDefault(),os(!0)},onDragLeave:t=>{t.preventDefault(),os(!1)},onDrop:t=>{var a;t.preventDefault(),os(!1),(a=t.dataTransfer.files)!=null&&a[0]&&Xr(t.dataTransfer.files[0])},inputRef:Pe,processingActive:n&&(J.toLowerCase().includes("background")||J.toLowerCase().includes("analyzing uploaded images")),processingTitle:J.toLowerCase().includes("analyzing")?"Analyzing background…":J.toLowerCase().includes("generating background")?"Generating background…":J,alternativeActionLabel:"Choose From Our Backgrounds",onAlternativeAction:()=>ls(!0)}),Us&&be&&e.jsx("div",{className:"mt-3",children:e.jsx(Ei,{value:be,onChange:Re,loading:n,label:"Background Description (Admin only)"})})]})]}),!n&&e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-xs font-medium text-gray-400 mb-1.5 pl-1",children:[e.jsx(fl,{className:"w-3.5 h-3.5"}),"Choose Resolution"]}),e.jsx(ts,{options:cr,selectedValue:K,onSelect:t=>nr(t,ms),autoOpenOnMount:!1,hideButtonWhenOpen:!1}),e.jsxs("p",{className:"sm:hidden text-[11px] font-semibold text-amber-300 leading-snug mt-1",children:[K==="1K"&&"Fastest load speed",K==="2K"&&"Semi-fast speed",K==="4K"&&"DSLR – Slow speed"]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-xs font-medium text-gray-400 mb-1.5 pl-1",children:[e.jsx(Zo,{className:"w-3.5 h-3.5"}),"Aspect Ratio"]}),e.jsx(ts,{options:gl,selectedValue:me,onSelect:t=>{ps(t),Ir(!1)},onClose:()=>
506Ir(!1),autoOpenOnMount:!1,hideButtonWhenOpen:!1,ignoreClickRefs:[Qi]})]}),e.jsxs("p",{className:"hidden sm:block sm:col-span-2 text-[11px] font-semibold text-amber-300 leading-snug",children:[K==="1K"&&"Fastest load speed",K==="2K"&&"Semi-fast speed",K==="4K"&&"DSLR – Slow speed"]})]}),e.jsxs("p",{className:"text-[11px] text-amber-300/90 font-medium leading-relaxed",children:["⚠ Generated models will differ from reference images. We create original, similar-looking models to ensure they are fully copyright-free and owned by you. Uploaded photos are used solely to generate your synthetic model and are not permanently stored or used for biometric identification. See our"," ",e.jsx(Ui,{to:"/privacy-policy",className:"underline",children:"Privacy Policy"})," ","for details."]}),B&&!n&&!F&&!m&&e.jsxs("button",{type:"button",onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),Et(B&&!ze?"scene-ready":"outfit")},className:"w-full inline-flex items-center justify-center gap-2 h-11 sm:h-12 px-6 rounded-full bg-white/5 hover:bg-white/10 border border-white/10 hover:border-white/20 text-blue-300 hover:text-blue-200 text-sm font-semibold transition-all cursor-pointer",children:[B&&!ze?"Back To Scene Ready":"Back To Outfit",e.jsx(Ja,{className:"w-4 h-4"})]}),!n&&e.jsx(e.Fragment,{children:Yr||Us?e.jsx(e.Fragment,{children:gr?e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:Wo,disabled:!Do||n,className:"group w-full inline-flex items-center justify-center gap-2 h-12 sm:h-14 px-6 sm:px-10 rounded-full bg-gradient-to-r from-[#3A78C6] to-[#326CB4] hover:from-[#4A86D2] hover:to-[#2E63A7] active:from-[#326CB4] active:to-[#285789] disabled:opacity-50 text-white text-sm sm:text-base font-extrabold tracking-tight transition-all shadow-[0_0_34px_rgba(50,108,180,0.45)] hover:shadow-[0_0_46px_rgba(50,108,180,0.65)] hover:-translate-y-0.5 active:translate-y-0",children:[e.jsx(Jo,{className:"w-5 h-5"}),"Generate Model",(w==null?void 0:w.role)!=="admin"&&e.jsx(Ke,{cost:oi})]}),e.jsxs("div",{className:"text-center text-[11px] text-gray-500",children:["Estimated wait: ",hi," ","(depending on network & complexity of items)"]})]}):e.jsx(Ve,{label:`Requires ${ni} Credits To Start`,modalTab:"tokens",size:"lg",variant:"primary",fullWidth:!0})}):e.jsx(Ve,{label:"Subscribe To Access Model Try-On",modalTab:"subscribe",size:"lg",variant:"primary",fullWidth:!0})}),!n&&e.jsx($o,{})]})]})]}),!n&&e.jsx("div",{className:"hidden lg:block",children:e.jsxs("div",{className:"relative h-[600px] overflow-hidden rounded-[28px] border border-white/10 bg-black/20 backdrop-blur-md",children:[e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-24 z-10 bg-gradient-to-b from-black/80 via-black/40 to-transparent"}),e.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-24 z-10 bg-gradient-to-t from-black/80 via-black/40 to-transparent"}),e.jsxs("div",{className:"absolute inset-0 flex gap-4 p-4",children:[e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{className:"animate-[tryonScrollUp_35s_linear_infinite] flex flex-col gap-4",children:[0,1].map(t=>[1,2,3,4,5].map(a=>e.jsx("div",{className:"relative rounded-xl overflow-hidden bg-gray-900 flex-shrink-0",style:{aspectRatio:"3/4"},children:e.jsx("img",{src:`/hero_images/tryon-${a}.webp`,alt:`Try-on example ${a}`,className:"w-full h-full object-cover",loading:"lazy"})},`tryon-col1-${t}-${a}`)))})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{className:"animate-[tryonScrollDown_40s_linear_infinite] flex flex-col gap-4",children:[0,1].map(t=>[6,7,8,9,10].map(a=>e.jsx("div",{className:"relative rounded-xl overflow-hidden bg-gray-900 flex-shrink-0",style:{aspectRatio:"3/4"},children:e.jsx("img",{src:`/hero_images/tryon-${a}.webp`,alt:`Try-on example ${a}`,className:"w-full h-full object-cover",loading:"lazy"})},`tryon-col2-${t}-${a}`)))})})]})]})})]})]}),f===2&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("button",{type:"button",disabled:F||m,onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),Et(B&&!ze?"scene-ready":"setup")},className:"inline-flex items-center gap-1 text-sm sm:text-md font-medium text-gray-200 hover:text-white transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(Ws,{className:"w-3.5 h-3.5"}),B&&!ze?"Back To Scene Ready":"Back To Setup"]}),ee&&e.jsxs("button",{type:"button",disabled:F||m,onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),Et("result")},className:"inline-flex items-center gap-1 text-sm sm:text-md font-medium text-gray-200 hover:text-white transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:["Final Result",e.jsx(Ja,{className:"w-3.5 h-3.5"})]})]}),e.jsx("div",{className:"bg-[#0f1115] rounded-2xl border border-gray-800 p-5",children:e.jsxs("div",{className:"grid lg:grid-cols-12 gap-6 items-start",children:[B&&e.jsxs("div",{className:"lg:hidden",children:[e.jsx("div",{children:e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:"rounded-xl overflow-hidden border border-gray-700 bg-black/20 relative",children:[e.jsx("img",{src:Ce(B),alt:"Current model",className:"w-full max-h-[340px] object-contain bg-black/30"}),m&&e.jsx(Ds,{title:O}),!m&&e.jsx("button",{type:"button",onClick:()=>Ot(!0),disabled:n||m,className:"absolute top-3 right-3 z-[0] p-2 bg-black/50 hover:bg-black/70 backdrop-blur-sm rounded-full text-gray-300 hover:text-white transition-all border border-white/10",title:"View enlarged","aria-label":"View enlarged",children:e.jsx(as,{className:"w-4 h-4"})}),!m&&e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 z-[1] pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 backdrop-blur-[6px]",style:{maskImage:"linear-gradient(to bottom, transparent 0%, black 50%)",WebkitMaskImage:"linear-gradient(to bottom, transparent 0%, black 50%)"}}),e.jsxs("div",{className:"relative bg-gradient-to-t from-black/70 via-black/40 to-transparent px-3.5 pt-8 pb-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-400 animate-pulse flex-shrink-0"}),e.jsx("span",{className:"text-amber-300 drop-shadow-sm font-bold",children:"You can change poses in the next step"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-400 animate-pulse flex-shrink-0"}),e.jsxs("span",{className:"text-amber-300 drop-shadow-sm font-bold",children:["This is a preview image"," ",e.jsx("span",{className:"font-normal text-amber-200/90",children:"— you can export up to 4K after"})]})]})]})]})]})})}),e.jsxs("div",{className:"flex flex-col gap-3 w-full mt-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-gray-400",children:"Choose Resolution"}),e.jsx(ts,{options:cr,selectedValue:G,onSelect:t=>
506nr(t,It),disabled:n||m,autoOpenOnMount:!1,hideButtonWhenOpen:!1}),e.jsxs("p",{className:"text-[11px] font-semibold text-amber-300 leading-snug mt-0.5",children:[G==="1K"&&"Fastest load speed",G==="2K"&&"Semi-fast speed",G==="4K"&&"DSLR – Slow speed"]})]}),e.jsx("div",{className:"flex flex-col gap-3 w-full",children:ui?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:ri,disabled:n||m,className:"w-full inline-flex items-center justify-center gap-2 px-6 py-2.5 rounded-full font-semibold text-[15px] disabled:opacity-50 transition-all text-white bg-blue-600 hover:bg-blue-500",children:[n||m?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),O]}):"Apply Outfit",(w==null?void 0:w.role)!=="admin"&&e.jsx(Ke,{cost:Sa})]}),e.jsxs("div",{className:"mt-2 text-[11px] text-gray-500 text-center min-[468px]:text-left",children:["Estimated wait: ",mi," ","(depending on network & complexity of items)"]})]}):e.jsx(Ve,{label:`Requires ${Sa} Credits To Apply Outfit`,modalTab:"tokens",size:"lg",variant:"primary",fullWidth:!0})})]})]}),e.jsxs("div",{className:B?"lg:col-span-7":"lg:col-span-12",children:[e.jsxs("p",{className:"text-md text-gray-400 mb-3",children:["Upload"," ",e.jsx("span",{className:"font-semibold text-gray-100",children:"front-facing"})," ","garments & accessories for ideal results."]}),e.jsxs("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Top"}),Te&&e.jsx("button",{onClick:()=>{Oa(null),Mt(null),it(null),$t(""),na(""),Zt("preset"),ft(null),pt(null),kt(null)},disabled:n||m,className:"text-xs text-red-400 hover:text-red-300 disabled:opacity-50 disabled:cursor-not-allowed",children:"Remove"})]}),e.jsxs("label",{className:`group relative block h-[140px] sm:aspect-square w-[100%] sm:max-h-[180px] md:h-auto rounded-lg border-2 border-dashed bg-[#0a0a0a]/60 cursor-pointer overflow-hidden transition-all ${co?"border-blue-500 ring-2 ring-blue-500/40":"border-gray-700 hover:border-blue-500"}`,onDragOver:t=>{t.preventDefault(),!(n||m)&&As(!0)},onDragLeave:t=>{t.preventDefault(),As(!1)},onDrop:t=>{var s,l;if(t.preventDefault(),As(!1),n||m)return;const a=(l=(s=t.dataTransfer)==null?void 0:s.files)==null?void 0:l[0];a&&$e({rawFile:a,kind:"top"})},children:[e.jsx("input",{type:"file",accept:"image/png, image/jpeg, image/webp, image/heic, image/heif, .heic, .heif",className:"hidden",disabled:n||m,onChange:async t=>{var s;const a=(s=t.target.files)==null?void 0:s[0];a&&await $e({rawFile:a,kind:"top"})}}),Te?e.jsx("img",{src:Te,alt:"Top",className:"w-full h-full object-contain"}):e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center px-4",children:[e.jsx(Li,{className:"mx-auto h-12 w-12 text-gray-500/80"}),e.jsx("span",{className:"mt-2 inline-block text-sm font-medium text-blue-400 group-hover:text-blue-300 underline decoration-dotted",children:"Click to upload"}),e.jsx("p",{className:"hidden sm:block mt-1 text-xs text-gray-400",children:"or drag & drop"})]})]}),(Te||we||le)&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[11px] font-medium text-gray-400",children:"Fit Style"}),e.jsxs("div",{className:"grid grid-cols-2 w-full rounded-lg bg-[#111318] border border-white/10 p-[2px]",children:[e.jsx("button",{type:"button",disabled:n||m,onClick:()=>{Zt("preset"),na("")},className:`w-full px-3 py-1 text-xs font-semibold rounded-md transition-colors disabled:opacity-50 ${Xt==="preset"?"bg-white/10 text-white":"text-gray-400 hover:text-white"}`,children:"Preset"}),e.jsx("button",{type:"button",disabled:n||m,onClick:()=>{Zt("custom"),$t("")},className:`w-full px-3 py-1 text-xs font-semibold rounded-md transition-colors disabled:opacity-50 ${Xt==="custom"?"bg-white/10 text-white":"text-gray-400 hover:text-white"}`,children:"Custom"})]})]}),Xt==="preset"?e.jsx(Xa,{label:"top",value:Ht,onChange:$t,disabled:n||m,options:["tucked","untucked","half-tucked","cropped","oversized"]}):e.jsxs("div",{className:"relative",children:[e.jsx(Za,{value:dt,disabled:n||m,onChange:t=>na(String(t||"").slice(0,200)),placeholder:"e.g. shorten sleeves slightly",rightPad:!0}),e.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-gray-500",children:[(dt||"").length,"/200"]})]})]}),(Te||we||le)&&e.jsx(es,{preview:_a,dragActive:po,disabled:n||m,onRemove:()=>{ft(null),pt(null),kt(null)},onFileSelect:t=>Is({rawFile:t,kind:"top"}),setDragActive:go,itemLabel:"garment"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Bottom"}),Ee&&e.jsx("button",{onClick:()=>{Ia(null),Dt(null),ot(null),Vt(""),ca(""),ta("preset"),gt(null),bt(null),St(null)},disabled:n||m,className:"text-xs text-red-400 hover:text-red-300 disabled:opacity-50 disabled:cursor-not-allowed",children:"Remove"})]}),e.jsxs("label",{className:`group relative block h-[140px] sm:aspect-square w-[100%] sm:max-h-[180px] md:h-auto rounded-lg border-2 border-dashed bg-[#0a0a0a]/60 cursor-pointer overflow-hidden transition-all ${uo?"border-blue-500 ring-2 ring-blue-500/40":"border-gray-700 hover:border-blue-500"}`,onDragOver:t=>{t.preventDefault(),!(n||m)&&Rs(!0)},onDragLeave:t=>{t.preventDefault(),Rs(!1)},onDrop:t=>{var s,l;if(t.preventDefault(),Rs(!1),n||m)return;const a=(l=(s=t.dataTransfer)==null?void 0:s.files)==null?void 0:l[0];a&&$e({rawFile:a,kind:"bottom"})},children:[e.jsx("input",{type:"file",accept:"image/png, image/jpeg, image/webp, image/heic, image/heif, .heic, .heif",className:"hidden",disabled:n||m,onChange:async t=>{var s;const a=(s=t.target.files)==null?void 0:s[0];a&&await $e({rawFile:a,kind:"bottom"})}}),Ee?e.jsx("img",{src:Ee,alt:"Bottom",className:"w-full h-full object-contain"}):e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center px-4",children:[e.jsx(Bi,{className:"mx-auto h-12 w-12 text-gray-500/80"}),e.jsx("span",{className:"mt-2 inline-block text-sm font-medium text-blue-400 group-hover:text-blue-300 underline decoration-dotted",children:"Click to upload"}),e.jsx("p",{className:"hidden sm:block mt-1 text-xs text-gray-400",children:"or drag & drop"})]})]}),(Ee||ye||ne)&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[11px] font-medium text-gray-400",children:"Fit Style"}),e.jsxs("div",{className:"grid grid-cols-2 w-full rounded-lg bg-[#111318] border border-white/10 p-[2px]",children:[e.jsx("button",{type:"button",disabled:n||m,onClick:()=>{ta("preset"),ca("")},className:`w-full px-3 py-1 text-xs font-semibold rounded-md transition-colors disabled:opacity-50 ${ea==="preset"?"bg-white/10 text-white":"text-gray-400 hover:text-white"}`,children:"Preset"}),e.jsx("button",{type:"button",disabled:n||m,onClick:()=>{ta("custom"),Vt("")},className:`w-full px-3 py-1 text-xs font-semibold rounded-md transition-colors disabled:opacity-50 ${ea==="custom"?"bg-white/10 text-white":"text-gray-400 hover:text-white"}`,children:"Custom"})]})]}
506),ea==="preset"?e.jsx(Xa,{label:"bottom",value:Gt,onChange:Vt,disabled:n||m,options:["high-waisted","low-rise","slim","straight","wide-leg","cuffed"]}):e.jsxs("div",{className:"relative",children:[e.jsx(Za,{value:ut,disabled:n||m,onChange:t=>ca(String(t||"").slice(0,200)),placeholder:"e.g. make fit more relaxed",rightPad:!0}),e.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-gray-500",children:[(ut||"").length,"/200"]})]})]}),(Ee||ye||ne)&&e.jsx(es,{preview:Wa,dragActive:bo,disabled:n||m,onRemove:()=>{gt(null),bt(null),St(null)},onFileSelect:t=>Is({rawFile:t,kind:"bottom"}),setDragActive:xo,itemLabel:"garment"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Shoes"}),Ue&&e.jsx("button",{onClick:()=>{Ma(null),zt(null),lt(null),Yt(""),da(""),sa("preset"),xt(null),wt(null),Ct(null)},disabled:n||m,className:"text-xs text-red-400 hover:text-red-300 disabled:opacity-50 disabled:cursor-not-allowed",children:"Remove"})]}),e.jsxs("label",{className:`group relative block h-[140px] sm:aspect-square w-[100%] sm:max-h-[180px] md:h-auto rounded-lg border-2 border-dashed bg-[#0a0a0a]/60 cursor-pointer overflow-hidden transition-all ${mo?"border-blue-500 ring-2 ring-blue-500/40":"border-gray-700 hover:border-blue-500"}`,onDragOver:t=>{t.preventDefault(),!(n||m)&&Ps(!0)},onDragLeave:t=>{t.preventDefault(),Ps(!1)},onDrop:t=>{var s,l;if(t.preventDefault(),Ps(!1),n||m)return;const a=(l=(s=t.dataTransfer)==null?void 0:s.files)==null?void 0:l[0];a&&$e({rawFile:a,kind:"shoes"})},children:[e.jsx("input",{type:"file",accept:"image/png, image/jpeg, image/webp, image/heic, image/heif, .heic, .heif",className:"hidden",disabled:n||m,onChange:async t=>{var s;const a=(s=t.target.files)==null?void 0:s[0];a&&await $e({rawFile:a,kind:"shoes"})}}),Ue?e.jsx("img",{src:Ue,alt:"Shoes",className:"w-full h-full object-contain"}):e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center px-4",children:[e.jsx(Oi,{className:"mx-auto h-12 w-12 text-gray-500/80"}),e.jsx("span",{className:"mt-2 inline-block text-sm font-medium text-blue-400 group-hover:text-blue-300 underline decoration-dotted",children:"Click to upload"}),e.jsx("p",{className:"hidden sm:block mt-1 text-xs text-gray-400",children:"or drag & drop"})]})]}),(Ue||ve||ce)&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[11px] font-medium text-gray-400",children:"Fit Style"}),e.jsxs("div",{className:"grid grid-cols-2 w-full rounded-lg bg-[#111318] border border-white/10 p-[2px]",children:[e.jsx("button",{type:"button",disabled:n||m,onClick:()=>{sa("preset"),da("")},className:`w-full px-3 py-1 text-xs font-semibold rounded-md transition-colors disabled:opacity-50 ${aa==="preset"?"bg-white/10 text-white":"text-gray-400 hover:text-white"}`,children:"Preset"}),e.jsx("button",{type:"button",disabled:n||m,onClick:()=>{sa("custom"),Yt("")},className:`w-full px-3 py-1 text-xs font-semibold rounded-md transition-colors disabled:opacity-50 ${aa==="custom"?"bg-white/10 text-white":"text-gray-400 hover:text-white"}`,children:"Custom"})]})]}),aa==="preset"?e.jsx(Xa,{label:"footwear",value:Kt,onChange:Yt,disabled:n||m,options:["tied","untied","loosely laced","tight laced","tongue out"]}):e.jsxs("div",{className:"relative",children:[e.jsx(Za,{value:mt,disabled:n||m,onChange:t=>da(String(t||"").slice(0,200)),placeholder:"e.g. keep original socks visible",rightPad:!0}),e.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-gray-500",children:[(mt||"").length,"/200"]})]})]}),(Ue||ve||ce)&&e.jsx(es,{preview:Ha,dragActive:wo,disabled:n||m,onRemove:()=>{xt(null),wt(null),Ct(null)},onFileSelect:t=>Is({rawFile:t,kind:"shoes"}),setDragActive:yo,itemLabel:"footwear"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Hat"}),Le&&e.jsx("button",{onClick:()=>{Da(null),_t(null),nt(null),Jt(""),ua(""),ia("preset"),yt(null),vt(null),At(null)},disabled:n||m,className:"text-xs text-red-400 hover:text-red-300 disabled:opacity-50 disabled:cursor-not-allowed",children:"Remove"})]}),e.jsxs("label",{className:`group relative block h-[140px] sm:aspect-square w-[100%] sm:max-h-[180px] md:h-auto rounded-lg border-2 border-dashed bg-[#0a0a0a]/60 cursor-pointer overflow-hidden transition-all ${ho?"border-blue-500 ring-2 ring-blue-500/40":"border-gray-700 hover:border-blue-500"}`,onDragOver:t=>{t.preventDefault(),!(n||m)&&Fs(!0)},onDragLeave:t=>{t.preventDefault(),Fs(!1)},onDrop:t=>{var s,l;if(t.preventDefault(),Fs(!1),n||m)return;const a=(l=(s=t.dataTransfer)==null?void 0:s.files)==null?void 0:l[0];a&&$e({rawFile:a,kind:"hat"})},children:[e.jsx("input",{type:"file",accept:"image/png, image/jpeg, image/webp, image/heic, image/heif, .heic, .heif",className:"hidden",disabled:n||m,onChange:async t=>{var s;const a=(s=t.target.files)==null?void 0:s[0];a&&await $e({rawFile:a,kind:"hat"})}}),Le?e.jsx("img",{src:Le,alt:"Hat",className:"w-full h-full object-contain"}):e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center px-4",children:[e.jsx(Ii,{className:"mx-auto h-12 w-12 text-gray-500/80"}),e.jsx("span",{className:"mt-2 inline-block text-sm font-medium text-blue-400 group-hover:text-blue-300 underline decoration-dotted",children:"Click to upload"}),e.jsx("p",{className:"hidden sm:block mt-1 text-xs text-gray-400",children:"or drag & drop"})]})]}),(Le||je||de)&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[11px] font-medium text-gray-400",children:"Fit Style"}),e.jsxs("div",{className:"grid grid-cols-2 w-full rounded-lg bg-[#111318] border border-white/10 p-[2px]",children:[e.jsx("button",{type:"button",disabled:n||m,onClick:()=>{ia("preset"),ua("")},className:`w-full px-3 py-1 text-xs font-semibold rounded-md transition-colors disabled:opacity-50 ${ra==="preset"?"bg-white/10 text-white":"text-gray-400 hover:text-white"}`,children:"Preset"}),e.jsx("button",{type:"button",disabled:n||m,onClick:()=>{ia("custom"),Jt("")},className:`w-full px-3 py-1 text-xs font-semibold rounded-md transition-colors disabled:opacity-50 ${ra==="custom"?"bg-white/10 text-white":"text-gray-400 hover:text-white"}`,children:"Custom"})]})]}),ra==="preset"?e.jsx(Xa,{label:"hat",value:qt,onChange:Jt,disabled:n||m,options:["forward","backwards","sideways","tilted","low on brow"]}):e.jsxs("div",{className:"relative",children:[e.jsx(Za,{value:ht,disabled:n||m,onChange:t=>ua(String(t||"").slice(0,200)),placeholder:"e.g. keep hair visible",rightPad:!0}),e.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-gray-500",children:[(ht||"").length,"/200"]})]})]}),(Le||je||de)&&e.jsx(es,{preview:$a,dragActive:vo,disabled:n||m,onRemove:()=>{yt(null),vt(null),At(null)},onFileSelect:t=>Is({rawFile:t,kind:"hat"}),setDragActive:jo,itemLabel:"hat"})]})]}),e.jsx("div",{className:"mt-6",children:e.jsx("div",{className:"grid sm:grid-cols-3 gap-4",children:[0,1,2].map(t=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"text-sm font-semibold",children:["Accessory ",t+1," (eg."," ",t===0?"Necklace":t===1?"Purse":"Scarf",")"]}),Ne[t]&&e.jsx("button",{onClick:()=>{const a=[...he],s=[...Ne],l=[...se];a[t]=null,s[t]=null,l[t]=null,za(a),Wt(s),ct(l),Qt(c=>{const u=Array.isArray(c)?[...c]:["","",""];return u[t]="",u}),ma(c=>{const u=Array.isArray(c)?[...c]:["","",""];return u[t]="",u}),la(c=>{const u=Array.isArray(c)?[...c]:["preset","preset","preset"];return u[t]="preset",u}),jt(c=>{const u=[...c];return u[t]=null,u}),Nt(c=>{const u=[...c];return u[t]=null,u}),Rt(c=>{const u=[...c];return u[t]="",u})},disabled:n||m,className:"text-xs text-red-400 hover:text-red-300 disabled:opacity-50 disabled:cursor-not-allowed",children:"Remove"})]}),e.jsxs("label",{onDragOver:a=>
506{n||m||(a.preventDefault(),Ts(s=>{const l=[...s];return l[t]=!0,l}))},onDragLeave:()=>{n||m||Ts(a=>{const s=[...a];return s[t]=!1,s})},onDrop:async a=>{var l,c;if(n||m)return;a.preventDefault(),Ts(u=>{const g=[...u];return g[t]=!1,g});const s=(c=(l=a.dataTransfer)==null?void 0:l.files)==null?void 0:c[0];s&&await Zr({rawFile:s,index:t})},className:`group relative block h-[140px] sm:aspect-square w-[100%] sm:max-h-[180px] md:h-auto rounded-lg border-2 border-dashed bg-[#0a0a0a]/60 overflow-hidden transition-all ${n||m?"border-gray-700 opacity-60 cursor-not-allowed":fo[t]?"border-blue-500 ring-2 ring-blue-500/30 cursor-pointer":"border-gray-700 hover:border-blue-500 cursor-pointer"}`,children:[(n||m)&&e.jsx("div",{className:"absolute inset-0","aria-hidden":"true"}),e.jsx("input",{type:"file",accept:"image/png, image/jpeg, image/webp, image/heic, image/heif, .heic, .heif",className:"hidden",disabled:n||m,onChange:async a=>{var l;const s=(l=a.target.files)==null?void 0:l[0];s&&(await Zr({rawFile:s,index:t}),a.target.value="")}}),Ne[t]?e.jsx("img",{src:Ne[t],alt:`Accessory ${t+1}`,className:"w-full h-full object-contain"}):e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center px-4",children:[e.jsx(rs,{className:"w-12 h-12 text-gray-500/80"}),e.jsx("span",{className:"mt-2 inline-block text-sm font-medium text-blue-400 group-hover:text-blue-300 underline decoration-dotted",children:"Click to Upload"}),e.jsx("p",{className:"hidden sm:block mt-1 text-xs text-gray-400",children:"or drag & drop"})]})]}),(Ne[t]||he[t]||se[t])&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[11px] font-medium text-gray-400",children:"Fit Style"}),e.jsxs("div",{className:"grid grid-cols-2 w-full rounded-lg bg-[#111318] border border-white/10 p-[2px]",children:[e.jsx("button",{type:"button",disabled:n||m,onClick:()=>{la(a=>{const s=Array.isArray(a)?[...a]:["preset","preset","preset"];return s[t]="preset",s}),ma(a=>{const s=Array.isArray(a)?[...a]:["","",""];return s[t]="",s})},className:`w-full px-3 py-1 text-xs font-semibold rounded-md transition-colors disabled:opacity-50 ${(oa[t]||"preset")==="preset"?"bg-white/10 text-white":"text-gray-400 hover:text-white"}`,children:"Preset"}),e.jsx("button",{type:"button",disabled:n||m,onClick:()=>{la(a=>{const s=Array.isArray(a)?[...a]:["preset","preset","preset"];return s[t]="custom",s}),Qt(a=>{const s=Array.isArray(a)?[...a]:["","",""];return s[t]="",s})},className:`w-full px-3 py-1 text-xs font-semibold rounded-md transition-colors disabled:opacity-50 ${(oa[t]||"preset")==="custom"?"bg-white/10 text-white":"text-gray-400 hover:text-white"}`,children:"Custom"})]})]}),(oa[t]||"preset")==="preset"?e.jsx(Xa,{label:`accessory ${t+1}`,value:_e[t]||"",onChange:a=>Qt(s=>{const l=Array.isArray(s)?[...s]:["","",""];return l[t]=a,l}),disabled:n||m,options:["layered","stacked","loose","snug","centered","asymmetric"]}):e.jsxs("div",{className:"relative",children:[e.jsx(Za,{value:Be[t]||"",disabled:n||m,onChange:a=>{const s=String(a||"").slice(0,200);ma(l=>{const c=Array.isArray(l)?[...l]:["","",""];return c[t]=s,c})},placeholder:"e.g. wear cross-body",rightPad:!0}),e.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-gray-500",children:[(Be[t]||"").length,"/200"]})]})]}),(Ne[t]||he[t]||se[t])&&e.jsx(es,{preview:ha[t],dragActive:No[t],disabled:n||m,onRemove:()=>{jt(a=>{const s=[...a];return s[t]=null,s}),Nt(a=>{const s=[...a];return s[t]=null,s}),Rt(a=>{const s=[...a];return s[t]="",s})},onFileSelect:a=>Ro({rawFile:a,index:t}),setDragActive:a=>ko(s=>{const l=[...s];return l[t]=a,l}),itemLabel:"accessory"})]},t))})})]}),B&&e.jsx("div",{className:"hidden lg:block lg:col-span-5",children:e.jsxs("div",{className:"lg:sticky lg:top-28",children:[e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:"rounded-xl overflow-hidden border border-gray-700 bg-black/20 relative",children:[e.jsx("img",{src:Ce(B),alt:"Current model",className:"w-full max-h-[400px] object-contain bg-black/30"}),m&&e.jsx(Ds,{title:O}),!m&&e.jsx("button",{type:"button",onClick:()=>Ot(!0),disabled:n||m,className:"absolute top-3 right-3 z-[0] p-2 bg-black/50 hover:bg-black/70 backdrop-blur-sm rounded-full text-gray-300 hover:text-white transition-all border border-white/10",title:"View enlarged","aria-label":"View enlarged",children:e.jsx(as,{className:"w-4 h-4"})}),!m&&e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 z-[1] pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 backdrop-blur-[6px]",style:{maskImage:"linear-gradient(to bottom, transparent 0%, black 50%)",WebkitMaskImage:"linear-gradient(to bottom, transparent 0%, black 50%)"}}),e.jsxs("div",{className:"relative bg-gradient-to-t from-black/70 via-black/40 to-transparent px-3.5 pt-8 pb-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-400 animate-pulse flex-shrink-0"}),e.jsx("span",{className:"text-amber-300 drop-shadow-sm font-bold",children:"You can change poses in the next step"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-400 animate-pulse flex-shrink-0"}),e.jsxs("span",{className:"text-amber-300 drop-shadow-sm font-bold",children:["This is a preview image"," ",e.jsx("span",{className:"font-normal text-amber-200/90",children:"— you can export up to 4K after"})]})]})]})]})]})}),e.jsxs("div",{className:"flex flex-col gap-3 w-full mt-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-gray-400",children:"Choose Resolution"}),e.jsx(ts,{options:cr,selectedValue:G,onSelect:t=>
506nr(t,It),disabled:n||m,autoOpenOnMount:!1,hideButtonWhenOpen:!1}),e.jsxs("p",{className:"text-[11px] font-semibold text-amber-300 leading-snug mt-0.5",children:[G==="1K"&&"Fastest load speed",G==="2K"&&"Semi-fast speed",G==="4K"&&"DSLR – Slow speed"]})]}),e.jsx("div",{children:ui?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:ri,disabled:n||m,className:"w-full inline-flex items-center justify-center gap-2 px-6 py-2.5 rounded-full font-semibold text-[15px] disabled:opacity-50 transition-all text-white bg-blue-600 hover:bg-blue-500",children:[n||m?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),O]}):"Apply Outfit To Model",(w==null?void 0:w.role)!=="admin"&&e.jsx(Ke,{cost:Sa})]}),e.jsxs("div",{className:"mt-2 text-[11px] text-gray-500 text-center min-[468px]:text-left",children:["Estimated wait: ",mi," ","(depending on network & complexity of items)"]})]}):e.jsx(Ve,{label:`Requires ${Sa} Credits To Apply Outfit`,modalTab:"tokens",size:"lg",variant:"primary",fullWidth:!0})})]})]})})]})})]}),f===3&&e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center justify-between mb-3",children:e.jsxs("button",{type:"button",disabled:F||m,onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),Et("outfit")},className:"inline-flex items-center gap-1 text-sm sm:text-md font-medium text-gray-200 hover:text-white transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(Ws,{className:"w-3.5 h-3.5"}),"Back To Outfit"]})}),e.jsx("div",{className:"bg-[#0f1115] rounded-2xl border border-gray-800 p-5",children:e.jsxs("div",{className:"flex flex-col lg:flex-row-reverse gap-5",children:[ee&&e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"relative rounded-xl overflow-hidden border border-gray-700 bg-black/20",children:[e.jsx("img",{src:Ce(((Ni=A[I])==null?void 0:Ni.url)||ya()||ee),alt:((ki=A[I])==null?void 0:ki.label)||`${We} view`,className:"w-full object-contain bg-black/30",style:{maxHeight:A.length>1||no?"32vh":"40vh"}}),!fa&&!Pt&&!n&&!ds&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full absolute top-0 left-0 z-[2]",children:e.jsx("div",{className:"relative bg-gradient-to-b from-black/70 via-black/40 to-transparent px-3.5 pb-8 pt-3 space-y-1.5",children:e.jsxs("div",{className:"flex items-center gap-2 text-[12px] sm:text-[13px]",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-400 animate-pulse flex-shrink-0"}),e.jsxs("span",{className:"flex font-bold text-amber-300 drop-shadow-sm",children:[e.jsx("span",{className:"block sm:hidden",children:"Preview image"}),e.jsx("span",{className:"hidden sm:block",children:"This is a low res preview image"})]})]})})}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-[2]",children:e.jsx("div",{className:"bg-gradient-to-t from-black/80 via-black/50 to-transparent px-3 sm:px-4 pt-8 pb-3 flex items-end justify-between gap-3",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:Io,disabled:F||!ee,className:"flex-shrink-0 px-4 sm:px-5 py-2 bg-green-600 hover:bg-green-500 rounded-full text-xs sm:text-sm font-semibold transition-all flex items-center gap-1.5 sm:gap-2 disabled:opacity-50 shadow-lg shadow-black/30",children:[e.jsx("svg",{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})}),"Export Full Quality"]}),A.length>1&&e.jsxs("button",{type:"button",onClick:Mo,disabled:F||!ee,className:"flex-shrink-0 px-4 sm:px-5 py-2 bg-green-600 hover:bg-green-500 rounded-full text-xs sm:text-sm font-semibold transition-all flex items-center gap-1.5 sm:gap-2 disabled:opacity-50 shadow-lg shadow-black/30",title:"Download all images as a ZIP",children:[e.jsx("svg",{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 10v6m0 0l-3-3m3 3l3-3M3 17V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z"})}),"Export All"]})]})})})]}),fa&&e.jsxs("div",{className:"absolute inset-0 z-[60] flex items-center justify-center","aria-live":"polite","aria-busy":"true",children:[e.jsx("div",{className:"absolute inset-0 scan-dim"}),e.jsx("div",{className:"absolute inset-0 scan-lines"}),e.jsx("div",{className:"absolute inset-0 scan-lines-angled"}),e.jsx("div",{className:"absolute left-0 w-full scan-line-sweep"}),e.jsx("div",{className:"absolute inset-0 scan-grid-lines"}),e.jsx("div",{className:"scan-grid-reactive",children:e.jsx("div",{className:"scan-grid-reactive-band"})}),e.jsxs("div",{className:"relative flex flex-col items-center justify-center text-center px-6",children:[e.jsxs("div",{className:"relative mb-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-full border-4 border-blue-700/30 border-t-[#4169e1] animate-spin"}),e.jsx("div",{className:"absolute inset-0 rounded-full animate-ping bg-blue-500/20"})]}),e.jsx("p",{className:"text-sm font-medium text-indigo-50 scan-text-front",children:Zi||"Rotating..."})]})]}),Pt&&e.jsxs("div",{className:"absolute inset-0 z-[60] flex items-center justify-center","aria-live":"polite","aria-busy":"true",children:[e.jsx("div",{className:"absolute inset-0 scan-dim"}),e.jsx("div",{className:"absolute inset-0 scan-lines"}),e.jsx("div",{className:"absolute inset-0 scan-lines-angled"}),e.jsx("div",{className:"absolute left-0 w-full scan-line-sweep"}),e.jsx("div",{className:"absolute inset-0 scan-grid-lines"}),e.jsx("div",{className:"scan-grid-reactive",children:e.jsx("div",{className:"scan-grid-reactive-band"})}),e.jsxs("div",{className:"relative flex flex-col items-center justify-center text-center px-6",children:[e.jsxs("div",{className:"relative mb-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-full border-4 border-purple-700/30 border-t-purple-500 animate-spin"}),e.jsx("div",{className:"absolute inset-0 rounded-full animate-ping bg-purple-500/20"})]}),e.jsx("p",{className:"text-sm font-medium text-indigo-50 scan-text-front",children:"Applying pose..."})]})]}),ds&&e.jsxs("div",{className:"absolute inset-0 z-[60] flex items-center justify-center","aria-live":"polite","aria-busy":"true",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50"}),e.jsxs("div",{className:"relative flex flex-col items-center justify-center text-center px-6",children:[e.jsxs("div",{className:"relative mb-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-full border-4 border-green-700/30 border-t-green-500 animate-spin"}),e.jsx("div",{className:"absolute inset-0 rounded-full animate-ping bg-green-500/20"})]}),e.jsx("p",{className:"text-sm font-medium text-indigo-50",children:"Exporting all images..."})]})]}),n&&f===3&&!fa&&!Pt&&e.jsx(Ds,{title:"Editing image..."}),e.jsxs("div",{className:"absolute top-3 right-3 z-[4] flex items-center gap-2",children:[!fa&&!Pt&&!n&&!ds&&(()=>{var s;
506const t=((s=A[I])==null?void 0:s.url)||ya()||ee,a=Yi.has(t);return e.jsx("button",{type:"button",onClick:()=>{if(!(F||!t||a)){if(!Yr){y.info("Photo Issue is available for Pro and Elite subscribers. Upgrade your plan to access this feature."),r("/pricing");return}Ki(t),Br(!0)}},disabled:F||!t||a,className:`px-3 py-1.5 backdrop-blur-sm rounded-full transition-all border text-xs font-semibold flex items-center gap-1.5 ${a?"bg-green-900/50 border-green-500/30 text-green-400 cursor-not-allowed":"bg-red-900/50 hover:bg-red-800/70 border-red-500/30 text-red-300 hover:text-white"}`,title:a?"Photo issue request submitted":"Report a photo issue",children:a?e.jsxs(e.Fragment,{children:[e.jsx($s,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Submitted"})]}):e.jsxs(e.Fragment,{children:[e.jsx(sl,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:block",children:"Photo"}),e.jsx("span",{children:"Issue"})]})})})(),e.jsx("button",{type:"button",onClick:()=>ba(!0),disabled:F,className:"p-2 bg-black/50 hover:bg-black/70 backdrop-blur-sm rounded-full text-gray-300 hover:text-white transition-all border border-white/10",title:"View enlarged","aria-label":"View enlarged",children:e.jsx(as,{className:"w-4 h-4"})})]})]}),A.length>1&&e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg bg-blue-500/10 border border-blue-500/20 mb-2",children:[e.jsx("span",{className:"inline-block w-2 h-2 mt-0.5 rounded-full bg-blue-400 shrink-0"}),e.jsxs("p",{className:"text-[11px] sm:text-xs text-blue-200/90 font-medium leading-snug",children:["All actions (side/back views, custom poses & AI edits) apply to the"," ",e.jsx("span",{className:"text-white font-semibold",children:"selected image"})," ","below."]})]}),e.jsx("div",{ref:so,className:"flex gap-2 overflow-x-auto overflow-y-visible pt-1 pb-2 pl-1 scrollbar-thin scrollbar-thumb-gray-700 scrollbar-track-transparent",children:A.map((t,a)=>{const s=t.type==="edit",l=t.type==="pose",c=I===a,u=c?l?"border-purple-500 ring-2 ring-purple-500/50":s?"border-amber-500 ring-2 ring-amber-500/50":"border-blue-500 ring-2 ring-blue-500/50":"border-gray-700 hover:border-gray-600",g=c?l?"bg-purple-600":s?"bg-amber-600":"bg-blue-600":"bg-black/80 group-hover:bg-black/90";return e.jsxs("button",{onClick:()=>{F||Oe(a)},disabled:F,className:`group relative w-[60px] sm:w-[70px] rounded-md overflow-hidden border-2 transition-all flex-shrink-0 ${u} disabled:opacity-50`,title:t.label,children:[e.jsx("div",{className:"aspect-[3/4] bg-black/20",children:e.jsx("img",{src:Ce(t.url),alt:t.label,className:"w-full h-full object-cover",draggable:!1})}),e.jsx("div",{className:`absolute bottom-0 left-0 right-0 px-1 py-0.5 text-[9px] font-medium text-center ${g}`,children:t.label})]},`result-v-${a}`)})})]}),e.jsxs("div",{className:"space-y-2 mt-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-xs font-medium text-gray-400",children:"Edit selected image"})}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{value:xa,onChange:t=>{ka&&Ga(String(t.target.value||"").slice(0,js))},rows:1,disabled:!ka||F,maxLength:js,placeholder:"e.g., make the shirt looser, change the shoes to white, make the background warmer...",className:"w-full rounded-xl bg-[#1a1a1d] border border-white/10 p-3 pr-20 pb-7 text-sm text-white placeholder-gray-500 disabled:opacity-50 resize-none"}),e.jsxs("span",{className:`absolute bottom-3 right-3 text-[11px] ${ro?"text-amber-300":"text-gray-500"}`,children:[xa.length,"/",js]})]}),ka?e.jsxs("button",{type:"button",onClick:To,disabled:F||!xa.trim(),className:"w-full inline-flex items-center justify-center gap-2 px-4 py-2.5 bg-blue-600 hover:bg-blue-500 rounded-full text-sm font-medium transition-all disabled:opacity-50 disabled:cursor-not-allowed",title:xa.trim()?"Edit the currently selected image":"Enter notes to enable editing",children:[e.jsx(rl,{className:"w-4 h-4"}),"Edit Image",(w==null?void 0:w.role)!=="admin"&&e.jsx(Ke,{cost:Tt})]}):e.jsx(Ve,{label:`Need ${Tt}
506 To Edit`,modalTab:"tokens",size:"md",fullWidth:!0})]}),e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-white font-medium",children:"Save this scene and model?"}),e.jsxs("p",{className:"text-[12px] text-gray-500",children:["Skip setup & save"," ",li," tokens next time"]})]}),e.jsxs("button",{type:"button",onClick:()=>{const t=A[I],a=(t==null?void 0:t.url)||ee,s=`result-${I}`;si(a,(t==null?void 0:t.label)||"Scene",s)},disabled:F||Ae||q.has(`result-${I}`),className:`flex items-center gap-2 px-5 py-2.5 rounded-full border transition-all ${q.has(`result-${I}`)?"bg-green-900/20 border-green-700/50":"bg-blue-600 hover:bg-blue-500 border-blue-500"} disabled:opacity-50 disabled:cursor-not-allowed`,title:q.has(`result-${I}`)?"This view is already saved":"Save scene to load later",children:[q.has(`result-${I}`)?e.jsx($s,{className:"w-4 h-4 text-green-400"}):e.jsx(wr,{className:"w-4 h-4 text-white"}),e.jsx("span",{className:`text-sm font-medium ${q.has(`result-${I}`)?"text-green-400":"text-white"}`,children:Ae?"Saving...":q.has(`result-${I}`)?"Saved!":"Save Scene And Model"})]})]})})]}),e.jsx("div",{className:"lg:w-[350px] flex flex-col justify-between gap-3",children:e.jsxs("div",{className:"bg-[#0f1115] rounded-xl border border-gray-800 p-4 space-y-4",children:[e.jsx("div",{className:"text-xs font-medium text-gray-400 uppercase tracking-wide",children:"Pose & Angle Options"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-white",children:"Generate New Angles"}),(w==null?void 0:w.role)!=="admin"&&e.jsx(Ke,{cost:zs})]}),zo?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("button",{type:"button",onClick:()=>La("side"),disabled:F,className:"flex items-center justify-center gap-2 px-4 py-2.5 bg-[#252525] hover:bg-[#2f2f2f] rounded-full text-sm font-medium transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx("span",{children:"Side Profile View"})}),e.jsx("button",{type:"button",onClick:()=>La("back"),disabled:F,className:"flex items-center justify-center gap-2 px-4 py-2.5 bg-[#252525] hover:bg-[#2f2f2f] rounded-full text-sm font-medium transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx("span",{children:"Back View"})}),e.jsxs("div",{className:"text-[11px] text-gray-500 text-center",children:["Estimated wait: ",fi," (depending on network & complexity of items)"]})]}):e.jsx(Ve,{label:`Requires ${zs} Credits`,modalTab:"tokens",size:"lg",variant:"primary",fullWidth:!0})]}),e.jsx("div",{className:"border-t border-gray-700/50"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-white",children:"Apply Custom Pose"}),e.jsx("p",{className:"mt-0.5 text-[11px] text-gray-500 leading-relaxed",children:"Results may vary from reference"})]}),(w==null?void 0:w.role)!=="admin"&&e.jsx(Ke,{cost:_s})]}),_o?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:`group relative w-full h-[110px] sm:h-[130px] rounded-xl flex items-center justify-center overflow-hidden border-2 ${F?"border-gray-700 cursor-not-allowed":io?"border-blue-500 ring-2 ring-blue-500 ring-opacity-50":"border-dashed border-gray-700 hover:border-gray-600 cursor-pointer"} bg-[#0A0A0A]/60 transition-all`,onDragOver:F?void 0:t=>{t.preventDefault(),tr(!0)},onDragLeave:F?void 0:t=>{t.preventDefault(),tr(!1)},onDrop:F?void 0:t=>{var a;t.preventDefault(),tr(!1),(a=t.dataTransfer.files)!=null&&a[0]&&ii(t.dataTransfer.files[0])},children:[e.jsx("input",{ref:Va,type:"file",accept:"image/png, image/jpeg, image/webp, image/heic, image/heif, .heic, .heif",onChange:t=>{var a;return((a=t.target.files)==null?void 0:a[0])&&ii(t.target.files[0])},disabled:F,className:"hidden"}),wa?e.jsxs("div",{className:"relative w-full h-full",children:[e.jsx("img",{src:wa,alt:"Pose reference",className:"w-full h-full object-contain"}),e.jsx("button",{type:"button",onClick:t=>{t.preventDefault(),t.stopPropagation(),ks(null),Ss(null),Va!=null&&Va.current&&(Va.current.value="")},disabled:F,className:"absolute top-2 right-2 p-1.5 bg-red-600/90 hover:bg-red-600 rounded-md transition-all disabled:opacity-50",title:"Clear pose reference",children:e.jsx(Ie,{className:"w-3 h-3 text-white"})})]}):e.jsxs("div",{className:"text-center px-4",children:[e.jsx(ss,{className:"mx-auto h-6 w-6 text-gray-400"}),e.jsx("span",{className:"mt-2 inline-block text-xs font-medium text-blue-400 hover:text-blue-300 underline decoration-dotted",children:"Click to upload"}),e.jsx("p",{className:"hidden sm:block mt-0.5 text-[10px] text-gray-500",children:"or drag & drop"})]}),Pt&&e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-black/60",children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:"w-6 h-6 rounded-full border-2 border-blue-700/30 border-t-[#4169e1] animate-spin"}),e.jsx("p",{className:"mt-1.5 text-[10px] text-white",children:"Applying pose..."})]})})]}),e.jsxs("button",{type:"button",onClick:()=>Cs(!0),disabled:F||!wa,className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-purple-600 hover:bg-purple-500 rounded-full text-sm font-medium transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(rs,{className:"w-4 h-4"}),e.jsx("span",{children:"Apply Pose"})]}),e.jsxs("div",{className:"text-[11px] text-gray-500 text-center",children:["Estimated wait: ",fi," (depending on network & complexity of items)"]})]}):e.jsx(Ve,{label:`Requires ${_s}
506 Credits`,modalTab:"tokens",size:"lg",variant:"primary",fullWidth:!0})]})]})})]})}),e.jsx("div",{className:"w-full flex justify-center mt-4",children:e.jsxs("button",{type:"button",onClick:()=>{Xi(),y.info("Starting new try-on session")},disabled:F,className:"inline-flex items-center justify-center gap-3 px-4 py-2 text-md text-gray-400 hover:text-red-400 disabled:opacity-50 transition-colors",children:[e.jsx(il,{className:"w-5 h-5"}),"Start A New Try-On"]})})]}),Gi&&e.jsx(Ri,{url:((Si=A[I])==null?void 0:Si.url)||ya()||ee,defaultFilename:`Try-On ${((Ci=A[I])==null?void 0:Ci.label)||"Result"}`,onClose:()=>Tr(!1),enableAiEdit:!1,enableBackdrop:!1,enableExportRemoveBg:!1,onEdited:t=>{He(a=>[...a,{url:t,label:`AI Edit ${a.length}`}]),Oe(A.length)}}),Lr&&e.jsx(ll,{isOpen:Lr,baseImageUrl:Vi,apiBase:U,onClose:()=>{Br(!1)},onSubmitted:t=>{t&&qi(a=>new Set(a).add(t))}}),e.jsx(bl,{isOpen:!!_r,candidates:_r||[],onSelect:Oo}),lo&&Ra.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",style:{animation:"poseViewFadeIn 140ms ease-out"},onClick:t=>{t.target===t.currentTarget&&Cs(!1)},children:[e.jsxs("div",{className:"w-full max-w-sm bg-[#16181A] border border-[#27272A] rounded-xl shadow-2xl p-5 space-y-4",style:{animation:"poseViewScaleIn 180ms cubic-bezier(.25,.8,.25,1)"},onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"text-center space-y-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-white",children:"What view is your pose reference?"}),e.jsx("p",{className:"text-xs text-gray-400",children:"This helps the AI generate more accurate results"})]}),e.jsx("div",{className:"flex flex-col gap-2",children:[{value:"front",label:"Front View",desc:"Facing the camera"},{value:"side",label:"Side View",desc:"Profile / side angle"},{value:"back",label:"Back View",desc:"Facing away from camera"}].map(t=>e.jsxs("button",{type:"button",onClick:()=>{Cs(!1),oo(t.value),t.value==="front"?fr({}):La("pose")},className:"flex items-center gap-3 px-4 py-3 bg-[#252525] hover:bg-[#2f2f2f] rounded-lg text-left transition-colors cursor-pointer group",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"text-sm font-medium text-white group-hover:text-purple-300 transition-colors",children:t.label}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-0.5",children:t.desc})]}),e.jsx(Ja,{className:"w-4 h-4 text-gray-600 group-hover:text-purple-400 transition-colors"})]},t.value))}),e.jsx("button",{type:"button",onClick:()=>Cs(!1),className:"w-full px-3 py-2 text-xs font-medium text-gray-400 hover:text-white transition-colors cursor-pointer",children:"Cancel"})]}),e.jsx("style",{children:`
507                    @keyframes poseViewFadeIn {
508                      from { opacity: 0 }
509                      to   { opacity: 1 }
510                    }
511                    @keyframes poseViewScaleIn {
512                      from { transform: scale(.92); opacity: 0 }
513                      to   { transform: scale(1);   opacity: 1 }
514                    }
515                  `})]}),document.body),e.jsx(wl,{isOpen:!!cs,onClose:()=>La(null),onConfirm:Ko,activeSlots:Vo,viewType:cs||"back"}),e.jsx(ol,{isOpen:Ji,onClose:()=>Ks(!1),videoUrl:Or,title:"Model Try-On Tutorial"})]}),e.jsx(cl,{heading:Qa.heading,subheading:Qa.subheading,steps:Qa.steps,featureCards:Qa.featureCards,beforeAfterShowcase:Qa.beforeAfterShowcase,tutorialVideoUrl:Or,onTutorialOpen:()=>Ks(!0)}),e.jsx(dl,{currentPath:"/model-try-on-legacy"}),e.jsx("div",{className:"mt-20",children:e.jsx(ul,{items:ml})})]})}),Uo]})}export{wn as default};

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.