PageSourceSearch

https://app.designhivestudio.ai/assets/StudioHub-DIBD92gE.js

js designhivestudio.ai collected 2026-10-05 14:37:27 UTC 80,909 bytes, 1 lines download raw bytes

1import{r as i,j as e}from"./react-CBsl08bt.js";import{b as Nt,y as vr,J as s,s as R,c as N,B as P,u as wr,G as jr,ab as yr,f as Nr,H as kr}from"./index-Znlz9Whf.js";import{C as Ve}from"./card-3cO3APWD.js";import{S as We}from"./slider-CBBPb_Ix.js";import{M as Cr}from"./MaskBrushCanvas-EbSqfN-7.js";import{e as _e,C as W}from"./creditCosts-MBRr8IhI.js";import{P as Ge,a as Oe,b as De}from"./popover-DIIKlC2R.js";import{ai as Sr,I as pe,d as Ie,be as vt,an as ze,V as Re,au as Ir,bf as wt,Q as kt,Y as Rr,v as qe,bg as Je,af as Ct,W as Qe,al as St,R as he,a0 as Pr,bh as fe,D as le,J as jt,S as be,Z as Er,am as Ur,aI as Ar,U as Le,_ as $e,aR as Me,P as Br,t as Fr,aV as Tr,ag as Hr,bi as Gr}from"./icons-CgIhAgVC.js";import{u as Or}from"./useGenerationCredits-Br7cbKnd.js";import{C as Dr}from"./CreditCostBadge-BVfp60Q0.js";import{B as zr}from"./BackToHub-DrpfsmHH.js";import"./index-BdQq_4o_.js";import"./index-DJmASvcX.js";const Lr=S=>{const{isAdmin:j,user:p}=Nt();vr();const[v,B]=i.useState(null),[x,O]=i.useState(null),[D,n]=i.useState(null),[T,f]=i.useState(!1),[y,l]=i.useState(null),[J,E]=i.useState(!1),[w,_]=i.useState(j?"hd":"standard"),[q,H]=i.useState(0),V=i.useCallback(g=>g==="[email protected]",[])(p==null?void 0:p.email),K=i.useCallback(async g=>{if(g)try{if(f(!0),l(null),!["image/jpeg","image/jpg","image/png"].includes(g.type))throw new Error("Please upload a JPG or PNG image");if(g.size>5*1024*1024)throw new Error("Image must be smaller than 5MB");g.name,g.type,g.size;const L=URL.createObjectURL(g);B(L),O(g),n(null),s.success("Image uploaded successfully")}catch(F){const L=(F==null?void 0:F.message)||"Failed to upload image";l(L),s.error(L)}finally{f(!1)}},[]),Q=i.useCallback(async()=>{if(!x){s.error("Please upload an image first");return}try{E(!0),f(!0),H(10),l(null),s.info("Uploading image..."),H(20);const g=x.name.split(".").pop(),L=`${`${Math.random()}.${g}`}`,{error:ee}=await R.storage.from("image-uploads").upload(L,x,{cacheControl:"3600",upsert:!1});if(ee)throw new Error("Failed to upload image: "+ee.message);const{data:{publicUrl:U}}=R.storage.from("image-uploads").getPublicUrl(L);H(40),s.info("Removing background with AI...");const{data:$,error:te}=await R.functions.invoke("background-removal",{body:{image:U}});if(te)throw console.error("Background removal function error:",te),new Error(te.message||"Failed to process image");if(!($!=null&&$.url))throw console.error("No URL in response:",$),new Error("No processed image returned from AI");H(70),s.info("Enhancing image quality...");const{data:Y,error:ve}=await R.functions.invoke("image-enhancement",{body:{image:$.url,enhancementType:"quality",desiredIncrease:2}}),de=(Y==null?void 0:Y.output)||(Y==null?void 0:Y.url);ve||!de?(console.error("Enhancement error, using non-enhanced image:",ve),n($.url),S&&S($.url)):(n(de),S&&S(de)),H(100),s.success("Backgroun
1d removed and quality enhanced!"),p&&!j&&!V&&await R.rpc("update_user_credits",{p_user_id:p.id,p_credits_change:-1,p_transaction_type:"usage",p_description:"Background removal + enhancement (HD AI)"})}catch(g){const F=(g==null?void 0:g.message)||"Failed to remove background";l(F),s.error(`Error: ${F}`),console.error("Background removal error:",g)}finally{f(!1),E(!1),H(0)}},[x,S,p,j,V]),b=i.useCallback(()=>{v&&v.startsWith("blob:")&&URL.revokeObjectURL(v),B(null),O(null),n(null),l(null),H(0),s.info("Images cleared")},[v]),c=i.useCallback(()=>{n(null),l(null),H(0),s.info("Reset to original image")},[]);return{selectedImage:v,selectedFile:x,processedImage:D,loading:T,error:y,processing:J,processingQuality:w,progress:q,isAdmin:j,isSpecialUser:V,handleImageUpload:K,processImage:Q,clearAll:b,resetToOriginal:c,setProcessingQuality:_}},$r={gold:{gradient:"from-hive-gold/10 via-transparent to-amber-500/10",badge:"bg-hive-gold/30 text-hive-gold border-hive-gold/50 shadow-sm shadow-hive-gold/10",badgeSecondary:"bg-amber-500/30 text-amber-300 border-amber-400/50 shadow-sm shadow-amber-500/10"}
1,green:{gradient:"from-emerald-500/10 via-transparent to-green-500/10",badge:"bg-emerald-500/30 text-emerald-300 border-emerald-400/50 shadow-sm shadow-emerald-500/10",badgeSecondary:"bg-green-500/30 text-green-300 border-green-400/50 shadow-sm shadow-green-500/10"},orange:{gradient:"from-orange-500/10 via-transparent to-red-500/10",badge:"bg-orange-500/30 text-orange-300 border-orange-400/50 shadow-sm shadow-orange-500/10",badgeSecondary:"bg-red-500/30 text-red-300 border-red-400/50 shadow-sm shadow-red-500/10"},purple:{gradient:"from-purple-500/10 via-transparent to-pink-500/10",badge:"bg-purple-500/30 text-purple-300 border-purple-400/50 shadow-sm shadow-purple-500/10",badgeSecondary:"bg-pink-500/30 text-pink-300 border-pink-400/50 shadow-sm shadow-pink-500/10"},blue:{gradient:"from-blue-500/10 via-transparent to-cyan-500/10",badge:"bg-blue-500/30 text-blue-300 border-blue-400/50 shadow-sm shadow-blue-500/10",badgeSecondary:"bg-cyan-500/30 text-cyan-300 border-cyan-400/50 shadow-sm shadow-cyan-500/10"},amber:{gradient:"from-amber-500/10 via-trans
1parent to-yellow-500/10",badge:"bg-amber-500/30 text-amber-300 border-amber-400/50 shadow-sm shadow-amber-500/10",badgeSecondary:"bg-yellow-500/30 text-yellow-300 border-yellow-400/50 shadow-sm shadow-yellow-500/10"}},ne=({imageSrc:S,imageAlt:j,title:p,description:v,accentColor:B,badges:x,promptExample:O})=>{const D=$r[B];return e.jsx("div",{className:"mt-6 mb-6",children:e.jsxs(Ve,{className:`relative bg-card border-2 border-hive-gold/20 overflow-hidden backdrop-blur-xl shadow-2xl accent-card-${B}`,children:[e.jsx("div",{className:`inset-0 bg-gradient-to-br ${D.gradient} animate-gradient-slow`}),e.jsx("div",{className:"relative p-8 md:p-10",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-8 items-center",children:[e.jsx("div",{className:"relative",children:e.jsx("div",{className:"relative bg-muted rounded-xl overflow-hidden border-2 border-hive-gold/30 shadow-2xl",children:e.jsx("img",{src:S,alt:j,className:"w-full h-auto object-cover"})})}),e.jsxs("div",{className:"space-y-6 text-center md:text-left",children:[e.jsxs("div",{children:[e.jsx("span",{className:`studio-badge studio-badge-primary inline-block px-4 py-1.5 mb-4 text-xs font-bold tracking-wider uppercase rounded-full ${D.badge} border`,children:"Example Output"}),e.jsx("h3",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:p}),e.jsx("p",{className:"text-foreground/80 text-sm md:text-base leading-relaxed",children:v})]}),e.jsx("div",{className:"flex flex-wrap gap-2 justify-center md:justify-start",children:x.map((n,T)=>{const f=n.variant==="secondary"?D.badgeSecondary:n.variant==="neutral"?"bg-muted text-foreground/90 border-border shadow-sm":D.badge,y=n.variant==="neutral"?"studio-badge-neutral":n.variant==="secondary"?"studio-badge-secondary":"studio-badge-primary";return e.jsx("span",{className:`studio-badge ${y} px-4 py-1.5 rounded-full text-xs font-bold tracking-wide ${f} border`,children:n.label},T)})}),e.jsx("div",{className:"pt-2",children:e.jsxs("p",{className:"text-sm text-muted-foreground italic font-medium",children:['"',O,'"']})})]})]})})})]})})},yt=[{value:"3:2",label:"3:2",icon:"▭"},{value:"1:1",label:"1:1",icon:"□"},{value:"2:3",label:"2:3",icon:"▯"},{value:"16:9",label:"16:9",icon:"▬"},{value:"9:16",label:"9:16",icon:"▮"}],Mr=[{value:4,label:"4s"},{value:8,label:"8s"},{value:12,label:"12s"}],Vr=[{value:"standard",label:"720p",description:"Standard"},{value:"high",label:"1080p",description:"High Quality"}],Wr=({prompt:S,onPromptChange:j,onSubmit:p,onImageUpload:v,hasImage:B,aspectRatio:x,onAspectRatioChange:O,duration:D,onDurationChange:n,resolution:T,onResolutionChange:f,isProcessing:y,mode:l="video",className:J})=>{const E=i.useRef(null),[w,_]=i.useState(!1),[q,H]=i.useState(!1),[X,V]=i.useState(!1),K=c=>{var F;const g=(F=c.target.files)==null?void 0:F[0];g&&g.type.startsWith("image/")&&v(g),E.current&&(E.current.value="")},Q=()=>{const c=yt.find(g=>g.value===x);return c?c.label:"2:3"},b=({children:c,active:g=!1,onClick:F,className:L})=>e.jsx("button",{onClick:F,className:N("flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium transition-all","bg-white/5 hover:bg-white/10 text-white/80 border border-white/10 hover:border-white/20",g&&"bg-hive-gold/10 border-hive-gold/30 text-hive-gold",L),children:c});return e.jsxs("div",{className:N("w-full relative",J),children:[e.jsx("div",{className:"absolute -inset-1 bg-gradient-to-r from-hive-gold/20 via-white/5 to-hive-gold/20 rounded-3xl blur-xl opacity-40 pointer-events-none"}),e.jsxs("div",{className:"relative bg-[#0d0d0d]/95 backdrop-blur-2xl border border-white/10 rounded-2xl shadow-2xl shadow-black/60",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsx("button",{onClick:()=>{var c;return(c=E.current)==null?void 0:c.click()},className:"flex items-center justify-center w-10 h-10 rounded-full bg-white/5 hover:bg-white/10 border border-white/10 hover:border-hive-gold/30 transition-all group flex-shrink-0",title:"Add image",children:e.jsx("span",{className:"text-xl text-white/60 group-hover:text-hive-gold transition-colors",children:"+"})}),e.jsx("div",{className:"flex-1 relative",children:e.jsx("input",{type:"text",value:S,onChange:c=>j(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&!y&&S.trim()&&(c.preventDefault(),p())},placeholder:l==="video"?"Describe your video...":"Describe your image...",className:"w-full bg-transparent text-white placeholder:text-white/35 text-sm py-2.5 px-2 focus:outline-none"})}),e.jsx("button",{onClick:p,disabled:y||!S.trim(),className:N("flex items-center justify-center w-10 h-10 rounded-full transition-all flex-shrink-0",S.trim()&&!y?"bg-gradient-to-br from-hive-gold to-hive-gold-light hover:from-hive-gold-light hover:to-hive-gold text-hive-gold-foreground shadow-lg shadow-hive-gold/12":"bg-white/5 text-white/25 cursor-not-allowed"),children:y?e.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent roun
1ded-full animate-spin"}):e.jsx(Sr,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"h-px bg-gradient-to-r from-transparent via-white/10 to-transparent mx-4"}),e.jsxs("div",{className:"flex items-center justify-center gap-2 p-3 overflow-x-auto scrollbar-hide",children:[e.jsxs(b,{active:B,onClick:()=>{var c;return(c=E.current)==null?void 0:c.click()},children:[e.jsx(pe,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Image"}),B&&e.jsx(Ie,{className:"w-3 h-3 text-green-400"})]}),e.jsxs(Ge,{open:w,onOpenChange:_,children:[e.jsx(Oe,{asChild:!0,children:e.jsx("div",{children:e.jsxs(b,{children:[e.jsx(vt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:Q()}),e.jsx(ze,{className:N("w-3 h-3 transition-transform",w&&"rotate-180")})]})})}),e.jsx(De,{className:"w-44 p-2 bg-popover backdrop-blur-xl border border-border rounded-xl shadow-xl",align:"center",side:"top",sideOffset:12,children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground px-2 py-1 font-medium uppercase tracking-wider",children:"Aspect ratio"}),yt.map(c=>e.jsxs("button",{onClick:()=>{O(c.value),_(!1)},className:N("w-full flex items-center justify-between px-3 py-2 rounded-lg text-sm transition-all",x===c.value?"bg-hive-gold/20 text-hive-gold":"text-foreground/70 hover:bg-muted hover:text-foreground"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(vt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:c.label})]}),x===c.value&&e.jsx(Ie,{className:"w-4 h-4 text-hive-gold"})]},c.value))]})})]}),l==="video"&&e.jsxs(Ge,{open:q,onOpenChange:H,children:[e.jsx(Oe,{asChild:!0,children:e.jsx("div",{children:e.jsxs(b,{children:[e.jsx(Re,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:[D,"s"]}),e.jsx(ze,{className:N("w-3 h-3 transition-transform",q&&"rotate-180")})]})})}),e.jsx(De,{className:"w-48 p-2 bg-popover backdrop-blur-xl border border-border rounded-xl shadow-xl",align:"center",side:"top",sideOffset:12,children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground px-2 py-1 font-medium uppercase tracking-wider",children:"Duration"}),Mr.map(c=>{const g=_e(c.value);return e.jsxs("button",{onClick:()=>{n(c.value),H(!1)},className:N("w-full flex items-center justify-between px-3 py-2 rounded-lg text-sm transition-all",D===c.value?"bg-hive-gold/20 text-hive-gold":"text-foreground/70 hover:bg-muted hover:text-foreground"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ir,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:c.label})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[g.cost," Credits"]}),D===c.value&&e.jsx(Ie,{className:"w-4 h-4 text-hive-gold"})]})]},c.value)})]})})]}),e.jsxs(Ge,{open:X,onOpenChange:V,children:[e.jsx(Oe,{asChild:!0,children:e.jsx("div",{children:e.jsxs(b,{children:[e.jsx(wt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:T==="high"?"1080p":"720p"}),e.jsx(ze,{className:N("w-3 h-3 transition-transform",X&&"rotate-180")})]})})}),e.jsx(De,{className:"w-48 p-2 bg-popover backdrop-blur-xl border border-border rounded-xl shadow-xl",align:"center",side:"top",sideOffset:12,children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground px-2 py-1 font-medium uppercase tracking-wider",children:"Resolution"}),Vr.map(c=>e.jsxs("button",{onClick:()=>{f(c.value),V(!1)},className:N("w-full flex items-center justify-between px-3 py-2 rounded-lg text-sm transition-all",T===c.value?"bg-hive-gold/20 text-hive-gold":"text-foreground/70 hover:bg-muted hover:text-foreground"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:c.label})]}),T===c.value&&e.jsx(Ie,{className:"w-4 h-4 text-hive-gold"})]},c.value))]})})]}),l==="video"&&(()=>{const c=_e(D);return e.jsxs(b,{className:"bg-hive-gold/10 border-hive-gold/30",children:[e.jsx(kt,{className:"w-3.5 h-3.5 text-hive-gold"}),e.jsxs("span",{className:"text-hive-gold font-semibold",children:[c.cost," Credits"]})]})})(),e.jsx(b,{children:e.jsx(Rr,{className:"w-3.5 h-3.5"})})]})]}),e.jsx("input",{ref:E,type:"file",accept:"image/*",onChange:K,className:"hidden"})]})}
1,_r=[{id:"background-remover",name:"Background Remover",shortName:"BG Remove",icon:qe,bgColor:"bg-gradient-to-br from-rose-500 to-pink-600",description:"Remove backgrounds",creditKey:"studio-bg-remover"},{id:"image-enhancer",name:"Image Enhancer",shortName:"Enhance",icon:Je,bgColor:"bg-gradient-to-br from-sky-400 to-blue-500",description:"Enhance quality",creditKey:"studio-enhancer"},{id:"hive-edit",name:"Hive Edit",shortName:"AI Edit",icon:Ct,bgColor:"bg-gradient-to-br from-violet-500 to-purple-600",description:"AI-powered editing",creditKey:"studio-hive-editor"},{id:"video-generator",name:"Video Generator",shortName:"Video",icon:Re,bgColor:"bg-gradient-to-br from-fuchsia-500 to-purple-600",description:"Create videos",creditKey:"studio-video-4s"},{id:"object-remover",name:"Object Remover",shortName:"Remove",icon:Qe,bgColor:"bg-gradient-to-br from-orange-500 to-red-500",description:"Remove objects",creditKey:"studio-object-remover"},{id:"background-generator",name:"Background Generator",shortName:"BG Gen",icon:St,bgColor:"bg-gradient-to-br from-emerald-500 to-green-600",description:"Generate backgrounds",creditKey:"studio-bg-generator"},{id:"image-to-image",name:"Image to Image",shortName:"Transform",icon:he,bgColor:"bg-gradient-to-br from-cyan-500 to-teal-500",description:"Transform images",creditKey:"studio-img2img"},{id:"corporate-headshot",name:"Corporate Photoshoots",shortName:"Photoshoots",icon:Pr,bgColor:"bg-gradient-to-br from-slate-500 to-zinc-700",description:"Professional headshots",creditKey:"studio-corporate-headshot"},{id:"brand-overlay",name:"Brand Overlay",shortName:"Brand",icon:fe,bgColor:"bg-gradient-to-br from-amber-500 to-orange-600",description:"Add branding"}],qr=({selectedTool:S,onToolSelect:j,className:p})=>e.jsx("div",{className:N("w-full py-3 px-2 md:px-4",p),children:e.jsx("div",{className:"flex items-center justify-start md:justify-center gap-1.5 md:gap-2 overflow-x-auto overflow-y-visible scrollbar-hide pb-2 pt-1",children:_r.map(v=>{const B=v.icon,x=S===v.id;return e.jsxs("button",{onClick:()=>j(v.id),className:N("group relative flex flex-col items-center gap-1.5 md:gap-2 p-2 md:p-3 rounded-xl transition-all duration-200 flex-shrink-0 overflow-visible","min-w-[72px] md:min-w-[88px]",x?"bg-white/[0.08] ring-2 ring-hive-gold 
1shadow-lg shadow-hive-gold/5":"hover:bg-white/[0.04]"),children:[e.jsx("div",{className:N("flex items-center justify-center w-9 h-9 md:w-11 md:h-11 rounded-xl transition-all duration-200 overflow-visible",v.bgColor,x?"shadow-lg ring-2 ring-white/20":"shadow-md group-hover:shadow-lg group-hover:scale-105"),children:e.jsx(B,{className:"h-5 w-5 md:h-6 md:w-6 text-white flex-shrink-0",strokeWidth:2})}),e.jsx("span",{className:N("text-[10px] md:text-xs font-semibold text-center leading-tight transition-colors whitespace-nowrap",x?"text-hive-gold":"text-white/60 group-hover:text-white/90"),children:v.shortName}),v.creditKey&&W[v.creditKey]||v.id==="brand-overlay"?e.jsxs("span",{className:N("flex items-center gap-0.5 text-[9px] font-medium",x?"text-hive-gold/80":"text-white/40"),children:[e.jsx(kt,{className:"h-2.5 w-2.5"}),v.id==="brand-overlay"?"0":v.creditKey?W[v.creditKey].cost:"0"]}):null]},v.id)})})}),Jr={"hive-edit":{icon:Ct,label:"AI Edit",description:"Transform with AI",actionLabel:"Apply Edit",gradientFrom:"from-violet-500",gradientTo:"to-purple-600",iconColor:"text-violet-400",placeholder:"Describe your edit (e.g., Make the sky purple, add dramatic lighting)..."},"background-remover":{icon:qe,label:"Background Remover",description:"Remove background instantly",actionLabel:"Remove BG",gradientFrom:"from-rose-500",gradientTo:"to-pink-600",iconColor:"text-rose-400"},"object-remover":{icon:Qe,label:"Object Remover",description:"Paint to remove objects",actionLabel:"Remove",gradientFrom:"from-orange-500",gradientTo:"to-red-500",iconColor:"text-orange-400"},"image-enhancer":{icon:Je,label:"Enhancer",description:"Enhance quality",actionLabel:"Enhance",gradientFrom:"from-sky-400",gradientTo:"to-blue-500",iconColor:"text-sky-400"},"background-generator":{icon:St,label:"BG Generator",description:"Generate new backgrounds",actionLabel:"Generate",gradientFrom:"from-emerald-500",gradientTo:"to-green-600",iconColor:"text-emerald-400",placeholder:"Describe the background (e.g., Luxury marble surface with golden lighting)..."},"video-generator":{icon:Re,label:"Video Generator",description:"Create AI videos",actionLabel:"Generate",gradientFrom:"from-fuchsia-500",gradientTo:"to-purple-600",iconColor:"text-fuchsia-400"},"image-to-image":{icon:he,label:"Transform",description:"Transform images",actionLabel:"Transform",gradientFrom:"from-cyan-500",gradientTo:"to-teal-500",iconColor:"text-cyan-400",placeholder:"Describe the transformation..."},"brand-overlay":{icon:fe,label:"Brand Overlay",description:"Add logo to images",actionLabel:"Apply",gradientFrom:"from-amber-500",gradientTo:"to-orange-600",iconColor:"text-amber-400"}},Qr=({selectedTool:S,isProcessing:j,hasImage:p,hasProcessedImage:v,onProcess:B,onDownload:x,onReset:O,onUploadClick:D,onClearMask:n,prompt:T="",onPromptChange:f,enhancementType:y,onEnhancementTypeChange:l,brightness:J=100,contrast:E=100,saturation:w=100,onBrightnessChange:_,onContrastChange:q,onSaturationChange:H,hasMask:X=!1,brushSize:V=30,onBrushSizeChange:K,className:Q})=>{const b=Jr[S];if(!b)return null;const c=b.icon,g=["hive-edit","background-generator"].includes(S),F=S==="image-enhancer",L=S==="image-enhancer",ee=S==="object-remover";return e.jsx("div",{className:N("w-full bg-[#0c0c0c]/95 backdrop-blur-xl border-b border-white/[0.05]",Q),children:e.jsxs("div",{className:"max-w-5xl mx-auto px-3 md:px-5 py-3 md:py-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:N("p-2 rounded-lg bg-gradient-to-br shadow-lg",b.gradientFrom,b.gradientTo),children:e.jsx(c,{className:"h-4 w-4 text-white",strokeWidth:2.5})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-sm font-bold text-white truncate",children:b.label}),e.jsx("span",{className:"hidden sm:inline text-xs text-white/30",children:"•"}),e.jsx("p",{className:"hidden sm:block text-xs text-white/40 truncate",children:b.description})]})}),e.jsx("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:v&&e.jsxs(P,{onClick:x,size:"sm",variant:"outline",className:"gap-1.5 border-white/10 text-white/70 hover:bg-white/5 hover:text-white text-xs px-3 h-8 rounded-lg",children:[e.jsx(le,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Save"})]})})]}),e.jsxs("div",{className:"space-y-3",children:[g&&e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",value:T,onChange:U=>f==null?void 0:f(U.target.value),placeholder:b.placeholder,className:"w-full h-10 px-4 pr-28 bg-white/[0.04] border border-white/[0.08] rounded-xl text-white text-sm placeholder:text-white/25 focus:outline-none focus:border-hive-gold/40 focu
1s:ring-1 focus:ring-hive-gold/20 transition-all"}),e.jsxs("div",{className:"absolute right-1.5 top-1/2 -translate-y-1/2 flex items-center gap-1.5",children:[O&&e.jsx(P,{onClick:O,size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-white/30 hover:text-white hover:bg-white/5",children:e.jsx(jt,{className:"h-3.5 w-3.5"})}),e.jsx(P,{onClick:B,size:"sm",disabled:j||!p&&S!=="background-generator"||g&&!T.trim(),className:N("gap-1.5 text-white font-semibold text-xs px-3 h-7 rounded-lg shadow-md transition-all bg-gradient-to-r",b.gradientFrom,b.gradientTo,"disabled:opacity-40"),children:j?e.jsx("div",{className:"h-3 w-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"h-3 w-3"}),b.actionLabel]})})]})]}),F&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-[10px] font-semibold text-white/40 uppercase tracking-wider",children:"Type:"}),[{id:"quality",label:"Quality",icon:Er},{id:"product",label:"Product",icon:pe},{id:"portrait",label:"Portrait",icon:Je},{id:"clarity",label:"Clarity",icon:Ur}].map(U=>e.jsxs("button",{onClick:()=>l==null?void 0:l(U.id),className:N("flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium transition-all",y===U.id?"bg-hive-gold text-hive-gold-foreground shadow-md":"bg-white/[0.04] text-white/60 hover:bg-white/[0.08] hover:text-white border border-white/[0.06]"),children:[e.jsx(U.icon,{className:"h-3 w-3"}),U.label]},U.id))]}),L&&p&&e.jsx("div",{className:"flex flex-wrap items-center gap-4 p-3 bg-white/[0.02] rounded-xl border border-white/[0.04]",children:[{label:"Brightness",value:J,onChange:_},{label:"Contrast",value:E,onChange:q},{label:"Saturation",value:w,onChange:H}].map(U=>e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-[120px]",children:[e.jsx("span",{className:"text-[10px] font-medium text-white/50 w-16",children:U.label}),e.jsx(We,{value:[U.value],onValueChange:$=>{var te;return(te=U.onChange)==null?void 0:te.call(U,$[0])},min:0,max:200,step:1,className:"flex-1 [&_[role=slider]]:bg-hive-gold [&_[role=slider]]:border-0 [&_[role=slider]]:h-3 [&_[role=slider]]:w-3"}),e.jsxs("span",{className:"text-[10px] text-hive-gold font-mono w-8 text-right",children:[U.value,"%"]})]},U.label))}),ee&&p&&e.jsxs("div",{className:"flex items-center gap-2 p-2.5 bg-orange-500/10 rounded-lg border border-orange-500/20",children:[e.jsx(Ar,{className:"h-3.5 w-3.5 text-orange-400 flex-shrink-0"}),e.jsxs("span",{className:"text-xs text-white/70",children:["Paint over objects to remove, then click ",e.jsx("span",{className:"font-semibold text-orange-400",children:"Remove"})]})]}),!g&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-2",children:O&&e.jsxs(P,{onClick:O,size:"sm",variant:"ghost",className:"gap-1.5 text-white/40 hover:text-white hover:bg-white/5 text-xs h-8",children:[e.jsx(jt,{className:"h-3.5 w-3.5"}),"Reset"]})}),e.jsx(P,{onClick:B,size:"sm",disabled:j||!p,className:N("gap-1.5 text-white font-semibold text-xs px-4 h-9 rounded-lg shadow-lg transition-all bg-gradient-to-r",b.gradientFrom,b.gradientTo,"disabled:opacity-40 disabled:shadow-none"),children:j?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3.5 w-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Processing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"h-3.5 w-3.5"}),b.actionLabel]})})]})]})]})})},Yr={"hive-edit":"edit with AI","background-remover":"remove the background","object-remover":"remove objects","image-enhancer":"enhance it","background-generator":"generate a new background"},ua=()=>{const S=wr(),{isAuthenticated:j}=Nt(),{openAuthModal:p}=jr(),{theme:v}=yr(),B=v==="dark"||v==="oled",x=i.useRef(null),O=i.useRef(null),D=i.useRef(null),[n,T]=i.useState(null),[f,y]=i.useState(null),[l,J]=i.useState(null),[E,w]=i.useState(!1),[_,q]=i.useState(100),[H,X]=i.useState(100),[V,K]=i.useState(100),[Q,b]=i.useState(null),[c,g]=i.useState(null),[F,L]=i.useState(30),[ee,U]=i.useState(null),[$,te]=i.useState(""),[Y,ve]=i.useState(0),[de,It]=i.useState(!1),[Ye,Rt]=i.useState(!1),[Ze,Pt]=i.useState(100),[Xe,Et]=i.useState(0),[Ke,Ut]=i.useState(0),[we,et]=i.useState(""),[Zr,At]=i.useState(!1),[je,Bt]=i.useState("quality"),[Pe,Xr]=i.useState(4),[ye,Ft]=i.useState(""),[Ee,Tt]=i.useState(8),[tt,rt]=i.useState("portrait"),[at,Ht]=i.useState("standard"),[Ne,st]=i.useState(null),[ot,it]=i.useState(!1),nt=i.useRef(null),[ce,Gt]=i.useState(""),[ge,Ot]=i.useState(null),[ue,lt]=i.useState(null);i.useState(null);const Ue=i.useRef(null),dt=i.useRef(null),[xe,Dt]=i.useState(null),[re,zt]=i.useState(null);i.useState(null);const[ie,Lt]=i.useState("bottom-right"),[ke,$t]=i.useState(35),[Ce,Mt]=i.useState(100),Ae=i.useRef(null),Be=i.useRef(null),[ct,Vt]=i.useState("none"),[Fe,Wt]=i.useState("neutral"),[mt,_t]=i.useState("1:1"),[Se,qt]=i.useState(null),[ht,gt]=i.useState(null),Te=i.useRef(null),{activeBrandKit:k,getBrandPromptEnhancement:G}=Nr(),{checkAndDeductCredits:ae,refundCredits:se,hasEnoughCredits:Kr,credits:ea,saveToMyCreations:oe}=Or();Lr(t=>
1{y(t),s.success("Background removed successfully!")});const Jt=[{id:"hive-edit",name:"Hive Editor",icon:Fr,path:"/hive-edit",color:"from-blue-500 to-cyan-500",description:"Advanced editing tools"},{id:"background-remover",name:"Background Remover",icon:qe,path:"/background-remover",color:"from-green-500 to-emerald-500",description:"Remove image background"},{id:"object-remover",name:"Object Remover",icon:Tr,path:"/object-remover",color:"from-yellow-500 to-orange-500",description:"Remove unwanted objects"},{id:"image-enhancer",name:"Image Enhancer",icon:Qe,path:"/image-enhancer",color:"from-indigo-500 to-purple-500",description:"Enhance image quality"},{id:"background-generator",name:"Background Generator",icon:Hr,path:"/background-generator",color:"from-pink-500 to-rose-500",description:"Generate new backgrounds"},{id:"video-generator",name:"Video Generator",icon:Re,path:null,color:"from-purple-500 to-violet-500",description:"Generate AI videos"},{id:"image-to-image",name:"Image to Image",icon:Gr,path:null,color:"from-teal-500 to-emerald-500",description:"Transform images with AI"},{id:"corporate-headshot",name:"Corporate Photoshoots",icon:Me,path:null,color:"from-slate-500 to-zinc-600",description:"Professional headshots"},{id:"brand-overlay",name:"Brand Overlay",icon:fe,path:null,color:"from-amber-500 to-orange-500",description:"Add logo to images"}];i.useEffect(()=>{if(n){const t=new Image;t.onload=()=>{U({width:t.width,height:t.height})},t.src=n}else U(null)},[n]);const Qt=t=>{var a;const o=(a=t.target.files)==null?void 0:a[0];if(!o)return;if(!o.type.startsWith("image/")){s.error("Please upload a valid image file"),x.current&&(x.current.value="");return}if(o.size>10*1024*1024){s.error("Image size must be less than 10MB"),x.current&&(x.current.value="");return}const r=new FileReader;r.onload=d=>{var I;const m=(I=d.target)==null?void 0:I.result;T(m),y(m),J(null),b(null),g(null),s.success("Image uploaded to canvas!"),x.current&&(x.current.value="")},r.onerror=()=>{s.error("Failed to read image file"),x.current&&(x.current.value="")},r.readAsDataURL(o)},Yt=async t=>{J(t.id),w(!1),At(!1),s.dismiss(),t.id==="background-remover"?s.success("Backgroun
1d Remover activated",{id:"tool-toast"}):t.id==="hive-edit"?s.success("Hive Edit mode activated",{id:"tool-toast"}):t.id==="object-remover"?(y(n),b(null),g(null),s.info("Use brush to mark objects to remove",{id:"tool-toast"})):t.id==="image-enhancer"?s.success("Image Enhancer activated",{id:"tool-toast"}):t.id==="background-generator"?s.info("Enter a prompt for new background",{id:"tool-toast"}):t.id==="video-generator"&&s.info("Enter a prompt to generate video",{id:"tool-toast"})},Zt=(t,o)=>{o==null||o.size,b(t),g(o)},Xt=async()=>{if(!j){p(),s.error("Please sign in to remove objects");return}if(!n){s.error("Please upload an image first");return}const t=W["studio-object-remover"];if(await ae(t)){w(!0),s.loading(Q?"Removing marked objects with AI...":"Auto-detecting and removing objects...",{id:"object-removal"});try{const{data:r,error:a}=await R.functions.invoke("image-ai",{body:{operation:"remove-object",imageUrl:n,maskUrl:Q||void 0,...G()&&{brandGuidelines:G()}}});if(a)throw a;if(r!=null&&r.imageUrl)y(r.imageUrl),await oe(r.imageUrl,"Object removal","object-remover","Studio Hub",k==null?void 0:k.id),s.success("Objects removed successfully!",{id:"object-removal"});else throw r!=null&&r.error?new Error(r.error):new Error("No image returned from service")}catch(r){console.error("Object removal error:",r),await se(t,"Object removal failed"),s.error(r.message||"Failed to remove objects",{id:"object-removal"})}finally{w(!1)}}},ut=()=>{var t;(t=D.current)==null||t.clearMask(),b(null),g(null),s.info("Mask cleared")},Kt=async()=>{if(!j){p(),s.error("Please sign in to generate backgrounds");return}if(!$.trim()){s.error("Please enter a background description");return}const t=W["studio-bg-generator"];if(await ae(t)){w(!0),s.loading("Generating background...",{id:"bg-gen"});try{const{data:r,error:a}=await R.functions.invoke("image-ai",{body:{operation:n?"replace-background":"generate",imageUrl:n,prompt:$,...G()&&{brandGuidelines:G()}}});if(a)throw a;if(r!=null&&r.imageUrl)y(r.imageUrl),n||T(r.imageUrl),await oe(r.imageUrl,$,"background-generator","Studio Hub",k==null?void 0:k.id),s.success("Backgroun
1d generated!",{id:"bg-gen"});else throw r!=null&&r.error?new Error(r.error):new Error("No image returned from service")}catch(r){console.error("Background generation error:",r),await se(t,"Background generation failed"),s.error(r.message||"Failed to generate background",{id:"bg-gen"})}finally{w(!1)}}},er=async()=>{if(!n)return;if(!j){p(),s.error("Please sign in to remove backgrounds");return}const t=W["studio-bg-remover"];if(await ae(t)){w(!0),s.loading("Removing background with AI...",{id:"bg-removal"});try{const{data:r,error:a}=await R.functions.invoke("image-ai",{body:{operation:"remove-background",imageUrl:n,...G()&&{brandGuidelines:G()}}});if(a)throw a;if(r!=null&&r.imageUrl)y(r.imageUrl),await oe(r.imageUrl,"Background removal","background-remover","Studio Hub",k==null?void 0:k.id),s.success("Background removed!",{id:"bg-removal"});else throw r!=null&&r.error?new Error(r.error):new Error("No image returned from service")}catch(r){console.error("Background removal error:",r),await se(t,"Background removal failed"),s.error(r.message||"Failed to remove background",{id:"bg-removal"})}finally{w(!1)}}},tr=()=>{if(!O.current||!n)return;const t=O.current,o=t.getContext("2d");if(!o)return;const r=new Image;r.onload=()=>{t.width=r.width,t.height=r.height,o.clearRect(0,0,t.width,t.height),o.save(),o.translate(t.width/2,t.height/2);const a=Ze/100;o.scale(a,a),o.rotate(Y*Math.PI/180),o.scale(de?-1:1,Ye?-1:1),o.filter=`blur(${Xe}px) hue-rotate(${Ke}deg)`,o.drawImage(r,-r.width/2,-r.height/2,r.width,r.height),o.restore();const d=t.toDataURL("image/png");y(d)},r.src=n};i.useEffect(()=>{l==="hive-edit"&&n&&tr()},[Y,de,Ye,Xe,Ke,Ze,l,n]);const rr=()=>{ve(0),It(!1),Rt(!1),Pt(100),Et(0),Ut(0),y(n),s.success("Settings reset to original image")},ar=async()=>{if(!j){p(),s.error("Please sign in to generate headshots");return}const t=Se||n;if(!t){s.error("Please upload a photo first");return}const o=W["studio-corporate-headshot"];if(await ae(o)){w(!0),s.loading("Generating professional headshot...",{id:"headshot-gen"});try{let a=t;if(t.startsWith("data:")){const I=t.split(",")[1],C=t.split(";")[0].split(":")[1],h=C.includes("png")?"png":"jpg",A=`headshot-input/${Date.now()}-${crypto.randomUUID()}.${h}`,u=Uint8Array.from(atob(I),z=>z.charCodeAt(0)),{error:M}=await R.storage.from("image-uploads").upload(A,u,{contentType:C});if(M)throw new Error("Failed to upload image: "+M.message);const{data:{publicUrl:Z}}=R.storage.from("image-uploads").getPublicUrl(A);a=Z}const{data:d,error:m}=await R.functions.invoke("corporate-headshot",{body:{input_image:a,gender:ct,background:Fe,aspect_ratio:mt,output_format:"png",...G()&&{brandGuidelines:G()}}});if(m)throw m;if(d!=null&&d.imageUrl)gt(d.imageUrl),y(d.imageUrl),await oe(d.imageUrl,`Corporate headshot - ${Fe} background`,"corporate-headshot","Studio Hub",k==null?void 0:k.id),s.success("Professional headshot generated!",{id:"headshot-gen"});else throw d!=null&&d.error?new Error(d.error):new Error("No image returned from service")}catch(a){console.error("Corporate headshot error:",a),await se(o,"Corporate headshot failed"),s.error(a.message||"Failed to generate headshot",{id:"headshot-gen"})}finally{w(!1)}}},sr=async()=>{if(!j){p(),s.error("Please sign in to edit images");return}if(!we.trim()){s.error("Please enter editing instructions");return}const t=f||n;if(!t){s.error("Please upload an image first");return}const o=W["studio-hive-editor"];if(await ae(o)){w(!0),s.loading(`Applying AI edits (${o.cost} credits)...`,{id:"hive-edit-ai"});try{const{data:a,error:d}=await R.functions.invoke("image-ai",{body:{operation:"hive-edit",imageUrl:t,prompt:we,...G()&&{brandGuidelines:G()}}});if(d)throw d;if(a!=null&&a.error)throw new Error(a.error);if(!(a!=null&&a.imageUrl))throw new Error("No image returned from service");y(a.imageUrl),T(a.imageUrl),await oe(a.imageUrl,we,"hive-edit","Studio Hub - Hive Editor",k==null?void 0:k.id),s.success("✨ Edits applied!",{id:"hive-edit-ai"}),et("")}catch(a){console.error("Hive edit AI error:",a),await se(o,"AI edit failed"),s.error(a.message||"Failed to apply AI edits",{id:"hive-edit-ai"})}finally{w(!1)}}},or=async()=>
1{if(!j){p(),s.error("Please sign in to enhance images");return}if(!n){s.error("Please upload an image first");return}const t=W["studio-enhancer"];if(await ae(t)){w(!0),s.loading(`Enhancing image with ${je} enhancement at ${Pe}x resolution...`,{id:"enhance"});try{const a=await(await fetch(n)).blob(),d=new File([a],"image.png",{type:"image/png"}),m=d.name.split(".").pop(),C=`${`${Math.random()}.${m}`}`,{error:h}=await R.storage.from("image-uploads").upload(C,d,{cacheControl:"3600",upsert:!1});if(h)throw new Error("Failed to upload image: "+h.message);const{data:{publicUrl:A}}=R.storage.from("image-uploads").getPublicUrl(C),{data:u,error:M}=await R.functions.invoke("image-enhancement",{body:{image:A,enhancementType:je,desiredIncrease:Pe,...G()&&{brandGuidelines:G()}}});if(M)throw M;if(u!=null&&u.url)y(u.url),await oe(u.url,`${je} enhancement ${Pe}x`,"image-enhancer","Studio Hub",k==null?void 0:k.id),s.success("Image enhanced successfully!",{id:"enhance"});else throw u!=null&&u.error?new Error(u.error):new Error("No image returned from enhancement service")}catch(r){console.error("Image enhancement error:",r),await se(t,"Enhancement failed"),s.error(r.message||"Failed to enhance image",{id:"enhance"})}finally{w(!1)}}},ir=async()=>{if(!j){p(),s.error("Please sign in to generate videos");return}if(!ye.trim()){s.error("Please enter a video prompt");return}const t=_e(Ee);if(await ae(t)){w(!0),s.loading("Starting video generation...",{id:"video-gen"});try{const{data:r,error:a}=await R.functions.invoke("sora-video-generation",{body:{prompt:ye,seconds:Ee,aspectRatio:tt,resolution:at==="high"?"1080p":"720p",inputReference:n||void 0,...G()&&{brandGuidelines:G()}}});if(a)throw a;if(r!=null&&r.error)throw new Error(r.error);if(!(r!=null&&r.predictionId))throw new Error("No prediction ID returned");const d=r.predictionId;let m=0;const I=120,C=(h,A)=>{const u=Math.min(95,Math.floor(h/I*100));return h<=5?`Initializing generation... (${u}%)`:h<=15?`Preparing video frames... (${u}%)`:h<=40?`Rendering video content... (${u}%)`:h<=80?`Processing video effects... (${u}%)`:`Finalizing video... (${u}%)`};for(s.loading(C(0,"starting"),{id:"video-gen"});m<I;){await new Promise(M=>setTimeout(M,5e3)),m++;const{data:h,error:A}=await R.functions.invoke("sora-video-generation",{body:{predictionId:d}});if(A){s.loading(`Retrying connection... (${Math.min(95,Math.floor(m/I*100))}%)`,{id:"video-gen"});continue}const u=(h==null?void 0:h.status)||"processing";if(s.loading(C(m,u),{id:"video-gen"}),u==="succeeded"&&(h!=null&&h.output)){st(h.output),await oe(h.output,ye,"video","Studio Hub Video",k==null?void 0:k.id),s.success("Video generated successfully!",{id:"video-gen",duration:5e3}),w(!1);return}if(u==="failed")throw new Error((h==null?void 0:h.error)||"Video generation failed")}throw new Error("Video generation timed out after 10 minutes")}catch(r){console.error("Video generation error:",r),await se(t,"Video generation failed"),s.error(r.message||"Failed to generate video",{id:"video-gen"}),w(!1)}}},nr=t=>{var a;const o=(a=t.target.files)==null?void 0:a[0];if(!o)return;if(!o.type.startsWith("image/")){s.error("Please select an image file");return}const r=new FileReader;r.onload=d=>{var m;Ot((m=d.target)==null?void 0:m.result)},r.readAsDataURL(o)},lr=t=>{var a;const o=(a=t.target.files)==null?void 0:a[0];if(!o)return;if(!o.type.startsWith("image/")){s.error("Please select an image file");return}const r=new FileReader;r.onload=d=>{var m;lt((m=d.target)==null?void 0:m.result)},r.readAsDataURL(o)},dr=async()=>{if(!j){p(),s.error("Please sign in to transform images");return}const t=ge||n;if(!t){s.error("Please upload an image first");return}if(!ce.trim()){s.error("Please enter a transformation prompt");return}const o=W["studio-img2img"];if(await ae(o)){w(!0),s.loading("Transforming image with AI...",{id:"img2img"});try{const{data:{user:a}}=await R.auth.getUser();if(!a)throw new Error("Please sign in to use this feature");const d=t.split(",")[1],m=Uint8Array.from(atob(d),He=>He.charCodeAt(0)),I=new Blob([m],{type:"image/png"}),C=`img2img-input-${Date.now()}.png`,h=`${a.id}/${C}`,{error:A}=await R.storage.from("hive-edit-images").upload(h,I,{contentType:"image/png",upsert:!0});if(A)throw A;const{data:{publicUrl:u}}=R.storage.from("hive-edit-images").getPublicUrl(h);let M=null;
1if(ue){const He=ue.split(",")[1],ur=Uint8Array.from(atob(He),br=>br.charCodeAt(0)),xr=new Blob([ur],{type:"image/png"}),pr=`img2img-ref-${Date.now()}.png`,ft=`${a.id}/${pr}`,{error:bt}=await R.storage.from("hive-edit-images").upload(ft,xr,{contentType:"image/png",upsert:!0});if(bt)throw bt;const{data:{publicUrl:fr}}=R.storage.from("hive-edit-images").getPublicUrl(ft);M=fr}const Z=M?`Transform the source image using the style and visual elements from the reference image. ${ce}`:ce,{data:z,error:pt}=await R.functions.invoke("gemini-image-to-image",{body:{prompt:Z,imageUrl:u,referenceImageUrl:M,aspectRatio:"match_input_image",outputFormat:"jpg",...G()&&{brandGuidelines:G()}}});if(pt)throw pt;if(z!=null&&z.error)throw new Error(z.error);if(z!=null&&z.output)y(z.output),await oe(z.output,ce,"image-to-image","Studio Hub",k==null?void 0:k.id),s.success("Image transformed successfully!",{id:"img2img"});else throw new Error("No output returned from transformation")}catch(a){console.error("Image to image error:",a),await se(W["studio-img2img"],"Image transformation failed"),s.error(a.message||"Failed to transform image",{id:"img2img"})}finally{w(!1)}}},cr=t=>{var r;const o=(r=t.target.files)==null?void 0:r[0];if(o&&o.type.startsWith("image/")){const a=new FileReader;a.onload=d=>{var m;Dt((m=d.target)==null?void 0:m.result)},a.readAsDataURL(o)}},mr=t=>{var r;const o=(r=t.target.files)==null?void 0:r[0];if(o&&o.type.startsWith("image/")){const a=new FileReader;a.onload=d=>{var m;zt((m=d.target)==null?void 0:m.result)},a.readAsDataURL(o)}},hr=t=>{const o=document.createElement("canvas"),r=o.getContext("2d");if(!r)throw new Error("Failed to create logo canvas context");o.width=t.width,o.height=t.height,r.drawImage(t,0,0);const a=r.getImageData(0,0,o.width,o.height),d=a.data,m=240,I=20;for(let C=0;C<d.length;C+=4){const h=d[C],A=d[C+1],u=d[C+2];if(h>=m&&A>=m&&u>=m)d[C+3]=0;else if(h>=m-I&&A>=m-I&&u>=m-I){const Z=((h+A+u)/3-(m-I))/I;d[C+3]=Math.max(0,Math.round(d[C+3]*(1-Z)))}}return r.putImageData(a,0,0),o},gr=async()=>{if(!j){p(),s.error("Please sign in to apply brand overlay");return}const t=xe||n;if(!t){s.error("Please upload a base image");return}if(!re){s.error("Please upload a logo/brand image");return}w(!0),s.loading("Processing logo & adding brand...",{id:"brand-overlay"});try{const o=document.createElement("canvas"),r=o.getContext("2d");if(!r)throw new Error("Failed to create canvas context");const a=new window.Image;a.crossOrigin="anonymous",await new Promise((Z,z)=>{a.onload=Z,a.onerror=z,a.src=t});const d=new window.Image;d.crossOrigin="anonymous",await new Promise((Z,z)=>{d.onload=Z,d.onerror=z,d.src=re}),o.width=a.width,o.height=a.height,r.drawImage(a,0,0);const m=hr(d),I=a.width*ke/100,C=d.height/d.width*I,h=Math.min(a.width,a.height)*.03;let A=0,u=0;switch(ie){case"top-left":A=h,u=h;break;case"top-right":A=a.width-I-h,u=h;break;case"bottom-left":A=h,u=a.height-C-h;break;case"bottom-right":A=a.width-I-h,u=a.height-C-h;break;case"center":A=(a.width-I)/2,u=(a.height-C)/2;break}r.globalAlpha=Ce/100,r.drawImage(m,A,u,I,C),r.globalAlpha=1;const M=o.toDataURL("image/png");y(M),s.success("Brand added with transparent background!",{id:"brand-overlay"})}catch(o){console.error("Brand overlay error:",o),s.error(o.message||"Failed to add brand to image",{id:"brand-overlay"})}finally{w(!1)}},me=async()=>{if(f)try{s.loading("Preparing download...",{id:"download"});const t=await fetch(f);if(!t.ok)throw new Error("Failed to fetch image");const o=await t.blob(),r=URL.createObjectURL(o),a=document.createElement("a");a.href=r,a.download=`design-hive-${l||"image"}-${Date.now()}.png`,document.body.appendChild(a),a.click(),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(r),100),s.success("Image downloaded to your downloads folder!",{id:"download"})}catch(t){console.error("Download error:",t),s.error("Failed to download image. Please try right-clicking the image to save it.",{id:"download"})}},xt=()=>{T(null),y(null),J(null),q(100),X(100),K(100),b(null),g(null),s.success("Canvas cleared")};return e.jsxs(e.Fragment,{children:[e.jsxs(kr,{children:[e.jsx("title",{children:"Studio Hub - Creative Worksp
1ace | Design Hive"}),e.jsx("meta",{name:"description",content:"Access all Design Hive creative tools in one professional workspace. Generate, edit, and design with AI-powered tools."})]}),e.jsx("div",{className:N("min-h-screen pb-4",B?"bg-background":"studio-hub-light bg-slate-50"),children:e.jsxs("div",{className:"container mx-auto px-2 md:px-4 max-w-[1600px]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3 md:py-4 px-2 md:px-4 mb-1",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(zr,{className:"-ml-3"}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("h1",{className:N("text-lg md:text-xl font-bold tracking-tight truncate",B?"text-white":"text-slate-900"),children:"Studio Hub"}),e.jsxs("span",{className:"hidden sm:inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-emerald-500/10 border border-emerald-500/25 text-[10px] font-bold uppercase tracking-wider text-emerald-500",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-emerald-400 animate-pulse"}),"All tools live"]})]}),e.jsx("p",{className:N("text-xs mt-0.5 truncate",B?"text-white/40":"text-slate-500"),children:"One canvas, every Design Hive tool — upload an image or pick a tool to start."})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs(P,{onClick:()=>{var t;return(t=x.current)==null?void 0:t.click()},size:"sm",className:"gap-1.5 bg-gradient-primary text-white font-bold text-xs px-4 h-8 shadow-lg shadow-hive-gold/5 rounded-lg transition-all",children:[e.jsx(Le,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden md:inline",children:"Upload"})]}),e.jsxs(P,{onClick:()=>S("/my-designs"),size:"sm",variant:"ghost",className:N("gap-1.5 text-xs h-8",B?"text-white/50 hover:text-white hover:bg-white/5":"text-slate-500 hover:text-slate-900 hover:bg-slate-100"),children:[e.jsx(le,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden md:inline",children:"My Designs"})]})]})]}),e.jsxs(Ve,{className:"relative w-full mx-auto bg-[#0a0a0a] border border-white/[0.05] shadow-2xl overflow-hidden rounded-2xl",children:[e.jsxs("div",{className:"relative z-30 bg-[#0a0a0a] border-b border-white/[0.06]",children:[n&&e.jsx("div",{className:"flex items-center justify-end px-3 md:px-4 py-2 border-b border-white/[0.03]",children:e.jsxs(P,{onClick:xt,size:"sm",variant:"ghost",className:"gap-1 text-white/30 hover:text-white hover:bg-white/5 text-xs px-2 h-7",children:[e.jsx($e,{className:"h-3.5 w-3.5"}),"Clear"]})}),e.jsx(qr,{selectedTool:l,onToolSelect:t=>{const o=Jt.find(r=>r.id===t);o&&Yt(o)}})]}),e.jsxs("div",{className:"flex flex-col bg-[#080808] z-10 overflow-hidden flex-1 min-h-0",children:[l&&l!=="video-generator"&&l!=="brand-overlay"&&l!=="image-to-image"&&l!=="corporate-headshot"&&e.jsx(Qr,{selectedTool:l,isProcessing:E,hasImage:!!n,hasProcessedImage:!!f&&f!==n,onProcess:()=>{if(!j){p(),s.error("Please sign in to use this tool");return}l==="hive-edit"?sr():l==="background-remover"?er():l==="object-remover"?Xt():l==="image-enhancer"?or():l==="background-generator"&&Kt()},onDownload:me,onReset:()=>{l==="hive-edit"?rr():l==="image-enhancer"?(q(100),X(100),K(100)):l==="object-remover"&&ut()},onClearMask:ut,prompt:l==="hive-edit"?we:$,onPromptChange:t=>{l==="hive-edit"?et(t):te(t)},enhancementType:je,onEnhancementTypeChange:t=>Bt(t),brightness:_,contrast:H,saturation:V,onBrightnessChange:q,onContrastChange:X,onSaturationChange:K,hasMask:!!Q,brushSize:F,onBrushSizeChange:L}),l==="image-to-image"&&e.jsx("div",{className:"flex-1 bg-[#0a0a0a] p-4 md:p-8 overflow-y-auto",children:e.jsx("div",{className:"max-w-7xl mx-auto h-full flex flex-col",children:e.jsxs("div",{className:"flex-1 grid lg:grid-cols-12 gap-6 items-start",children:[e.jsxs("div",{className:"lg:col-span-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-white/50 uppercase tracking-wider font-medium",children:"Source Image"}),e.jsx("input",{type:"file",ref:Ue,onChange:nr,accept:"image/*",className:"hidden"}),(ge||n)&&e.jsxs(P,{size:"sm",variant:"ghost",onClick:()=>{var t;return(t=Ue.current)==null?void 0:t.click()},className:"text-xs text-white/60 hover:text-white hover:bg-white/10 h-7 px-2",children:[e.jsx(he,{className:"h-3 w-3 mr-1.5"}),"Change"]})]}),ge||n?e.jsx("div",{className:"relative rounded-2xl overflow-hidden bg-gradient-to-br from-[#0d0d0d] to-[#111] border border-white/5 flex items-center justify-center",style:{minHeight:"380px"},children:e.jsx("div",{className:"p-4 w-full h-full flex items-center justify-center",children:e.jsx("img",{src:ge||n||"",alt:"Source",className:"max-w-full max-h-[350px] w-auto h-auto object-contain rounded-xl shadow-2xl ring-1 ring-white/10"})})}):e.jsxs("div",{onClick:()=>{var t;return(t=Ue.current)==null?void 0:t.click()},className:"rounded-2xl border-2 border-dashed border-white/10 bg-white/[0.02] flex flex-col items-center justify-center cursor-pointer hover:border-teal-500/40 hover:bg-teal-500/5 transition-all group",style:{minHeight:"380px"},children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-white/5 flex items-center justify-center mb-3 group-hover:bg-teal-500/10 transition-colors",children:e.jsx(pe,{className:"h-8 w-8 text-white/30 group-hover:text-teal-400/60 transition-colors"})}),e.jsx("span",{className:"text-sm text-white/50 font-medium",children:"Upload source image"}),e.jsx("span",{className:"text-xs text-white/30 mt-1",children:"JPG, PNG, WebP"})]})]}),e.jsxs("div",{className:"lg:col-span-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-white/50 uppercase tracking-wider font-medium",children:["Reference ",e.jsx("span",{className:"text-white/30",children:"(Optional)"})]}),e.jsx("input",{type:"file",ref:dt,onChange:lr,accept:"image/*",className:"hidden"}),ue&&e.jsx(P,{size:"sm",variant:"ghost",onClick:()=>lt(null),className:"text-xs text-white/60 hover:text-red-400 hover:bg-red-500/10 h-7 px-2",children:e.jsx($e,{className:"h-3 w-3"})})]}),ue?e.jsxs("div",{className:"relative rounded-2xl overflow-hidden bg-gradient-to-br from-[#0d0d0d] to-[#111] border border-teal-500/20 flex items-center justify-center",style:{minHeight:"180px"},children:[e.jsx("div",{className:"p-3 w-full h-full flex items-center justify-center",children:e.jsx("img",{src:ue,alt:"Reference",className:"max-w-full max-h-[160px] w-auto h-auto object-contain rounded-lg shadow-lg"})}),e.jsx("div",{className:"absolute top-2 left-2 px-2 py-1 bg-teal-500/20 backdrop-blur-sm rounded-md",children:e.jsx("span",{className:"text-[10px] text-teal-300 font-medium",children:"Style Guide"})})]}):e.jsxs("div",{onClick:()=>{var t;return(t=dt.current)==null?void 0:t.click()},className:"rounded-2xl border-2 border-dashed border-white/10 bg-white/[0.02] flex flex-col items-center justify-center cursor-pointer hover:border-teal-500/30 hover:bg-teal-500/5 transition-all group",style:{minHeight:"180px"},children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/5 flex items-center justify-center mb-2 group-hover:bg-teal-500/10 transition-colors",children:e.jsx(Me,{className:"h-5 w-5 text-white/30 group-hover:text-teal-400/60 transition-colors"})}),e.jsx("span",{className:"text-xs text-white/50 font-medium",children:"Add reference"}),e.jsx("span",{className:"text-[10px] text-white/30 mt-0.5",children:"Style or composition"})]}),e.jsxs("div",{className:"rounded-xl bg-white/[0.02] border border-white/5 p-3 space-y-2",children:[e.jsx("span",{className:"text-[10px] text-white/40 uppercase tracking-wider font-medium",children:"Tips"}),e.jsxs("ul",{className:"space-y-1",children:[e.jsxs("li",{className:"text-[11px] text-white/50 flex items-start gap-2",children:[e.jsx("span",{className:"text-teal-400 mt-0.5",children:"•"}),"Reference guides style transfer"]}),e.jsxs("li",{className:"text-[11px] text-white/50 flex items-start gap-2",children:[e.jsx("span",{className:"text-teal-400 mt-0.5",children:"•"}),"Describe desired changes clearly"]})]})]})]}),e.jsxs("div",{className:"lg:col-span-4 space-y-4",children:[e.jsxs("div",{className:"rounded-2xl bg-gradient-to-br from-[#0d0d0d] to-[#0f0f0f] border border-white/5 p-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-xs text-white/50 uppercase tracking-wider font-medium",children:"Transformation Prompt"}),e.jsx("textarea",{value:ce,onChange:t=>Gt(t.target.value),placeholder:"Describe how to transform the image... e.g., 'Convert to anime style with vibrant colors' or 'Make it look like a watercolor painting'",rows:5,className:"w-full bg-white/5 border border-white/10 text-white rounded-xl px-4 py-3 text-sm placeholder:text-white/30 focus:outline-none focus:border-teal-500/50 focus:ring-1 focus:ring-teal-500/20 resize-none"})]}),e.jsx(P,{onClick:dr,disabled:E||!ge&&!n||!ce.trim(),className:"w-full bg-gradient-to-r from-teal-500 to-cyan-500 hover:from-teal-400 hover:to-cyan-400 text-white font-bold py-5 text-sm shadow-lg shadow-teal-500/20 rounded-xl disabled:opacity-40",children:E?e.
1jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-4 w-4 mr-2 border-2 border-white/30 border-t-white rounded-full animate-spin"})," Transforming..."]}):e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"h-4 w-4 mr-2"})," Transform Image"]})})]}),f&&e.jsxs("div",{className:"rounded-2xl bg-gradient-to-br from-[#0d0d0d] to-[#0f0f0f] border border-teal-500/20 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-white/50 uppercase tracking-wider font-medium flex items-center gap-2",children:"Result"}),e.jsxs(P,{onClick:me,size:"sm",className:"gap-1.5 bg-hive-gold hover:bg-hive-gold-light text-hive-gold-foreground font-bold text-xs px-4 h-8 shadow-lg shadow-hive-gold/5 rounded-lg",children:[e.jsx(le,{className:"h-3.5 w-3.5"}),"Download"]})]}),e.jsx("div",{className:"rounded-xl overflow-hidden bg-[#080808] flex items-center justify-center",style:{minHeight:"220px"},children:e.jsx("img",{src:f,alt:"Transformed result",className:"max-w-full max-h-[260px] object-contain rounded-lg shadow-2xl"})})]})]})]})})}),l==="corporate-headshot"&&e.jsx("div",{className:"flex-1 bg-[#0a0a0a] p-4 md:p-8 overflow-y-auto",children:e.jsx("div",{className:"max-w-4xl mx-auto h-full flex flex-col",children:e.jsxs("div",{className:"flex-1 grid lg:grid-cols-2 gap-8 items-start",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-white/50 uppercase tracking-wider font-medium",children:"Upload Photo"}),e.jsx("input",{type:"file",ref:Te,onChange:t=>{var a;const o=(a=t.target.files)==null?void 0:a[0];if(!o)return;const r=new FileReader;r.onload=d=>{var m;qt((m=d.target)==null?void 0:m.result),gt(null)},r.readAsDataURL(o),t.target.value=""},accept:"image/*",className:"hidden"})]}),Se||n?e.jsxs("div",{className:"relative rounded-2xl overflow-hidden bg-[#0d0d0d] border border-white/5 flex items-center justify-center",style:{minHeight:"300px"},children:[e.jsx("img",{src:Se||n||"",alt:"Source",className:"max-w-full max-h-[300px] w-auto h-auto object-contain rounded-xl shadow-2xl ring-1 ring-white/10 p-3"}),e.jsxs(P,{size:"sm",variant:"ghost",onClick:()=>{var t;return(t=Te.current)==null?void 0:t.click()},className:"absolute top-2 right-2 text-xs text-white/60 hover:text-white hover:bg-white/10 h-7 px-2",children:[e.jsx(he,{className:"h-3 w-3 mr-1"}),"Change"]})]}):e.jsxs("div",{onClick:()=>{var t;return(t=Te.current)==null?void 0:t.click()},className:"rounded-2xl border-2 border-dashed border-white/10 bg-white/[0.02] flex flex-col items-center justify-center cursor-pointer hover:border-zinc-400/40 hover:bg-white/[0.04] transition-all group",style:{minHeight:"300px"},children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-white/5 flex items-center justify-center mb-3 group-hover:bg-white/10 transition-colors",children:e.jsx(Le,{className:"h-8 w-8 text-white/30 group-hover:text-white/60 transition-colors"})}),e.jsx("span",{className:"text-sm text-white/50 font-medium",children:"Upload your photo"}),e.jsx("span",{className:"text-xs text-white/30 mt-1",children:"JPG, PNG, WebP"})]}),e.jsxs("div",{className:"space-y-4 bg-white/[0.03] rounded-xl p-4 border border-white/5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-white/50 uppercase tracking-wider font-medium mb-2 block",children:"Gender"}),e.jsx("div",{className:"flex gap-2",children:["none","male","female"].map(t=>e.jsx("button",{onClick:()=>Vt(t),className:N("flex-1 py-2 px-3 rounded-lg text-xs font-medium transition-all capitalize",ct===t?"bg-hive-gold text-white":"bg-white/5 text-white/60 hover:bg-white/10"),children:t==="none"?"Auto":t},t))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-white/50 uppercase tracking-wider font-medium mb-2 block",children:"Backgroun
1d"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:["neutral","white","black","gray","office"].map(t=>e.jsx("button",{onClick:()=>Wt(t),className:N("py-2 px-3 rounded-lg text-xs font-medium transition-all capitalize",Fe===t?"bg-hive-gold text-white":"bg-white/5 text-white/60 hover:bg-white/10"),children:t},t))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-white/50 uppercase tracking-wider font-medium mb-2 block",children:"Aspect Ratio"}),e.jsx("div",{className:"flex gap-2",children:["1:1","4:3","3:4","16:9"].map(t=>e.jsx("button",{onClick:()=>_t(t),className:N("flex-1 py-2 px-3 rounded-lg text-xs font-medium transition-all",mt===t?"bg-hive-gold text-white":"bg-white/5 text-white/60 hover:bg-white/10"),children:t},t))})]})]}),e.jsx(P,{onClick:ar,disabled:E||!(Se||n),className:"w-full h-12 bg-gradient-to-r from-zinc-600 to-zinc-700 hover:from-zinc-500 hover:to-zinc-600 text-white font-bold rounded-xl shadow-lg",children:E?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-4 w-4 border-2 border-white/30 border-t-white rounded-full animate-spin mr-2"})," Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"h-4 w-4 mr-2"})," Generate Professional Headshot"]})}),e.jsx(Dr,{config:W["studio-corporate-headshot"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("span",{className:"text-xs text-white/50 uppercase tracking-wider font-medium",children:"Result"}),ht?e.jsxs("div",{className:"relative rounded-2xl overflow-hidden bg-[#0d0d0d] border border-white/5 flex items-center justify-center",style:{minHeight:"400px"},children:[e.jsx("img",{src:ht,alt:"Professional Headshot",className:"max-w-full max-h-[500px] w-auto h-auto object-contain rounded-xl shadow-2xl ring-1 ring-white/10 p-3"}),e.jsx("div",{className:"absolute bottom-3 right-3 flex gap-2",children:e.jsxs(P,{size:"sm",onClick:me,className:"gap-1.5 bg-hive-gold hover:bg-hive-gold-light text-black font-bold text-xs px-4 h-9 shadow-lg rounded-lg",children:[e.jsx(le,{className:"h-3.5 w-3.5"})," Download"]})})]}):e.jsxs("div",{className:"rounded-2xl border border-white/5 bg-white/[0.02] flex flex-col items-center justify-center",style:{minHeight:"400px"},children:[e.jsx(Me,{className:"h-12 w-12 text-white/10 mb-3"}),e.jsx("span",{className:"text-sm text-white/30",children:"Your professional headshot will appear here"})]})]})]})})}),l==="brand-overlay"&&e.jsx("div",{className:"flex-1 bg-[#0a0a0a] p-4 md:p-8 overflow-y-auto",children:e.jsx("div",{className:"max-w-6xl mx-auto h-full flex flex-col",children:e.jsxs("div",{className:"flex-1 grid lg:grid-cols-2 gap-8 items-start",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-white/50 uppercase tracking-wider font-medium",children:"Base Image"}),e.jsx("input",{type:"file",ref:Ae,onChange:cr,accept:"image/*",className:"hidden"}),(xe||n)&&e.jsxs(P,{size:"sm",variant:"ghost",onClick:()=>{var t;return(t=Ae.current)==null?void 0:t.click()},className:"text-xs text-white/60 hover:text-white hover:bg-white/10 h-7 px-2",children:[e.jsx(he,{className:"h-3 w-3 mr-1.5"}),"Change"]})]}),xe||n?e.jsx("div",{className:"relative rounded-2xl overflow-hidden bg-[#0d0d0d] border border-white/5 flex items-center justify-center",style:{minHeight:"420px"},children:e.jsxs("div",{className:"relative p-6 w-full h-full flex items-center justify-center",children:[e.jsx("img",{src:xe||n||"",alt:"Base",className:"max-w-full max-h-[380px] w-auto h-auto object-contain rounded-xl shadow-2xl"}),re&&e.jsx("div",{className:"absolute pointer-events-none",style:{width:`${ke}%`,opacity:Ce/100,...ie==="top-left"&&{top:"8%",left:"8%"},...ie==="top-right"&&{top:"8%",right:"8%"},...ie==="bottom-left"&&{bottom:"8%",left:"8%"},...ie==="bottom-right"&&{bottom:"8%",right:"8%"},...ie==="center"&&{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}},children:e.jsx("img",{src:re,alt:"Logo preview",className:"w-full h-auto object-contain drop-shadow-[0_4px_12px_rgba(0,0,0,0.9)]"})})]})}):e.jsxs("div",{onClick:()=>{var t;return(t=Ae.current)==null?void 0:t.click()},className:"rounded-2xl border-2 border-dashed border-white/10 bg-white/[0.02] flex flex-col items-center justify-center cursor-pointer hover:border-hive-gold/40 hover:bg-hive-gold/5 transition-all group",style:{minHeight:"420px"},children:[e.jsx("div",{className:"w-20 h-20 rounded-2xl bg-white/5 flex items-center justify-center mb-4 group-hover:bg-hive-gold/10 transition-colors",children:e.jsx(pe,{className:"h-10 w-10 text-white/30 group-hover:text-hive-gold/60 transition-colors"})}),e.jsx("span",{className:"text-sm text-white/50 font-medium",children:"Upload base image"}),e.jsx("span",{className:"text-xs text-white/30 mt-1",children:"JPG, PNG, WebP"})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-white/50 uppercase tracking-wider font-medium",children:"Logo / Watermark"}),e.jsx("input",{type:"file",ref:Be,onChange:mr,accept:"image/*",className:"hidden"}),re&&e.jsxs(P,{size:"sm",variant:"ghost",onClick:()=>{var t;return(t=Be.current)==null?void 0:t.click()},className:"text-xs text-white/60 hover:text-white hover:bg-white/10 h-7 px-2",children:[e.jsx(he,{className:"h-3 w-3 mr-1.5"}),"Change"]})]}),re?e.jsx("div",{className:"rounded-2xl overflow-hidden bg-[#0d0d0d] border border-white/5 p-6 flex items-center justify-center",style:{height:"160px"},children:e.jsx("img",{src:re,alt:"Logo",className:"max-w-full max-h-full object-contain"})}):e.jsxs("div",{onClick:()=>{var t;return(t=Be.current)==null?void 0:t.click()},className:"rounded-2xl border-2 border-dashed border-white/10 bg-white/[0.02] flex flex-col items-center justify-center cursor-pointer hover:border-hive-gold/40 hover:bg-hive-gold/5 transition-all group",style:{height:"160px"},children:[e.jsx(fe,{className:"h-8 w-8 text-white/30 mb-2 group-hover:text-hive-gold/60 transition-colors"}),e.jsx("span",{className:"text-xs text-white/50",children:"Upload logo"})]})]}),e.jsxs("div",{className:"rounded-2xl bg-[#0d0d0d] border border-white/5 p-5 space-y-5",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("span",{className:"text-xs text-white/50 uppercase tracking-wider font-medium",children:"Position"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{id:"top-left",label:"Top Left"},{id:"top-right",label:"Top Right"},{id:"center",label:"Center"},{id:"bottom-left",label:"Bottom Left"},{id:"bottom-right",label:"Bottom Right"}].map(t=>e.jsx("button",{onClick:()=>Lt(t.id),className:`px-3 py-2.5 rounded-xl text-xs font-medium transition-all ${ie===t.id?"bg-hive-gold text-hive-gold-foreground shadow-lg shadow-hive-gold/5":"bg-white/5 text-white/60 hover:bg-white/10 hover:text-white"}`,children:t.label},t.id))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-white/50 uppercase tracking-wider font-medium",children:"Size"}),e.jsxs("span",{className:"text-xs text-hive-gold font-semibold tabular-nums",children:[ke,"%"]})]}),e.jsx(We,{value:[ke],onValueChange:t=>$t(t[0]),min:5,max:50,step:1,className:"py-1"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-white/50 uppercase tracking-wider font-medium",children:"Opacity"}),e.jsxs("span",{className:"text-xs text-hive-gold font-semibold tabular-nums",children:[Ce,"%"]})]}),e.jsx(We,{value:[Ce],onValueChange:t=>Mt(t[0]),min:10,max:100,step:5,className:"py-1"})]})]}),e.jsx(P,{onClick:gr,disabled:E||!xe&&!n||!re,className:"w-full bg-gradient-to-r from-hive-gold to-hive-gold-light hover:from-hive-gold-light hover:to-hive-gold text-hive-gold-foreground font-bold py-6 text-sm shadow-lg shadow-hive-gold/5 rounded-xl disabled:opacity-40",children:E?e.
1jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-4 w-4 mr-2 border-2 border-hive-dark/30 border-t-hive-dark rounded-full animate-spin"})," Processing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"h-4 w-4 mr-2"})," Apply Brand Overlay"]})}),f&&e.jsxs("div",{className:"space-y-3 pt-4 border-t border-white/5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-white/50 uppercase tracking-wider font-medium flex items-center gap-2",children:"Result"}),e.jsxs(P,{onClick:me,size:"sm",className:"gap-1.5 bg-hive-gold hover:bg-hive-gold-light text-hive-gold-foreground font-bold text-xs px-4 h-8 shadow-lg shadow-hive-gold/5 rounded-lg",children:[e.jsx(le,{className:"h-3.5 w-3.5"}),"Download"]})]}),e.jsx("div",{className:"rounded-2xl overflow-hidden bg-[#0d0d0d] border border-hive-gold/20 p-4 flex items-center justify-center",style:{minHeight:"200px"},children:e.jsx("img",{src:f,alt:"Branded result",className:"max-w-full max-h-[280px] object-contain rounded-xl shadow-2xl"})})]})]})]})})}),l==="video-generator"&&e.jsxs("div",{className:"flex-1 relative flex flex-col items-center justify-center bg-[#080808] overflow-auto",style:{minHeight:"0"},children:[Ne?e.jsx("div",{className:"w-full h-full flex flex-col items-center justify-center p-4",style:{paddingBottom:"140px"},children:n&&e.jsxs("div",{className:"flex-shrink-0 pt-4 flex items-center gap-4 w-full max-w-4xl",children:[e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("img",{src:n,alt:"Source Image",className:"rounded-xl shadow-2xl border border-white/[0.08]",style:{maxWidth:"100%",maxHeight:"200px",width:"auto",height:"auto",objectFit:"contain"}})}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("video",{src:Ne,controls:!0,playsInline:!0,className:"rounded-xl shadow-2xl border border-hive-gold/30",style:{maxWidth:"100%",maxHeight:"300px",width:"auto",height:"auto",objectFit:"contain"}})})]})}):n?e.jsx("div",{className:"w-full h-full flex items-center justify-center p-4",style:{paddingBottom:"140px"},children:e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:n,alt:"Source Image",className:"rounded-xl shadow-2xl border border-white/[0.08]",style:{maxWidth:"100%",maxHeight:"70vh",width:"auto",height:"auto",objectFit:"contain"}}),E&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 rounded-xl",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"h-8 w-8 border-4 border-white/30 border-t-white rounded-full animate-spin mx-auto mb-2"}),e.jsx("p",{className:"text-white text-sm",children:"Generating video..."})]})})]})}):e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{paddingBottom:"140px"}}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-30 flex justify-center px-3 pb-3 bg-[#080808] border-t border-white/5",children:e.jsx("div",{className:"w-full max-w-2xl",children:e.jsx(Wr,{prompt:ye,onPromptChange:Ft,onSubmit:ir,onImageUpload:t=>{const o=new FileReader;o.onloadend=()=>{T(o.result)},o.readAsDataURL(t)},hasImage:!!n,aspectRatio:tt==="portrait"?"9:16":"16:9",onAspectRatioChange:t=>{rt(t==="9:16"||t==="2:3"||t==="3:4"?"portrait":"landscape")},duration:Ee,onDurationChange:Tt,resolution:at,onResolutionChange:Ht,isProcessing:E,mode:"video"})})})]}),l!=="brand-overlay"&&l!=="image-to-image"&&l!=="video-generator"&&l!=="corporate-headshot"&&e.jsx("div",{className:"flex-1 relative flex items-center justify-center bg-[#080808] overflow-hidden",style:{minHeight:"0"},children:f?l==="object-remover"&&n&&ee?f!==n?e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center p-4",children:[e.jsx("div",{className:"flex-1 flex items-center justify-center w-full min-h-0",children:e.jsx("img",{src:f,alt:"Result",className:"rounded-xl shadow-2xl border border-white/[0.08] ring-1 ring-white/5",style:{maxWidth:"calc(100% - 48px)",maxHeight:"calc(100% - 24px)",width:"auto",height:"auto",objectFit:"contain"}})}),e.jsx("div",{className:"flex-shrink-0 pt-3",children:e.jsxs(P,{onClick:me,size:"sm",className:"gap-1.5 bg-hive-gold hover:bg-hive-gold-light text-hive-gold-foreground font-bold text-xs px-4 h-9 shadow-lg shadow-hive-gold/5 rounded-lg",children:[e.jsx(le,{className:"h-3.5 w-3.5"}),"Download"]})})]}):e.jsx("div",{className:"w-full h-full overflow-hidden",children:e.jsx(Cr,{ref:D,imageUrl:n,originalWidth:ee.width,originalHeight:ee.height,brushSize:F,onBrushSizeChange:L,disabled:E,onMaskChange:Zt,onClear:xt})}):e.jsxs("div",{className:"w-full h-full flex items-center justify-center overflow-hidden",children:[Ne?e.jsxs("div",{className:"flex gap-4 items-center justify-center w-full h-full p-4",children:[e.jsx("div",{className:"flex-1 flex items-center justify-center h-full max-w-[48%] min-h-0",children:e.jsx("img",{src:f,alt:"Uploaded Image",className:"rounded-xl shadow-2xl border border-white/[0.08]",style:{filter:l==="image-enhancer"?`brightness(${_}%) contrast(${H}%) saturate(${V}%)`:void 0,maxWidth:"100%",maxHeight:"calc(100% - 24px)",objectFit:"contain"}})}),e.jsx("div",{className:"flex-1 flex items-center justify-center h-full max-w-[48%] min-h-0",children:e.jsx("video",{src:Ne,controls:!0,playsInl
1ine:!0,className:"rounded-xl shadow-2xl border border-hive-gold/30",style:{maxWidth:"100%",maxHeight:"calc(100% - 24px)",objectFit:"contain"}})})]}):e.jsxs("div",{className:"relative w-full h-full flex flex-col items-center justify-center p-4 overflow-hidden",children:[e.jsx("button",{onClick:()=>{T(null),y(null),st(null)},className:"absolute top-3 right-3 z-10 p-1.5 rounded-lg bg-black/60 hover:bg-black/80 text-white/50 hover:text-white transition-all backdrop-blur-sm border border-white/10",title:"Remove image",children:e.jsx($e,{className:"w-4 h-4"})}),e.jsx("div",{className:"flex-1 flex items-center justify-center w-full min-h-0",children:e.jsx("img",{src:f,alt:"Canvas",className:"rounded-xl shadow-2xl border border-white/[0.08] ring-1 ring-white/5",style:{filter:l==="image-enhancer"?`brightness(${_}%) contrast(${H}%) saturate(${V}%)`:void 0,maxWidth:"calc(100% - 48px)",maxHeight:"calc(100% - 24px)",width:"auto",height:"auto",objectFit:"contain"}})}),f!==n&&e.jsx("div",{className:"flex-shrink-0 pt-3",children:e.jsxs(P,{onClick:me,size:"sm",className:"gap-1.5 bg-hive-gold hover:bg-hive-gold-light text-hive-gold-foreground font-bold text-xs px-4 h-9 shadow-lg shadow-hive-gold/5 rounded-lg",children:[e.jsx(le,{className:"h-3.5 w-3.5"}),"Download"]})})]}),e.jsx("canvas",{ref:O,className:"hidden"})]}):l==="brand-overlay"?e.jsx("div",{className:"text-center space-y-4 flex items-center justify-center min-h-full px-4",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("div",{className:"inline-flex p-6 rounded-full bg-gradient-to-br from-amber-500/20 to-orange-500/20 border-2 border-amber-500/30 mb-4",children:e.jsx(fe,{className:"h-12 w-12 text-amber-400"})}),e.jsx("h3",{className:"text-xl md:text-2xl font-bold mb-2 bg-gradient-to-r from-amber-400 to-orange-400 bg-clip-text text-transparent",children:"Brand Overlay Tool"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Use the controls on the left to upload your base image and logo, then preview and generate your branded image."}),e.jsxs("div",{className:"flex items-center justify-center gap-2 text-xs text-muted-foreground/70",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500"}),"1. Upload base image"]}),e.jsx("span",{children:"→"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-orange-500"}),"2. Upload logo"]}),e.jsx("span",{children:"→"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"}),"3. Generate"]})]})]})}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center px-6 py-12",children:[e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 rounded-full bg-hive-gold/10 blur-2xl"}),e.jsx("div",{className:"relative inline-flex h-16 w-16 items-center justify-center rounded-2xl border border-white/10 bg-white/[0.04]",children:e.jsx(pe,{className:"h-7 w-7 text-white/40"})})]}),e.jsx("h3",{className:"mb-1.5 text-base md:text-lg font-semibold text-white/90",children:l?`Upload an image to ${Yr[l]??"get started"}`:"Start creating"}),e.jsx("p",{className:"mb-6 max-w-xs text-sm text-white/45",children:l?"Drop in a photo and the tool gets to work.":"Pick a tool above, or upload an image to begin."}),e.jsxs(P,{onClick:()=>{var t;return(t=x.current)==null?void 0:t.click()},className:"gap-2 bg-gradient-primary text-white font-bold px-5 h-10 rounded-xl shadow-lg shadow-hive-gold/10 transition-all hover:scale-[1.02] active:scale-[0.98]",children:[e.jsx(Le,{className:"h-4 w-4"}),"Upload an image"]}),!l&&e.jsx("p",{className:"mt-4 text-xs text-white/30",children:"Tip: choose a tool first to see its controls."})]})})]}),e.jsx("input",{ref:x,type:"file",accept:"image/*",onChange:Qt,className:"hidden"})]}),l==="video-generator"&&e.jsx("div",{className:"mt-6 mb-6",children:e.jsxs(Ve,{className:"relative bg-card border-2 border-border overflow-hidden backdrop-blur-xl video-showcase-card",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-purple-500/5 via-trans
1parent to-hive-gold/5 animate-gradient-slow"}),e.jsx("div",{className:"relative p-8 md:p-10",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-8 items-center",children:[e.jsx("div",{className:"relative",children:e.jsx("div",{className:"relative bg-white/5 rounded-xl overflow-hidden border border-white/10 shadow-2xl aspect-square backdrop-blur-sm cursor-pointer group",onClick:()=>{ot||(it(!0),setTimeout(()=>{var t;(t=nt.current)==null||t.play()},100))},children:ot?e.jsx("video",{ref:nt,src:"/videos/image-to-video.mp4",controls:!0,className:"w-full h-full object-cover",preload:"auto",onEnded:()=>it(!1),children:"Your browser does not support the video tag."}):e.jsxs(e.Fragment,{children:[e.jsx("video",{src:"/videos/image-to-video.mp4",className:"w-full h-full object-cover",preload:"metadata",muted:!0,playsInline:!0,onLoadedData:t=>{const o=t.currentTarget;o.currentTime=.5}}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20 group-hover:bg-black/30 transition-colors",children:e.jsx("div",{className:"w-16 h-16 md:w-20 md:h-20 rounded-full bg-white/20 backdrop-blur-md flex items-center justify-center border border-white/30 group-hover:scale-110 transition-transform",children:e.jsx(Br,{className:"w-8 h-8 md:w-10 md:h-10 text-white ml-1",fill:"white"})})}),e.jsx("div",{className:"absolute bottom-3 left-3 px-2 py-1 rounded bg-black/60 backdrop-blur-sm",children:e.jsx("span",{className:"text-xs text-white font-medium",children:"Click to play"})})]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"video-badge video-badge-primary inline-flex items-center gap-2 px-3 py-1 rounded-full bg-hive-gold/10 border border-hive-gold/30",children:e.jsx("span",{className:"text-xs font-semibold text-hive-gold uppercase tracking-wider",children:"Example Output"})}),e.jsx("h3",{className:"text-2xl md:text-3xl font-bold text-foreground",children:"AI Video Generation"}),e.jsx("p",{className:"text-base text-muted-foreground leading-relaxed",children:"Transform your ideas into professional video content with our advanced AI technology. Just describe what you want, and watch it come to life."}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.jsx("span",{className:"video-badge video-badge-primary px-3 py-1 rounded-full bg-hive-gold/10 border border-hive-gold/30 text-xs text-hive-gold font-medium",children:"Fast Generation"}),e.jsx("span",{className:"video-badge video-badge-primary px-3 py-1 rounded-full bg-hive-gold/10 border border-hive-gold/30 text-xs text-hive-gold font-medium",children:"High Quality"}),e.jsx("span",{className:"video-badge video-badge-secondary px-3 py-1 rounded-full bg-cyan-500/10 border border-cyan-500/30 text-xs text-cyan-300 font-medium",children:"Custom Prompts"})]})]})]})})})]})}),l==="hive-edit"&&e.jsx(ne,{imageSrc:"/images/hive-edit-image-to-image.jpg",imageAlt:"Hive Editor Example - Before and After",title:"Transform Any Photo",description:"Just describe what you want and our AI will transform your image. Turn ordinary photos into magical scenes, change backgrounds, add elements, or completely reimagine your pictures.",accentColor:"gold",badges:[{label:"AI-Powered",variant:"primary"},{label:"Simple Prompts",variant:"secondary"},{label:"10 Credits",variant:"neutral"}],promptExample:"Transform into a princess at a magical castle"}),l==="background-remover"&&e.jsx(ne,{imageSrc:"/images/background-removal.png",imageAlt:"Background Remover Example - Before and After",title:"Cut Out Any Object",description:"Remove backgrounds like magic. Perfect for product photos, portraits, pets, and e-commerce images. Get clean, transparent PNG cutouts in seconds.",accentColor:"green",badges:[{label:"AI-Powered",variant:"primary"},{label:"Instant Results",variant:"secondary"},{label:"Free",variant:"neutral"}],promptExample:"Upload → Remove → Download transparent PNG"}),l==="object-remover"&&e.jsx(ne,{imageSrc:"/images/object-removal-image.jpg",imageAlt:"Object Remover Example - Before and After",title:"Erase Unwanted Objects",description:"Remove anything from your photos seamlessly. Perfect for cleaning up travel shots, product images, real estate photos, and AI-generated art.",accentColor:"orange",badges:[{label:"AI-Powered",variant:"primary"},{label:"Seamless Fill",variant:"secondary"},{label:"Clean Results",variant:"neutral"}],promptExample:"Upload → Select → Erase → Clean!"}),l==="image-enhancer"&&e.jsx(ne,{imageSrc:"/images/image-enhancement-image.jpg",imageAlt:"Image Enhancer Example - Before and After",title:"Enhance Any Image",description:"Sharpen, upscale, and increase resolution of any photo instantly. Perfect for restoring old photos, improving low-quality images, and enhancing portraits.",accentColor:"amber",badges:[{label:"AI-Powered",variant:"primary"},{label:"Upscale 4x",variant:"secondary"},{label:"HD Quality",variant:"neutral"}],promptExample:"Upload → Enhance → Download"}),l==="image-to-image"&&e.jsx(ne,{imageSrc:"/images/image-to-image.jpg",imageAlt:"Image to Image Example - Portrait Style Transfer",title:"Transform Any Photo",description:"Turn any image into new artistic styles with one click. Perfect for portrait style transfers, artistic transformations, and stylized modifications.",accentColor:"orange",badges:[{label:"Style Transfer",variant:"primary"},{label:"Artistic",variant:"secondary"},{label:"AI-Powered",variant:"neutral"}],promptExample:"Upload → Describe Style → Generate"}),l==="brand-overlay"&&e.jsx(ne,{imageSrc:"/images/logo-maker.jpg",imageAlt:"Brand Overlay Example - Product with Logo",title:"Craft Brand-Ready Images",description:"Add your logo and branding to any photo with one click. Perfect for product photography, social media content, and customized ads.",accentColor:"gold",badges:[{label:"Logo Placement",variant:"primary"},{label:"Brand Tags",variant:"secondary"},{label:"AI-Powered",variant:"neutral"}],promptExample:"Upload → Add Branding → Download"}),l==="background-generator"&&e.jsx(ne,{imageSrc:"/images/background-generator-image.jpg",imageAlt:"Backgroun
1d Generator Example - Multiple AI Backgrounds",title:"Generate Stunning Backgrounds",description:"Create beautiful AI-generated backgrounds for any subject. Perfect for product photos, portraits, pets, and travel images.",accentColor:"purple",badges:[{label:"AI-Powered",variant:"primary"},{label:"Multiple Styles",variant:"secondary"},{label:"Instant Results",variant:"neutral"}],promptExample:"Upload → Describe Background → Generate"}),e.jsx("div",{className:"mt-2 md:mt-4 text-center px-4",children:e.jsxs("p",{className:"text-xs md:text-sm text-gray-500",children:[e.jsx("span",{className:"hidden md:inline",children:"Select tools from the left sidebar • "}),e.jsx("span",{className:"md:hidden",children:"Tap the tools button • "}),"Upload or drag images to the canvas"]})})]})})]})};export{ua 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.