PageSourceSearch

https://www.bilgim.ai/_next/static/chunks/1voy7nxas5o8p.js

js bilgim.ai collected 2026-10-05 12:44:19 UTC 80,093 bytes, 5 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,35720,e=>{"use strict";var t=e.i(75214);e.i(23127);var r=e.i(63696);e.s(["BannerSlide",0,function({card:e,priority:n=!1,sizes:s={}}){let{default:i="h-28",sm:a="sm:h-28",lg:l="lg:h-40",xl:o="xl:h-56"}=s,c=`${i} ${a} ${l} ${o}`;return(0,t.jsx)("div",{role:"group","aria-roledescription":"slide","data-slot":"carousel-item",className:"min-w-[210px] md:min-w-[180px] lg:min-w-[270px] xl:min-w-[440px] flex-[0_0_210px] md:flex-[0_0_180px] lg:flex-[0_0_270px] xl:flex-[0_0_440px] ml-1 first:ml-0 group relative pl-0",children:(0,t.jsxs)("a",{href:e.link,className:"cursor-pointer block",children:[(0,t.jsx)(r.MediaCard,{imageUrl:e.imageUrl,videoUrl:e.videoUrl,alt:e.title,aspectRatio:c,enableVideo:!0,priority:n,className:"w-full rounded-lg overflow-hidden"}),(0,t.jsx)("p",{className:"text-xs md:text-[10px] text-nowrap overflow-hidden overflow-ellipsis lg:text-sm leading-3 xl:text-lg xl:leading-6 pt-1 font-bold uppercase text-white group-hover:text-accent-rose transition-colors duration-300",children:e.title}),(0,t.jsx)("div",{className:"flex items-center gap-1 justify-between",children:(0,t.jsx)("p",{className:"text-[9px] md:text-[6px] text-nowrap overflow-hidden overflow-ellipsis lg:text-[11px] xl:text-sm pt-1 xl:pt-1.5 text-text-muted group-hover:text-accent-rose transition-colors duration-300",children:e.description})})]})})}])},17100,e=>{"use strict";var t=e.i(75214),r=e.i(91151),n=e.i(67382);function s({children:e,className:i="",snap:a=!0,showArrows:l=!1,gap:o="gap-1"}){let c=(0,r.useRef)(null),[d,u]=(0,r.useState)(!1),[p,m]=(0,r.useState)(!0),x=(0,r.useRef)(!1),g=(0,r.useRef)(!1),h=(0,r.useRef)(0),b=(0,r.useRef)(0),f=(0,r.useRef)(0),v=(0,r.useRef)(0),w=(0,r.useRef)(0),y=(0,r.useRef)(null),j=(0,r.useCallback)(()=>{if(!c.current)return;let{scrollLeft:e,scrollWidth:t,clientWidth:r}=c.current;u(e>0),m(e<t-r-1)},[]);(0,r.useEffect)(()=>{let e=c.current;if(e)return j(),e.addEventListener("scroll",j,{passive:!0}),window.addEventListener("resize",j,{passive:!0}),()=>{e.removeEventListener("scroll",j),window.removeEventListener("resize",j)}},[j]);let k=e=>{if(c.current){let{scrollLeft:t,clientWidth:r}=c.current,n=.75*r;c.current.scrollTo({left:"left"===e?t-n:t+n,behavior:"smooth"})}},N=()=>{if(!c.current)return;let e=c.current;if(Math.abs(f.current)>.5){let t=()=>{if(f.current*=.92,.5>Math.abs(f.current)){y.current=null;return}e.scrollLeft-=f.current,y.current=requestAnimationFrame(t)};y.current=requestAnimationFrame(t)}};return(0,t.jsxs)("div",{className:`group/carousel relative w-full ${i}`,role:"region","aria-roledescription":"carousel","data-slot":"carousel",onClick:e=>{g.current&&(e.preventDefault(),e.stopPropagation())},children:[l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{suppressHydrationWarning:!0,onClick:()=>k("left"),className:`absolute left-2 top-1/2 -translate-y-1/2 z-20 h-9 w-9 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 flex items-center justify-center text-white transition-all duration-300 hover:bg-zinc-900 hover:border-white/20 hover:scale-105 active:scale-95 shadow-lg cursor-pointer ${d?"opacity-100":"opacity-0 pointer-events-none"}`,"aria-label":"Scroll Left",children:(0,t.jsx)(n.ChevronLeft,{className:"h-5 w-5"})}),(0,t.jsx)("button",{suppressHydrationWarning:!0,onClick:()=>k("right"),className:`absolute right-2 top-1/2 -translate-y-1/2 z-20 h-9 w-9 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 flex items-center justify-center text-white transition-all duration-300 hover:bg-zinc-900 hover:border-white/20 hover:scale-105 active:scale-95 shadow-lg cursor-pointer ${p?"opacity-100":"opacity-0 pointer-events-none"}`,"aria-label":"Scroll Right",children:(0,t.jsx)(n.ChevronRight,{className:"h-5 w-5"})})]}),(0,t.jsx)("div",{className:"overflow-hidden","data-slot":"carousel-content",children:(0,t.jsxs)("div",{ref:c,className:`flex overflow-x-auto ${a?"snap-x sm:snap-mandatory":""} pb-1`,style:{WebkitOverflowScrolling:"touch",scrollbarWidth:"none",msOverflowStyle:"none"},onMouseDown:e=>{e.preventDefault(),x.current=!0,g.current=!1,h.current=e.pageX,b.current=c.current?.scrollLeft??0,f.current=0,v.current=e.pageX,w.current=Date.now(),y.current&&cancelAnimationFrame(y.current),c.current?.style.setProperty("scroll-behavior","auto"),c.current?.style.setProperty("user-select","none")},onMouseLeave:()=>{x.current&&(x.current=!1,c.current?.style.removeProperty("user-select"),c.current?.style.setProperty("scroll-behavior","smooth"),N())},onMouseUp:()=>{x.current&&(x.current=!1,c.current?.style.removeProperty("user-select"),c.current?.style.setProperty("scroll-behavior","smooth"),N())},onMouseMove:e=>{if(!x.current||!c.current)return;let t=e.pageX,r=t-v.current;Date.now()-w.current>0&&(f.current=r),v.current=t,w.current=Date.now();let n=t-h.current;Math.abs(n)>3&&(g.current=!0),c.current.scrollLeft=b.current-n},onTouchStart:e=>{x.current=!0,g.current=!1,h.current=e.touches[0].pageX,b.current=c.current?.scrollLeft??0,f.current=0,v.current=e.touches[0].pageX,w.current=Date.now(),y.current&&cancelAnimationFrame(y.current)},onTouchMove:e=>{if(!x.current||!c.current)return;let t=e.touches[0].pageX,r=t-v.current;Date.now()-w.current>0&&(f.current=r),v.current=t,w.current=Date.now();let n=t-h.current;Math.abs(n)>3&&(g.current=!0),c.current.scrollLeft=b.current-n},onTouchEnd:()=>{x.current&&(x.current=!1,N())},onDragStart:e=>e.preventDefault(),children:[(0,t.jsx)("style",{children:`
2            [data-slot="carousel-content"] > div::-webkit-scrollbar {
3              display: none;
4            }
5          `}),e]})})]})}var i=e.i(29191),a=e.i(35720);e.s(["BannerCarousel",0,function(){return(0,t.jsx)("div",{className:"group/carousel relative w-full -mx-5 pl-5 pr-0 sm:-mx-0 sm:px-0",children:(0,t.jsx)(s,{gap:"gap-1",className:"w-full",children:(0,t.jsx)("div",{className:"flex",children:i.bannerCards.map((e,r)=>(0,t.jsx)(a.BannerSlide,{card:e,priority:r<2},e.id))})})})}],17100)},70933,e=>{"use strict";var t=e.i(75214),r=e.i(91151),n=e.i(15467),s=e.i(69960);function i({tabs:e,activeTabId:a,onTabChange:l,className:o="",layoutIdPrefix:c="activeTabBackground"}){return(0,t.jsx)("div",{role:"tablist",className:(0,s.cn)("flex w-full sm:w-auto gap-1 bg-zinc-950/60 border border-white/5 p-1 rounded-xl overflow-x-auto scrollbar-none",o),children:e.map(e=>{let i=a===e.id;return(0,t.jsxs)("button",{suppressHydrationWarning:!0,role:"tab","aria-selected":i,onClick:()=>l(e.id),className:(0,s.cn)("group relative flex-1 sm:flex-initial flex items-center justify-center gap-2 px-4 py-2 rounded-lg text-xs font-semibold tracking-wide cursor-pointer transition-colors outline-none focus-visible:ring-1 focus-visible:ring-accent-rose/40 select-none",i?"text-white":"text-zinc-500 hover:text-zinc-300"),children:[i&&(0,t.jsx)(n.motion.div,{layoutId:c,className:"absolute inset-0 rounded-lg bg-bg-hover border border-white/10 shadow-[inset_0_1px_0_rgba(255,255,255,0.05),0_2px_8px_rgba(0,0,0,0.5)] z-0",transition:{type:"spring",stiffness:380,damping:30,mass:.8}}),e.icon&&(0,t.jsx)("span",{className:"relative z-10 transition-transform duration-200 group-hover:scale-110 flex items-center justify-center",children:r.default.isValidElement(e.icon)?r.default.cloneElement(e.icon,{weight:i?"Filled":"Outline"}):e.icon}),(0,t.jsx)("span",{className:"relative z-10",children:e.name})]},e.id??"all")})})}var a=e.i(67382);function l({value:e,onChange:n,placeholder:i="Search...",className:o="",inputClassName:c=""}){let[d,u]=r.default.useState(!1),p=r.default.useRef(null);return r.default.useEffect(()=>{let e=e=>{let t=document.activeElement,r=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t?.getAttribute("contenteditable")==="true";"/"!==e.key||r||(e.preventDefault(),p.current?.focus())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,t.jsxs)("div",{className:(0,s.cn)("relative flex items-center transition-all duration-300 w-full sm:w-72 md:w-80 rounded-xl border",d?"border-accent-rose/40 bg-zinc-900/60 shadow-[0_0_15px_rgba(244,63,94,0.1),inset_0_1px_0_rgba(255,255,255,0.03)]":"border-white/5 bg-zinc-950/60 hover:border-white/10",o),children:[(0,t.jsx)(a.Search,{className:(0,s.cn)("absolute left-3.5 h-3.5 w-3.5 transition-colors duration-200 pointer-events-none z-10",d?"text-accent-rose":"text-zinc-500")}),(0,t.jsx)("input",{ref:p,type:"text",value:e,onChange:e=>n(e.target.value),onFocus:()=>u(!0),onBlur:()=>u(!1),placeholder:i,autoComplete:"off",suppressHydrationWarning:!0,className:(0,s.cn)("w-full bg-transparent border-0 pl-10 pr-9 py-2.5 text-xs text-white placeholder-zinc-500 focus:outline-none focus:ring-0",c)}),e?(0,t.jsx)("button",{suppressHydrationWarning:!0,type:"button","aria-label":"Clear search query",onClick:()=>{n(""),p.current?.focus()},className:"absolute right-2.5 p-1 rounded-md text-zinc-500 hover:text-white hover:bg-zinc-800/60 transition-all cursor-pointer z-10",children:(0,t.jsx)(a.X,{className:"h-3.5 w-3.5"})}):(0,t.jsx)("div",{className:(0,s.cn)("absolute right-3.5 flex items-center gap-0.5 px-1.5 py-0.5 border border-white/10 bg-zinc-900 rounded text-[9px] font-mono text-zinc-500 pointer-events-none transition-all duration-200 select-none z-10",d?"opacity-0 scale-95":"opacity-100 scale-100"),children:"/"})]})}var o=e.i(36046);let c=e=>{switch(e.toLowerCase()){case"all":default:return(0,t.jsx)(a.Compass,{className:"h-3.5 w-3.5"});case"women":return(0,t.jsx)(a.Female,{className:"h-3.5 w-3.5 text-rose-400/80"});case"men":return(0,t.jsx)(a.Male,{className:"h-3.5 w-3.5 text-blue-400/80"});case"couple":return(0,t.jsx)(a.Heart,{className:"h-3.5 w-3.5 text-rose-500/80"});case"kids":return(0,t.jsx)(a.Baby,{className:"h-3.5 w-3.5 text-amber-400/80"});case"selfie":return(0,t.jsx)(a.Smartphone,{className:"h-3.5 w-3.5 text-teal-400/80"});case"mirror selfie":return(0,t.jsx)(a.Camera,{className:"h-3.5 w-3.5 text-indigo-400/80"});case"car":return(0,t.jsx)(a.Car,{className:"h-3.5 w-3.5 text-red-400/80"});case"studio":return(0,t.jsx)(a.Aperture,{className:"h-3.5 w-3.5 text-purple-400/80"});case"winter":return(0,t.jsx)(a.Snowflake,{className:"h-3.5 w-3.5 text-sky-300/80"});case"day":return(0,t.jsx)(a.Sun,{className:"h-3.5 w-3.5 text-yellow-500/80"});case"night":return(0,t.jsx)(a.Moon,{className:"h-3.5 w-3.5 text-indigo-300/80"});case"business":return(0,t.jsx)(a.Briefcase,{className:"h-3.5 w-3.5 text-slate-400/80"});case"elegant":return(0,t.jsx)(a.Gem,{className:"h-3.5 w-3.5 text-amber-300/80"})}},d=[{id:"latest",name:"Latest",icon:(0,t.jsx)(a.Clock,{className:"h-3.5 w-3.5 text-sky-400/80"})},{id:"best",name:"Best",icon:(0,t.jsx)(a.Flame,{className:"h-3.5 w-3.5 text-orange-500/80"})}];function u({tabs:e,activeTabId:n,onTabChange:i,overflowCount:l,className:c}){let[d,p]=r.default.useState(!1),m=e.find(e=>e.id===n)?.name??"All";return(0,t.jsxs)(o.Drawer,{open:d,onOpenChange:p,children:[(0,t.jsx)(o.DrawerTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button","aria-label":"More collections",className:(0,s.cn)("shrink-0 inline-flex items-center justify-center gap-1 h-9 px-2.5 rounded-xl","bg-zinc-950/60 border border-white/5 text-zinc-400","hover:text-zinc-200 hover:border-white/10 transition-colors","active:scale-[0.97]",c),children:[(0,t.jsx)(a.SlidersHorizontal,{className:"h-3.5 w-3.5"}),l>0&&(0,t.jsxs)("span",{className:"text-[10px] font-semibold text-zinc-500",children:["+",l]})]})}),(0,t.jsxs)(o.DrawerContent,{className:"bg-bg-surface/95 backdrop-blur-xl border-t border-white/10",children:[(0,t.jsx)("div",{className:"mx-auto mt-4 h-1 w-[100px] shrink-0 rounded-full bg-white/10"}),(0,t.jsxs)("div",{className:"px-5 pt-4 pb-3 flex flex-col gap-1",children:[(0,t.jsx)(o.DrawerTitle,{className:"text-base font-semibold text-text-primary",children:"Collections"}),(0,t.jsxs)(o.DrawerDescription,{className:"text-xs text-text-muted",children:["Currently viewing:"," ",(0,t.jsx)("span",{className:"text-text-primary font-medium",children:m})]})]}),(0,t.jsx)("nav",{"aria-label":"Collections",className:"flex flex-col gap-1 px-3 pb-[max(1rem,env(safe-area-inset-bottom))] max-h-[70vh] overflow-y-auto scrollbar-thin",children:e.map(e=>{let l=n===e.id;return(0,t.jsxs)("button",{type:"button",onClick:()=>{i(e.id),p(!1)},"aria-pressed":l,className:(0,s.cn)("group relative flex items-center gap-3 min-h-[52px] py-3 pl-3 pr-3.5","rounded-lg text-sm font-medium text-left","transition-colors duration-[var(--motion-fast)] ease-out","active:scale-[0.99] motion-reduce:active:scale-100",l?"bg-bg-hover text-text-primary ring-1 ring-inset ring-white/10 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]":"text-text-muted hover:text-text-secondary hover:bg-white/[0.03]"),children:[(0,t.jsx)("span",{"aria-hidden":!0,
5className:(0,s.cn)("absolute left-0 top-2 bottom-2 w-[2px] rounded-full transition-opacity",l?"bg-accent-rose opacity-100":"opacity-0")}),e.icon&&(0,t.jsx)("span",{className:"flex items-center justify-center shrink-0",children:r.default.isValidElement(e.icon)?r.default.cloneElement(e.icon,{weight:l?"Filled":"Outline"}):e.icon}),(0,t.jsx)("span",{className:"flex-1 truncate",children:e.name}),l&&(0,t.jsx)(a.Check,{"aria-hidden":!0,className:"h-4 w-4 shrink-0 text-accent-rose",strokeWidth:2.5})]},e.id??"all")})})]})]})}e.s(["FilterBar",0,function({activeCollectionId:e,onCollectionChange:n,collections:s,searchQuery:a,onSearchChange:o,sortMode:p,onSortChange:m}){let x=r.default.useMemo(()=>[{id:null,name:"All",icon:c("all")},...s.map(e=>({id:e._id,name:e.name,icon:c(e.name)}))],[s]),g=r.default.useMemo(()=>x.slice(0,5),[x]),h=Math.max(0,x.length-g.length);return(0,t.jsxs)("div",{className:"flex flex-col gap-3 border-t border-white/5 pt-6",children:[(0,t.jsxs)("div",{className:"flex sm:hidden flex-col gap-3 w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 w-full",children:[(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsx)(i,{tabs:g,activeTabId:e,onTabChange:n,layoutIdPrefix:"activeCollectionTab",className:"w-full"})}),h>0&&(0,t.jsx)(u,{tabs:x,activeTabId:e,onTabChange:n,overflowCount:h,className:"flex"})]}),(0,t.jsx)(i,{tabs:d,activeTabId:p,onTabChange:e=>m(e),layoutIdPrefix:"activeSortTab",className:"w-full flex-none *:flex-1"})]}),(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3 w-full",children:[(0,t.jsx)(i,{tabs:x,activeTabId:e,onTabChange:n,layoutIdPrefix:"activeCollectionTab"}),(0,t.jsx)(i,{tabs:d,activeTabId:p,onTabChange:e=>m(e),layoutIdPrefix:"activeSortTab"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)("div",{className:"w-full max-w-sm",children:(0,t.jsx)(l,{value:a,onChange:o,placeholder:"Search presets..."})})]})]})}],70933)},58388,e=>{"use strict";var t=e.i(75214),r=e.i(69960);let n={image:"Image"};function s({className:e}){return(0,t.jsxs)("svg",{"aria-hidden":!0,className:e,width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M7.08339 9.15042C8.17875 9.15042 9.06672 8.26245 9.06672 7.16709C9.06672 6.07172 8.17875 5.18376 7.08339 5.18376C5.98802 5.
518376 5.10006 6.07172 5.10006 7.16709C5.10006 8.26245 5.98802 9.15042 7.08339 9.15042Z",fill:"currentColor"}),(0,t.jsx)("path",{d:"M13.0751 2.16699H6.09173C3.05839 2.16699 1.25006 3.97533 1.25006 7.00866V13.992C1.25006 14.9003 1.40839 15.692 1.71673 16.3587C2.43339 17.942 3.96673 18.8337 6.09173 18.8337H13.0751C16.1084 18.8337 17.9167 17.0253 17.9167 13.992V7.00866C17.9167 3.97533 16.1084 2.16699 13.0751 2.16699ZM16.5584 10.917C15.9084 10.3587 14.8584 10.3587 14.2084 10.917L10.7417 13.892C10.0917 14.4503 9.04173 14.4503 8.39173 13.892L8.10839 13.6587C7.51673 13.142 6.57506 13.092 5.90839 13.542L2.79173 15.6337C2.60839 15.167 2.50006 14.6253 2.50006 13.992V7.00866C2.50006 4.65866 3.74173 3.41699 6.09173 3.41699H13.0751C15.4251 3.41699 16.6667 4.65866 16.6667 7.00866V11.0087L16.5584 10.917Z",fill:"currentColor"})]})}e.s(["PresetHeader",0,function({type:e,presetName:i,presetImageSrc:a,phase:l="idle",className:o}){return(0,t.jsxs)("div",{"data-slot":"creation-preset-header",className:(0,r.cn)("flex items-center gap-2 min-w-0",("queue"===l||"processing"===l||"completed"===l)&&"hidden lg:flex",o),children:[(0,t.jsxs)("div",{className:"flex items-center justify-center gap-1.5 h-8 md:h-9 pl-2 md:pl-4 pr-3 rounded-xl bg-white/[0.04] ring-1 ring-inset ring-border-subtle",children:[(0,t.jsx)(s,{className:"w-4 h-4 md:w-5 md:h-5 text-text-primary"}),(0,t.jsx)("span",{className:"text-sm md:text-base font-medium text-text-primary",children:n[e]})]}),(0,t.jsx)("span",{"aria-hidden":!0,className:"w-px h-4 md:h-6 bg-border-default rounded-full shrink-0"}),(0,t.jsxs)("div",{className:"flex items-center h-9 md:h-11 gap-2 p-1 rounded-xl md:rounded-2xl pr-2 md:pr-3 bg-bg-card ring-1 ring-inset ring-border-subtle min-w-0",children:[a&&(0,t.jsx)("img",{className:"w-7 h-7 rounded-lg object-cover bg-bg-hover shrink-0",alt:"","aria-hidden":!0,src:(0,r.getOptimizedImageUrl)(a,{width:56,height:56})}),(0,t.jsx)("span",{className:"text-xs md:text-sm font-medium text-text-primary whitespace-nowrap truncate",children:i})]})]})}])},48883,e=>{"use strict";var t=e.i(75214),r=e.i(91151),n=e.i(67382),s=e.i(78953),i=e.i(69960),a=e.i(57399),l=e.i(20015);let o=r.forwardRef(function({id:e="prompt",name:o="prompt",value:c,onChange:d,placeholder:u="Describe the look you want…",className:p,label:m="Prompt",rows:x=3,readOnly:g=!1,requirePremium:h=!0,pricingReason:b="See the prompt behind a preset with Pro"},f){let[v,w]=r.useState(!1),[y,j]=r.useState(!1),k=r.useRef(null);r.useEffect(()=>()=>{null!=k.current&&window.clearTimeout(k.current)},[]);let[N,C]=r.useState(!1),_=r.useCallback(()=>C(!0),[]),{limitations:z}=(0,a.usePlanStatus)(),S=h&&!z?.presetPrompts,I=c.length>0&&!g&&!S,U=r.useCallback(async()=>{if(S)return void _();if(!I)return;let e=!1;try{"u">typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(await navigator.clipboard.writeText(c),e=!0)}catch{e=!1}if(!e&&"u">typeof document)try{let t=document.createElement("textarea");t.value=c,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select(),e=document.execCommand("copy"),document.body.removeChild(t)}catch{e=!1}e?(j(!0),null!=k.current&&window.clearTimeout(k.current),k.current=window.setTimeout(()=>{j(!1),k.current=null},1400),s.toast.success("Prompt copied to clipboard")):s.toast.error("Couldn't copy prompt")},[I,c,S,_]);return(0,t.jsxs)("div",{"data-slot":"creation-prompt-editor","data-focused":v||void 0,"data-locked":S||void 0,className:(0,i.cn)("p-px rounded-2xl","bg-[image:var(--background-image-gradient-prompt-border)]","transition-[background-image,box-shadow] duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)]","data-[focused]:bg-[image:var(--background-image-gradient-prompt-border-active)]","data-[focused]:shadow-[0_0_0_3px_oklch(64%_0.20_10/0.10)]",p),children:[(0,t.jsxs)("div",{className:"relative rounded-[15px] bg-bg-card p-4 pt-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 pb-3",children:[(0,t.jsx)("label",{htmlFor:e,className:"font-semibold flex items-center gap-2 text-text-primary",children:m}),(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",onClick:U,disabled:!I,"aria-label":y?"Prompt copied":S?"Unlock to copy prompt":"Copy prompt",title:y?"Copied":S?"Unlock to copy":"Copy prompt","data-copied":y||void 0,className:(0,i.cn)("group/cp inline-flex items-center gap-1.5 h-7 px-2 rounded-lg","bg-white/[0.04] text-text-secondary","ring-1 ring-inset ring-border-subtle","text-[11px] font-semibold cursor-pointer","transition-all duration-[var(--motion-fast)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-white/[0.08] hover:text-text-primary hover:ring-border-default","active:scale-[var(--scale-press)]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","data-[copied]:text-accent-rose data-[copied]:ring-accent-rose/40 data-[copied]:bg-accent-rose-soft/30","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-white/[0.04] disabled:hover:text-text-secondary","motion-reduce:transition-none motion-reduce:transform-none"),children:[y?(0,t.jsx)(n.Check,{className:"size-3.5","aria-hidden":!0}):(0,t.jsx)(n.Copy,{className:"size-3.5","aria-hidden":!0}),(0,t.jsx)("span",{children:y?"Copied":"Copy"})]})]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("textarea",{suppressHydrationWarning:!0,ref:f,id:e,name:o,value:c,onChange:e=>d(e.target.value),onFocus:()=>w(!0),onBlur:()=>w(!1),placeholder:u,readOnly:g||S,"aria-hidden":S||void 0,tabIndex:S?-1:void 0,rows:x,className:(0,i.cn)("w-full outline-none text-xs font-medium text-text-primary bg-transparent resize-none","min-h-15 leading-relaxed","placeholder:text-text-muted",(g||S)&&"cursor-default",S&&"blur-[3px] select-none")}),S&&(0,t.jsx)("button",{suppressHydrationWarning:!0,type:"button",onClick:_,"aria-label":b,className:(0,i.cn)("group/lock absolute inset-0 z-10 flex items-center justify-center","rounded-[10px] cursor-pointer","bg-bg-card/60 backdrop-blur-md","transition-colors duration-[var(--motion-base)]","hover:bg-bg-card/75","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","motion-reduce:transition-none"),children:(0,t.jsxs)("span",{className:(0,i.cn)("inline-flex items-center gap-1.5 h-8 px-3.5 rounded-full","bg-bg-base/80 text-text-primary","ring-1 ring-inset ring-border-default","text-[11px] font-semibold","backdrop-blur-sm","transition-all duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)]","group-hover/lock:ring-text-primary/40 group-hover/lock:-translate-y-
5px","motion-reduce:transform-none"),children:[(0,t.jsx)(n.Lock,{className:"size-3","aria-hidden":!0}),"Unlock with Pro"]})})]})]}),(0,t.jsx)(l.PricingDialog,{open:N,onOpenChange:C,reason:"See the prompt behind any preset with Pro"})]})});e.s(["PromptEditor",0,o])},51291,e=>{"use strict";var t=e.i(75214),r=e.i(67382),n=e.i(69960);function s({action:e}){return(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",onClick:e.onClick,disabled:e.disabled,className:(0,n.cn)("group/sa flex items-center gap-1.5 md:gap-2","h-9 md:h-11 px-3 md:px-4 rounded-[30px] md:rounded-[40px]","bg-white/[0.04] text-text-primary","ring-1 ring-inset ring-border-subtle","backdrop-blur-sm cursor-pointer font-bold text-xs md:text-sm","transition-all duration-[var(--motion-fast)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-white/[0.08] hover:ring-border-default hover:-translate-y-px","active:translate-y-0 active:scale-[var(--scale-press)]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0","motion-reduce:transition-none motion-reduce:transform-none"),children:[(0,t.jsx)("span",{className:"text-text-secondary group-hover/sa:text-text-primary transition-colors",children:e.icon}),e.label]})}function i({action:e}){return(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",onClick:e.onClick,disabled:e.disabled,"data-prominent":"true",className:(0,n.cn)("group/sa relative inline-flex items-center gap-2 md:gap-2.5","h-10 md:h-12 pl-3.5 pr-3 md:pl-4 md:pr-3.5 rounded-full","cursor-pointer font-semibold text-xs md:text-sm","bg-accent-rose-soft/40 text-text-primary","ring-1 ring-inset ring-accent-rose/40","shadow-[inset_0_1px_0_oklch(100%_0_0/0.06)]","transition-all duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-[image:var(--background-image-gradient-cta-hover)] hover:text-white","hover:ring-accent-rose/60","hover:shadow-[0_8px_28px_-6px_oklch(64%_0.20_10/0.55),inset_0_1px_0_oklch(100%_0_0/0.2)]","hover:-translate-y-px","active:translate-y-0 active:scale-[var(--scale-press)]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0","motion-reduce:transition-none motion-reduce:transform-none"),children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"inline-flex items-center justify-center text-accent-rose group-hover/sa:text-white transition-colors",children:e.icon}),(0,t.jsx)("span",{className:"whitespace-nowrap tracking-tight",children:e.label}),(0,t.jsx)("span",{"aria-hidden":!0,className:"inline-flex size-5 items-center justify-center rounded-full bg-bg-base/60 ring-1 ring-inset ring-accent-rose/30 text-accent-rose group-hover/sa:bg-white/15 group-hover/sa:text-white group-hover/sa:ring-white/30 transition-colors",children:(0,t.jsx)(r.Lock,{className:"size-2.5"})}),(0,t.jsx)("svg",{"aria-hidden":!0,className:"size-3.5 -mr-0.5 text-text-secondary group-hover/sa:text-white transition-all duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)] group-hover/sa:translate-x-0.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M5 12h14m0 0-5-5m5 5-5 5"})})]})}e.s(["CopyPromptIcon",0,function({className:e}){return(0,t.jsxs)("svg",{"aria-hidden":!0,className:e??"w-4 h-4 md:w-5 md:h-5",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5",stroke:"currentColor",strokeWidth:"1.4"}),(0,t.jsx)("path",{d:"M3 11V3.5A1.5 1.5 0 0 1 4.5 2H10",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})},"EditStyleIcon",0,function({className:e}){return(0,t.jsxs)("svg",{"aria-hidden":!0,className:e??"w-4 h-4 md:w-5 md:h-5",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M14.5397 2.62658C13.513 5.18658 10.9397 8.66658 8.78635 10.3933L7.47302 11.4466C7.30635 11.5666 7.13969 11.6733 6.95302 11.7466C6.95302 11.6266 6.94635 11.4933 6.92635 11.3666C6.85302 10.8066 6.59969 10.2866 6.15302 9.83992C5.69969 9.38658 5.14635 9.11992 4.57969 9.04658C4.44635 9.03992 4.31302 9.02658 4.17969 9.03992C4.25302 8.83325 4.36635 8.63992 4.50635 8.47992L5.54635 7.16658C7.26635 5.01325 10.7597 2.42658 13.313 1.40658C13.7064 1.25992 14.0864 1.36658 14.3264 1.61325C14.5797 1.85992 14.6997 2.23992 14.5397 2.62658Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsx)("path",{d:"M6.95319 11.7465C6.95319 12.4799 6.67319 13.1799 6.14652 13.7132C5.73986 14.1199 5.18652 14.3999 4.52652 14.4865L2.88652 14.6665C1.99319 14.7665 1.22652 14.0065 1.33319 13.0999L1.51319 11.4599C1.67319 9.99987 2.89319 9.06654 4.18652 9.03987C4.31986 9.0332 4.4598
56 9.03987 4.58652 9.04654C5.15319 9.11987 5.70652 9.37987 6.15986 9.83987C6.60652 10.2865 6.85986 10.8065 6.93319 11.3665C6.93986 11.4932 6.95319 11.6199 6.95319 11.7465Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsx)("path",{d:"M9.49318 9.6465C9.49318 7.9065 8.07984 6.49316 6.33984 6.49316",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})},"ShareStyleIcon",0,function({className:e}){return(0,t.jsx)("svg",{"aria-hidden":!0,className:e??"w-4 h-4 md:w-5 md:h-5",width:"15",height:"13",viewBox:"0 0 15 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M7.89905 0.699707C8.45674 0.699707 8.82653 0.960304 9.18616 1.28662L13.5719 5.25439L13.5758 5.2583C13.9381 5.59074 14.1002 5.9969 14.1002 6.3999C14.1002 6.79833 13.93 7.21303 13.5748 7.53857L13.5729 7.53955L9.18909 11.5386L9.18713 11.5396C8.82239 11.8707 8.42269 12.1001 7.89026 12.1001C7.1012 12.1001 6.44511 11.5017 6.44495 10.6821V9.46143C5.76646 9.50609 5.23827 9.63608 4.8092 9.85303C4.28173 10.1197 3.84506 10.5472 3.46155 11.2427H3.46057C3.30061 11.532 3.08918 11.759 2.81799 11.9038C2.55154 12.046 2.28605 12.0776 2.07581 12.0776C1.64843 12.0775 1.27229 11.873 1.026 11.5298C0.793479 11.2057 0.699829 10.7963 0.699829 10.3735C0.699847 8.32798 1.16087 6.56488 2.22913 5.3042C3.21454 4.14138 4.63979 3.49739 6.44495 3.38818V2.14111C6.44495 1.3446 7.07736 0.699823 7.89905 0.699707Z",stroke:"currentColor",strokeWidth:"1.4"})})},"StyleActions",0,function({actions:e,className:r}){return 0===e.length?null:(0,t.jsx)("div",{"data-slot":"creation-style-actions",className:(0,n.cn)("flex items-center gap-2.5 flex-wrap",r),children:e.map(e=>e.prominent?(0,t.jsx)(i,{action:e},e.id):(0,t.jsx)(s,{action:e},e.id))})}])},9091,e=>{"use strict";var t=e.i(75214),r=e.i(91151),n=e.i(67382),s=e.i(69960);function i({variant:e,state:r,previewUrl:n,filename:s,fileSize:o,source:c="upload",label:d,description:u,ctaLabel:p,onPick:m,onRemove:x,className:g}){return"filled"===r?(0,t.jsx)(l,{variant:e,previewUrl:n,filename:s??"",fileSize:o??0,source:c,onReplace:m,onRemove:x,className:g}):(0,t.jsx)(a,{variant:e,label:d,description:u,ctaLabel:p,onPick:m,className:g})}function a({variant:e,label:r,description:i,ctaLabel:l,onPick:o,className:c}){return"compact"===e?(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",onClick:o,"aria-label":r,title:i??r,className:(0,s.cn)("group/empty relative w-full aspect-square flex flex-col items-center justify-center gap-1.5","rounded-xl bg-bg-card","border-2 border-dashed border-border-default","cursor-pointer","transition-all duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-bg-hover hover:border-text-muted hover:-translate-y-px","active:translate-y-0 active:scale-[var(--scale-press)]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","motion-reduce:transition-none motion-reduce:transform-none",c),children:[(0,t.jsx)(n.ImagePlus,{className:"size-5 text-text-secondary transition-colors group-hover/empty:text-accent-rose","aria-hidden":!0}),(0,t.jsx)("p",{className:"text-[11px] font-semibold text-text-secondary leading-tight px-1 text-center line-clamp-2",children:r})]}):(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",onClick:o,className:(0,s.cn)("group/empty relative w-full flex flex-col items-center justify-center gap-2.5 sm:gap-3","rounded-2xl bg-bg-card p-4 sm:p-7","border-2 border-dashed border-border-default","text-center cursor-pointer","transition-all duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-bg-hover hover:border-text-muted hover:-translate-y-px","active:translate-y-0 active:scale-[var(--scale-press)]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","motion-reduce:transition-none motion-reduce:transform-none",c),children:[(0,t.jsx)("div",{className:"flex h-9 w-9 sm:h-10 sm:w-10 items-center justify-center rounded-full bg-bg-hover ring-1 ring-inset ring-border-subtle transition-colors group-hover/empty:bg-bg-card",children:(0,t.jsx)(n.ImagePlus,{className:"size-4 sm:size-5 text-text-primary","aria-hidden":!0})}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-text-primary leading-snug",children:r}),i&&(0,t.jsx)("p",{className:"text-xs text-text-secondary leading-relaxed max-w-[28ch] mx-auto",children:i})]}),(0,t.jsx)("span",{className:(0,s.cn)("inline-flex items-center gap-1.5 px-3.5 h-9 rounded-full","bg-white/[0.06] ring-1 ring-inset ring-border-subtle","text-xs font-semibold text-text-primary","transition-all duration-[var(--motion-fast)] ease-[cubic-bezier(0.23,1,0.32,1)]","group-hover/empty:bg-white/[0.10] group-hover/empty:ring-border-default"),children:l})]})}function l({variant:e,previewUrl:r,filename:i,fileSize:a,source:o,onReplace:c,onRemove:d,className:u}){let p="library"===o;return"compact"===e?(0,t.jsxs)("div",{className:(0,s.cn)("group/pv relative w-full aspect-square overflow-hidden rounded-xl","ring-1 ring-inset ring-border-default","bg-bg-card cursor-pointer","transition-all duration-[var(--motion-fast)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:ring-border-default active:scale-[var(--scale-press)]","focus-within:ring-2 focus-within:ring-ring/60","motion-reduce:transition-none motion-reduce:transform-none",u),children:[(0,t.jsx)("button",{suppressHydrationWarning:!0,type:"button",onClick:c,"aria-label":p?`Replace ${i} (from library)`:`Replace ${i}`,className:"absolute inset-0 w-full h-full",children:(0,t.jsx)("img",{src:r,alt:i,className:"w-full h-full object-cover"})}
5),p&&(0,t.jsxs)("span",{"aria-hidden":!0,className:"absolute top-1.5 left-1.5 inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md bg-black/65 backdrop-blur-md ring-1 ring-inset ring-white/15 text-[9px] font-semibold uppercase tracking-wide text-white/90",children:[(0,t.jsx)("span",{className:"size-1 rounded-full bg-accent-rose"}),"Library"]}),d&&(0,t.jsx)("button",{suppressHydrationWarning:!0,type:"button",onClick:e=>{e.stopPropagation(),d()},"aria-label":`Remove ${i}`,className:(0,s.cn)("absolute top-1.5 right-1.5","inline-flex size-6 items-center justify-center rounded-full","bg-black/65 backdrop-blur-md text-white","ring-1 ring-inset ring-white/15","transition-all duration-[var(--motion-fast)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-red-500/85 hover:ring-red-300/40 active:scale-95","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60"),children:(0,t.jsx)(n.X,{className:"size-3","aria-hidden":!0})})]}):(0,t.jsxs)("div",{className:(0,s.cn)("group/pv relative w-full aspect-square overflow-hidden rounded-2xl","ring-1 ring-inset ring-border-default","bg-bg-card","shadow-[0_4px_20px_-4px_oklch(4%_0.01_280/0.45)]",u),children:[(0,t.jsxs)("div",{"aria-hidden":!0,className:"absolute inset-0 overflow-hidden",children:[(0,t.jsx)("img",{src:r,alt:"",className:(0,s.cn)("absolute inset-0 w-full h-full object-cover scale-125","saturate-150","blur-2xl","opacity-70")}),(0,t.jsx)("div",{className:(0,s.cn)("absolute inset-0","bg-gradient-to-b from-black/35 via-black/10 to-black/55")})]}),(0,t.jsx)("div",{className:"absolute inset-3 sm:inset-4",children:(0,t.jsx)("img",{src:r,alt:i,className:"w-full h-full object-cover rounded-xl ring-1 ring-inset ring-white/10 shadow-[0_8px_32px_-4px_oklch(4%_0.01_280/0.55)]"})}),(0,t.jsxs)("div",{className:"absolute top-3 left-3 right-3 flex items-center gap-2",children:[(0,t.jsxs)("div",{className:(0,s.cn)("flex-1 min-w-0 px-2.5 py-1.5 rounded-lg","bg-black/55 backdrop-blur-md ring-1 ring-inset ring-white/10","flex items-center gap-2"),children:[(0,t.jsx)("span",{className:"size-1.5 rounded-full bg-accent-rose shrink-0","aria-hidden":!0}),(0,t.jsx)("p",{className:"text-[11px] text-white font-medium truncate",children:i}),p?(0,t.jsx)("span",{className:"ml-auto shrink-0 inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md bg-accent-rose/20 ring-1 ring-inset ring-accent-rose/30 text-[9px] font-semibold uppercase tracking-wide text-white/90",children:"Library"}):(0,t.jsx)("span",{className:"text-[10px] text-white/70 font-medium tabular-nums ml-auto shrink-0",children:a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(2)} MB`})]}),d&&(0,t.jsx)("button",{suppressHydrationWarning:!0,type:"button",onClick:e=>{e.stopPropagation(),d()},"aria-label":"Remove image",className:(0,s.cn)("inline-flex size-8 items-center justify-center rounded-lg","bg-black/55 backdrop-blur-md text-white","ring-1 ring-inset ring-white/10","transition-all duration-[var(--motion-fast)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-red-500/80 hover:ring-red-300/30 active:scale-95","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60"),children:(0,t.jsx)(n.Trash2,{className:"size-3.5","aria-hidden":!0})})]}),(0,t.jsx)("div",{className:"absolute bottom-3 left-3 right-3",children:(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",onClick:c,className:(0,s.cn)("w-full inline-flex items-center justify-center gap-1.5 h-9 px-3","rounded-xl text-xs font-semibold text-white","bg-black/55 backdrop-blur-md ring-1 ring-inset ring-white/10","transition-all duration-[var(--motion-fast)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-black/70 hover:ring-white/20 active:scale-[var(--scale-press)]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60"),children:[(0,t.jsx)(n.ImagePlus,{className:"size-3.5","aria-hidden":!0}),"Replace image"]})})]})}e.i(15351);var o=e.i(14930);let c=["image/jpeg","image/png","image/webp","image/gif"],d={woman:"Woman",man:"Man",kid:"Kid"},u={woman:"Clear, front-facing photo of the woman",man:"Clear, front-facing photo of the man",kid:"Clear, front-facing photo of the kid"},p=0;function m(){return(p+=1,"u">typeof crypto&&"function"==typeof crypto.randomUUID)?`avatar-${crypto.randomUUID()}`:`avatar-${Date.now()}-${p}`}function x(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(2)} MB`}
5function g(e){return null!=e.file||null!=e.sourceUrl}e.s(["AvatarUploader",0,function({initialAvatars:e,value:a,onChange:l,maxTotal:p=6,maxPerRow:h=3,maxFileSize:b=0xa00000,acceptedTypes:f=c,className:v}){let w,y=void 0!==a,[j,k]=r.useState(()=>e.map(e=>({id:m(),type:e,file:null,previewUrl:null,sourceUrl:null,filename:"",fileSize:0,source:"upload"}))),N=y?a:j;r.useEffect(()=>()=>{N.forEach(e=>{e.file&&e.previewUrl&&URL.revokeObjectURL(e.previewUrl)})},[]);let C=r.useCallback(e=>{y?l?.(e(a)):k(t=>e(t))},[y,l,a]),_=r.useRef(new Map),[z,S]=r.useState(null),I=r.useRef(null),U=r.useRef(new Map),L=r.useRef(null),M=r.useRef(null),R=r.useRef(null),E=r.useCallback((e,t,r=null)=>{let n=U.current.get(e);n&&(L.current=n),M.current=t,R.current=r,I.current=e,S(e)},[]),P=r.useCallback(()=>{S(null),I.current=null,M.current=null,R.current=null},[]),A=r.useCallback(e=>{_.current.get(e)?.click()},[]),[W,$]=r.useState(null),D=r.useCallback(e=>e.size>b?`Image is too large (${x(e.size)}). Max ${x(b)}.`:f.includes(e.type)?null:`Unsupported format. Use ${f.map(e=>e.replace("image/","")).join(", ")}.`,[b,f]),T=r.useCallback((e,t)=>{let r=D(t);r?$(r):($(null),C(r=>r.map(r=>r.id!==e?r:(r.file&&r.previewUrl&&URL.revokeObjectURL(r.previewUrl),{...r,file:t,previewUrl:URL.createObjectURL(t),sourceUrl:null,filename:t.name,fileSize:t.size,source:"upload"}))))},[D,C]),H=r.useCallback((e,t)=>{let r=D(t);r?$(r):($(null),C(r=>[...r,{id:m(),type:e,file:t,previewUrl:URL.createObjectURL(t),sourceUrl:null,filename:t.name,fileSize:t.size,source:"upload"}]))},[D,C]),F=r.useCallback((e,t)=>{$(null),C(r=>r.map(r=>r.id!==e?r:(r.file&&r.previewUrl&&URL.revokeObjectURL(r.previewUrl),{...r,file:null,previewUrl:t.url,sourceUrl:t.url,filename:t.filename,fileSize:0,source:"library"})))},[C]),B=r.useCallback((e,t)=>{$(null),C(r=>[...r,{id:m(),type:e,file:null,previewUrl:t.url,sourceUrl:t.url,filename:t.filename,fileSize:0,source:"library"}])},[C]),O=r.useCallback(e=>{let t=I.current,r=M.current,n=R.current;t&&r&&(e instanceof File?"reset"===r?H(n,e):T(t,e):"reset"===r?B(n,e):F(t,e)),P()},[T,H,B,F,P]),q=r.useCallback(e=>{$(null),C(t=>{let r=t.filter(t=>t.id!==e),n=t.find(t=>t.id===e);return n?.file&&n.previewUrl&&URL.revokeObjectURL(n.previewUrl),r})},[C]),G=N.length<p,V=N.length>0&&N.every(g),X=0===N.length,K=V&&G,Z=Math.min(X?e.length:N.length+ +!!K,h);return(0,t.jsxs)("div",{className:(0,s.cn)("flex flex-col gap-2.5",v),children:[N.map(e=>(0,t.jsx)("input",{suppressHydrationWarning:!0,ref:t=>{t?_.current.set(e.id,t):_.current.delete(e.id)},type:"file",accept:f.join(","),className:"sr-only",onChange:t=>{let r=t.target.files?.[0];r&&T(e.id,r),t.target.value=""}},e.id)),W&&(0,t.jsxs)("div",{role:"alert",className:"flex items-start gap-2 px-3 py-2 rounded-xl bg-[oklch(64%_0.20_10/0.10)] ring-1 ring-inset ring-[oklch(64%_0.20_10/0.30)] text-[oklch(80%_0.14_10)]",children:[(0,t.jsx)(n.AlertCircle,{className:"size-3.5 mt-0.5 shrink-0","aria-hidden":!0}),(0,t.jsx)("p",{className:"text-xs font-medium leading-snug flex-1",children:W}),(0,t.jsx)("button",{suppressHydrationWarning:!0,type:"button",onClick:()=>$(null),"aria-label":"Dismiss error",className:"shrink-0 -m-1 p-1 rounded text-[oklch(80%_0.14_10/0.70)] hover:text-[oklch(88%_0.10_10)] transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[oklch(64%_0.20_10/0.50)]",children:(0,t.jsx)(n.X,{className:"size-3","aria-hidden":!0})})]}),(0,t.jsxs)("div",{className:"grid gap-2.5",style:{gridTemplateColumns:`repeat(${Z}, minmax(0, 1fr))`},children:[X?e.map((e,r)=>{let n=`__reset_${r}__`,s=null!=e?d[e]:null,a=s?`Add ${s.toLowerCase()}`:`Add photo ${r+1}`,l=s?u[e]:"Add a clear, front-facing photo.";return(0,t.jsxs)("div",{ref:e=>{e?U.current.set(n,e):U.current.delete(n)},children:[(0,t.jsx)("input",{suppressHydrationWarning:!0,ref:e=>{e?_.current.set(n,e):_.current.delete(n)},type:"file",accept:f.join(","),className:"sr-only",onChange:t=>{let r=t.target.files?.[0];r&&H(e,r),t.target.value=""}}),(0,t.jsx)(i,{variant:"full",state:"empty",previewUrl:null,label:a,description:l,ctaLabel:s?`Add ${s}`:"Choose Image",onPick:()=>E(n,"reset",e)})]},n)}):N.map(e=>{let r=g(e),n=null!=e.type?d[e.type]:null,s=r?n??"Person":n?`Add ${n.toLowerCase()}`:"Add photo",a=n?u[e.type]:"Add a clear, front-facing photo.";return(0,t.jsx)("div",{ref:t=>{t?U.current.set(e.id,t):U.current.delete(e.id)},children:(0,t.jsx)(i,{variant:r?"compact":"full",state:r?"filled":"empty",previewUrl:e.previewUrl,filename:e.filename,fileSize:e.fileSize,source:e.source,label:s,description:a,ctaLabel:r?"Replace":n?`Add ${n}`:"Add photo",onPick:r?()=>A(e.id):()=>E(e.id,"entry"),onRemove:r?()=>q(e.id):void 0})},e.id)}),K&&(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",ref:e=>{e?U.current.set("__add__",e):U.current.delete("__add__")},onClick:()=>E("__add__","reset",null),className:(0,s.cn)("group/add relative w-full aspect-square flex flex-col items-center justify-center gap-1.5","rounded-xl bg-bg-card","border-2 border-dashed border-border-subtle","cursor-pointer","transition-all duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-bg-hover hover:border-text-muted hover:-translate-y-
5px","active:translate-y-0 active:scale-[var(--scale-press)]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","motion-reduce:transition-none motion-reduce:transform-none"),"aria-label":"Add another photo",children:[(0,t.jsx)(n.Plus,{className:"size-5 text-text-secondary transition-colors group-hover/add:text-accent-rose","aria-hidden":!0}),(0,t.jsx)("p",{className:"text-[11px] font-semibold text-text-secondary leading-tight px-1 text-center",children:"Add photo"})]})]}),(0,t.jsx)(o.AssetManager,{open:null!==z,selectedValue:(w=N.find(e=>e.id===z),w?.previewUrl||w?.sourceUrl||void 0),onOpenChange:e=>{e||P()},onPick:O,anchorRef:L})]})}],9091)},39367,e=>{"use strict";var t=e.i(75214),r=e.i(91151),n=e.i(67382),s=e.i(69960),i=e.i(34506);function a({presetImageSrc:e,elapsedMs:n,chainRetriedAt:i,phase:l,className:o}){let c="queue"===l,d=r.useMemo(()=>(0,s.getOptimizedImageUrl)(e,{width:900,quality:70}),[e]),u=r.useRef(null),p=r.useMemo(()=>{let e=Math.floor((n||0)/1e3);return i&&Date.now()-i<3e4?{kind:"retry",body:"The first model was at capacity. We've just retried with a faster one — hang tight, results usually land within a minute."}:e<5?{kind:"fresh",body:"Running in the background. Feel free to explore more presets while it works."}:e<12?{kind:"tip",body:"Tip — you can keep generating more presets in parallel; everything is saved to your gallery when it lands."}:e<25?{kind:"tip",body:"Most presets finish in 10–30 seconds. The longer it runs, the more refined the result tends to be."}:{kind:"tip",body:"Still going. You can leave this dialog — we'll keep the generation running and you'll see it in your gallery."}},[n,i]);return(0,t.jsxs)("div",{"data-slot":"generating-panel-inflight","aria-live":"polite","aria-busy":"true",className:(0,s.cn)("relative w-full overflow-hidden rounded-2xl isolate","ring-1 ring-inset ring-border-subtle","bg-bg-card",o),style:{aspectRatio:"2 / 3",background:"radial-gradient(120% 80% at 50% 0%, oklch(20% 0.04 16) 0%, oklch(11% 0.018 280) 60%, oklch(7% 0.015 280) 100%)"},children:[!c&&d&&(0,t.jsx)("img",{ref:u,src:d,alt:"","aria-hidden":!0,className:"absolute inset-0 size-full object-cover scale-110",style:{filter:"blur(36px) saturate(1.1) brightness(0.85)"}}),!c&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"aria-hidden":!0,className:"gen-glow-a motion-reduce:animate-none absolute inset-0 pointer-events-none",style:{background:"radial-gradient(45% 35% at 30% 70%, oklch(64% 0.20 10 / 0.55) 0%, oklch(64% 0.20 10 / 0.18) 40%, transparent 70%)",mixBlendMode:"screen",filter:"blur(20px)"}}),(0,t.jsx)("div",{"aria-hidden":!0,className:"gen-glow-b motion-reduce:animate-none absolute inset-0 pointer-events-none",style:{background:"radial-gradient(40% 32% at 70% 30%, oklch(68% 0.19 78 / 0.45) 0%, oklch(68% 0.19 78 / 0.12) 40%, transparent 70%)",mixBlendMode:"screen",filter:"blur(24px)"}})]}),(0,t.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 top-0 h-1/3 bg-gradient-to-b from-bg-base/55 to-transparent"}),(0,t.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 bottom-0 h-2/3 bg-gradient-to-t from-bg-base to-transparent"}),(0,t.jsx)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-10",children:(0,t.jsxs)("div",{className:"flex items-center gap-1.5 h-6 px-2.5 rounded-full ring-1 ring-inset ring-white/15",style:{background:"linear-gradient(135deg, oklch(64% 0.20 10 / 0.4) 0%, oklch(68% 0.19 78 / 0.3) 100%)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",boxShadow:"0 4px 12px -2px oklch(0% 0 0 / 0.3)"},children:[c?(0,t.jsx)("span",{"aria-hidden":!0,className:"size-1.5 rounded-full bg-white/70"}):(0,t.jsx)("span",{"aria-hidden":!0,className:"size-1.5 rounded-full bg-white shadow-[0_0_6px_1px_oklch(100%_0_0/0.7)] gen-pulse motion-reduce:animate-none"}),(0,t.jsx)("span",{className:"text-[10.5px] font-semibold uppercase tracking-wider text-white",children:c?"Submitting":"Creating"})]})}),(0,t.jsx)("div",{"data-slot":"generating-panel-tip",className:"absolute inset-x-0 bottom-0 z-10 px-5 sm:px-7 pb-5 sm:pb-6 flex flex-col items-center text-center gap-2",children:c?(0,t.jsx)("p",{className:"gen-tip-fade motion-reduce:animate-none max-w-[28ch] text-[12.5px] sm:text-[13px] leading-snug text-text-secondary",children:"Submitting your request…"}):(0,t.jsx)("p",{className:"gen-tip-fade motion-reduce:animate-none max-w-[28ch] text-[12.5px] sm:text-[13px] leading-snug text-text-secondary",children:p.body},p.body)})]})}function l({resultSrc:e,generationId:i,onDownload:a,onExplore:o,onViewGallery:c,onForceClose:d,className:u}){let[p,m]=r.useState(null),x=r.useMemo(()=>
5{if(!p)return;let e=Math.min(Math.max(p.w/p.h,.45),1.9);return{aspectRatio:`${e}`}},[p]),g=r.useRef(null);return r.useEffect(()=>{if(p)return;let e=g.current;e&&e.complete&&e.naturalWidth&&e.naturalHeight&&m({w:e.naturalWidth,h:e.naturalHeight})},[e,p]),(0,t.jsxs)("div",{"data-slot":"generating-panel-completed",className:(0,s.cn)("relative w-full overflow-hidden rounded-2xl isolate","bg-bg-card","ring-1 ring-inset ring-accent-rose/30","shadow-[0_12px_44px_-14px_oklch(64%_0.20_10/0.4),inset_0_1px_0_oklch(100%_0_0/0.05)]",u),children:[(0,t.jsxs)("div",{className:"relative w-full overflow-hidden",style:{...x??{aspectRatio:"2 / 3"},background:"radial-gradient(120% 80% at 50% 0%, oklch(20% 0.04 16) 0%, oklch(11% 0.018 280) 60%, oklch(7% 0.015 280) 100%)"},children:[(0,t.jsx)("img",{ref:g,src:e,alt:"Generated image",loading:"lazy",className:"gen-result-reveal motion-reduce:animate-none absolute inset-0 size-full object-contain"}),(0,t.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-1.5 rounded-xl ring-1 ring-inset ring-accent-rose/20"})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-3 border-t border-border-subtle/40",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-text-primary truncate",children:"Ready to download"}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[o&&(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",onClick:()=>{d?.(),o?.()},className:(0,s.cn)("inline-flex items-center gap-1 h-7 px-2 rounded-full","text-text-secondary font-medium text-[11.5px]","hover:text-text-primary hover:bg-white/[0.04]","transition-colors duration-[var(--motion-fast)]"),children:[(0,t.jsx)(n.Compass,{className:"size-3"}),"Explore"]}),c&&(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",onClick:()=>{d?.(),c?.()},className:(0,s.cn)("inline-flex items-center gap-1 h-7 px-2 rounded-full","text-text-secondary font-medium text-[11.5px]","hover:text-text-primary hover:bg-white/[0.04]","transition-colors duration-[var(--motion-fast)]"),children:[(0,t.jsx)(n.Images,{className:"size-3"}),"Gallery"]}),i&&(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",onClick:()=>a(i),className:(0,s.cn)("group/dl relative ml-1 inline-flex items-center gap-1.5 h-8 pl-3 pr-2.5 rounded-full font-semibold text-xs text-white","bg-[image:var(--background-image-gradient-cta)]","shadow-[0_4px_14px_-2px_oklch(64%_0.20_10/0.45)]","transition-all duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-[image:var(--background-image-gradient-cta-hover)] hover:-translate-y-px hover:shadow-[0_8px_24px_-4px_oklch(64%_0.20_10/0.55)]","active:translate-y-0 active:scale-[var(--scale-press)]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","cta-shine overflow-hidden isolate"),children:[(0,t.jsx)(n.Download,{className:"size-3.5"}),"Download",(0,t.jsx)(n.ArrowRight,{className:"size-3 -mr-0.5 transition-transform duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)] group-hover/dl:translate-x-0.5"})]})]})]})]})}function o({presetImageSrc:e,errorMessage:i,className:a}){let l=r.useMemo(()=>(0,s.getOptimizedImageUrl)(e,{width:96,height:96,quality:60}),[e]);return(0,t.jsxs)("div",{"data-slot":"generating-panel-failed",role:"alert",className:(0,s.cn)("relative flex items-center gap-3 p-3 rounded-2xl","bg-bg-card","ring-1 ring-inset ring-border-default",a),children:[(0,t.jsxs)("div",{className:"relative size-11 shrink-0 rounded-xl overflow-hidden ring-1 ring-inset ring-border-subtle bg-bg-muted",children:[l&&(0,t.jsx)("img",{src:l,alt:"",className:"size-full object-cover opacity-50 grayscale"}),(0,t.jsx)("div",{"aria-hidden":!0,className:"absolute inset-0",style:{background:"linear-gradient(135deg, oklch(45% 0.18 25 / 0.6) 0%, oklch(35% 0.15 10 / 0.7) 100%)"}}),(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,t.jsx)(n.TriangleAlert,{className:"size-4 text-white drop-shadow-[0_1px_2px_oklch(0%_0_0/0.5)]",strokeWidth:2.5})})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-text-primary",children:"Couldn’t generate"}),i&&(0,t.jsx)("p",{className:"text-[11.5px] text-text-secondary mt-0.5 line-clamp-2",children:i})]}
5),(0,t.jsx)("span",{"aria-hidden":!0,className:"shrink-0 inline-flex items-center justify-center size-6 rounded-full bg-white/[0.04] text-text-muted",children:(0,t.jsx)(n.X,{className:"size-3"})})]})}e.s(["GeneratingPanel",0,function({phase:e,presetImageSrc:r,resultImageSrc:n,errorMessage:s,generationId:c,elapsedMs:d,chainRetriedAt:u,onExplore:p,onViewGallery:m,onForceClose:x,className:g}){let h=n||r;return"queue"===e||"processing"===e?(0,t.jsx)(a,{presetImageSrc:r,elapsedMs:d,chainRetriedAt:u,phase:e,className:g}):"completed"===e?(0,t.jsx)(l,{resultSrc:h,generationId:c,onDownload:i.triggerDownload,onExplore:p,onViewGallery:m,onForceClose:x,className:g}):"failed"===e?(0,t.jsx)(o,{presetImageSrc:r,errorMessage:s,className:g}):null}])},2696,e=>{"use strict";var t=e.i(75214),r=e.i(91151),n=e.i(69960);function s({className:e}){return(0,t.jsxs)("svg",{"aria-hidden":!0,className:(0,n.cn)("size-4 animate-spin motion-reduce:animate-none",e),viewBox:"0 0 24 24",fill:"none",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"2.5"}),(0,t.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]})}e.s(["DefaultShortcutHint",0,function(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("kbd",{className:"font-sans",children:"Ctrl"}),(0,t.jsx)("kbd",{className:"font-sans",children:"↵"})]})},"GenerateBar",0,function({cost:e,costLabel:i,generateLabel:a="Generate",onGenerate:l,onCancel:o,generating:c=!1,elapsedMs:d,shortcutHint:u,className:p,disabled:m=!1}){let[x,g]=r.useState(0),h=r.useRef(null),b=r.useRef(null),f=d??x;r.useEffect(()=>{if(null!=d)return;if(!c){h.current=null,g(0),null!=b.current&&(cancelAnimationFrame(b.current),b.current=null);return}h.current=Date.now(),g(0);let e=()=>{null!=h.current&&(g(Date.now()-h.current),b.current=requestAnimationFrame(e))};return b.current=requestAnimationFrame(e),()=>{null!=b.current&&cancelAnimationFrame(b.current),b.current=null}},[c,d]);let v=Math.floor(f/1e3),w=v<60?`${v}s`:`${Math.floor(v/60)}m ${v%60}s`;return(0,t.jsx)("div",{"data-slot":"creation-generate-bar",className:(0,n.cn)("space-y-2",p),children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 mt-6",children:[o&&(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",onClick:o,"aria-hidden":!c,tabIndex:c?0:-1,className:(0,n.cn)("h-11 flex items-center justify-center rounded-[40px] font-semibold","bg-white/[0.04] text-text-primary ring-1 ring-inset ring-border-subtle","transition-all duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)]","flex-none min-w-0 overflow-hidden","hover:bg-white/[0.08]",c?"w-auto px-5 opacity-100 translate-y-0":"w-0 opacity-0 -translate-y-1 pointer-events-none"),children:["Cancel",(0,t.jsx)("span",{className:"ml-2 inline-flex items-center self-center text-sm leading-none text-text-secondary tabular-nums","aria-live":"polite",children:w})]}),(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"submit",onClick:l,disabled:m||c,"aria-busy":c||void 0,className:(0,n.cn)("group/cta relative h-11 flex-1 min-w-0","inline-flex items-center justify-center gap-2","rounded-[40px] font-semibold text-white","bg-[image:var(--background-image-gradient-cta)]","shadow-[0_4px_20px_-4px_oklch(64%_0.20_10/0.45)]","transition-all duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-[image:var(--background-image-gradient-cta-hover)]","hover:shadow-[0_8px_32px_-4px_oklch(64%_0.20_10/0.55)] hover:-translate-y-px","active:translate-y-0 active:scale-[var(--scale-press)]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","disabled:cursor-default disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:shadow-[0_4px_20px_-4px_oklch(64%_0.20_10/0.45)]","overflow-hidden isolate","cta-shine"),children:[c?(0,t.jsx)(s,{}):(0,t.jsx)("svg",{"aria-hidden":!0,className:"size-4 transition-transform duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)] group-hover/cta:translate-x-0.5",viewBox:"0 0 24 24",fill:"none",children:(0,t.jsx)("path",{d:"M5 12h14m0 0-5-5m5 5-5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),c?"Generating…":a]})]})})}])},85241,e=>{"use strict";var t=e.i(75214),r=e.i(91151),n=e.i(10669),s=e.i(17033),i=e.i(69960),a=e.i(67382),l=e.i(635
552),o=e.i(58388),c=e.i(48883),d=e.i(51291),u=e.i(10058),p=e.i(9091),m=e.i(39367),x=e.i(2696);e.i(34462);var g=e.i(8752),h=e.i(34633),b=e.i(70732),f=e.i(20015);e.s(["PresetStartDialog",0,function({open:e,onOpenChange:v,title:w="Start a new creation",description:y,type:j,presetName:k,presetImageSrc:N,imageSrc:C,prompt:_,onPromptChange:z,onGenerate:S,onShare:I,onEdit:U,avatars:L=[],cost:M=1,costLabel:R,generating:E=!1,phase:P="idle",modelLabel:A,elapsedMs:W=0,errorMessage:$,errorCode:D,resultImageUrl:T,chainRetriedAt:H,onViewGallery:F,onExplore:B,onRetry:O,onPanelClose:q,onForceClose:G,onNext:V,onPrev:X,disabled:K=!1,className:Z}){let{isAuthenticated:Y,credits:Q}=(0,g.useUser)(),J=(0,h.useUserLimitations)(),[ee,et]=r.useState(!1),er=r.useCallback(()=>et(!0),[]),[en,es]=r.useState(!1),[ei,ea]=r.useState(void 0),el=r.useCallback(e=>{ea(e),es(!0)},[]),eo=J?.presetsRun??!0,ec=r.useMemo(()=>{let e=[{id:"edit",label:"Edit Style",icon:(0,t.jsx)(d.EditStyleIcon,{}),onClick:U}];return Y||e.push({id:"copy-prompt",label:"Copy Prompt",icon:(0,t.jsx)(d.CopyPromptIcon,{}),onClick:er,prominent:!0}),e},[I,U,Y,er]),ed=r.useRef(null);r.useEffect(()=>{e&&ed.current?.scrollTo({top:0,behavior:"instant"})},[e,k]),r.useEffect(()=>{if(!e)return;let t=e=>{let t=document.activeElement;t?.tagName!=="INPUT"&&t?.tagName!=="TEXTAREA"&&t?.getAttribute("contenteditable")!=="true"&&("ArrowRight"===e.key&&V?V():"ArrowLeft"===e.key&&X&&X())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,P,V,X]),r.useEffect(()=>{"failed"!==P||("INSUFFICIENT_CREDITS"===D||"DAILY_LIMIT_EXCEEDED"===D)&&el($??"You don't have enough credits to generate this image.")},[P,D,$,el]);let eu=L.length>0,ep=r.useId(),[em,ex]=r.useState([]);r.useEffect(()=>{e&&ex(L.map(e=>({id:`seed-${k}-${e??"any"}-${Math.random().toString(36).slice(2,8)}`,type:e,file:null,previewUrl:null,sourceUrl:null,filename:"",fileSize:0,source:"upload"})))},[e,k]);let eg=r.useCallback(()=>{Y?eo?Q<M?el(`You need ${M} credits to generate. You currently have ${Q}.`):S?.(em):el("Running presets is included in the Starter and Pro plans."):er()},[Y,eo,Q,M,er,el,S,em]),eh="bilgim.preset-start.upload-guidance-seen",eb=r.useSyncExternalStore(r.useCallback(e=>{let t=t=>{(t.key===eh||null===t.key)&&e()};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]),()=>{try{return"1"===window.localStorage.getItem(eh)}catch{return!1}},()=>!1),ef=r.useCallback(()=>{try{window.localStorage.setItem(eh,"1"),window.dispatchEvent(new StorageEvent("storage",{key:eh,newValue:"1"}))}catch{}},[]),ev="queue"===P||"processing"===P,ew="queue"!==P,ey=r.useCallback(e=>{(e||!ev)&&v(e)},[v,ev]);return r.useCallback(e=>{let t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`},[]),(0,t.jsxs)(n.Dialog,{open:e,onOpenChange:ey,children:[(0,t.jsxs)(n.DialogContent,{variant:"fullscreen",onOpenAutoFocus:e=>e.preventDefault(),className:(0,i.cn)("bg-bg-base text-text-primary border-none outline-none p-0","w-screen h-screen max-w-[100vw] md:rounded-2xl overflow-hidden","flex flex-col gap-0",Z),children:[(0,t.jsx)(n.DialogTitle,{className:"sr-only",children:w}),(0,t.jsx)(n.DialogDescription,{className:"sr-only",children:y??`Configure ${k} and start a new generation.`}),(0,t.jsxs)("div",{className:"flex flex-col lg:flex-row flex-1 min-h-0 w-full h-full relative",children:[(0,t.jsxs)("div",{className:"relative w-full h-[40vh] sm:h-[45vh] lg:h-full lg:flex-1 min-w-0 min-h-0 p-3 pb-1 lg:p-4 lg:pr-2 shrink-0",children:[(0,t.jsx)(l.MediaPreview,{imageSrc:C,thumbnailSrc:N,alt:k}),X&&(0,t.jsx)("button",{suppressHydrationWarning:!0,type:"button",onClick:X,className:(0,i.cn)("absolute left-6 lg:left-8 top-1/2 -translate-y-1/2 z-50 flex items-center justify-center rounded-full size-10 lg:size-12 bg-black/60 text-white/90 border border-white/10 hover:bg-black/80 hover:text-white active:scale-95 transition-all shadow-[0_4px_16px_rgba(0,0,0,0.5)] cursor-pointer","focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-rose/50"),"aria-label":"Previous preset",children:(0,t.jsx)("svg",{className:"size-5 lg:size-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"m15 18-6-6 6-6"})})}),V&&(0,t.jsx)("button",{suppressHydrationWarning:!0,type:"button",onClick:V,className:(0,i.cn)("absolute right-6 lg:right-6 top-1/2 -translate-y-1/2 z-50 flex items-center justify-center rounded-full size-10 lg:size-12 bg-black/60 text-white/90 border border-white/10 hover:bg-black/80 hover:text-white active:scale-95 transition-all shadow-[0_4px_16px_rgba(0,0,0,0.5)] curs
5or-pointer","focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-rose/50"),"aria-label":"Next preset",children:(0,t.jsx)("svg",{className:"size-5 lg:size-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"m9 18 6-6-6-6"})})})]}),(0,t.jsxs)("div",{className:(0,i.cn)("flex flex-col w-full lg:w-[clamp(360px,32vw,460px)] flex-1 lg:flex-initial shrink-0 min-h-0","animate-creation-panel-rise motion-reduce:animate-none"),children:[(0,t.jsxs)("div",{ref:ed,className:(0,i.cn)("flex flex-col gap-4 sm:gap-5 flex-1 min-h-0","overflow-y-auto","px-4 sm:px-6 pt-4 sm:pt-5 lg:pt-6 pb-4 sm:pb-5 lg:pb-6 lg:pr-6 lg:pl-3","scrollbar-thin"),children:[(0,t.jsx)(o.PresetHeader,{type:j,presetName:k,presetImageSrc:N,phase:P}),eu&&(0,t.jsx)("div",{children:"idle"===P?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(s.Popover,{onOpenChange:e=>{e&&ef()},children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,t.jsx)(s.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button","aria-labelledby":ep,className:(0,i.cn)("relative w-9 h-9 flex items-center justify-center rounded-full cursor-pointer","bg-bg-card text-text-primary","ring-1 ring-inset ring-border-subtle","transition-all duration-[var(--motion-fast)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-bg-hover hover:ring-border-default hover:-translate-y-px","active:translate-y-0 active:scale-[var(--scale-press)]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"),children:[(0,t.jsx)(a.Info,{className:"w-5 h-5"}),!eb&&(0,t.jsxs)("span",{"aria-hidden":!0,className:"absolute right-1 top-0 size-2",children:[(0,t.jsx)("span",{className:"absolute inline-flex size-2 rounded-full bg-accent-rose"}),(0,t.jsx)("span",{className:"absolute inline-flex size-2 rounded-full bg-accent-rose live-ping-soft motion-reduce:animate-none"})]})]})}),(0,t.jsx)("p",{id:ep,className:"text-sm font-semibold text-text-primary",children:"Upload Guidelines"})]}),(0,t.jsx)(s.PopoverContent,{align:"start",sideOffset:10,className:"w-80 max-w-[calc(100vw-2rem)] rounded-2xl p-3 bg-bg-surface/95 backdrop-blur-xl ring-1 ring-border-default shadow-[0_8px_32px_0_oklch(4%_0.01_280/0.45)]",children:(0,t.jsx)(u.UploadGuidance,{mode:j})})]}),(0,t.jsx)(p.AvatarUploader,{initialAvatars:L,value:em,onChange:ex},`${k}-${e}`)]}):(0,t.jsx)(m.GeneratingPanel,{phase:P,presetImageSrc:C,resultImageSrc:T,modelLabel:A,elapsedMs:W,errorMessage:$,chainRetriedAt:H,onExplore:B,onViewGallery:F,onForceClose:G})}),Y&&"idle"===P&&(0,t.jsx)("div",{className:"hidden lg:block",children:(0,t.jsx)(c.PromptEditor,{value:_,onChange:z})}),"idle"===P&&(0,t.jsx)(d.StyleActions,{actions:ec})]}),(0,t.jsx)("div",{className:"shrink-0 border-t border-border-subtle/40 bg-bg-base/40 backdrop-blur-md px-4 sm:px-6 pt-3 sm:pt-4 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:pb-[max(1rem,env(safe-area-inset-bottom))] lg:pr-6 lg:pl-3",children:"idle"===P?(0,t.jsx)(x.GenerateBar,{cost:M,costLabel:R,onGenerate:eg,generating:E,shortcutHint:(0,t.jsx)(x.DefaultShortcutHint,{}),disabled:K}):ev&&ew?B?(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",onClick:G,className:(0,i.cn)("group/ex w-full h-11 inline-flex items-center justify-center gap-2 rounded-[40px]","text-sm font-semibold text-white","bg-[image:var(--background-image-gradient-cta)]","shadow-[0_4px_20px_-4px_oklch(64%_0.20_10/0.45)]","transition-all duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-[image:var(--background-image-gradient-cta-hover)] hover:-translate-y-px hover:shadow-[0_8px_32px_-4px_oklch(64%_0.20_10/0.55)]","active:translate-y-0 active:scale-[var(--scale-press)]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","cta-shine overflow-hidden isolate"),children:[(0,t.jsx)(a.Compass,{className:"size-4"}),"Keep exploring"]}):(0,t.jsx)("span",{}):"completed"===P?(0,t.jsxs)("div",{className:"flex gap-2",children:[T?(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",onClick:()=>{let e=document.createElement("a");e.href=T,e.download="",e.rel="noopener noreferrer",e.style.display="none",document.body.appendChild(e),e.click(),setTimeout(()=>e.remove(),0)},className:(0,i.cn)("flex-1 h-11 inline-flex items-center justify-center gap-2 rounded-[40px] text-sm font-semibold text-white","bg-accent-rose hover:bg-accent-rose/90","shadow-[0_4px_20px_-4px_oklch(64%_0.20_10/0.45)]","transition-all duration-[var(--motion-base)]","active:scale-[var(--scale-press)]"),children:[(0,t.jsx)(a.Download,{className:"size-4"}),"Download"]}):(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsx)("button",{suppressHydrationWarning:!0,type:"button","aria-label":"Reset and start over",title:"Start over",onClick:q,className:(0,i.cn)("h-11 w-11 shrink-0 inline-flex items-center justify-center rounded-full","bg-white/[0.04] text-text-primary ring-1 ring-inset ring-border-subtle","hover:bg-white/[0.08] hover:ring-border-default","transition-all duration-[var(--motion-base)]","active:scale-[var(--scale-press)]"),children:(0,t.jsx)(a.RotateCcw,{className:"size-4"})})]}):"failed"===P?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("button",{suppressHydrationWarning:!0,type:"button",onClick:O,className:(0,i.cn)("flex-1 h-11 inline-flex items-center justify-center gap-2 rounded-[40px] text-sm font-semibold text-white","bg-accent-rose hover:bg-accent-rose/90","shadow-[0_4px_20px_-4px_oklch(64%_0.20_10/0.45)]","transition-all duration-[var(--motion-base)]","active:scale-[var(--scale-press)]"),children:"Try again"}),(0,t.jsx)("button",{suppressHydrationWarning:!0,type:"button",onClick:q,className:(0,i.cn)("h-11 px-5 inline-flex items-center justify-center rounded-[40px] text-sm font-semibold","bg-white/[0.04] text-text-primary ring-1 ring-inset ring-border-subtle","hover:bg-white/[0.08]","transition-all duration-[var(--motion-base)]"),children:"Close"})]}):null})]})]})]}),(0,t.jsx)(b.SignInDialog,{open:ee,onOpenChange:et}),(0,t.jsx)(f.PricingDialog,{open:en,onOpenChange:es,reason:ei})]})}])},29183,e=>{"use strict";var t=e.i(75214),r=e.i(91151),n=e.i(67382),s=e.i(69960);e.s(["PresetCard",0,function({preset:e,onClick:i,onTryNow:a}){let[l,o]=(0,r.useState)(!1),[c,d]=(0,r.useState)(!1),u=e.coverUrl||e.fullImageUrl;return(0,t.jsxs)("div",{onClick:i,onKeyDown:e=>
5{i&&("Enter"===e.key||" "===e.key)&&(e.preventDefault(),i())},role:i?"button":void 0,tabIndex:i?0:void 0,"aria-label":i?`Open ${e.title}`:void 0,className:"group relative aspect-[5/6] w-full rounded-2xl overflow-hidden cursor-pointer outline-none bg-bg-card ring-1 ring-inset ring-border-subtle transition-all duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)] hover:-translate-y-1 hover:ring-accent-rose/30 hover:shadow-[0_14px_36px_-6px_oklch(4%_0.01_280/0.55),0_0_0_1px_oklch(64%_0.20_10/0.10)] focus-visible:ring-2 focus-visible:ring-ring/60 motion-reduce:transition-none motion-reduce:transform-none",children:[!l&&!c&&(0,t.jsx)("div",{className:"absolute inset-0 w-full h-full rounded-2xl bg-bg-hover animate-pulse"}),c&&(0,t.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-bg-card p-4",children:[(0,t.jsx)(n.ImageOff,{className:"h-8 w-8 text-text-muted mb-2"}),(0,t.jsx)("span",{className:"text-[10px] text-text-muted font-medium text-center leading-tight",children:"Failed to load"})]}),(0,t.jsx)("div",{className:"absolute inset-0 overflow-hidden rounded-2xl",children:(0,t.jsx)("img",{src:(0,s.getOptimizedImageUrl)(u,{width:600,height:720,quality:80}),alt:e.title,loading:"lazy",decoding:"async",onLoad:()=>o(!0),onError:()=>{d(!0),o(!0)},className:(0,s.cn)("absolute inset-0 w-full h-full object-cover object-top","transition-transform duration-[700ms] ease-[cubic-bezier(0.23,1,0.32,1)]","group-hover:scale-[1.06] motion-reduce:transition-none",!l||c?"opacity-0":"opacity-100")})}),(0,t.jsx)("div",{"aria-hidden":!0,className:"absolute inset-0 rounded-2xl bg-gradient-to-t from-black/95 via-black/30 to-transparent opacity-70 group-hover:opacity-100 transition-opacity duration-300 motion-reduce:transition-none"}),e.premium&&(0,t.jsx)("div",{className:"absolute top-3 left-3 pointer-events-none z-10",children:(0,t.jsxs)("div",{className:"flex items-center gap-1 bg-gradient-to-r from-amber-500 to-orange-500 text-white text-[9px] font-bold px-2 py-1 rounded-lg shadow-lg",children:[(0,t.jsx)(n.Crown,{className:"h-3 w-3"}),"PREMIUM"]})}),e.isBundle&&(0,t.jsx)("div",{className:"absolute top-3 right-3 pointer-events-none z-10",children:(0,t.jsxs)("div",{className:"flex items-center gap-1 bg-gradient-to-r from-purple-500 to-pink-500 text-white text-[9px] font-bold px-2 py-1 rounded-lg shadow-lg",children:[(0,t.jsx)(n.Sparkles,{className:"h-3 w-3"}),"BUNDLE"]})}),(0,t.jsx)("div",{className:"absolute inset-x-2 bottom-2 z-10 pointer-events-none",children:(0,t.jsxs)("div",{className:(0,s.cn)("rounded-xl px-2.5 py-2","bg-black/35 backdrop-blur-md ring-1 ring-inset ring-white/[0.06]","group-hover:bg-black/60 group-hover:ring-white/10","transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)]","motion-reduce:transition-none"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"flex-1 min-w-0 text-[11px] sm:text-xs font-semibold text-white line-clamp-1 leading-tight",children:e.title}),e.likes>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1 bg-white/10 text-white text-[9px] font-bold px-1.5 py-0.5 rounded-md shrink-0",children:[(0,t.jsx)(n.Heart,{className:"h-2.5 w-2.5 text-rose-500",weight:"Filled"}),e.likes>=1e3?`${(e.likes/1e3).toFixed(1)}k`:e.likes]})]}),a&&(0,t.jsx)("div",{className:"grid grid-rows-[0fr] group-hover:grid-rows-[1fr] group-focus-visible:grid-rows-[1fr] transition-[grid-template-rows] duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none",children:(0,t.jsx)("div",{className:"overflow-hidden",children:(0,t.jsxs)("button",{suppressHydrationWarning:!0,type:"button",onClick:e=>{e.stopPropagation(),a?.()},"aria-label":`Try ${e.title}`,tabIndex:i?0:-1,className:(0,s.cn)("mt-2 w-full h-8 px-3 rounded-lg","inline-flex items-center justify-center gap-1.5","text-white text-[11px] font-bold","bg-[image:var(--background-image-gradient-cta)]","shadow-[0_4px_16px_-2px_oklch(64%_0.20_10/0.5)]","cta-shine","opacity-0 translate-y-1","group-hover:opacity-100 group-hover:translate-y-0","group-focus-visible:opacity-100 group-focus-visible:translate-y-0","transition-[opacity,transform] duration-[var(--motion-base)] ease-[cubic-bezier(0.23,1,0.32,1)]","hover:bg-[image:var(--background-image-gradient-cta-hover)]","hover:shadow-[0_6px_20px_-2px_oklch(64%_0.20_10/0.6)]","active:scale-[0.97]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","motion-reduce:transition-none motion-reduce:translate-y-0 motion-reduce:opacity-100"),children:[(0,t.jsx)(n.Wand2,{className:"h-3 w-3"}),"Try Now"]})})})]})})]})}])},71750,75028,e=>{"use strict";var t=e.i(75214),r=e.i(91151),n=e.i(18599),s=e.i(78953);e.i(67382);var i=e.i(7529);let a={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6"},l={1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},o={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6"},c={1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6"},d={1:"xl:grid-cols-1",2:"xl:grid-cols-2",3:"xl:grid-cols-3",4:"xl:grid-cols-4",5:"xl:grid-cols-5",6:"xl:grid-cols-6"},u={1:"2xl:grid-cols-1",2:"2xl:grid-cols-2",3:"2xl:grid-cols-3",4:"2xl:grid-cols-4",5:"2xl:grid-cols-5",6:"2xl:grid-cols-6"};
5function p({count:e=12,columns:r={base:2,sm:3,md:4,lg:5,xl:5,"2xl":6},gap:n="gap-1.5 sm:gap-2",className:s=""}){let m=`grid ${a[r.base??2]||"grid-cols-2"} ${l[r.sm??3]||"sm:grid-cols-3"} ${o[r.md??4]||"md:grid-cols-4"} ${c[r.lg??5]||"lg:grid-cols-5"} ${d[r.xl??5]||"xl:grid-cols-5"} ${u[r["2xl"]??6]||"2xl:grid-cols-6"} ${n} ${s}`;return(0,t.jsx)("div",{className:m,children:Array.from({length:e}).map((e,r)=>(0,t.jsx)(i.Skeleton,{className:"relative aspect-[5/6] w-full rounded-2xl border border-white/5 bg-zinc-800/50"},r))})}e.s(["MediaGridSkeleton",0,p],75028);var m=e.i(85241);e.i(9091),e.i(15351),e.i(63552),e.i(58388),e.i(48883),e.i(51291),e.i(2696),e.i(39367);var x=e.i(29183),g=e.i(28191);e.i(17548);var h=e.i(8752),b=e.i(47462);let f={phase:"idle",elapsedMs:0};var v=e.i(36761),w=e.i(46754),y=e.i(40537),j=e.i(4054),k=e.i(69960);e.s(["MediaGrid",0,function({items:e,isLoading:i}){let a=(0,n.useRouter)(),{user:l}=(0,h.useUser)(),{presetId:o,setPresetId:c,navigateToEdit:d}=(0,v.useExploreUrlState)(),[u,N]=(0,r.useState)(""),C=function(){let{subscribe:e}=(0,b.useWebSocket)(),[t,n]=(0,r.useState)(f),i=(0,r.useRef)(null),a=(0,r.useRef)(null),l=(0,r.useRef)(f);l.current=t,(0,r.useEffect)(()=>e("generation_update",e=>{if(!e)return;let t=l.current;if(t.requestId&&e.requestId===t.requestId||t.chainId&&e.chainId===t.chainId){if("processing"===e.status||"uploading"===e.status)return void n(t=>({...t,phase:"processing",usedModel:e.modelId?{modelId:e.modelId,versionId:e.modelId,label:e.modelId}:t.usedModel}));if("completed"===e.status){let t=e.result?.images,r=Array.isArray(t)&&t.length>0?t[0]?.url:void 0;n(e=>({...e,phase:"completed",resultImageUrl:r}));return}"failed"===e.status&&(n(t=>({...t,phase:"failed",errorMessage:e.error??"Generation failed",errorCode:e.code})),s.toast.error(e.error||"Generation failed"))}}),[e]),(0,r.useEffect)(()=>{if("queue"!==t.phase&&"processing"!==t.phase){null!=a.current&&(cancelAnimationFrame(a.current),a.current=null);return}i.current=Date.now();let e=()=>{if(null==i.current)return;let t=Date.now()-i.current;n(e=>({...e,elapsedMs:t})),a.current=requestAnimationFrame(e)};return a.current=requestAnimationFrame(e),()=>{null!=a.current&&cancelAnimationFrame(a.current),a.current=null}},[t.phase]);let o=(0,r.useCallback)(async e=>{n({...f,phase:"queue"});let t="parentPresetId"in e,r=e=>{n(t=>({...t,phase:"processing",chainId:e.chainId,requestId:e.requestId,usedModel:e.usedModel})),s.toast.success(t?"Edit started!":"Generation started!")},i=(e,t)=>{s.toast.error(e),n({...f,phase:"failed",errorMessage:e,errorCode:t})};try{if(t){let t=await g.api.runPresetEdit(e);t.success?r(t):i(t.error||"Failed to start edit.",t.code)}else{let t=await g.api.generateFromPreset(e);t.success?r(t):i(t.error||"Failed to start generation.",t.code)}}catch(e){i(e instanceof Error?e.message:"Something went wrong")}},[]),c=(0,r.useCallback)(()=>{n(f)},[]);return{...t,start:o,reset:c}}(),_=(0,r.useMemo)(()=>{if(!o)return null;let t=e.find(e=>e._id===o);if(t)return t;let r=(0,w.getCachedPreset)(o);return r?{_id:r._id,title:r.title,description:r.title,coverUrl:r.coverUrl??"",fullImageUrl:r.coverUrl??"",imagePosition:"center",tags:[],likes:0,premium:!1,isBundle:!1,inputs:{avatars:[]},collectionId:r.collectionId?{_id:r.collectionId._id,name:r.collectionId.name,type:"image",order:0}:void 0,isActive:!0,order:0,createdAt:"",updatedAt:""}:null},[o,e]);(0,r.useEffect)(()=>{_&&N(_.description?.trim()||"A photo from the early 2010s, taken with an iPhone 5s and flash in a bedroom. She has slightly tousled hair, bold black eyeliner, and smoky eye makeup. She's wearing a white, tight-fitting top and very short, black, stretchy shorts. She's kneeling on the bed, leaning slightly toward the camera.")},[_]);let z=(0,r.useCallback)(e=>{c(e._id)},[c]),S=(0,r.useCallback)(e=>{e||("idle"===C.phase||"completed"===C.phase||"failed"===C.phase)&&(c(null),C.reset())},[C,c]),I=(0,r.useCallback)(()=>{_&&(C.reset(),d(_._id))},[_,C,d]),U=(0,r.useCallback)(async e=>{if(!_||!l)return;let t=(await Promise.all(e.map(async e=>e.sourceUrl?e.sourceUrl:e.file?await g.api.uploadImage(e.file):e.previewUrl))).filter(e=>!!e&&!e.startsWith("blob:"));0===t.length?s.toast.error("Please upload at least one avatar image"):C.start({presetId:_._id,imageUrls:t,userId:l.userId})},[_,l,C]),L=(0,r.useCallback)(()=>{_&&l&&C.reset()},[_,l,C]),M=(0,r.useMemo)(()=>o?e.findIndex(e=>e._id===o):-1,[o,e]),R=(0,r.useCallback)(()=>{-1!==M&&M<e.length-1&&(c(e[M+1]._id),C.reset())},[M,e,c,C]),E=(0,r.useCallback)(()=>{M>0&&(c(e[M-1]._id),C.reset())},[M,e,c,C]);return i?(0,t.jsx)(p,{count:12}):0===e.length?(0,t.jsx)(j.AnimatedEmptyState,{title:"No presets found",description:"Try adjusting your filters or search"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.StaggerGrid,{staggerKey:e.map(e=>e._id).slice(0,6).join("-"),className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-5 2xl:gr
5id-cols-6 gap-1.5 sm:gap-2",children:e.map(e=>(0,t.jsx)(x.PresetCard,{preset:e,onClick:()=>z(e),onTryNow:()=>z(e)},e._id))}),(0,t.jsx)(m.PresetStartDialog,{open:!!_,onOpenChange:S,type:"image",presetName:_?.title??"",presetImageSrc:_?.coverUrl||_?.fullImageUrl,imageSrc:_?.fullImageUrl||_?.coverUrl||"",prompt:u,onPromptChange:N,avatars:_?.inputs.avatars.map(e=>e.type),cost:4,costLabel:"4 CR",generating:"idle"!==C.phase,phase:C.phase,modelLabel:C.usedModel?.label,elapsedMs:C.elapsedMs,errorMessage:C.errorMessage,errorCode:C.errorCode,resultImageUrl:C.resultImageUrl,chainRetriedAt:C.chainRetriedAt,onGenerate:U,onEdit:I,onViewGallery:()=>a.push("/generate/gallery"),onExplore:()=>a.push("/"),onForceClose:()=>{c(null),C.reset()},onRetry:L,onPanelClose:()=>{c(null),C.reset()},onNext:-1!==M&&M<e.length-1?R:void 0,onPrev:M>0?E:void 0}),M>0&&(0,t.jsx)("link",{rel:"prefetch",href:(0,k.getOptimizedImageUrl)(e[M-1].fullImageUrl||e[M-1].coverUrl||"",{width:900,quality:80})}),-1!==M&&M<e.length-1&&(0,t.jsx)("link",{rel:"prefetch",href:(0,k.getOptimizedImageUrl)(e[M+1].fullImageUrl||e[M+1].coverUrl||"",{width:900,quality:80})})]})}],71750)},46704,e=>{"use strict";var t=e.i(75214),r=e.i(91151),n=e.i(17100),s=e.i(70933),i=e.i(71750),a=e.i(78822),l=e.i(75028);function o(){return(0,t.jsxs)("div",{className:"w-full flex flex-col gap-6 pb-16 animate-pulse",children:[(0,t.jsx)("div",{className:"group/carousel relative w-full -mx-5 pl-5 pr-0 sm:-mx-0 sm:px-0 overflow-hidden",children:(0,t.jsx)("div",{className:"flex gap-2 mr-1",children:Array.from({length:3}).map((e,r)=>(0,t.jsx)("div",{className:"min-w-[210px] md:min-w-[180px] lg:min-w-[270px] xl:min-w-[440px] flex-[0_0_210px] md:flex-[0_0_180px] lg:flex-[0_0_270px] xl:flex-[0_0_440px] h-28 md:h-28 lg:h-40 xl:h-56 bg-zinc-800/40 rounded-lg"},r))})}),(0,t.jsx)("div",{className:"flex flex-col gap-3 border-t border-white/5 pt-6 w-full",children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4 w-full",children:[(0,t.jsx)("div",{className:"flex items-center gap-1.5 overflow-x-hidden flex-1",children:Array.from({length:6}).map((e,r)=>(0,t.jsx)("div",{className:"h-8 w-20 bg-zinc-800/40 rounded-full shrink-0"},r))}),(0,t.jsx)("div",{className:"hidden sm:flex items-center gap-1.5 w-32 h-8 bg-zinc-800/30 rounded-full shrink-0"})]})}),(0,t.jsx)(l.MediaGridSkeleton,{count:12})]})}function c(){let[e,l]=(0,r.useState)(null),[c,d]=(0,r.useState)(""),[u,p]=(0,r.useState)("latest"),m=(0,r.useRef)(null),{items:x,isLoading:g,isLoadingMore:h,hasMore:b,loadMore:f,collections:v,isLoadingCollections:w}=(0,a.usePresetsCatalog)({activeCollectionId:e,searchQuery:c,sortMode:u});(0,r.useEffect)(()=>{let e=m.current;if(!e)return;let t=new IntersectionObserver(e=>{e[0].isIntersecting&&b&&!h&&!g&&f()},{rootMargin:"200px"});return t.observe(e),()=>t.disconnect()},[b,h,g,f]);let y=(0,r.useCallback)(e=>{l(e),d("")},[]),j=(0,r.useCallback)(e=>{d(e)},[]);return g&&w&&0===x.length?(0,t.jsx)(o,{}):(0,t.jsxs)("div",{className:"w-full flex flex-col gap-4 pb-16",children:[(0,t.jsx)(n.BannerCarousel,{}),(0,t.jsx)(s.FilterBar,{activeCollectionId:e,onCollectionChange:y,collections:v,searchQuery:c,onSearchChange:j,sortMode:u,onSortChange:p}),(0,t.jsx)(i.MediaGrid,{items:x,isLoading:g}),(0,t.jsx)("div",{ref:m,className:"h-4"}),h&&(0,t.jsx)("div",{className:"flex justify-center py-4",children:(0,t.jsx)("div",{className:"h-6 w-6 border-2 border-zinc-600 border-t-white rounded-full animate-spin"})})]})}e.s(["ExploreSection",0,c,"default",0,c])}]);

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.