1import{f as le,g as de,h as pe,S as ue,k as ce,s as E,a5 as me,A as xe,y as O,v as S,o as w,c as b,a as t,b as r,l as s,t as p,V as he,d as j,F as fe,O as B,E as z,G as L,n as q,p as U,q as y,c0 as ge,aa as ve,cK as we}from"./Bl7aIc7Y.js";import{A as be}from"./CEuPowNu.js";import{A as ye}from"./hCNgqYvz.js";import{A as ke}from"./s9I36zUG.js";import{R as Ce}from"./BbHqwxDV.js";import{S as _e}from"./Ad73TV1m.js";import"./B0FwBhnJ.js";import"./BIpKDfdz.js";import"./D3MSiAdk.js";const F=le("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]),Ae={class:"max-w-4xl mx-auto mt-20 mb-12 px-4 sm:px-6 md:mt-24 md:mb-24"},Me={class:"space-y-6"},Oe={class:"glass-panel flex items-center justify-between gap-3 rounded-2xl px-4 py-3 md:rounded-3xl md:px-5 md:py-4"},Se={class:"min-w-0"},Te={class:"mt-1 truncate text-sm font-semibold text-white"},Re={key:0,class:"glass-panel rounded-2xl md:rounded-3xl flex flex-col items-center justify-center gap-3 py-24 text-white/50"},Ie={class:"text-sm"},De={class:"font-bold text-white"},He={key:1,class:"glass-panel flex flex-col items-center justify-center gap-3 rounded-2xl py-24 text-white/50 md:rounded-3xl"},Ne={class:"glass-panel p-5 rounded-2xl md:p-6 md:rounded-3xl"},Ve={class:"flex items-start justify-between gap-3"},Ee=["disabled"],je={class:"mt-5"},Be={class:"flex items-center justify-between"},ze={class:"mt-4"},Le={class:"flex items-center justify-between"},K=2,k=300,P=10,C=3e3,Je=de({__name:"[id]",setup(qe){const{$firebaseAnalytics:_}=pe(),T=ue(),Y=ce(),{appInfoID:i}=E(Y),m=me(),{fetchAvatar2CopyPreview:$,setAdLanguage:R,setAvatar2MaxDuration:I,markAvatar2OptionsChosen:G,clearCopyDraft:D}=m,{adLanguage:x,avatar2MaxDuration:A,avatar2OptionsAppId:W,copyHook:n,copyBody:a,copyDraftId:u,copyPreviewLoading:h}=E(m),H=String(T.params.id||""),M=String(T.query.from_task||""),f=U(!1),g=U(!1);let c={duration:0,language:""},v=!1;const N=y(()=>m.languageOptions("app_video_generate_avatar_2")?.find(d=>d?.code===x.value)?.name||x.value||"..."),X=y(()=>!!u.value||!!n.value.trim()||!!a.value.trim()),J=y(()=>{const o=n.value.trim().length;return o>k||o>0&&o<K?"text-red-400":"text-white/35"}),Q=y(()=>{const o=a.value.trim().length;return o>C||o>0&&o<P?"text-red-400":"text-white/35"}),Z=()=>{ge().back()},l=(o="")=>{$(i.value,o)?.catch(e=>{O(e,"error")})},ee=()=>{l(M),G(i.value),ve(M).then(o=>{o?.language&&R(o.language,!0),I(Number(o?.generate_args?.max_duration_seconds)||we)}).catch(()=>{})},V=()=>{_?.trackEvent("click_avatar_script_change_settings"),c={duration:A.value,language:x.value},f.value=!0},te=()=>{!u.value&&!h.value&&S("/app/list")},oe=o=>{if(!o?.changed){u.value||l();return}if(h.value){l();return}if(u.value||n.value.trim()||a.value.trim()){v=!1,g.value=!0;return}l()},se=()=>{v=!0,g.value=!1,D(),l()},ne=()=>{if(g.value=!1,v){v=!1;return}c.duration&&I(c.duration),c.language&&R(c.language,!0)};xe(()=>{if(!i.value&&H&&(i.value=H),!i.value){O("Please select an app first","warning"),S("/app/list",{replace:!0});return}if(m.copyDraftAppId&&m.copyDraftAppId!==i.value&&D(),M){u.value||ee();return}if(W.value!==i.value){c={duration:A.value,language:x.value},f.value=!0;return}!u.value&&x.value&&l()});const ae=()=>{const o=n.value.trim(),e=a.value.trim();return o.length<K?"The opening hook is too short":o.length>k?`The opening hook must be within ${k} characters`:e.length<P?"The main script is too short":e.length>C?`The main script must be within ${C} characters`:""},re=()=>{_?.trackEvent("click_avatar_script_rewrite"),l()},ie=()=>{const o=ae();if(o){O(o,"warning");return}_?.trackEvent("click_avatar_script_next"),S("/template/list/avatar")};return(o,e)=>(w(),b("main",Ae,[t("button",{class:"mb-6 inline-flex items-center gap-2 text-white/50 hover:text-white transition-colors cursor-pointer",onClick:Z},[r(s(ke),{class:"w-5 h-5"}),e[3]||(e[3]=t("span",{class:"text-sm font-semibold"},"Back",-1))]),t("div",Me,[t("div",Oe,[t("div",Se,[e[4]||(e[4]=t("p",{class:"text-xs font-bold tracking-widest text-white/40"}," VIDEO SETTINGS ",-1)),t("p",Te,p(s(A))+"s · "+p(N.value),1)]),t("button",{class:"inline-flex shrink-0 cursor-pointer items-center gap-1.5 rounded-xl border border-white/10 bg-white/5 px-3 py-2 text-xs font-semibold text-white/60 transition-colors hover:border-brand-purple/50 hover:text-white",type:"button",onClick:V},[r(s(F),{class:"h-3.5 w-3.5"}),e[5]||(e[5]=t("span",null,"Change",-1))])]),s(h)?(w(),b("div",Re,[r(s(he),{size:"large",stroke:"9d9d9d"}),t("span",Ie,[e[6]||(e[6]=j(" Writing your script in ",-1)),t("span",De,p(N.value),1),e[7]||(e[7]=j("... ",-1))]),e[8]||(e[8]=t("span",{class:"text-xs text-white/30"}," Wrong length or language? Change it above and we'll start over. ",-1))])):X.value?(w(),b(fe,{key:2},[t("section",Ne,[t("div",Ve,[e[12]||(e[12]=t("div",null,[t("h1",{class:"font-display text-xl font-bold text-white md:text-2xl"}," Edit Your Script "),t("p",{class:"mt-1 text-sm text-white/45"}," Review the AI-written script below. Edit anything you like, or keep it as is â the video voiceover will follow this script. ")
1],-1)),t("button",{class:"shrink-0 inline-flex items-center gap-1.5 rounded-xl border border-white/10 bg-white/5 px-3 py-2 text-xs font-semibold text-white/60 transition-colors hover:border-brand-purple/50 hover:text-white cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",type:"button",disabled:s(h),onClick:re},[r(s(Ce),{class:"h-3.5 w-3.5"}),e[11]||(e[11]=t("span",null,"Rewrite",-1))],8,Ee)]),t("div",je,[t("div",Be,[e[13]||(e[13]=t("label",{class:"text-sm font-bold text-white"},"Opening Hook",-1)),t("span",{class:B(["text-xs",J.value])},p(s(n).trim().length)+"/"+p(k),3)]),e[14]||(e[14]=t("p",{class:"mt-0.5 text-xs text-white/35"}," The first line spoken on camera to grab attention. ",-1)),z(t("textarea",{"onUpdate:modelValue":e[0]||(e[0]=d=>q(n)?n.value=d:null),rows:"2",class:"mt-2 w-full resize-y rounded-xl border border-white/10 bg-white/[0.04] px-3.5 py-2.5 text-sm text-white placeholder-white/25 outline-none transition-colors focus:border-brand-purple/60",placeholder:"e.g. My grocery lists used to live on four different apps..."},null,512),[[L,s(n)]])]),t("div",ze,[t("div",Le,[e[15]||(e[15]=t("label",{class:"text-sm font-bold text-white"},"Main Script",-1)),t("span",{class:B(["text-xs",Q.value])},p(s(a).trim().length)+"/"+p(C),3)]),e[16]||(e[16]=t("p",{class:"mt-0.5 text-xs text-white/35"}," The rest of the voiceover. It will be automatically split into short scenes â one sentence per scene works best. ",-1)),z(t("textarea",{"onUpdate:modelValue":e[1]||(e[1]=d=>q(a)?a.value=d:null),rows:"8",class:"mt-2 w-full resize-y rounded-xl border border-white/10 bg-white/[0.04] px-3.5 py-2.5 text-sm text-white placeholder-white/25 outline-none transition-colors focus:border-brand-purple/60",placeholder:"The main script of your video..."},null,512),[[L,s(a)]])])]),t("button",{class:"w-full py-3 md:py-3.5 rounded-2xl bg-linear-to-r from-brand-purple to-brand-blue font-bold text-base md:text-lg shadow-[0_0_30px_rgba(139,92,246,0.3)] hover:opacity-90 transition-opacity flex items-center justify-center gap-2 cursor-pointer",type:"button",onClick:ie},[r(s(_e),{class:"w-5 h-5"}),e[17]||(e[17]=t("span",null,"Next: Choose Avatar",-1))])],64)):(w(),b("div",He,[e[10]||(e[10]=t("span",{class:"text-sm"}," Choose your video length and language to write the script. ",-1)),t("button",{class:"inline-flex cursor-pointer items-center gap-1.5 rounded-xl border border-white/10 bg-white/5 px-3.5 py-2 text-xs font-semibold text-white/70 transition-colors hover:border-brand-purple/50 hover:text-white",type:"button",onClick:V},[r(s(F),{class:"h-3.5 w-3.5"}),e[9]||(e[9]=t("span",null,"Video settings",-1))])]))]),r(ye,{modelValue:f.value,"onUpdate:modelValue":e[2]||(e[2]=d=>f.value=d),onConfirm:oe,onCancel:te},null,8,["modelValue"]),r(be,{"is-open":g.value,mode:"confirm",type:"warning",title:"Regenerate Script",content:"Changing the video length or language will regenerate the script and discard your edits. Continue?","confirm-text":"Change & Regenerate","cancel-text":"Keep Current",onConfirm:se,onClose:ne},null,8,["is-open"])]))}});export{Je as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.