1import{e as _n,S as mn,a as L,b as R,r as U,j as fn,w as F,o as hn,l as Cn,M as m,P as c,N as o,R as v,u as f,F as q,X as G,U as H,Q as y,m as wn,Y as Q,A as X}from"./vendor-vue-BX5H9cWS.js";import{u as yn}from"./wavesurfer.esm-jwuNJ03F.js";import{i as kn,e as An,f as k,aB as bn,e$ as h,d as zn}from"./index-DsiSMK2M.js";const $n={class:"card-voice-clone"},jn={class:"vc-inner"},On={class:"vc-header"},Sn={class:"vc-title original-col"},Wn={class:"vc-title clone-col"},Vn={class:"vc-pairs-content"},Nn=["onClick"],In={class:"mobile-label"},Pn={class:"original-card-inner"},Tn={class:"original-play-btn"},Bn=["id"],Dn=["onClick"],Mn={class:"mobile-label"},En={class:"clone-card-inner"},Ln={class:"clone-content"},Rn={class:"clone-top-row"},Un={class:"clone-play-icon"},Fn={class:"clone-name"},qn={class:"clone-tags-wrapper"},Gn=["onScroll"],Hn={class:"vc-footer"},Qn=_n({name:"LandingDemoDemoCardVoiceClone",__name:"DemoCardVoiceClone",setup(Xn){const t=n=>`${window.location.origin}/resource/img/tts/${n}`,Y=t("landing_en1_original.mp3"),J=t("landing_en1_voice_clone.wav"),K=t("landing_en2_original.mp3"),Z=t("landing_en2_voice_clone.wav"),x=t("landing_zh1_original.mp3"),nn=t("landing_zh1_voice_clone.wav"),en=t("landing_zh2_original.mp3"),on=t("landing_zh2_voice_clone.wav"),an=t("landing_ja1_original.mp3"),sn=t("landing_ja1_voice_clone.wav"),ln=t("landing_ja2_original.mp3"),tn=t("landing_ja2_voice_clone.wav"),{t:u}=kn.global,cn=mn(),$=An(),j=L(()=>$.user.preferences.lang||"en"),O={en:[{originalAudio:Y,cloneAudio:J},{originalAudio:K,cloneAudio:Z}],zh:[{originalAudio:x,cloneAudio:nn},{originalAudio:en,cloneAudio:on}],ja:[{originalAudio:an,cloneAudio:sn},{originalAudio:ln,cloneAudio:tn}]},C=L(()=>{const n=j.value.startsWith("zh")?"zh":j.value.startsWith("ja")?"ja":"en",e=[0,1].map(a=>({cloneName:u(`landing.landing.demo.voiceClone.voice${a}CloneName`),tags:u(`landing.landing.demo.voiceClone.voice${a}Tags`).split(",")}));return(O[n]??O.en).map((a,_)=>({...a,cloneName:e[_].cloneName??"",tags:e[_].tags??[]}))}),l=R([{status:"none",ws:null},{status:"none",ws:null}]);function rn(n,e){const a=yn.create({container:`#waveform-vc-original-${n}`,width:"100%",height:36,autoplay:!1,waveColor:"#999",progressColor:"#FE655D",cursorColor:"#505050",cursorWidth:0,barWidth:2,barGap:2,barRadius:5});l[n].ws=a,l[n].status="loading",a.on("ready",()=>{l[n].status="pause"}),a.on("play",()=>{l[n].status="play"}),a.on("pause",()=>{l[n].status="pause"}),a.on("finish",()=>{l[n].status="pause"}),a.on("error",()=>{l[n].status="error"}),a.load(e)}function A(){l.forEach(n=>{var e;return(e=n.ws)==null?void 0:e.pause()})}function un(n){const e=l[n];if(!(!e.ws||!["pause","play"].includes(e.status))){if(e.status==="play"){h.demoVcOriginalPlay(n,"pause"),e.ws.pause();return}A(),i(),h.demoVcOriginalPlay(n,"play"),e.ws.play()}}const p=U("");let r=null;function i(){r==null||r.pause(),r=null,p.value=""}const b=fn("stopAudioSignal");F(()=>b==null?void 0:b.value,()=>{A(),i()});function dn(n){const e=`clone-${n}`,a=C.value[n];if(p.value===e){h.demoVcClonePlay(n,"pause"),i();return}i(),A(),h.demoVcClonePlay(n,"play"),p.value=e,r=new Audio(a.cloneAudio),r.play().catch(()=>{i()}),r.onended=()=>{i()},r.onerror=()=>{i()}}function gn(){h.demoVoiceCloneNav(),cn.push({name:"VoiceClone"})}const S=U([]),w=R([{left:!1,right:!1},{left:!1,right:!1}]);function vn(n,e){S.value[e]=n}function W(n){const e=S.value[n];e&&(w[n].left=e.scrollLeft>0,w[n].right=e.scrollLeft+e.clientWidth<e.scrollWidth-1)}function V(){X(()=>{C.value.forEach((n,e)=>W(e))})}let d=null,z=!1;function N(){var n;d!==null&&(z?window.clearTimeout(d):(n=window.cancelIdleCallback)==null||n.call(window,d),d=null)}function I(){N(),l.forEach(n=>{var e,a;(e=n.ws)==null||e.pause(),(a=n.ws)==null||a.destroy(),n.ws=null,n.status="none"})}function P(){X(()=>{C.value.forEach((n,e)=>rn(e,n.originalAudio))})}function pn(){N();const n=()=>{d=null,P()},e=window.requestIdleCallback;typeof e=="function"?(z=!1,d=e(n,{timeout:2e3})):(z=!0,d=window.setTimeout(n,300))}return F(()=>$.user.preferences.lang,()=>{I(),i(),P(),V()}),hn(()=>{pn(),V()}),Cn(()=>{I(),i()}),(n,e)=>{const a=bn;return c(),m("div",$n,[o("div",jn,[o("div",On,[o("span",Sn,v(f(u)("landing.landing.demo.voiceClone.headerOriginal")),1),e[0]||(e[0]=o("div",{class:"vc-header-spacer"},null,-1)),o("span",Wn,v(f(u)("landing.landing.demo.voiceClone.headerClone")),1)]),o("div",Vn,[(c(!0),m(q,null,G(C.value,(_,s)=>{var T,B,D,M,E;return c(),m("div",{class:"vc-pair",key:s}
1,[o("div",{class:H(["vc-card original-card",{playing:((T=l[s])==null?void 0:T.status)==="play"}]),onClick:g=>un(s)},[o("div",In,v(f(u)("landing.landing.demo.voiceClone.headerOriginal")),1),o("div",Pn,[o("div",Tn,[((B=l[s])==null?void 0:B.status)==="play"?(c(),y(k,{key:0,name:"play",size:"17"})):(c(),y(k,{key:1,name:"pause",size:"17"}))]),o("div",{id:`waveform-vc-original-${s}`,class:"wave-box"},[wn(a,{spinning:((D=l[s])==null?void 0:D.status)==="loading",size:"small",style:{position:"absolute",top:"calc(50% - 10px)",left:"calc(50% - 10px)"}},null,8,["spinning"])],8,Bn)])],10,Nn),e[2]||(e[2]=o("div",{class:"vc-connector-wrap"},[o("div",{class:"vc-connector"},[o("div",{class:"connector-line"})])],-1)),o("div",{class:H(["vc-card clone-card",[`clone-variant-${s}`,{playing:p.value===`clone-${s}`}]]),onClick:g=>dn(s)},[o("div",Mn,v(f(u)("landing.landing.demo.voiceClone.headerClone")),1),o("div",En,[e[1]||(e[1]=o("div",{class:"clone-gradient-bg"},null,-1)),o("div",Ln,[o("div",Rn,[o("span",Un,[p.value!==`clone-${s}`?(c(),y(k,{key:0,name:"pause",size:"17"})):(c(),y(k,{key:1,name:"play",size:"17"}))]),o("span",Fn,v(_.cloneName),1)]),o("div",qn,[o("div",{class:"clone-tags",ref_for:!0,ref:g=>vn(g,s),onScroll:g=>W(s)},[(c(!0),m(q,null,G(_.tags,g=>(c(),m("span",{class:"tag",key:g},v(g),1))),128))],40,Gn),o("div",{class:"tags-mask tags-mask-left",style:Q({opacity:(M=w[s])!=null&&M.left?1:0})},null,4),o("div",{class:"tags-mask tags-mask-right",style:Q({opacity:(E=w[s])!=null&&E.right?1:0})},null,4)])])])],10,Dn)])}),128))]),o("div",Hn,[o("button",{class:"clone-btn",onClick:gn},v(f(u)("landing.landing.demo.voiceClone.cloneBtn")),1)])])])}}}),Zn=zn(Qn,[["__scopeId","data-v-3b6e3c49"]]);export{Zn 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.