PageSourceSearch

https://komiko.app/_next/static/chunks/pages/image-upscaling-21730ec6230f2f1d.js

js komiko.app collected 2026-09-24 22:23:08 UTC 35,146 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[38434],{971310:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/image-upscaling",function(){return a(63521)}])},663594:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(931134).Z)("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]])},813474:function(e,t,a){"use strict";a.d(t,{Y:function(){return r.Z}});var r=a(75554)},389598:function(e,t,a){"use strict";a.d(t,{Z:function(){return D}});var r=a(785893),s=a(667294),n=a(286501),l=a(479390),o=a(444892),i=a(474548),c=a(294365),d=a(387613),u=a(607894),m=a(385374),p=a(887740),x=a(886597),f=a(696476),h=a(751978),g=a(73314),v=a(967241),b=a(197808),w=a(346718),j=a(396606),y=a(980232),N=a(248583),k=a(536602),q=a(567421),I=a(580036),P=a(613786),Z=a(520084),C=a(178202),F=a(999395),M=a(83782);let _=(0,g.Bu)(),L=async e=>{let t=await fetch("/api/tools/image-generation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("API request failed: ".concat(t.status));return await t.json()},E=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"gfpgan",r=arguments.length>3?arguments[3]:void 0,s={image:e,scale:t,model:a};if(s.image&&!s.image.match(/^https?:\/\//)){let e=await (0,M.G)(s.image,r);s.image=e}let n=await fetch("/api/tools/image-upscale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!n.ok)throw Error("API request failed: ".concat(n.status));let l=await n.json();return l.error?{error:l.error,error_code:l.error_code}:l.output?l.output:""},R=e=>new Promise((t,a)=>{let r=new Image;r.onload=()=>{t({width:r.width,height:r.height})},r.onerror=a,r.src=e});function D(e){let{isMobile:t}=e,{t:a}=(0,q.$G)("image-upscaling"),{inputImage:M,setInputImage:D,hasMedia:S,mediaItem:T,isFromTool:O}
1=(0,Z.Y)(),[U,z]=(0,s.useState)(4),[A,B]=(0,s.useState)([{id:-1,url_path:"/images/examples/image-upscaling/input.jpg",prompt:a("common:exampleResult")}]),[G,V]=(0,s.useState)(!1),[W,J]=(0,s.useState)(null),[Y,K]=(0,N.KO)(y.I3),$=(0,N.Dv)(y.L4);(0,k.o)("Upscale Image","Upscale Image");let{submit:X}=(0,F.R)(),[H,Q]=(0,s.useState)(()=>"Free"===Y.plan),ee=async()=>{try{let e=await L({method:"getImages",tool:"image-upscale"});if(e.data){let t=await (0,g.$r)(e.data);if(!t.length)return;B(t)}}catch(e){if(console.error("fetchImages failed",e),e.message.indexOf("401"))return;n.ZP.error(a("toasts.upscaleFailed"),{position:"top-center",style:{background:"#555",color:"#fff"}})}};(0,s.useEffect)(()=>{$&&ee()},[$]);let et=e=>{if("number"==typeof e&&e<0){B(t=>t.filter(t=>t.id!==e));return}J(e),V(!0)},ea=async()=>{if(V(!1),W)try{let e=await L({method:"deleteImage",tool:"image-upscale",id:W});e.data&&e.data.length>0?(console.log("deleteImage success"),(0,g.Ym)(B,W),n.ZP.success(a("toasts.deleteSuccess"),{position:"top-center",style:{background:"#555",color:"#fff"}})):(console.log("deleteImage failed"),n.ZP.error(a("toasts.deleteFailed"),{position:"top-center",style:{background:"#555",color:"#fff"}})),J(null)}catch(e){console.error("deleteImage failed",e),n.ZP.error(a("toasts.deleteFailed"),{position:"top-center",style:{background:"#555",color:"#fff"}})}},er=async e=>{try{let t=await fetch(e);if(!t.ok)throw Error("Network response was not ok");let a=await t.blob(),r=window.URL.createObjectURL(a),s=document.createElement("a");s.href=r,s.setAttribute("download","result-".concat(Date.now(),".jpg")),document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(r)}catch(e){console.error("Download failed:",e),n.ZP.error(a("toasts.downloadFailed"),{position:"top-center",style:{background:"#555",color:"#fff"}})}},es=async e=>new Promise((t,a)=>{let r=new FileReader;r.onloadend=()=>t(r.result),r.onerror=a,r.readAsDataURL(e)}),en=async e=>{if(e){let t=await fetch(e),a=await t.blob();D(await es(a))}},el=async(e,t)=>{await (0,g.n_)(e),B(a=>{let r=a.findIndex(t=>t.id===e);return(a[r]={id:e,url_path:t},r>-1)?[...a]:a})},eo=async()=>{if(Y.credit<w.DB){X("pricing");return}let e="real-esrgan",t=await R(M);console.log("Image dimensions:",t),t.width*t.height>2096704&&(e="gfpgan");try{let t=_();B([{id:t,url_path:"",status:g.Vr.GENERATING},...A.filter(e=>-1!==e.id)]);let r=await E(M,U,e,null==Y?void 0:Y.id);if(!r||"object"==typeof r&&r.error){r?"object"==typeof r&&"no zaps"===r.error?X("pricing"):"object"==typeof r&&r.error_code===C.O1.RATE_LIMIT_EXCEEDED?(0,P.Cx)(a("toast:common.rateLimitExceeded")):(0,P._N)(a("toasts.upscaleFailed")):(0,P._N)(a("toasts.upscaleFailed")),B(e=>{let a=e.findIndex(e=>e.id===t);return a>-1?(e.splice(a,1),[...e]):e});return}K(e=>({...e,credit:e.credit-w.DB})),await el(t,r);let s=await L({method:"generateImage",tool:"image-upscale",url_path:r,id:null,model:"Image Upscaling"});s.data&&s.data.length>0?(B(e=>{let a=e.findIndex(e=>e.id===t);return a>-1&&(e[a]={...e[a],id:s.data[0].id}),[...e]}),n.ZP.success(a("toasts.upscaleSuccess"),{position:"top-center",style:{background:"#555",color:"#fff"}})):n.ZP.error(a("toasts.upscaleFailed"),{position:"top-center",style:{background:"#555",color:"#fff"}})}catch(e){if(console.error("Image upscale failed:",e),"no zaps"===e.message){X("pricing");return}n.ZP.error(a("toasts.upscaleFailed"),{position:"top-center",style:{background:"#555",color:"#fff"}})}},ei=[{id:1,question:a("faq.question1"),answer:a("faq.answer1")},{id:2,question:a("faq.question2"),answer:a("faq.answer2")},{id:3,question:a("faq.question3"),answer:[a("faq.answer3.point1"),a("faq.answer3.point2"),a("faq.answer3.point3"),a("faq.answer3.point4"),a("faq.answer3.point5")]},{id:4,question:a("faq.question4"),answer:a("faq.answer4")},{id:5,question:a("faq.question5"),answer:a("faq.answer5")},{id:6,question:a("faq.question6"),answer:a("faq.answer6")},{id:7,question:a("faq.question7"),answer:a("faq.answer7")},{id:8,question:a("faq.question8"),answer:a("faq.answer8")},{id:9,question:a("faq.question9"),answer:a("faq.answer9")},{id:10,question:a("faq.question10"),answer:a("faq.answer10")}];return(0,r.jsx)("div",{className:"overflow-y-auto pb-16 -mt-4 min-h-screen bg-background",children:(0,r.jsxs)("div",{className:"container relative mx-auto max-w-[100rem] flex-grow px-4 md:px-6 2xl:px-16",children:[(0,r.jsx)("h1",{className:"mt-2 mb-3 text-2xl font-bold text-center text-heading md:text-3xl lg:text-4xl",children:a("title")}),(0,r.jsx)("p",{className:"mx-auto mb-4 md:mb-6 max-w-4xl text-xs text-center text-muted-foreground md:text-xs lg:text-base px-4 md:px-20",children:a("description")}),(0,r.jsxs)("div",{className:"grid grid-cols-12 gap-4 mt-4",children:[(0,r.jsx)("div",{className:"col-span-12 md:col-span-6 lg:col-span-5",children:(0,r.jsxs)(l.w,{className:"bg-card p-6",children:[(0,r.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,r.jsx)("h2",{className:"text-2xl font-bold",children:a("inputImage")})}),(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsx)(h.Z,{onChange:en,type:"image",initialImage:M})}),(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsxs)("label",{className:"block mb-2 text-sm font-medium",children:[a("scaleFactor"),": ",U,"x"]}),(0,r.jsx)(o.L,{size:"sm",step:1,minValue:1,maxValue:10,value:U,onChange:e=>z(Number(e)),className:"max-w-md","aria-label":a("scaleFactor"),marks:[{value:1,label:"1x"},{value:10,label:"10x"}]})]}),(0,r.jsxs)(i.A,{color:"primary",className:"w-full mt-2",size:"lg",onClick:eo,isDisabled:!M,children:[a("upscaleImage"),$&&(0,r.jsxs)(c.z,{startContent:(0,r.jsx)(j.bzf,{className:"mr-0 w-4 h-4 text-orange-400"}),variant:"bordered",color:"primary",size:"sm",className:"bg-card",children:["-",w.DB,"/",Y.credit]})]})]})}),(0,r.jsx)("div",{className:"col-span-12 md:col-span-6 lg:col-span-7",children:(0,r.jsxs)(l.w,{className:"bg-card p-6 h-full",children:[(0,r.jsx)("h2",{className:"mb-6 text-2xl font-bold",children:a("imageResults")}),(0,r.jsx)("div",{className:"w-full h-[calc(460px-7rem)] flex flex-col",children:(0,r.jsx)("div",{className:"overflow-y-auto flex-1",children:(null==A?void 0:A.length)>0?(0,r.jsx)("div",{className:"grid grid-cols-1 gap-6",children:A.map((e,t)=>(0,r.jsx)(v.e7,{type:"image",index:t,data:e,handleDelete:et,handleDownload:er,showPrompt:!!e.prompt,isExample:-1===e.id,tool:"image-upscale"},e.id))}):(0,r.jsx)("div",{className:"flex justify-center items-center h-full text-muted-foreground",children:a("resultsPlaceholder")})})})]})})]}),(0,r.jsx)("div",{className:"flex flex-col justify-center items-center mb-8",children:(0,r.jsxs)("div",{className:"col-span-12",children:[(0,r.jsx)("h2",{className:"mt-14 md:mt-16 mb-4 md:mb-6 text-xl font-bold text-center text-heading md:text-3xl",children:a("whatIsSection.title")}),(0,r.jsx)("div",{className:"mx-auto max-w-4xl text-center text-muted-foreground text-sm md:text-base px-4 md:px-20 mb-4 md:mb-6",children:(0,r.jsx)("p",{children:a("whatIsSection.description")})}),(0,r.jsx)("h2",{className:"mt-14 md:mt-16 mb-4 text-xl font-bold text-center text-heading md:text-3xl",children:a("howToSection.title")}),(0,r.jsx)("p",{className:"mx-auto mb-4 md:mb-10 max-w-3xl text-center text-muted-foreground text-sm md:text-base px-4 md:px-20",children:a("howToSection.description")}),(0,r.jsx)("div",{className:"grid grid-cols-1 gap-8 md:px-4 sm:grid-cols-2 lg:grid-cols-4 mb-6",children:[{step:1,title:a("steps.step1.title"),content:a("steps.step1.content")},{step:2,title:a("steps.step2.title"),content:a("steps.step2.content")},{step:3,title:a("steps.step3.title"),content:a("steps.step3.content")},{step:4,title:a("steps.step4.title"),content:a("steps.step4.content")}].map(e=>(0,r.jsxs)("div",{className:"flex flex-col p-4 md:p-6 h-full bg-card rounded-xl border border-primary-100 shadow-md hover:shadow-lg transition-all duration-300 hover:border-primary-300 hover:translate-y-[-5px]",children:[(0,r.jsx)("div",{className:"flex justify-center items-center mb-4 w-8 h-8 md:w-14 md:h-14 text-xl font-bold text-primary-foreground bg-gradient-to-r to-purple-600 rounded-full from-primary-600 md:text-2xl",children:e.step}),(0,r.jsxs)("div",{className:"flex-grow",children:[(0,r.jsx)("h3",{className:"mb-3 text-lg font-bold text-primary-600 md:text-xl",children:e.title}),(0,r.jsx)("p",{className:"text-muted-foreground text-sm md:text-base",children:e.content})]})]},e.title))}),(0,r.jsx)("div",{className:"grid grid-cols-12 gap-4 mt-8 mb-8",children:(0,r.jsxs)("div",{className:"col-span-12",children:[(0,r.jsx)("h2",{className:"mt-14 md:mt-16 mb-4 md:mb-6 text-xl font-bold text-center text-heading md:text-3xl",children:a("examples.title")}),(0,r.jsx)("div",{className:"mx-auto max-w-4xl text-center text-muted-foreground text-sm md:text-base px-4 md:px-20 mb-4 md:mb-6",children:(0,r.jsx)("p",{children:a("examples.description")})}),(0,r.jsxs)("div",{className:"grid grid-cols-12 gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col col-span-5 items-center",children:[(0,r.jsx)("div",{className:"flex overflow-hidden justify-center items-center mt-8 mb-2 w-full",children:(0,r.jsx)(d.J,{src:"/images/examples/image-upscaling/input.jpg",alt:a("examples.inputAlt1"),width:300,height:300,className:"object-cover object-top w-full h-full !rou
1nded-none"})}),(0,r.jsx)("p",{className:"text-xs md:text-sm text-center text-muted-foreground",children:a("examples.inputCaption1")})]}),(0,r.jsxs)("div",{className:"flex flex-col col-span-7 items-center",children:[(0,r.jsx)("div",{className:"flex overflow-hidden justify-center items-center mb-2 w-full",children:(0,r.jsx)(d.J,{src:"/images/examples/image-upscaling/upscaled.png",alt:a("examples.outputAlt1"),width:400,height:400,className:"object-cover object-top w-full h-full !rounded-none"})}),(0,r.jsx)("p",{className:"text-xs md:text-sm text-center text-muted-foreground",children:a("examples.outputCaption1")})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-12 gap-4 mt-8",children:[(0,r.jsxs)("div",{className:"flex flex-col col-span-5 items-center",children:[(0,r.jsx)("div",{className:"flex overflow-hidden justify-center items-center mt-8 mb-2 w-full",children:(0,r.jsx)(d.J,{src:"/images/examples/image-upscaling/input2.jpg",alt:a("examples.inputAlt2"),width:300,height:300,className:"object-cover object-top w-full h-full !rounded-none"})}),(0,r.jsx)("p",{className:"text-xs md:text-sm text-center text-muted-foreground",children:a("examples.inputCaption2")})]}),(0,r.jsxs)("div",{className:"flex flex-col col-span-7 items-center",children:[(0,r.jsx)("div",{className:"flex overflow-hidden justify-center items-center mb-2 w-full",children:(0,r.jsx)(d.J,{src:"/images/examples/image-upscaling/upscaled2.png",alt:a("examples.outputAlt2"),width:400,height:400,className:"object-cover object-top w-full h-full !rounded-none"})}),(0,r.jsx)("p",{className:"text-xs md:text-sm text-center text-muted-foreground",children:a("examples.outputCaption2")})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-12 gap-4 mt-8",children:[(0,r.jsxs)("div",{className:"flex flex-col col-span-5 items-center",children:[(0,r.jsx)("div",{className:"flex overflow-hidden justify-center items-center mt-8 mb-2 w-full",children:(0,r.jsx)(d.J,{src:"/images/examples/image-upscaling/input3.jpg",alt:a("examples.inputAlt3"),width:300,height:300,className:"object-cover object-top w-full h-full !rounded-none"})}),(0,r.jsx)("p",{className:"text-xs md:text-sm text-center text-muted-foreground",children:a("examples.inputCaption3")})]}),(0,r.jsxs)("div",{className:"flex flex-col col-span-7 items-center",children:[(0,r.jsx)("div",{className:"flex overflow-hidden justify-center items-center mb-2 w-full",children:(0,r.jsx)(d.J,{src:"/images/examples/image-upscaling/upscaled3.png",alt:a("examples.outputAlt3"),width:400,height:400,className:"object-cover object-top w-full h-full !rounded-none"})}),(0,r.jsx)("p",{className:"text-xs md:text-sm text-center text-muted-foreground",children:a("examples.outputCaption3")})]})]})]})}),(0,r.jsx)("h2",{className:"mt-14 md:mt-16 mb-4 text-xl font-bold text-center text-heading md:text-3xl",children:a("whyChoose.title")}),(0,r.jsx)("p",{className:"mx-auto mb-4 md:mb-10 max-w-3xl text-center text-muted-foreground text-sm md:text-base px-4 md:px-20",children:a("whyChoose.description")}),(0,r.jsx)("div",{className:"py-14 md:py-16 bg-gradient-to-b from-background rounded-xl to-primary-100",children:(0,r.jsx)("div",{className:"grid grid-cols-1 gap-6 px-4 sm:grid-cols-2 lg:grid-cols-3",children:[{title:a("features.feature1.title"),content:a("features.feature1.content")},{title:a("features.feature2.title"),content:a("features.feature2.content")},{title:a("features.feature3.title"),content:a("features.feature3.content")},{title:a("features.feature4.title"),content:a("features.feature4.content")},{title:a("features.feature5.title"),content:a("features.feature5.content")},{title:a("features.feature6.title"),content:a("features.feature6.content")}].map(e=>(0,r.jsxs)("div",{className:"p-4 md:p-6 bg-card rounded-xl border border-primary-100 shadow-md transform transition-all duration-300 hover:shadow-lg hover:translate-y-[-5px] hover:border-primary-300",children:[(0,r.jsx)("h3",{className:"mb-2 text-md md:text-xl font-semibold text-primary-600",children:e.title}),(0,r.jsx)("p",{className:"text-muted-foreground text-sm md:text-base",children:e.content})]},e.title))})}),(0,r.jsx)("div",{className:"my-12 md:my-16",children:(0,r.jsx)(I.E,{category:"illustration"})}),(0,r.jsx)("h2",{className:"mt-14 md:mt-16 mb-2 text-xl font-bold text-center text-heading md:text-3xl",children:a("guide.title")}),(0,r.jsx)("div",{className:"mx-auto max-w-4xl text-center text-muted-foreground text-sm md:text-base px-4 md:px-20 mb-4 md:mb-6",children:(0,r.jsx)("p",{children:a("guide.description")})}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)("div",{className:"max-w-[1000px] w-full",children:(0,r.jsx)(b.Z,{faqs:ei})})})]})}),(0,r.jsx)(u.R,{isOpen:G,onClose:()=>V(!1),children:(0,r.jsxs)(m.A,{children:[(0,r.jsx)(p.k,{children:a("deleteModal.title")}),(0,r.jsx)(x.I,{children:a("deleteModal.message")}),(0,r.jsxs)(f.R,{children:[(0,r.jsx)(i.A,{variant:"light",onPress:()=>V(!1),children:a("deleteModal.cancel")}),(0,r.jsx)(i.A,{color:"danger",onPress:ea,children:a("deleteModal.delete")})]})]})})]})})}},751978:function(e,t,a){"use strict";var r=a(785893),s=a(667294),n=a(555346),l=a(286501),o=a(248583),i=a(980232),c=a(567421),d=a(73314),u=a(618633);let m=e=>{let{url:t,type:a}=e;return t&&""!==t&&"undefined"!==t&&"null"!==t?"image"===a?(0,r.jsx)("img",{src:t,alt:"Upload image",className:"object-contain w-full h-full rounded-lg",onError:e=>{let t=e.target;t.src="",t.style.display="none"}}):"video"===a?(0,r.jsx)("video",{src:t,className:"object-contain w-full h-full rounded-lg",controls:!0}):null:null},p=(0,s.memo)(e=>{let{onChange:t,onRemove:a,type:p="image",children:x,needAuth:f=!0,removable:h=!1,accept:g,limit:v,enforceLimit:b,style:w,className:j,initialImage:y}
1=e,N=(0,s.useRef)(null),[k,q]=(0,s.useState)(y||""),[I]=(0,o.KO)(i.L4),[P]=(0,o.KO)(i.k_),{t:Z}=(0,c.$G)("common");(0,s.useEffect)(()=>{y!==k&&q(y||"")},[y]);let C=async(e,t)=>{if(g){var a;let e=(null===(a=t.name.split(".").pop())||void 0===a?void 0:a.toLowerCase())||"";if(!g.split(",").map(e=>e.trim().startsWith(".")?e.trim().substring(1).toLowerCase():e.trim().toLowerCase()).includes(e))return l.ZP.error(Z("uploadFile.errors.invalidExtension",{accept:g}),{position:"top-center"}),!1}if("image"===e&&!t.type.startsWith("image"))return l.ZP.error(Z("uploadFile.errors.selectImage"),{position:"top-center"}),!1;if("video"===e&&!t.type.startsWith("video"))return l.ZP.error(Z("uploadFile.errors.selectVideo"),{position:"top-center"}),!1;if("video"===e&&(0,u.fr)())try{if(await (0,d.Mf)(t)>15)return l.ZP.error(Z("toast:video.styleTransfer.safariVideoTooLong")),!1}catch(e){console.warn("Failed to get video duration:",e)}return!0},F=async e=>{var a;let r=null===(a=e.target.files)||void 0===a?void 0:a[0];if(!r||!await C(p,r))return;if(v&&r.size>1048576*v){if(b){l.ZP.error(Z("uploadFile.errors.fileSize",{limit:v}),{position:"top-center"});return}if("image"===p)(0,l.ZP)(Z("uploadFile.warnings.imageWillCompress",{limit:v})||"Image exceeds ".concat(v,"MB and will be compressed"),{position:"top-center",duration:3e3});else{l.ZP.error(Z("uploadFile.errors.fileSize",{limit:v}),{position:"top-center"});return}}let s=URL.createObjectURL(r);q(s),null==t||t(s),N.current&&(N.current.value="")},M=async e=>{if(e.preventDefault(),f&&!I){var a;null===(a=P.onOpen)||void 0===a||a.call(P);return}let r=e.dataTransfer.files[0];if(!await C(p,r))return;if(v&&r.size>1048576*v){if(b){l.ZP.error(Z("uploadFile.errors.fileSize",{limit:v}),{position:"top-center"});return}if("image"===p)(0,l.ZP)(Z("uploadFile.warnings.imageWillCompress",{limit:v})||"Image exceeds ".concat(v,"MB and will be compressed"),{position:"top-center",duration:3e3});else{l.ZP.error(Z("uploadFile.errors.fileSize",{limit:v}),{position:"top-center"});return}}let s=URL.createObjectURL(r);q(s),null==t||t(s)};return(0,r.jsxs)("div",{className:"relative w-full h-36 md:h-48 rounded-lg border border-dashed cursor-pointer group hover:border-indigo-400 border-2 ".concat(j||""),onClick:()=>{var e,t;if(f&&!I){null===(t=P.onOpen)||void 0===t||t.call(P);return}null===(e=N.current)||void 0===e||e.click()},onDrop:M,onDragOver:e=>e.preventDefault(),style:w,children:[k?(0,r.jsxs)("div",{className:"relative w-full h-full",children:[(0,r.jsx)(m,{url:k,type:p}),h&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),q(""),N.current&&(N.current.value=""),null==a||a()},className:"absolute top-2 right-2 p-1 text-primary-foreground bg-red-500 rounded-full hover:bg-red-600",type:"button",children:(0,r.jsx)(n.Xm5,{className:"w-3 h-3"})})]}):(0,r.jsx)("div",{className:"flex absolute inset-0 flex-col justify-center items-center",children:x||(0,r.jsxs)(r.Fragment,{children:["image"===p?(0,r.jsx)(n.H3h,{className:"w-12 h-12 text-muted-foreground transition-colors duration-200 group-hover:text-indigo-500"}):(0,r.jsx)(n.KoQ,{className:"w-12 h-12 text-muted-foreground transition-colors duration-200 group-hover:text-indigo-500"}),(0,r.jsx)("p",{className:"mt-2 text-muted-foreground text-sm md:text-base transition-colors duration-200 group-hover:text-indigo-600 px-2 md:hidden",children:Z("uploadFile.tapToUpload")}),(0,r.jsx)("p",{className:"mt-2 text-muted-foreground text-sm md:text-base transition-colors duration-200 group-hover:text-indigo-600 px-2 hidden md:block",children:Z("uploadFile.clickToUpload")})]})}),(0,r.jsx)("input",{type:"file",accept:g||("image"===p?"image/*":"video"===p?"video/*":"image/*,video/*"),ref:N,className:"hidden",onChange:F})]})});t.Z=p},536602:function(e,t,a){"use strict";a.d(t,{o:function(){return n}});var r=a(248583),s=a(980232);let n=(e,t)=>{let[a]=(0,r.KO)(s.L4);return a?t:e}},520084:function(e,t,a){"use strict";a.d(t,{Y:function(){return c}});var r=a(667294),s=a(811163);let n=e=>{try{if(e.includes("supabase.co")||e.includes("hedra-api-video")||!e.includes("%"))return e;let t=decodeURIComponent(e);
1if(t!==e&&t.includes("%"))return n(t);return t}catch(t){return console.error("URL解码失败:",t,e),e}},l=()=>{let e=(0,s.useRouter)(),[t,a]=(0,r.useState)({});return(0,r.useEffect)(()=>{if(!e.isReady)return;let{mediaUrl:t,mediaType:r,prompt:s,source:l,characterId:o}=e.query;t&&r&&a({url:n(t),type:r,prompt:s,source:l,characterId:o})},[e.isReady,e.query]),t};var o=a(567421),i=a(286501);function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onImageProcessed:t}=e,[a,n]=(0,r.useState)(""),[c,d]=(0,r.useState)(!1),[u,m]=(0,r.useState)(!1),p=(0,s.useRouter)(),{t:x}=(0,o.$G)("common"),f=l(),h=!!(null==f?void 0:f.url),g=async()=>{let{pathname:e,query:t}=p;Object.keys(t).length>0&&await p.replace(e,void 0,{shallow:!0})},v=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e),m(t)};return(0,r.useEffect)(()=>{(async()=>{if(!c&&(null==f?void 0:f.url))try{let e=f.url;v(e,!0),d(!0),t&&t(e),i.ZP.success(x("from_other_tools",{input_type:x("input_types.image"),tools:x("tools.".concat(f.source))}),{position:"top-center",duration:3e3,style:{background:"#4CAF50",color:"#fff"}}),await g();return}catch(e){console.error("处理MediaNavigation图像失败:",e)}})()},[c,f,t]),{inputImage:a,setInputImage:v,hasMedia:h,mediaItem:f,isFromTool:u}}},63521:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return p}});var r=a(785893),s=a(775867),n=a(389598),l=a(809008),o=a.n(l),i=a(383198),c=a(667294),d=a(567421),u=a(813474),m=a(322226);function p(){let{t:e}=(0,d.$G)("image-upscaling");return(0,c.useEffect)(()=>{let e=setTimeout(()=>{try{i.Z.track("visit.page.tools.image_upscaling",{}),console.log("tracking mixpanel")}catch(e){console.error("Mixpanel tracking failed:",e)}},800);return()=>clearTimeout(e)},[]),(0,r.jsxs)("main",{className:"flex flex-col h-screen caffelabs text-foreground bg-background",children:[(0,r.jsxs)(o(),{children:[(0,r.jsx)("title",{children:e("meta.title")}),(0,r.jsx)("meta",{property:"og:type",content:"website"}),(0,r.jsx)("meta",{property:"og:title",content:e("meta.title")}),(0,r.jsx)("meta",{property:"og:description",content:e("meta.description")}),(0,r.jsx)("meta",{property:"og:url",content:"https://komiko.app/image_upscaling"}),(0,r.jsx)("meta",{property:"og:image",content:"https://d31cygw67xifd4.cloudfront.net/covers/tools/image-upscale.webp"}),(0,r.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,r.jsx)("meta",{name:"twitter:title",content:e("meta.title")}),(0,r.jsx)("meta",{name:"twitter:description",content:e("meta.description")}),(0,r.jsx)("meta",{name:"twitter:image",content:"https://d31cygw67xifd4.cloudfront.net/covers/tools/image-upscale.webp"}),(0,r.jsx)("meta",{name:"description",content:e("meta.fullDescription")}),(0,r.jsx)("meta",{name:"keywords",content:e("meta.keywords")})]}),(0,r.jsx)(s.h,{autoOpenLogin:!1}),(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)(u.Y,{}),(0,r.jsx)("div",{className:"p-2 pt-24  lg:pl-[240px] w-full h-full",children:(0,r.jsx)(n.Z,{})})]}),(0,r.jsx)(m.n,{className:"ml-5 border-border  lg:pl-[240px]"})]})}},83782:function(e,t,a){"use strict";a.d(t,{E:function(){return o},G:function(){return i}});var r=a(757632),s=a(567875),n=a(613786),l=a(430413);let o=async e=>{try{let t=await fetch((0,l.he)(e));if(!t.ok)throw Error("Failed to fetch image URL");let a=await t.blob(),n=new File([a],"".concat((0,r.Z)(),".jpg"),{type:"image/jpeg"}),o="app_media/".concat(n.name),i=new FormData;i.append("file",n),i.append("imagePath",o);let c=await (0,s.I)(i);if(!c||c.error)throw Error("Upload failed: ".concat(c.error));if(!c.data)throw Error("Failed to get public URL");return c.data}catch(e){throw console.error("Failed to upload image:",e),e}},i=async(e,t)=>{try{var a;let s=await fetch((0,l.he)(e));if(!s.ok)throw Error("Failed to fetch image URL");let o=await s.blob(),i=(null===(a=o.type)||void 0===a?void 0:a.startsWith("image/"))?o.type:"image/jpeg",c="image/jpeg"===i?"jpg":i.split("/")[1],d=new Date().toISOString().split("T")[0],u=(0,r.Z)(),m=new File([o],"".concat(d,"-").concat(u,".").concat(c),{type:i}),p="app_media/".concat(t||"anonymous","/").concat(d,"-").concat(u,".").concat(c);return await (0,n.uploadFile)(p,m)}catch(e){return console.error("Failed to upload image:",e),""}}},519314:function(e,t,a){"use strict";a.d(t,{G:function(){return c}});var r=a(283468),s=a(215607),n=a(933295),l=a(149869),o=a(785893),i=(0,s.Gp)((e,t)=>{var a;let{as:s,className:i,children:c,...d}=e,u=(0,n.gy)(t),{slots:m,classNames:p}=(0,r.R)(),x=(0,l.W)(null==p?void 0:p.body,i);return(0,o.jsx)(s||"div",{ref:u,className:null==(a=m.body)?void 0:a.call(m,{class:x}),...d,children:c})});i.displayName="NextUI.CardBody";var c=i},446448:function(e,t,a){"use strict";a.d(t,{P:function(){return i}});var r=a(728271),s=a(215607),n=a(607894),l=a(785893),o=(0,s.Gp)(({children:e,...t},a)=>{let{domRef:s,getModalProps:o}
1=(0,r.y)({...t,ref:a});return(0,l.jsx)(n.R,{ref:s,...o(),children:e})});o.displayName="NextUI.Drawer";var i=o},728271:function(e,t,a){"use strict";a.d(t,{y:function(){return c}});var r=a(144038),s=a(933295),n=a(667294),l=a(90029),o=a(850262),i=a(149869);function c(e){let{ref:t,className:a,classNames:c,placement:d="right",scrollBehavior:u="inside",size:m="md",motionProps:p,...x}=e,f=(0,s.gy)(t),h=(0,n.useMemo)(()=>{if(!(0,o.xb)(p))return p;let e="left"===d||"right"===d?"x":"y";return{variants:{enter:{[e]:0,transition:{[e]:{duration:.2,ease:l.Lj.easeOut}}},exit:{[e]:"top"===d||"left"===d?"-100%":"100%",transition:{[e]:{duration:.1,ease:l.Lj.easeIn}}}}}},[d,p]),g=(0,i.W)(null==c?void 0:c.base,a),v=(0,n.useMemo)(()=>(0,r.Y)({size:m,placement:d}),[m,d]);return{domRef:f,getModalProps:(0,n.useCallback)(()=>({classNames:{...c,base:v.base({class:g})},motionProps:h,scrollBehavior:u,size:m,...x}),[g,c,h,u,m,x])}}},456323:function(e,t,a){"use strict";a.d(t,{O:function(){return c}});var r=a(85772),s=a(215607),n=a(785893),l=e=>
1(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",focusable:"false",height:"1em",shapeRendering:"geometricPrecision",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",viewBox:"0 0 24 24",width:"1em",...e,children:[(0,n.jsx)("path",{d:"M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"}),(0,n.jsx)("path",{d:"M15 3h6v6"}),(0,n.jsx)("path",{d:"M10 14L21 3"})]}),o=a(791706),i=(0,s.Gp)((e,t)=>{let{Component:a,children:s,showAnchorIcon:i,anchorIcon:c=(0,n.jsx)(l,{className:o.A}),getLinkProps:d}=(0,r.n)({ref:t,...e});return(0,n.jsx)(a,{...d(),children:(0,n.jsxs)(n.Fragment,{children:[s,i&&c]})})});i.displayName="NextUI.Link";var c=i},85772:function(e,t,a){"use strict";a.d(t,{n:function(){return v}});var r=a(791706),s=a(168806),n=a(703136),l=a(828349),o=a(932433),i=a(644684),c=a(568587),d=a(414943),u=a(676733),m=a(215607),p=a(933295),x=a(2459),f=a(960798),h=a(850262),g=a(667294);function v(e){var t,a,v,b;let w=(0,u.w)(),[j,y]=(0,m.oe)(e,r.p.variantKeys),{ref:N,as:k,children:q,anchorIcon:I,isExternal:P=!1,showAnchorIcon:Z=!1,autoFocus:C=!1,className:F,onPress:M,onPressStart:_,onPressEnd:L,onClick:E,...R}=j,D=(0,p.gy)(N),S=null!=(a=null!=(t=null==e?void 0:e.disableAnimation)?t:null==w?void 0:w.disableAnimation)&&a,{linkProps:T}=function(e,t){let{elementType:a="a",onPress:r,onPressStart:u,onPressEnd:m,onClick:p,role:x,isDisabled:f,...h}=e,g={};"a"!==a&&(g={role:"link",tabIndex:f?void 0:0});let v=(0,s.gn)()||(0,s.Dt)();p&&"function"==typeof p&&"button"!==x&&(0,i.Z)("onClick is deprecated, please use onPress instead. See: https://github.com/nextui-org/nextui/issues/4292","useLink");let{focusableProps:b}=(0,c.k)(e,t),{pressProps:w,isPressed:j}=(0,d.r)({onPress:e=>{v&&(null==p||p(e)),null==r||r(e)},onPressStart:u,onPressEnd:m,isDisabled:f,ref:t}),y=(0,n.z)(h,{labelable:!0,isLink:"a"===a}),N=(0,l.d)(b,w),k=(0,o.tv)(),q=(0,o.eY)(e);return{isPressed:j,linkProps:(0,l.d)(y,q,{...N,...g,"aria-disabled":f||void 0,"aria-current":e["aria-current"],onClick:t=>{var a;null==(a=w.onClick)||a.call(w,t),!v&&p&&p(t),!k.isNative&&t.currentTarget instanceof HTMLAnchorElement&&t.currentTarget.href&&!t.isDefaultPrevented()&&(0,o.b0)(t.currentTarget,t)&&e.href&&(t.preventDefault(),k.open(t.currentTarget,t,e.href,e.routerOptions))}})}}({...R,onPress:M,onPressStart:_,onPressEnd:L,onClick:E,isDisabled:e.isDisabled,elementType:`${k}`},D),{isFocused:O,isFocusVisible:U,focusProps:z}=(0,x.F)({autoFocus:C});P&&(R.rel=null!=(v=R.rel)?v:"noopener noreferrer",R.target=null!=(b=R.target)?b:"_blank");let A=(0,g.useMemo)(()=>(0,r.p)({...y,disableAnimation:S,className:F}),[(0,f.Xx)(y),S,F]);return{Component:k||"a",children:q,anchorIcon:I,showAnchorIcon:Z,getLinkProps:(0,g.useCallback)(()=>({ref:D,className:A,"data-focus":(0,h.PB)(O),"data-disabled":(0,h.PB)(e.isDisabled),"data-focus-visible":(0,h.PB)(U),...(0,l.d)(z,T,R)}),[A,O,U,z,T,R])}}},144038:function(e,t,a){"use strict";a.d(t,{Y:function(){return r}});var r=(0,a(474428).tv)({slots:{base:["absolute","m-0","sm:m-0","overflow-y-auto"]},variants:{size:{xs:{base:"max-w-xs max-h-[20rem]"},sm:{base:"max-w-sm max-h-[24rem]"},md:{base:"max-w-md max-h-[28rem]"},lg:{base:"max-w-lg max-h-[32rem]"},xl:{base:"max-w-xl max-h-[36rem]"},"2xl":{base:"max-w-2xl max-h-[42rem]"},"3xl":{base:"max-w-3xl max-h-[48rem]"},"4xl":{base:"max-w-4xl max-h-[56rem]"},"5xl":{base:"max-w-5xl max-h-[64rem]"},full:{base:"max-w-full max-h-full h-[100dvh] !rounded-none"}},placement:{top:{base:"inset-x-0 top-0 max-w-[none] rounded-t-none"},right:{base:"inset-y-0 right-0 max-h-[none] rounded-r-none"},bottom:{base:"inset-x-0 bottom-0 max-w-[none] rounded-b-none"},left:{base:"inset-y-0 left-0 max-h-[none] rounded-l-none"}}}})},791706:function(e,t,a){"use strict";a.d(t,{A:function(){return l},p:function(){return n}});var r=a(474428),s=a(88115),n=(0,r.tv)({base:["relative inline-flex items-center outline-none tap-highlight-transparent",...s.Dh],variants:{size:{sm:"text-small",md:"text-medium",lg:"text-large"},color:{foreground:"text-foreground",primary:"text-primary",secondary:"text-secondary",success:"text-success",warning:"text-warning",danger:"text-danger"},underline:{none:"no-underline",hover:"hover:underline",always:"underline",active:"active:underline",focu
1s:"focus:underline"},isBlock:{true:["px-2","py-1","hover:after:opacity-100","after:content-['']","after:inset-0","after:opacity-0","after:w-full","after:h-full","after:rounded-xl","after:transition-background","after:absolute"],false:"hover:opacity-80 active:opacity-disabled transition-opacity"},isDisabled:{true:"opacity-disabled cursor-default pointer-events-none"},disableAnimation:{true:"after:transition-none transition-none"}},compoundVariants:[{isBlock:!0,color:"foreground",class:"hover:after:bg-foreground/10"},{isBlock:!0,color:"primary",class:"hover:after:bg-primary/20"},{isBlock:!0,color:"secondary",class:"hover:after:bg-secondary/20"},{isBlock:!0,color:"success",class:"hover:after:bg-success/20"},{isBlock:!0,color:"warning",class:"hover:after:bg-warning/20"},{isBlock:!0,color:"danger",class:"hover:after:bg-danger/20"},{underline:["hover","always","active","focus"],class:"underline-offset-4"}],defaultVariants:{color:"primary",size:"md",isBlock:!1,underline:"none",isDisabled:!1}}),l="flex mx-1 text-current self-center"},680666:function(e,t,a){"use strict";a.d(t,{t:function(){return s}});var r=a(667294);function s(e={}){let{rerender:t=!1,delay:a=0}=e,s=(0,r.useRef)(!1),[n,l]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{s.current=!0;let e=null;return t&&(a>0?e=setTimeout(()=>{l(!0)},a):l(!0)),()=>{s.current=!1,t&&l(!1),e&&clearTimeout(e)}},[t]),[(0,r.useCallback)(()=>s.current,[]),n]}},312014:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var r=(0,a(40885).Z)("outline","chevron-down","IconChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]])},49630:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var r=(0,a(40885).Z)("outline","chevron-up","IconChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]])},422007:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var r=(0,a(40885).Z)("outline","copy","IconCopy",[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]])},682137:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var r=(0,a(40885).Z)("outline","map-2","IconMap2",[["path",{d:"M12 18.5l-3 -1.5l-6 3v-13l6 -3l6 3l6 -3v7.5",key:"svg-0"}],["path",{d:"M9 4v13",key:"svg-1"}],["path",{d:"M15 7v5.5",key:"svg-2"}],["path",{d:"M21.121 20.121a3 3 0 1 0 -4.242 0c.418 .419 1.125 1.045 2.121 1.879c1.051 -.89 1.759 -1.516 2.121 -1.879z",key:"svg-3"}],["path",{d:"M19 18v.01",key:"svg-4"}]])},799096:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var r=(0,a(40885).Z)("outline","share-3","IconShare3",[["path",{d:"M13 4v4c-6.575 1.028 -9.02 6.788 -10 12c-.037 .206 5.384 -5.962 10 -6v4l8 -7l-8 -7z",key:"svg-0"}]])},344897:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var r=(0,a(40885).Z)("outline","template","IconTemplate",[["path",{d:"M4 4m0 1a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1z",key:"svg-0"}],["path",{d:"M4 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z",key:"svg-1"}],["path",{d:"M14 12l6 0",key:"svg-2"}],["path",{d:"M14 16l6 0",key:"svg-3"}],["path",{d:"M14 20l6 0",key:"svg-4"}]])},326758:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var r=(0,a(40885).Z)("outline","user-square","IconUserSquare",[["path",{d:"M9 10a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-0"}],["path",{d:"M6 21v-1a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v1",key:"svg-1"}],["path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z",key:"svg-2"}]])}},function(e){e.O(0,[60509,44321,64838,648,47473,11349,44892,75554,86835,67241,72326,92888,49774,40179],function(){return e(e.s=971310)}),_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.