1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9409],{35477:function(){},65092:function(){},9133:function(){},8438:function(){},45107:function(){},21440:function(){},53472:function(e,s,a){"use strict";a.r(s),a.d(s,{ExpressionInputPanel:function(){return D}});var t=a(98365),n=a(99544),i=a(77168),l=a(77455),r=a(22200),o=a(51645),c=a(61892),d=a(26693),p=a(35965),m=a(69996),u=a(92939),g=a.n(u);function SettingsSkeleton(){return(0,t.jsx)("div",{className:"flex flex-col h-full",children:(0,t.jsxs)("div",{className:"p-4 space-y-6 flex-grow",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.O,{className:"h-5 w-1/3 bg-background/50"})," ",(0,t.jsx)(m.O,{className:"h-4 w-3/4 bg-background/50"})," ",(0,t.jsx)(m.O,{className:"h-24 w-full bg-background/50 rounded-md"})," "]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.O,{className:"h-5 w-1/3 bg-background/50"})," ",(0,t.jsx)(m.O,{className:"h-4 w-2/3 bg-background/50"})," ",(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.O,{className:"h-32 w-full bg-background/50 rounded-md"})," ",(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(m.O,{className:"h-16 w-16 bg-background/50 rounded-md"})," ",(0,t.jsx)(m.O,{className:"h-16 w-16 bg-background/50 rounded-md"})," ",(0,t.jsx)(m.O,{className:"h-16 w-16 bg-background/50 rounded-md"})," ",(0,t.jsx)(m.O,{className:"h-16 w-16 bg-background/50 rounded-md"})," ",(0,t.jsx)(m.O,{className:"h-16 w-16 bg-background/50 rounded-md"})," ",(0,t.jsx)(m.O,{className:"h-16 w-16 bg-background/50 rounded-md"})," ",(0,t.jsx)(m.O,{className:"h-16 w-16 bg-background/50 rounded-md"})," "]})]})]})]})})}var x=a(23586),f=a(35080),h=a(30418),b=a(70347),j=a(98284);function ExpressionSettingsUpgradeOverlay(e){let{plan:s,customTitle:a}=e;return(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-background/70 backdrop-blur-[1px] z-10 m-3 border-2 rounded-md",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)(b.Z,{className:"w-10 h-10 mx-auto mb-2"}),(0,t.jsx)("h3",{className:"text-md font-extrabold mb-4",children:a||"This feature is available in the ".concat(s," plan")}),(0,t.jsx)("div",{className:"flex justify-center",children:(0,t.jsx)(j.Z,{plan:s})})]})})}var y=a(52793),_=a(26633),v=a(85658),w=a(91380),N=a(74506);let S=g()(()=>a.e(5380).then(a.bind(a,55380)),{loadableGenerated:{webpack:()=>[55380]},loading:()=>(0,t.jsx)("div",{className:"animate-pulse h-[300px] bg-muted rounded-md"}),ssr:!1});function FaceCloneSettings(e){var s,a;let{config:i,onChange:r,subscription:o}=e,[d,p]=(0,l.useState)(()=>"true"===localStorage.getItem("faceCloneShowControl"));if(!(null==i?void 0:i.expression_config))return null;let m=!(null==o?void 0:null===(s=o.plan)||void 0===s?void 0:s.type)||"Free"===o.plan.type,u=(null==o?void 0:null===(a=o.plan)||void 0===a?void 0:a.type)==="Pro",handlePromptChange=e=>{(0,n.E)(i.expression_config,"Face Clone")&&r({...i,expression_config:{...i.expression_config,prompt:e}})},handleDimensionChange=(e,s)=>{u&&(0,n.E)(i.expression_config,"Face Clone")&&r({...i,expression_config:{...i.expression_config,[e]:s}})};return(0,l.useEffect)(()=>{localStorage.setItem("faceCloneShowControl",d.toString())},[d]),(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("div",{className:"relative",children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsx)(c._,{children:"Clone Prompt"})}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Describe how you want the cloned face to look. Be specific about style, lighting, and expression."}),(0,t.jsx)(f.g,{value:(0,n.E)(i.expression_config,"Face Clone")?i.expression_config.prompt:"",onChange:e=>handlePromptChange(e.target.value),placeholder:"Celebratory professional headshot in festive attire, suitable for birthday posts on Instagram. Clean studio backdrop with flattering lighting highlights elegance.",className:"resize-none",rows:2}),i.expression_config.prompt?(0,t.jsx)(h.r,{currentPrompt:i.expression_config.prompt||"",onPromptUpdate:handlePromptChange,featureType:"face-clone"}):(0,t.jsxs)("div",{className:"mt-5 p-4 rounded-md bg-secondary",children:[(0,t.jsx)(c._,{className:"text-sm text-muted-foreground mb-2 block",children:"Click to try these example prompts"}),(0,t.jsx)(S,{onPromptSelect:handlePromptChange,expressionType:"Face Clone"})]})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(c._,{children:"Realism Enhancement"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Apply realism enhancement for more natural-looking results"})]}),(0,t.jsx)(y.r,{id:"realism-mode",checked:i.expression_config.enable_realism,onCheckedChange:e=>{(0,n.E)(i.expression_config,"Face Clone")&&r({...i,expression_config:{...i.expression_config,enable_realism:e}})}})]})}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(c._,{children:"Anti-Blur Enhancement"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Apply anti-blur enhancement to reduce blurriness in the results"})]}),(0,t.jsx)(y.r,{id:"anti-blur-mode",checked:i.expression_config.enable_anti_blur,onCheckedChange:e=>{(0,n.E)(i.expression_config,"Face Clone")&&r({...i,expression_config:{...i.expression_config,enable_anti_blur:e}})}})]})}),(0,t.jsx)("div",{className:"space-y-4",children:(0,t.jsxs)("div",{className:"relative",children:[!m&&!u&&(0,t.jsx)(ExpressionSettingsUpgradeOverlay,{plan:"Pro"}),(0,t.jsx)("div",{className:"space-y-4 border border-dashed border-muted-foreground
1/50 rounded-md p-5 bg-black",children:(0,t.jsx)("div",{className:"space-y-4",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(c._,{children:"Advanced Controls"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Control the pose and dimensions of your output"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("div",{className:"flex flex-row items-center align-middle gap-2",children:d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.Z,{className:"h-6 w-6 text-muted-foreground"}),(0,t.jsx)("span",{className:"text-sm",children:"Control image will affect the pose and composition."})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.Z,{className:"h-6 w-6 text-muted-foreground"}),(0,t.jsx)("span",{className:"text-sm",children:"Need pose control? Enable control image upload."})]})}),(0,t.jsxs)("div",{className:"flex flex-row items-center align-middle gap-2",children:[(0,t.jsx)(c._,{htmlFor:"control-image-toggle",className:"cursor-pointer text-sm",children:"Enable"}),(0,t.jsx)(y.r,{id:"control-image-toggle",checked:d,onCheckedChange:e=>{u&&(p(e),!e&&i.expression_config.control_image&&(0,n.E)(i.expression_config,"Face Clone")&&r({...i,expression_config:{...i.expression_config,control_image:""}}))}})]})]}),d&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsxs)("div",{className:"flex flex-col space-y-2",children:[(0,t.jsx)(c._,{children:"Control Image"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Upload a second image to control the pose and composition of the output"}),(0,t.jsx)(v.FileUploadField,{destinationFolder:"uploads",onUploadComplete:e=>{r({...i,expression_config:{...i.expression_config,control_image:e}})},onFileChange:()=>{},imageFileUrl:i.expression_config.control_image||"",setImageFileUrl:e=>r({...i,expression_config:{...i.expression_config,control_image:e}}),maxVisibleSelectImages:7,hideRecentOutputs:!0})]})})]}),(0,t.jsxs)("div",{className:"pt-4 border-t border-border",children:[(0,t.jsx)(c._,{className:"mb-4 block",children:"Output Dimensions"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex flex-col",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)(c._,{className:"text-sm text-muted-foreground",children:"Width"}),(0,t.jsxs)("span",{className:"text-sm text-muted-foreground",children:[i.expression_config.width,"px"]})]})}),(0,t.jsx)(_.i,{value:[i.expression_config.width],onValueChange:e=>handleDimensionChange("width",e[0]),min:256,max:1280,step:64})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex flex-col",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)(c._,{className:"text-sm text-muted-foreground",children:"Height"}),(0,t.jsxs)("span",{className:"text-sm text-muted-foreground",children:[i.expression_config.height,"px"]})]})}),(0,t.jsx)(_.i,{value:[i.expression_config.height],onValueChange:e=>handleDimensionChange("height",e[0]),min:256,max:1280,step:64})]})]})]})]})]})})})]})})]})})})}var C=a(45158),k=a(69273),E=a(5235);function ExpressionActionButtons(e){var s,a;let{studioConfig:n,subscription:i,isCreating:l,onGenerate:r,onReset:o,disabled:c,videoDuration:d}=e;return(null==n?void 0:n.expression_config)?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("div",{className:"flex w-full",children:(0,t.jsxs)("div",{className:"flex flex-col md:flex-row justify-between gap-2 md:gap-5 items-center align-middle w-full px-2",children:[(0,t.jsx)(E.Z,{editorType:n.expression_config.type,units:n.expression_config.quantity,duration:"Animate"===n.expression_config.type?null!==(s=n.expression_config.duration)&&void 0!==s?s:5:void 0,quality:"Animate"===n.expression_config.type?null!==(a=n.expression_config.video_quality)&&void 0!==a?a:"720p":void 0,videoDuration:"Upscale Video"===n.expression_config.type?d:void 0},"".concat(n.expression_config.label,"-1")),(0,t.jsx)("div",{className:"flex flex-row gap-1 border-t border-white/20 pt-5 md:border-none md:pt-0 w-full md:w-auto justify-center items-center",children:(0,t.jsxs)(C.z,{type:"button",variant:"ghost",className:"hidden md:flex",onClick:o,disabled:l,children:[(0,t.jsx)(k.Z,{className:"w-4 h-4 mr-2"}),"Reset"]})})]})})}):null}var F=a(90804),U=a(12837);let P=g()(()=>Promise.resolve().then(a.bind(a,85658)).then(e=>({default:e.FileUploadField})),{loadableGenerated:{webpack:()=>[85658]},ssr:!1,loading:()=>(0,t.jsx)(m.O,{className:"h-[300px] w-full rounded-md"})}),R=g()(()=>a.e(487).then(a.bind(a,487)).then(e=>({default:e.VideoUploadField})),{loadableGenerated:{webpack:()=>[487]},ssr:!1,loading:()=>(0,t.jsx)(m.O,{className:"h-[300px] w-full rounded-md"})}),q=g()(()=>Promise.all([a.e(3567),a.e(5745)]).then(a.bind(a,75745)).then(e=>({default:e.AnimateExpressionSettings})),{loadableGenerated:{webpack:()=>[75745]},ssr:!1,loading:()=>(0,t.jsx)(SettingsSkeleton,{})}),T=g()(()=>Promise.all([a.e(3567),a.e(3145)]).then(a.bind(a,73145)).then(e=>({default:e.UpscaleExpressionSettings})),{loadableGenerated:{webpack:()=>[73145]},ssr:!1,loading:()=>(0,t.jsx)(SettingsSkeleton,{})}),z=g()(()=>a.e(65).then(a.bind(a,20065)).then(e=>({default:e.FaceSwapExpressionSettings})),{loadableGenerated:{webpack:()=>[20065]},ssr:!1,loading:()=>(0,t.jsx)(SettingsSkeleton,{})}),I=g()(()=>a.e(3904).then(a.bind(a,13904)).then(e=>({default:e.SceneSwapExpressionSettings})),{loadableGenerated:{webpack:()=>[13904]},ssr:!1,loading:()=>(0,t.jsx)(SettingsSkeleton,{})}),O=g()(()=>a.e(3501).then(a.bind(a,83501)).then(e=>
1({default:e.ReplicateExpressionSettings})),{loadableGenerated:{webpack:()=>[83501]},ssr:!1,loading:()=>(0,t.jsx)(SettingsSkeleton,{})}),A=g()(()=>Promise.all([a.e(3567),a.e(2919)]).then(a.bind(a,2919)).then(e=>({default:e.ClothesSwapExpressionSettings})),{loadableGenerated:{webpack:()=>[2919]},ssr:!1,loading:()=>(0,t.jsx)(SettingsSkeleton,{})}),Z=g()(()=>Promise.all([a.e(2215),a.e(3432)]).then(a.bind(a,23432)).then(e=>({default:e.EraseAndReplaceExpressionSettings})),{loadableGenerated:{webpack:()=>[23432]},ssr:!1,loading:()=>(0,t.jsx)(SettingsSkeleton,{})}),V=g()(()=>a.e(5667).then(a.bind(a,50402)).then(e=>({default:e.MagicEditSettings})),{loadableGenerated:{webpack:()=>[50402]},ssr:!1,loading:()=>(0,t.jsx)(SettingsSkeleton,{})}),M=g()(()=>Promise.all([a.e(3567),a.e(1045)]).then(a.bind(a,1045)).then(e=>({default:e.SmartExpandExpressionSettings})),{loadableGenerated:{webpack:()=>[1045]},ssr:!1,loading:()=>(0,t.jsx)(SettingsSkeleton,{})}),G=g()(()=>Promise.all([a.e(3567),a.e(9424)]).then(a.bind(a,59424)).then(e=>({default:e.CharacterClonerExpressionSettings})),{loadableGenerated:{webpack:()=>[59424]},ssr:!1,loading:()=>(0,t.jsx)(SettingsSkeleton,{})}),L=g()(()=>Promise.all([a.e(3567),a.e(2303)]).then(a.bind(a,82303)).then(e=>({default:e.UpscaleVideoExpressionSettings})),{loadableGenerated:{webpack:()=>[82303]},ssr:!1,loading:()=>(0,t.jsx)(SettingsSkeleton,{})}),D=(0,l.memo)(function(e){let{studioConfig:s,setStudioConfig:a}=e,m=(0,l.useRef)(null),[u,g]=(0,l.useState)("none"),[f]=(0,r.v1)("fromExpressionId"),[h]=(0,r.v1)("expressionId"),{expressionItem:b,getImageUrl:j}=(0,o.w)(h||f||""),{toast:y}=(0,U.pm)(),{createExpression:_,isCreating:v}=(0,F.O)(),[w,N]=(0,l.useState)(0),{data:S}=(0,x.h)(),k=s.expression_config.type;(0,l.useEffect)(()=>{f&&(null==b?void 0:b.output)&&(a(e=>({...e,expression_config:{...e.expression_config,image:""}})),j(!0).then(e=>{e&&a(s=>({...s,expression_config:{...s.expression_config,image:e}}))}))},[f,b,j,a]);let E=(0,l.useCallback)(e=>{a(s=>({...s,expression_config:{...s.expression_config,image:e}}))},[a]),D=(0,l.useCallback)(e=>{N(e)},[]),B=(0,l.useCallback)(e=>{a(s=>({...s,expression_config:{...s.expression_config,image:e}}))},[a]),H=(0,l.useCallback)(()=>{if(!(null==s?void 0:s.expression_config))return null;switch(k){case"Animate":return(0,t.jsx)(q,{config:s,onChange:a,subscription:S});case"Face Swap":return(0,t.jsx)(z,{config:s,onChange:a,subscription:S});case"Upscale":return(0,t.jsx)(T,{config:s,onChange:a,subscription:S});case"Scene Swap":return(0,t.jsx)(I,{config:s,onChange:a,subscription:S});case"Replicate":return(0,t.jsx)(O,{config:s,onChange:a,subscription:S});case"Clothes Swap":return(0,t.jsx)(A,{config:s,onChange:a,subscription:S});case"Erase and Replace":return(0,t.jsx)(Z,{config:s,onChange:a,subscription:S});case"Magic Edit":return(0,t.jsx)(V,{config:s,onChange:a,subscription:S});case"Face Clone":return(0,t.jsx)(FaceCloneSettings,{config:s,onChange:a,subscription:S});case"Smart Expand":return(0,t.jsx)(M,{config:s,onChange:a,subscription:S});case"Character Clone":return(0,t.jsx)(G,{config:s,onChange:a,subscription:S});case"Upscale Video":return(0,t.jsx)(L,{config:s,onChange:a,subscription:S});default:return null}},[k,s,a,S]),W=(0,l.useMemo)(()=>H(),[H]),Y=(0,l.useCallback)(()=>{let e=m.current;if(!e)return;let{scrollTop:s,scrollHeight:a,clientHeight:t}=e;if(!(a>t)){g("none");return}s<10?g("toBottom"):g("toTop")},[]);(0,l.useEffect)(()=>{let e=m.current;if(e)return Y(),e.addEventListener("scroll",Y),()=>{e.removeEventListener("scroll",Y)}},[Y,W]);let X=(0,l.useCallback)(()=>{var e;null===(e=m.current)||void 0===e||e.scrollTo({top:0,behavior:"smooth"})},[]),K=(0,l.useCallback)(()=>{let e=m.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[]),Q=(0,l.useCallback)(async()=>{if(!(null==s?void 0:s.expression_config))return;let e=s.expression_config,t={title:s.name||"My ".concat(e.type," Expression"),config:{...e,quantity:1}};if((0,n.E)(e,"Animate"))t.config={type:"Animate",image:e.image,prompt:e.prompt,modelId:e.modelId,duration:e.duration,label:e.label,quantity:1,aspect_ratio:e.aspect_ratio,video_quality:e.video_quality};else if((0,n.E)(e,"Face Swap"))t.config={type:"Face Swap",image:e.image,swap_image:e.swap_image,label:e.label,quantity:1,settings:e.settings};else if((0,n.E)(e,"Upscale"))t.config={type:"Upscale",image:e.image,upscale:e.upscale,label:e.label,quantity:1,enable_face_upsample:e.enable_face_upsample,enable_background_enhance:e.enable_background_enhance,fidelity:e.fidelity,settings:e.settings};else if((0,n.E)(e,"Scene Swap"))e.removal_mode?t.config={type:"Scene Swap",image:e.image,label:e.label,quantity:1,removal_mode:!0}:t.config={type:"Scene Swap",image:e.image,prompt:e.prompt,negative_prompt:e.negative_prompt,steps:e.steps,guidance_scale:e.guidance_scale,label:e.label,quantity:1};else if((0,n.E)(e,"Replicate"))t.config={type:"Replicate",image:e.image,prompt:e.prompt,label:e.label,quantity:1,composition_image:e.composition_image,style_image:e.style_image,identity_image:e.identity_image,image_strength:e.image_strength,style_strength:e.style_strength,identity_strength:e.identity_strength,composition_strength:e.composition_strength};else if((0,n.E)(e,"Clothes Swap"))t.config={type:"Clothes Swap",image:e.image,garment_image:e.garment_image,label:e.label,quantity:1,category:e.category,long_top:e.long_top,cover_feet:e.cover_feet,adjust_hands:e.adjust_hands,restore_background:e.restore_background,restore_clothes:e.restore_clothes,settings:e.settings};else if((0,n.E)(e,"Erase and Replace"))e.erase_mode?t.config={type:"Erase and Replace",image:e.image,mask_image:e.mask_image,label:e.label,quantity:1,erase_mode:!0}:t.config={type:"Erase and Replace",image:e.image,mask_image:e.mask_image,prompt:e.prompt,label:e.label,quantity:1,settings:e.settings};else if((0,n.E)(e,"Magic Edit"))t.config={type:"Magic Edit",image:e.image,prompt:e.prompt,label:e.label,quantity:1,settings:e.settings};else if((0,n.E)(e,"Face Clone"))t.config={type:"Face Clone",image:e.image,prompt:e.prompt,control_image:e.control_image,enable_realism:e.enable_realism,enable_anti_blur:e.enable_anti_blur,height:e.height,width:e.width,label:e.label,quantity:1};else if((0,n.E)(e,"Smart Expand"))t.config={type:"Smart Expand",image:e.image,label:e.label,quantity:1,image_size:e.image_size,reference_image:e.reference_image,rendering_speed:e.rendering_speed,style:e.style,settings:e.settings};else if((0,n.E)(e,"Character Clone"))t.config={type:"Character Clone",image:e.image,label:e.label,quantity:1,prompt:e.prompt,image_size:e.image_size,scale:e.scale,negative_prompt:e.negative_prompt,guidance_scale:e.guidance_scale,num_inference_steps:e.num_inference_steps,settings:e.settings};else if((0,n.E)(e,"Upscale Video"))t.config={type:"Upscale Video",image:e.image,upscale_factor:e.upscale_factor,target_fps:e.target_fps,label:e.label,quantity:1,videoDuration:w};else{let s=e.type;console.error("Unhandled expression type for generation:",s),y({title:"â Error",description:"Cannot generate expression for type: ".concat(s)});return}try{let e=await _(t),s=new URL(window.location.href);s.searchParams.delete("fromExpressionId"),s.searchParams.delete("useSettings"),s.searchParams.set("expressionId",e.data.id),window.history.replaceState({},"",s.toString()),a(s=>({...s,currentExpressionItem:e.data}
1)),y({title:"â
Success",description:"Thank you. We're processing your request."})}catch(e){y({title:"â Error",description:e.message||"We can't process your request. Please try again."})}},[s,_,a,y]),J=(0,l.useMemo)(()=>{var e,a,t,i,l,r,o,c,d,p,m;let u=s.expression_config;if(!(null==u?void 0:u.image))return!1;switch(u.type){case"Animate":return(0,n.E)(u,"Animate")&&!!(null===(e=u.prompt)||void 0===e?void 0:e.trim());case"Face Swap":return(0,n.E)(u,"Face Swap")&&!!(null===(a=u.swap_image)||void 0===a?void 0:a.trim());case"Upscale":return(0,n.E)(u,"Upscale")&&!!u.upscale&&void 0!==u.fidelity;case"Scene Swap":return(0,n.E)(u,"Scene Swap")&&(!!u.removal_mode||!!(null===(t=u.prompt)||void 0===t?void 0:t.trim())&&!!(null===(i=u.negative_prompt)||void 0===i?void 0:i.trim())&&!!u.steps&&!!u.guidance_scale);case"Replicate":return(0,n.E)(u,"Replicate")&&!!u.style_image&&!!u.composition_image;case"Clothes Swap":return(0,n.E)(u,"Clothes Swap")&&!!u.garment_image;case"Erase and Replace":return(0,n.E)(u,"Erase and Replace")&&!!(null===(l=u.mask_image)||void 0===l?void 0:l.trim())&&(!!u.erase_mode||!!(null===(r=u.prompt)||void 0===r?void 0:r.trim()));case"Magic Edit":return(0,n.E)(u,"Magic Edit")&&!!(null===(o=u.prompt)||void 0===o?void 0:o.trim());case"Face Clone":return(0,n.E)(u,"Face Clone")&&!!(null===(c=u.prompt)||void 0===c?void 0:c.trim());case"Smart Expand":return(0,n.E)(u,"Smart Expand")&&!!(null===(d=u.image)||void 0===d?void 0:d.trim())&&!!u.image_size&&!!u.rendering_speed&&!!u.style;case"Character Clone":return(0,n.E)(u,"Character Clone")&&!!(null===(p=u.prompt)||void 0===p?void 0:p.trim())&&!!u.image_size&&void 0!==u.scale&&void 0!==u.guidance_scale&&void 0!==u.num_inference_steps;case"Upscale Video":return(0,n.E)(u,"Upscale Video")&&!!(null===(m=u.image)||void 0===m?void 0:m.trim())&&u.upscale_factor>=1&&u.upscale_factor<=4&&u.target_fps>=16&&u.target_fps<=60&&w>0;default:return!1}},[s.expression_config]),$=(0,l.useCallback)(()=>{let e=s.expression_config.type,t={type:e,label:"My ".concat(e," Expression"),quantity:1,image:""},n={baseSettings:{rotatePitch:0,rotateYaw:0,rotateRoll:0,blink:0,wink:0,eyebrow:0,pupilX:0,pupilY:0,aaa:0,eee:0,woo:0,smile:0},rotatePitch:0,rotateYaw:0,rotateRoll:0,blink:0,wink:0,eyebrow:0,pupilX:0,pupilY:0,aaa:0,eee:0,woo:0,smile:0},l=(()=>{switch(e){case"Animate":default:return{...t,type:"Animate",prompt:"",duration:5,video_quality:"720p",aspect_ratio:"square",modelId:""};case"Upscale":return{...t,type:"Upscale",upscale:2,fidelity:1,enable_face_upsample:!0,enable_background_enhance:!1,settings:n};case"Clothes Swap":return{...t,type:"Clothes Swap",garment_image:"",category:"tops",long_top:!1,cover_feet:!1,adjust_hands:!0,restore_background:!0,restore_clothes:!0,settings:n};case"Scene Swap":return{...t,type:"Scene Swap",prompt:"",negative_prompt:"",steps:20,guidance_scale:7.5};case"Face Swap":return{...t,type:"Face Swap",swap_image:"",settings:n};case"Replicate":return{...t,type:"Replicate",prompt:"",composition_image:"",style_image:"",identity_image:"",image_strength:.7,style_strength:.7,identity_strength:.7,composition_strength:.7};case"Erase and Replace":return{...t,type:"Erase and Replace",mask_image:"",prompt:"",settings:n};case"Magic Edit":return{...t,type:"Magic Edit",prompt:"",settings:n};case"Face Clone":return{...t,type:"Face Clone",prompt:"",control_image:"",enable_realism:!0,enable_anti_blur:!0,height:512,width:512};case"Smart Expand":return{...t,type:"Smart Expand",image_size:"square",reference_image:"",rendering_speed:"BALANCED",style:"AUTO",settings:n};case"Character Clone":return{...i.gZ,image:s.expression_config.image||"",label:"My Character Transfer Expression",quantity:1};case"Upscale Video":return{...t,type:"Upscale Video",upscale_factor:2,target_fps:30,settings:n}}})();a(e=>({...e,expression_config:l}))},[s.expression_config.type,s.expression_config.image,a]);return(0,t.jsxs)("div",{className:"flex flex-col h-full relative",children:[(0,t.jsxs)("div",{ref:m,className:"flex-grow p-3 space-y-3 overflow-y-auto",children:[(0,t.jsxs)("div",{className:"space-y-1 rounded-md",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"h-5 w-5 rounded-full bg-white/70 flex items-center justify-center",children:(0,t.jsx)("span",{className:"text-xs font-extrabold text-black/70",children:"1"})}),(0,t.jsx)(c._,{className:"text-md font-extrabold text-white/70",children:"Animate"===s.expression_config.type?"Choose Your Video":"Upload Your Image"})]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"For optimal results, please read & follow the instructions carefully."}),(0,t.jsx)("div",{className:"pl-1",children:"Upscale Video"===s.expression_config.type?(0,t.jsx)(R,{destinationFolder:"uploads",onUploadComplete:E,onFileChange:()=>{},videoFileUrl:s.expression_config.image||"",setVideoFileUrl:B,onVideoDurationChange:D}):(0,t.jsx)(P,{destinationFolder:"uploads",onUploadComplete:E,onFileChange:()=>{},imageFileUrl:s.expression_config.image||"",setImageFileUrl:B})})]}),W&&(0,t.jsxs)("div",{className:"space-y-3 rounded-md",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-5",children:[(0,t.jsx)("div",{className:"h-5 w-5 rounded-full bg-white/70 flex items-center justify-center",children:(0,t.jsx)("span",{className:"text-xs font-extrabold text-black/70",children:"2"})}),(0,t.jsx)(c._,{className:"text-md font-extrabold text-white/70",children:"Customize Your Settings"})]}),(0,t.jsx)("div",{className:"pl-1",children:W})]})]}),(0,t.jsxs)("div",{className:"hidden md:block absolute bottom-28 right-2 z-20",children:["toTop"===u&&(0,t.jsx)(C.z,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full shadow-lg op
1acity-90 hover:opacity-100",onClick:X,"aria-label":"Scroll to top",children:(0,t.jsx)(d.Z,{className:"h-4 w-4"})}),"toBottom"===u&&(0,t.jsx)(C.z,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full shadow-lg opacity-90 hover:opacity-100",onClick:K,"aria-label":"Scroll to bottom",children:(0,t.jsx)(p.Z,{className:"h-4 w-4"})})]}),(0,t.jsx)("div",{className:"sticky bottom-0 w-full px-2 py-4 my-[2px] bg-secondary/30 backdrop-blur-sm border-t border-white/20 z-10 mt-auto rounded-bl-lg rounded-br-lg",children:(0,t.jsx)(ExpressionActionButtons,{studioConfig:s,subscription:S,isCreating:v,onGenerate:Q,onReset:$,disabled:!J,videoDuration:w})})]})})},30418:function(e,s,a){"use strict";a.d(s,{r:function(){return PromptHelperPanel}});var t=a(98365),n=a(45158),i=a(22783),l=a(9824),r=a(12837),o=a(77455);function PromptHelperPanel(e){let{currentPrompt:s,onPromptUpdate:a,category:c="eyes",featureType:d="animate"}=e,{toast:p}=(0,r.pm)(),[m,u]=(0,o.useState)(null),handlePromptHelp=async e=>{try{u(e);let t=await fetch("/api/prompt-helper",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:s,mode:e,featureType:d})}),n=await t.json();if(!t.ok)throw Error(n.error||"Failed to process prompt");if(n.warning){p({title:"â ï¸ Note",description:n.warning});return}if(n.prompt)a(n.prompt),p({title:"â
Success",description:"Prompt updated successfully"});else throw Error("No prompt received from server")}catch(e){p({title:"â Error",description:e.message||"Failed to process prompt"})}finally{u(null)}};return(0,t.jsxs)("div",{className:"flex flex-col md:flex-row gap-2 my-2 py-2 w-full justify-between",children:[(0,t.jsxs)(n.z,{size:"sm",variant:"outline",className:"w-full",onClick:()=>handlePromptHelp("optimize"),disabled:null!==m||!s,children:[(0,t.jsx)(i.Z,{className:"w-4 h-4 mr-2 ".concat("optimize"===m?"animate-spin":"")}),"Optimize Prompt"]}),(0,t.jsxs)(n.z,{size:"sm",variant:"outline",className:"w-full",onClick:()=>handlePromptHelp("expand"),disabled:null!==m,children:[(0,t.jsx)(l.Z,{className:"w-4 h-4 mr-2 ".concat("expand"===m?"animate-spin":"")}),"Expand Prompt"]})]})}},85658:function(e,s,a){"use strict";a.r(s),a.d(s,{FileUploadField:function(){return FileUploadField}});var t=a(98365),n=a(77455),i=a(45158),l=a(61892),r=a(92458),o=a(69273),c=a(95028),d=a(52313),p=a(62862),m=a(48495),u=a(2161);let g=n.forwardRef((e,s)=>{let{className:a,value:n,...i}=e;return(0,t.jsx)(m.fC,{ref:s,className:(0,u.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",a),...i,children:(0,t.jsx)(m.z$,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:"translateX(-".concat(100-(n||0),"%)")}})})});g.displayName=m.fC.displayName;var x=a(9681),f=a(26212),h=a(52798),b=a(8434),j=a(62963),y=a(24401),_=a(39714),v=a(62315),file_uploader=e=>{let{destinationFolder:s,onUploadComplete:a,acceptedFileTypes:i=["image/jpg","image/jpeg","image/png","image/webp"],maxFileSize:l=10485760}=e,[r,o]=(0,n.useState)(null),[c,d]=(0,n.useState)(null),[m,u]=(0,n.useState)(null),[w,N]=(0,n.useState)(!1),{refreshRecentUploads:S}=(0,y.l)(),{uploadFile:C,uploadProgress:k,isUploading:E}=(0,_.e)(),[F,U]=(0,n.useState)(!1),P=(0,n.useRef)(null);(0,n.useEffect)(()=>{!async function(){try{P.current=await v.z()}catch(e){console.error("Failed to load NSFW detection model:",e)}}()},[]);let checkFileType=async e=>new Promise(s=>{let a=new FileReader;a.onloadend=a=>{var t,n;let l=new Uint8Array(null===(t=a.target)||void 0===t?void 0:t.result),r=((0,j.filetypename)(l)||[]).map(e=>e.toLowerCase()),o=null===(n=e.name.split(".").pop())||void 0===n?void 0:n.toLowerCase().trim(),c=r.some(e=>{let s="jpg"===e||"jpeg"===e?"jpeg":e,a="jpg"===o||"jpeg"===o?"jpeg":o;return"jpeg"===s&&"jpeg"===a?i.some(e=>"image/jpeg"===e||"image/jpg"===e):"png"===s&&"png"===a?i.includes("image/png"):"webp"===s&&"webp"===a&&i.includes("image/webp")});if(!c&&"webp"===o&&i.some(e=>"image/webp"===e)){let e=l.length>=12&&"RIFF"===bytesToString(l,0,4)&&"WEBP"===bytesToString(l,8,12);e&&(c=!0)}s(c)},a.readAsArrayBuffer(e.slice(0,16))});function bytesToString(e,s,a){return Array.from(e.subarray(s,a)).map(e=>String.fromCharCode(e)).join("")}let checkNSFWContent=async e=>{if(!P.current)return console.warn("NSFW detection model not loaded"),!0;U(!0);try{let s=new Image;s.src=URL.createObjectURL(e),await new Promise(e=>s.onload=e);let a=await P.current.classify(s);URL.revokeObjectURL(s.src);let t=a.find(e=>"Porn"===e.className||"Hentai"===e.className);if(t&&t.probability>.7)return!1;return!0}catch(e){return console.error("NSFW detection failed:",e),!1}finally{await new Promise(e=>setTimeout(e,1e3)),U(!1)}},R=(0,n.useCallback)(async(e,s)=>{if(e&&e[0]){let s=e[0];if(s.size>l){u("File size exceeds ".concat(l/1024/1024,"MB limit")),d(!1);return}u(null),N(!1),d(null),o(s);try{let e=await checkFileType(s);if(!e){u("Invalid file type. Please upload a valid image file."),d(!1),o(null);return}let a=await checkNSFWContent(s);if(!a){u("This image appears to contain inappropriate content and cannot be uploaded."),d(!1),o(null);return}d(!0),await handleUpload(s)}catch(e){console.error("File validation failed:",e),d(!1),o(null),u("File validation failed. Please try again.")}}},[l,s]),handleUpload=async e=>
1{try{let t=await C(e,s);a(t),N(!0),S()}catch(e){console.error("Upload error:",e),u("Upload failed. Please try again.")}},{getRootProps:q,getInputProps:T,isDragActive:z}=(0,p.uI)({onDrop:R,accept:i.reduce((e,s)=>({...e,[s]:[]}),{}),multiple:!1,maxSize:l});return(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{...q(),className:"bg-background border-2 border-dashed rounded-md p-4 cursor-pointer transition-colors duration-200 ease-in-out ".concat(z?"border-blue-500 bg-background":"border-white/70 hover:border-primary"),children:[(0,t.jsx)("input",{...T()}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)(x.Z,{className:"mx-auto h-8 w-8 text-white"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-white font-extrabold",children:z?"Drop the file here ...":"Drag & drop or click to select"}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["(",i.map(e=>e.split("/").pop()).join(", "),", Max: ",l/1024/1024,"MB)"]})]})]}),r&&!F&&c&&(0,t.jsx)("div",{className:"mt-2 flex items-center",children:(0,t.jsxs)("div",{className:"flex items-center overflow-hidden",children:[(0,t.jsx)(f.Z,{className:"h-4 w-4 text-blue-400 mr-2 flex-shrink-0"}),(0,t.jsx)("p",{className:"text-sm text-gray-300 truncate",children:r.name})]})}),F&&(0,t.jsxs)("div",{className:"mt-2 p-2 bg-blue-900/50 border border-blue-700 rounded-md flex items-center",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 text-blue-400 mr-2"}),(0,t.jsx)("p",{className:"text-sm text-blue-300",children:"Checking image content..."})]}),!F&&m&&(0,t.jsxs)("div",{className:"mt-2 p-2 bg-red-900/50 border border-red-700 rounded-md flex items-center",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 text-red-400 mr-2"}),(0,t.jsx)("p",{className:"text-sm text-red-300",children:m})]}),E&&(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsx)(g,{value:k,className:"w-full h-1"}),(0,t.jsxs)("p",{className:"text-sm text-gray-400 mt-5 text-center",children:[k.toFixed(0),"% uploaded"]})]}),w&&(0,t.jsxs)("div",{className:"mt-4 p-2 bg-green-900/50 border border-green-700 rounded-md flex items-center",children:[(0,t.jsx)(b.Z,{className:"h-4 w-4 text-green-400 mr-2"}),(0,t.jsx)("p",{className:"text-sm text-green-300",children:"Upload completed"})]}),!1===c&&!m&&(0,t.jsxs)("div",{className:"mt-4 p-2 bg-yellow-900/50 border border-yellow-700 rounded-md flex items-center",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 text-yellow-400 mr-2"}),(0,t.jsx)("p",{className:"text-sm text-yellow-300",children:"This file appears to be invalid. Please select a different file."})]})]})},w=a(22200),N=a(63441),S=a(92939),C=a.n(S);let k=C()(()=>Promise.all([a.e(7944),a.e(4416),a.e(9755)]).then(a.bind(a,1532)).then(e=>({default:e.SelectFromRecentUploads})),{loadableGenerated:{webpack:()=>[1532]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"p-4 text-center border rounded-lg border-dashed border-border flex items-center justify-center h-full",children:(0,t.jsx)("p",{className:"text-muted-foreground mb-1 text-sm font-extrabold",children:"Loading..."})})}),E=C()(()=>Promise.all([a.e(7944),a.e(4416),a.e(6679)]).then(a.bind(a,36679)).then(e=>({default:e.SelectFromRecentOutputs})),{loadableGenerated:{webpack:()=>[36679]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"p-4 text-center border rounded-lg border-dashed border-border flex items-center justify-center h-full",children:(0,t.jsx)("p",{className:"text-muted-foreground mb-1 text-sm font-extrabold",children:"Loading..."})})});function FileUploadField(e){let{imageFileUrl:s,setImageFileUrl:a,onUploadComplete:p,destinationFolder:m,onFileChange:u,maxVisibleSelectImages:g=7,hideRecentOutputs:x=!1,limitOutputFolder:f}=e,h=(0,n.useRef)(null),[b,j]=(0,n.useState)(!0),[y,_]=(0,w.v1)("fromExpressionId"),[v,S]=(0,w.v1)("expressionId"),handleFileUpload=e=>{a(e),p(e)},C=s&&!(s.includes(".mp4")||s.includes(".webm")||s.includes("/video/"))?s:"";return(0,t.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,t.jsx)(l._,{htmlFor:"image-file",className:"sr-only",children:"Image File"}),C&&""!==C?(0,t.jsx)("div",{className:"w-full bg-black rounded-md p-2 border-dotted border-2 border-white/70",children:(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"relative w-16 h-16 flex-shrink-0",children:[b&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,t.jsx)(r.Z,{className:"w-8 h-8 animate-spin text-gray-400"})}),(0,t.jsx)("img",{ref:h,src:C,alt:"Uploaded Image",className:"w-full h-full object-contain rounded-md",onLoad:()=>j(!1)})]}),(0,t.jsx)("div",{className:"flex-grow overflow-scroll",children:(0,t.jsx)("p",{className:"text-sm truncate text-ellipsis hidden md:block md:max-w-[200px]",children:"Image File"})}),(0,t.jsxs)(i.z,{variant:"secondary",size:"sm",onClick:()=>{a(""),u(0),j(!0),_(null),S(null)},children:[(0,t.jsx)(o.Z,{className:"w-4 h-4 mr-2"}),"Change"]})]})}):(0,t.jsxs)("div",{className:"flex flex-col rounded-md",children:[(0,t.jsx)(file_uploader,{destinationFolder:m,onUploadComplete:handleFileUpload}),(0,t.jsx)("div",{className:"space-y-2 mt-2",children:(0,t.jsxs)(N.Tabs,{defaultValue:"recentUploads",className:"w-full",children:[(0,t.jsxs)(N.TabsList,{className:"grid w-full grid-cols-2",children:[(0,t.jsxs)(N.TabsTrigger,{value:"recentUploads",children:[(0,t.jsx)(c.Z,{className:"w-4 h-4 mr-2"}),f?"Recent ".concat(f):"Recent Uploads"]}),!x&&(0,t.jsxs)(N.TabsTrigger,{value:"recentOutputs",children:[(0,t.jsx)(d.Z,{className:"w-4 h-4 mr-2"}),"Recent Outputs"]})]}),(0,t.jsx)(N.TabsContent,{value:"recentUploads",className:"px-1.5 py-2",children:(0,t.jsx)(k,{setRecentUploadSignedUrl:handleFileUpload,maxVisibleSelectImages:g,limitFolder:f})}),!x&&(0,t.jsx)(N.TabsContent,{value:"recentOutputs",className:"px-1.5 py-2",children:(0,t.jsx)(E,{setSelectedExpressionId:e=>{_(e)}
1,maxVisibleSelectImages:g,filterTypes:["Animate","Motion Effects","Extend Video"],filterMode:"exclude"})})]})})]})]})}},26633:function(e,s,a){"use strict";a.d(s,{i:function(){return r}});var t=a(98365),n=a(77455),i=a(75515),l=a(2161);let r=n.forwardRef((e,s)=>{let{className:a,...n}=e;return(0,t.jsxs)(i.fC,{ref:s,className:(0,l.cn)("relative flex w-full touch-none select-none items-center",a),...n,children:[(0,t.jsx)(i.fQ,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:(0,t.jsx)(i.e6,{className:"absolute h-full bg-primary"})}),(0,t.jsx)(i.bU,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]})});r.displayName=i.fC.displayName},35080:function(e,s,a){"use strict";a.d(s,{g:function(){return l}});var t=a(98365),n=a(77455),i=a(2161);let l=n.forwardRef((e,s)=>{let{className:a,...n}=e;return(0,t.jsx)("textarea",{className:(0,i.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:s,...n})});l.displayName="Textarea"},24401:function(e,s,a){"use strict";a.d(s,{l:function(){return useRecentUploads}});var t=a(56089),n=a(98214);function useRecentUploads(e){let s=(0,t.NL)(),{data:a=[],isLoading:i,error:l}=(0,n.a)({queryKey:["recent-uploads",e],queryFn:()=>
1{let s="".concat("https://merchshoot.ai","/api/account/recent-uploads"),a=e?"".concat(s,"?folder=").concat(encodeURIComponent(e)):s;return fetch(a).then(e=>e.json())}});return{recentUploads:a,isLoading:i,error:l,refreshRecentUploads:()=>{s.invalidateQueries({queryKey:["recent-uploads",e]})}}}},39714:function(e,s,a){"use strict";a.d(s,{e:function(){return useSupabaseUpload}});var t=a(77455),n=a(76142),i=a(70145);function useSupabaseUpload(){let[e,s]=(0,t.useState)(0),[a,l]=(0,t.useState)(!1),[r,o]=(0,t.useState)(null),{supabase:c}=(0,n.useSupabase)(),uploadFile=async(e,a)=>{l(!0),s(0),o(null);let t=Date.now(),n=e.name,r=n.includes(".")?n.substring(n.lastIndexOf(".")):"",d="".concat((0,i.Z)()).concat(r),p="".concat(a,"/").concat(t,"_").concat(d);try{let{data:{session:a}}=await c.auth.getSession();if(!a||!a.user)throw Error("No session found");let{data:t,error:n}=await c.storage.from("uploads").createSignedUploadUrl("".concat(a.user.id,"/").concat(p));if(n)throw n;let i=new Promise((a,n)=>{let i=new XMLHttpRequest;i.upload.onprogress=e=>{if(e.lengthComputable){let a=e.loaded/e.total*100;s(a)}},i.onload=async()=>{if(200===i.status){let{data:e,error:s}=await c.storage.from("uploads").createSignedUrl(t.path,604800);s?n(s):a(e.signedUrl)}else n(Error("Upload failed with status: ".concat(i.status)))},i.onerror=()=>n(Error("Network error during upload")),i.onabort=()=>n(Error("Upload aborted")),i.ontimeout=()=>n(Error("Upload timed out")),i.open("PUT",t.signedUrl),i.send(e)}),l=await i;return l}catch(e){throw console.error("Upload error:",e),o(e.message),e}finally{l(!1)}};return{uploadFile,uploadProgress:e,isUploading:a,error:r}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.