PageSourceSearch

https://viraldancemaker.com/_next/static/chunks/app/ai-dance-video…?dpl=dpl_CYGWtnMHTfA12kbFspaB4DBgNsFe

js viraldancemaker.com collected 2026-10-06 15:14:57 UTC 57,897 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[609],{3762:(e,t,a)=>{"use strict";a.d(t,{DanceVideoGenerator:()=>J});var r=a(95155),o=a(12115),i=a(6874),s=a.n(i),n=a(85690),l=a(5196),d=a(54416),c=a(42076),u=a(29869),m=a(51154),p=a(53311),h=a(61976),f=a(88145),g=a(97168),v=a(99840);function x(e){let{isOpen:t,onClose:a,requiredCredits:o,currentCredits:i=0}=e;return(0,r.jsx)(v.lG,{open:t,onOpenChange:a,children:(0,r.jsxs)(v.Cf,{className:"max-w-md mx-auto",children:[(0,r.jsx)(v.c7,{children:(0,r.jsx)(v.L3,{className:"text-center",children:"Insufficient Credits"})}),(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 bg-red-100 rounded-full flex items-center justify-center",children:(0,r.jsx)(d.A,{className:"w-8 h-8 text-red-600"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-2",children:"Not enough credits"}),(0,r.jsxs)("p",{className:"text-muted-foreground mb-6",children:["You need at least ",o," credit",o>1?"s":""," to generate. You currently have ",i," credit",1!==i?"s":"",". Please purchase more credits to continue."]}),(0,r.jsxs)("div",{className:"flex gap-3 justify-center",children:[(0,r.jsx)(g.$,{variant:"outline",onClick:a,children:"Cancel"}),(0,r.jsx)(g.$,{onClick:()=>{a(),window.open("/pricing","_blank")},children:"Buy Credits"})]})]})]})})}var b=a(40968),y=a(53999);function w(e){let{className:t,...a}=e;return(0,r.jsx)(b.b,{"data-slot":"label",className:(0,y.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...a})}var k=a(93399),j=a(66474),_=a(47863);let A=k.bL;k.YJ;let N=k.WT,I=o.forwardRef((e,t)=>{let{className:a,children:o,...i}=e;return(0,r.jsxs)(k.l9,{ref:t,className:(0,y.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...i,children:[o,(0,r.jsx)(k.In,{asChild:!0,children:(0,r.jsx)(j.A,{className:"h-4 w-4 opacity-50"})})]})});I.displayName=k.l9.displayName;let S=o.forwardRef((e,t)=>{let{className:a,...o}=e;return(0,r.jsx)(k.PP,{ref:t,className:(0,y.cn)("flex cursor-default items-center justify-center py-1",a),...o,children:(0,r.jsx)(_.A,{className:"h-4 w-4"})})});S.displayName=k.PP.displayName;let F=o.forwardRef((e,t)=>{let{className:a,...o}=e;return(0,r.jsx)(k.wn,{ref:t,className:(0,y.cn)("flex cursor-default items-center justify-center py-1",a),...o,children:(0,r.jsx)(j.A,{className:"h-4 w-4"})})});F.displayName=k.wn.displayName;let T=o.forwardRef((e,t)=>{let{className:a,children:o,position:i="popper",...s}=e;return(0,r.jsx)(k.ZL,{children:(0,r.jsxs)(k.UC,{ref:t,className:(0,y.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:i,...s,children:[(0,r.jsx)(S,{}),(0,r.jsx)(k.LM,{className:(0,y.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:o}),(0,r.jsx)(F,{})]})})});T.displayName=k.UC.displayName,o.forwardRef((e,t)=>{let{className:a,...o}=e;return(0,r.jsx)(k.JU,{ref:t,className:(0,y.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...o})}).displayName=k.JU.displayName;let P=o.forwardRef((e,t)=>{let{className:a,children:o,...i}=e;return(0,r.jsxs)(k.q7,{ref:t,className:(0,y.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...i,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(k.VF,{children:(0,r.jsx)(l.A,{className:"h-4 w-4"})})}),(0,r.jsx)(k.p4,{children:o})]})});P.displayName=k.q7.displayName,o.forwardRef((e,t)=>{let{className:a,...o}=e;return(0,r.jsx)(k.wv,{ref:t,className:(0,y.cn)("-mx-1 my-1 h-px bg-muted",a),...o})}).displayName=k.wv.displayName;var E=a(78080),$=a(32165);let R=(0,o.createContext)({openUpgradeModal:()=>{},closeUpgradeModal:()=>{}});var D=a(31886),C=a(72367);let U="https://cysource.viraldancemaker.com/moban",O=`${U}/hero.mp4`,V="/video-posters/templates/hero.webp",B=Array.from({length:4},(e,t)=>({name:`Character template ${t+1}`,url:`${U}/ai-dance-generator-${t+1}.jpg`})),M=[{name:"Artistic Animated Dance",url:"https://cysource.viraldancemaker.com/moban/Artistic-Animated-Dance.mp4",poster:"/video-posters/templates/artistic-animated-dance.webp"},{name:"Ghost Step Dance",url:"https://cysource.viraldancemaker.com/moban/Ghost-Step-Dance.mp4",poster:"/video-posters/templates/ghost-step-dance.webp"},{name:"Heart Dance",url:"https://cysource.viraldancemaker.com/moban/Heart-Dance.mp4",poster:"/video-posters/templates/heart-dance.webp"},{name:"Malvado de Vapo",url:"https://cysource.viraldancemaker.com/moban/Malvado-de-Vapo.mp4",poster:"/video-posters/templates/malvado-de-vapo.webp"},{name:"Midu Folk Song Dance",url:"https://cysource.viraldancemaker.com/moban/Midu-Folk-Song-Dance.mp4",poster:"/video-posters/templates/midu-folk-song-dance.webp"},{name:"Sabre Horse Dance",url:"https://cysource.viraldancemaker.com/moban/Sabre-Horse-Dance.mp4",poster:"/video-posters/templates/sabre-horse-dance.webp"}];function L(e){return new Promise(t=>{let a=document.createElement("video");
1a.preload="metadata",a.muted=!0,a.playsInline=!0;let r=e=>{a.removeAttribute("src"),a.load(),t(e)};a.onloadedmetadata=()=>{r(Number.isFinite(a.duration)?a.duration:5)},a.onerror=()=>r(5),a.src=e})}function z(e){let{label:t,items:a,selectedUrl:o,onSelect:i,video:s=!1}=e;return(0,r.jsxs)("div",{className:t?"mt-4":"",children:[t&&(0,r.jsx)(w,{className:"text-xs font-medium text-[#6D687A]",children:t}),(0,r.jsx)("div",{className:(0,y.cn)("min-w-0 gap-2",t&&"mt-2",s?"grid grid-cols-6":"flex overflow-x-auto"),children:a.map(e=>{let t=o===e.url;return(0,r.jsxs)("button",{type:"button",onClick:()=>i(e),className:(0,y.cn)("group relative shrink-0 overflow-hidden rounded-[12px] border transition duration-200",s?"aspect-[9/16] w-full bg-[#17151F]":"h-14 w-12 bg-[#F0F0F5]",t?"border-[#563BFF] ring-2 ring-[#563BFF]/25":"border-[#241c4c]/10 hover:border-[#563BFF]/40"),"aria-label":`Use ${e.name}`,"aria-pressed":t,children:[(0,r.jsx)("img",{src:s?e.poster??V:e.poster??e.url,alt:s?`${e.name} viral dance template preview`:`${e.name} full-body photo for AI dance video generation`,loading:"lazy",className:(0,y.cn)("h-full w-full transition duration-300",s?"object-contain group-hover:scale-[1.02]":"object-contain object-center")}),s&&(0,r.jsx)("span",{className:"absolute inset-0 grid place-items-center bg-black/25",children:(0,r.jsx)("span",{className:"grid h-6 w-6 place-items-center rounded-full bg-black/50 text-white backdrop-blur-sm",children:(0,r.jsx)(n.A,{className:"h-3 w-3 fill-current"})})}),t&&(0,r.jsx)("span",{className:"absolute right-1 top-1 grid h-4 w-4 place-items-center rounded-full bg-[#563BFF] text-white shadow-md",children:(0,r.jsx)(l.A,{className:"h-2.5 w-2.5",strokeWidth:3})})]},e.url)})})]})}function G(e){let{hint:t,accept:a,asset:i,onChange:s,onClear:n,onRequestUpload:l}=e,u=(0,o.useRef)(null);return(0,r.jsxs)("div",{className:"relative overflow-hidden rounded-[16px] border-2 border-dashed border-[#241c4c]/18 bg-[#FAFAFD]",children:[(0,r.jsx)("input",{ref:u,type:"file",accept:a,onChange:s,className:"hidden"}),i?(0,r.jsxs)("div",{className:"relative flex min-h-[76px] items-center gap-3 px-4 py-3",children:[(0,r.jsx)("img",{src:i.url,alt:`${i.name} preview`,className:"h-12 w-12 rounded-[12px] bg-[#F0F0F5] object-contain"}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("p",{className:"truncate text-sm font-semibold text-[#17151F]",children:i.name}),(0,r.jsx)("p",{className:"mt-1 text-xs text-[#6D687A]",children:"Photo ready"})]}),(0,r.jsx)("button",{type:"button",onClick:n,className:"ml-auto rounded-full bg-[#17151F]/8 p-1.5 transition-colors hover:bg-red-500 hover:text-white","aria-label":"Remove uploaded photo",children:(0,r.jsx)(d.A,{className:"h-4 w-4"})})]}):(0,r.jsxs)("button",{type:"button",onClick:()=>{var e;(!l||l())&&(null==(e=u.current)||e.click())},className:"group flex min-h-[76px] w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-[#F0EEFF]",children:[(0,r.jsx)("span",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-[13px] bg-[#E9E5FF] text-[#563BFF] transition-transform group-hover:-translate-y-0.5",children:(0,r.jsx)(c.A,{className:"h-5 w-5"})}),(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"block text-sm font-semibold text-[#17151F]",children:"Upload photo"}),(0,r.jsx)("span",{className:"mt-1 block text-xs text-[#6D687A]",children:t})]})]})]})}function H(e){let{asset:t,onChange:a,onClear:i}=e,s=(0,o.useRef)(null);return(0,r.jsxs)("div",{className:"relative aspect-[9/16] min-w-0 overflow-hidden rounded-[12px] border-2 border-dashed border-[#241c4c]/18 bg-[#FAFAFD]",children:[(0,r.jsx)("input",{ref:s,type:"file",accept:"video/mp4,video/quicktime",onChange:a,className:"hidden"}),t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("video",{src:t.url,muted:!0,playsInline:!0,preload:"metadata",poster:t.poster,className:"h-full w-full bg-[#17151F] object-contain","aria-label":`${t.name} preview`},t.url),(0,r.jsx)("button",{type:"button",onClick:i,className:"absolute right-1 top-1 rounded-full bg-black/55 p-1 text-white transition-colors hover:bg-red-500","aria-label":"Remove uploaded dance video",children:(0,r.jsx)(d.A,{className:"h-3 w-3"})})]}):(0,r.jsxs)("button",{type:"button",onClick:()=>{var e;return null==(e=s.current)?void 0:e.click()},className:"flex h-full w-full flex-col items-center justify-center gap-2 px-2 text-center transition-colors hover:bg-[#F0EEFF]",children:[(0,r.jsx)(u.A,{className:"h-5 w-5 text-[#563BFF]"}),(0,r.jsx)("span",{className:"text-[11px] font-medium text-[#6D687A]",children:"Upload"})]})]})}function J(){let{defaultPreview:e=O,defaultPreviewPoster:t=V,selectedTemplate:a,onSelectedTemplateClear:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{isSignedIn:l}=(0,h.Jd)(),{userInfo:d,refreshUserInfo:c}=(0,C.P)(),{openAuthModal:u}=(0,E.X)(),{openUpgradeModal:g}=function(){let e=(0,o.useContext)(R);if(void 0===e)throw Error("useUpgradeModal must be used within an UpgradeModalProvider");return e}(),{error:v,info:b,success:k}=(0,$.d)(),[j,_]=(0,o.useState)(null),[S,F]=(0,o.useState)(null),[U,J]=(0,o.useState)("standard"),[q,Y]=(0,o.useState)(!1),[W,Z]=(0,o.useState)(""),[X,K]=(0,o.useState)(0),[Q,ee]=(0,o.useState)(""),[et,ea]=(0,o.useState)(""),[er,eo]=(0,o.useState)(5),[ei,es]=(0,o.useState)(!1),[en,el]=(0,o.useState)(!1),ed=(0,o.useRef)(null),ec=Math.min(20,Math.max(3,Math.ceil(er||5))),eu=Math.max(5,ec)*("standard"===U?3:4);(0,o.useEffect)(()=>()=>{ed.current&&clearInterval(ed.current)},[]),(0,o.useEffect)(()=>{el(!1)},[e]),(0,o.useEffect)(()=>
1{if(!a)return;let e=!1;return F(e=>((null==e?void 0:e.isObjectUrl)&&URL.revokeObjectURL(e.url),{name:a.title,url:a.video,poster:a.poster})),ea(""),L(a.video).then(t=>{e||eo(Math.min(20,Math.max(3,t||5)))}),()=>{e=!0}},[a]);let em=(0,o.useMemo)(()=>`${eu} Credits`,[eu]),ep=(e,t,a)=>{(null==e?void 0:e.isObjectUrl)&&URL.revokeObjectURL(e.url),a({name:t.name,url:URL.createObjectURL(t),file:t,isObjectUrl:!0}),ea("")},eh=async e=>{var t;let a=null==(t=e.target.files)?void 0:t[0];if(!a)return;if(!a.type.startsWith("video/")){v("Upload a valid reference video."),e.target.value="";return}if(a.size>0x6400000){v("The reference video must be smaller than 100MB."),e.target.value="";return}let r=URL.createObjectURL(a),o=await L(r);if(o<3){URL.revokeObjectURL(r),v("Use a reference video that is at least 3 seconds long."),e.target.value="";return}if(o>20){URL.revokeObjectURL(r),v("Use a reference video no longer than 20 seconds."),e.target.value="";return}(null==S?void 0:S.isObjectUrl)&&URL.revokeObjectURL(S.url),null==i||i(),F({name:a.name,url:r,file:a,isObjectUrl:!0}),eo(o),ea(""),e.target.value=""},ef=async function(e,t,a){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(null==t?void 0:t.isObjectUrl)&&URL.revokeObjectURL(t.url),r&&(null==i||i()),a({name:e.name,url:e.url,poster:e.poster}),ea(""),r&&eo(Math.min(20,Math.max(3,await L(e.url)||5)))},eg=()=>{ed.current&&clearInterval(ed.current);let e=Date.now();K(4),ed.current=setInterval(()=>{K(Math.min(94,4+Math.floor(90*Math.min(1,(Date.now()-e)/3e5))))},1e3)},ev=()=>{ed.current&&clearInterval(ed.current),ed.current=null},ex=async(e,t)=>{if(e.file){let a=await D.FH.gen.uploadImage(e.file),r=function(e){let t=null==e?void 0:e.data;if("string"==typeof t)return t;if(t&&"object"==typeof t){if("string"==typeof t.r3_url)return t.r3_url;if("string"==typeof t.url)return t.url;if("string"==typeof t.image_url)return t.image_url}return""}(a);if((null==a?void 0:a.code)!==200||!r)throw Error((null==a?void 0:a.msg)||`${t} upload failed.`);return r}return e.url},eb=async()=>{if(!q){if(!j||!S)return void v("Choose one character image and one dance video first.");if(!l)return void u("signin");if(!d)return void b("Loading account information, please wait.");if(ec<3)return void v("The reference video must be at least 3 seconds long.");if(ec>20)return void v("Reference videos can be up to 20 seconds.");if((d.total_credits||0)<eu)return void es(!0);Y(!0),K(0),ee(""),ea(""),Z("Preparing media..."),eg();try{var e;Z("Uploading media...");let[t,a]=await Promise.all([ex(j,"Character image"),ex(S,"Reference video")]);Z("Starting generation...");let r=await D.FH.gen.generateVideo({is_std:"standard"===U,image_url:t,video_url:a,character_orientation:"video",duration:ec,prompt:"",keep_original_sound:!0}),o=null==r||null==(e=r.data)?void 0:e.task_id;if((null==r?void 0:r.code)!==200||"string"!=typeof o||!o)throw Error((null==r?void 0:r.msg)||"Failed to create the dance video task.");ee(o),Z("Generating dance video...");let i=await D.FH.gen.pollTaskStatus(o);ev(),ea(i.video_url),K(100),Z(""),k("Dance video generated successfully."),c()}catch(t){ev(),K(0),Z("");let e=t instanceof Error?t.message:"Failed to generate the dance video.";/upgrade|plan|subscription/i.test(e)?g({source:"ai-dance-generator",reason:e}):v(e)}finally{ev(),Y(!1)}}};return(0,r.jsxs)("section",{id:"create",className:"scroll-mt-20 bg-[#F7F7FB] px-5 pb-24 pt-6 md:px-8 lg:pb-32 lg:pt-8",children:[(0,r.jsxs)("div",{className:"mx-auto grid max-w-7xl grid-cols-1 items-start gap-6 lg:grid-cols-5 lg:gap-8",children:[(0,r.jsx)("div",{className:"flex min-w-0 flex-col lg:col-span-2",children:(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col rounded-[28px] border border-[#241c4c]/10 bg-white p-5 shadow-[0_24px_70px_rgba(35,27,74,.10)] sm:p-6",children:[(0,r.jsxs)("div",{className:"mb-7",children:[(0,r.jsx)("h2",{className:"text-2xl font-semibold tracking-[-0.035em] text-[#17151F] sm:text-[28px]",children:"Create Your AI Dance Video"}),(0,r.jsx)("p",{className:"mt-2 max-w-md text-sm leading-6 text-[#6D687A]",children:"Upload a full-body photo, choose a dance template, and generate a short AI dance video."})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(w,{className:"mb-2 block text-sm font-medium text-[#17151F]",children:"Your Photo"}),(0,r.jsx)(G,{hint:"JPG, PNG, WEBP (max 10MB)",accept:"image/jpeg,image/png,image/webp",asset:j,onChange:e=>{var t;let a=null==(t=e.target.files)?void 0:t[0];if(a){if(!["image/jpeg","image/png","image/webp"].includes(a.type)){v("Upload a JPG, PNG, or WEBP image."),e.target.value="";return}if(a.size>0xa00000){v("The image must be smaller than 10MB."),e.target.value="";return}ep(j,a,_),e.target.value=""}},onRequestUpload:()=>!!l||(u("signin"),!1),onClear:()=>{(null==j?void 0:j.isObjectUrl)&&URL.revokeObjectURL(j.url),_(null),ea("")}}),(0,r.jsx)(z,{label:"Try these examples",items:B,selectedUrl:null==j?void 0:j.url,onSelect:e=>{ef(e,j,_)}})]}),(0,r.jsxs)("div",{className:"mt-7",children:[(0,r.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-4",children:[(0,r.jsx)(w,{className:"text-sm font-medium text-[#17151F]",children:"Select or upload a dance template"}),(0,r.jsx)("span",{className:"shrink-0 text-xs text-[#6D687A]",children:"3 to 20 seconds"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-7 gap-2",children:[(0,r.jsx)(H,{asset:S,onChange:e=>{eh(e)},onClear:()=>{(null==S?void 0:S.isObjectUrl)&&URL.revokeObjectURL(S.url),null==i||i(),F(null),eo(5),ea("")}}),(0,r.jsx)("div",{className:"col-span-6 min-w-0",children:(0,r.jsx)(z,{label:"",items:M,selectedUrl:null==S?void 0:S.url,onSelect:e=>{ef(e,S,F,!0)},video:!0})})]})]}),(0,r.jsx)("div",{className:"mt-7 border-t border-[#241c4c]/10 pt-5",children:(0,r.jsxs)("div",{children:[(0,r.jsx)(w,{className:"mb-1.5 block text-xs font-medium text-[#6D687A]",children:"Model"}),(0,r.jsxs)(A,{value:U,onValueChange:e=>J(e),disabled:q,children:[(0,r.jsx)(I,{className:"w-full rounded-[14px] border-[#241c4c]/12 bg-[#FAFAFD] text-[#17151F]","aria-label":"Select generation model",children:(0,r.jsx)(N,{})}),(0,r.jsxs)(T,{children:[(0,r.jsx)(P,{value:"standard",children:"Standard \xb7 3 credits/s"}),(0,r.jsx)(P,{value:"pro",children:"Pro \xb7 4 credits/s"})]})]})]})}),(0,r.jsxs)("p",{className:"mt-4 text-center text-xs text-[#6D687A]",children:[ec,"s video \xb7 minimum 5s billing"]}),(0,r.jsxs)("div",{className:"relative mt-2 pt-2",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>{eb()},disabled:q,className:"relative w-full rounded-full bg-[#563BFF] py-4 font-semibold text-white shadow-[0_14px_30px_rgba(86,59,255,.24)] transition hover:bg-[#4932E8] hover:scale-[1.01] active:scale-[0.99] disabled:cursor-wait disabled:opacity-65 disabled:hover:scale-100",children:[q?(0,r.jsxs)("span",{className:"flex items-center justify-center gap-2 text-base",children:[(0,r.jsx)(m.A,{className:"h-4 w-4 animate-spin"}),"Generating..."]}):(0,r.jsx)("span",{className:"text-base",children:"Generate Dance Video"}),!q&&(0,r.jsx)("span",{className:"absolute -right-1 -top-3 rotate-3 rounded-full border-2 border-white bg-[#17151F] px-2.5 py-1 text-[10px] font-bold text-white shadow-lg",children:em})]}),q&&W&&(0,r.jsx)("p",{className:"mt-3 text-center text-xs text-[#563BFF]","aria-live":"polite",children:W})]})]})}),(0,r.jsx)("div",{className:"lg:col-span-3",children:(0,r.jsx)("div",{className:"relative h-[500px] overflow-hidden rounded-[28px] border border-[#241c4c]/10 bg-[#111015] p-1 shadow-[0_24px_70px_rgba(35,27,74,.12)] lg:h-[620px]",children:(0,r.jsxs)("div",{className:"relative h-full overflow-hidden rounded-[24px] bg-black",children:[et?(0,r.jsx)("video",{autoPlay:!0,controls:!0,playsInl
1ine:!0,preload:"metadata",className:"h-full w-full object-contain","aria-label":"Generated AI dance video",children:(0,r.jsx)("source",{src:et})},et):en?(0,r.jsx)("video",{autoPlay:!0,controls:!0,muted:!0,loop:!0,playsInline:!0,preload:"none",poster:t||void 0,className:"h-full w-full object-contain opacity-90 transition-opacity duration-700 hover:opacity-100","aria-label":"AI-generated dance video preview",children:(0,r.jsx)("source",{src:e})},e):(0,r.jsxs)("button",{type:"button",onClick:()=>el(!0),className:"group relative h-full w-full overflow-hidden bg-black focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-inset focus-visible:ring-[#8C7AFF]","aria-label":"Play AI-generated dance video preview",children:[(0,r.jsx)("img",{src:t,alt:"",loading:"eager",fetchPriority:"high",className:"h-full w-full object-contain opacity-90 transition duration-500 group-hover:scale-[1.01] group-hover:opacity-100"}),(0,r.jsx)("span",{className:"absolute inset-0 grid place-items-center bg-black/10",children:(0,r.jsx)("span",{className:"grid h-16 w-16 place-items-center rounded-full border border-white/30 bg-black/45 text-white shadow-xl backdrop-blur-md transition-transform group-hover:scale-105",children:(0,r.jsx)(n.A,{className:"ml-1 h-6 w-6 fill-current","aria-hidden":"true"})})})]}),(0,r.jsxs)("div",{className:"absolute inset-x-0 top-0 flex items-center justify-between p-4",children:[(0,r.jsxs)(f.E,{variant:"secondary",className:"border-white/10 bg-black/40 text-[10px] uppercase tracking-wide text-gray-200 backdrop-blur-md",children:[(0,r.jsx)("span",{className:(0,y.cn)("mr-2 h-2 w-2 rounded-full",et?"bg-emerald-400 shadow-[0_0_10px_rgba(52,211,153,0.8)]":q?"animate-pulse bg-amber-400":"bg-[#8C7AFF]")}),et?"Generated result":q?"Creating video":"Live preview"]}),(0,r.jsx)(f.E,{variant:"outline",className:"border-white/10 bg-black/40 text-[10px] text-gray-300 backdrop-blur-md",children:"standard"===U?"Standard":"Pro"})]}),q&&(0,r.jsxs)("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center bg-[#111015]/75 backdrop-blur-sm",children:[(0,r.jsxs)("div",{className:"relative mb-5 h-24 w-24",children:[(0,r.jsx)("div",{className:"absolute inset-0 rounded-full border-4 border-[#563BFF]/20"}),(0,r.jsx)("div",{className:"absolute inset-0 animate-spin rounded-full border-4 border-[#563BFF] border-t-transparent"}),(0,r.jsx)(p.A,{className:"absolute left-1/2 top-1/2 h-8 w-8 -translate-x-1/2 -translate-y-1/2 animate-pulse text-[#8C7AFF]"})]}),(0,r.jsx)("p",{className:"text-lg font-medium text-white",children:"Creating your dance"}),(0,r.jsxs)("p",{className:"mt-1 text-sm font-medium text-[#B7A8FF]",children:[Math.round(X),"% Complete"]}),(0,r.jsx)("div",{className:"mt-4 h-2 w-72 max-w-[75%] overflow-hidden rounded-full bg-white/10",children:(0,r.jsx)("div",{className:"h-full rounded-full bg-[#7964FF] transition-[width] duration-500 ease-out",style:{width:`${Math.min(100,Math.max(0,X))}%`}})}),(0,r.jsx)("p",{className:"mt-3 max-w-xs px-4 text-center text-xs text-white/55","aria-live":"polite",children:W||"Preparing generation..."}),Q&&(0,r.jsx)("div",{className:"mt-5 max-w-sm rounded-xl bg-white/[0.06] px-4 py-3 text-center",children:(0,r.jsxs)("p",{className:"text-xs leading-5 text-gray-300",children:["No need to wait here. View the result anytime in your"," ",(0,r.jsx)(s(),{href:"/profile",className:"font-medium text-[#B7A8FF] underline decoration-[#B7A8FF]/50 underline-offset-2 transition-colors hover:text-white",children:"Profile"}),"."]})})]})]})})})]}),(0,r.jsx)(x,{isOpen:ei,onClose:()=>es(!1),requiredCredits:eu,currentCredits:(null==d?void 0:d.total_credits)||0})]})}},31886:(e,t,a)=>{"use strict";a.d(t,{FH:()=>c,QG:()=>l});var r=a(94826);let o={VIDOR_AI_BASE:r.DR.baseUrl,APP_ID:r.DR.appId},i=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t={"Content-Type":"application/json","x-appid":o.APP_ID};if(e){let e=localStorage.getItem("access_token");e&&(t.Authorization=`Bearer ${e}`)}return t},s=async e=>{if(!e.ok){let t=await e.text();throw Error(`HTTP Error ${e.status}: ${t||e.statusText}`)}let t=await e.json();if(t.code&&200!==t.code)throw Error(`${t.message||t.msg||"Unknown error"}`);return t},n={textToVideo:async e=>s(await fetch(`${o.VIDOR_AI_BASE}/api/task/volcengine/text2video`,{method:"POST",headers:i(),body:JSON.stringify({prompt:e.prompt,resolution:e.resolution,ratio:e.ratio,duration:e.duration,framepersecond:e.framepersecond||24})})),imageToVideo:async e=>{let t=new FormData;t.append("prompt",e.prompt),t.append("resolution",e.resolution),t.append("duration",e.duration.toString()),t.append("framepersecond",(e.framepersecond||24).toString()),t.append("image_file",e.image_file),e.image_tail_file&&t.append("image_tail_file",e.image_tail_file);let a=localStorage.getItem("access_token"),r={"x-appid":o.APP_ID};return a&&(r.Authorization=`Bearer ${a}`),s(await fetch(`${o.VIDOR_AI_BASE}/api/task/volcengine/img2video`,{method:"POST",headers:r,body:t}))},checkTaskStatus:async e=>s(await fetch(`${o.VIDOR_AI_BASE}/api/task/volcengine/check_task_status?task_id=${e}`,{method:"GET",headers:i()})),pollTaskStatus:async(e,t)=>new Promise((a,r)=>{let o=async()=>{try{let i=await n.checkTaskStatus(e);
1if(200!==i.code)return void r(Error(i.msg||"Task check failed"));let{status:s,status_msg:l,video_url:d,progress:c}=i.data;if(t){let e=100*parseFloat(c);t(e,l)}1===s?a({video_url:d,status:s,status_msg:l}):-1===s?r(Error(l||"Task failed")):setTimeout(o,2e3)}catch(e){r(e)}};o()}),seedance15TextToVideo:async e=>s(await fetch(`${o.VIDOR_AI_BASE}/api/task/volcengine/seedance1.5/text2video`,{method:"POST",headers:i(),body:JSON.stringify({prompt:e.prompt,resolution:e.resolution,duration:e.duration,camerafixed:e.camerafixed,audio:e.audio})})),seedance15ImageToVideo:async e=>{let t=new FormData;t.append("prompt",e.prompt),t.append("resolution",e.resolution),t.append("duration",e.duration.toString()),t.append("camerafixed",e.camerafixed.toString()),t.append("audio",e.audio.toString()),t.append("image_file",e.image_file),e.image_tail_file&&t.append("image_tail_file",e.image_tail_file);let a=localStorage.getItem("access_token"),r={"x-appid":o.APP_ID};return a&&(r.Authorization=`Bearer ${a}`),s(await fetch(`${o.VIDOR_AI_BASE}/api/task/volcengine/seedance1.5/img2video`,{method:"POST",headers:r,body:t}))}},l={getFriendLinkList:async()=>s(await fetch(`${o.VIDOR_AI_BASE}/api/cms/friendLinkList`,{method:"GET",headers:i(!1)})),trackBlogClick:async e=>s(await fetch(`${o.VIDOR_AI_BASE}/api/cms/statistics?url=${encodeURIComponent(e)}`,{method:"GET",headers:i(!1)}))},d={uploadImage:async e=>{let t=new FormData;t.append("file",e);let a=localStorage.getItem("access_token"),r={"x-appid":o.APP_ID};return a&&(r.Authorization=`Bearer ${a}`),s(await fetch(`${o.VIDOR_AI_BASE}/api/common/upload`,{method:"POST",headers:r,body:t}))},generateVideo:async e=>s(await fetch(`${o.VIDOR_AI_BASE}/api/task/wp/kling-v3/motion`,{method:"POST",headers:i(),body:JSON.stringify({is_std:e.is_std,image_url:e.image_url,video_url:e.video_url,duration:Math.max(3,Math.min(20,Math.ceil(e.duration))),prompt:e.prompt,character_orientation:e.character_orientation,keep_original_sound:e.keep_original_sound??!0,negative_prompt:""})})),getTaskResult:async e=>s(await fetch(`${o.VIDOR_AI_BASE}/api/task/wp/kling-v3/motion/check?task_id=${encodeURIComponent(e)}`,{method:"GET",headers:i()})),pollTaskStatus:async e=>new Promise((t,a)=>{let r=async()=>{try{let o=await d.getTaskResult(e);if(200!==o.code)return void a(Error(o.msg||"Task check failed."));let i=o.data;1===i.status?t(i):-1===i.status?a(Error(i.status_msg||"Video generation failed.")):setTimeout(r,2e3)}catch(e){a(e)}};r()})},c={auth:{syncUser:async e=>{let t=await fetch(`${o.VIDOR_AI_BASE}/api/user/loginAuth`,{method:"POST",headers:i(!1),body:JSON.stringify(e)}),a=await s(t);return 200===a.code&&a.data&&(localStorage.setItem("access_token",a.data.access_token),localStorage.setItem("refresh_token",a.data.refresh_token),localStorage.setItem("token_expire_at",a.data.expire_at.toString())),a},isTokenValid:()=>{let e=localStorage.getItem("access_token"),t=localStorage.getItem("token_expire_at");if(!e||!t)return!1;let a=Math.floor(Date.now()/1e3);return parseInt(t)>a},clearTokens:()=>{localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token"),localStorage.removeItem("token_expire_at")}},user:{getUserInfo:async()=>s(await fetch(`${o.VIDOR_AI_BASE}/api/user/info`,{headers:i()})),getUserOpusList:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30;return s(await fetch(`${o.VIDOR_AI_BASE}/api/user/opus_list?page=${e}&page_size=${t}`,{method:"GET",headers:i()}))},getTimesLog:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return s(await fetch(`${o.VIDOR_AI_BASE}/api/user/times_log?page=${e}&page_size=${t}`,{method:"GET",headers:i()}))},getPayLog:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return s(await fetch(`${o.VIDOR_AI_BASE}/api/user/pay_log?page=${e}&page_size=${t}`,{method:"GET",headers:i()}))},deleteOpus:async e=>s(await fetch(`${o.VIDOR_AI_BASE}
1/api/opus/delete`,{method:"POST",headers:i(),body:JSON.stringify({opus_id:e})})),getPromotionLink:async()=>s(await fetch(`${o.VIDOR_AI_BASE}/api/user/promotion_link`,{method:"GET",headers:i()})),getPromotionStatistics:async()=>s(await fetch(`${o.VIDOR_AI_BASE}/api/user/promotion_statistics`,{method:"GET",headers:i()})),getPromotionScoreLog:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,a=arguments.length>2?arguments[2]:void 0,r=`${o.VIDOR_AI_BASE}/api/user/promotion_score_log?page=${e}&page_size=${t}`;return void 0!==a&&(r+=`&status=${a}`),s(await fetch(r,{method:"GET",headers:i()}))},getPromotionUsers:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return s(await fetch(`${o.VIDOR_AI_BASE}/api/user/promotion_users?page=${e}&page_size=${t}`,{method:"GET",headers:i()}))},closeAccount:async()=>s(await fetch(`${o.VIDOR_AI_BASE}/api/user/close_account`,{method:"POST",headers:i()}))},payment:{createPaypalSession:async e=>s(await fetch(`${o.VIDOR_AI_BASE}/api/pay/stripe`,{method:"POST",headers:i(),body:JSON.stringify({price_id:e})})),getSubscriptions:async()=>s(await fetch(`${o.VIDOR_AI_BASE}/api/pay/subscriptions`,{method:"GET",headers:i()})),getPayLog:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return s(await fetch(`${o.VIDOR_AI_BASE}/api/user/pay_log?page=${e}&page_size=${t}`,{method:"GET",headers:i()}))},cancelSubscription:async e=>s(await fetch(`${o.VIDOR_AI_BASE}/api/pay/subscription/cancel`,{method:"POST",headers:i(),body:JSON.stringify({id:e})})),createInvoice:async e=>s(await fetch(`${o.VIDOR_AI_BASE}/api/pay/create_invoice`,{method:"POST",headers:i(),body:JSON.stringify(e)}))},website:{getConfig:async()=>s(await fetch(`${o.VIDOR_AI_BASE}/api/website/config`,{method:"GET",headers:i(!1)})),getOpenOpusList:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return s(await fetch(`${o.VIDOR_AI_BASE}/api/website/open/opus_list?page=${e}&page_size=${t}`,{method:"GET",headers:i(!1)}))}},cms:l,video:n,gen:d,withRetry:async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;for(let r=0;r<t;r++)try{if(!localStorage.getItem("access_token")){await new Promise(e=>setTimeout(e,a));continue}return await e()}catch(e){if(console.error(`API call failed (attempt ${r+1}/${t}):`,e),r===t-1)throw e;await new Promise(e=>setTimeout(e,a))}throw Error("API call failed after maximum retries")}}},32165:(e,t,a)=>{"use strict";a.d(t,{ToastProvider:()=>l,d:()=>d});var r=a(95155),o=a(12115),i=a(54416);let s=e=>{let{message:t,type:a,onClose:s}=e;return(0,o.useEffect)(()=>{let e=setTimeout(()=>{s()},5e3);return()=>clearTimeout(e)},[s]),(0,r.jsxs)("div",{className:`fixed right-4 top-4 z-50 mb-4 flex items-center rounded-[20px] border-l-4 p-4 shadow-md ${"success"===a?"bg-green-100 border-green-500":"error"===a?"bg-red-100 border-red-500":"bg-card border-ring"}`,role:"alert",children:[(0,r.jsx)("div",{className:`text-sm font-medium ${"success"===a?"text-green-800":"error"===a?"text-red-800":"text-foreground"}`,children:t}),(0,r.jsx)("button",{type:"button",className:`ml-auto -mx-1.5 -my-1.5 ${"success"===a?"text-green-500":"error"===a?"text-red-500":"text-ring"} rounded-lg p-1.5 hover:opacity-75 inline-flex items-center justify-center h-8 w-8`,onClick:s,children:(0,r.jsx)(i.A,{size:16})})]})},n=(0,o.createContext)(void 0),l=e=>{let{children:t}=e,[a,i]=(0,o.useState)({show:!1,message:"",type:"info"}),l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info";i({show:!0,message:e,type:t})};return(0,r.jsxs)(n.Provider,{value:{showToast:l,success:e=>{l(e,"success")},error:e=>{console.error("Error:",e),l(e,"error")},info:e=>{l(e,"info")}},children:[t,a.show&&(0,r.jsx)(s,{message:a.message,type:a.type,onClose:()=>{i(e=>({...e,show:!1}))}})]})},d=()=>{let e=(0,o.useContext)(n);if(void 0===e)throw Error("useToast must be used within a ToastProvider");return e}},53999:(e,t,a)=>{"use strict";a.d(t,{cn:()=>i});var r=a(52596),o=a(39688);function i(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,o.QP)((0,r.$)(t))}},62099:(e,t,a)=>{"use strict";a.d(t,{UserProvider:()=>x,useUserInfo:()=>b});var r=a(95155),o=a(12115),i=a(61976),s=a(27016),n=a(31886),l=a(32165),d=a(10238),c=a(54416);let u=e=>{let{count:t,onClose:a}=e;return(0,o.useEffect)(()=>{let e=setTimeout(()=>{a()},1e4);return()=>clearTimeout(e)},[a]),(0,r.jsx)("div",{className:"fixed top-4 right-4 z-[80]",children:(0,r.jsxs)("div",{className:"relative flex min-w-[280px] max-w-[360px] items-start gap-3 rounded-[20px] border border-border bg-card px-4 py-3 shadow-md",children:[(0,r.jsx)("div",{className:"absolute inset-x-6 -top-[1px] h-[2px] rounded-full bg-ring"}),(0,r.jsx)("div",{className:"mt-1 flex h-8 w-8 items-center justify-center rounded-full bg-secondary text-ring",children:(0,r.jsx)(d.A,{className:"h-5 w-5"})}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsxs)("div",{className:"text-sm font-semibold text-foreground",children:[t," trial vouchers for you."]}),(0,r.jsx)("div",{className:"mt-1 text-xs leading-snug text-muted-foreground",children:"You can use these vouchers to try out any model you wish."})]}),(0,r.jsx)("button",{type:"button",onClick:a,"aria-label":"Close voucher toast",className:"mt-1 ml-2 inline-flex h-7 w-7 items-center justify-center rounded-full bg-muted text-muted-foreground transition-colors hover:bg-primary hover:text-primary-foreground",children:(0,r.jsx)(c.A,{className:"h-4 w-4"})})]})})},m=(0,o.createContext)(void 0),p={},h="pending_ivcode",f=e=>{try{localStorage.setItem(h,e)}catch(e){console.error("UserProvider: Failed to save ivcode to cache:",e)}},g=()=>{try{return localStorage.getItem(h)}catch(e){return console.error("UserProvider: Failed to get ivcode from cache:",e),null}},v=()=>{try{localStorage.removeItem(h)}catch(e){console.error("UserProvider: Failed to clear ivcode cache:",e)}};function x(e){let{children:t}=e,{user:a,isSignedIn:d}=(0,i.Jd)(),{getToken:c}=(0,s.d)(),{signOut:h}=(0,i.ho)(),[x,b]=(0,o.useState)(null),[y,w]=(0,o.useState)(!1),[k,j]=(0,o.useState)(0),[_,A]=(0,o.useState)(!1),N=(0,o.useRef)(!1),{error:I}=(0,l.d)();(0,o.useEffect)(()=>{try{let e=new URLSearchParams(window.location.search),t=e.get("i")||e.get("ivcode");t&&f(t)}catch(e){console.error("UserProvider: Failed to check URL params:",e)}},[]);let S=async()=>{var e,t;
1if(!d||!(null==a?void 0:a.id)||!(null==a||null==(e=a.primaryEmailAddress)?void 0:e.emailAddress))return;let r=a.id;if(!p[r]){p[r]=!0;try{let e=null;try{e=await c()}catch(e){console.error("获取 Clerk Token 失败,清除登录状态:",e),delete p[r],b(null),I("Failed to get user token, please sign in again");try{await h()}catch(e){console.error("UserProvider: 清除登录状态失败:",e)}return}if(!e){console.warn("Clerk Token 为空,清除登录状态"),delete p[r],b(null),n.FH.auth.clearTokens(),I("User token is empty, please sign in again");try{await h()}catch(e){console.error("UserProvider: 清除登录状态失败:",e)}return}let o=g();if(!o)try{let e=new URLSearchParams(window.location.search);(o=e.get("i")||e.get("ivcode"))&&f(o)}catch(e){console.error("UserProvider: Failed to get ivcode from URL:",e)}let i={uuid:r,email:a.primaryEmailAddress.emailAddress,nickname:a.fullName||void 0,avatar:a.imageUrl||void 0,from_login:"google",token:e,ivcode:o||void 0},s=await n.FH.auth.syncUser(i);if(!s||200!==s.code)throw Error(`Sync failed: ${(null==s?void 0:s.message)||(null==s?void 0:s.msg)||"Unknown error"}`);if(!(null==(t=s.data)?void 0:t.access_token))throw Error("Sync succeeded but no access_token received");o&&v(),await F(!0)}catch(t){let e=t instanceof Error?t.message:String(t);console.error("UserProvider: 用户数据同步失败,清除登录状态",{error:e,userId:r,email:a.primaryEmailAddress.emailAddress,timestamp:new Date().toISOString()}),delete p[r],b(null),n.FH.auth.clearTokens(),I(`Failed to sync user data, please sign in again: ${e}`);try{await h()}catch(e){console.error("UserProvider: 清除登录状态失败:",e)}return}}},F=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!d||!(null==a?void 0:a.id))return void b(null);if(n.FH.auth.isTokenValid()){e&&w(!0);try{let e=await n.FH.user.getUserInfo();if(200===e.code&&e.data){let t="number"==typeof e.data.free_times?e.data.free_times:0,a={uuid:e.data.uuid,email:e.data.email,from_login:e.data.from_login,nickname:e.data.nickname,avatar:e.data.avatar,free_limit:e.data.free_limit,remaining_limit:e.data.remaining_limit,total_limit:e.data.total_limit,use_limit:e.data.use_limit,vip_last_time:e.data.vip_last_time,level:e.data.level,created_at:e.data.created_at,updated_at:e.data.updated_at,status:e.data.status,id:e.data.id,total_credits:e.data.free_limit+e.data.remaining_limit,free_times:t};b(a);let r=a.free_times>0;a.level<=0&&r&&!N.current&&(j(a.free_times),A(!0),N.current=!0)}else console.warn("User info API returned success code but no data for:",a.id),b(null)}catch(t){console.error("Failed to fetch user info:",t),b(null),e&&I(t instanceof Error?t.message:"Failed to fetch user info")}finally{e&&w(!1)}}},T=async()=>{await F(!0)};(0,o.useEffect)(()=>{d&&(null==a?void 0:a.id)?(b(null),N.current=!1,S()):(b(null),(null==a?void 0:a.id)&&delete p[a.id])},[d,null==a?void 0:a.id]),(0,o.useEffect)(()=>{if(!d||!(null==a?void 0:a.id))return;let e=setInterval(()=>{n.FH.auth.isTokenValid()&&F(!1)},3e4);return()=>clearInterval(e)},[d,null==a?void 0:a.id]);let P={userInfo:x,isLoadingUserInfo:y,refreshUserInfo:T,clearUserState:(0,o.useCallback)(()=>{try{n.FH.auth.clearTokens()}catch(e){console.warn("clearUserState: failed to clear tokens")}b(null),(null==a?void 0:a.id)&&delete p[a.id]},[null==a?void 0:a.id])};return(0,r.jsxs)(m.Provider,{value:P,children:[t,_&&(0,r.jsx)(u,{count:k,onClose:()=>A(!1)})]})}function b(){let e=(0,o.useContext)(m);if(void 0===e)throw Error("useUserInfo must be used within a UserProvider");return e}},72367:(e,t,a)=>{"use strict";a.d(t,{P:()=>r.useUserInfo});var r=a(62099)},78080:(e,t,a)=>{"use strict";a.d(t,{AuthModalProvider:()=>d,X:()=>c});var r=a(95155),o=a(12115),i=a(61976);let s="__auth_modal_sign_in_trigger",n="__auth_modal_sign_up_trigger",l=(0,o.createContext)({openAuthModal:()=>{},closeAuthModal:()=>{}});function d(e){let{children:t}=e,a=(0,o.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signin";requestAnimationFrame(()=>{var t;let a="signup"===e?n:s;null==(t=document.getElementById(a))||t.click()})},[]),d=(0,o.useCallback)(()=>{},[]),c=(0,o.useMemo)(()=>({openAuthModal:a,closeAuthModal:d}),[a,d]);return(0,r.jsxs)(l.Provider,{value:c,children:[t,(0,r.jsxs)("div",{className:"fixed left-0 top-0 -z-[1] h-px w-px overflow-hidden opacity-0","aria-hidden":!0,
1children:[(0,r.jsx)(i.hZ,{mode:"modal",children:(0,r.jsx)("button",{id:s,type:"button",tabIndex:-1,className:"sr-only",children:"Sign in"})}),(0,r.jsx)(i.Ny,{mode:"modal",children:(0,r.jsx)("button",{id:n,type:"button",tabIndex:-1,className:"sr-only",children:"Sign up"})})]})]})}function c(){return(0,o.useContext)(l)}},86266:(e,t,a)=>{"use strict";a.d(t,{AiDanceVideoGallery:()=>h});var r=a(95155),o=a(85690),i=a(5196),s=a(51976),n=a(71366),l=a(75684),d=a(92657),c=a(12115);let u=["aspect-square","aspect-[3/5]","aspect-[16/9]","aspect-[3/5]","aspect-[3/5]","aspect-[3/5]","aspect-[3/5]"],m=["aspect-[4/5]","aspect-[9/16]","aspect-square","aspect-[3/4]","aspect-[9/16]","aspect-[4/5]","aspect-square","aspect-[3/5]"];function p(e,t){var a;let r="string"==typeof e?e:e.video;if(!r)return null;let o=(null==(a=r.split("/").pop())?void 0:a.replace(/\.[^.]+$/,""))||String(t+1);return{title:"string"==typeof e?`AI dance video ${o}`:e.title||`AI dance video ${o}`,video:r,poster:"string"==typeof e?void 0:e.poster,likes:"string"==typeof e?void 0:e.likes,comments:"string"==typeof e?void 0:e.comments,platform:"string"==typeof e?void 0:e.platform,views:"string"==typeof e?void 0:e.views}}function h(e){let{feedUrl:t="/api/ai-dance-videos",variant:a="standard",videos:o,selectedVideo:i,onSelectTemplate:s}=e,[n,l]=(0,c.useState)([]),[d,h]=(0,c.useState)(!o),[g,v]=(0,c.useState)(!1),x="template-grid"===a?["aspect-[9/16]"]:"masonry"===a?m:u,b=o?o.slice(0,20).map(p).filter(e=>null!==e):n;return((0,c.useEffect)(()=>{if(o)return;let e=new AbortController;return async function(){try{let a=await fetch(t,{cache:"no-store",signal:e.signal});if(!a.ok)throw Error(`Video feed returned ${a.status}`);let r=await a.json(),o=Array.isArray(r)?{videos:r}:r,i=Array.isArray(o.videos)?o.videos:[],s=Math.min(Math.max(o.maxItems||20,1),20),n="newest-first"===o.order?i.slice(0,s):i.slice(-s).reverse();l(n.map(p).filter(e=>null!==e)),v(!1)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;v(!0)}finally{e.signal.aborted||h(!1)}}(),()=>e.abort()},[t,o]),d)?(0,r.jsx)("div",{className:"template-grid"===a?"grid grid-cols-1 gap-0 overflow-hidden rounded-[20px] sm:grid-cols-2 lg:grid-cols-4":"columns-1 gap-4 sm:columns-2 lg:columns-3","aria-label":"Loading AI dance videos",children:Array.from({length:"template-grid"===a?8:6},(e,t)=>(0,r.jsx)("div",{className:`${"template-grid"===a?"":"mb-4 break-inside-avoid rounded-[20px]"} animate-pulse bg-[#E9E5FF] ${x[t%x.length]}`},t))}):g?(0,r.jsx)("div",{className:"rounded-[20px] border border-[#241c4c]/10 bg-[#F7F7FB] px-6 py-10 text-center text-sm text-[#6D687A]",children:"template-grid"===a?"Dance templates are temporarily unavailable. Please try again later.":"Video examples are temporarily unavailable. Please try again later."}):0===b.length?null:(0,r.jsx)("div",{className:"template-grid"===a?"grid grid-cols-1 gap-0 overflow-hidden rounded-[20px] border border-[#241c4c]/10 shadow-[0_16px_38px_rgba(35,27,74,.10)] sm:grid-cols-2 lg:grid-cols-4":"columns-1 gap-4 sm:columns-2 lg:columns-3",children:b.map((e,t)=>(0,r.jsx)(f,{item:e,aspectClass:x[t%x.length],isGridItem:"template-grid"===a,contentType:"template-grid"===a?"":"AI dance video example",isSelected:i===e.video,onSelectTemplate:s},e.video))})}function f(e){let{item:t,aspectClass:a,isGridItem:u,contentType:m,isSelected:p,onSelectTemplate:h}=e,f=(0,c.useRef)(null),[g,v]=(0,c.useState)(!1),[x,b]=(0,c.useState)(!1);(0,c.useEffect)(()=>{let e=f.current;e&&g&&x&&(e.muted=!0,e.play().catch(()=>b(!1)))},[g,x]);let y=()=>{v(!0),b(!0)},w=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=f.current;null==t||t.pause(),t&&e&&(t.currentTime=0),b(!1)};return(0,r.jsxs)("figure",{className:`group relative overflow-hidden bg-[#17151F] ${u?"":"mb-4 break-inside-avoid rounded-[20px] border border-[#241c4c]/10 shadow-[0_16px_38px_rgba(35,27,74,.10)]"} ${a}`,children:[(0,r.jsxs)("button",{type:"button",onMouseEnter:y,onMouseLeave:()=>w(!0),onFocus:()=>v(!0),onClick:()=>{x?w():y()},"aria-label":`${x?"Pause":"Play"} ${t.title}${m?` ${m}`:""}`,className:"absolute inset-0 h-full w-full cursor-pointer focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-inset focus-visible:ring-[#563BFF]",children:[(0,r.jsx)("video",{ref:f,src:g?t.video:void 0,poster:t.poster,"aria-hidden":"true",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-[1.015]",muted:!0,loop:!0,playsInl
1ine:!0,preload:"none"}),(0,r.jsx)("span",{className:`pointer-events-none absolute inset-0 flex items-center justify-center bg-black/10 transition-opacity duration-200 ${x?"opacity-0":"opacity-100"}`,children:(0,r.jsx)("span",{className:"flex h-11 w-11 items-center justify-center rounded-full border border-white/35 bg-black/25 text-white backdrop-blur-md",children:(0,r.jsx)(o.A,{className:"ml-0.5 h-5 w-5 fill-current","aria-hidden":"true"})})})]}),u&&h&&(0,r.jsx)("button",{type:"button",onClick:()=>h(t),"aria-pressed":p,className:`absolute left-3 right-3 top-3 z-10 inline-flex min-h-10 items-center justify-center gap-2 rounded-full bg-[#F0EEFF] px-4 text-sm font-semibold text-[#3220B8] shadow-[0_10px_26px_rgba(23,21,31,.20)] transition-[opacity,transform,background-color] duration-200 hover:bg-white active:scale-[.98] focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-white/70 ${p?"opacity-100":"md:-translate-y-1 md:opacity-0 md:group-hover:translate-y-0 md:group-hover:opacity-100 md:group-focus-within:translate-y-0 md:group-focus-within:opacity-100"}`,children:p?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.A,{className:"h-4 w-4","aria-hidden":"true"}),"Added to creator"]}):"Use this template"}),u&&(t.likes||t.comments||t.platform||t.views)&&(0,r.jsxs)("figcaption",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-[5] bg-gradient-to-t from-[#17151F] via-[#17151F]/80 to-transparent px-4 pb-4 pt-14 text-white",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4 text-xs font-medium text-white/90",children:[t.likes&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,r.jsx)(s.A,{className:"h-4 w-4","aria-hidden":"true"}),t.likes]}),t.comments&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,r.jsx)(n.A,{className:"h-4 w-4","aria-hidden":"true"}),t.comments]})]}),(0,r.jsxs)("div",{className:"mt-2.5 flex items-center justify-between gap-3 border-t border-white/20 pt-2.5 text-xs font-semibold",children:[t.platform&&(0,r.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5 truncate",children:[(0,r.jsx)(l.A,{className:"h-4 w-4 shrink-0 text-[#B7A8FF]","aria-hidden":"true"}),t.platform]}),t.views&&(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1.5",children:[(0,r.jsx)(d.A,{className:"h-4 w-4","aria-hidden":"true"}),t.views]})]})]})]})}},88145:(e,t,a)=>{"use strict";a.d(t,{E:()=>n});var r=a(95155);a(12115);var o=a(74466),i=a(53999);let s=(0,o.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function n(e){let{className:t,variant:a,...o}=e;return(0,r.jsx)("div",{className:(0,i.cn)(s({variant:a}),t),...o})}},88156:(e,t,a)=>{Promise.resolve().then(a.bind(a,86266)),Promise.resolve().then(a.bind(a,3762)),Promise.resolve().then(a.t.bind(a,6874,23)),Promise.resolve().then(a.t.bind(a,33063,23))},94826:(e,t,a)=>{"use strict";a.d(t,{CQ:()=>n,DR:()=>i,Ht:()=>
1o,Ty:()=>s});let r={contact:{supportEmail:"[email protected]"},canonical:{url:"https://viraldancemaker.com"},api:{baseUrl:"https://svc.viraldancemaker.com",appId:"viraldancevideomaker"},seo:{staticPages:["/","/ai-dance-video-generator","/viral-dance-video-templates","/photo-to-dance-video","/make-photo-dance","/tiktok-dance-video-maker","/pricing","/terms","/privacy","/refund"]},pageTdk:{"/":{title:"Viral Dance Video Maker - Turn Photos into AI Dance Videos",description:"Make viral dance videos with AI. Upload a photo, choose a trending dance template, and create TikTok, Reels, or Shorts-ready dance videos in minutes.",keywords:["viral dance video maker","AI dance video generator","photo to dance video","make photo dance","TikTok dance video maker","viral dance video templates","AI dance video maker","turn photo into dance video","make a picture dance","dance video generator AI","TikTok AI dance generator","Instagram Reels dance video maker","YouTube Shorts dance video maker","trending dance video templates","AI dance template","dance motion transfer AI"]},"/ai-dance-video-generator":{title:"AI Dance Video Generator - Make Photos and Characters Dance",description:"Compare AI dance video controls, motion references, output quality, and character support for creator, mascot, and animated dance clips.",keywords:["AI dance video generator","AI dance controls","character dance video","mascot dance video","dance motion transfer AI"]},"/viral-dance-video-templates":{title:"Viral Dance Video Templates - AI for TikTok & Reels",description:"Explore viral dance video templates for AI dance videos. Pick a trending dance, upload a photo, and make short videos for TikTok, Reels, and Shorts.",keywords:["viral dance video templates","TikTok dance templates","AI dance templates","trending dance video templates","photo to dance video"]},"/photo-to-dance-video":{title:"Photo to Dance Video - Turn Any Photo into an AI Dance",description:"Learn how photo-to-dance conversion works, match a photo to reference motion, diagnose weak inputs, and create a clearer AI dance video.",keywords:["photo to dance video","turn photo into dance video","photo to dance matching","photo dance video troubleshooting","AI photo dance video","dance motion transfer AI"]},"/make-photo-dance":{title:"Make a Photo Dance with AI - Easy Photo Dance Video Maker",description:"Make a photo dance with a beginner-friendly AI workflow. Try simple moves and create playful dancing photos for memes, characters, or social posts.",keywords:["make photo dance","make a photo dance","make picture dance","easy photo dance maker","funny dancing photo","photo dance video maker"]},"/tiktok-dance-video-maker":{title:"TikTok Dance Video Maker - Create AI Dance Videos",description:"Create TikTok dance videos with AI. Upload an authorized photo, choose a dance template, and prepare a vertical video for TikTok, Reels, or Shorts.",keywords:["TikTok dance video maker","TikTok AI dance generator","AI TikTok dance video","TikTok dance template","vertical dance video maker"]},"/payment-failed":{title:"Payment Failed",description:"Your payment could not be completed. Please try again or contact support.",keywords:["payment failed","checkout error"]},"/payment-success":{title:"Payment Successful",description:"Your payment was successful. Your credits have been added to your account.",keywords:["payment success","purchase complete"]},"/referral":{title:"Referral Program",description:"Share your referral link and earn credits when friends join. Invite friends and earn rewards.",keywords:["referral program","earn credits","invite friends"]},"/pricing":{title:"AI Dance Video Generator Pricing & Credit Packs",description:"Compare AI dance video generator pricing and one-time AI video credits. Choose the right dance video maker pricing pack for Standard or Pro generation.",keywords:["AI dance video generator pricing","dance video maker pricing","AI video credits","AI dance video credit packs","one-time video credits"]},"/terms":{title:"Terms of Service | Viral Dance Video Maker",description:"Review the rules for accounts, one-time credits, authorized uploads, AI dance video outputs, commercial use, safety, and service access.",keywords:["terms of service","AI video terms","user agreement"]},"/privacy":{title:"Privacy Policy | Viral Dance Video Maker",description:"Learn how account data, uploaded photos, reference videos, generated content, payments, analytics, and privacy requests are handled.",keywords:["privacy policy","AI video privacy","data protection"]},"/refund":{title:"Refund Policy | Viral Dance Video Maker",description:"See refund eligibility for one-time credit packs, the 7-day request window, partial-refund calculations, and payment issue support.",keywords:["refund policy","credit pack refund","payment refund"]},"/blog":{title:"Blog",description:"Read the latest posts, product updates, tutorials, and company news.",keywords:["blog","updates","tutorials","news"]}},pricing:{oneTimePlans:[{key:"Starter",priceId:"price_1Tyn0VRo6rWdZuVs0AScngGr",popular:!1,title:"Starter",price:"$13.9",priceAmount:13.9,buttonText:"Get 140 Credits",features:["140 credits included","Create photo-to-dance videos with a character image and reference dance video","720p export, No watermark download","Keep original reference audio","Commercial use for authorized media","Standard queue speed","Email support"]},{key:"Plus",priceId:"price_1Tyn10Ro6rWdZuVsXupSmvkP",popular:!0,title:"Plus",price:"$49.9",priceAmount:49.9,buttonText:"Get 600 Credits",features:["600 credits included","Generate more photo-to-dance variations with the same tw
1o-input workflow","Character image and reference dance video motion transfer","1080p export, No watermark download","Keep original reference audio","Commercial use for authorized media","Faster priority queue + up to 5 concurrent jobs","Priority support"]},{key:"Professional",priceId:"price_1Tyn1BRo6rWdZuVsbj6uBXaY",popular:!1,title:"Professional",price:"$99.9",priceAmount:99.9,buttonText:"Get 1250 Credits",features:["1250 credits included","High-volume AI dance video generation for creators and teams","Character image and reference dance video motion transfer","1080p export, No watermark download","Keep original reference audio","Commercial use for authorized media","Fastest queue + up to 10 concurrent jobs","Full effects pack + early access to new features","24/7 priority support","Bulk processing","API access (coming soon)"]}]}},o=r.contact,i=r.api;r.seo;let s=r.pricing;r.canonical.url;let n={name:"Viral Dance Video Maker",description:"Turn authorized photos into short AI dance videos with trending templates for TikTok, Reels, and Shorts."};r.pageTdk,r.seo.staticPages},97168:(e,t,a)=>{"use strict";a.d(t,{$:()=>d,r:()=>l});var r=a(95155),o=a(12115),i=a(99708),s=a(74466),n=a(53999);let l=(0,s.F)("inline-flex items-center justify-center whitespace-nowrap rounded-full text-sm font-medium tracking-[-0.14px] ring-offset-background transition-[background,color,transform] active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"border border-primary bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-transparent bg-secondary text-secondary-foreground hover:bg-accent",secondary:"border border-transparent bg-secondary text-secondary-foreground hover:bg-accent",ghost:"hover:bg-secondary hover:text-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-11 px-4 py-2.5",sm:"h-9 px-3.5",lg:"h-12 px-5",icon:"h-10 w-10 rounded-full"}},defaultVariants:{variant:"default",size:"default"}}),d=o.forwardRef((e,t)=>{let{className:a,variant:o,size:s,asChild:d=!1,...c}=e,u=d?i.DX:"button";return(0,r.jsx)(u,{className:(0,n.cn)(l({variant:o,size:s,className:a})),ref:t,...c})});d.displayName="Button"},99840:(e,t,a)=>{"use strict";a.d(t,{Cf:()=>u,L3:()=>p,c7:()=>m,lG:()=>n,rr:()=>h,zM:()=>l});var r=a(95155);a(12115);var o=a(40175),i=a(54416),s=a(53999);function n(e){let{...t}=e;return(0,r.jsx)(o.bL,{"data-slot":"dialog",...t})}function l(e){let{...t}=e;return(0,r.jsx)(o.l9,{"data-slot":"dialog-trigger",...t})}function d(e){let{...t}=e;return(0,r.jsx)(o.ZL,{"data-slot":"dialog-portal",...t})}function c(e){let{className:t,...a}=e;return(0,r.jsx)(o.hJ,{"data-slot":"dialog-overlay",className:(0,s.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function u(e){let{className:t,children:a,...n}=e;return(0,r.jsxs)(d,{"data-slot":"dialog-portal",children:[(0,r.jsx)(c,{}),(0,r.jsxs)(o.UC,{"data-slot":"dialog-content",className:(0,s.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...n,children:[a,(0,r.jsxs)(o.bm,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,r.jsx)(i.A,{}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function m(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"dialog-header",className:(0,s.cn)("flex flex-col gap-2 text-center sm:text-left",t),...a})}function p(e){let{className:t,...a}=e;return(0,r.jsx)(o.hE,{"data-slot":"dialog-title",className:(0,s.cn)("text-lg leading-none font-semibold",t),...a})}function h(e){let{className:t,...a}=e;return(0,r.jsx)(o.VY,{"data-slot":"dialog-description",className:(0,s.cn)("text-muted-foreground text-sm",t),...a})}}},e=>{var t=t=>e(e.s=t);e.O(0,[6,628,315,358],()=>t(88156)),_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.