1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2274],{3894:(e,i,l)=>{"use strict";l.r(i),l.d(i,{default:()=>j});var a=l(6029),t=l(28945),n=l(50433),s=l(69943),o=l(63887),r=l(13445),d=l(73075),c=l(84335),u=l(37948),g=l(87462),m=l(73641),p=l(27835),h=l(75185),w=l(1751),v=l(92907),f=l(37514),_=l(55729),b=l(40340);let j=()=>{var e;let[i,l]=(0,_.useState)({source:{preview:null,uploaded:!1,uploadedId:"",type:""},target:{preview:null,uploaded:!1,uploadedId:"",type:""}}),{mutate:j,isLoading:x}=(0,w.M3E)(),{setInferenceJobId:y,pollJobStatus:U,processedImageUrl:I,setProcessedImageUrl:E,isLoading:k}=(0,h.V)({defaultProcessedImageUrl:null}),L=(0,_.useMemo)(()=>i.source.preview?i.source.preview instanceof Blob?URL.createObjectURL(i.source.preview):i.source.preview:"https://cdnr2.aieasypic.com/aieasypic/asian_woman_realistic.png",[i.source.preview]);return(0,a.jsxs)(n.a,{sx:e=>({minHeight:"80vh",padding:"30px 40px",[e.fn.smallerThan("md")]:{padding:"20px 10px"}}),children:[(0,a.jsx)(p.A,{title:"Upscale Image - ".concat(v._g.fullSiteName),description:"Upscale Image using ".concat(v._g.fullSiteName)}),(0,a.jsxs)(s.x,{children:[(0,a.jsx)(o.f,{span:12,order:2,orderMd:1,md:4,offsetMd:1,children:(0,a.jsxs)(r.B,{children:[(0,a.jsx)(b.EW,{itemOne:(0,a.jsx)(b.D4,{src:L,alt:"Image one",width:500,height:500}),itemTwo:I?(0,a.jsx)(b.D4,{src:I,alt:"Image two",width:500,height:500}):(0,a.jsx)(d.E,{height:500,width:500})}),(0,a.jsx)(c.$,{size:"lg",loading:!I||x,onClick:()=>(0,m.m)(I),children:"Download Upscaled"}),(0,a.jsx)(u.E,{size:"sm",color:"dimmed",inline:!0,children:"Processed images will be available also in your dashboard"})]})}),(0,a.jsx)(o.f,{span:12,md:5,children:(0,a.jsxs)(n.a,{children:[(0,a.jsx)(g.h,{align:"center",children:"Upscale Image Using AI"}),(0,a.jsxs)(r.B,{spacing:"md",children:[(0,a.jsx)(t.A,{images:i,type:"source",description:"Upscale this image",setImages:l,setProcessedImageUrl:E}),(0,a.jsx)(c.$,{size:"lg",loading:k||x,onClick:()=>{i.source.uploadedId&&j({data:{input_image:i.source.uploadedId}},{onError:e=>{(0,f.A)(e)},onSuccess:async e=>{y(e.id),await U()}})},disabled:!i.source.uploadedId||(null==i||null==(e=i.source)?void 0:e.uploading),children:"Upscale Image"})]})]})})]})]})}},49017:(e,i,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/tools/upscale-image_hidden",function(){return l(3894)}])},73641:(e,i,l)=>{"use strict";l.d(i,{A:()=>d,m:()=>r});var a=l(6029),t=l(99690),n=l(26500),s=l(37948),o=l(50016);let r=async e=>{if(e)try{if(e.startsWith("data:image")){let i=((e,i)=>{let l=atob(e),a=null==l?void 0:l.length,t=new Uint8Array(a);for(let e=0;e<a;e++)t[e]=l.charCodeAt(e);return new Blob([t],{type:i})})(e.split(",")[1],e.split(";")[0].split(":")[1]),l=window.URL.createObjectURL(i),a=document.createElement("a");a.href=l,a.download="image.png",document.body.appendChild(a),a.click(),window.URL.revokeObjectURL(l),document.body.removeChild(a)}else{let i=await fetch(e),l=await i.blob(),a=window.URL.createObjectURL(l),t=document.createElement("a");t.href=a,t.download="image.png",document.body.appendChild(t),t.click(),window.URL.revokeObjectURL(a),document.body.removeChild(t)}}catch(e){console.error("Error downloading image:",e)}},d=e=>{let{image:i,withText:l=!0}=e;return(0,a.jsxs)(t.Y,{onClick:e=>{e.stopPropagation(),r(i)},children:[(0,a.jsx)(n.M,{variant:"filled",color:"blue",children:(0,a.jsx)(o.s3U,{})}),l&&(0,a.jsx)(s.E,{children:"Download"})]})}},75185:(e,i,l)=>{"use strict";l.d(i,{V:()=>g});var a=l(35670),t=l(18090),n=l(1751),s=l(58943),o=l(89948),r=l(74312),d=l.n(r),c=l(55729),u=l(34417);let g=e=>{let{defaultProcessedImageUrl:i=null}=e,[l,r]=(0,c.useState)(null),[g,m]=(0,c.useState)(i),p=(0,c.useRef)([]),[h,w]=(0,c.useState)(!1),{refetch:v,isFetching:f,isRefetching:_}=(0,n.Z5_)(l||0,{query:{enabled:null!==l&&0!==l}}),{data:b,refetch:j}=(0,u.P)(),[x,y]=(0,a.M)({key:"freeGenerations".concat(d()().format("YYYY-MM-DD")),defaultValue:o.iF}),U=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1500,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6e4,l=new Date().getTime(),a=!0;for(w(!0);new Date().getTime()-l<i&&a;){try{await v().then(e=>{var i,n,o,r,d,c,u,h,v,f;let{data:_}=e;return(console.log("Job status:",_),console.log("Time elapsed:",new Date().getTime()-l),(null==_?void 0:_.status)===s.Mf.FL)?((0,t.Ds)({title:"Image processing failed",message:"Please try again later",color:"red"}),m(null),w(!1),a=!1,j(),g):(null==_?void 0:_.prediction_images)&&(null==_||null==(i=_.prediction_images)?void 0:i.length)>0&&((null==(o=_.prediction_images)||null==(n=o[0])?void 0:n.image)||(null==(d=_.prediction_images)||null==(r=d[0])?void 0:r.base_encoded))?(p.current=null==(c=_.prediction_images)?void 0:c.map(e=>(null==e?void 0:e.image)||(null==e?void 0:e.base_encoded)),m((null==(h=_.prediction_images)||null==(u=h[0])?void 0:u.image)||(null==_||null==(f=_.prediction_images)||null==(v=f[0])?void 0:v.base_encoded)),y(e=>e-1),a=!1,w(!1),j(),g):void 0})}catch(e){console.error("Error fetching job status:",e),w(!1)}if(!a)break;await new Promise(i=>setTimeout(i,e))}return a&&(m(null),w(!1),p.current=[],(0,t.Ds)({title:"Image processing timed out",message:"Please try again later",color:"red"})),g};return{inferenceJobId:l,setInferenceJobId:r,processedImageUrl:g,inferenceJobLo
1ading:f,pollJobStatus:U,setProcessedImageUrl:m,isLoading:h,processedImageUrlRef:p,inferenceJobRefetching:_}}}},e=>{e.O(0,[182,9720,8945,636,6593,8792],()=>e(e.s=49017)),_N_E=e.O()}]);
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.