1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,27348,e=>{"use strict";var t,s=e.i(175083),a=e.i(795803),l=e.i(344303),i=e.i(754897),r=e.i(2813),n=e.i(985902),o=((t={}).PENDIND="PENDING",t.CONVERTING="CONVERTING",t.UPLOADING="UPLOADING",t.WAITING_UPLOADING="WAITING_UPLOADING",t.SUCCESS="SUCCESS",t.ERROR="ERROR",t),d=e.i(107565),c=e.i(842763);let u=(0,c.default)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);var m=e.i(10306);let x=(0,c.default)("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var p=e.i(666786),h=e.i(504920),h=h,v=e.i(440368),j=e.i(152088);let g=(0,a.memo)(({afterSize:e,beforeSize:t})=>{let a=(e-t)/t*100;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{children:(0,d.formatSize)(e)}),(0,s.jsxs)("span",{className:(0,j.cn)({"text-primary":a>=0,"text-red-500":a<0},"ml-1"),children:["(",a>=0&&"+",Math.floor(a),"%)"]})]})});g.displayName="OutputSize";var f=e.i(144735),N=e.i(569779),S=e.i(49275),b=e.i(547608),w=e.i(465986),C=e.i(876581),y=e.i(377300),k=e.i(132405);let D=({tasks:e,removeTask:t,saveFile:l,retryJob:i})=>{let c=(0,r.useTranslations)("Tasks"),D=(0,r.useTranslations)("Qrcode"),[A,L]=(0,a.useState)(!1),[R,T]=(0,a.useState)(!1),[I,z]=(0,a.useState)(),[E,O]=(0,a.useState)(!1),F=e=>{if(!e||e<=0)return;if(e<1e3)return c("durationMs",{value:e});let t=e/1e3;if(t<60)return c("durationSeconds",{value:t.toFixed(t>=10?0:1)});let s=t/60;if(s<60){let e=Math.floor(s),a=Math.round(t%60);return 0===a?c("durationMinutes",{value:e}):c("durationMinutesSeconds",{minutes:e,seconds:a})}let a=Math.floor(s/60),l=Math.floor(s%60);return 0===l?c("durationHours",{value:a}):c("durationHoursMinutes",{hours:a,minutes:l})};return(0,s.jsxs)(s.Fragment,{children:[e?.map((t,r)=>{let u=t.settings?.format==="amv"?{mb:100,bytes:0x6400000,isAmv:!0}:{mb:300,bytes:0x12c00000,isAmv:!1},f=u.isAmv&&!!t.outputs&&t.outputs[0].size>u.bytes;return(0,s.jsxs)(a.Fragment,{children:[(0,s.jsxs)("div",{className:(0,j.cn)("relative py-3 flex flex-wrap items-center gap-x-3 gap-y-2 rounded-lg transition-colors sm:flex-nowrap sm:gap-y-0",!t.isVideo&&"bg-red-50"),children:[(0,s.jsx)("div",{className:(0,j.cn)("hidden sm:flex w-10 h-10 rounded-lg items-center justify-center shrink-0",t.isVideo?"bg-primary/10":"bg-red-100"),children:(0,s.jsx)(h.default,{className:(0,j.cn)("fill-current",t.isVideo?"text-primary":"text-red-500"),size:18,strokeWidth:0})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("div",{className:"truncate min-w-0 text-sm font-medium text-slate-800",title:t.file.name,children:t.file.name}),t.isVideo&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-0.5 mt-1 sm:gap-x-3",children:[(0,s.jsxs)("span",{className:"text-xs text-slate-500",children:[c("originalFile"),": ",(0,d.formatSize)(t.file.size)]}),t.outputs&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"text-xs text-slate-500",children:[c("afterConvert"),":"," ",(0,s.jsx)(g,{afterSize:t.outputs[0].size,beforeSize:t.file.size})]}),F(t.outputs[0].convertDurationMs)&&(0,s.jsxs)("span",{className:"text-xs text-slate-500",children:[c("duration"),": ",F(t.outputs[0].convertDurationMs)]})]})]})]}),(0,s.jsxs)("div",{className:"flex order-4 w-full items-center justify-end gap-2 sm:order-3 sm:w-auto sm:shrink-0",children:[t.status===o.SUCCESS&&(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm text-green-600 font-medium",children:c("success")}),!u.isAmv&&t.outputs&&t.outputs[0].size>u.bytes?(0,s.jsx)("span",{className:"text-xs text-amber-600 ml-2",children:c("downloadTooLarge",{limit:u.mb})}):(0,s.jsx)(n.Button,{size:"sm",className:"h-9 gap-1 sm:h-8",disabled:t.isDownloading,onClick:()=>{f?(0,y.toast)(c("downloadTooLargeAmv",{limit:u.mb}),{action:{label:c("downloadApp"),onClick:()=>window.open(k.LOCAL_AMV_URL,"_blank")}}):t.isDownloaded?(L(!0),z(t)):l(t)},children:t.isDownloading?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p.Loader2,{size:14,className:"animate-spin"}),(0,s.jsx)("span",{children:c("downloading")}),t.downloadProgress&&(0,s.jsxs)("span",{children:[t.downloadProgress,"%"]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(m.Download,{size:14}),(0,s.jsx)("span",{children:t.isDownloaded?c("downloaded"):c("download")})]})})]}),t.status===o.ERROR&&(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("div",{className:"text-right",children:[(0,s.jsx)("span",{className:"text-sm text-red-500 font-medium",children:c("fail")}),"RATE_LIMIT_EXCEEDED"===t.errorCode&&(0,s.jsx)("div",{className:"text-red-500 text-xs mt-1",children:(0,s.jsxs)(w.Tooltip,{children:[(0,s.jsx)(w.TooltipTrigger,{asChild:!0,children:(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(x,{size:12}),(0,s.jsx)("span",{children:c("rateLimited")})]})}),(0,s.jsx)(w.TooltipContent,{children:(0,s.jsx)("p",{className:"max-w-xs",children:c("rateLimitedTip")})})]})})]}),"RATE_LIMIT_EXCEEDED"===t.errorCode&&(0,s.jsx)(n.Button,{variant:"outline",size:"sm",className:"h-9 sm:h-8",onClick:()=>{i(t)},children:c("retry")})]}),t.status===o.PENDIND&&(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:(0,j.cn)("text-sm",t.sizeLimit?.isOverLimit?"text-amber-600":"text-slate-500"),children:t.isVideo?t.sizeLimit?.isOverLimit?c("overSizeLimit",{limit:t.sizeLimit.limit}):c("pending"):c("notConvertible")}),t.isVideo&&t.sizeLimit?.isOverLimit&&(0,s.jsx)("button",{type:"button",className:"text-amber-500 hover:text-amber-600",onClick:()=>O(!0),children:(0,s.jsx)(x,{size:16})})]}),t.status===o.WAITING_UPLOADING&&(0,s.jsx)("span",{className:"text-sm text-slate-500",children:c("waiting")}),t.status===o.UPLOADING&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[(0,s.jsx)(p.Loader2,{size:16,className:"animate-spin"}),(0,s.jsx)("span",{children:c("uploading")}),t.uploadProgress&&(0,s.jsxs)("span",{children:[Math.floor(100*t.uploadProgress),"%"]})]}),t.status===o.CONVERTING&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[(0,s.jsx)(p.Loader2,{size:16,className:"animate-spin"}),(0,s.jsx)("span",{children:c("converting")}),t.progress>0&&(0,s.jsxs)("span",{children:[t.progress,"%"]})]})]}),(0,s.jsx)(n.Button,{variant:"ghost",size:"icon",className:"order-3 w-9 h-9 text-slate-400 hover:text-slate-600 hover:bg-slate-100 sm:order-4 sm:h-8 sm:w-8",title:c("delete"),"aria-label":c("delete"),onClick:()=>{z(t),T(!0)},children:(0,s.jsx)(v.X,{size:16})})]}),r<e.length-1&&(0,s.jsx)(C.Separator,{className:"my-1"})]},t.id)}),(0,s.jsx)(b.Dialog,{open:E,onOpenChange:O,children:(0,s.jsxs)(b.DialogContent,{className:"max-w-sm",children:[(0,s.jsx)(b.DialogHeader,{children:(0,s.jsx)(b.DialogTitle,{className:"text-center",children:c("sizeLimitTitle")})}),(0,s.jsxs)("div",{className:"flex flex-col items-center py-4",children:[(0,s.jsx)(f.default,{src:N.default,width:160,alt:D("qrAlt")}),(0,s.jsx)("div",{className:"mt-3 text-center text-sm text-slate-600",children:c("sizeLimitDesc")})]})]})}),(0,s.jsx)(S.AlertDialog,{open:A,onOpenChange:e=>{e||(L(e),z(void 0))},children:(0,s.jsxs)(S.AlertDialogContent,{children:[(0,s.jsxs)(S.AlertDialogHeader,{children:[(0,s.jsx)(S.AlertDialogTitle,{children:c("tip")}),(0,s.jsx)(S.AlertDialogDescription,{children:c("redownloadConfirm")})]}),(0,s.jsxs)(S.AlertDialogFooter,{children:[(0,s.jsx)(S.AlertDialogCancel,{children:c("cancel")}),(0,s.jsx)(S.AlertDialogAction,{onClick:e=>{if(e.preventDefault(),I){let e=I.outputs?.[0].key||"";window.open(/^https?:\/\//.test(e)?e:"https://file.ahelpers.com/"+e)}L(!1)},children:c("download")})]})]})}),(0,s.jsx)(S.AlertDialog,{open:R,onOpenChange:e=>{e||(T(e),z(void 0))},children:(0,s.jsxs)(S.AlertDialogContent,{children:[(0,s.jsxs)(S.AlertDialogHeader,{children:[(0,s.jsxs)(S.AlertDialogTitle,{className:"flex items-center",children:[(0,s.jsx)(u,{className:"mr-2 text-destructive",size:18}),c("deleteConfirmTitle")]}),(0,s.jsx)(S.AlertDialogDescription,{children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("code",{className:"bg-slate-100 px-2 py-1 rounded text-sm",children:I?.file.name}),(0,s.jsx)("br",{}),(0,s.jsx)("br",{}),c("deleteConfirmDesc")]})})]}),(0,s.jsxs)(S.AlertDialogFooter,{children:[(0,s.jsx)(S.AlertDialogCancel,{children:c("cancel")}),(0,s.jsx)(S.AlertDialogAction,{variant:"destructive",onClick:e=>{e.preventDefault(),I&&t(I.id),T(!1)},children:c("delete")})]})]})})]})};var A=e.i(680707),L=e.i(173554),R=e.i(758934),T=e.i(898358),T=T,I=e.i(715049),z=e.i(896422),E=e.i(985555),O=e.i(572234),F=e.i(601506),V=e.i(468438);let M=(0,V.createServerReference)("400514316d3eb8810b7ded64bf8e7a445c26eeb4c4",V.callServer,void 0,V.findSourceMapURL,"createUploadTask");var P=e.i(748673),G=e.i(776447);let B=(e,t)=>{let s=t?.format,a=200,l="é»è®¤éå¶";"amv"===s?(a=100,l="AMVæ ¼å¼éå¶"):(a=200,l="éAMVæ ¼å¼éå¶");let i=e.size>1024*a*1024;return{limit:a,reason:l,isOverLimit:i}},U=async e=>(await fetch("/api/app/convert/status?appTaskId="+e,{headers:{"skip-login":"1"}})).json(),_={},H={},W=(0,O.create)()((0,F.immer)((e,t)=>({tasks:[],createTask(t,s){t.name.split(".").pop();let a=(0,E.nanoid)(),l=B(t,s),i={id:a,file:t,progress:0,videoUrl:URL.createObjectURL(t),status:o.PEND
1IND,settings:s,isVideo:(0,P.default)(t),sizeLimit:l};e(e=>{e.tasks.push(i)})},async startJob(e,s){let a=t().update;if(t().tasks.filter(e=>e.status===o.UPLOADING).length>=3)return void a(e.id,{status:o.WAITING_UPLOADING,settings:s});if(e.status!==o.PENDIND&&e.status!==o.WAITING_UPLOADING||!e.isVideo)return;let l=e.videoKey,i=e.region;try{if(!l){a(e.id,{status:o.UPLOADING});let s=await t().uploadFile(e);a(e.id,{videoKey:s?.form.parameters.key,region:s?.region}),l=s?.form.parameters.key,i=s?.region}a(e.id,{status:o.CONVERTING,settings:s});let r=await fetch("/api/app/convert",{method:"POST",headers:{"skip-login":"1","x-app-id":I.default.env.NEXT_PUBLIC_CONVERT_PC_APPID||"cm2ai4a2w00011327k4989djw"},body:JSON.stringify({key:l,region:i,options:s})});if(r.ok){let s=await r.json();s.success?t().checkConvertStatus(s.data.taskId,e):a(e.id,{status:o.ERROR})}else 429===r.status?a(e.id,{status:o.ERROR,errorCode:"RATE_LIMIT_EXCEEDED"}):a(e.id,{status:o.ERROR,errorCode:"GENERAL"})}catch(t){console.log("startJob err:",t),a(e.id,{status:o.ERROR})}},async retryJob(e){(0,t().update)(e.id,{status:o.PENDIND,errorCode:void 0});let s=t().tasks.find(t=>t.id===e.id);s&&t().startJob(s,s.settings)},async checkConvertStatus(e,s){if(!t().tasks.find(e=>e.id===s.id))return;let a=t().update,l=await U(e);if("Success"===l.data.status)a(s.id,{status:o.SUCCESS,outputs:[{...l.data.output,convertDurationMs:l.data.convertDurationMs}]});else if("Failed"===l.data.status)a(s.id,{status:o.ERROR});else{let a=setTimeout(()=>{t().checkConvertStatus(e,s)},3e3);_[s.id]=a}},async uploadFile(e){let s=t().update,a=await M(e.file.name),l=a?.data?.result?.form;if(!a.success||!l)return void s(e.id,{status:o.ERROR,errorCode:a.errorCode});let i=new FormData;i.append("OSSAccessKeyId",l.parameters.OSSAccessKeyId),i.append("policy",l.parameters.policy),i.append("Signature",l.parameters.signature),i.append("key",l.parameters.key),l.parameters.callback,i.append("file",e.file);let r=new AbortController;H[e.id]=r,await z.default.post(l.url,i,{signal:r.signal,onUploadProgress:t=>{s(e.id,{uploadProgress:t.progress})}});let n=t().tasks.filter(e=>e.status===o.WAITING_UPLOADING).slice(0,3);n&&n.forEach(e=>{t().startJob(e,e.settings)});let d=a?.data?.result;return d?{...d,region:a?.data?.region}:void 0},removeTask(t){clearTimeout(_[t]),H[t]&&H[t].abort(),e(e=>{let s=e.tasks.findIndex(e=>e.id===t);s>-1&&e.tasks.splice(s,1)}),y.toast.success("å 餿å")},async saveFile(e){if(e.status===o.SUCCESS&&e.outputs&&e.outputs.length){t().update(e.id,{isDownloading:!0});try{let s=e.outputs[0].key,a=/^https?:\/\//.test(s)?s:"https://file.ahelpers.com/"+s,{blob:l,filename:i}=await (0,G.downloadFile)(a,{onDownloadProgress:s=>{t().update(e.id,{downloadProgress:s})}});(0,G.saveFile)(l,i),t().update(e.id,{isDownloaded:!0})}catch(e){console.log(e)}finally{t().update(e.id,{isDownloading:!1})}}},updateSizeLimits(t){e(e=>{e.tasks.forEach(e=>{e.sizeLimit=B(e.file,t)})})},update(t,s){e(e=>{let a=e.tasks.find(e=>e.id===t);a&&Object.assign(a,s)})}})));var J=e.i(429702),K=e.i(304454),X=e.i(553319);let q=({className:e})=>{let t=(0,r.useTranslations)("AmvPage"),{visible:a,dismiss:l}
1=(0,k.useLocalAmvNotice)();return a?(0,s.jsxs)("div",{className:(0,j.cn)("relative flex items-start gap-2 rounded-lg border border-green-200 bg-green-50 px-3 py-2.5 pr-8 text-xs leading-relaxed text-slate-600 sm:text-sm",e),children:[(0,s.jsx)(X.Smartphone,{className:"mt-0.5 size-4 shrink-0 text-green-600"}),(0,s.jsxs)("p",{children:[t("localInlineTip")," ",(0,s.jsxs)("a",{href:k.LOCAL_AMV_URL,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 font-medium text-green-700 hover:text-green-800 hover:underline",children:[t("localCta"),(0,s.jsx)(K.ArrowRight,{className:"size-3.5"})]})]}),(0,s.jsx)("button",{type:"button","aria-label":t("localDismiss"),onClick:l,className:"absolute right-1.5 top-1.5 rounded-md p-1 text-slate-400 transition-colors hover:bg-green-100 hover:text-slate-600",children:(0,s.jsx)(v.X,{className:"size-3.5"})})]}):null},Q=(0,a.forwardRef)((e,t)=>{let l=(0,r.useTranslations)("Settings"),i=(0,r.useTranslations)(),{tasks:o,startJob:d,updateSizeLimits:c}=W(),{settings:u,setSettings:m,updateSetting:p}=(e=>{let t={videoSize:"auto",videoScaleMode:"stretch",format:"mp4",videoCodec:"libx264",videoBitrate:"auto",videoFramerate:"auto",videoAspect:"auto",audioBitrate:"auto",audioSampleRate:"auto",audioChannels:"auto",videoRotate:"auto",...e};"amv"===t.format&&(t.videoSize="320x240",t.videoFramerate="25");let[s,l]=(0,a.useState)(t);return{settings:s,updateSetting:(e,t)=>{l(s=>({...s,[e]:t}))},setSettings:l}})(e.settings),[h,v]=(0,a.useState)("amv"===u.format?"2":"1"),g=(0,R.getFormatOptions)(u.format),f=(0,a.useCallback)(()=>{v("2"),m({format:"amv",videoSize:"320x240",videoScaleMode:"stretch",videoFramerate:"25"})},[m]),N=async e=>{let t=e.get("format"),s="amv"===t?0x6400000:0xc800000,a=o.filter(e=>e.isVideo&&e.file.size<=s),i=o.filter(e=>e.isVideo&&e.file.size>s),r=Object.fromEntries(e),n={};for(let e in r)"auto"!==r[e]&&(n[e]=r[e]);a.forEach(e=>{d(e,{format:t,...n})}),a.length>0&&y.toast.success(l("toastQueued",{count:a.length})),i.length>0&&y.toast.warning(l("toastOversized",{count:i.length,limit:s/1048576}))},S=(0,a.useRef)(null),[b,C]=(0,a.useState)(void 0);(0,a.useEffect)(()=>{if(!e.isFixed||!S.current)return;let t=S.current,s=()=>C(t.offsetWidth);s();let a=new ResizeObserver(s);return a.observe(t),()=>a.disconnect()},[e.isFixed]),(0,a.useImperativeHandle)(t,()=>({getSettings:()=>Object.fromEntries(new FormData(S.current))}));let k=e=>(0,J.translateOptionLabel)(e,e=>i(e));return(0,s.jsxs)("form",{ref:S,action:N,className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(L.Label,{className:"text-xs font-medium text-slate-500 uppercase tracking-wide",children:l("targetFormat")}),(0,s.jsxs)(A.Select,{value:u.format,name:"format",onValueChange:e=>{p("format",e),"amv"===e&&f(),c({...u,format:e})},children:[(0,s.jsx)(A.SelectTrigger,{className:"w-full","data-testid":"format-select",children:(0,s.jsx)(A.SelectValue,{placeholder:l("selectFormat")})}),(0,s.jsx)(A.SelectContent,{children:(0,s.jsx)(A.SelectGroup,{children:R.formatOptions.map(e=>(0,s.jsx)(A.SelectItem,{value:e.value,children:e.label},e.value))})})]})]}),"amv"===u.format&&(0,s.jsx)(q,{}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(L.Label,{className:"text-xs font-medium text-slate-500 uppercase tracking-wide",children:l("videoOptions")}),(0,s.jsxs)(A.Select,{value:h,onValueChange:v,disabled:"amv"===u.format,children:[(0,s.jsx)(A.SelectTrigger,{className:"w-full","data-testid":"video-options-select",children:(0,s.jsx)(A.SelectValue,{placeholder:l("pleaseSelect")})}),(0,s.jsx)(A.SelectContent,{children:(0,s.jsxs)(A.SelectGroup,{children:[(0,s.jsx)(A.SelectItem,{value:"1",children:l("keepDefault")}),(0,s.jsx)(A.SelectItem,{value:"2",children:l("changeParams")})]})})]})]})]}),"2"===h&&(0,s.jsxs)("div",{className:"space-y-4 pt-2 border-t border-slate-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 text-slate-500",children:[(0,s.jsx)(T.default,{size:16}),(0,s.jsx)("span",{className:"text-sm font-medium",children:l("advancedSettings")})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:["videoSize"in g&&(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(L.Label,{className:"text-xs font-medium text-slate-500 uppercase tracking-wide",children:l("resolution")}),(0,s.jsxs)(A.Select,{value:u.videoSize,name:"videoSize",onValueChange:e=>{p("videoSize",e)},children:[(0,s.jsx)(A.SelectTrigger,{className:"w-full","data-testid":"video-size-select",children:(0,s.jsx)(A.SelectValue,{placeholder:l("selectResolution")})}),(0,s.jsx)(A.SelectContent,{children:(0,s.jsx)(A.SelectGroup,{children:g.videoSize?.options.map(e=>(0,s.jsx)(A.SelectItem,{value:e.value,children:k(e.label)},e.value))})})]})]}),"videoScaleMode"in g&&u.videoSize&&"auto"!==u.videoSize&&(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(L.Label,{className:"text-xs font-medium text-slate-500 uppercase tracking-wide",children:l("scaleMode")}),(0,s.jsxs)(A.Select,{value:u.videoScaleMode||"stretch",name:"videoScaleMode",onValueChange:e=>{p("videoScaleMode",e)},children:[(0,s.jsx)(A.SelectTrigger,{className:"w-full","data-testid":"video-scale-mode-select",children:(0,s.jsx)(A.SelectValue,{placeholder:l("selectScaleMode")})}),(0,s.jsx)(A.SelectContent,{children:(0,s.jsx)(A.SelectGroup,{children:g.videoScaleMode?.options.map(e=>(0,s.jsx)(A.SelectItem,{value:e.value,children:k(e.label)},e.value))})})]})]}),"videoCodec"in g&&(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(L.Label,{className:"text-xs font-medium text-slate-500 uppercase tracking-wide",children:l("videoCodec")}),(0,s.jsxs)(A.Select,{value:u.videoCodec,name:"videoCodec",onValueChange:e=>{p("videoCodec",e)},children:[(0,s.jsx)(A.SelectTrigger,{className:"w-full",children:(0,s.jsx)(A.SelectValue,{placeholder:l("selectCodec")})}),(0,s.jsx)(A.SelectContent,{children:(0,s.jsx)(A.SelectGroup,{children:g.videoCodec?.options.map(e=>(0,s.jsx)(A.SelectItem,{value:e.value,children:k(e.label)},e.value))})})]})]}),"videoBitrate"in g&&(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(L.Label,{className:"text-xs font-medium text-slate-500 uppercase tracking-wide",children:l("videoBitrate")}),(0,s.jsxs)(A.Select,{value:u.videoBitrate,name:"videoBitrate",onValueChange:e=>{p("videoBitrate",e)},children:[(0,s.jsx)(A.SelectTrigger,{className:"w-full",children:(0,s.jsx)(A.SelectValue,{placeholder:l("selectBitrate")})}),(0,s.jsx)(A.SelectContent,{children:(0,s.jsx)(A.SelectGroup,{children:g.videoBitrate?.options.map(e=>(0,s.jsx)(A.SelectItem,{value:e.value,children:k(e.label)},e.value))})})]})]}),"videoFramerate"in g&&(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(L.Label,{className:"text-xs font-medium text-slate-500 uppercase tracking-wide",children:l("framerate")}),(0,s.jsxs)(A.Select,{value:u.videoFramerate,name:"videoFramerate",onValueChange:e=>{p("videoFramerate",e)},children:[(0,s.jsx)(A.SelectTrigger,{className:"w-full",children:(0,s.jsx)(A.SelectValue,{placeholder:l("selectFramerate")})}),(0,s.jsx)(A.SelectContent,{children:(0,s.jsx)(A.SelectGroup,{children:g.videoFramerate?.options.map(e=>(0,s.jsx)(A.SelectItem,{value:e.value,children:k(e.label)},e.value))})})]})]}),"videoAspect"in g&&(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(L.Label,{className:"text-xs font-medium text-slate-500 uppercase tracking-wide",children:l("aspectRatio")}),(0,s.jsx)(w.TooltipProvider,{children:(0,s.jsxs)(w.Tooltip,{children:[(0,s.jsx)(w.TooltipTrigger,{asChild:!0,children:(0,s.jsx)("button",{type:"button",className:"inline-flex text-slate-400 hover:text-slate-600","aria-label":l("aspectRatioHintLabel"),"data-testid":"video-aspect-hint",children:(0,s.jsx)(x,{className:"size-3.5"})})}),(0,s.jsx)(w.TooltipContent,{className:"max-w-xs",children:(0,s.jsx)("p",{children:l("aspectRatioHint")})})]})})]}),(0,s.jsxs)(A.Select,{value:u.videoAspect||"auto",name:"videoAspect",onValueChange:e=>{p("videoAspect",e)},children:[(0,s.jsx)(A.SelectTrigger,{className:"w-full","data-testid":"video-aspect-select",children:(0,s.jsx)(A.SelectValue,{placeholder:l("selectAspect")})}),(0,s.jsx)(A.SelectContent,{children:(0,s.jsx)(A.SelectGroup,{children:g.videoAspect?.options.map(e=>(0,s.jsx)(A.SelectItem,{value:e.value,children:k(e.label)},e.value))})})]})]}),"audioBitrate"in g&&(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(L.Label,{className:"text-xs font-medium text-slate-500 uppercase tracking-wide",children:l("audioBitrate")}),(0,s.jsxs)(A.Select,{value:u.audioBitrate,name:"audioBitrate",onValueChange:e=>{p("audioBitrate",e)},children:[(0,s.jsx)(A.SelectTrigger,{className:"w-full",children:(0,s.jsx)(A.SelectValue,{placeholder:l("selectAudioBitrate")})}),(0,s.jsx)(A.SelectContent,{children:(0,s.jsx)(A.SelectGroup,{children:g.audioBitrate?.options.map(e=>(0,s.jsx)(A.SelectItem,{value:e.value,children:k(e.label)},e.value))})})]})]}),"audioSampleRate"in g&&(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(L.Label,{className:"text-xs font-medium text-slate-500 uppercase tracking-wide",children:l("audioSampleRate")}),(0,s.jsxs)(A.Select,{value:u.audioSampleRate,name:"audioSampleRate",onValueChange:e=>{p("audioSampleRate",e)},children:[(0,s.jsx)(A.SelectTrigger,{className:"w-full",children:(0,s.jsx)(A.SelectValue,{placeholder:l("selectAudioSampleRate")})}),(0,s.jsx)(A.SelectContent,{children:(0,s.jsx)(A.SelectGroup,{children:g.audioSampleRate?.options.map(e=>(0,s.jsx)(A.SelectItem,{value:e.value,children:k(e.label)},e.value))})})]})]}),"audioChannels"in g&&(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(L.Label,{className:"text-xs font-medium text-slate-500 uppercase tracking-wide",children:l("audioChannels")}),(0,s.jsxs)(A.Select,{value:u.audioChannels,name:"audioChannels",onValueChange:e=>{p("audioChannels",e)},children:[(0,s.jsx)(A.SelectTrigger,{className:"w-full",children:(0,s.jsx)(A.SelectValue,{placeholder:l("selectAudioChannels")})}),(0,s.jsx)(A.SelectContent,{children:(0,s.jsx)(A.SelectGroup,{children:g.audioChannels?.options.map(e=>(0,s.jsx)(A.SelectItem,{value:e.value,children:k(e.label)},e.value))})})]})]})]})]}),(0,s.jsx)("div",{className:(0,j.cn)({"fixed bottom-0 inset-x-0 sm:inset-x-auto bg-white border-t px-4 pt-4 pb-[max(1rem,env(safe-area-inset-bottom))] sm:p-4 shadow-lg z-50":e.isFixed}),style:{width:e.isFixed&&null!=b?b:"auto"},children:(0,s.jsx)(n.Button,{variant:"default",disabled:0===o.length,type:"submit",className:"w-full h-12 text-base font-medium shadow-sm hover:shadow-md transition-all",children:l("startConvert")})})]})});Q.displayName="Settings",(0,a.memo)(Q).displayName="SettingsMemo";var Z=e.i(269279),Y=e.i(394541),$=e.i(7284);let ee=(0,c.default)("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]),et=(0,c.default)("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}
1]]);var es=e.i(914850);let ea=(0,a.forwardRef)((e,t)=>{let l=(0,r.useTranslations)("FileDrop"),[{canDrop:i,isOver:o},d]=(0,Z.useDrop)(()=>({accept:[Y.NativeTypes.FILE],drop(t){e.onChange(t.files)},canDrop:()=>!0,collect:e=>({isOver:e.isOver(),canDrop:e.canDrop()})}),[e]),c=(0,a.useRef)(null);(0,a.useImperativeHandle)(t,()=>({clear:()=>{c.current&&(c.current.value="")},choose:()=>{c.current&&(c.current.value=""),c.current?.click()}}));let u=i&&o,[m,x]=(0,a.useState)(!1);return(0,a.useLayoutEffect)(()=>{x(!!("FileSystemHandle"in window&&"showDirectoryPicker"in window&&"showOpenFilePicker"in window))},[]),(0,s.jsxs)("div",{ref:d,className:(0,$.default)("relative cursor-pointer min-h-52 rounded-2xl border-2 border-dashed flex flex-col justify-center items-center transition-all duration-300 px-6 py-8",u?"border-primary bg-primary/5":"border-slate-200 hover:border-primary/50 hover:bg-slate-50"),children:[(0,s.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[(0,s.jsx)("div",{className:(0,$.default)("w-16 h-16 rounded-full flex items-center justify-center transition-colors",u?"bg-primary/20":"bg-slate-100"),children:(0,s.jsx)(es.UploadCloud,{size:32,className:(0,$.default)("transition-colors",u?"text-primary":"text-slate-400")})}),(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("p",{className:(0,$.default)("text-lg font-medium mb-1",u?"text-primary":"text-slate-700"),children:l(u?"dropActive":"dropIdle")}),(0,s.jsx)("p",{className:"text-sm text-slate-500",children:l("orClick")})]}),(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 relative z-10",children:[(0,s.jsxs)(n.Button,{size:"lg",onClick:e=>{e.stopPropagation(),e.preventDefault(),c.current&&(c.current.value=""),c.current?.click()},className:"min-w-32",children:[(0,s.jsx)(ee,{size:18,className:"mr-2"}),l("selectFile")]}),m&&(0,s.jsxs)(n.Button,{size:"lg",variant:"secondary",onClick:t=>{t.stopPropagation(),t.preventDefault(),window.showDirectoryPicker().then(async t=>{let s=[];for await(let e of t.values())if("file"===e.kind){let t=await e.getFile();null!==t&&(0,P.default)(t)&&s.push(t)}e.onChange(s)}).catch(e=>{console.log("choose folder failed:",e)})},className:"min-w-32",children:[(0,s.jsx)(et,{size:18,className:"mr-2"}),l("selectFolder")]})]}),(0,s.jsx)("p",{className:"text-xs text-slate-400 mt-2",children:l("supportedFormats")})]}),(0,s.jsx)("input",{ref:c,onChange:t=>{e.onChange(t.target.files)},accept:"video/*, video/vnd.dlna.mpeg-tts",type:"file",multiple:!0,name:"file",className:"opacity-0 absolute inset-0 cursor-pointer"})]})}),el=(0,a.memo)(({settings:e})=>{let t=(0,r.useTranslations)("Converter"),{createTask:o,retryJob:d,tasks:c,removeTask:u,saveFile:m}=W(),x=(0,a.useRef)(null),p=(0,a.useRef)(null),h=t=>{t&&Array.from(t).forEach(t=>{(0,P.default)(t)&&o(t,e||{format:"mp4"})})},v=(0,a.useRef)(null),j=(0,a.useRef)(null),[g,f]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=()=>{if(v.current){let e=v.current.getBoundingClientRect();e.top>window.innerHeight-e.height?f(!0):f(!1)}};window.addEventListener("scroll",e),window.addEventListener("resize",e);let t=new ResizeObserver(e);return j.current&&t.observe(j.current),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e),t.disconnect()}},[]),(0,s.jsx)(l.DndProvider,{backend:i.HTML5Backend,children:(0,s.jsxs)("div",{className:"space-y-6",ref:j,children:[(0,s.jsx)("div",{className:"border border-slate-200 bg-white rounded-xl shadow-sm overflow-hidden",children:0===c.length?(0,s.jsx)("div",{className:"p-2",children:(0,s.jsx)(ea,{onChange:h,filesCount:c.length})}):(0,s.jsx)("div",{ref:v,children:(0,s.jsx)("div",{className:"p-4",children:(0,s.jsx)(D,{tasks:c,removeTask:u,saveFile:m,retryJob:d})})})}),c.length>0&&(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("span",{className:"text-sm text-slate-600 bg-slate-100 px-3 py-1.5 rounded-full",children:t("addedVideos",{count:c.length})}),(0,s.jsxs)(n.Button,{variant:"secondary",onClick:()=>{x.current&&(x.current.value="",x.current.click())},className:"gap-2 shrink-0",children:[(0,s.jsx)(ee,{size:18}),t("addMore")]}),(0,s.jsx)("input",{ref:x,onChange:e=>{h(e.target.files)},accept:"video/*, *.ts",type:"file",multiple:!0,name:"file",className:"opacity-0 absolute -top-96"})]}),c.length>0&&(0,s.jsx)("div",{className:"border border-slate-200 bg-white rounded-xl shadow-sm p-4 sm:p-6",children:(0,s.jsx)(Q,{settings:e,ref:p,isFixed:g})})]})})});el.displayName="Converter",e.s(["Converter",0,el],27348)},132405,e=>{"use strict";var t=e.i(460651),s=e.i(572234);let a="amv-local-banner-dismissed",l=(0,s.create)(e=>({dismissed:"1"===sessionStorage.getItem(a),dismiss:()=>{sessionStorage.setItem(a,"1"),e({dismissed:!0})}}));e.s(["LOCAL_AMV_URL",0,"https://amv.ahelpers.com/app","useLocalAmvNotice",0,()=>{let e=(0,t.useLocale)(),s=l(e=>e.dismissed),a=l(e=>e.dismiss);return{visible:"zh-CN"===e&&!s&&!/(?:TBS\/|MQQBrowser)/i.test(navigator.userAgent),dismiss:a}}])}]);
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.