@acedatacloud/nexior 3.258.1 → 3.258.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ApiCodeButton-BnhRGoHa.js → ApiCodeButton-BGsUTaW2.js} +1 -1
- package/dist/assets/{Auth-B-tosCjG.js → Auth-B7AgEWkX.js} +1 -1
- package/dist/assets/{BotPlaceholder-CWZ-jLaQ.js → BotPlaceholder-Dohdky-5.js} +1 -1
- package/dist/assets/{Callback-DontwWN2.js → Callback-DIwygSjl.js} +1 -1
- package/dist/assets/{Console-Dn5PVkJl.js → Console-BEHv16n0.js} +1 -1
- package/dist/assets/{Consumption-D6SdJe6i.js → Consumption-DlnQDVB1.js} +1 -1
- package/dist/assets/{Conversation-B9fy6Bab.js → Conversation-L6KDKgX7.js} +3 -3
- package/dist/assets/{CopyToClipboard-BgYTcbSR.js → CopyToClipboard-tPdZVnT9.js} +1 -1
- package/dist/assets/{Detail-Bn9QvJ57.js → Detail-C97QPxOm.js} +2 -2
- package/dist/assets/{Extra-DnZEBqyP.js → Extra-DnAWPp0s.js} +1 -1
- package/dist/assets/{FilePreview-TMppMkIO.js → FilePreview-DbXfisdW.js} +1 -1
- package/dist/assets/{Hailuo-C6-ujjY-.js → Hailuo-DHvfuhCX.js} +1 -1
- package/dist/assets/{History-GdxHkt11.js → History-BsTOz2bL.js} +1 -1
- package/dist/assets/{ImagePreview-DsvWqvur.js → ImagePreview-CzkdlFEp.js} +1 -1
- package/dist/assets/{ImageWrapper-C141nOSf.js → ImageWrapper-DJFKyQ7I.js} +1 -1
- package/dist/assets/{Index-fSkBfc1b.js → Index-4i-XjlNx.js} +1 -1
- package/dist/assets/{Index-CNbRYDSI.js → Index-A69wS2Ib.js} +1 -1
- package/dist/assets/{Index-Bybx5L94.js → Index-BRWJouI7.js} +1 -1
- package/dist/assets/{Index-gK8R9kE0.js → Index-BUCNlmK1.js} +1 -1
- package/dist/assets/{Index-ov4_yeBA.js → Index-Bdctji-L.js} +1 -1
- package/dist/assets/{Index-C7DJCydU2.js → Index-BkPmDjeg2.js} +1 -1
- package/dist/assets/Index-BvQl59Kc.js +1 -0
- package/dist/assets/{Index-CxvGzwna.js → Index-C4hRbt1x.js} +1 -1
- package/dist/assets/{Index-DYvtRWcV.js → Index-CIkcoBM6.js} +1 -1
- package/dist/assets/Index-CQ-6M3T1.js +1 -0
- package/dist/assets/{Index-BHQmochW.js → Index-Cu4hE-vg.js} +1 -1
- package/dist/assets/{Index-D_FSzwkL.js → Index-D2v5KkIG.js} +1 -1
- package/dist/assets/Index-D7v78VPr2.js +1 -0
- package/dist/assets/{Index-as7TNatt.js → Index-D8Ckw6qm.js} +1 -1
- package/dist/assets/{Index-C9QZWG58.js → Index-DA5cROfW.js} +1 -1
- package/dist/assets/{Index-DuiGTD59.js → Index-DJIvtVK5.js} +1 -1
- package/dist/assets/Index-DLexgg4D.js +1 -0
- package/dist/assets/{Index-Bj3ifKj8.js → Index-DPbT4YBv.js} +1 -1
- package/dist/assets/{Index-8v1oAQ1D.js → Index-DVK9zCkz.js} +1 -1
- package/dist/assets/Index-DdyFHlFl.js +1 -0
- package/dist/assets/{Index-SxQyx_un.js → Index-DztisIZk.js} +1 -1
- package/dist/assets/{Index-D91pfQiX2.js → Index-EP7oLMvJ2.js} +1 -1
- package/dist/assets/{Index-CC17pwop.js → Index-cIBfryyr.js} +1 -1
- package/dist/assets/Index-e4tRE-ap.js +1 -0
- package/dist/assets/{Index-BjFq7tGz.js → Index-lTedMMja.js} +1 -1
- package/dist/assets/{Invitees-BPnd5apu.js → Invitees-Btc-Nh9P.js} +1 -1
- package/dist/assets/{List-Cyultaf9.js → List-1kiwYyzd.js} +1 -1
- package/dist/assets/{List-CwY8PAVX.js → List-BROQb6n7.js} +1 -1
- package/dist/assets/{List-D4L2SyYv.js → List-m1SHx7a7.js} +1 -1
- package/dist/assets/{Main-CT19Nj5m.js → Main-HgfCFXk7.js} +1 -1
- package/dist/assets/{Model-BwChK5tp.js → Model-DTz5Ytbr.js} +1 -1
- package/dist/assets/{Navigator-iq5X18Oe.js → Navigator-DOBmKpN_.js} +2 -2
- package/dist/assets/{NoTasks-BSGHQNdO.js → NoTasks-B7PhgGY7.js} +1 -1
- package/dist/assets/{NotFound-CQjSi5MH.js → NotFound-DxxLAW46.js} +1 -1
- package/dist/assets/{Pagination-Di_yqfqX.js → Pagination-CfrFLnjR.js} +1 -1
- package/dist/assets/{Pay-C7EgtKX-.js → Pay-Deei2qfK.js} +1 -1
- package/dist/assets/{Player-BIoX_RId.js → Player-Be2AB8J3.js} +1 -1
- package/dist/assets/{Status-DCZU2Iuq.js → Status-CEUEEQJP.js} +1 -1
- package/dist/assets/{Subscribe-Bg6z5EBd.js → Subscribe-BCYrEGKB.js} +1 -1
- package/dist/assets/{TabSwitcher-Ba8ZTGKR.js → TabSwitcher-CHNVhMSr.js} +1 -1
- package/dist/assets/{Tts-J5I94C_g.js → Tts-DnT_oXdv.js} +1 -1
- package/dist/assets/{VideoPlayer-BTaBgcT6.js → VideoPlayer-BGom2PRo.js} +1 -1
- package/dist/assets/{avatar-DDNa26p1.js → avatar-CcIU9U9G.js} +1 -1
- package/dist/assets/{basic-BDUBXx1c.js → basic-DD4fM-aH.js} +1 -1
- package/dist/assets/{chat-BYfphwYG.js → chat-CQrJ8TUU.js} +1 -1
- package/dist/assets/codingBridge-BFTlVNGI.js +1 -0
- package/dist/assets/{constants-Ch-akEqn.js → constants-SseKgNeZ.js} +1 -1
- package/dist/assets/{createTaskActions-BR-TQS1t.js → createTaskActions-ou5Xex5T.js} +1 -1
- package/dist/assets/{date-picker-B8OCKb8G.js → date-picker-uyIdA2TK.js} +1 -1
- package/dist/assets/{dropdown-Cbgd3uK3.js → dropdown-CmSaOeLU.js} +1 -1
- package/dist/assets/{esm-C-Hc-fqp.js → esm-CDIsYhs7.js} +1 -1
- package/dist/assets/{esm-DSZBcv02.js → esm-Cv-72KKj.js} +3 -3
- package/dist/assets/{esm-BYz85wqk.js → esm-D0opv2AD.js} +2 -2
- package/dist/assets/{esm-Bk5h-AVf.js → esm-DFjrkQxv.js} +1 -1
- package/dist/assets/{esm-Djtol7BG.js → esm-t6MrhTfu.js} +1 -1
- package/dist/assets/{fish-C9HIwHHU.js → fish-B-RjEL-W.js} +1 -1
- package/dist/assets/{flux-C_a7IaQg.js → flux-B968tStw.js} +1 -1
- package/dist/assets/{hailuo-0054u4Nf.js → hailuo-CEKgCRMn.js} +1 -1
- package/dist/assets/{headshots-CvNaz_34.js → headshots-wMOG2pd3.js} +1 -1
- package/dist/assets/{image-h59pgGu4.js → image-DH0GV7eO.js} +1 -1
- package/dist/assets/{index-Lyxum_zj.js → index-AqzIVsbo.js} +5 -5
- package/dist/assets/{index.browser.esm-HuZS-qJg.js → index.browser.esm-xJeP9TcQ.js} +1 -1
- package/dist/assets/{index.es-CRAhHJsF.js → index.es-Dcyd74ZY.js} +1 -1
- package/dist/assets/{input-number-DRiPLyxJ.js → input-number-3metTuwD.js} +1 -1
- package/dist/assets/{kling-BXdjOdn4.js → kling-Bdx5PLQZ.js} +1 -1
- package/dist/assets/{luma-BEfym1CL.js → luma-DTLgR3fY.js} +1 -1
- package/dist/assets/{midjourney-D7zquBza.js → midjourney-CwVQ5daK.js} +1 -1
- package/dist/assets/{nanobanana-1Fs2BxsU.js → nanobanana-BzvcAjQg.js} +1 -1
- package/dist/assets/{openaiimage-7jnyMvwr.js → openaiimage-DTIiR2oU.js} +1 -1
- package/dist/assets/{pagination-CtEQ0kyl.js → pagination-BE8J31gG.js} +1 -1
- package/dist/assets/{pika-Q3hPJ60M.js → pika-BUsSoZcw.js} +1 -1
- package/dist/assets/{pixverse-MKIIcA6t.js → pixverse-D9rtE2Bi.js} +1 -1
- package/dist/assets/{popover-CVWhmFil.js → popover-B-rS_vfC.js} +1 -1
- package/dist/assets/{producer-DyG2oc34.js → producer-Cs424W05.js} +1 -1
- package/dist/assets/{qrart-DArnA7t8.js → qrart-BJ78OmyN.js} +1 -1
- package/dist/assets/{seedance-CzxKsvIl.js → seedance-ChtcM4SJ.js} +1 -1
- package/dist/assets/{seedream-3wiXRyrv.js → seedream-Bm9Cc0Mb.js} +1 -1
- package/dist/assets/{select-D09DhLq3.js → select-BRZiQo0Z.js} +1 -1
- package/dist/assets/serp-Co94X_nA.js +1 -0
- package/dist/assets/{slider-Boe4ZceA.js → slider-BAI04Ufm.js} +1 -1
- package/dist/assets/{solana-wallets-CULoYHE_.js → solana-wallets-t7bBocj_.js} +2 -2
- package/dist/assets/{solana-wallets-vue-j3DbAXlX.js → solana-wallets-vue-Ck7H7K8f.js} +1 -1
- package/dist/assets/{sora-B0kKB478.js → sora-5uGqLjLY.js} +1 -1
- package/dist/assets/{suno-BGKdUwhb.js → suno-BSkVSDFr.js} +1 -1
- package/dist/assets/{switch-4rpQbrhU.js → switch-BM5fX3CU.js} +1 -1
- package/dist/assets/{veo-DditUC7C.js → veo-BWZc-Gh0.js} +1 -1
- package/dist/assets/{wan-pw2rxbi2.js → wan-U53QOXrC.js} +1 -1
- package/dist/assets/{web-D1eXn2O_.js → web-2nFuyWFb.js} +1 -1
- package/dist/assets/{web-AtDnSDka.js → web-BnUgWYPi.js} +1 -1
- package/dist/assets/{web-CURWbw5F.js → web-C_sun89O.js} +1 -1
- package/dist/assets/{web-CxYzWcYK.js → web-CwstBVbQ.js} +1 -1
- package/dist/assets/{webextrator-BasTffLK.js → webextrator-BIxZj7zS.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/Index-B-Px1u0A.js +0 -1
- package/dist/assets/Index-BaTkDdaM2.js +0 -1
- package/dist/assets/Index-CXMqNYPW.js +0 -1
- package/dist/assets/Index-C_zG3Kk-.js +0 -1
- package/dist/assets/Index-Dpf2dY_L.js +0 -1
- package/dist/assets/Index-OaDES6A6.js +0 -1
- package/dist/assets/codingBridge-ra0n7eeh.js +0 -1
- package/dist/assets/serp-uJ4gL7ia.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,Bt as t,D as n,E as r,Ht as ee,M as i,N as a,O as o,P as s,Q as c,Ut as l,X as u,et as d,k as f,lt as p,x as m}from"./vendor-chart-Df3WBvr0.js";import{t as h}from"./button-DgZFgZDr.js";import{r as g,t as _}from"./select-BRZiQo0Z.js";import{t as v}from"./upload-B8zBOx3w.js";import{t as y}from"./tooltip-C-9nDsaA.js";import{t as b}from"./image-DH0GV7eO.js";import{t as x}from"./alert-Bgv5POrX.js";import{t as S}from"./drawer-BhAAsvLB.js";import{t as C}from"./switch-BM5fX3CU.js";import{Bn as w,Fn as T,Hn as E,In as D,Ln as O,Pn as k,Rn as A,Vr as te,Wn as j,zn as M}from"./constants-SseKgNeZ.js";import{Ct as N,Dt as P,On as ne,Or as F,S as I,St as L,Tt as R,an as z,dr as B,mr as V,wt as H,xr as U}from"./index-AqzIVsbo.js";import{t as W}from"./index.es-Dcyd74ZY.js";import{t as G}from"./CopyToClipboard-tPdZVnT9.js";import{t as K}from"./ImagePreview-CzkdlFEp.js";import{t as q}from"./BotPlaceholder-Dohdky-5.js";import{i as J,n as Y,t as X}from"./pagination-BE8J31gG.js";import{n as Z,t as re}from"./NoTasks-B7PhgGY7.js";import{t as ie}from"./Consumption-DlnQDVB1.js";import{t as ae}from"./ApiCodeButton-BGsUTaW2.js";import{t as Q}from"./VideoPlayer-BGom2PRo.js";var oe=s({name:`LayoutVeo`,components:{ElDrawer:S,ElButton:h,FontAwesomeIcon:W},data(){return{drawer:!1}}}),se={class:`main flex flex-row flex-1`},ce={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},le={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ue(t,n,ee,i,o,s){let c=d(`font-awesome-icon`),l=d(`el-button`),m=d(`el-drawer`);return u(),f(`div`,se,[r(`div`,ce,[e(t.$slots,`config`,{},void 0,!0)]),r(`div`,le,[e(t.$slots,`result`,{},void 0,!0)]),a(l,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(c,{icon:`fa-solid fa-magic`})]),_:1}),a(m,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:p(()=>[e(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var de=I(oe,[[`render`,ue],[`__scopeId`,`data-v-9b26d591`]]),fe=s({name:`ModelSelector`,components:{ElSelect:g,ElOption:_},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`veo2`,label:`veo2`},{value:`veo2-fast`,label:`veo2-fast`},{value:`veo3`,label:`veo3`},{value:`veo3-fast`,label:`veo3-fast`},{value:`veo31-fast`,label:`veo31-fast`},{value:`veo31`,label:`veo31`},{value:`veo31-fast-ingredients`,label:`veo31-fast-ingredients`}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=O}}),pe={class:`field`},me={class:`title font-bold`};function he(e,t,ee,i,o,s){let h=d(`el-option`),g=d(`el-select`);return u(),f(`div`,pe,[r(`h2`,me,l(e.$t(`veo.name.model`)),1),a(g,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`veo.placeholder.select`)},{default:p(()=>[(u(!0),f(m,null,c(e.options,e=>(u(),n(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ge=I(fe,[[`render`,he],[`__scopeId`,`data-v-a59d89c9`]]),_e=s({name:`ActionSelector`,components:{ElSelect:g,ElOption:_},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)},{value:`upsample`,label:this.$t(`veo.button.actionUpsample`)},{value:`extend`,label:this.$t(`veo.button.actionExtend`)},{value:`reshoot`,label:this.$t(`veo.button.actionReshoot`)},{value:`object_insert`,label:this.$t(`veo.button.actionObjectInsert`)},{value:`object_remove`,label:this.$t(`veo.button.actionObjectRemove`)}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||=k}}),ve={class:`field`},ye={class:`title font-bold`},be={class:`float-left`};function xe(e,t,ee,i,o,s){let h=d(`el-option`),g=d(`el-select`);return u(),f(`div`,ve,[r(`h2`,ye,l(e.$t(`veo.name.action`)),1),a(g,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`veo.placeholder.select`),clearable:``},{default:p(()=>[(u(!0),f(m,null,c(e.options,e=>(u(),n(h,{key:e.value,label:e.label,value:e.value},{default:p(()=>[r(`span`,be,l(e.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Se=I(_e,[[`render`,xe],[`__scopeId`,`data-v-f4d8785c`]]),Ce=s({name:`TranslationSelector`,components:{ElSwitch:C,InfoIcon:J},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),we={class:`relative`},Te={class:`flex justify-between`},Ee={class:`flex justify-start items-center`},De={class:`text-sm font-bold`},Oe={class:`flex justify-end items-center`};function ke(e,t,n,ee,i,o){let s=d(`info-icon`),c=d(`el-switch`);return u(),f(`div`,we,[r(`div`,Te,[r(`div`,Ee,[r(`span`,De,l(e.$t(`veo.name.translation`)),1),a(s,{content:e.$t(`veo.description.translation`)},null,8,[`content`])]),r(`div`,Oe,[a(c,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`},null,8,[`modelValue`])])])])}var Ae=I(Ce,[[`render`,ke]]),je=s({name:`AspectRatioSelector`,data(){return{options:[{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=T}}),Me={class:`text-sm font-bold mb-2 block`},Ne={class:`items`},Pe=[`onClick`],Fe={class:`name`};function Ie(e,n,i,a,o,s){return u(),f(`div`,null,[r(`span`,Me,l(e.$t(`veo.name.ratio`)),1),r(`div`,Ne,[(u(!0),f(m,null,c(e.options,(n,i)=>(u(),f(`div`,{key:i,class:t({active:e.active===i,item:!0}),onClick:t=>e.value=n.value},[r(`div`,{class:t([`preview`,n.label])},[r(`div`,{class:`rect`,style:ee({width:n.width+`px`,height:n.height+`px`})},null,4)],2),r(`p`,Fe,l(n.label),1)],10,Pe))),128))])])}var Le=I(je,[[`render`,Ie],[`__scopeId`,`data-v-28c472c4`]]),Re=s({name:`VideoFromInput`,components:{VideoPlayer:Q},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.veo?.config}}}),ze={class:`relative`},Be={class:`flex mb-2`},Ve={class:`text-sm font-bold`};function He(e,t,ee,i,a,s){let c=d(`video-player`);return u(),f(`div`,ze,[r(`div`,Be,[r(`span`,Ve,l(e.$t(`veo.name.action3`)),1)]),r(`div`,null,[e.config?.video_url?(u(),n(c,{key:0,src:e.config?.video_url},null,8,[`src`])):o(``,!0)])])}var Ue=I(Re,[[`render`,He]]),We=s({name:`VideoIdInput`,components:{ElInput:F},computed:{value:{get(){return this.$store.state.veo?.config?.video_id},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,video_id:e})}}}}),Ge={class:`field`},Ke={class:`title font-bold`};function qe(e,t,n,ee,i,o){let s=d(`el-input`);return u(),f(`div`,Ge,[r(`h2`,Ke,l(e.$t(`veo.name.videoId`)),1),a(s,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,type:`text`,placeholder:e.$t(`veo.placeholder.videoId`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var Je=I(We,[[`render`,qe],[`__scopeId`,`data-v-6eba4026`]]),Ye=s({name:`StartEndImage`,components:{ElUpload:v,ElButton:h,InfoIcon:J,FontAwesomeIcon:W,ImagePreview:K},mixins:[R,N],emits:[`change`],data(){return{fileList:[],uploadUrl:V()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){U.warning(this.$t(`veo.message.uploadReferencesExceed`))},onError(){U.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Xe={class:`relative`},Ze={class:`flex justify-between`},Qe={class:`flex justify-start items-center`},$e={class:`text-sm font-bold`};function et(e,t,ee,s,c,m){let h=d(`info-icon`),g=d(`image-preview`),_=d(`font-awesome-icon`),v=d(`el-button`),y=d(`el-upload`);return u(),f(`div`,Xe,[r(`div`,Ze,[r(`div`,Qe,[r(`span`,$e,l(e.$t(`veo.name.startEndImage`)),1),a(h,{content:e.$t(`veo.description.uploadStartEndImage`)},null,8,[`content`])])]),a(y,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:p(({file:t})=>[t.url&&t.percentage!==void 0?(u(),n(g,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(v,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(_,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+l(e.$t(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var tt=I(Ye,[[`render`,et],[`__scopeId`,`data-v-f9a79b4a`]]),nt=s({name:`UpsampleActionSelector`,components:{ElSelect:g,ElOption:_},computed:{options(){return j.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.upsample_action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,upsample_action:e})}}},mounted(){this.value||=M}}),rt={class:`field`},it={class:`title font-bold`};function at(e,t,ee,i,o,s){let h=d(`el-option`),g=d(`el-select`);return u(),f(`div`,rt,[r(`h2`,it,l(e.$t(`veo.name.upsampleAction`)),1),a(g,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`veo.placeholder.select`)},{default:p(()=>[(u(!0),f(m,null,c(e.options,e=>(u(),n(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ot=I(nt,[[`render`,at],[`__scopeId`,`data-v-8b74a7ae`]]),st=s({name:`ExtendModelSelector`,components:{ElSelect:g,ElOption:_},computed:{options(){return w.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){(!this.value||!w.includes(this.value))&&(this.value=D)}}),ct={class:`field`},lt={class:`title font-bold`};function ut(e,t,ee,i,o,s){let h=d(`el-option`),g=d(`el-select`);return u(),f(`div`,ct,[r(`h2`,lt,l(e.$t(`veo.name.model`)),1),a(g,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`veo.placeholder.select`)},{default:p(()=>[(u(!0),f(m,null,c(e.options,e=>(u(),n(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var dt=I(st,[[`render`,ut],[`__scopeId`,`data-v-cc3f9355`]]),ft=s({name:`MotionTypeSelector`,components:{ElSelect:g,ElOption:_},computed:{options(){return E.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.motion_type},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,motion_type:e})}}},mounted(){this.value||=A}}),pt={class:`field`},mt={class:`title font-bold`};function ht(e,t,ee,i,o,s){let h=d(`el-option`),g=d(`el-select`);return u(),f(`div`,pt,[r(`h2`,mt,l(e.$t(`veo.name.motionType`)),1),a(g,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`veo.placeholder.select`),filterable:``},{default:p(()=>[(u(!0),f(m,null,c(e.options,e=>(u(),n(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var gt=I(ft,[[`render`,ht],[`__scopeId`,`data-v-3affff3c`]]),_t=s({name:`ImageMaskInput`,components:{ElInput:F},computed:{value:{get(){return this.$store.state.veo?.config?.image_mask},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,image_mask:e})}}}}),vt={class:`field`},yt={class:`title font-bold`};function bt(e,t,n,ee,i,o){let s=d(`el-input`);return u(),f(`div`,vt,[r(`h2`,yt,l(e.$t(`veo.name.imageMask`)),1),a(s,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,type:`text`,placeholder:e.$t(`veo.placeholder.imageMask`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var xt=I(_t,[[`render`,bt],[`__scopeId`,`data-v-6cc27c68`]]),St=s({name:`PromptInput`,components:{PromptTextarea:Z},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ct(e,t,r,ee,i,a){let o=d(`prompt-textarea`);return u(),n(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var wt=I(St,[[`render`,Ct]]),Tt=[`upsample`,`extend`,`reshoot`,`object_insert`,`object_remove`,`get1080p`],Et=[`text2video`,`image2video`,`ingredients2video`],Dt=s({name:`ConfigPanel`,components:{ElButton:h,Consumption:ie,FontAwesomeIcon:W,PromptInput:wt,ModelSelector:ge,StartEndImage:tt,ActionSelector:Se,VideoFromInput:Ue,VideoIdInput:Je,UpsampleActionSelector:ot,ExtendModelSelector:dt,MotionTypeSelector:gt,ImageMaskInput:xt,TranslationSelector:Ae,AspectRatioSelector:Le},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},consumption(){return P(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service},isPostProcessing(){return Tt.includes(this.config?.action??``)},isGeneration(){return Et.includes(this.config?.action??``)}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ot={class:`flex flex-col h-full`},kt={class:`flex-1 overflow-y-auto p-5`},At={class:`flex flex-col items-center justify-center px-5 pb-5`};function jt(e,t,ee,s,c,h){let g=d(`action-selector`),_=d(`video-from-input`),v=d(`video-id-input`),y=d(`upsample-action-selector`),b=d(`extend-model-selector`),x=d(`prompt-input`),S=d(`motion-type-selector`),C=d(`image-mask-input`),w=d(`translation-selector`),T=d(`aspect-ratio-selector`),E=d(`model-selector`),D=d(`start-end-image`),O=d(`consumption`),k=d(`font-awesome-icon`),A=d(`el-button`);return u(),f(`div`,Ot,[r(`div`,kt,[a(g,{class:`mb-4`}),e.isPostProcessing?(u(),f(m,{key:0},[e.config?.video_url?(u(),n(_,{key:0,class:`mb-4`})):o(``,!0),a(v,{class:`mb-4`})],64)):o(``,!0),e.config?.action===`upsample`?(u(),n(y,{key:1,class:`mb-4`})):o(``,!0),e.config?.action===`extend`?(u(),n(b,{key:2,class:`mb-4`})):o(``,!0),e.config?.action===`extend`?(u(),n(x,{key:3,class:`mb-4`})):o(``,!0),e.config?.action===`reshoot`?(u(),n(S,{key:4,class:`mb-4`})):o(``,!0),e.config?.action===`object_insert`?(u(),n(x,{key:5,class:`mb-4`})):o(``,!0),e.config?.action===`object_insert`||e.config?.action===`object_remove`?(u(),n(C,{key:6,class:`mb-4`})):o(``,!0),e.config?.action===`object_remove`?(u(),n(x,{key:7,class:`mb-4`})):o(``,!0),e.isGeneration?(u(),f(m,{key:8},[a(w,{class:`mb-4`}),a(T,{class:`mb-4`}),a(x,{class:`mb-4`}),e.config?.action===`ingredients2video`?o(``,!0):(u(),n(E,{key:0,class:`mb-4`})),e.config?.action===`image2video`||e.config?.action===`ingredients2video`?(u(),n(D,{key:1,class:`mb-2`})):o(``,!0)],64)):o(``,!0)]),r(`div`,At,[a(O,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),a(A,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:p(()=>[a(k,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Mt=I(Dt,[[`render`,jt]]),Nt=s({name:`TaskPreview`,components:{ElImage:b,CopyToClipboard:G,FontAwesomeIcon:W,ElAlert:x,VideoPlayer:Q,ElTooltip:y,ElButton:h,ApiCodeButton:ae},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onPickAction(e,t,n,r){console.debug(`seed config from preview`,{action:n,upsampleAction:r,response:t}),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:n,video_id:t?.data?.[0]?.id,video_url:t?.data?.[0]?.video_url,...r?{upsample_action:r}:{}})},onDownload(e,t){e.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Pt={class:`preview`},Ft={class:`left`},It={class:`main`},Lt={class:`bot`},Rt={class:`datetime`},zt={class:`info`},Bt={key:0,class:`prompt mt-2`},Vt={key:0},Ht={key:1},Ut={key:0,class:t({content:!0,failed:!0})},Wt={key:0,class:`mb-4`},Gt={key:1,class:t({operations:!0,"mt-2":!0})},Kt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Jt={key:1,class:t({content:!0})},Yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Xt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Zt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Qt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$t={key:2,class:t({content:!0})},en={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function nn(e,t,ee,s,c,m){let h=d(`el-image`),g=d(`video-player`),_=d(`el-button`),v=d(`el-tooltip`),y=d(`api-code-button`),b=d(`font-awesome-icon`),x=d(`copy-to-clipboard`),S=d(`el-alert`);return u(),f(`div`,Pt,[r(`div`,Ft,[a(h,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),r(`div`,It,[r(`div`,Lt,[i(l(e.$t(`veo.name.veoBot`))+` `,1),r(`span`,Rt,l(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),r(`div`,zt,[e.modelValue?.request?.prompt?(u(),f(`p`,Bt,[i(l(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?o(``,!0):(u(),f(`span`,Vt,` - (`+l(e.$t(`veo.status.pending`))+`) `,1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state===`running`?(u(),f(`span`,Ht,` - (`+l(e.$t(`veo.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(u(),f(`div`,Ut,[e.modelValue?.response?.data[0]?.video_url?(u(),f(`div`,Wt,[a(g,{src:e.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):o(``,!0),e.modelValue?.response.success?(u(),f(`div`,Gt,[e.modelValue?.response?.data[0]?.video_url?(u(),n(_,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:t[0]||=t=>e.onPickAction(t,e.modelValue?.response,`upsample`,`1080p`)},{default:p(()=>[i(l(e.$t(`veo.button.actionUpsample1080p`)),1)]),_:1})):o(``,!0),e.modelValue?.response?.data[0]?.video_url?(u(),n(_,{key:1,type:`info`,size:`small`,class:`btn-action`,onClick:t[1]||=t=>e.onPickAction(t,e.modelValue?.response,`upsample`,`4k`)},{default:p(()=>[i(l(e.$t(`veo.button.actionUpsample4k`)),1)]),_:1})):o(``,!0),e.modelValue?.response?.data[0]?.video_url?(u(),n(_,{key:2,type:`info`,size:`small`,class:`btn-action`,onClick:t[2]||=t=>e.onPickAction(t,e.modelValue?.response,`upsample`,`gif`)},{default:p(()=>[i(l(e.$t(`veo.button.actionUpsampleGif`)),1)]),_:1})):o(``,!0),e.modelValue?.response?.data[0]?.video_url?(u(),n(_,{key:3,type:`info`,size:`small`,class:`btn-action`,onClick:t[3]||=t=>e.onPickAction(t,e.modelValue?.response,`extend`)},{default:p(()=>[i(l(e.$t(`veo.button.actionExtend`)),1)]),_:1})):o(``,!0),e.modelValue?.response?.data[0]?.video_url?(u(),n(_,{key:4,type:`info`,size:`small`,class:`btn-action`,onClick:t[4]||=t=>e.onPickAction(t,e.modelValue?.response,`reshoot`)},{default:p(()=>[i(l(e.$t(`veo.button.actionReshoot`)),1)]),_:1})):o(``,!0),e.modelValue?.response?.data[0]?.video_url?(u(),n(_,{key:5,type:`info`,size:`small`,class:`btn-action`,onClick:t[5]||=t=>e.onPickAction(t,e.modelValue?.response,`object_insert`)},{default:p(()=>[i(l(e.$t(`veo.button.actionObjectInsert`)),1)]),_:1})):o(``,!0),e.modelValue?.response?.data[0]?.video_url?(u(),n(_,{key:6,type:`info`,size:`small`,class:`btn-action`,onClick:t[6]||=t=>e.onPickAction(t,e.modelValue?.response,`object_remove`)},{default:p(()=>[i(l(e.$t(`veo.button.actionObjectRemove`)),1)]),_:1})):o(``,!0),a(v,{class:`box-item`,effect:`dark`,content:e.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:p(()=>[e.modelValue?.response?.data[0]?.video_url?(u(),n(_,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:t[7]||=t=>e.onDownload(t,e.modelValue?.response?.data[0]?.video_url)},{default:p(()=>[i(l(e.$t(`veo.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(y,{path:`/veo/videos`,body:e.modelValue?.request},null,8,[`body`])])):o(``,!0),a(S,{closable:!1,class:`mt-2 success`},{default:p(()=>[r(`p`,Kt,[a(b,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`veo.name.model`))+`: `+l(e.modelValue?.request?.model),1)]),r(`p`,qt,[a(b,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`veo.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),a(x,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.elapsed?(u(),f(`p`,$,[a(b,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`veo.name.elapsed`))+`: `+l(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),e.modelValue?.response?.success===!1?(u(),f(`div`,Jt,[a(S,{closable:!1,class:`failure`},{template:p(()=>[a(b,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(e.$t(`veo.name.failure`)),1)]),default:p(()=>[r(`p`,Yt,[a(b,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`veo.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),a(x,{content:e.modelValue?.id},null,8,[`content`])]),r(`p`,Xt,[a(b,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+l(e.$t(`veo.name.failureReason`))+`: `+l(e.modelValue?.response?.error?.message)+` `,1),a(x,{content:e.modelValue?.response?.error?.message},null,8,[`content`])]),e.modelValue?.elapsed?(u(),f(`p`,Zt,[a(b,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`veo.name.elapsed`))+`: `+l(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e.modelValue?.response?.trace_id?(u(),f(`p`,Qt,[a(b,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`veo.name.traceId`))+`: `+l(e.modelValue?.response?.trace_id)+` `,1),a(x,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),e.modelValue?.response?.success===void 0?(u(),f(`div`,$t,[a(S,{closable:!1,class:`info`},{template:p(()=>[a(b,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(e.$t(`veo.name.failure`)),1)]),default:p(()=>[r(`p`,en,[a(b,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`veo.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),a(x,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.response?.trace_id?(u(),f(`p`,tn,[a(b,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`veo.name.traceId`))+`: `+l(e.modelValue?.response?.trace_id)+` `,1),a(x,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var rn=s({name:`RecentPanel`,components:{TaskPreview:I(Nt,[[`render`,nn],[`__scopeId`,`data-v-912779c9`]]),NoTasks:re,BotPlaceholder:q,ScrollList:Y},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),an={key:0},on={key:2,class:`w-full h-full flex items-center justify-center`};function sn(e,t,r,ee,i,s){let l=d(`bot-placeholder`),h=d(`task-preview`),g=d(`scroll-list`),_=d(`no-tasks`);return u(),f(m,null,[e.tasks?.items===void 0?(u(),f(`div`,an,[a(l)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(u(),n(g,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(u(!0),f(m,null,c(e.tasks?.items,(e,t)=>(u(),n(h,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(u(),f(`div`,on,[a(_)])):o(``,!0)],64)}var cn=I(rn,[[`render`,sn]]),ln=te(`veo`),un=s({name:`VeoIndex`,components:{ConfigPanel:Mt,Layout:de,RecentPanel:cn},mixins:[H],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===B.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===B.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await X({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!L(this.uploadTracker,e=>this.$t(e),e=>U.warning(e)))return;let e={...this.config,callback_url:ln},t=this.credential?.token;if(!t){console.error(`no token specified`);return}if(e.action===`image2video`&&!(e.image_urls&&e.image_urls.length>0)){U.warning(this.$t(`veo.message.imageRequired`));return}(!e.image_urls||e.image_urls.length===0)&&delete e.image_urls,U.info(this.$t(`veo.message.startingTask`)),ne(`veo`,z.generate(e,{token:t})).then(()=>{U.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`veo.message.usedUp`)):U.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function dn(e,t,r,ee,i,o){let s=d(`config-panel`),c=d(`recent-panel`),l=d(`layout`);return u(),n(l,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var fn=I(un,[[`render`,dn]]);export{fn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,Bt as t,D as n,E as r,M as i,N as a,O as o,P as s,Q as c,Ut as l,X as u,_ as d,et as f,k as p,lt as m,tt as h,ut as g,v as _,x as v,y}from"./vendor-chart-Df3WBvr0.js";import{t as b}from"./button-DgZFgZDr.js";import{F as x,X as S,Y as C,tt as w,z as T}from"./use-deprecated-Brbm5i6o.js";import{r as E,t as D}from"./select-D09DhLq3.js";import{n as O,t as k}from"./tabs-DT_RvYVg.js";import{n as A,t as j}from"./form-CM4sfjkF.js";import{t as M}from"./upload-B8zBOx3w.js";import{t as N}from"./tooltip-C-9nDsaA.js";import{t as P}from"./image-h59pgGu4.js";import{t as F}from"./avatar-LKc8EZVv.js";import{t as I}from"./checkbox-B_yzN9YW.js";import{n as L,r as R,t as ee}from"./radio-DNLlMkjf.js";import{n as te,t as ne}from"./collapse-CbVpOSn0.js";import{t as z}from"./drawer-BhAAsvLB.js";import{n as B,r as V,t as re}from"./dropdown-Cbgd3uK3.js";import{t as H}from"./input-number-DRiPLyxJ.js";import{t as ie}from"./popover-CVWhmFil.js";import{t as ae}from"./progress-C5HwZSvS.js";import{n as oe,t as se}from"./skeleton-k2vAVQdD.js";import{t as ce}from"./slider-Boe4ZceA.js";import{t as le}from"./switch-4rpQbrhU.js";import{an as ue,zr as U}from"./constants-Ch-akEqn.js";import{Cn as de,Ct as fe,Dt as pe,On as me,Or as W,S as G,St as he,Xt as K,br as q,dr as J,mr as ge,wr as Y,wt as _e,xr as X}from"./index-Lyxum_zj.js";import{t as Z}from"./index.es-CRAhHJsF.js";import{i as Q,n as ve,r as ye,t as be}from"./pagination-CtEQ0kyl.js";import{n as xe,t as Se}from"./NoTasks-BSGHQNdO.js";import{t as Ce}from"./Consumption-D6SdJe6i.js";import{n as we,r as $,t as Te}from"./Player-BIoX_RId.js";var Ee=s({name:`LayoutSuno`,components:{ElDrawer:z,ElButton:b,FontAwesomeIcon:Z},data(){return{drawer:!1,preview:!1}},computed:{}}),De={class:`main flex flex-row flex-1`},Oe={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ke={class:`result h-full flex flex-col flex-1 min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`},Ae={class:`preview h-full w-[300px] flex flex-col`};function je(t,n,i,o,s,c){let l=f(`font-awesome-icon`),d=f(`el-button`),h=f(`el-drawer`);return u(),p(`div`,De,[r(`div`,Oe,[e(t.$slots,`config`,{},void 0,!0)]),r(`div`,ke,[e(t.$slots,`result`,{},void 0,!0)]),r(`div`,Ae,[e(t.$slots,`preview`,{},void 0,!0)]),a(d,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[a(l,{icon:`fa-solid fa-magic`})]),_:1}),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:m(()=>[e(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Me=G(Ee,[[`render`,je],[`__scopeId`,`data-v-abe843c9`]]),Ne=s({name:`TypeSelector`,components:{ElSelect:E,ElOption:D,ElSwitch:le},data(){return{options:[{label:`v5.5`,value:`chirp-v5-5`,desc:this.$t(`suno.model.v55desc`)},{label:`v5`,value:`chirp-v5`,desc:this.$t(`suno.model.v5desc`)},{label:`v4.5+`,value:`chirp-v4-5-plus`,desc:this.$t(`suno.model.v45plusdesc`)},{label:`v4.5`,value:`chirp-v4-5`,desc:this.$t(`suno.model.v45desc`),dividerAfter:!0},{label:`v4`,value:`chirp-v4`,desc:this.$t(`suno.model.v4desc`)},{label:`v3.5`,value:`chirp-v3-5`,desc:this.$t(`suno.model.v35desc`)},{label:`v3`,value:`chirp-v3-0`,desc:this.$t(`suno.model.v3desc`)}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom||!1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,custom:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental||!1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,instrumental:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||=ue}}),Pe={class:`mb-3`},Fe={class:`flex items-center mb-1`},Ie={class:`text-sm font-bold`},Le={class:`model-option`},Re={class:`model-option-left`},ze={class:`model-option-name`},Be={class:`model-option-desc`},Ve={key:0,class:`flex items-center justify-between mb-3`},He={class:`text-sm font-bold`};function Ue(e,i,s,d,h,g){let _=f(`el-option`),y=f(`el-select`),b=f(`el-switch`);return u(),p(`div`,null,[r(`div`,Pe,[r(`div`,Fe,[r(`span`,Ie,l(e.$t(`suno.name.model`)),1)]),a(y,{modelValue:e.model,"onUpdate:modelValue":i[0]||=t=>e.model=t,class:`w-full model-select`,size:`default`,placeholder:e.$t(`suno.placeholder.select`)},{default:m(()=>[(u(!0),p(v,null,c(e.options,e=>(u(),n(_,{key:e.value,label:e.label,value:e.value,class:t({"model-option-divider":e.dividerAfter})},{default:m(()=>[r(`div`,Le,[r(`div`,Re,[r(`span`,ze,l(e.label),1)]),r(`span`,Be,l(e.desc),1)])]),_:2},1032,[`label`,`value`,`class`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),e.custom?(u(),p(`div`,Ve,[r(`span`,He,l(e.$t(`suno.name.instrumental`)),1),a(b,{modelValue:e.instrumental,"onUpdate:modelValue":i[1]||=t=>e.instrumental=t},null,8,[`modelValue`])])):o(``,!0)])}var We=G(Ne,[[`render`,Ue],[`__scopeId`,`data-v-16e4d6fc`]]),Ge=s({name:`UploadAudio`,components:{ElUpload:M,ElButton:b,ElDialog:Y,ElTabs:O,ElTabPane:k,InfoIcon:Q,FontAwesomeIcon:Z,ElRadioGroup:R,ElRadioButton:L},mixins:[fe],emits:[`change`],data(){return{fileList:[],uploadUrl:ge()+`/api/v1/files/`,dialogVisible:!1,activeTab:`browse`,recording:!1,recordedBlob:null,recordedAudioUrl:null,audioPreviewUrl:null,recordTimer:null,recordSeconds:0,mediaRecorder:null,mediaStream:null,recordedChunks:[],uploadingRecord:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}},hasUploadedAudio(){let e=this.$store.state.suno?.config?.action;return e===`upload_extend`||e===`upload_cover`},uploadAction:{get(){return this.$store.state.suno?.config?.action||`upload_extend`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,action:e})}},formattedTime(){return`${Math.floor(this.recordSeconds/60).toString().padStart(2,`0`)}:${(this.recordSeconds%60).toString().padStart(2,`0`)}`}},watch:{urls:{handler(e){this.$emit(`change`,e)}}},beforeUnmount(){this.cleanupRecording()},methods:{onExceed(){X.warning(this.$t(`suno.message.uploadReferencesExceed`))},onError(){X.error(this.$t(`suno.message.uploadReferencesError`))},async onBrowseSuccess(){let e=this.urls?.[0];e&&(this.audioPreviewUrl=e,await this.onGenerateAudioId(e),this.dialogVisible=!1)},async onGenerateAudioId(e){let t={audio_url:e},n=this.credential?.token;if(!n){console.error(`no token specified`);return}X.info(this.$t(`suno.message.startingUploadAudio`));try{let e=await K.upload(t,{token:n});console.debug(`get upload music success`,e.data);let r=e.data?.data.audio_id;this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,audio_id:r,action:`upload_extend`}),X.success(this.$t(`suno.message.startUploadAudioSuccess`))}catch(e){X.error(e?.response?.data?.error?.message||this.$t(`suno.message.startUploadAudioFailed`))}},async startRecording(){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){X.error(this.$t(`suno.message.recordingUnsupported`));return}try{this.mediaStream=await navigator.mediaDevices.getUserMedia({audio:!0}),this.recordedChunks=[],this.mediaRecorder=new MediaRecorder(this.mediaStream),this.mediaRecorder.ondataavailable=e=>{e.data&&e.data.size>0&&this.recordedChunks.push(e.data)},this.mediaRecorder.onstop=()=>{let e=new Blob(this.recordedChunks,{type:`audio/webm`});this.recordedBlob=e,this.recordedAudioUrl&&URL.revokeObjectURL(this.recordedAudioUrl),this.recordedAudioUrl=URL.createObjectURL(e),this.releaseStream()},this.mediaRecorder.start(),this.recording=!0,this.recordSeconds=0,this.recordTimer=window.setInterval(()=>{this.recordSeconds+=1,this.recordSeconds>=600&&this.stopRecording()},1e3)}catch(e){console.error(`record error`,e),X.error(this.$t(`suno.message.recordingPermissionDenied`))}},stopRecording(){this.recordTimer&&=(window.clearInterval(this.recordTimer),null),this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&this.mediaRecorder.stop(),this.recording=!1},resetRecording(){this.recordedAudioUrl&&URL.revokeObjectURL(this.recordedAudioUrl),this.recordedBlob=null,this.recordedAudioUrl=null,this.recordSeconds=0},async uploadRecording(){if(this.recordedBlob){this.uploadingRecord=!0;try{let e=new FormData,t=`recording-${Date.now()}.webm`;e.append(`file`,this.recordedBlob,t);let n=await fetch(this.uploadUrl,{method:`POST`,headers:{Authorization:`Bearer ${this.$store.state.token.access}`},body:e});if(!n.ok)throw Error(`upload failed: ${n.status}`);let r=await n.json(),i=r?.file_url||r?.data?.file_url;if(!i)throw Error(`no file_url in response`);this.audioPreviewUrl=i,await this.onGenerateAudioId(i),this.dialogVisible=!1,this.resetRecording()}catch(e){console.error(e),X.error(e?.message||this.$t(`suno.message.uploadReferencesError`))}finally{this.uploadingRecord=!1}}},releaseStream(){this.mediaStream&&=(this.mediaStream.getTracks().forEach(e=>e.stop()),null)},cleanupRecording(){this.recordTimer&&=(window.clearInterval(this.recordTimer),null),this.releaseStream(),this.recordedAudioUrl&&=(URL.revokeObjectURL(this.recordedAudioUrl),null)}}}),Ke={class:`relative`},qe={class:`flex justify-between items-center mb-2`},Je={class:`flex justify-start items-center`},Ye={class:`text-sm font-bold`},Xe={key:0,class:`mb-2`},Ze=[`src`],Qe={key:1,class:`mt-2`},$e={class:`py-4`},et={class:`text-center py-6`},tt={class:`text-sm`},nt={class:`text-xs text-gray-400 mt-1`},rt={class:`py-4 text-center`},it={class:`recorder-display mb-4`},at={key:0,class:`text-red-500 flex items-center justify-center gap-2`},ot={class:`text-2xl font-mono`},st={key:1,class:`text-green-600`},ct={key:2,class:`text-gray-400 text-2xl font-mono`},lt={key:0,class:`mb-4`},ut=[`src`],dt={class:`flex justify-center gap-3`};function ft(e,t,s,c,d,h){let g=f(`info-icon`),_=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-radio-button`),x=f(`el-radio-group`),S=f(`el-upload`),C=f(`el-tab-pane`),w=f(`el-tabs`),T=f(`el-dialog`);return u(),p(`div`,Ke,[r(`div`,qe,[r(`div`,Je,[r(`span`,Ye,l(e.$t(`suno.name.referenceAudios`)),1),a(g,{content:e.$t(`suno.description.uploadAudios`)},null,8,[`content`])]),a(y,{round:``,type:`primary`,size:`small`,onClick:t[0]||=t=>e.dialogVisible=!0},{default:m(()=>[a(_,{icon:`fa-solid fa-plus`,class:`icon mr-1`}),i(` `+l(e.$t(`suno.button.addAudio`)),1)]),_:1})]),e.audioPreviewUrl?(u(),p(`div`,Xe,[r(`audio`,{src:e.audioPreviewUrl,controls:``,class:`w-full`},null,8,Ze)])):o(``,!0),e.hasUploadedAudio?(u(),p(`div`,Qe,[a(x,{modelValue:e.uploadAction,"onUpdate:modelValue":t[1]||=t=>e.uploadAction=t,size:`small`},{default:m(()=>[a(b,{value:`upload_extend`},{default:m(()=>[i(l(e.$t(`suno.button.extend`)),1)]),_:1}),a(b,{value:`upload_cover`},{default:m(()=>[i(l(e.$t(`suno.button.upload_cover`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0),a(T,{modelValue:e.dialogVisible,"onUpdate:modelValue":t[4]||=t=>e.dialogVisible=t,title:e.$t(`suno.name.addAudio`),width:`520px`,"close-on-click-modal":!1,"append-to-body":``},{default:m(()=>[a(w,{modelValue:e.activeTab,"onUpdate:modelValue":t[3]||=t=>e.activeTab=t,class:`add-audio-tabs`},{default:m(()=>[a(C,{name:`browse`,label:e.$t(`suno.tab.browse`)},{default:m(()=>[r(`div`,$e,[a(S,{"file-list":e.fileList,"onUpdate:fileList":t[2]||=t=>e.fileList=t,name:`file`,limit:1,class:`upload-wrapper`,action:e.uploadUrl,accept:`.mp3,.wav,.m4a,audio/*`,"show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onBrowseSuccess,headers:e.headers,drag:``},{default:m(()=>[r(`div`,et,[a(_,{icon:`fa-solid fa-upload`,class:`text-4xl text-gray-400 mb-3`}),r(`div`,tt,l(e.$t(`suno.description.dropAudioHere`)),1),r(`div`,nt,l(e.$t(`suno.description.audioFormats`)),1)])]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])]),_:1},8,[`label`]),a(C,{name:`record`,label:e.$t(`suno.tab.record`)},{default:m(()=>[r(`div`,rt,[r(`div`,it,[e.recording?(u(),p(`div`,at,[t[5]||=r(`span`,{class:`recording-dot`},null,-1),r(`span`,ot,l(e.formattedTime),1)])):e.recordedBlob?(u(),p(`div`,st,[a(_,{icon:`fa-solid fa-check-circle`,class:`text-2xl mr-2`}),r(`span`,null,l(e.$t(`suno.message.recordingReady`))+` (`+l(e.formattedTime)+`)`,1)])):(u(),p(`div`,ct,`00:00`))]),e.recordedAudioUrl&&!e.recording?(u(),p(`div`,lt,[r(`audio`,{src:e.recordedAudioUrl,controls:``,class:`w-full`},null,8,ut)])):o(``,!0),r(`div`,dt,[!e.recording&&!e.recordedBlob?(u(),n(y,{key:0,type:`primary`,round:``,onClick:e.startRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-microphone`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.startRecord`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.recording?(u(),n(y,{key:1,type:`danger`,round:``,onClick:e.stopRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-stop`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.stopRecord`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.recordedBlob&&!e.recording?(u(),p(v,{key:2},[a(y,{round:``,onClick:e.resetRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.reRecord`)),1)]),_:1},8,[`onClick`]),a(y,{type:`primary`,round:``,loading:e.uploadingRecord,onClick:e.uploadRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-upload`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.useRecording`)),1)]),_:1},8,[`loading`,`onClick`])],64)):o(``,!0)])])]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`])])}var pt=G(Ge,[[`render`,ft],[`__scopeId`,`data-v-5f17a1f4`]]),mt=[{key:`lofi`,label:`🎧 Lo-fi Chill`,prompt:`a relaxing lo-fi hip hop beat for studying`},{key:`pop-love`,label:`💕 Pop Love Song`,prompt:`a catchy pop love song with sweet melodies`},{key:`rock-anthem`,label:`🎸 Rock Anthem`,prompt:`an energetic rock anthem with electric guitars`},{key:`jazz-night`,label:`🎷 Jazz Night`,prompt:`a smooth late-night jazz piece with saxophone`},{key:`edm-drop`,label:`⚡ EDM Drop`,prompt:`an intense EDM track with a massive drop`},{key:`folk-story`,label:`🪕 Folk Story`,prompt:`a warm folk song telling a story about traveling`},{key:`rnb-groove`,label:`🎤 R&B Groove`,prompt:`a smooth R&B groove with soulful vocals`},{key:`classical`,label:`🎻 Classical`,prompt:`an elegant classical piece for orchestra`},{key:`hip-hop`,label:`🎤 Hip Hop`,prompt:`a hard-hitting hip hop beat with bass`},{key:`country`,label:`🤠 Country`,prompt:`an upbeat country song with acoustic guitar and banjo`},{key:`reggae`,label:`🌴 Reggae`,prompt:`a laid-back reggae tune with island vibes`},{key:`latin`,label:`💃 Latin`,prompt:`a vibrant Latin dance track with percussion`},{key:`ambient`,label:`🌊 Ambient`,prompt:`a dreamy ambient soundscape for relaxation`},{key:`metal`,label:`🤘 Metal`,prompt:`a powerful metal song with heavy riffs and double bass drums`},{key:`soul`,label:`🎵 Soul`,prompt:`a heartfelt soul ballad with gospel harmonies`},{key:`synthwave`,label:`🌃 Synthwave`,prompt:`a retro synthwave track with 80s vibes`},{key:`kpop`,label:`🇰🇷 K-Pop`,prompt:`a catchy K-pop dance track with hook`},{key:`lullaby`,label:`🌙 Lullaby`,prompt:`a gentle lullaby for bedtime with soft piano`},{key:`cinematic`,label:`🎬 Cinematic`,prompt:`an epic cinematic orchestral score for a movie trailer`},{key:`blues`,label:`🎸 Blues`,prompt:`a soulful blues song with electric guitar bends`},{key:`disco`,label:`🕺 Disco`,prompt:`a funky disco track with groovy bassline`},{key:`punk`,label:`🔥 Punk Rock`,prompt:`a fast punk rock song with raw energy`},{key:`gospel`,label:`⛪ Gospel`,prompt:`an uplifting gospel choir song with piano`},{key:`trap`,label:`🔊 Trap`,prompt:`a dark trap beat with 808s and hi-hats`},{key:`bossa`,label:`☕ Bossa Nova`,prompt:`a gentle bossa nova with nylon guitar`},{key:`indie`,label:`🎶 Indie`,prompt:`a dreamy indie track with ethereal vocals`},{key:`cpop`,label:`🇨🇳 C-Pop`,prompt:`a beautiful Chinese pop ballad with emotional vocals`},{key:`jpop`,label:`🇯🇵 J-Pop`,prompt:`a cheerful J-pop song with anime vibes`},{key:`afrobeat`,label:`🥁 Afrobeat`,prompt:`a groovy Afrobeat track with layered percussion`},{key:`game`,label:`🎮 Game BGM`,prompt:`an adventurous video game background music`}],ht=8;function gt(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}var _t=s({name:`PromptInput`,components:{FontAwesomeIcon:Z,PromptTextarea:xe},data(){return{shuffledTags:gt(mt)}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,prompt:e})}},visibleTags(){return this.shuffledTags.slice(0,ht)}},mounted(){this.prompt||=``},methods:{onTagClick(e){this.prompt=e.prompt},onRefreshTags(){this.shuffledTags=gt(mt)}}}),vt={class:`inspo-tags`},yt=[`onClick`];function bt(e,t,i,o,s,d){let h=f(`font-awesome-icon`),g=f(`prompt-textarea`);return u(),n(g,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`suno.name.songDescription`),info:e.$t(`suno.description.prompt`),placeholder:e.$t(`suno.placeholder.prompt`),"min-rows":5,"max-rows":14},{after:m(()=>[r(`div`,vt,[(u(!0),p(v,null,c(e.visibleTags,t=>(u(),p(`button`,{key:t.key,class:`inspo-tag`,onClick:n=>e.onTagClick(t)},l(t.label),9,yt))),128)),r(`button`,{class:`inspo-tag inspo-tag-refresh`,onClick:t[0]||=(...t)=>e.onRefreshTags&&e.onRefreshTags(...t)},[a(h,{icon:`fa-solid fa-arrows-rotate`})])])]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var xt=G(_t,[[`render`,bt],[`__scopeId`,`data-v-58ffcd38`]]),St=s({name:`LyricInput`,components:{ElInput:W,ElButton:b,ElTooltip:N,ElDialog:Y,FontAwesomeIcon:Z,InfoIcon:Q},data(){return{generatingLyrics:!1,enhancingLyrics:!1,enhancePrompt:``,lyricHistory:[],expanded:!1}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config},credential(){return this.$store.state.suno?.credential}},mounted(){this.lyric||=``},methods:{pushHistory(){this.lyric&&(this.lyricHistory.push(this.lyric),this.lyricHistory.length>20&&this.lyricHistory.shift())},onUndo(){let e=this.lyricHistory.pop();e!==void 0&&(this.lyric=e)},onClear(){this.pushHistory(),this.lyric=``},async onEnhanceLyrics(){let e=this.credential?.token;if(!(!e||!this.lyric||!this.enhancePrompt)){this.pushHistory(),this.enhancingLyrics=!0,X.info(this.$t(`suno.message.enhancingLyrics`));try{let t=`${this.enhancePrompt}\n\nOriginal lyrics:\n${this.lyric}`,n=(await K.lyric({prompt:t},{token:e})).data?.data;n?.text&&(this.lyric=n.text,this.enhancePrompt=``,X.success(this.$t(`suno.message.enhanceLyricsSuccess`)))}catch{X.error(this.$t(`suno.message.enhanceLyricsFailed`))}finally{this.enhancingLyrics=!1}}},async onGenerateLyrics(){let e=this.credential?.token;if(!e)return;let t;try{t=((await q.prompt(this.$t(`suno.message.lyricsThemePromptMessage`),this.$t(`suno.message.lyricsThemePromptTitle`),{confirmButtonText:this.$t(`common.button.confirm`),cancelButtonText:this.$t(`common.button.cancel`),inputPlaceholder:this.$t(`suno.placeholder.lyricsTheme`),inputValue:this.config?.title||``,inputType:`textarea`,inputValidator:e=>typeof e==`string`&&e.trim().length>0||this.$t(`suno.message.lyricsThemeRequired`)})).value||``).trim()}catch{return}if(t){this.pushHistory(),this.generatingLyrics=!0,X.info(this.$t(`suno.message.generatingLyrics`));try{let n=(await K.lyric({prompt:t},{token:e})).data?.data;n?.text&&(this.lyric=n.text,n?.title&&!this.config?.title&&this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric:n.text,title:n.title}),X.success(this.$t(`suno.message.generateLyricsSuccess`)))}catch{X.error(this.$t(`suno.message.generateLyricsFailed`))}finally{this.generatingLyrics=!1}}}}}),Ct={class:`field`},wt={class:`flex items-center justify-between mb-1`},Tt={class:`flex items-center`},Et={class:`text-sm font-bold`},Dt={class:`flex items-center gap-1`},Ot={class:`relative`},kt={class:`text-xs text-right text-[var(--el-text-color-secondary)] mt-1`},At={key:0,class:`enhance-bar`},jt={key:0,class:`enhance-bar mt-3`},Mt={class:`flex items-center justify-between`},Nt={class:`flex items-center gap-1`};function Pt(e,t,s,c,d,h){let g=f(`info-icon`),v=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-tooltip`),x=f(`el-input`),S=f(`el-dialog`);return u(),p(`div`,Ct,[r(`div`,wt,[r(`div`,Tt,[r(`span`,Et,l(e.$t(`suno.name.lyrics`)),1),a(g,{content:e.$t(`suno.description.lyrics`)},null,8,[`content`])]),r(`div`,Dt,[e.lyricHistory.length>0?(u(),n(b,{key:0,content:e.$t(`suno.button.undo`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,onClick:e.onUndo},{default:m(()=>[a(v,{icon:`fa-solid fa-rotate-left`})]),_:1},8,[`onClick`])]),_:1},8,[`content`])):o(``,!0),e.lyric?(u(),n(b,{key:1,content:e.$t(`suno.button.clear_lyrics`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,onClick:e.onClear},{default:m(()=>[a(v,{icon:`fa-solid fa-eraser`})]),_:1},8,[`onClick`])]),_:1},8,[`content`])):o(``,!0),a(b,{content:e.$t(`suno.button.expand_lyrics`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,onClick:t[0]||=t=>e.expanded=!0},{default:m(()=>[a(v,{icon:`fa-solid fa-expand`})]),_:1})]),_:1},8,[`content`]),e.config?.action===`extend`?o(``,!0):(u(),n(y,{key:2,size:`small`,loading:e.generatingLyrics,round:``,onClick:e.onGenerateLyrics},{default:m(()=>[e.generatingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.generate_lyrics`)),1)]),_:1},8,[`loading`,`onClick`]))])]),r(`div`,Ot,[e.config?.action===`extend`?(u(),n(x,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[2]||=t=>e.lyric=t,rows:5,type:`textarea`,class:`lyrics`,placeholder:e.$t(`suno.placeholder.extend.lyrics`)},null,8,[`modelValue`,`placeholder`])):(u(),n(x,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[1]||=t=>e.lyric=t,rows:5,type:`textarea`,class:`lyrics`,placeholder:e.$t(`suno.placeholder.lyrics`)},null,8,[`modelValue`,`placeholder`])),r(`div`,kt,l(e.lyric?.length||0)+`/5000`,1)]),e.lyric&&e.config?.action!==`extend`?(u(),p(`div`,At,[a(x,{modelValue:e.enhancePrompt,"onUpdate:modelValue":t[3]||=t=>e.enhancePrompt=t,size:`small`,placeholder:e.$t(`suno.placeholder.enhanceLyrics`),class:`enhance-input`,onKeyup:_(e.onEnhanceLyrics,[`enter`])},{append:m(()=>[a(y,{loading:e.enhancingLyrics,onClick:e.onEnhanceLyrics},{default:m(()=>[e.enhancingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.enhance_lyrics`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1},8,[`modelValue`,`placeholder`,`onKeyup`])])):o(``,!0),a(S,{modelValue:e.expanded,"onUpdate:modelValue":t[7]||=t=>e.expanded=t,title:e.$t(`suno.name.lyrics`),width:`720px`,top:`5vh`,"close-on-click-modal":!1,class:`lyrics-expand-dialog`},{footer:m(()=>[r(`div`,Mt,[r(`div`,Nt,[e.lyricHistory.length>0?(u(),n(y,{key:0,size:`small`,onClick:e.onUndo},{default:m(()=>[a(v,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.undo`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.lyric?(u(),n(y,{key:1,size:`small`,onClick:e.onClear},{default:m(()=>[a(v,{icon:`fa-solid fa-eraser`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.clear_lyrics`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.config?.action===`extend`?o(``,!0):(u(),n(y,{key:2,size:`small`,loading:e.generatingLyrics,onClick:e.onGenerateLyrics},{default:m(()=>[e.generatingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.generate_lyrics`)),1)]),_:1},8,[`loading`,`onClick`]))]),a(y,{type:`primary`,onClick:t[6]||=t=>e.expanded=!1},{default:m(()=>[i(l(e.$t(`common.button.confirm`)),1)]),_:1})])]),default:m(()=>[a(x,{modelValue:e.lyric,"onUpdate:modelValue":t[4]||=t=>e.lyric=t,type:`textarea`,rows:20,class:`lyrics-expanded`,placeholder:e.$t(`suno.placeholder.lyrics`),autofocus:``},null,8,[`modelValue`,`placeholder`]),e.config?.action===`extend`?o(``,!0):(u(),p(`div`,jt,[a(x,{modelValue:e.enhancePrompt,"onUpdate:modelValue":t[5]||=t=>e.enhancePrompt=t,size:`small`,placeholder:e.$t(`suno.placeholder.enhanceLyrics`),class:`enhance-input`,onKeyup:_(e.onEnhanceLyrics,[`enter`])},{append:m(()=>[a(y,{loading:e.enhancingLyrics,onClick:e.onEnhanceLyrics},{default:m(()=>[e.enhancingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.enhance_lyrics`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1},8,[`modelValue`,`placeholder`,`onKeyup`])]))]),_:1},8,[`modelValue`,`title`])])}var Ft=G(St,[[`render`,Pt],[`__scopeId`,`data-v-d7d2ec74`]]),It=`Pop.Rock.Jazz.R&B.Hip Hop.Lo-fi.Electronic.Classical.Country.Blues.Folk.Reggae.Metal.Punk.Soul.Funk.Ambient.Indie.Latin.Acoustic.Dance.Disco.Gospel.K-Pop.J-Pop.C-Pop.Bossa Nova.Trap.Drill.House.Techno.Dubstep.Synthwave.Chill.Dreamy.Upbeat.Melancholic.Romantic.Epic.Cinematic.Orchestral.Piano.Guitar.Saxophone.Violin.Tribal.World Music.Afrobeat.Ska.Grunge`.split(`.`),Lt=12;function Rt(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}var zt=s({name:`StyleInput`,components:{ElInput:W,ElButton:b,FontAwesomeIcon:Z,InfoIcon:Q},data(){return{optimizing:!1,shuffledTags:Rt(It)}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style:e})}},credential(){return this.$store.state.suno?.credential},visibleTags(){return this.shuffledTags.slice(0,Lt)}},methods:{onTagClick(e){let t=this.style||``;t.toLowerCase().includes(e.toLowerCase())||(this.style=t?`${t}, ${e}`:e)},onRefreshTags(){this.shuffledTags=Rt(It)},async onOptimizeStyle(){let e=this.credential?.token;if(!(!e||!this.style)){this.optimizing=!0,X.info(this.$t(`suno.message.optimizingStyle`));try{let t=await K.style({prompt:this.style},{token:e}),n=t.data?.text||t.data?.data?.text;n&&(this.style=n,X.success(this.$t(`suno.message.optimizeStyleSuccess`)))}catch{X.error(this.$t(`suno.message.optimizeStyleFailed`))}finally{this.optimizing=!1}}}}}),Bt={class:`field`},Vt={class:`flex items-center justify-between mb-1`},Ht={class:`flex items-center`},Ut={class:`text-sm font-bold`},Wt={class:`relative`},Gt={class:`text-xs text-right text-[var(--el-text-color-secondary)] mt-1`},Kt={class:`style-tags`},qt=[`onClick`];function Jt(e,t,s,d,h,g){let _=f(`info-icon`),y=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-input`);return u(),p(`div`,Bt,[r(`div`,Vt,[r(`div`,Ht,[r(`span`,Ut,l(e.$t(`suno.name.style`)),1),a(_,{content:e.$t(`suno.description.style`)},null,8,[`content`])]),a(b,{size:`small`,loading:e.optimizing,round:``,onClick:e.onOptimizeStyle},{default:m(()=>[e.optimizing?o(``,!0):(u(),n(y,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.optimize_style`)),1)]),_:1},8,[`loading`,`onClick`])]),r(`div`,Wt,[a(x,{modelValue:e.style,"onUpdate:modelValue":t[0]||=t=>e.style=t,rows:2,type:`textarea`,placeholder:e.$t(`suno.placeholder.style`)},null,8,[`modelValue`,`placeholder`]),r(`div`,Gt,l(e.style?.length||0)+`/1000`,1)]),r(`div`,Kt,[(u(!0),p(v,null,c(e.visibleTags,t=>(u(),p(`button`,{key:t,class:`style-tag`,onClick:n=>e.onTagClick(t)},l(t),9,qt))),128)),r(`button`,{class:`style-tag style-tag-refresh`,onClick:t[1]||=(...t)=>e.onRefreshTags&&e.onRefreshTags(...t)},[a(y,{icon:`fa-solid fa-arrows-rotate`})])])])}var Yt=G(zt,[[`render`,Jt],[`__scopeId`,`data-v-ddebb076`]]),Xt=s({name:`TitleInput`,components:{ElInput:W,InfoIcon:Q},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,title:e})}}}}),Zt={class:`field`},Qt={class:`flex items-center mb-1`},$t={class:`text-sm font-bold`};function en(e,t,n,i,o,s){let c=f(`info-icon`),d=f(`el-input`);return u(),p(`div`,Zt,[r(`div`,Qt,[r(`span`,$t,l(e.$t(`suno.name.title`)),1),a(c,{content:e.$t(`suno.description.title`)},null,8,[`content`])]),a(d,{modelValue:e.title,"onUpdate:modelValue":t[0]||=t=>e.title=t,placeholder:e.$t(`suno.placeholder.title`)},null,8,[`modelValue`,`placeholder`])])}var tn=G(Xt,[[`render`,en]]),nn=s({name:`ExtendFromInput`,components:{ElImage:P,ElIcon:w,ElInputNumber:H,VideoPlay:S,VideoPause:C},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:$,onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),rn={class:`field`},an={class:`box`},on={class:`title font-bold`},sn={class:`input-wrapper`},cn={class:`task`},ln={class:`left`},un={key:2,class:`duration`},dn={class:`info`},fn={class:`title`},pn={class:`style`};function mn(e,t,n,i,s,c){let d=f(`el-input-number`),_=f(`el-image`),v=f(`video-pause`),y=f(`el-icon`),b=f(`video-play`),x=h(`loading`);return u(),p(`div`,rn,[r(`div`,an,[r(`h2`,on,l(e.$t(`suno.name.extend`)),1),r(`div`,sn,[a(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.extend.continue_at`),onChange:e.handleChange},null,8,[`modelValue`,`max`,`placeholder`,`onChange`])])]),r(`div`,cn,[e.audio?(u(),p(`div`,{key:0,class:`audio`,onClick:t[3]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,ln,[a(_,{src:e.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`playing`?(u(),p(`div`,{key:0,class:`overlay`,onClick:t[1]||=t=>e.onPause(e.audio)},[a(y,null,{default:m(()=>[a(v)]),_:1})])):o(``,!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`paused`)?(u(),p(`div`,{key:1,class:`overlay`,onClick:t[2]||=t=>e.onPlay(e.audio)},[a(y,null,{default:m(()=>[a(b)]),_:1})])):o(``,!0),e.audio?.duration?(u(),p(`div`,un,l(e.useFormatDuring(e.audio?.duration)),1)):o(``,!0)])),[[x,!e.audio?.audio_url]]),r(`div`,dn,[r(`h2`,fn,l(e.audio?.title),1),r(`p`,pn,l(e.audio?.style),1)])])):o(``,!0)])])}var hn=G(nn,[[`render`,mn],[`__scopeId`,`data-v-bcce4821`]]),gn=s({name:`CoverFromInput`,components:{ElImage:P,ElIcon:w,VideoPlay:S,VideoPause:C},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:$,onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),_n={class:`field`},vn={class:`box`},yn={class:`title font-bold`},bn={class:`task`},xn={class:`left`},Sn={key:2,class:`duration`},Cn={class:`info`},wn={class:`title`},Tn={class:`style`};function En(e,t,n,i,s,c){let d=f(`el-image`),_=f(`video-pause`),v=f(`el-icon`),y=f(`video-play`),b=h(`loading`);return u(),p(`div`,_n,[r(`div`,vn,[r(`h2`,yn,l(e.$t(`suno.name.cover`)),1)]),r(`div`,bn,[e.audio?(u(),p(`div`,{key:0,class:`audio`,onClick:t[2]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,xn,[a(d,{src:e.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`playing`?(u(),p(`div`,{key:0,class:`overlay`,onClick:t[0]||=t=>e.onPause(e.audio)},[a(v,null,{default:m(()=>[a(_)]),_:1})])):o(``,!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`paused`)?(u(),p(`div`,{key:1,class:`overlay`,onClick:t[1]||=t=>e.onPlay(e.audio)},[a(v,null,{default:m(()=>[a(y)]),_:1})])):o(``,!0),e.audio?.duration?(u(),p(`div`,Sn,l(e.useFormatDuring(e.audio?.duration)),1)):o(``,!0)])),[[b,!e.audio?.audio_url]]),r(`div`,Cn,[r(`h2`,wn,l(e.audio?.title),1),r(`p`,Tn,l(e.audio?.style),1)])])):o(``,!0)])])}var Dn=G(gn,[[`render`,En],[`__scopeId`,`data-v-06640216`]]),On=s({name:`VocalGenderSelector`,components:{ElRadioGroup:R,ElRadioButton:L,InfoIcon:Q},computed:{vocalGender:{get(){return this.$store.state.suno?.config?.vocal_gender||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,vocal_gender:e||void 0})}}}}),kn={class:`flex items-center mb-1`},An={class:`text-sm font-bold`};function jn(e,t,n,o,s,c){let d=f(`info-icon`),h=f(`el-radio-button`),g=f(`el-radio-group`);return u(),p(`div`,null,[r(`div`,kn,[r(`span`,An,l(e.$t(`suno.name.vocalGender`)),1),a(d,{content:e.$t(`suno.description.vocalGender`)},null,8,[`content`])]),a(g,{modelValue:e.vocalGender,"onUpdate:modelValue":t[0]||=t=>e.vocalGender=t,size:`small`},{default:m(()=>[a(h,{value:``},{default:m(()=>[i(l(e.$t(`suno.gender.auto`)),1)]),_:1}),a(h,{value:`f`},{default:m(()=>[i(l(e.$t(`suno.gender.female`)),1)]),_:1}),a(h,{value:`m`},{default:m(()=>[i(l(e.$t(`suno.gender.male`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var Mn=G(On,[[`render`,jn]]),Nn=s({name:`AdvancedParams`,components:{ElCollapse:ne,ElCollapseItem:te,ElInput:W,ElSlider:ce,ElRadioGroup:R,ElRadioButton:L},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.suno?.config},isV5OrAbove(){let e=this.config?.model||``;return[`chirp-v5`,`chirp-v5-5`].includes(e)},styleNegative:{get(){return this.$store.state.suno?.config?.style_negative||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style_negative:e||void 0})}},lyricPrompt:{get(){return this.$store.state.suno?.config?.lyric_prompt||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric_prompt:e||void 0})}},weirdness:{get(){return this.$store.state.suno?.config?.weirdness??0},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,weirdness:e||void 0})}},styleInfluence:{get(){return this.$store.state.suno?.config?.style_influence??.5},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style_influence:e})}},variationCategory:{get(){return this.$store.state.suno?.config?.variation_category||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,variation_category:e||void 0})}},audioWeight:{get(){return this.$store.state.suno?.config?.audio_weight??.5},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,audio_weight:e})}},lyricsMode:{get(){return this.$store.state.suno?.config?.lyrics_mode||`manual`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyrics_mode:e})}}},mounted(){let e=this.$store.state.suno?.config;if(!e)return;let t={};typeof e.weirdness==`number`&&e.weirdness>1&&(t.weirdness=e.weirdness/100),typeof e.style_influence==`number`&&e.style_influence>1&&(t.style_influence=e.style_influence/100),typeof e.audio_weight==`number`&&e.audio_weight>1&&(t.audio_weight=e.audio_weight/100),Object.keys(t).length>0&&this.$store.commit(`suno/setConfig`,{...e,...t})}}),Pn={key:0,class:`mb-3`},Fn={class:`flex items-center mb-1`},In={class:`text-xs font-bold`},Ln={key:1,class:`mb-3`},Rn={class:`flex items-center mb-1`},zn={class:`text-xs font-bold`},Bn={key:2,class:`mb-3`},Vn={class:`flex items-center justify-between mb-1`},Hn={class:`text-xs font-bold`},Un={class:`text-xs text-[var(--el-text-color-secondary)]`},Wn={key:3,class:`mb-3`},Gn={class:`flex items-center justify-between mb-1`},Kn={class:`text-xs font-bold`},qn={class:`text-xs text-[var(--el-text-color-secondary)]`},Jn={key:4,class:`mb-3`},Yn={class:`flex items-center mb-1`},Xn={class:`text-xs font-bold`},Zn={key:5,class:`mb-3`},Qn={class:`flex items-center justify-between mb-1`},$n={class:`text-xs font-bold`},er={class:`text-xs text-[var(--el-text-color-secondary)]`},tr={key:6,class:`mb-3`},nr={class:`flex items-center mb-1`},rr={class:`text-xs font-bold`};function ir(e,t,s,c,d,h){let g=f(`el-input`),_=f(`el-slider`),v=f(`el-radio-button`),y=f(`el-radio-group`),b=f(`el-collapse-item`),x=f(`el-collapse`);return u(),n(x,{modelValue:e.activeNames,"onUpdate:modelValue":t[7]||=t=>e.activeNames=t,class:`advanced-collapse`},{default:m(()=>[a(b,{title:e.$t(`suno.name.advancedParams`),name:`advanced`},{default:m(()=>[e.config?.custom?(u(),p(`div`,Pn,[r(`div`,Fn,[r(`span`,In,l(e.$t(`suno.name.styleNegative`)),1)]),a(g,{modelValue:e.styleNegative,"onUpdate:modelValue":t[0]||=t=>e.styleNegative=t,size:`small`,placeholder:e.$t(`suno.placeholder.styleNegative`)},null,8,[`modelValue`,`placeholder`])])):o(``,!0),e.config?.custom&&!e.config?.instrumental?(u(),p(`div`,Ln,[r(`div`,Rn,[r(`span`,zn,l(e.$t(`suno.name.lyricPrompt`)),1)]),a(g,{modelValue:e.lyricPrompt,"onUpdate:modelValue":t[1]||=t=>e.lyricPrompt=t,size:`small`,placeholder:e.$t(`suno.placeholder.lyricPrompt`)},null,8,[`modelValue`,`placeholder`])])):o(``,!0),e.config?.custom?(u(),p(`div`,Bn,[r(`div`,Vn,[r(`span`,Hn,l(e.$t(`suno.name.weirdness`)),1),r(`span`,Un,l(e.weirdness??0),1)]),a(_,{modelValue:e.weirdness,"onUpdate:modelValue":t[2]||=t=>e.weirdness=t,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),e.config?.custom?(u(),p(`div`,Wn,[r(`div`,Gn,[r(`span`,Kn,l(e.$t(`suno.name.styleInfluence`)),1),r(`span`,qn,l(e.styleInfluence??.5),1)]),a(_,{modelValue:e.styleInfluence,"onUpdate:modelValue":t[3]||=t=>e.styleInfluence=t,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),e.isV5OrAbove?(u(),p(`div`,Jn,[r(`div`,Yn,[r(`span`,Xn,l(e.$t(`suno.name.variationCategory`)),1)]),a(y,{modelValue:e.variationCategory,"onUpdate:modelValue":t[4]||=t=>e.variationCategory=t,size:`small`},{default:m(()=>[a(v,{value:``},{default:m(()=>[i(l(e.$t(`suno.gender.auto`)),1)]),_:1}),a(v,{value:`high`},{default:m(()=>[i(l(e.$t(`suno.variation.high`)),1)]),_:1}),a(v,{value:`low`},{default:m(()=>[i(l(e.$t(`suno.variation.low`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0),e.config?.action===`cover`?(u(),p(`div`,Zn,[r(`div`,Qn,[r(`span`,$n,l(e.$t(`suno.name.audioWeight`)),1),r(`span`,er,l(e.audioWeight??.5),1)]),a(_,{modelValue:e.audioWeight,"onUpdate:modelValue":t[5]||=t=>e.audioWeight=t,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),e.config?.custom&&!e.config?.instrumental?(u(),p(`div`,tr,[r(`div`,nr,[r(`span`,rr,l(e.$t(`suno.name.lyricsMode`)),1)]),a(y,{modelValue:e.lyricsMode,"onUpdate:modelValue":t[6]||=t=>e.lyricsMode=t,size:`small`},{default:m(()=>[a(v,{value:`manual`},{default:m(()=>[i(l(e.$t(`suno.lyricsMode.manual`)),1)]),_:1}),a(v,{value:`auto`},{default:m(()=>[i(l(e.$t(`suno.lyricsMode.auto`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0)]),_:1},8,[`title`])]),_:1},8,[`modelValue`])}var ar=G(Nn,[[`render`,ir],[`__scopeId`,`data-v-363599d3`]]),or=s({name:`ReplaceSectionInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},replaceSectionStart:{get(){return this.$store.state.suno?.config?.replace_section_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,replace_section_start:e})}},replaceSectionEnd:{get(){return this.$store.state.suno?.config?.replace_section_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,replace_section_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),sr={class:`field`},cr={class:`flex items-center mb-2`},lr={class:`text-sm font-bold m-0`},ur={key:0,class:`task mb-2`},dr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},fr={class:`info flex-1 min-w-0`},pr={class:`text-sm font-bold m-0 truncate`},mr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},hr={class:`flex gap-2`};function gr(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,sr,[r(`div`,cr,[r(`h2`,lr,l(e.$t(`suno.name.replaceSection`)),1),a(d,{content:e.$t(`suno.description.replaceSection`)},null,8,[`content`])]),e.audio?(u(),p(`div`,ur,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,dr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,fr,[r(`h2`,pr,l(e.audio?.title),1),r(`p`,mr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,hr,[a(_,{modelValue:e.replaceSectionStart,"onUpdate:modelValue":t[1]||=t=>e.replaceSectionStart=t,class:`flex-1`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.replaceSectionStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.replaceSectionEnd,"onUpdate:modelValue":t[2]||=t=>e.replaceSectionEnd=t,class:`flex-1`,min:e.replaceSectionStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.replaceSectionEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var _r=G(or,[[`render`,gr]]),vr=s({name:`OverpaintingInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},overpaintingStart:{get(){return this.$store.state.suno?.config?.overpainting_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,overpainting_start:e})}},overpaintingEnd:{get(){return this.$store.state.suno?.config?.overpainting_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,overpainting_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),yr={class:`field`},br={class:`flex items-center mb-2`},xr={class:`text-sm font-bold m-0`},Sr={key:0,class:`task mb-2`},Cr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},wr={class:`info flex-1 min-w-0`},Tr={class:`text-sm font-bold m-0 truncate`},Er={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Dr={class:`flex gap-2`};function Or(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,yr,[r(`div`,br,[r(`h2`,xr,l(e.$t(`suno.name.overpaintingRange`)),1),a(d,{content:e.$t(`suno.description.overpainting`)},null,8,[`content`])]),e.audio?(u(),p(`div`,Sr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,Cr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,wr,[r(`h2`,Tr,l(e.audio?.title),1),r(`p`,Er,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,Dr,[a(_,{modelValue:e.overpaintingStart,"onUpdate:modelValue":t[1]||=t=>e.overpaintingStart=t,class:`flex-1`,size:`small`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.overpaintingStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.overpaintingEnd,"onUpdate:modelValue":t[2]||=t=>e.overpaintingEnd=t,class:`flex-1`,size:`small`,min:e.overpaintingStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.overpaintingEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var kr=G(vr,[[`render`,Or]]),Ar=s({name:`UnderpaintingInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},underpaintingStart:{get(){return this.$store.state.suno?.config?.underpainting_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,underpainting_start:e})}},underpaintingEnd:{get(){return this.$store.state.suno?.config?.underpainting_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,underpainting_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),jr={class:`field`},Mr={class:`flex items-center mb-2`},Nr={class:`text-sm font-bold m-0`},Pr={key:0,class:`task mb-2`},Fr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Ir={class:`info flex-1 min-w-0`},Lr={class:`text-sm font-bold m-0 truncate`},Rr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},zr={class:`flex gap-2`};function Br(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,jr,[r(`div`,Mr,[r(`h2`,Nr,l(e.$t(`suno.name.underpaintingRange`)),1),a(d,{content:e.$t(`suno.description.underpainting`)},null,8,[`content`])]),e.audio?(u(),p(`div`,Pr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,Fr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,Ir,[r(`h2`,Lr,l(e.audio?.title),1),r(`p`,Rr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,zr,[a(_,{modelValue:e.underpaintingStart,"onUpdate:modelValue":t[1]||=t=>e.underpaintingStart=t,class:`flex-1`,size:`small`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.underpaintingStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.underpaintingEnd,"onUpdate:modelValue":t[2]||=t=>e.underpaintingEnd=t,class:`flex-1`,size:`small`,min:e.underpaintingStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.underpaintingEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var Vr=G(Ar,[[`render`,Br]]),Hr=s({name:`SamplesInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},samplesStart:{get(){return this.$store.state.suno?.config?.samples_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,samples_start:e})}},samplesEnd:{get(){return this.$store.state.suno?.config?.samples_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,samples_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),Ur={class:`field`},Wr={class:`flex items-center mb-2`},Gr={class:`text-sm font-bold m-0`},Kr={key:0,class:`task mb-2`},qr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Jr={class:`info flex-1 min-w-0`},Yr={class:`text-sm font-bold m-0 truncate`},Xr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Zr={class:`flex gap-2`};function Qr(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,Ur,[r(`div`,Wr,[r(`h2`,Gr,l(e.$t(`suno.name.samplesRange`)),1),a(d,{content:e.$t(`suno.description.samples`)},null,8,[`content`])]),e.audio?(u(),p(`div`,Kr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,qr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,Jr,[r(`h2`,Yr,l(e.audio?.title),1),r(`p`,Xr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,Zr,[a(_,{modelValue:e.samplesStart,"onUpdate:modelValue":t[1]||=t=>e.samplesStart=t,class:`flex-1`,size:`small`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.samplesStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.samplesEnd,"onUpdate:modelValue":t[2]||=t=>e.samplesEnd=t,class:`flex-1`,size:`small`,min:e.samplesStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.samplesEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var $r=G(Hr,[[`render`,Qr]]),ei=[.5,.75,1,1.25,1.5,2],ti=s({name:`AdjustSpeedInput`,components:{ElRadioGroup:R,ElRadioButton:L,ElImage:P,InfoIcon:Q},data(){return{options:ei}},computed:{audio(){return this.$store.state.suno?.config?.audio},speed:{get(){let e=this.$store.state.suno?.config?.speed;return typeof e==`number`?e:1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,speed:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),ni={class:`field`},ri={class:`flex items-center mb-2`},ii={class:`text-sm font-bold m-0`},ai={key:0,class:`task mb-2`},oi={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},si={class:`info flex-1 min-w-0`},ci={class:`text-sm font-bold m-0 truncate`},li={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`};function ui(e,t,s,d,_,y){let b=f(`info-icon`),x=f(`el-image`),S=f(`el-radio-button`),C=f(`el-radio-group`),w=h(`loading`);return u(),p(`div`,ni,[r(`div`,ri,[r(`h2`,ii,l(e.$t(`suno.name.adjustSpeed`)),1),a(b,{content:e.$t(`suno.description.adjustSpeed`)},null,8,[`content`])]),e.audio?(u(),p(`div`,ai,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,oi,[a(x,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[w,!e.audio?.audio_url]]),r(`div`,si,[r(`h2`,ci,l(e.audio?.title),1),r(`p`,li,l(e.audio?.style),1)])])])):o(``,!0),a(C,{modelValue:e.speed,"onUpdate:modelValue":t[1]||=t=>e.speed=t,size:`small`,class:`speed-group`},{default:m(()=>[(u(!0),p(v,null,c(e.options,e=>(u(),n(S,{key:e,value:e},{default:m(()=>[i(l(e)+`x`,1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])])}var di=G(ti,[[`render`,ui],[`__scopeId`,`data-v-ba834628`]]),fi=s({name:`VoiceCreateDialog`,components:{ElDialog:Y,ElForm:j,ElFormItem:A,ElInput:W,ElButton:b,ElRadioGroup:R,ElRadio:ee},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{sourceType:`song`,form:{name:``,description:``,audio_id:``,audio_url:``},loading:!1}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit(`update:modelValue`,e)}},token(){return this.$store.state.suno?.credential?.token},canSubmit(){return!(!this.form.name||this.sourceType===`song`&&!this.form.audio_id||this.sourceType===`upload`&&!this.form.audio_url)}},methods:{onClose(){this.visible=!1,this.resetForm()},resetForm(){this.form={name:``,description:``,audio_id:``,audio_url:``},this.sourceType=`song`},async onSubmit(){if(this.token){this.loading=!0;try{this.sourceType===`song`?await K.persona({audio_id:this.form.audio_id,name:this.form.name,description:this.form.description},{token:this.token}):await K.voices({audio_url:this.form.audio_url,name:this.form.name,description:this.form.description},{token:this.token}),X.success(this.$t(`suno.voice.createSuccess`)),this.$emit(`created`),this.onClose()}catch{X.error(this.$t(`suno.voice.createFailed`))}finally{this.loading=!1}}}}});function pi(e,t,r,s,c,d){let p=f(`el-input`),h=f(`el-form-item`),g=f(`el-radio`),_=f(`el-radio-group`),v=f(`el-form`),y=f(`el-button`),b=f(`el-dialog`);return u(),n(b,{modelValue:e.visible,"onUpdate:modelValue":t[5]||=t=>e.visible=t,title:e.$t(`suno.voice.createTitle`),width:`480px`,"close-on-click-modal":!1,onClose:e.onClose},{footer:m(()=>[a(y,{onClick:e.onClose},{default:m(()=>[i(l(e.$t(`common.button.cancel`)),1)]),_:1},8,[`onClick`]),a(y,{type:`primary`,loading:e.loading,disabled:!e.canSubmit,onClick:e.onSubmit},{default:m(()=>[i(l(e.$t(`suno.voice.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:m(()=>[a(v,{"label-position":`top`,class:`voice-create-form`},{default:m(()=>[a(h,{label:e.$t(`suno.voice.name`)},{default:m(()=>[a(p,{modelValue:e.form.name,"onUpdate:modelValue":t[0]||=t=>e.form.name=t,placeholder:e.$t(`suno.voice.namePlaceholder`),maxlength:`50`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),a(h,{label:e.$t(`suno.voice.description`)},{default:m(()=>[a(p,{modelValue:e.form.description,"onUpdate:modelValue":t[1]||=t=>e.form.description=t,type:`textarea`,rows:2,placeholder:e.$t(`suno.voice.descriptionPlaceholder`),maxlength:`200`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),a(h,{label:e.$t(`suno.voice.sourceType`)},{default:m(()=>[a(_,{modelValue:e.sourceType,"onUpdate:modelValue":t[2]||=t=>e.sourceType=t,class:`w-full`},{default:m(()=>[a(g,{value:`song`},{default:m(()=>[i(l(e.$t(`suno.voice.fromSong`)),1)]),_:1}),a(g,{value:`upload`},{default:m(()=>[i(l(e.$t(`suno.voice.fromUpload`)),1)]),_:1})]),_:1},8,[`modelValue`])]),_:1},8,[`label`]),e.sourceType===`song`?(u(),n(h,{key:0,label:e.$t(`suno.voice.audioId`)},{default:m(()=>[a(p,{modelValue:e.form.audio_id,"onUpdate:modelValue":t[3]||=t=>e.form.audio_id=t,placeholder:e.$t(`suno.voice.audioIdPlaceholder`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):o(``,!0),e.sourceType===`upload`?(u(),n(h,{key:1,label:e.$t(`suno.voice.audioUrl`)},{default:m(()=>[a(p,{modelValue:e.form.audio_url,"onUpdate:modelValue":t[4]||=t=>e.form.audio_url=t,placeholder:e.$t(`suno.voice.audioUrlPlaceholder`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):o(``,!0)]),_:1})]),_:1},8,[`modelValue`,`title`,`onClose`])}var mi=s({name:`VoiceManager`,components:{ElButton:b,ElIcon:w,ElTabs:O,ElTabPane:k,ElTooltip:N,Loading:x,FontAwesomeIcon:Z,VoiceCreateDialog:G(fi,[[`render`,pi]])},data(){return{showCreateDialog:!1,loading:!1,deletingId:null,activeTab:`all`}},computed:{personas(){return this.$store.state.suno?.personas||[]},favoriteIds(){return this.$store.state.suno?.favoritePersonaIds||[]},favoritePersonas(){return this.personas.filter(e=>e.persona_id&&this.favoriteIds.includes(e.persona_id))},visiblePersonas(){return this.activeTab===`favorites`?this.favoritePersonas:this.personas},selectedPersonaId(){return this.$store.state.suno?.config?.persona_id}},watch:{"$store.state.suno.credential":{handler(){this.loadPersonas()},immediate:!0}},methods:{isFavorite(e){return!!e&&this.favoriteIds.includes(e)},onToggleFavorite(e){e.persona_id&&this.$store.commit(`suno/togglePersonaFavorite`,e.persona_id)},async loadPersonas(){if(this.$store.state.suno?.credential?.token){this.loading=!0;try{await this.$store.dispatch(`suno/getPersonas`)}finally{this.loading=!1}}},selectPersona(e){let t={...this.$store.state.suno?.config};t.persona_id===e.persona_id?t.persona_id=void 0:t.persona_id=e.persona_id,this.$store.dispatch(`suno/setConfig`,t)},async onDelete(e){try{await q.confirm(this.$t(`suno.voice.confirmDelete`),this.$t(`suno.voice.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.confirm`),cancelButtonText:this.$t(`common.button.cancel`)})}catch{return}if(!e.persona_id)return;this.deletingId=e.persona_id;let t=await this.$store.dispatch(`suno/deletePersona`,e.persona_id);if(this.deletingId=null,t){if(X.success(this.$t(`suno.voice.deleteSuccess`)),this.selectedPersonaId===e.persona_id){let e={...this.$store.state.suno?.config,persona_id:void 0};this.$store.dispatch(`suno/setConfig`,e)}this.favoriteIds.includes(e.persona_id)&&this.$store.commit(`suno/togglePersonaFavorite`,e.persona_id)}else X.error(this.$t(`suno.voice.deleteFailed`))},async onCreated(){await this.loadPersonas()}}}),hi={class:`voice-manager`},gi={class:`flex items-center justify-between mb-3`},_i={class:`text-sm font-medium`},vi={key:0,class:`text-center py-6`},yi={key:1,class:`text-center py-6 text-gray-400 text-sm`},bi={key:2,class:`voice-list`},xi=[`onClick`],Si={class:`flex-1 min-w-0`},Ci={class:`voice-name`},wi={key:0,class:`voice-desc`};function Ti(e,n,s,d,h,g){let _=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-tab-pane`),S=f(`el-tabs`),C=f(`loading`),w=f(`el-icon`),T=f(`el-tooltip`),E=f(`voice-create-dialog`);return u(),p(`div`,hi,[r(`div`,gi,[r(`span`,_i,l(e.$t(`suno.voice.title`)),1),a(b,{type:`primary`,size:`small`,onClick:n[0]||=t=>e.showCreateDialog=!0},{default:m(()=>[a(_,{icon:`fa-solid fa-plus`,class:`mr-1`}),i(` `+l(e.$t(`suno.voice.create`)),1)]),_:1})]),a(S,{modelValue:e.activeTab,"onUpdate:modelValue":n[1]||=t=>e.activeTab=t,class:`voice-tabs`,size:`small`},{default:m(()=>[a(x,{name:`all`,label:e.$t(`suno.voice.tabAll`)+` (`+(e.personas?.length||0)+`)`},null,8,[`label`]),a(x,{name:`favorites`,label:e.$t(`suno.voice.tabFavorites`)+` (`+e.favoritePersonas.length+`)`},null,8,[`label`])]),_:1},8,[`modelValue`]),e.loading?(u(),p(`div`,vi,[a(w,{class:`is-loading`},{default:m(()=>[a(C)]),_:1})])):e.visiblePersonas.length===0?(u(),p(`div`,yi,l(e.activeTab===`favorites`?e.$t(`suno.voice.emptyFavorites`):e.$t(`suno.voice.empty`)),1)):(u(),p(`div`,bi,[(u(!0),p(v,null,c(e.visiblePersonas,s=>(u(),p(`div`,{key:s.persona_id,class:t([`voice-item`,{active:e.selectedPersonaId===s.persona_id}]),onClick:t=>e.selectPersona(s)},[r(`div`,Si,[r(`div`,Ci,[a(_,{icon:s.source_type===`voice`?`fa-solid fa-microphone`:`fa-solid fa-music`,class:`mr-1.5 text-xs opacity-60`},null,8,[`icon`]),i(` `+l(s.name||s.persona_id),1)]),s.description?(u(),p(`div`,wi,l(s.description),1)):o(``,!0)]),r(`div`,{class:`voice-actions`,onClick:n[2]||=y(()=>{},[`stop`])},[a(T,{content:e.isFavorite(s.persona_id)?e.$t(`suno.voice.unfavorite`):e.$t(`suno.voice.favorite`),placement:`top`},{default:m(()=>[a(b,{size:`small`,text:``,class:t({"voice-fav-active":e.isFavorite(s.persona_id)}),onClick:t=>e.onToggleFavorite(s)},{default:m(()=>[a(_,{icon:e.isFavorite(s.persona_id)?`fa-solid fa-star`:`fa-regular fa-star`},null,8,[`icon`])]),_:2},1032,[`class`,`onClick`])]),_:2},1032,[`content`]),a(b,{type:`danger`,size:`small`,text:``,loading:e.deletingId===s.persona_id,onClick:t=>e.onDelete(s)},{default:m(()=>[a(_,{icon:`fa-solid fa-trash`})]),_:1},8,[`loading`,`onClick`])])],10,xi))),128))])),a(E,{modelValue:e.showCreateDialog,"onUpdate:modelValue":n[3]||=t=>e.showCreateDialog=t,onCreated:e.onCreated},null,8,[`modelValue`,`onCreated`])])}var Ei=s({name:`PersonaInput`,components:{ElSelect:E,ElOption:D,ElButton:b,ElDrawer:z,FontAwesomeIcon:Z,InfoIcon:Q,VoiceManager:G(mi,[[`render`,Ti],[`__scopeId`,`data-v-8b8e36d9`]])},data(){return{showManager:!1}},computed:{personaId:{get(){return this.$store.state.suno?.config?.persona_id||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,persona_id:e||void 0})}},personas(){return this.$store.state.suno?.personas||[]}}}),Di={class:`field`},Oi={class:`flex items-center justify-between mb-2`},ki={class:`flex items-center`},Ai={class:`text-sm font-bold`},ji={class:`flex items-center justify-between w-full`},Mi={key:0,class:`text-xs text-gray-400 ml-2`};function Ni(e,t,s,d,h,g){let _=f(`info-icon`),y=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-option`),S=f(`el-select`),C=f(`voice-manager`),w=f(`el-drawer`);return u(),p(`div`,Di,[r(`div`,Oi,[r(`div`,ki,[r(`span`,Ai,l(e.$t(`suno.name.persona`)),1),a(_,{content:e.$t(`suno.description.persona`)},null,8,[`content`])]),a(b,{size:`small`,round:``,onClick:t[0]||=t=>e.showManager=!0},{default:m(()=>[a(y,{icon:`fa-solid fa-microphone`,class:`mr-1`}),i(` `+l(e.$t(`suno.voice.manage`)),1)]),_:1})]),a(S,{modelValue:e.personaId,"onUpdate:modelValue":t[1]||=t=>e.personaId=t,placeholder:e.$t(`suno.placeholder.personaId`),clearable:``,filterable:``,class:`w-full`},{default:m(()=>[(u(!0),p(v,null,c(e.personas,e=>(u(),n(x,{key:e.persona_id||``,value:e.persona_id||``,label:e.name||e.persona_id||``},{default:m(()=>[r(`div`,ji,[r(`span`,null,l(e.name||e.persona_id),1),e.source_type?(u(),p(`span`,Mi,l(e.source_type),1)):o(``,!0)])]),_:2},1032,[`value`,`label`]))),128))]),_:1},8,[`modelValue`,`placeholder`]),a(w,{modelValue:e.showManager,"onUpdate:modelValue":t[2]||=t=>e.showManager=t,title:e.$t(`suno.voice.title`),size:`380px`,direction:`rtl`},{default:m(()=>[a(C)]),_:1},8,[`modelValue`,`title`])])}var Pi=s({name:`PresetPanel`,components:{TypeSelector:We,PromptInput:xt,LyricInput:Ft,StyleInput:Yt,TitleInput:tn,ExtendFromInput:hn,CoverFromInput:Dn,UploadAudio:pt,VocalGenderSelector:Mn,AdvancedParams:ar,ReplaceSectionInput:_r,OverpaintingInput:kr,UnderpaintingInput:Vr,SamplesInput:$r,AdjustSpeedInput:di,PersonaInput:G(Ei,[[`render`,Ni]]),FontAwesomeIcon:Z,ElButton:b,ElTabs:O,ElTabPane:k,Consumption:Ce},emits:[`generate`],computed:{config(){return this.$store.state.suno?.config},mode:{get(){return this.$store.state.suno?.config?.custom?`custom`:`simple`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,custom:e===`custom`})}},consumption(){return pe(this.config,this.service?.cost)},service(){return this.$store.state.suno?.service},supportsVocalGender(){let e=this.config?.model||``;return[`chirp-v4-5-plus`,`chirp-v5`,`chirp-v5-5`].includes(e)},supportsPersona(){let e=this.config?.action;return!e||e===`generate`||e===`artist_consistency`||e===`artist_consistency_vox`},generateButtonText(){let e=this.config?.action;return e===`extend`?this.$t(`suno.button.extend`):e===`cover`?this.$t(`suno.button.cover_music`):e===`remaster`?this.$t(`suno.button.remaster`):e===`replace_section`?this.$t(`suno.button.replace_section`):e===`mashup`?this.$t(`suno.button.mashup`):e===`stems`?this.$t(`suno.button.get_stems`):e===`concat`?this.$t(`suno.button.concat_music`):e===`upload_cover`?this.$t(`suno.button.upload_cover`):e===`artist_consistency`?this.$t(`suno.button.artist_consistency`):e===`artist_consistency_vox`?this.$t(`suno.button.artist_consistency_vox`):e===`overpainting`?this.$t(`suno.button.overpainting`):e===`underpainting`?this.$t(`suno.button.underpainting`):e===`samples`?this.$t(`suno.button.samples`):e===`adjust_speed`?this.$t(`suno.button.adjust_speed`):this.$t(`suno.button.generate`)}},methods:{onGenerate(){this.$emit(`generate`)},onClearAll(){this.$store.commit(`suno/setConfig`,{custom:!1,sounds:!1,instrumental:!1,lyric:``,style:``,title:``,lyrics_mode:`manual`,model:this.$store.state.suno?.config?.model})}}}),Fi={class:`flex flex-col h-full`},Ii={class:`flex-1 overflow-y-auto p-5`},Li={class:`pt-2 px-1`},Ri={class:`pt-2 px-1`},zi={class:`flex flex-col items-center justify-center px-5 pb-5 gap-2`},Bi={class:`flex gap-2 w-full`};function Vi(e,t,s,c,d,h){let g=f(`type-selector`),_=f(`upload-audio`),v=f(`prompt-input`),y=f(`extend-from-input`),b=f(`cover-from-input`),x=f(`replace-section-input`),S=f(`overpainting-input`),C=f(`underpainting-input`),w=f(`samples-input`),T=f(`adjust-speed-input`),E=f(`advanced-params`),D=f(`el-tab-pane`),O=f(`lyric-input`),k=f(`style-input`),A=f(`title-input`),j=f(`vocal-gender-selector`),M=f(`persona-input`),N=f(`el-tabs`),P=f(`consumption`),F=f(`font-awesome-icon`),I=f(`el-button`);return u(),p(`div`,Fi,[r(`div`,Ii,[a(N,{modelValue:e.mode,"onUpdate:modelValue":t[0]||=t=>e.mode=t,class:`suno-mode-tabs`,stretch:``},{default:m(()=>[a(D,{label:e.$t(`suno.mode.simple`),name:`simple`},{default:m(()=>[r(`div`,Li,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),e.config?.action===`extend`?(u(),n(y,{key:0,class:`mb-4`})):o(``,!0),e.config?.action===`cover`?(u(),n(b,{key:1,class:`mb-4`})):o(``,!0),e.config?.action===`replace_section`?(u(),n(x,{key:2,class:`mb-4`})):o(``,!0),e.config?.action===`overpainting`?(u(),n(S,{key:3,class:`mb-4`})):o(``,!0),e.config?.action===`underpainting`?(u(),n(C,{key:4,class:`mb-4`})):o(``,!0),e.config?.action===`samples`?(u(),n(w,{key:5,class:`mb-4`})):o(``,!0),e.config?.action===`adjust_speed`?(u(),n(T,{key:6,class:`mb-4`})):o(``,!0),a(E,{class:`mb-4`})])]),_:1},8,[`label`]),a(D,{label:e.$t(`suno.mode.custom`),name:`custom`},{default:m(()=>[r(`div`,Ri,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),e.config?.instrumental?o(``,!0):(u(),n(O,{key:0,class:`mb-4`})),a(k,{class:`mb-4`}),a(A,{class:`mb-4`}),!e.config?.instrumental&&e.supportsVocalGender?(u(),n(j,{key:1,class:`mb-4`})):o(``,!0),e.supportsPersona?(u(),n(M,{key:2,class:`mb-4`})):o(``,!0),e.config?.action===`extend`?(u(),n(y,{key:3,class:`mb-4`})):o(``,!0),e.config?.action===`cover`?(u(),n(b,{key:4,class:`mb-4`})):o(``,!0),e.config?.action===`replace_section`?(u(),n(x,{key:5,class:`mb-4`})):o(``,!0),e.config?.action===`overpainting`?(u(),n(S,{key:6,class:`mb-4`})):o(``,!0),e.config?.action===`underpainting`?(u(),n(C,{key:7,class:`mb-4`})):o(``,!0),e.config?.action===`samples`?(u(),n(w,{key:8,class:`mb-4`})):o(``,!0),e.config?.action===`adjust_speed`?(u(),n(T,{key:9,class:`mb-4`})):o(``,!0),a(E,{class:`mb-4`})])]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),r(`div`,zi,[a(P,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),r(`div`,Bi,[a(I,{class:`flex-1`,onClick:e.onClearAll},{default:m(()=>[a(F,{icon:`fa-solid fa-broom`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.clear_all`)),1)]),_:1},8,[`onClick`]),a(I,{type:`primary`,class:`flex-1`,round:``,onClick:e.onGenerate},{default:m(()=>[a(F,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.generateButtonText),1)]),_:1},8,[`onClick`])])])])}var Hi=G(Pi,[[`render`,Vi],[`__scopeId`,`data-v-c62324e6`]]),Ui=we(),Wi=U(`suno`),Gi=s({name:`TaskPreview`,components:{ElImage:P,ElIcon:w,ElTooltip:N,FontAwesomeIcon:Z,VideoPlay:S,VideoPause:C,ElDropdown:re,ElDropdownMenu:V,ElDropdownItem:B,ElInput:W,ElProgress:ae,ElCheckbox:I,Loading:x,ApiCodeDialog:ye},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1,isFetchingMidi:!1,editingAudioId:null,editingTitle:``,apiCodeVisible:!1,apiCodePath:`/suno/audios`,apiCodeBody:{}}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===J.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(e=>({...e,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active},isMashupMode(){return this.$store.state.suno?.config?.action===`mashup`},mashupAudioIds(){return this.$store.state.suno?.config?.mashup_audio_ids||[]}},methods:{useFormatDuring:$,onViewCode(){let e=this.modelValue?.request||{},t={};Object.entries(e).forEach(([e,n])=>{e===`application_id`||e===`callback_url`||n!=null&&(typeof n==`string`&&n===``||Array.isArray(n)&&n.length===0||(t[e]=n))}),this.apiCodeBody=t,this.apiCodePath=`/suno/audios`,this.apiCodeVisible=!0},onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log(`on extend`),console.debug(`set config`,t),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:`extend`,audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log(`on download`,t);let n=new URL(t).pathname,r=n.substring(n.lastIndexOf(`/`)+1);console.log(`on preview`,r),fetch(t).then(e=>e.blob()).then(e=>{(0,Ui.saveAs)(e,r)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;let t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(e){console.error(`get videoUrl failed:`,e),X.error(this.$t(`suno.message.getVideoUrlFailed`))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,n)=>{let r={audio_id:e},i=this.credential?.token;if(!i){console.error(`no token specified`),n(Error(`No token specified`));return}K.mp4(r,{token:i}).then(e=>{let r=e.data?.data?.video_url;r?t(r):n(Error(`Video URL not found in response`))}).catch(e=>{n(e)})})},onPreview(e,t){e.stopPropagation(),console.log(`on preview`,t),window.open(t,`_blank`)},async onGetStems(e){await this.onGenerateAudioUrl(`stems`,e)},onCover(e){console.log(`on cover`),console.debug(`set config`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`cover`,audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl(`concat`,e)},async onRemaster(e){await this.onGenerateAudioUrl(`remaster`,e)},async onGetAllStems(e){await this.onGenerateAudioUrl(`all_stems`,e)},onReplaceSection(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`replace_section`,audio:e,audio_id:e.id,replace_section_start:0,replace_section_end:Math.min(30,e.duration||30)})},onMashup(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`mashup`,audio:e,audio_id:e.id,mashup_audio_ids:[e.id]})},onOverpainting(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`overpainting`,audio:e,audio_id:e.id,overpainting_start:0,overpainting_end:Math.min(30,e.duration||30)})},onUnderpainting(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`underpainting`,audio:e,audio_id:e.id,underpainting_start:0,underpainting_end:Math.min(30,e.duration||30)})},onSamples(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`samples`,audio:e,audio_id:e.id,samples_start:0,samples_end:Math.min(30,e.duration||30)})},onArtistConsistency(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`artist_consistency`,audio:e,audio_id:e.id})},onAdjustSpeed(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`adjust_speed`,audio:e,audio_id:e.id,speed:1})},onReusePrompt(e){let t=this.modelValue?.request??{};if(!(t.prompt||t.lyric||t.style||t.title||t.lyric_prompt||t.style_negative||t.persona_id)){X.warning(this.$t(`suno.message.reusePromptEmpty`));return}this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:t.model??e.model,custom:t.custom??!1,instrumental:t.instrumental??!1,prompt:t.prompt??``,lyric:t.lyric??``,lyric_prompt:t.lyric_prompt??``,lyrics_mode:t.lyrics_mode??`manual`,title:t.title??``,style:t.style??``,style_negative:t.style_negative??``,vocal_gender:t.vocal_gender,weirdness:t.weirdness,style_influence:t.style_influence,variation_category:t.variation_category,audio_weight:t.audio_weight,persona_id:t.persona_id,action:void 0,audio:void 0,audio_id:void 0,mashup_audio_ids:void 0,continue_at:void 0,speed:void 0,replace_section_start:void 0,replace_section_end:void 0,overpainting_start:void 0,overpainting_end:void 0,underpainting_start:void 0,underpainting_end:void 0,samples_start:void 0,samples_end:void 0}),X.success(this.$t(`suno.message.reusePromptSuccess`))},async onExtractVocals(e){let t=this.credential?.token;t&&(X.info(this.$t(`suno.message.extractingVocals`)),K.vox({audio_id:e,callback_url:Wi},{token:t}).then(()=>{X.success(this.$t(`suno.message.extractVocalsSuccess`))}).catch(e=>{X.error(e?.response?.data?.error?.message||this.$t(`suno.message.extractVocalsFailed`))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()}))},async onGetTiming(e){let t=this.credential?.token;t&&(X.info(this.$t(`suno.message.fetchingTiming`)),K.timing({audio_id:e},{token:t}).then(e=>{X.success(this.$t(`suno.message.fetchTimingSuccess`)),console.debug(`timing data`,e.data)}).catch(e=>{X.error(e?.response?.data?.error?.message||this.$t(`suno.message.fetchTimingFailed`))}))},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;let t=this.credential?.token;if(t)try{this.isFetchingWav=!0,X.info(this.$t(`suno.message.fetchingWav`));let n=(await K.wav({audio_id:e.id},{token:t})).data?.data?.[0]?.file_url;n?this.onDownload(null,n):X.error(this.$t(`suno.message.fetchWavFailed`))}catch(e){let t=e?.response?.data?.error?.message;X.error(t||this.$t(`suno.message.fetchWavFailed`))}finally{this.isFetchingWav=!1}},async handleMidiDownload(e){if(!e?.id||this.isFetchingMidi)return;let t=this.credential?.token;if(t)try{this.isFetchingMidi=!0,X.info(this.$t(`suno.message.fetchingMidi`));let n=(await K.midi({audio_id:e.id},{token:t})).data?.data;if(!n?.length){X.error(this.$t(`suno.message.fetchMidiFailed`));return}let r=(e.title||e.id||`suno`).replace(/[^\w.-]+/g,`_`)+`.json`;(0,Ui.saveAs)(new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),r)}catch(e){let t=e?.response?.data?.error?.message;X.error(t||this.$t(`suno.message.fetchMidiFailed`))}finally{this.isFetchingMidi=!1}},async onGenerateAudioUrl(e,t){let n={action:e,audio_id:t,callback_url:Wi},r=this.credential?.token;if(!r){console.error(`no token specified`);return}X.info(this.$t(`suno.message.startingTask`)),K.audio(n,{token:r}).then(()=>{X.success(this.$t(`suno.message.startTaskSuccess`))}).catch(e=>{X.error(e?.response?.data?.error?.message||this.$t(`suno.message.startTaskFailed`))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},isMashupSelected(e){return!!e.id&&this.mashupAudioIds.includes(e.id)},onToggleMashup(e){if(!e.id)return;let t=[...this.mashupAudioIds],n=t.indexOf(e.id);n===-1?t.push(e.id):t.splice(n,1),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,mashup_audio_ids:t})},async onScrollDown(){setTimeout(()=>{let e=document.querySelector(`.tasks`);e&&(e.scrollTop=e.scrollHeight)},1e3)},onStartTitleEdit(e){this.editingAudioId=e.id??null,this.editingTitle=e.title||``,this.$nextTick(()=>{this.$refs.titleInput?.focus?.()})},onSaveTitleEdit(e){if(this.editingAudioId!==e.id)return;let t=this.editingTitle.trim();if(t&&t!==e.title){let n=this.$store.state.suno?.tasks;if(n?.items)for(let r of n.items){let n=(r?.response?.data??[]).find(t=>t.id===e.id);if(n){n.title=t;break}}}this.editingAudioId=null,this.editingTitle=``},onCancelTitleEdit(){this.editingAudioId=null,this.editingTitle=``},async onDelete(e){try{await q.confirm(this.$t(`suno.message.confirmDelete`),{confirmButtonText:this.$t(`suno.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),type:`warning`})}catch{return}let t=this.$store.state.suno?.tasks;if(t?.items)for(let n of t.items){let r=n?.response?.data??[],i=r.findIndex(t=>t.id===e.id);if(i!==-1){if(r.splice(i,1),r.length===0){let e=t.items.indexOf(n);e!==-1&&t.items.splice(e,1)}break}}this.$store.state?.suno?.audio?.id===e.id&&this.$store.dispatch(`suno/setAudio`,null),X.success(this.$t(`suno.message.deleteSuccess`))},async onGetTasks(){if(this.loading){console.debug(`loading`);return}await this.$store.dispatch(`suno/getTasks`,{limit:30,offset:0})}}}),Ki={class:`task`},qi=[`onClick`],Ji=[`onClick`],Yi={class:`left`},Xi=[`onClick`],Zi=[`onClick`],Qi={key:2,class:`duration`},$i={class:`info`},ea={key:1,class:`title-row`},ta={class:`title`},na={class:`style`},ra={key:2,class:`progress-row`},ia={class:`progress-text`},aa={class:`right`},oa={class:`el-dropdown-link`},sa={class:`flex items-center min-w-[120px]`},ca={class:`flex items-center min-w-[120px]`},la={class:`flex items-center min-w-[120px]`},ua={class:`el-dropdown-link`};function da(e,s,d,b,x,S){let C=f(`el-checkbox`),w=f(`el-image`),T=f(`video-pause`),E=f(`el-icon`),D=f(`video-play`),O=f(`el-input`),k=f(`font-awesome-icon`),A=f(`el-progress`),j=f(`el-tooltip`),M=f(`Loading`),N=f(`el-dropdown-item`),P=f(`el-dropdown-menu`),F=f(`el-dropdown`),I=f(`api-code-dialog`),L=h(`loading`);return u(),p(`div`,Ki,[(u(!0),p(v,null,c(e.audios,c=>(u(),p(`div`,{key:c.id,class:t([`audio`,{"mashup-selected":e.isMashupSelected(c)}]),onClick:y(t=>e.onClick(c),[`stop`])},[e.isMashupMode&&c?.audio_url?(u(),p(`div`,{key:0,class:`mashup-check`,onClick:y(t=>e.onToggleMashup(c),[`stop`])},[a(C,{"model-value":e.isMashupSelected(c),onClick:s[0]||=y(()=>{},[`stop`])},null,8,[`model-value`])],8,Ji)):o(``,!0),g((u(),p(`div`,Yi,[a(w,{src:c?.image_url,class:`cover`,fit:`cover`,lazy:``},null,8,[`src`]),c?.audio_url&&e.$store.state?.suno?.audio?.id===c.id&&e.$store.state?.suno?.audio?.state===`playing`?(u(),p(`div`,{key:0,class:`overlay`,onClick:y(t=>e.onPause(c),[`stop`])},[a(E,null,{default:m(()=>[a(T)]),_:1})],8,Xi)):o(``,!0),c?.audio_url&&(e.$store.state?.suno?.audio?.id!==c.id||e.$store.state?.suno?.audio?.id===c.id&&e.$store.state?.suno?.audio?.state===`paused`)?(u(),p(`div`,{key:1,class:`overlay`,onClick:y(t=>e.onPlay(c),[`stop`])},[a(E,null,{default:m(()=>[a(D)]),_:1})],8,Zi)):o(``,!0),c?.duration?(u(),p(`div`,Qi,l(e.useFormatDuring(c?.duration)),1)):o(``,!0)])),[[L,!c?.audio_url]]),r(`div`,$i,[e.editingAudioId===c.id?(u(),p(`div`,{key:0,class:`title-edit`,onClick:s[2]||=y(()=>{},[`stop`])},[a(O,{ref_for:!0,ref:`titleInput`,modelValue:e.editingTitle,"onUpdate:modelValue":s[1]||=t=>e.editingTitle=t,size:`small`,onKeyup:[_(t=>e.onSaveTitleEdit(c),[`enter`]),_(e.onCancelTitleEdit,[`escape`])],onBlur:t=>e.onSaveTitleEdit(c)},null,8,[`modelValue`,`onKeyup`,`onBlur`])])):(u(),p(`div`,ea,[r(`h2`,ta,l(c?.title),1),c?.audio_url?(u(),n(k,{key:0,icon:`fa-solid fa-pen`,class:`edit-icon`,onClick:y(t=>e.onStartTitleEdit(c),[`stop`])},null,8,[`onClick`])):o(``,!0)])),r(`p`,na,l(c?.style),1),!c?.audio_url&&c?.progress!=null&&c?.progress<100?(u(),p(`div`,ra,[a(A,{percentage:Math.round(c.progress),"stroke-width":4,"show-text":!1,status:`warning`,class:`progress-bar`},null,8,[`percentage`]),r(`span`,ia,l(e.$t(`suno.name.generating`))+` `+l(Math.round(c.progress))+`%`,1)])):o(``,!0)]),r(`div`,aa,[a(F,null,{dropdown:m(()=>[a(P,null,{default:m(()=>[a(N,{disabled:e.isFetchingVideoUrl,onClick:t=>e.handleVideoDownload(c)},{default:m(()=>[r(`div`,sa,[e.isFetchingVideoUrl?(u(),n(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(M)]),_:1})):o(``,!0),r(`span`,null,l(e.$t(`suno.button.download_video`)),1)])]),_:1},8,[`disabled`,`onClick`]),c?.audio_url?(u(),n(N,{key:0,onClick:y(t=>e.onDownload(t,c?.audio_url),[`stop`])},{default:m(()=>[i(l(e.$t(`suno.button.download_audio`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(N,{disabled:e.isFetchingWav,onClick:t=>e.handleWavDownload(c)},{default:m(()=>[r(`div`,ca,[e.isFetchingWav?(u(),n(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(M)]),_:1})):o(``,!0),r(`span`,null,l(e.$t(`suno.button.download_wav`)),1)])]),_:1},8,[`disabled`,`onClick`]),a(N,{disabled:e.isFetchingMidi,onClick:t=>e.handleMidiDownload(c)},{default:m(()=>[r(`div`,la,[e.isFetchingMidi?(u(),n(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(M)]),_:1})):o(``,!0),r(`span`,null,l(e.$t(`suno.button.download_midi`)),1)])]),_:1},8,[`disabled`,`onClick`])]),_:2},1024)]),default:m(()=>[r(`span`,oa,[a(j,{effect:`dark`,content:e.$t(`suno.button.download`),placement:`top`},{default:m(()=>[c?.audio_url||c?.video_url?(u(),n(k,{key:0,icon:`fa-solid fa-download`,class:`icon icon-download`})):o(``,!0)]),_:2},1032,[`content`])])]),_:2},1024),a(F,null,{dropdown:m(()=>[a(P,{class:`suno-action-menu`},{default:m(()=>[c?.audio_url?(u(),n(N,{key:0,onClick:y(t=>e.onExtend(t,c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-forward`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.extend`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(N,{onClick:y(t=>e.onCover(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-music`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.cover_music`)),1)]),_:1},8,[`onClick`]),c?.id?(u(),n(N,{key:1,onClick:y(t=>e.onMashup(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-shuffle`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.mashup`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id&&c?.action===`extend`?(u(),n(N,{key:2,onClick:y(t=>e.onConcatMusic(c?.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-link`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.concat_music`)),1)]),_:1},8,[`onClick`])):o(``,!0),s[4]||=r(`div`,{class:`menu-divider`},null,-1),c?.id?(u(),n(N,{key:3,onClick:y(t=>e.onReplaceSection(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-scissors`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.replace_section`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:4,onClick:y(t=>e.onOverpainting(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-microphone`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.overpainting`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:5,onClick:y(t=>e.onUnderpainting(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-guitar`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.underpainting`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:6,onClick:y(t=>e.onSamples(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-drum`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.samples`)),1)]),_:1},8,[`onClick`])):o(``,!0),s[5]||=r(`div`,{class:`menu-divider`},null,-1),c.id?(u(),n(N,{key:7,onClick:y(t=>e.onGetStems(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-layer-group`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.get_stems`)),1)]),_:1},8,[`onClick`])):o(``,!0),c.id?(u(),n(N,{key:8,onClick:y(t=>e.onGetAllStems(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-bars-staggered`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.all_stems`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:9,onClick:y(t=>e.onRemaster(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-wand-magic-sparkles`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.remaster`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:10,onClick:y(t=>e.onExtractVocals(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-headphones`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.extract_vocals`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:11,onClick:y(t=>e.onArtistConsistency(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-palette`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.artist_consistency`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:12,onClick:y(t=>e.onAdjustSpeed(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-gauge-high`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.adjust_speed`)),1)]),_:1},8,[`onClick`])):o(``,!0),s[6]||=r(`div`,{class:`menu-divider`},null,-1),a(N,{onClick:y(t=>e.onReusePrompt(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-rotate-left`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.reuse_prompt`)),1)]),_:1},8,[`onClick`]),c?.id?(u(),n(N,{key:13,onClick:y(t=>e.onGetTiming(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-clock`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.get_timing`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(N,{onClick:y(e.onViewCode,[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-code`,class:`menu-icon`}),i(` `+l(e.$t(`common.button.viewCode`)),1)]),_:1},8,[`onClick`]),s[7]||=r(`div`,{class:`menu-divider`},null,-1),c?.id?(u(),n(N,{key:14,class:`delete-item`,onClick:y(t=>e.onDelete(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-trash`,class:`menu-icon delete-icon`}),i(` `+l(e.$t(`suno.button.delete`)),1)]),_:1},8,[`onClick`])):o(``,!0)]),_:2},1024)]),default:m(()=>[r(`span`,ua,[a(j,{effect:`dark`,content:e.$t(`suno.button.more`),placement:`top`},{default:m(()=>[c?.audio_url||c?.video_url?(u(),n(k,{key:0,icon:`fa-solid fa-ellipsis`,class:`icon icon-ellipsis`})):o(``,!0)]),_:2},1032,[`content`])])]),_:2},1024)])],10,qi))),128)),a(I,{visible:e.apiCodeVisible,"onUpdate:visible":s[3]||=t=>e.apiCodeVisible=t,method:`POST`,path:e.apiCodePath,body:e.apiCodeBody,token:e.$store.state.suno?.credential?.token||``},null,8,[`visible`,`path`,`body`,`token`])])}var fa=s({name:`RecentPanel`,components:{ElSkeletonItem:oe,ElSkeleton:se,ElInput:W,ElButton:b,ElDropdown:re,ElDropdownMenu:V,ElDropdownItem:B,ElPopover:ie,ElRadioGroup:R,ElRadioButton:L,ElSelect:E,ElOption:D,FontAwesomeIcon:Z,TaskPreview:G(Gi,[[`render`,da]]),Player:Te,NoTasks:Se,ScrollList:ve},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0,searchQuery:``,sortBy:`newest`,filterType:`all`,filterDuration:`all`,filterVideo:`all`,filterModel:`all`}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}},sortLabel(){return this.sortBy===`newest`?this.$t(`suno.sort.newest`):this.$t(`suno.sort.oldest`)},activeFilterCount(){let e=0;return this.filterType!==`all`&&e++,this.filterDuration!==`all`&&e++,this.filterVideo!==`all`&&e++,this.filterModel&&this.filterModel!==`all`&&e++,e},availableModels(){let e=this.tasks?.items||[],t=new Set;for(let n of e){let e=n?.response?.data??[];for(let n of e)n.model&&t.add(n.model)}return Array.from(t).sort()},filteredTasks(){let e=this.tasks?.items||[];if(this.searchQuery){let t=this.searchQuery.toLowerCase();e=e.filter(e=>(e?.response?.data??[]).some(e=>e.title?.toLowerCase().includes(t)||e.style?.toLowerCase().includes(t)||e.prompt?.toLowerCase().includes(t)))}return this.activeFilterCount>0&&(e=e.filter(e=>{let t=e?.request??{},n=e?.response?.data??[];return this.filterType===`vocal`&&t.instrumental===!0||this.filterType===`instrumental`&&t.instrumental!==!0?!1:this.filterDuration!==`all`||this.filterVideo!==`all`||this.filterModel&&this.filterModel!==`all`?n.some(e=>!(this.filterDuration===`short`&&!(typeof e.duration==`number`&&e.duration<60)||this.filterDuration===`medium`&&!(typeof e.duration==`number`&&e.duration>=60&&e.duration<=180)||this.filterDuration===`long`&&!(typeof e.duration==`number`&&e.duration>180)||this.filterVideo===`with`&&!e.video_url||this.filterVideo===`without`&&e.video_url||this.filterModel&&this.filterModel!==`all`&&e.model!==this.filterModel)):!0})),this.sortBy===`oldest`&&(e=[...e].reverse()),e}},methods:{onSortChange(e){this.sortBy=e},onResetFilters(){this.filterType=`all`,this.filterDuration=`all`,this.filterVideo=`all`,this.filterModel=`all`},getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),pa={key:0,class:`tasks`},ma={class:`left w-[70px] p-[10px] flex items-center`},ha={class:`main w-[calc(100%-70px)] flex-1 p-[10px]`},ga={key:0,class:`task-toolbar`},_a={key:0,class:`filter-badge`},va={class:`filter-popover`},ya={class:`filter-row`},ba={class:`filter-label`},xa={class:`filter-row`},Sa={class:`filter-label`},Ca={class:`filter-row`},wa={class:`filter-label`},Ta={key:0,class:`filter-row`},Ea={class:`filter-label`},Da={class:`filter-actions`},Oa={key:2,class:`w-full flex-1 flex items-center justify-center`},ka={class:`text-sm text-gray-400`},Aa={key:3,class:`w-full flex-1 flex flex-col items-center justify-center gap-2`},ja={class:`text-sm text-gray-400`},Ma={key:4,class:`w-full flex-1 flex items-center justify-center`},Na={class:`h-20`};function Pa(e,s,h,_,y,b){let x=f(`el-skeleton-item`),S=f(`el-skeleton`),C=f(`font-awesome-icon`),w=f(`el-input`),T=f(`el-button`),E=f(`el-dropdown-item`),D=f(`el-dropdown-menu`),O=f(`el-dropdown`),k=f(`el-radio-button`),A=f(`el-radio-group`),j=f(`el-option`),M=f(`el-select`),N=f(`el-popover`),P=f(`task-preview`),F=f(`scroll-list`),I=f(`no-tasks`),L=f(`player`);return u(),p(v,null,[e.tasks?.items===void 0?(u(),p(`div`,pa,[(u(),p(v,null,c(3,e=>r(`div`,{key:e,class:`flex`},[r(`div`,ma,[a(S,{animated:``},{template:m(()=>[a(x,{variant:`image`,class:`avatar w-[50px] h-[50px]`})]),_:1})]),r(`div`,ha,[a(S,{animated:``},{template:m(()=>[a(x,{variant:`p`,class:`w-[200px] h-[15px] mb-[5px] mt-[10px]`}),a(x,{variant:`text`})]),_:1})])])),64))])):(u(),p(v,{key:1},[e.tasks?.items?.length?(u(),p(`div`,ga,[a(w,{modelValue:e.searchQuery,"onUpdate:modelValue":s[0]||=t=>e.searchQuery=t,size:`small`,placeholder:e.$t(`suno.placeholder.searchSongs`),clearable:``,class:`task-search`},{prefix:m(()=>[a(C,{icon:`fa-solid fa-magnifying-glass`,class:`text-xs`})]),_:1},8,[`modelValue`,`placeholder`]),a(O,{trigger:`click`,onCommand:e.onSortChange},{dropdown:m(()=>[a(D,null,{default:m(()=>[a(E,{command:`newest`,class:t({"is-active":e.sortBy===`newest`})},{default:m(()=>[i(l(e.$t(`suno.sort.newest`)),1)]),_:1},8,[`class`]),a(E,{command:`oldest`,class:t({"is-active":e.sortBy===`oldest`})},{default:m(()=>[i(l(e.$t(`suno.sort.oldest`)),1)]),_:1},8,[`class`])]),_:1})]),default:m(()=>[a(T,{size:`small`,class:`sort-btn`},{default:m(()=>[a(C,{icon:`fa-solid fa-arrow-down-wide-short`,class:`mr-1`}),i(` `+l(e.sortLabel),1)]),_:1})]),_:1},8,[`onCommand`]),a(N,{trigger:`click`,placement:`bottom-end`,width:260},{reference:m(()=>[a(T,{size:`small`,class:t([`filter-btn`,{"has-active-filter":e.activeFilterCount>0}])},{default:m(()=>[a(C,{icon:`fa-solid fa-filter`,class:`mr-1`}),i(` `+l(e.$t(`suno.filter.title`))+` `,1),e.activeFilterCount>0?(u(),p(`span`,_a,l(e.activeFilterCount),1)):o(``,!0)]),_:1},8,[`class`])]),default:m(()=>[r(`div`,va,[r(`div`,ya,[r(`div`,ba,l(e.$t(`suno.filter.type`)),1),a(A,{modelValue:e.filterType,"onUpdate:modelValue":s[1]||=t=>e.filterType=t,size:`small`},{default:m(()=>[a(k,{value:`all`},{default:m(()=>[i(l(e.$t(`suno.filter.typeAll`)),1)]),_:1}),a(k,{value:`vocal`},{default:m(()=>[i(l(e.$t(`suno.filter.typeVocal`)),1)]),_:1}),a(k,{value:`instrumental`},{default:m(()=>[i(l(e.$t(`suno.filter.typeInstrumental`)),1)]),_:1})]),_:1},8,[`modelValue`])]),r(`div`,xa,[r(`div`,Sa,l(e.$t(`suno.filter.duration`)),1),a(A,{modelValue:e.filterDuration,"onUpdate:modelValue":s[2]||=t=>e.filterDuration=t,size:`small`},{default:m(()=>[a(k,{value:`all`},{default:m(()=>[i(l(e.$t(`suno.filter.durationAll`)),1)]),_:1}),a(k,{value:`short`},{default:m(()=>[i(l(e.$t(`suno.filter.durationShort`)),1)]),_:1}),a(k,{value:`medium`},{default:m(()=>[i(l(e.$t(`suno.filter.durationMedium`)),1)]),_:1}),a(k,{value:`long`},{default:m(()=>[i(l(e.$t(`suno.filter.durationLong`)),1)]),_:1})]),_:1},8,[`modelValue`])]),r(`div`,Ca,[r(`div`,wa,l(e.$t(`suno.filter.video`)),1),a(A,{modelValue:e.filterVideo,"onUpdate:modelValue":s[3]||=t=>e.filterVideo=t,size:`small`},{default:m(()=>[a(k,{value:`all`},{default:m(()=>[i(l(e.$t(`suno.filter.videoAll`)),1)]),_:1}),a(k,{value:`with`},{default:m(()=>[i(l(e.$t(`suno.filter.videoWith`)),1)]),_:1}),a(k,{value:`without`},{default:m(()=>[i(l(e.$t(`suno.filter.videoWithout`)),1)]),_:1})]),_:1},8,[`modelValue`])]),e.availableModels.length>0?(u(),p(`div`,Ta,[r(`div`,Ea,l(e.$t(`suno.filter.model`)),1),a(M,{modelValue:e.filterModel,"onUpdate:modelValue":s[4]||=t=>e.filterModel=t,size:`small`,placeholder:e.$t(`suno.filter.modelAll`),clearable:``},{default:m(()=>[a(j,{label:e.$t(`suno.filter.modelAll`),value:`all`},null,8,[`label`]),(u(!0),p(v,null,c(e.availableModels,e=>(u(),n(j,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0),r(`div`,Da,[a(T,{size:`small`,text:``,onClick:e.onResetFilters},{default:m(()=>[i(l(e.$t(`suno.filter.reset`)),1)]),_:1},8,[`onClick`])])])]),_:1})])):o(``,!0),e.filteredTasks?.length>0?(u(),n(F,{key:1,ref:`scrollList`,class:`flex-1 w-full overflow-y-auto tasks p-2`,loading:e.loading,onReachTop:s[5]||=t=>e.$emit(`reach-top`)},{default:m(()=>[(u(!0),p(v,null,c(e.filteredTasks,(e,t)=>(u(),n(P,{key:t,"model-value":e,class:`preview`},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):e.searchQuery&&e.tasks?.items?.length>0?(u(),p(`div`,Oa,[r(`p`,ka,l(e.$t(`suno.message.noSearchResults`)),1)])):e.activeFilterCount>0&&e.tasks?.items?.length>0?(u(),p(`div`,Aa,[r(`p`,ja,l(e.$t(`suno.message.noFilterResults`)),1),a(T,{size:`small`,text:``,onClick:e.onResetFilters},{default:m(()=>[i(l(e.$t(`suno.filter.reset`)),1)]),_:1},8,[`onClick`])])):e.tasks?.items?.length===0?(u(),p(`div`,Ma,[a(I)])):o(``,!0)],64)),g(r(`div`,Na,[a(L,{namespace:`suno`})],512),[[d,!!e.$store?.state?.suno?.audio?.object]])],64)}var Fa=G(fa,[[`render`,Pa],[`__scopeId`,`data-v-6ce376c9`]]),Ia=s({name:`TaskPreview`,components:{IconPicture:T,ElImage:P,ElAvatar:F,ElIcon:w},computed:{audio(){return this.$store.state.suno?.audio}}}),La={key:0,class:`size-full overflow-hidden`},Ra={class:`relative h-[300px]`},za={class:`flex items-center justify-center size-full bg-[var(--el-bg-color)]`},Ba={class:`absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent`},Va={class:`p-4`},Ha={class:`flex items-center font-bold mb-2`},Ua={class:`text-[var(--el-text-color-regular)] mb-2`},Wa={class:`text-xs text-[var(--el-text-color-regular)]`},Ga={class:`mt-4 text-sm leading-[25px] whitespace-pre-wrap`},Ka={key:1,class:`w-full h-full`};function qa(e,t,n,i,o,s){let c=f(`icon-picture`),d=f(`el-icon`),h=f(`el-image`),g=f(`el-avatar`);return e.audio?.object?(u(),p(`div`,La,[r(`div`,Ra,[a(h,{src:e.audio.image_url,fit:`cover`,class:`size-full`},{error:m(()=>[r(`div`,za,[a(d,{class:`text-3xl`},{default:m(()=>[a(c)]),_:1})])]),_:1},8,[`src`]),r(`h2`,Ba,l(e.audio?.title),1)]),r(`div`,Va,[r(`div`,Ha,[a(g,{size:30,src:e.audio?.image_url,class:`mr-2`},null,8,[`src`]),r(`span`,null,l(e.audio?.title),1)]),r(`p`,Ua,l(e.audio?.style),1),r(`p`,Wa,l(e.$dayjs.format(e.audio?.created_at)),1),r(`div`,Ga,[r(`p`,null,l(e.audio?.lyric),1)])])])):(u(),p(`div`,Ka))}var Ja=G(Ia,[[`render`,qa]]),Ya=U(`suno`),Xa=s({name:`SunoIndex`,components:{Layout:Me,ConfigPanel:Hi,RecentPanel:Fa,PreviewPanel:Ja},mixins:[_e],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===J.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===J.Request||this.fetchingTasks},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===J.Request},needApply(){return this.$store.state.suno.status.getApplications===J.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await be({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`suno/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplications`),await this.$store.dispatch(`suno/getApplications`),console.debug(`end onGetApplications`),await this.onGetTasks()},onApply(){de.create({application:this.application}).then(({data:e})=>{this.application=e,X.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&X.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`suno/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){if(!he(this.uploadTracker,e=>this.$t(e),e=>X.warning(e)))return;let e={...this.config,callback_url:Ya};if(!this.hasSunoInput(e)){X.error(this.$t(`suno.message.promptRequired`));return}this.hasText(e.prompt)&&(e.prompt=e.prompt.trim());let t=this.credential?.token;if(!t){console.error(`no token specified`);return}X.info(this.$t(`suno.message.startingTask`)),me(`suno`,K.audio(e,{token:t})).then(()=>{X.success(this.$t(`suno.message.startTaskSuccess`))}).catch(e=>{X.error(e?.response?.data?.error?.message||this.$t(`suno.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0},hasSunoInput(e){return[e.prompt,e.lyric,e.lyric_prompt,e.style,e.title].some(e=>this.hasText(e))||this.hasText(e.audio_id)||Array.isArray(e.mashup_audio_ids)&&e.mashup_audio_ids.length>0}}});function Za(e,t,r,i,o,s){let c=f(`config-panel`),l=f(`recent-panel`),d=f(`preview-panel`),p=f(`layout`);return u(),n(p,null,{config:m(()=>[a(c,{onGenerate:e.onGenerateAudio},null,8,[`onGenerate`])]),result:m(()=>[a(l,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),preview:m(()=>[a(d)]),_:1})}var Qa=G(Xa,[[`render`,Za],[`__scopeId`,`data-v-b9beee12`]]);export{Qa as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,Bt as t,D as n,E as r,M as i,N as a,O as o,P as s,Q as c,Ut as l,X as u,_ as d,et as f,k as p,lt as m,tt as h,ut as g,v as _,x as v,y}from"./vendor-chart-Df3WBvr0.js";import{t as b}from"./button-DgZFgZDr.js";import{F as x,X as S,Y as C,tt as w,z as T}from"./use-deprecated-Brbm5i6o.js";import{r as E,t as D}from"./select-BRZiQo0Z.js";import{n as O,t as k}from"./tabs-DT_RvYVg.js";import{n as A,t as j}from"./form-CM4sfjkF.js";import{t as M}from"./upload-B8zBOx3w.js";import{t as N}from"./tooltip-C-9nDsaA.js";import{t as P}from"./image-DH0GV7eO.js";import{t as F}from"./avatar-LKc8EZVv.js";import{t as I}from"./checkbox-B_yzN9YW.js";import{n as L,r as R,t as ee}from"./radio-DNLlMkjf.js";import{n as te,t as ne}from"./collapse-CbVpOSn0.js";import{t as z}from"./drawer-BhAAsvLB.js";import{n as B,r as V,t as re}from"./dropdown-CmSaOeLU.js";import{t as H}from"./input-number-3metTuwD.js";import{t as ie}from"./popover-B-rS_vfC.js";import{t as ae}from"./progress-C5HwZSvS.js";import{n as oe,t as se}from"./skeleton-k2vAVQdD.js";import{t as ce}from"./slider-BAI04Ufm.js";import{t as le}from"./switch-BM5fX3CU.js";import{Vr as U,sn as ue}from"./constants-SseKgNeZ.js";import{Cn as de,Ct as fe,Dt as pe,On as me,Or as W,S as G,St as he,Xt as K,br as q,dr as J,mr as ge,wr as Y,wt as _e,xr as X}from"./index-AqzIVsbo.js";import{t as Z}from"./index.es-Dcyd74ZY.js";import{i as Q,n as ve,r as ye,t as be}from"./pagination-BE8J31gG.js";import{n as xe,t as Se}from"./NoTasks-B7PhgGY7.js";import{t as Ce}from"./Consumption-DlnQDVB1.js";import{n as we,r as $,t as Te}from"./Player-Be2AB8J3.js";var Ee=s({name:`LayoutSuno`,components:{ElDrawer:z,ElButton:b,FontAwesomeIcon:Z},data(){return{drawer:!1,preview:!1}},computed:{}}),De={class:`main flex flex-row flex-1`},Oe={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ke={class:`result h-full flex flex-col flex-1 min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`},Ae={class:`preview h-full w-[300px] flex flex-col`};function je(t,n,i,o,s,c){let l=f(`font-awesome-icon`),d=f(`el-button`),h=f(`el-drawer`);return u(),p(`div`,De,[r(`div`,Oe,[e(t.$slots,`config`,{},void 0,!0)]),r(`div`,ke,[e(t.$slots,`result`,{},void 0,!0)]),r(`div`,Ae,[e(t.$slots,`preview`,{},void 0,!0)]),a(d,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[a(l,{icon:`fa-solid fa-magic`})]),_:1}),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:m(()=>[e(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Me=G(Ee,[[`render`,je],[`__scopeId`,`data-v-abe843c9`]]),Ne=s({name:`TypeSelector`,components:{ElSelect:E,ElOption:D,ElSwitch:le},data(){return{options:[{label:`v5.5`,value:`chirp-v5-5`,desc:this.$t(`suno.model.v55desc`)},{label:`v5`,value:`chirp-v5`,desc:this.$t(`suno.model.v5desc`)},{label:`v4.5+`,value:`chirp-v4-5-plus`,desc:this.$t(`suno.model.v45plusdesc`)},{label:`v4.5`,value:`chirp-v4-5`,desc:this.$t(`suno.model.v45desc`),dividerAfter:!0},{label:`v4`,value:`chirp-v4`,desc:this.$t(`suno.model.v4desc`)},{label:`v3.5`,value:`chirp-v3-5`,desc:this.$t(`suno.model.v35desc`)},{label:`v3`,value:`chirp-v3-0`,desc:this.$t(`suno.model.v3desc`)}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom||!1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,custom:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental||!1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,instrumental:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||=ue}}),Pe={class:`mb-3`},Fe={class:`flex items-center mb-1`},Ie={class:`text-sm font-bold`},Le={class:`model-option`},Re={class:`model-option-left`},ze={class:`model-option-name`},Be={class:`model-option-desc`},Ve={key:0,class:`flex items-center justify-between mb-3`},He={class:`text-sm font-bold`};function Ue(e,i,s,d,h,g){let _=f(`el-option`),y=f(`el-select`),b=f(`el-switch`);return u(),p(`div`,null,[r(`div`,Pe,[r(`div`,Fe,[r(`span`,Ie,l(e.$t(`suno.name.model`)),1)]),a(y,{modelValue:e.model,"onUpdate:modelValue":i[0]||=t=>e.model=t,class:`w-full model-select`,size:`default`,placeholder:e.$t(`suno.placeholder.select`)},{default:m(()=>[(u(!0),p(v,null,c(e.options,e=>(u(),n(_,{key:e.value,label:e.label,value:e.value,class:t({"model-option-divider":e.dividerAfter})},{default:m(()=>[r(`div`,Le,[r(`div`,Re,[r(`span`,ze,l(e.label),1)]),r(`span`,Be,l(e.desc),1)])]),_:2},1032,[`label`,`value`,`class`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),e.custom?(u(),p(`div`,Ve,[r(`span`,He,l(e.$t(`suno.name.instrumental`)),1),a(b,{modelValue:e.instrumental,"onUpdate:modelValue":i[1]||=t=>e.instrumental=t},null,8,[`modelValue`])])):o(``,!0)])}var We=G(Ne,[[`render`,Ue],[`__scopeId`,`data-v-16e4d6fc`]]),Ge=s({name:`UploadAudio`,components:{ElUpload:M,ElButton:b,ElDialog:Y,ElTabs:O,ElTabPane:k,InfoIcon:Q,FontAwesomeIcon:Z,ElRadioGroup:R,ElRadioButton:L},mixins:[fe],emits:[`change`],data(){return{fileList:[],uploadUrl:ge()+`/api/v1/files/`,dialogVisible:!1,activeTab:`browse`,recording:!1,recordedBlob:null,recordedAudioUrl:null,audioPreviewUrl:null,recordTimer:null,recordSeconds:0,mediaRecorder:null,mediaStream:null,recordedChunks:[],uploadingRecord:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}},hasUploadedAudio(){let e=this.$store.state.suno?.config?.action;return e===`upload_extend`||e===`upload_cover`},uploadAction:{get(){return this.$store.state.suno?.config?.action||`upload_extend`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,action:e})}},formattedTime(){return`${Math.floor(this.recordSeconds/60).toString().padStart(2,`0`)}:${(this.recordSeconds%60).toString().padStart(2,`0`)}`}},watch:{urls:{handler(e){this.$emit(`change`,e)}}},beforeUnmount(){this.cleanupRecording()},methods:{onExceed(){X.warning(this.$t(`suno.message.uploadReferencesExceed`))},onError(){X.error(this.$t(`suno.message.uploadReferencesError`))},async onBrowseSuccess(){let e=this.urls?.[0];e&&(this.audioPreviewUrl=e,await this.onGenerateAudioId(e),this.dialogVisible=!1)},async onGenerateAudioId(e){let t={audio_url:e},n=this.credential?.token;if(!n){console.error(`no token specified`);return}X.info(this.$t(`suno.message.startingUploadAudio`));try{let e=await K.upload(t,{token:n});console.debug(`get upload music success`,e.data);let r=e.data?.data.audio_id;this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,audio_id:r,action:`upload_extend`}),X.success(this.$t(`suno.message.startUploadAudioSuccess`))}catch(e){X.error(e?.response?.data?.error?.message||this.$t(`suno.message.startUploadAudioFailed`))}},async startRecording(){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){X.error(this.$t(`suno.message.recordingUnsupported`));return}try{this.mediaStream=await navigator.mediaDevices.getUserMedia({audio:!0}),this.recordedChunks=[],this.mediaRecorder=new MediaRecorder(this.mediaStream),this.mediaRecorder.ondataavailable=e=>{e.data&&e.data.size>0&&this.recordedChunks.push(e.data)},this.mediaRecorder.onstop=()=>{let e=new Blob(this.recordedChunks,{type:`audio/webm`});this.recordedBlob=e,this.recordedAudioUrl&&URL.revokeObjectURL(this.recordedAudioUrl),this.recordedAudioUrl=URL.createObjectURL(e),this.releaseStream()},this.mediaRecorder.start(),this.recording=!0,this.recordSeconds=0,this.recordTimer=window.setInterval(()=>{this.recordSeconds+=1,this.recordSeconds>=600&&this.stopRecording()},1e3)}catch(e){console.error(`record error`,e),X.error(this.$t(`suno.message.recordingPermissionDenied`))}},stopRecording(){this.recordTimer&&=(window.clearInterval(this.recordTimer),null),this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&this.mediaRecorder.stop(),this.recording=!1},resetRecording(){this.recordedAudioUrl&&URL.revokeObjectURL(this.recordedAudioUrl),this.recordedBlob=null,this.recordedAudioUrl=null,this.recordSeconds=0},async uploadRecording(){if(this.recordedBlob){this.uploadingRecord=!0;try{let e=new FormData,t=`recording-${Date.now()}.webm`;e.append(`file`,this.recordedBlob,t);let n=await fetch(this.uploadUrl,{method:`POST`,headers:{Authorization:`Bearer ${this.$store.state.token.access}`},body:e});if(!n.ok)throw Error(`upload failed: ${n.status}`);let r=await n.json(),i=r?.file_url||r?.data?.file_url;if(!i)throw Error(`no file_url in response`);this.audioPreviewUrl=i,await this.onGenerateAudioId(i),this.dialogVisible=!1,this.resetRecording()}catch(e){console.error(e),X.error(e?.message||this.$t(`suno.message.uploadReferencesError`))}finally{this.uploadingRecord=!1}}},releaseStream(){this.mediaStream&&=(this.mediaStream.getTracks().forEach(e=>e.stop()),null)},cleanupRecording(){this.recordTimer&&=(window.clearInterval(this.recordTimer),null),this.releaseStream(),this.recordedAudioUrl&&=(URL.revokeObjectURL(this.recordedAudioUrl),null)}}}),Ke={class:`relative`},qe={class:`flex justify-between items-center mb-2`},Je={class:`flex justify-start items-center`},Ye={class:`text-sm font-bold`},Xe={key:0,class:`mb-2`},Ze=[`src`],Qe={key:1,class:`mt-2`},$e={class:`py-4`},et={class:`text-center py-6`},tt={class:`text-sm`},nt={class:`text-xs text-gray-400 mt-1`},rt={class:`py-4 text-center`},it={class:`recorder-display mb-4`},at={key:0,class:`text-red-500 flex items-center justify-center gap-2`},ot={class:`text-2xl font-mono`},st={key:1,class:`text-green-600`},ct={key:2,class:`text-gray-400 text-2xl font-mono`},lt={key:0,class:`mb-4`},ut=[`src`],dt={class:`flex justify-center gap-3`};function ft(e,t,s,c,d,h){let g=f(`info-icon`),_=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-radio-button`),x=f(`el-radio-group`),S=f(`el-upload`),C=f(`el-tab-pane`),w=f(`el-tabs`),T=f(`el-dialog`);return u(),p(`div`,Ke,[r(`div`,qe,[r(`div`,Je,[r(`span`,Ye,l(e.$t(`suno.name.referenceAudios`)),1),a(g,{content:e.$t(`suno.description.uploadAudios`)},null,8,[`content`])]),a(y,{round:``,type:`primary`,size:`small`,onClick:t[0]||=t=>e.dialogVisible=!0},{default:m(()=>[a(_,{icon:`fa-solid fa-plus`,class:`icon mr-1`}),i(` `+l(e.$t(`suno.button.addAudio`)),1)]),_:1})]),e.audioPreviewUrl?(u(),p(`div`,Xe,[r(`audio`,{src:e.audioPreviewUrl,controls:``,class:`w-full`},null,8,Ze)])):o(``,!0),e.hasUploadedAudio?(u(),p(`div`,Qe,[a(x,{modelValue:e.uploadAction,"onUpdate:modelValue":t[1]||=t=>e.uploadAction=t,size:`small`},{default:m(()=>[a(b,{value:`upload_extend`},{default:m(()=>[i(l(e.$t(`suno.button.extend`)),1)]),_:1}),a(b,{value:`upload_cover`},{default:m(()=>[i(l(e.$t(`suno.button.upload_cover`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0),a(T,{modelValue:e.dialogVisible,"onUpdate:modelValue":t[4]||=t=>e.dialogVisible=t,title:e.$t(`suno.name.addAudio`),width:`520px`,"close-on-click-modal":!1,"append-to-body":``},{default:m(()=>[a(w,{modelValue:e.activeTab,"onUpdate:modelValue":t[3]||=t=>e.activeTab=t,class:`add-audio-tabs`},{default:m(()=>[a(C,{name:`browse`,label:e.$t(`suno.tab.browse`)},{default:m(()=>[r(`div`,$e,[a(S,{"file-list":e.fileList,"onUpdate:fileList":t[2]||=t=>e.fileList=t,name:`file`,limit:1,class:`upload-wrapper`,action:e.uploadUrl,accept:`.mp3,.wav,.m4a,audio/*`,"show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onBrowseSuccess,headers:e.headers,drag:``},{default:m(()=>[r(`div`,et,[a(_,{icon:`fa-solid fa-upload`,class:`text-4xl text-gray-400 mb-3`}),r(`div`,tt,l(e.$t(`suno.description.dropAudioHere`)),1),r(`div`,nt,l(e.$t(`suno.description.audioFormats`)),1)])]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])]),_:1},8,[`label`]),a(C,{name:`record`,label:e.$t(`suno.tab.record`)},{default:m(()=>[r(`div`,rt,[r(`div`,it,[e.recording?(u(),p(`div`,at,[t[5]||=r(`span`,{class:`recording-dot`},null,-1),r(`span`,ot,l(e.formattedTime),1)])):e.recordedBlob?(u(),p(`div`,st,[a(_,{icon:`fa-solid fa-check-circle`,class:`text-2xl mr-2`}),r(`span`,null,l(e.$t(`suno.message.recordingReady`))+` (`+l(e.formattedTime)+`)`,1)])):(u(),p(`div`,ct,`00:00`))]),e.recordedAudioUrl&&!e.recording?(u(),p(`div`,lt,[r(`audio`,{src:e.recordedAudioUrl,controls:``,class:`w-full`},null,8,ut)])):o(``,!0),r(`div`,dt,[!e.recording&&!e.recordedBlob?(u(),n(y,{key:0,type:`primary`,round:``,onClick:e.startRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-microphone`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.startRecord`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.recording?(u(),n(y,{key:1,type:`danger`,round:``,onClick:e.stopRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-stop`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.stopRecord`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.recordedBlob&&!e.recording?(u(),p(v,{key:2},[a(y,{round:``,onClick:e.resetRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.reRecord`)),1)]),_:1},8,[`onClick`]),a(y,{type:`primary`,round:``,loading:e.uploadingRecord,onClick:e.uploadRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-upload`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.useRecording`)),1)]),_:1},8,[`loading`,`onClick`])],64)):o(``,!0)])])]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`])])}var pt=G(Ge,[[`render`,ft],[`__scopeId`,`data-v-5f17a1f4`]]),mt=[{key:`lofi`,label:`🎧 Lo-fi Chill`,prompt:`a relaxing lo-fi hip hop beat for studying`},{key:`pop-love`,label:`💕 Pop Love Song`,prompt:`a catchy pop love song with sweet melodies`},{key:`rock-anthem`,label:`🎸 Rock Anthem`,prompt:`an energetic rock anthem with electric guitars`},{key:`jazz-night`,label:`🎷 Jazz Night`,prompt:`a smooth late-night jazz piece with saxophone`},{key:`edm-drop`,label:`⚡ EDM Drop`,prompt:`an intense EDM track with a massive drop`},{key:`folk-story`,label:`🪕 Folk Story`,prompt:`a warm folk song telling a story about traveling`},{key:`rnb-groove`,label:`🎤 R&B Groove`,prompt:`a smooth R&B groove with soulful vocals`},{key:`classical`,label:`🎻 Classical`,prompt:`an elegant classical piece for orchestra`},{key:`hip-hop`,label:`🎤 Hip Hop`,prompt:`a hard-hitting hip hop beat with bass`},{key:`country`,label:`🤠 Country`,prompt:`an upbeat country song with acoustic guitar and banjo`},{key:`reggae`,label:`🌴 Reggae`,prompt:`a laid-back reggae tune with island vibes`},{key:`latin`,label:`💃 Latin`,prompt:`a vibrant Latin dance track with percussion`},{key:`ambient`,label:`🌊 Ambient`,prompt:`a dreamy ambient soundscape for relaxation`},{key:`metal`,label:`🤘 Metal`,prompt:`a powerful metal song with heavy riffs and double bass drums`},{key:`soul`,label:`🎵 Soul`,prompt:`a heartfelt soul ballad with gospel harmonies`},{key:`synthwave`,label:`🌃 Synthwave`,prompt:`a retro synthwave track with 80s vibes`},{key:`kpop`,label:`🇰🇷 K-Pop`,prompt:`a catchy K-pop dance track with hook`},{key:`lullaby`,label:`🌙 Lullaby`,prompt:`a gentle lullaby for bedtime with soft piano`},{key:`cinematic`,label:`🎬 Cinematic`,prompt:`an epic cinematic orchestral score for a movie trailer`},{key:`blues`,label:`🎸 Blues`,prompt:`a soulful blues song with electric guitar bends`},{key:`disco`,label:`🕺 Disco`,prompt:`a funky disco track with groovy bassline`},{key:`punk`,label:`🔥 Punk Rock`,prompt:`a fast punk rock song with raw energy`},{key:`gospel`,label:`⛪ Gospel`,prompt:`an uplifting gospel choir song with piano`},{key:`trap`,label:`🔊 Trap`,prompt:`a dark trap beat with 808s and hi-hats`},{key:`bossa`,label:`☕ Bossa Nova`,prompt:`a gentle bossa nova with nylon guitar`},{key:`indie`,label:`🎶 Indie`,prompt:`a dreamy indie track with ethereal vocals`},{key:`cpop`,label:`🇨🇳 C-Pop`,prompt:`a beautiful Chinese pop ballad with emotional vocals`},{key:`jpop`,label:`🇯🇵 J-Pop`,prompt:`a cheerful J-pop song with anime vibes`},{key:`afrobeat`,label:`🥁 Afrobeat`,prompt:`a groovy Afrobeat track with layered percussion`},{key:`game`,label:`🎮 Game BGM`,prompt:`an adventurous video game background music`}],ht=8;function gt(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}var _t=s({name:`PromptInput`,components:{FontAwesomeIcon:Z,PromptTextarea:xe},data(){return{shuffledTags:gt(mt)}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,prompt:e})}},visibleTags(){return this.shuffledTags.slice(0,ht)}},mounted(){this.prompt||=``},methods:{onTagClick(e){this.prompt=e.prompt},onRefreshTags(){this.shuffledTags=gt(mt)}}}),vt={class:`inspo-tags`},yt=[`onClick`];function bt(e,t,i,o,s,d){let h=f(`font-awesome-icon`),g=f(`prompt-textarea`);return u(),n(g,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`suno.name.songDescription`),info:e.$t(`suno.description.prompt`),placeholder:e.$t(`suno.placeholder.prompt`),"min-rows":5,"max-rows":14},{after:m(()=>[r(`div`,vt,[(u(!0),p(v,null,c(e.visibleTags,t=>(u(),p(`button`,{key:t.key,class:`inspo-tag`,onClick:n=>e.onTagClick(t)},l(t.label),9,yt))),128)),r(`button`,{class:`inspo-tag inspo-tag-refresh`,onClick:t[0]||=(...t)=>e.onRefreshTags&&e.onRefreshTags(...t)},[a(h,{icon:`fa-solid fa-arrows-rotate`})])])]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var xt=G(_t,[[`render`,bt],[`__scopeId`,`data-v-58ffcd38`]]),St=s({name:`LyricInput`,components:{ElInput:W,ElButton:b,ElTooltip:N,ElDialog:Y,FontAwesomeIcon:Z,InfoIcon:Q},data(){return{generatingLyrics:!1,enhancingLyrics:!1,enhancePrompt:``,lyricHistory:[],expanded:!1}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config},credential(){return this.$store.state.suno?.credential}},mounted(){this.lyric||=``},methods:{pushHistory(){this.lyric&&(this.lyricHistory.push(this.lyric),this.lyricHistory.length>20&&this.lyricHistory.shift())},onUndo(){let e=this.lyricHistory.pop();e!==void 0&&(this.lyric=e)},onClear(){this.pushHistory(),this.lyric=``},async onEnhanceLyrics(){let e=this.credential?.token;if(!(!e||!this.lyric||!this.enhancePrompt)){this.pushHistory(),this.enhancingLyrics=!0,X.info(this.$t(`suno.message.enhancingLyrics`));try{let t=`${this.enhancePrompt}\n\nOriginal lyrics:\n${this.lyric}`,n=(await K.lyric({prompt:t},{token:e})).data?.data;n?.text&&(this.lyric=n.text,this.enhancePrompt=``,X.success(this.$t(`suno.message.enhanceLyricsSuccess`)))}catch{X.error(this.$t(`suno.message.enhanceLyricsFailed`))}finally{this.enhancingLyrics=!1}}},async onGenerateLyrics(){let e=this.credential?.token;if(!e)return;let t;try{t=((await q.prompt(this.$t(`suno.message.lyricsThemePromptMessage`),this.$t(`suno.message.lyricsThemePromptTitle`),{confirmButtonText:this.$t(`common.button.confirm`),cancelButtonText:this.$t(`common.button.cancel`),inputPlaceholder:this.$t(`suno.placeholder.lyricsTheme`),inputValue:this.config?.title||``,inputType:`textarea`,inputValidator:e=>typeof e==`string`&&e.trim().length>0||this.$t(`suno.message.lyricsThemeRequired`)})).value||``).trim()}catch{return}if(t){this.pushHistory(),this.generatingLyrics=!0,X.info(this.$t(`suno.message.generatingLyrics`));try{let n=(await K.lyric({prompt:t},{token:e})).data?.data;n?.text&&(this.lyric=n.text,n?.title&&!this.config?.title&&this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric:n.text,title:n.title}),X.success(this.$t(`suno.message.generateLyricsSuccess`)))}catch{X.error(this.$t(`suno.message.generateLyricsFailed`))}finally{this.generatingLyrics=!1}}}}}),Ct={class:`field`},wt={class:`flex items-center justify-between mb-1`},Tt={class:`flex items-center`},Et={class:`text-sm font-bold`},Dt={class:`flex items-center gap-1`},Ot={class:`relative`},kt={class:`text-xs text-right text-[var(--el-text-color-secondary)] mt-1`},At={key:0,class:`enhance-bar`},jt={key:0,class:`enhance-bar mt-3`},Mt={class:`flex items-center justify-between`},Nt={class:`flex items-center gap-1`};function Pt(e,t,s,c,d,h){let g=f(`info-icon`),v=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-tooltip`),x=f(`el-input`),S=f(`el-dialog`);return u(),p(`div`,Ct,[r(`div`,wt,[r(`div`,Tt,[r(`span`,Et,l(e.$t(`suno.name.lyrics`)),1),a(g,{content:e.$t(`suno.description.lyrics`)},null,8,[`content`])]),r(`div`,Dt,[e.lyricHistory.length>0?(u(),n(b,{key:0,content:e.$t(`suno.button.undo`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,onClick:e.onUndo},{default:m(()=>[a(v,{icon:`fa-solid fa-rotate-left`})]),_:1},8,[`onClick`])]),_:1},8,[`content`])):o(``,!0),e.lyric?(u(),n(b,{key:1,content:e.$t(`suno.button.clear_lyrics`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,onClick:e.onClear},{default:m(()=>[a(v,{icon:`fa-solid fa-eraser`})]),_:1},8,[`onClick`])]),_:1},8,[`content`])):o(``,!0),a(b,{content:e.$t(`suno.button.expand_lyrics`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,onClick:t[0]||=t=>e.expanded=!0},{default:m(()=>[a(v,{icon:`fa-solid fa-expand`})]),_:1})]),_:1},8,[`content`]),e.config?.action===`extend`?o(``,!0):(u(),n(y,{key:2,size:`small`,loading:e.generatingLyrics,round:``,onClick:e.onGenerateLyrics},{default:m(()=>[e.generatingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.generate_lyrics`)),1)]),_:1},8,[`loading`,`onClick`]))])]),r(`div`,Ot,[e.config?.action===`extend`?(u(),n(x,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[2]||=t=>e.lyric=t,rows:5,type:`textarea`,class:`lyrics`,placeholder:e.$t(`suno.placeholder.extend.lyrics`)},null,8,[`modelValue`,`placeholder`])):(u(),n(x,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[1]||=t=>e.lyric=t,rows:5,type:`textarea`,class:`lyrics`,placeholder:e.$t(`suno.placeholder.lyrics`)},null,8,[`modelValue`,`placeholder`])),r(`div`,kt,l(e.lyric?.length||0)+`/5000`,1)]),e.lyric&&e.config?.action!==`extend`?(u(),p(`div`,At,[a(x,{modelValue:e.enhancePrompt,"onUpdate:modelValue":t[3]||=t=>e.enhancePrompt=t,size:`small`,placeholder:e.$t(`suno.placeholder.enhanceLyrics`),class:`enhance-input`,onKeyup:_(e.onEnhanceLyrics,[`enter`])},{append:m(()=>[a(y,{loading:e.enhancingLyrics,onClick:e.onEnhanceLyrics},{default:m(()=>[e.enhancingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.enhance_lyrics`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1},8,[`modelValue`,`placeholder`,`onKeyup`])])):o(``,!0),a(S,{modelValue:e.expanded,"onUpdate:modelValue":t[7]||=t=>e.expanded=t,title:e.$t(`suno.name.lyrics`),width:`720px`,top:`5vh`,"close-on-click-modal":!1,class:`lyrics-expand-dialog`},{footer:m(()=>[r(`div`,Mt,[r(`div`,Nt,[e.lyricHistory.length>0?(u(),n(y,{key:0,size:`small`,onClick:e.onUndo},{default:m(()=>[a(v,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.undo`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.lyric?(u(),n(y,{key:1,size:`small`,onClick:e.onClear},{default:m(()=>[a(v,{icon:`fa-solid fa-eraser`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.clear_lyrics`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.config?.action===`extend`?o(``,!0):(u(),n(y,{key:2,size:`small`,loading:e.generatingLyrics,onClick:e.onGenerateLyrics},{default:m(()=>[e.generatingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.generate_lyrics`)),1)]),_:1},8,[`loading`,`onClick`]))]),a(y,{type:`primary`,onClick:t[6]||=t=>e.expanded=!1},{default:m(()=>[i(l(e.$t(`common.button.confirm`)),1)]),_:1})])]),default:m(()=>[a(x,{modelValue:e.lyric,"onUpdate:modelValue":t[4]||=t=>e.lyric=t,type:`textarea`,rows:20,class:`lyrics-expanded`,placeholder:e.$t(`suno.placeholder.lyrics`),autofocus:``},null,8,[`modelValue`,`placeholder`]),e.config?.action===`extend`?o(``,!0):(u(),p(`div`,jt,[a(x,{modelValue:e.enhancePrompt,"onUpdate:modelValue":t[5]||=t=>e.enhancePrompt=t,size:`small`,placeholder:e.$t(`suno.placeholder.enhanceLyrics`),class:`enhance-input`,onKeyup:_(e.onEnhanceLyrics,[`enter`])},{append:m(()=>[a(y,{loading:e.enhancingLyrics,onClick:e.onEnhanceLyrics},{default:m(()=>[e.enhancingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.enhance_lyrics`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1},8,[`modelValue`,`placeholder`,`onKeyup`])]))]),_:1},8,[`modelValue`,`title`])])}var Ft=G(St,[[`render`,Pt],[`__scopeId`,`data-v-d7d2ec74`]]),It=`Pop.Rock.Jazz.R&B.Hip Hop.Lo-fi.Electronic.Classical.Country.Blues.Folk.Reggae.Metal.Punk.Soul.Funk.Ambient.Indie.Latin.Acoustic.Dance.Disco.Gospel.K-Pop.J-Pop.C-Pop.Bossa Nova.Trap.Drill.House.Techno.Dubstep.Synthwave.Chill.Dreamy.Upbeat.Melancholic.Romantic.Epic.Cinematic.Orchestral.Piano.Guitar.Saxophone.Violin.Tribal.World Music.Afrobeat.Ska.Grunge`.split(`.`),Lt=12;function Rt(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}var zt=s({name:`StyleInput`,components:{ElInput:W,ElButton:b,FontAwesomeIcon:Z,InfoIcon:Q},data(){return{optimizing:!1,shuffledTags:Rt(It)}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style:e})}},credential(){return this.$store.state.suno?.credential},visibleTags(){return this.shuffledTags.slice(0,Lt)}},methods:{onTagClick(e){let t=this.style||``;t.toLowerCase().includes(e.toLowerCase())||(this.style=t?`${t}, ${e}`:e)},onRefreshTags(){this.shuffledTags=Rt(It)},async onOptimizeStyle(){let e=this.credential?.token;if(!(!e||!this.style)){this.optimizing=!0,X.info(this.$t(`suno.message.optimizingStyle`));try{let t=await K.style({prompt:this.style},{token:e}),n=t.data?.text||t.data?.data?.text;n&&(this.style=n,X.success(this.$t(`suno.message.optimizeStyleSuccess`)))}catch{X.error(this.$t(`suno.message.optimizeStyleFailed`))}finally{this.optimizing=!1}}}}}),Bt={class:`field`},Vt={class:`flex items-center justify-between mb-1`},Ht={class:`flex items-center`},Ut={class:`text-sm font-bold`},Wt={class:`relative`},Gt={class:`text-xs text-right text-[var(--el-text-color-secondary)] mt-1`},Kt={class:`style-tags`},qt=[`onClick`];function Jt(e,t,s,d,h,g){let _=f(`info-icon`),y=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-input`);return u(),p(`div`,Bt,[r(`div`,Vt,[r(`div`,Ht,[r(`span`,Ut,l(e.$t(`suno.name.style`)),1),a(_,{content:e.$t(`suno.description.style`)},null,8,[`content`])]),a(b,{size:`small`,loading:e.optimizing,round:``,onClick:e.onOptimizeStyle},{default:m(()=>[e.optimizing?o(``,!0):(u(),n(y,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.optimize_style`)),1)]),_:1},8,[`loading`,`onClick`])]),r(`div`,Wt,[a(x,{modelValue:e.style,"onUpdate:modelValue":t[0]||=t=>e.style=t,rows:2,type:`textarea`,placeholder:e.$t(`suno.placeholder.style`)},null,8,[`modelValue`,`placeholder`]),r(`div`,Gt,l(e.style?.length||0)+`/1000`,1)]),r(`div`,Kt,[(u(!0),p(v,null,c(e.visibleTags,t=>(u(),p(`button`,{key:t,class:`style-tag`,onClick:n=>e.onTagClick(t)},l(t),9,qt))),128)),r(`button`,{class:`style-tag style-tag-refresh`,onClick:t[1]||=(...t)=>e.onRefreshTags&&e.onRefreshTags(...t)},[a(y,{icon:`fa-solid fa-arrows-rotate`})])])])}var Yt=G(zt,[[`render`,Jt],[`__scopeId`,`data-v-ddebb076`]]),Xt=s({name:`TitleInput`,components:{ElInput:W,InfoIcon:Q},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,title:e})}}}}),Zt={class:`field`},Qt={class:`flex items-center mb-1`},$t={class:`text-sm font-bold`};function en(e,t,n,i,o,s){let c=f(`info-icon`),d=f(`el-input`);return u(),p(`div`,Zt,[r(`div`,Qt,[r(`span`,$t,l(e.$t(`suno.name.title`)),1),a(c,{content:e.$t(`suno.description.title`)},null,8,[`content`])]),a(d,{modelValue:e.title,"onUpdate:modelValue":t[0]||=t=>e.title=t,placeholder:e.$t(`suno.placeholder.title`)},null,8,[`modelValue`,`placeholder`])])}var tn=G(Xt,[[`render`,en]]),nn=s({name:`ExtendFromInput`,components:{ElImage:P,ElIcon:w,ElInputNumber:H,VideoPlay:S,VideoPause:C},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:$,onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),rn={class:`field`},an={class:`box`},on={class:`title font-bold`},sn={class:`input-wrapper`},cn={class:`task`},ln={class:`left`},un={key:2,class:`duration`},dn={class:`info`},fn={class:`title`},pn={class:`style`};function mn(e,t,n,i,s,c){let d=f(`el-input-number`),_=f(`el-image`),v=f(`video-pause`),y=f(`el-icon`),b=f(`video-play`),x=h(`loading`);return u(),p(`div`,rn,[r(`div`,an,[r(`h2`,on,l(e.$t(`suno.name.extend`)),1),r(`div`,sn,[a(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.extend.continue_at`),onChange:e.handleChange},null,8,[`modelValue`,`max`,`placeholder`,`onChange`])])]),r(`div`,cn,[e.audio?(u(),p(`div`,{key:0,class:`audio`,onClick:t[3]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,ln,[a(_,{src:e.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`playing`?(u(),p(`div`,{key:0,class:`overlay`,onClick:t[1]||=t=>e.onPause(e.audio)},[a(y,null,{default:m(()=>[a(v)]),_:1})])):o(``,!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`paused`)?(u(),p(`div`,{key:1,class:`overlay`,onClick:t[2]||=t=>e.onPlay(e.audio)},[a(y,null,{default:m(()=>[a(b)]),_:1})])):o(``,!0),e.audio?.duration?(u(),p(`div`,un,l(e.useFormatDuring(e.audio?.duration)),1)):o(``,!0)])),[[x,!e.audio?.audio_url]]),r(`div`,dn,[r(`h2`,fn,l(e.audio?.title),1),r(`p`,pn,l(e.audio?.style),1)])])):o(``,!0)])])}var hn=G(nn,[[`render`,mn],[`__scopeId`,`data-v-bcce4821`]]),gn=s({name:`CoverFromInput`,components:{ElImage:P,ElIcon:w,VideoPlay:S,VideoPause:C},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:$,onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),_n={class:`field`},vn={class:`box`},yn={class:`title font-bold`},bn={class:`task`},xn={class:`left`},Sn={key:2,class:`duration`},Cn={class:`info`},wn={class:`title`},Tn={class:`style`};function En(e,t,n,i,s,c){let d=f(`el-image`),_=f(`video-pause`),v=f(`el-icon`),y=f(`video-play`),b=h(`loading`);return u(),p(`div`,_n,[r(`div`,vn,[r(`h2`,yn,l(e.$t(`suno.name.cover`)),1)]),r(`div`,bn,[e.audio?(u(),p(`div`,{key:0,class:`audio`,onClick:t[2]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,xn,[a(d,{src:e.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`playing`?(u(),p(`div`,{key:0,class:`overlay`,onClick:t[0]||=t=>e.onPause(e.audio)},[a(v,null,{default:m(()=>[a(_)]),_:1})])):o(``,!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`paused`)?(u(),p(`div`,{key:1,class:`overlay`,onClick:t[1]||=t=>e.onPlay(e.audio)},[a(v,null,{default:m(()=>[a(y)]),_:1})])):o(``,!0),e.audio?.duration?(u(),p(`div`,Sn,l(e.useFormatDuring(e.audio?.duration)),1)):o(``,!0)])),[[b,!e.audio?.audio_url]]),r(`div`,Cn,[r(`h2`,wn,l(e.audio?.title),1),r(`p`,Tn,l(e.audio?.style),1)])])):o(``,!0)])])}var Dn=G(gn,[[`render`,En],[`__scopeId`,`data-v-06640216`]]),On=s({name:`VocalGenderSelector`,components:{ElRadioGroup:R,ElRadioButton:L,InfoIcon:Q},computed:{vocalGender:{get(){return this.$store.state.suno?.config?.vocal_gender||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,vocal_gender:e||void 0})}}}}),kn={class:`flex items-center mb-1`},An={class:`text-sm font-bold`};function jn(e,t,n,o,s,c){let d=f(`info-icon`),h=f(`el-radio-button`),g=f(`el-radio-group`);return u(),p(`div`,null,[r(`div`,kn,[r(`span`,An,l(e.$t(`suno.name.vocalGender`)),1),a(d,{content:e.$t(`suno.description.vocalGender`)},null,8,[`content`])]),a(g,{modelValue:e.vocalGender,"onUpdate:modelValue":t[0]||=t=>e.vocalGender=t,size:`small`},{default:m(()=>[a(h,{value:``},{default:m(()=>[i(l(e.$t(`suno.gender.auto`)),1)]),_:1}),a(h,{value:`f`},{default:m(()=>[i(l(e.$t(`suno.gender.female`)),1)]),_:1}),a(h,{value:`m`},{default:m(()=>[i(l(e.$t(`suno.gender.male`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var Mn=G(On,[[`render`,jn]]),Nn=s({name:`AdvancedParams`,components:{ElCollapse:ne,ElCollapseItem:te,ElInput:W,ElSlider:ce,ElRadioGroup:R,ElRadioButton:L},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.suno?.config},isV5OrAbove(){let e=this.config?.model||``;return[`chirp-v5`,`chirp-v5-5`].includes(e)},styleNegative:{get(){return this.$store.state.suno?.config?.style_negative||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style_negative:e||void 0})}},lyricPrompt:{get(){return this.$store.state.suno?.config?.lyric_prompt||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric_prompt:e||void 0})}},weirdness:{get(){return this.$store.state.suno?.config?.weirdness??0},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,weirdness:e||void 0})}},styleInfluence:{get(){return this.$store.state.suno?.config?.style_influence??.5},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style_influence:e})}},variationCategory:{get(){return this.$store.state.suno?.config?.variation_category||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,variation_category:e||void 0})}},audioWeight:{get(){return this.$store.state.suno?.config?.audio_weight??.5},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,audio_weight:e})}},lyricsMode:{get(){return this.$store.state.suno?.config?.lyrics_mode||`manual`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyrics_mode:e})}}},mounted(){let e=this.$store.state.suno?.config;if(!e)return;let t={};typeof e.weirdness==`number`&&e.weirdness>1&&(t.weirdness=e.weirdness/100),typeof e.style_influence==`number`&&e.style_influence>1&&(t.style_influence=e.style_influence/100),typeof e.audio_weight==`number`&&e.audio_weight>1&&(t.audio_weight=e.audio_weight/100),Object.keys(t).length>0&&this.$store.commit(`suno/setConfig`,{...e,...t})}}),Pn={key:0,class:`mb-3`},Fn={class:`flex items-center mb-1`},In={class:`text-xs font-bold`},Ln={key:1,class:`mb-3`},Rn={class:`flex items-center mb-1`},zn={class:`text-xs font-bold`},Bn={key:2,class:`mb-3`},Vn={class:`flex items-center justify-between mb-1`},Hn={class:`text-xs font-bold`},Un={class:`text-xs text-[var(--el-text-color-secondary)]`},Wn={key:3,class:`mb-3`},Gn={class:`flex items-center justify-between mb-1`},Kn={class:`text-xs font-bold`},qn={class:`text-xs text-[var(--el-text-color-secondary)]`},Jn={key:4,class:`mb-3`},Yn={class:`flex items-center mb-1`},Xn={class:`text-xs font-bold`},Zn={key:5,class:`mb-3`},Qn={class:`flex items-center justify-between mb-1`},$n={class:`text-xs font-bold`},er={class:`text-xs text-[var(--el-text-color-secondary)]`},tr={key:6,class:`mb-3`},nr={class:`flex items-center mb-1`},rr={class:`text-xs font-bold`};function ir(e,t,s,c,d,h){let g=f(`el-input`),_=f(`el-slider`),v=f(`el-radio-button`),y=f(`el-radio-group`),b=f(`el-collapse-item`),x=f(`el-collapse`);return u(),n(x,{modelValue:e.activeNames,"onUpdate:modelValue":t[7]||=t=>e.activeNames=t,class:`advanced-collapse`},{default:m(()=>[a(b,{title:e.$t(`suno.name.advancedParams`),name:`advanced`},{default:m(()=>[e.config?.custom?(u(),p(`div`,Pn,[r(`div`,Fn,[r(`span`,In,l(e.$t(`suno.name.styleNegative`)),1)]),a(g,{modelValue:e.styleNegative,"onUpdate:modelValue":t[0]||=t=>e.styleNegative=t,size:`small`,placeholder:e.$t(`suno.placeholder.styleNegative`)},null,8,[`modelValue`,`placeholder`])])):o(``,!0),e.config?.custom&&!e.config?.instrumental?(u(),p(`div`,Ln,[r(`div`,Rn,[r(`span`,zn,l(e.$t(`suno.name.lyricPrompt`)),1)]),a(g,{modelValue:e.lyricPrompt,"onUpdate:modelValue":t[1]||=t=>e.lyricPrompt=t,size:`small`,placeholder:e.$t(`suno.placeholder.lyricPrompt`)},null,8,[`modelValue`,`placeholder`])])):o(``,!0),e.config?.custom?(u(),p(`div`,Bn,[r(`div`,Vn,[r(`span`,Hn,l(e.$t(`suno.name.weirdness`)),1),r(`span`,Un,l(e.weirdness??0),1)]),a(_,{modelValue:e.weirdness,"onUpdate:modelValue":t[2]||=t=>e.weirdness=t,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),e.config?.custom?(u(),p(`div`,Wn,[r(`div`,Gn,[r(`span`,Kn,l(e.$t(`suno.name.styleInfluence`)),1),r(`span`,qn,l(e.styleInfluence??.5),1)]),a(_,{modelValue:e.styleInfluence,"onUpdate:modelValue":t[3]||=t=>e.styleInfluence=t,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),e.isV5OrAbove?(u(),p(`div`,Jn,[r(`div`,Yn,[r(`span`,Xn,l(e.$t(`suno.name.variationCategory`)),1)]),a(y,{modelValue:e.variationCategory,"onUpdate:modelValue":t[4]||=t=>e.variationCategory=t,size:`small`},{default:m(()=>[a(v,{value:``},{default:m(()=>[i(l(e.$t(`suno.gender.auto`)),1)]),_:1}),a(v,{value:`high`},{default:m(()=>[i(l(e.$t(`suno.variation.high`)),1)]),_:1}),a(v,{value:`low`},{default:m(()=>[i(l(e.$t(`suno.variation.low`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0),e.config?.action===`cover`?(u(),p(`div`,Zn,[r(`div`,Qn,[r(`span`,$n,l(e.$t(`suno.name.audioWeight`)),1),r(`span`,er,l(e.audioWeight??.5),1)]),a(_,{modelValue:e.audioWeight,"onUpdate:modelValue":t[5]||=t=>e.audioWeight=t,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),e.config?.custom&&!e.config?.instrumental?(u(),p(`div`,tr,[r(`div`,nr,[r(`span`,rr,l(e.$t(`suno.name.lyricsMode`)),1)]),a(y,{modelValue:e.lyricsMode,"onUpdate:modelValue":t[6]||=t=>e.lyricsMode=t,size:`small`},{default:m(()=>[a(v,{value:`manual`},{default:m(()=>[i(l(e.$t(`suno.lyricsMode.manual`)),1)]),_:1}),a(v,{value:`auto`},{default:m(()=>[i(l(e.$t(`suno.lyricsMode.auto`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0)]),_:1},8,[`title`])]),_:1},8,[`modelValue`])}var ar=G(Nn,[[`render`,ir],[`__scopeId`,`data-v-363599d3`]]),or=s({name:`ReplaceSectionInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},replaceSectionStart:{get(){return this.$store.state.suno?.config?.replace_section_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,replace_section_start:e})}},replaceSectionEnd:{get(){return this.$store.state.suno?.config?.replace_section_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,replace_section_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),sr={class:`field`},cr={class:`flex items-center mb-2`},lr={class:`text-sm font-bold m-0`},ur={key:0,class:`task mb-2`},dr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},fr={class:`info flex-1 min-w-0`},pr={class:`text-sm font-bold m-0 truncate`},mr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},hr={class:`flex gap-2`};function gr(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,sr,[r(`div`,cr,[r(`h2`,lr,l(e.$t(`suno.name.replaceSection`)),1),a(d,{content:e.$t(`suno.description.replaceSection`)},null,8,[`content`])]),e.audio?(u(),p(`div`,ur,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,dr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,fr,[r(`h2`,pr,l(e.audio?.title),1),r(`p`,mr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,hr,[a(_,{modelValue:e.replaceSectionStart,"onUpdate:modelValue":t[1]||=t=>e.replaceSectionStart=t,class:`flex-1`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.replaceSectionStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.replaceSectionEnd,"onUpdate:modelValue":t[2]||=t=>e.replaceSectionEnd=t,class:`flex-1`,min:e.replaceSectionStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.replaceSectionEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var _r=G(or,[[`render`,gr]]),vr=s({name:`OverpaintingInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},overpaintingStart:{get(){return this.$store.state.suno?.config?.overpainting_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,overpainting_start:e})}},overpaintingEnd:{get(){return this.$store.state.suno?.config?.overpainting_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,overpainting_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),yr={class:`field`},br={class:`flex items-center mb-2`},xr={class:`text-sm font-bold m-0`},Sr={key:0,class:`task mb-2`},Cr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},wr={class:`info flex-1 min-w-0`},Tr={class:`text-sm font-bold m-0 truncate`},Er={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Dr={class:`flex gap-2`};function Or(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,yr,[r(`div`,br,[r(`h2`,xr,l(e.$t(`suno.name.overpaintingRange`)),1),a(d,{content:e.$t(`suno.description.overpainting`)},null,8,[`content`])]),e.audio?(u(),p(`div`,Sr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,Cr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,wr,[r(`h2`,Tr,l(e.audio?.title),1),r(`p`,Er,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,Dr,[a(_,{modelValue:e.overpaintingStart,"onUpdate:modelValue":t[1]||=t=>e.overpaintingStart=t,class:`flex-1`,size:`small`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.overpaintingStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.overpaintingEnd,"onUpdate:modelValue":t[2]||=t=>e.overpaintingEnd=t,class:`flex-1`,size:`small`,min:e.overpaintingStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.overpaintingEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var kr=G(vr,[[`render`,Or]]),Ar=s({name:`UnderpaintingInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},underpaintingStart:{get(){return this.$store.state.suno?.config?.underpainting_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,underpainting_start:e})}},underpaintingEnd:{get(){return this.$store.state.suno?.config?.underpainting_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,underpainting_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),jr={class:`field`},Mr={class:`flex items-center mb-2`},Nr={class:`text-sm font-bold m-0`},Pr={key:0,class:`task mb-2`},Fr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Ir={class:`info flex-1 min-w-0`},Lr={class:`text-sm font-bold m-0 truncate`},Rr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},zr={class:`flex gap-2`};function Br(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,jr,[r(`div`,Mr,[r(`h2`,Nr,l(e.$t(`suno.name.underpaintingRange`)),1),a(d,{content:e.$t(`suno.description.underpainting`)},null,8,[`content`])]),e.audio?(u(),p(`div`,Pr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,Fr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,Ir,[r(`h2`,Lr,l(e.audio?.title),1),r(`p`,Rr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,zr,[a(_,{modelValue:e.underpaintingStart,"onUpdate:modelValue":t[1]||=t=>e.underpaintingStart=t,class:`flex-1`,size:`small`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.underpaintingStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.underpaintingEnd,"onUpdate:modelValue":t[2]||=t=>e.underpaintingEnd=t,class:`flex-1`,size:`small`,min:e.underpaintingStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.underpaintingEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var Vr=G(Ar,[[`render`,Br]]),Hr=s({name:`SamplesInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},samplesStart:{get(){return this.$store.state.suno?.config?.samples_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,samples_start:e})}},samplesEnd:{get(){return this.$store.state.suno?.config?.samples_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,samples_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),Ur={class:`field`},Wr={class:`flex items-center mb-2`},Gr={class:`text-sm font-bold m-0`},Kr={key:0,class:`task mb-2`},qr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Jr={class:`info flex-1 min-w-0`},Yr={class:`text-sm font-bold m-0 truncate`},Xr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Zr={class:`flex gap-2`};function Qr(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,Ur,[r(`div`,Wr,[r(`h2`,Gr,l(e.$t(`suno.name.samplesRange`)),1),a(d,{content:e.$t(`suno.description.samples`)},null,8,[`content`])]),e.audio?(u(),p(`div`,Kr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,qr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,Jr,[r(`h2`,Yr,l(e.audio?.title),1),r(`p`,Xr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,Zr,[a(_,{modelValue:e.samplesStart,"onUpdate:modelValue":t[1]||=t=>e.samplesStart=t,class:`flex-1`,size:`small`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.samplesStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.samplesEnd,"onUpdate:modelValue":t[2]||=t=>e.samplesEnd=t,class:`flex-1`,size:`small`,min:e.samplesStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.samplesEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var $r=G(Hr,[[`render`,Qr]]),ei=[.5,.75,1,1.25,1.5,2],ti=s({name:`AdjustSpeedInput`,components:{ElRadioGroup:R,ElRadioButton:L,ElImage:P,InfoIcon:Q},data(){return{options:ei}},computed:{audio(){return this.$store.state.suno?.config?.audio},speed:{get(){let e=this.$store.state.suno?.config?.speed;return typeof e==`number`?e:1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,speed:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),ni={class:`field`},ri={class:`flex items-center mb-2`},ii={class:`text-sm font-bold m-0`},ai={key:0,class:`task mb-2`},oi={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},si={class:`info flex-1 min-w-0`},ci={class:`text-sm font-bold m-0 truncate`},li={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`};function ui(e,t,s,d,_,y){let b=f(`info-icon`),x=f(`el-image`),S=f(`el-radio-button`),C=f(`el-radio-group`),w=h(`loading`);return u(),p(`div`,ni,[r(`div`,ri,[r(`h2`,ii,l(e.$t(`suno.name.adjustSpeed`)),1),a(b,{content:e.$t(`suno.description.adjustSpeed`)},null,8,[`content`])]),e.audio?(u(),p(`div`,ai,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,oi,[a(x,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[w,!e.audio?.audio_url]]),r(`div`,si,[r(`h2`,ci,l(e.audio?.title),1),r(`p`,li,l(e.audio?.style),1)])])])):o(``,!0),a(C,{modelValue:e.speed,"onUpdate:modelValue":t[1]||=t=>e.speed=t,size:`small`,class:`speed-group`},{default:m(()=>[(u(!0),p(v,null,c(e.options,e=>(u(),n(S,{key:e,value:e},{default:m(()=>[i(l(e)+`x`,1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])])}var di=G(ti,[[`render`,ui],[`__scopeId`,`data-v-ba834628`]]),fi=s({name:`VoiceCreateDialog`,components:{ElDialog:Y,ElForm:j,ElFormItem:A,ElInput:W,ElButton:b,ElRadioGroup:R,ElRadio:ee},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{sourceType:`song`,form:{name:``,description:``,audio_id:``,audio_url:``},loading:!1}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit(`update:modelValue`,e)}},token(){return this.$store.state.suno?.credential?.token},canSubmit(){return!(!this.form.name||this.sourceType===`song`&&!this.form.audio_id||this.sourceType===`upload`&&!this.form.audio_url)}},methods:{onClose(){this.visible=!1,this.resetForm()},resetForm(){this.form={name:``,description:``,audio_id:``,audio_url:``},this.sourceType=`song`},async onSubmit(){if(this.token){this.loading=!0;try{this.sourceType===`song`?await K.persona({audio_id:this.form.audio_id,name:this.form.name,description:this.form.description},{token:this.token}):await K.voices({audio_url:this.form.audio_url,name:this.form.name,description:this.form.description},{token:this.token}),X.success(this.$t(`suno.voice.createSuccess`)),this.$emit(`created`),this.onClose()}catch{X.error(this.$t(`suno.voice.createFailed`))}finally{this.loading=!1}}}}});function pi(e,t,r,s,c,d){let p=f(`el-input`),h=f(`el-form-item`),g=f(`el-radio`),_=f(`el-radio-group`),v=f(`el-form`),y=f(`el-button`),b=f(`el-dialog`);return u(),n(b,{modelValue:e.visible,"onUpdate:modelValue":t[5]||=t=>e.visible=t,title:e.$t(`suno.voice.createTitle`),width:`480px`,"close-on-click-modal":!1,onClose:e.onClose},{footer:m(()=>[a(y,{onClick:e.onClose},{default:m(()=>[i(l(e.$t(`common.button.cancel`)),1)]),_:1},8,[`onClick`]),a(y,{type:`primary`,loading:e.loading,disabled:!e.canSubmit,onClick:e.onSubmit},{default:m(()=>[i(l(e.$t(`suno.voice.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:m(()=>[a(v,{"label-position":`top`,class:`voice-create-form`},{default:m(()=>[a(h,{label:e.$t(`suno.voice.name`)},{default:m(()=>[a(p,{modelValue:e.form.name,"onUpdate:modelValue":t[0]||=t=>e.form.name=t,placeholder:e.$t(`suno.voice.namePlaceholder`),maxlength:`50`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),a(h,{label:e.$t(`suno.voice.description`)},{default:m(()=>[a(p,{modelValue:e.form.description,"onUpdate:modelValue":t[1]||=t=>e.form.description=t,type:`textarea`,rows:2,placeholder:e.$t(`suno.voice.descriptionPlaceholder`),maxlength:`200`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),a(h,{label:e.$t(`suno.voice.sourceType`)},{default:m(()=>[a(_,{modelValue:e.sourceType,"onUpdate:modelValue":t[2]||=t=>e.sourceType=t,class:`w-full`},{default:m(()=>[a(g,{value:`song`},{default:m(()=>[i(l(e.$t(`suno.voice.fromSong`)),1)]),_:1}),a(g,{value:`upload`},{default:m(()=>[i(l(e.$t(`suno.voice.fromUpload`)),1)]),_:1})]),_:1},8,[`modelValue`])]),_:1},8,[`label`]),e.sourceType===`song`?(u(),n(h,{key:0,label:e.$t(`suno.voice.audioId`)},{default:m(()=>[a(p,{modelValue:e.form.audio_id,"onUpdate:modelValue":t[3]||=t=>e.form.audio_id=t,placeholder:e.$t(`suno.voice.audioIdPlaceholder`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):o(``,!0),e.sourceType===`upload`?(u(),n(h,{key:1,label:e.$t(`suno.voice.audioUrl`)},{default:m(()=>[a(p,{modelValue:e.form.audio_url,"onUpdate:modelValue":t[4]||=t=>e.form.audio_url=t,placeholder:e.$t(`suno.voice.audioUrlPlaceholder`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):o(``,!0)]),_:1})]),_:1},8,[`modelValue`,`title`,`onClose`])}var mi=s({name:`VoiceManager`,components:{ElButton:b,ElIcon:w,ElTabs:O,ElTabPane:k,ElTooltip:N,Loading:x,FontAwesomeIcon:Z,VoiceCreateDialog:G(fi,[[`render`,pi]])},data(){return{showCreateDialog:!1,loading:!1,deletingId:null,activeTab:`all`}},computed:{personas(){return this.$store.state.suno?.personas||[]},favoriteIds(){return this.$store.state.suno?.favoritePersonaIds||[]},favoritePersonas(){return this.personas.filter(e=>e.persona_id&&this.favoriteIds.includes(e.persona_id))},visiblePersonas(){return this.activeTab===`favorites`?this.favoritePersonas:this.personas},selectedPersonaId(){return this.$store.state.suno?.config?.persona_id}},watch:{"$store.state.suno.credential":{handler(){this.loadPersonas()},immediate:!0}},methods:{isFavorite(e){return!!e&&this.favoriteIds.includes(e)},onToggleFavorite(e){e.persona_id&&this.$store.commit(`suno/togglePersonaFavorite`,e.persona_id)},async loadPersonas(){if(this.$store.state.suno?.credential?.token){this.loading=!0;try{await this.$store.dispatch(`suno/getPersonas`)}finally{this.loading=!1}}},selectPersona(e){let t={...this.$store.state.suno?.config};t.persona_id===e.persona_id?t.persona_id=void 0:t.persona_id=e.persona_id,this.$store.dispatch(`suno/setConfig`,t)},async onDelete(e){try{await q.confirm(this.$t(`suno.voice.confirmDelete`),this.$t(`suno.voice.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.confirm`),cancelButtonText:this.$t(`common.button.cancel`)})}catch{return}if(!e.persona_id)return;this.deletingId=e.persona_id;let t=await this.$store.dispatch(`suno/deletePersona`,e.persona_id);if(this.deletingId=null,t){if(X.success(this.$t(`suno.voice.deleteSuccess`)),this.selectedPersonaId===e.persona_id){let e={...this.$store.state.suno?.config,persona_id:void 0};this.$store.dispatch(`suno/setConfig`,e)}this.favoriteIds.includes(e.persona_id)&&this.$store.commit(`suno/togglePersonaFavorite`,e.persona_id)}else X.error(this.$t(`suno.voice.deleteFailed`))},async onCreated(){await this.loadPersonas()}}}),hi={class:`voice-manager`},gi={class:`flex items-center justify-between mb-3`},_i={class:`text-sm font-medium`},vi={key:0,class:`text-center py-6`},yi={key:1,class:`text-center py-6 text-gray-400 text-sm`},bi={key:2,class:`voice-list`},xi=[`onClick`],Si={class:`flex-1 min-w-0`},Ci={class:`voice-name`},wi={key:0,class:`voice-desc`};function Ti(e,n,s,d,h,g){let _=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-tab-pane`),S=f(`el-tabs`),C=f(`loading`),w=f(`el-icon`),T=f(`el-tooltip`),E=f(`voice-create-dialog`);return u(),p(`div`,hi,[r(`div`,gi,[r(`span`,_i,l(e.$t(`suno.voice.title`)),1),a(b,{type:`primary`,size:`small`,onClick:n[0]||=t=>e.showCreateDialog=!0},{default:m(()=>[a(_,{icon:`fa-solid fa-plus`,class:`mr-1`}),i(` `+l(e.$t(`suno.voice.create`)),1)]),_:1})]),a(S,{modelValue:e.activeTab,"onUpdate:modelValue":n[1]||=t=>e.activeTab=t,class:`voice-tabs`,size:`small`},{default:m(()=>[a(x,{name:`all`,label:e.$t(`suno.voice.tabAll`)+` (`+(e.personas?.length||0)+`)`},null,8,[`label`]),a(x,{name:`favorites`,label:e.$t(`suno.voice.tabFavorites`)+` (`+e.favoritePersonas.length+`)`},null,8,[`label`])]),_:1},8,[`modelValue`]),e.loading?(u(),p(`div`,vi,[a(w,{class:`is-loading`},{default:m(()=>[a(C)]),_:1})])):e.visiblePersonas.length===0?(u(),p(`div`,yi,l(e.activeTab===`favorites`?e.$t(`suno.voice.emptyFavorites`):e.$t(`suno.voice.empty`)),1)):(u(),p(`div`,bi,[(u(!0),p(v,null,c(e.visiblePersonas,s=>(u(),p(`div`,{key:s.persona_id,class:t([`voice-item`,{active:e.selectedPersonaId===s.persona_id}]),onClick:t=>e.selectPersona(s)},[r(`div`,Si,[r(`div`,Ci,[a(_,{icon:s.source_type===`voice`?`fa-solid fa-microphone`:`fa-solid fa-music`,class:`mr-1.5 text-xs opacity-60`},null,8,[`icon`]),i(` `+l(s.name||s.persona_id),1)]),s.description?(u(),p(`div`,wi,l(s.description),1)):o(``,!0)]),r(`div`,{class:`voice-actions`,onClick:n[2]||=y(()=>{},[`stop`])},[a(T,{content:e.isFavorite(s.persona_id)?e.$t(`suno.voice.unfavorite`):e.$t(`suno.voice.favorite`),placement:`top`},{default:m(()=>[a(b,{size:`small`,text:``,class:t({"voice-fav-active":e.isFavorite(s.persona_id)}),onClick:t=>e.onToggleFavorite(s)},{default:m(()=>[a(_,{icon:e.isFavorite(s.persona_id)?`fa-solid fa-star`:`fa-regular fa-star`},null,8,[`icon`])]),_:2},1032,[`class`,`onClick`])]),_:2},1032,[`content`]),a(b,{type:`danger`,size:`small`,text:``,loading:e.deletingId===s.persona_id,onClick:t=>e.onDelete(s)},{default:m(()=>[a(_,{icon:`fa-solid fa-trash`})]),_:1},8,[`loading`,`onClick`])])],10,xi))),128))])),a(E,{modelValue:e.showCreateDialog,"onUpdate:modelValue":n[3]||=t=>e.showCreateDialog=t,onCreated:e.onCreated},null,8,[`modelValue`,`onCreated`])])}var Ei=s({name:`PersonaInput`,components:{ElSelect:E,ElOption:D,ElButton:b,ElDrawer:z,FontAwesomeIcon:Z,InfoIcon:Q,VoiceManager:G(mi,[[`render`,Ti],[`__scopeId`,`data-v-8b8e36d9`]])},data(){return{showManager:!1}},computed:{personaId:{get(){return this.$store.state.suno?.config?.persona_id||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,persona_id:e||void 0})}},personas(){return this.$store.state.suno?.personas||[]}}}),Di={class:`field`},Oi={class:`flex items-center justify-between mb-2`},ki={class:`flex items-center`},Ai={class:`text-sm font-bold`},ji={class:`flex items-center justify-between w-full`},Mi={key:0,class:`text-xs text-gray-400 ml-2`};function Ni(e,t,s,d,h,g){let _=f(`info-icon`),y=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-option`),S=f(`el-select`),C=f(`voice-manager`),w=f(`el-drawer`);return u(),p(`div`,Di,[r(`div`,Oi,[r(`div`,ki,[r(`span`,Ai,l(e.$t(`suno.name.persona`)),1),a(_,{content:e.$t(`suno.description.persona`)},null,8,[`content`])]),a(b,{size:`small`,round:``,onClick:t[0]||=t=>e.showManager=!0},{default:m(()=>[a(y,{icon:`fa-solid fa-microphone`,class:`mr-1`}),i(` `+l(e.$t(`suno.voice.manage`)),1)]),_:1})]),a(S,{modelValue:e.personaId,"onUpdate:modelValue":t[1]||=t=>e.personaId=t,placeholder:e.$t(`suno.placeholder.personaId`),clearable:``,filterable:``,class:`w-full`},{default:m(()=>[(u(!0),p(v,null,c(e.personas,e=>(u(),n(x,{key:e.persona_id||``,value:e.persona_id||``,label:e.name||e.persona_id||``},{default:m(()=>[r(`div`,ji,[r(`span`,null,l(e.name||e.persona_id),1),e.source_type?(u(),p(`span`,Mi,l(e.source_type),1)):o(``,!0)])]),_:2},1032,[`value`,`label`]))),128))]),_:1},8,[`modelValue`,`placeholder`]),a(w,{modelValue:e.showManager,"onUpdate:modelValue":t[2]||=t=>e.showManager=t,title:e.$t(`suno.voice.title`),size:`380px`,direction:`rtl`},{default:m(()=>[a(C)]),_:1},8,[`modelValue`,`title`])])}var Pi=s({name:`PresetPanel`,components:{TypeSelector:We,PromptInput:xt,LyricInput:Ft,StyleInput:Yt,TitleInput:tn,ExtendFromInput:hn,CoverFromInput:Dn,UploadAudio:pt,VocalGenderSelector:Mn,AdvancedParams:ar,ReplaceSectionInput:_r,OverpaintingInput:kr,UnderpaintingInput:Vr,SamplesInput:$r,AdjustSpeedInput:di,PersonaInput:G(Ei,[[`render`,Ni]]),FontAwesomeIcon:Z,ElButton:b,ElTabs:O,ElTabPane:k,Consumption:Ce},emits:[`generate`],computed:{config(){return this.$store.state.suno?.config},mode:{get(){return this.$store.state.suno?.config?.custom?`custom`:`simple`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,custom:e===`custom`})}},consumption(){return pe(this.config,this.service?.cost)},service(){return this.$store.state.suno?.service},supportsVocalGender(){let e=this.config?.model||``;return[`chirp-v4-5-plus`,`chirp-v5`,`chirp-v5-5`].includes(e)},supportsPersona(){let e=this.config?.action;return!e||e===`generate`||e===`artist_consistency`||e===`artist_consistency_vox`},generateButtonText(){let e=this.config?.action;return e===`extend`?this.$t(`suno.button.extend`):e===`cover`?this.$t(`suno.button.cover_music`):e===`remaster`?this.$t(`suno.button.remaster`):e===`replace_section`?this.$t(`suno.button.replace_section`):e===`mashup`?this.$t(`suno.button.mashup`):e===`stems`?this.$t(`suno.button.get_stems`):e===`concat`?this.$t(`suno.button.concat_music`):e===`upload_cover`?this.$t(`suno.button.upload_cover`):e===`artist_consistency`?this.$t(`suno.button.artist_consistency`):e===`artist_consistency_vox`?this.$t(`suno.button.artist_consistency_vox`):e===`overpainting`?this.$t(`suno.button.overpainting`):e===`underpainting`?this.$t(`suno.button.underpainting`):e===`samples`?this.$t(`suno.button.samples`):e===`adjust_speed`?this.$t(`suno.button.adjust_speed`):this.$t(`suno.button.generate`)}},methods:{onGenerate(){this.$emit(`generate`)},onClearAll(){this.$store.commit(`suno/setConfig`,{custom:!1,sounds:!1,instrumental:!1,lyric:``,style:``,title:``,lyrics_mode:`manual`,model:this.$store.state.suno?.config?.model})}}}),Fi={class:`flex flex-col h-full`},Ii={class:`flex-1 overflow-y-auto p-5`},Li={class:`pt-2 px-1`},Ri={class:`pt-2 px-1`},zi={class:`flex flex-col items-center justify-center px-5 pb-5 gap-2`},Bi={class:`flex gap-2 w-full`};function Vi(e,t,s,c,d,h){let g=f(`type-selector`),_=f(`upload-audio`),v=f(`prompt-input`),y=f(`extend-from-input`),b=f(`cover-from-input`),x=f(`replace-section-input`),S=f(`overpainting-input`),C=f(`underpainting-input`),w=f(`samples-input`),T=f(`adjust-speed-input`),E=f(`advanced-params`),D=f(`el-tab-pane`),O=f(`lyric-input`),k=f(`style-input`),A=f(`title-input`),j=f(`vocal-gender-selector`),M=f(`persona-input`),N=f(`el-tabs`),P=f(`consumption`),F=f(`font-awesome-icon`),I=f(`el-button`);return u(),p(`div`,Fi,[r(`div`,Ii,[a(N,{modelValue:e.mode,"onUpdate:modelValue":t[0]||=t=>e.mode=t,class:`suno-mode-tabs`,stretch:``},{default:m(()=>[a(D,{label:e.$t(`suno.mode.simple`),name:`simple`},{default:m(()=>[r(`div`,Li,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),e.config?.action===`extend`?(u(),n(y,{key:0,class:`mb-4`})):o(``,!0),e.config?.action===`cover`?(u(),n(b,{key:1,class:`mb-4`})):o(``,!0),e.config?.action===`replace_section`?(u(),n(x,{key:2,class:`mb-4`})):o(``,!0),e.config?.action===`overpainting`?(u(),n(S,{key:3,class:`mb-4`})):o(``,!0),e.config?.action===`underpainting`?(u(),n(C,{key:4,class:`mb-4`})):o(``,!0),e.config?.action===`samples`?(u(),n(w,{key:5,class:`mb-4`})):o(``,!0),e.config?.action===`adjust_speed`?(u(),n(T,{key:6,class:`mb-4`})):o(``,!0),a(E,{class:`mb-4`})])]),_:1},8,[`label`]),a(D,{label:e.$t(`suno.mode.custom`),name:`custom`},{default:m(()=>[r(`div`,Ri,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),e.config?.instrumental?o(``,!0):(u(),n(O,{key:0,class:`mb-4`})),a(k,{class:`mb-4`}),a(A,{class:`mb-4`}),!e.config?.instrumental&&e.supportsVocalGender?(u(),n(j,{key:1,class:`mb-4`})):o(``,!0),e.supportsPersona?(u(),n(M,{key:2,class:`mb-4`})):o(``,!0),e.config?.action===`extend`?(u(),n(y,{key:3,class:`mb-4`})):o(``,!0),e.config?.action===`cover`?(u(),n(b,{key:4,class:`mb-4`})):o(``,!0),e.config?.action===`replace_section`?(u(),n(x,{key:5,class:`mb-4`})):o(``,!0),e.config?.action===`overpainting`?(u(),n(S,{key:6,class:`mb-4`})):o(``,!0),e.config?.action===`underpainting`?(u(),n(C,{key:7,class:`mb-4`})):o(``,!0),e.config?.action===`samples`?(u(),n(w,{key:8,class:`mb-4`})):o(``,!0),e.config?.action===`adjust_speed`?(u(),n(T,{key:9,class:`mb-4`})):o(``,!0),a(E,{class:`mb-4`})])]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),r(`div`,zi,[a(P,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),r(`div`,Bi,[a(I,{class:`flex-1`,onClick:e.onClearAll},{default:m(()=>[a(F,{icon:`fa-solid fa-broom`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.clear_all`)),1)]),_:1},8,[`onClick`]),a(I,{type:`primary`,class:`flex-1`,round:``,onClick:e.onGenerate},{default:m(()=>[a(F,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.generateButtonText),1)]),_:1},8,[`onClick`])])])])}var Hi=G(Pi,[[`render`,Vi],[`__scopeId`,`data-v-c62324e6`]]),Ui=we(),Wi=U(`suno`),Gi=s({name:`TaskPreview`,components:{ElImage:P,ElIcon:w,ElTooltip:N,FontAwesomeIcon:Z,VideoPlay:S,VideoPause:C,ElDropdown:re,ElDropdownMenu:V,ElDropdownItem:B,ElInput:W,ElProgress:ae,ElCheckbox:I,Loading:x,ApiCodeDialog:ye},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1,isFetchingMidi:!1,editingAudioId:null,editingTitle:``,apiCodeVisible:!1,apiCodePath:`/suno/audios`,apiCodeBody:{}}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===J.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(e=>({...e,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active},isMashupMode(){return this.$store.state.suno?.config?.action===`mashup`},mashupAudioIds(){return this.$store.state.suno?.config?.mashup_audio_ids||[]}},methods:{useFormatDuring:$,onViewCode(){let e=this.modelValue?.request||{},t={};Object.entries(e).forEach(([e,n])=>{e===`application_id`||e===`callback_url`||n!=null&&(typeof n==`string`&&n===``||Array.isArray(n)&&n.length===0||(t[e]=n))}),this.apiCodeBody=t,this.apiCodePath=`/suno/audios`,this.apiCodeVisible=!0},onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log(`on extend`),console.debug(`set config`,t),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:`extend`,audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log(`on download`,t);let n=new URL(t).pathname,r=n.substring(n.lastIndexOf(`/`)+1);console.log(`on preview`,r),fetch(t).then(e=>e.blob()).then(e=>{(0,Ui.saveAs)(e,r)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;let t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(e){console.error(`get videoUrl failed:`,e),X.error(this.$t(`suno.message.getVideoUrlFailed`))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,n)=>{let r={audio_id:e},i=this.credential?.token;if(!i){console.error(`no token specified`),n(Error(`No token specified`));return}K.mp4(r,{token:i}).then(e=>{let r=e.data?.data?.video_url;r?t(r):n(Error(`Video URL not found in response`))}).catch(e=>{n(e)})})},onPreview(e,t){e.stopPropagation(),console.log(`on preview`,t),window.open(t,`_blank`)},async onGetStems(e){await this.onGenerateAudioUrl(`stems`,e)},onCover(e){console.log(`on cover`),console.debug(`set config`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`cover`,audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl(`concat`,e)},async onRemaster(e){await this.onGenerateAudioUrl(`remaster`,e)},async onGetAllStems(e){await this.onGenerateAudioUrl(`all_stems`,e)},onReplaceSection(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`replace_section`,audio:e,audio_id:e.id,replace_section_start:0,replace_section_end:Math.min(30,e.duration||30)})},onMashup(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`mashup`,audio:e,audio_id:e.id,mashup_audio_ids:[e.id]})},onOverpainting(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`overpainting`,audio:e,audio_id:e.id,overpainting_start:0,overpainting_end:Math.min(30,e.duration||30)})},onUnderpainting(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`underpainting`,audio:e,audio_id:e.id,underpainting_start:0,underpainting_end:Math.min(30,e.duration||30)})},onSamples(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`samples`,audio:e,audio_id:e.id,samples_start:0,samples_end:Math.min(30,e.duration||30)})},onArtistConsistency(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`artist_consistency`,audio:e,audio_id:e.id})},onAdjustSpeed(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`adjust_speed`,audio:e,audio_id:e.id,speed:1})},onReusePrompt(e){let t=this.modelValue?.request??{};if(!(t.prompt||t.lyric||t.style||t.title||t.lyric_prompt||t.style_negative||t.persona_id)){X.warning(this.$t(`suno.message.reusePromptEmpty`));return}this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:t.model??e.model,custom:t.custom??!1,instrumental:t.instrumental??!1,prompt:t.prompt??``,lyric:t.lyric??``,lyric_prompt:t.lyric_prompt??``,lyrics_mode:t.lyrics_mode??`manual`,title:t.title??``,style:t.style??``,style_negative:t.style_negative??``,vocal_gender:t.vocal_gender,weirdness:t.weirdness,style_influence:t.style_influence,variation_category:t.variation_category,audio_weight:t.audio_weight,persona_id:t.persona_id,action:void 0,audio:void 0,audio_id:void 0,mashup_audio_ids:void 0,continue_at:void 0,speed:void 0,replace_section_start:void 0,replace_section_end:void 0,overpainting_start:void 0,overpainting_end:void 0,underpainting_start:void 0,underpainting_end:void 0,samples_start:void 0,samples_end:void 0}),X.success(this.$t(`suno.message.reusePromptSuccess`))},async onExtractVocals(e){let t=this.credential?.token;t&&(X.info(this.$t(`suno.message.extractingVocals`)),K.vox({audio_id:e,callback_url:Wi},{token:t}).then(()=>{X.success(this.$t(`suno.message.extractVocalsSuccess`))}).catch(e=>{X.error(e?.response?.data?.error?.message||this.$t(`suno.message.extractVocalsFailed`))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()}))},async onGetTiming(e){let t=this.credential?.token;t&&(X.info(this.$t(`suno.message.fetchingTiming`)),K.timing({audio_id:e},{token:t}).then(e=>{X.success(this.$t(`suno.message.fetchTimingSuccess`)),console.debug(`timing data`,e.data)}).catch(e=>{X.error(e?.response?.data?.error?.message||this.$t(`suno.message.fetchTimingFailed`))}))},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;let t=this.credential?.token;if(t)try{this.isFetchingWav=!0,X.info(this.$t(`suno.message.fetchingWav`));let n=(await K.wav({audio_id:e.id},{token:t})).data?.data?.[0]?.file_url;n?this.onDownload(null,n):X.error(this.$t(`suno.message.fetchWavFailed`))}catch(e){let t=e?.response?.data?.error?.message;X.error(t||this.$t(`suno.message.fetchWavFailed`))}finally{this.isFetchingWav=!1}},async handleMidiDownload(e){if(!e?.id||this.isFetchingMidi)return;let t=this.credential?.token;if(t)try{this.isFetchingMidi=!0,X.info(this.$t(`suno.message.fetchingMidi`));let n=(await K.midi({audio_id:e.id},{token:t})).data?.data;if(!n?.length){X.error(this.$t(`suno.message.fetchMidiFailed`));return}let r=(e.title||e.id||`suno`).replace(/[^\w.-]+/g,`_`)+`.json`;(0,Ui.saveAs)(new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),r)}catch(e){let t=e?.response?.data?.error?.message;X.error(t||this.$t(`suno.message.fetchMidiFailed`))}finally{this.isFetchingMidi=!1}},async onGenerateAudioUrl(e,t){let n={action:e,audio_id:t,callback_url:Wi},r=this.credential?.token;if(!r){console.error(`no token specified`);return}X.info(this.$t(`suno.message.startingTask`)),K.audio(n,{token:r}).then(()=>{X.success(this.$t(`suno.message.startTaskSuccess`))}).catch(e=>{X.error(e?.response?.data?.error?.message||this.$t(`suno.message.startTaskFailed`))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},isMashupSelected(e){return!!e.id&&this.mashupAudioIds.includes(e.id)},onToggleMashup(e){if(!e.id)return;let t=[...this.mashupAudioIds],n=t.indexOf(e.id);n===-1?t.push(e.id):t.splice(n,1),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,mashup_audio_ids:t})},async onScrollDown(){setTimeout(()=>{let e=document.querySelector(`.tasks`);e&&(e.scrollTop=e.scrollHeight)},1e3)},onStartTitleEdit(e){this.editingAudioId=e.id??null,this.editingTitle=e.title||``,this.$nextTick(()=>{this.$refs.titleInput?.focus?.()})},onSaveTitleEdit(e){if(this.editingAudioId!==e.id)return;let t=this.editingTitle.trim();if(t&&t!==e.title){let n=this.$store.state.suno?.tasks;if(n?.items)for(let r of n.items){let n=(r?.response?.data??[]).find(t=>t.id===e.id);if(n){n.title=t;break}}}this.editingAudioId=null,this.editingTitle=``},onCancelTitleEdit(){this.editingAudioId=null,this.editingTitle=``},async onDelete(e){try{await q.confirm(this.$t(`suno.message.confirmDelete`),{confirmButtonText:this.$t(`suno.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),type:`warning`})}catch{return}let t=this.$store.state.suno?.tasks;if(t?.items)for(let n of t.items){let r=n?.response?.data??[],i=r.findIndex(t=>t.id===e.id);if(i!==-1){if(r.splice(i,1),r.length===0){let e=t.items.indexOf(n);e!==-1&&t.items.splice(e,1)}break}}this.$store.state?.suno?.audio?.id===e.id&&this.$store.dispatch(`suno/setAudio`,null),X.success(this.$t(`suno.message.deleteSuccess`))},async onGetTasks(){if(this.loading){console.debug(`loading`);return}await this.$store.dispatch(`suno/getTasks`,{limit:30,offset:0})}}}),Ki={class:`task`},qi=[`onClick`],Ji=[`onClick`],Yi={class:`left`},Xi=[`onClick`],Zi=[`onClick`],Qi={key:2,class:`duration`},$i={class:`info`},ea={key:1,class:`title-row`},ta={class:`title`},na={class:`style`},ra={key:2,class:`progress-row`},ia={class:`progress-text`},aa={class:`right`},oa={class:`el-dropdown-link`},sa={class:`flex items-center min-w-[120px]`},ca={class:`flex items-center min-w-[120px]`},la={class:`flex items-center min-w-[120px]`},ua={class:`el-dropdown-link`};function da(e,s,d,b,x,S){let C=f(`el-checkbox`),w=f(`el-image`),T=f(`video-pause`),E=f(`el-icon`),D=f(`video-play`),O=f(`el-input`),k=f(`font-awesome-icon`),A=f(`el-progress`),j=f(`el-tooltip`),M=f(`Loading`),N=f(`el-dropdown-item`),P=f(`el-dropdown-menu`),F=f(`el-dropdown`),I=f(`api-code-dialog`),L=h(`loading`);return u(),p(`div`,Ki,[(u(!0),p(v,null,c(e.audios,c=>(u(),p(`div`,{key:c.id,class:t([`audio`,{"mashup-selected":e.isMashupSelected(c)}]),onClick:y(t=>e.onClick(c),[`stop`])},[e.isMashupMode&&c?.audio_url?(u(),p(`div`,{key:0,class:`mashup-check`,onClick:y(t=>e.onToggleMashup(c),[`stop`])},[a(C,{"model-value":e.isMashupSelected(c),onClick:s[0]||=y(()=>{},[`stop`])},null,8,[`model-value`])],8,Ji)):o(``,!0),g((u(),p(`div`,Yi,[a(w,{src:c?.image_url,class:`cover`,fit:`cover`,lazy:``},null,8,[`src`]),c?.audio_url&&e.$store.state?.suno?.audio?.id===c.id&&e.$store.state?.suno?.audio?.state===`playing`?(u(),p(`div`,{key:0,class:`overlay`,onClick:y(t=>e.onPause(c),[`stop`])},[a(E,null,{default:m(()=>[a(T)]),_:1})],8,Xi)):o(``,!0),c?.audio_url&&(e.$store.state?.suno?.audio?.id!==c.id||e.$store.state?.suno?.audio?.id===c.id&&e.$store.state?.suno?.audio?.state===`paused`)?(u(),p(`div`,{key:1,class:`overlay`,onClick:y(t=>e.onPlay(c),[`stop`])},[a(E,null,{default:m(()=>[a(D)]),_:1})],8,Zi)):o(``,!0),c?.duration?(u(),p(`div`,Qi,l(e.useFormatDuring(c?.duration)),1)):o(``,!0)])),[[L,!c?.audio_url]]),r(`div`,$i,[e.editingAudioId===c.id?(u(),p(`div`,{key:0,class:`title-edit`,onClick:s[2]||=y(()=>{},[`stop`])},[a(O,{ref_for:!0,ref:`titleInput`,modelValue:e.editingTitle,"onUpdate:modelValue":s[1]||=t=>e.editingTitle=t,size:`small`,onKeyup:[_(t=>e.onSaveTitleEdit(c),[`enter`]),_(e.onCancelTitleEdit,[`escape`])],onBlur:t=>e.onSaveTitleEdit(c)},null,8,[`modelValue`,`onKeyup`,`onBlur`])])):(u(),p(`div`,ea,[r(`h2`,ta,l(c?.title),1),c?.audio_url?(u(),n(k,{key:0,icon:`fa-solid fa-pen`,class:`edit-icon`,onClick:y(t=>e.onStartTitleEdit(c),[`stop`])},null,8,[`onClick`])):o(``,!0)])),r(`p`,na,l(c?.style),1),!c?.audio_url&&c?.progress!=null&&c?.progress<100?(u(),p(`div`,ra,[a(A,{percentage:Math.round(c.progress),"stroke-width":4,"show-text":!1,status:`warning`,class:`progress-bar`},null,8,[`percentage`]),r(`span`,ia,l(e.$t(`suno.name.generating`))+` `+l(Math.round(c.progress))+`%`,1)])):o(``,!0)]),r(`div`,aa,[a(F,null,{dropdown:m(()=>[a(P,null,{default:m(()=>[a(N,{disabled:e.isFetchingVideoUrl,onClick:t=>e.handleVideoDownload(c)},{default:m(()=>[r(`div`,sa,[e.isFetchingVideoUrl?(u(),n(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(M)]),_:1})):o(``,!0),r(`span`,null,l(e.$t(`suno.button.download_video`)),1)])]),_:1},8,[`disabled`,`onClick`]),c?.audio_url?(u(),n(N,{key:0,onClick:y(t=>e.onDownload(t,c?.audio_url),[`stop`])},{default:m(()=>[i(l(e.$t(`suno.button.download_audio`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(N,{disabled:e.isFetchingWav,onClick:t=>e.handleWavDownload(c)},{default:m(()=>[r(`div`,ca,[e.isFetchingWav?(u(),n(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(M)]),_:1})):o(``,!0),r(`span`,null,l(e.$t(`suno.button.download_wav`)),1)])]),_:1},8,[`disabled`,`onClick`]),a(N,{disabled:e.isFetchingMidi,onClick:t=>e.handleMidiDownload(c)},{default:m(()=>[r(`div`,la,[e.isFetchingMidi?(u(),n(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(M)]),_:1})):o(``,!0),r(`span`,null,l(e.$t(`suno.button.download_midi`)),1)])]),_:1},8,[`disabled`,`onClick`])]),_:2},1024)]),default:m(()=>[r(`span`,oa,[a(j,{effect:`dark`,content:e.$t(`suno.button.download`),placement:`top`},{default:m(()=>[c?.audio_url||c?.video_url?(u(),n(k,{key:0,icon:`fa-solid fa-download`,class:`icon icon-download`})):o(``,!0)]),_:2},1032,[`content`])])]),_:2},1024),a(F,null,{dropdown:m(()=>[a(P,{class:`suno-action-menu`},{default:m(()=>[c?.audio_url?(u(),n(N,{key:0,onClick:y(t=>e.onExtend(t,c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-forward`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.extend`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(N,{onClick:y(t=>e.onCover(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-music`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.cover_music`)),1)]),_:1},8,[`onClick`]),c?.id?(u(),n(N,{key:1,onClick:y(t=>e.onMashup(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-shuffle`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.mashup`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id&&c?.action===`extend`?(u(),n(N,{key:2,onClick:y(t=>e.onConcatMusic(c?.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-link`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.concat_music`)),1)]),_:1},8,[`onClick`])):o(``,!0),s[4]||=r(`div`,{class:`menu-divider`},null,-1),c?.id?(u(),n(N,{key:3,onClick:y(t=>e.onReplaceSection(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-scissors`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.replace_section`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:4,onClick:y(t=>e.onOverpainting(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-microphone`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.overpainting`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:5,onClick:y(t=>e.onUnderpainting(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-guitar`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.underpainting`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:6,onClick:y(t=>e.onSamples(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-drum`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.samples`)),1)]),_:1},8,[`onClick`])):o(``,!0),s[5]||=r(`div`,{class:`menu-divider`},null,-1),c.id?(u(),n(N,{key:7,onClick:y(t=>e.onGetStems(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-layer-group`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.get_stems`)),1)]),_:1},8,[`onClick`])):o(``,!0),c.id?(u(),n(N,{key:8,onClick:y(t=>e.onGetAllStems(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-bars-staggered`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.all_stems`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:9,onClick:y(t=>e.onRemaster(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-wand-magic-sparkles`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.remaster`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:10,onClick:y(t=>e.onExtractVocals(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-headphones`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.extract_vocals`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:11,onClick:y(t=>e.onArtistConsistency(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-palette`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.artist_consistency`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:12,onClick:y(t=>e.onAdjustSpeed(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-gauge-high`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.adjust_speed`)),1)]),_:1},8,[`onClick`])):o(``,!0),s[6]||=r(`div`,{class:`menu-divider`},null,-1),a(N,{onClick:y(t=>e.onReusePrompt(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-rotate-left`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.reuse_prompt`)),1)]),_:1},8,[`onClick`]),c?.id?(u(),n(N,{key:13,onClick:y(t=>e.onGetTiming(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-clock`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.get_timing`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(N,{onClick:y(e.onViewCode,[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-code`,class:`menu-icon`}),i(` `+l(e.$t(`common.button.viewCode`)),1)]),_:1},8,[`onClick`]),s[7]||=r(`div`,{class:`menu-divider`},null,-1),c?.id?(u(),n(N,{key:14,class:`delete-item`,onClick:y(t=>e.onDelete(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-trash`,class:`menu-icon delete-icon`}),i(` `+l(e.$t(`suno.button.delete`)),1)]),_:1},8,[`onClick`])):o(``,!0)]),_:2},1024)]),default:m(()=>[r(`span`,ua,[a(j,{effect:`dark`,content:e.$t(`suno.button.more`),placement:`top`},{default:m(()=>[c?.audio_url||c?.video_url?(u(),n(k,{key:0,icon:`fa-solid fa-ellipsis`,class:`icon icon-ellipsis`})):o(``,!0)]),_:2},1032,[`content`])])]),_:2},1024)])],10,qi))),128)),a(I,{visible:e.apiCodeVisible,"onUpdate:visible":s[3]||=t=>e.apiCodeVisible=t,method:`POST`,path:e.apiCodePath,body:e.apiCodeBody,token:e.$store.state.suno?.credential?.token||``},null,8,[`visible`,`path`,`body`,`token`])])}var fa=s({name:`RecentPanel`,components:{ElSkeletonItem:oe,ElSkeleton:se,ElInput:W,ElButton:b,ElDropdown:re,ElDropdownMenu:V,ElDropdownItem:B,ElPopover:ie,ElRadioGroup:R,ElRadioButton:L,ElSelect:E,ElOption:D,FontAwesomeIcon:Z,TaskPreview:G(Gi,[[`render`,da]]),Player:Te,NoTasks:Se,ScrollList:ve},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0,searchQuery:``,sortBy:`newest`,filterType:`all`,filterDuration:`all`,filterVideo:`all`,filterModel:`all`}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}},sortLabel(){return this.sortBy===`newest`?this.$t(`suno.sort.newest`):this.$t(`suno.sort.oldest`)},activeFilterCount(){let e=0;return this.filterType!==`all`&&e++,this.filterDuration!==`all`&&e++,this.filterVideo!==`all`&&e++,this.filterModel&&this.filterModel!==`all`&&e++,e},availableModels(){let e=this.tasks?.items||[],t=new Set;for(let n of e){let e=n?.response?.data??[];for(let n of e)n.model&&t.add(n.model)}return Array.from(t).sort()},filteredTasks(){let e=this.tasks?.items||[];if(this.searchQuery){let t=this.searchQuery.toLowerCase();e=e.filter(e=>(e?.response?.data??[]).some(e=>e.title?.toLowerCase().includes(t)||e.style?.toLowerCase().includes(t)||e.prompt?.toLowerCase().includes(t)))}return this.activeFilterCount>0&&(e=e.filter(e=>{let t=e?.request??{},n=e?.response?.data??[];return this.filterType===`vocal`&&t.instrumental===!0||this.filterType===`instrumental`&&t.instrumental!==!0?!1:this.filterDuration!==`all`||this.filterVideo!==`all`||this.filterModel&&this.filterModel!==`all`?n.some(e=>!(this.filterDuration===`short`&&!(typeof e.duration==`number`&&e.duration<60)||this.filterDuration===`medium`&&!(typeof e.duration==`number`&&e.duration>=60&&e.duration<=180)||this.filterDuration===`long`&&!(typeof e.duration==`number`&&e.duration>180)||this.filterVideo===`with`&&!e.video_url||this.filterVideo===`without`&&e.video_url||this.filterModel&&this.filterModel!==`all`&&e.model!==this.filterModel)):!0})),this.sortBy===`oldest`&&(e=[...e].reverse()),e}},methods:{onSortChange(e){this.sortBy=e},onResetFilters(){this.filterType=`all`,this.filterDuration=`all`,this.filterVideo=`all`,this.filterModel=`all`},getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),pa={key:0,class:`tasks`},ma={class:`left w-[70px] p-[10px] flex items-center`},ha={class:`main w-[calc(100%-70px)] flex-1 p-[10px]`},ga={key:0,class:`task-toolbar`},_a={key:0,class:`filter-badge`},va={class:`filter-popover`},ya={class:`filter-row`},ba={class:`filter-label`},xa={class:`filter-row`},Sa={class:`filter-label`},Ca={class:`filter-row`},wa={class:`filter-label`},Ta={key:0,class:`filter-row`},Ea={class:`filter-label`},Da={class:`filter-actions`},Oa={key:2,class:`w-full flex-1 flex items-center justify-center`},ka={class:`text-sm text-gray-400`},Aa={key:3,class:`w-full flex-1 flex flex-col items-center justify-center gap-2`},ja={class:`text-sm text-gray-400`},Ma={key:4,class:`w-full flex-1 flex items-center justify-center`},Na={class:`h-20`};function Pa(e,s,h,_,y,b){let x=f(`el-skeleton-item`),S=f(`el-skeleton`),C=f(`font-awesome-icon`),w=f(`el-input`),T=f(`el-button`),E=f(`el-dropdown-item`),D=f(`el-dropdown-menu`),O=f(`el-dropdown`),k=f(`el-radio-button`),A=f(`el-radio-group`),j=f(`el-option`),M=f(`el-select`),N=f(`el-popover`),P=f(`task-preview`),F=f(`scroll-list`),I=f(`no-tasks`),L=f(`player`);return u(),p(v,null,[e.tasks?.items===void 0?(u(),p(`div`,pa,[(u(),p(v,null,c(3,e=>r(`div`,{key:e,class:`flex`},[r(`div`,ma,[a(S,{animated:``},{template:m(()=>[a(x,{variant:`image`,class:`avatar w-[50px] h-[50px]`})]),_:1})]),r(`div`,ha,[a(S,{animated:``},{template:m(()=>[a(x,{variant:`p`,class:`w-[200px] h-[15px] mb-[5px] mt-[10px]`}),a(x,{variant:`text`})]),_:1})])])),64))])):(u(),p(v,{key:1},[e.tasks?.items?.length?(u(),p(`div`,ga,[a(w,{modelValue:e.searchQuery,"onUpdate:modelValue":s[0]||=t=>e.searchQuery=t,size:`small`,placeholder:e.$t(`suno.placeholder.searchSongs`),clearable:``,class:`task-search`},{prefix:m(()=>[a(C,{icon:`fa-solid fa-magnifying-glass`,class:`text-xs`})]),_:1},8,[`modelValue`,`placeholder`]),a(O,{trigger:`click`,onCommand:e.onSortChange},{dropdown:m(()=>[a(D,null,{default:m(()=>[a(E,{command:`newest`,class:t({"is-active":e.sortBy===`newest`})},{default:m(()=>[i(l(e.$t(`suno.sort.newest`)),1)]),_:1},8,[`class`]),a(E,{command:`oldest`,class:t({"is-active":e.sortBy===`oldest`})},{default:m(()=>[i(l(e.$t(`suno.sort.oldest`)),1)]),_:1},8,[`class`])]),_:1})]),default:m(()=>[a(T,{size:`small`,class:`sort-btn`},{default:m(()=>[a(C,{icon:`fa-solid fa-arrow-down-wide-short`,class:`mr-1`}),i(` `+l(e.sortLabel),1)]),_:1})]),_:1},8,[`onCommand`]),a(N,{trigger:`click`,placement:`bottom-end`,width:260},{reference:m(()=>[a(T,{size:`small`,class:t([`filter-btn`,{"has-active-filter":e.activeFilterCount>0}])},{default:m(()=>[a(C,{icon:`fa-solid fa-filter`,class:`mr-1`}),i(` `+l(e.$t(`suno.filter.title`))+` `,1),e.activeFilterCount>0?(u(),p(`span`,_a,l(e.activeFilterCount),1)):o(``,!0)]),_:1},8,[`class`])]),default:m(()=>[r(`div`,va,[r(`div`,ya,[r(`div`,ba,l(e.$t(`suno.filter.type`)),1),a(A,{modelValue:e.filterType,"onUpdate:modelValue":s[1]||=t=>e.filterType=t,size:`small`},{default:m(()=>[a(k,{value:`all`},{default:m(()=>[i(l(e.$t(`suno.filter.typeAll`)),1)]),_:1}),a(k,{value:`vocal`},{default:m(()=>[i(l(e.$t(`suno.filter.typeVocal`)),1)]),_:1}),a(k,{value:`instrumental`},{default:m(()=>[i(l(e.$t(`suno.filter.typeInstrumental`)),1)]),_:1})]),_:1},8,[`modelValue`])]),r(`div`,xa,[r(`div`,Sa,l(e.$t(`suno.filter.duration`)),1),a(A,{modelValue:e.filterDuration,"onUpdate:modelValue":s[2]||=t=>e.filterDuration=t,size:`small`},{default:m(()=>[a(k,{value:`all`},{default:m(()=>[i(l(e.$t(`suno.filter.durationAll`)),1)]),_:1}),a(k,{value:`short`},{default:m(()=>[i(l(e.$t(`suno.filter.durationShort`)),1)]),_:1}),a(k,{value:`medium`},{default:m(()=>[i(l(e.$t(`suno.filter.durationMedium`)),1)]),_:1}),a(k,{value:`long`},{default:m(()=>[i(l(e.$t(`suno.filter.durationLong`)),1)]),_:1})]),_:1},8,[`modelValue`])]),r(`div`,Ca,[r(`div`,wa,l(e.$t(`suno.filter.video`)),1),a(A,{modelValue:e.filterVideo,"onUpdate:modelValue":s[3]||=t=>e.filterVideo=t,size:`small`},{default:m(()=>[a(k,{value:`all`},{default:m(()=>[i(l(e.$t(`suno.filter.videoAll`)),1)]),_:1}),a(k,{value:`with`},{default:m(()=>[i(l(e.$t(`suno.filter.videoWith`)),1)]),_:1}),a(k,{value:`without`},{default:m(()=>[i(l(e.$t(`suno.filter.videoWithout`)),1)]),_:1})]),_:1},8,[`modelValue`])]),e.availableModels.length>0?(u(),p(`div`,Ta,[r(`div`,Ea,l(e.$t(`suno.filter.model`)),1),a(M,{modelValue:e.filterModel,"onUpdate:modelValue":s[4]||=t=>e.filterModel=t,size:`small`,placeholder:e.$t(`suno.filter.modelAll`),clearable:``},{default:m(()=>[a(j,{label:e.$t(`suno.filter.modelAll`),value:`all`},null,8,[`label`]),(u(!0),p(v,null,c(e.availableModels,e=>(u(),n(j,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0),r(`div`,Da,[a(T,{size:`small`,text:``,onClick:e.onResetFilters},{default:m(()=>[i(l(e.$t(`suno.filter.reset`)),1)]),_:1},8,[`onClick`])])])]),_:1})])):o(``,!0),e.filteredTasks?.length>0?(u(),n(F,{key:1,ref:`scrollList`,class:`flex-1 w-full overflow-y-auto tasks p-2`,loading:e.loading,onReachTop:s[5]||=t=>e.$emit(`reach-top`)},{default:m(()=>[(u(!0),p(v,null,c(e.filteredTasks,(e,t)=>(u(),n(P,{key:t,"model-value":e,class:`preview`},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):e.searchQuery&&e.tasks?.items?.length>0?(u(),p(`div`,Oa,[r(`p`,ka,l(e.$t(`suno.message.noSearchResults`)),1)])):e.activeFilterCount>0&&e.tasks?.items?.length>0?(u(),p(`div`,Aa,[r(`p`,ja,l(e.$t(`suno.message.noFilterResults`)),1),a(T,{size:`small`,text:``,onClick:e.onResetFilters},{default:m(()=>[i(l(e.$t(`suno.filter.reset`)),1)]),_:1},8,[`onClick`])])):e.tasks?.items?.length===0?(u(),p(`div`,Ma,[a(I)])):o(``,!0)],64)),g(r(`div`,Na,[a(L,{namespace:`suno`})],512),[[d,!!e.$store?.state?.suno?.audio?.object]])],64)}var Fa=G(fa,[[`render`,Pa],[`__scopeId`,`data-v-6ce376c9`]]),Ia=s({name:`TaskPreview`,components:{IconPicture:T,ElImage:P,ElAvatar:F,ElIcon:w},computed:{audio(){return this.$store.state.suno?.audio}}}),La={key:0,class:`size-full overflow-hidden`},Ra={class:`relative h-[300px]`},za={class:`flex items-center justify-center size-full bg-[var(--el-bg-color)]`},Ba={class:`absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent`},Va={class:`p-4`},Ha={class:`flex items-center font-bold mb-2`},Ua={class:`text-[var(--el-text-color-regular)] mb-2`},Wa={class:`text-xs text-[var(--el-text-color-regular)]`},Ga={class:`mt-4 text-sm leading-[25px] whitespace-pre-wrap`},Ka={key:1,class:`w-full h-full`};function qa(e,t,n,i,o,s){let c=f(`icon-picture`),d=f(`el-icon`),h=f(`el-image`),g=f(`el-avatar`);return e.audio?.object?(u(),p(`div`,La,[r(`div`,Ra,[a(h,{src:e.audio.image_url,fit:`cover`,class:`size-full`},{error:m(()=>[r(`div`,za,[a(d,{class:`text-3xl`},{default:m(()=>[a(c)]),_:1})])]),_:1},8,[`src`]),r(`h2`,Ba,l(e.audio?.title),1)]),r(`div`,Va,[r(`div`,Ha,[a(g,{size:30,src:e.audio?.image_url,class:`mr-2`},null,8,[`src`]),r(`span`,null,l(e.audio?.title),1)]),r(`p`,Ua,l(e.audio?.style),1),r(`p`,Wa,l(e.$dayjs.format(e.audio?.created_at)),1),r(`div`,Ga,[r(`p`,null,l(e.audio?.lyric),1)])])])):(u(),p(`div`,Ka))}var Ja=G(Ia,[[`render`,qa]]),Ya=U(`suno`),Xa=s({name:`SunoIndex`,components:{Layout:Me,ConfigPanel:Hi,RecentPanel:Fa,PreviewPanel:Ja},mixins:[_e],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===J.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===J.Request||this.fetchingTasks},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===J.Request},needApply(){return this.$store.state.suno.status.getApplications===J.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await be({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`suno/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplications`),await this.$store.dispatch(`suno/getApplications`),console.debug(`end onGetApplications`),await this.onGetTasks()},onApply(){de.create({application:this.application}).then(({data:e})=>{this.application=e,X.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&X.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`suno/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){if(!he(this.uploadTracker,e=>this.$t(e),e=>X.warning(e)))return;let e={...this.config,callback_url:Ya};if(!this.hasSunoInput(e)){X.error(this.$t(`suno.message.promptRequired`));return}this.hasText(e.prompt)&&(e.prompt=e.prompt.trim());let t=this.credential?.token;if(!t){console.error(`no token specified`);return}X.info(this.$t(`suno.message.startingTask`)),me(`suno`,K.audio(e,{token:t})).then(()=>{X.success(this.$t(`suno.message.startTaskSuccess`))}).catch(e=>{X.error(e?.response?.data?.error?.message||this.$t(`suno.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0},hasSunoInput(e){return[e.prompt,e.lyric,e.lyric_prompt,e.style,e.title].some(e=>this.hasText(e))||this.hasText(e.audio_id)||Array.isArray(e.mashup_audio_ids)&&e.mashup_audio_ids.length>0}}});function Za(e,t,r,i,o,s){let c=f(`config-panel`),l=f(`recent-panel`),d=f(`preview-panel`),p=f(`layout`);return u(),n(p,null,{config:m(()=>[a(c,{onGenerate:e.onGenerateAudio},null,8,[`onGenerate`])]),result:m(()=>[a(l,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),preview:m(()=>[a(d)]),_:1})}var Qa=G(Xa,[[`render`,Za],[`__scopeId`,`data-v-b9beee12`]]);export{Qa as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,O as i,P as a,Ut as o,X as s,et as c,k as l,lt as u}from"./vendor-chart-Df3WBvr0.js";import{t as d}from"./button-DgZFgZDr.js";import{
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,O as i,P as a,Ut as o,X as s,et as c,k as l,lt as u}from"./vendor-chart-Df3WBvr0.js";import{t as d}from"./button-DgZFgZDr.js";import{R as f,z as p}from"./constants-SseKgNeZ.js";import{S as m,bt as h}from"./index-AqzIVsbo.js";var g=a({name:`DownloadIndex`,components:{ElButton:d,QrCode:h},computed:{version(){return p},androidDownloadUrl(){return f},hasAndroidDownload(){return!!f},iosDownloadUrl(){return``},iosFallbackUrl(){return``},hasIosDownload(){return!1}},methods:{openSupport(){window.open(`https://platform.acedata.cloud/support`,`_blank`)}}}),_={class:`download-page`},v={class:`container`},y={class:`hero-shell`},b={class:`hero-copy`},x={class:`subtitle`},S={class:`hero-tags`},C={class:`tag`},w={class:`tag`},T={class:`tag tag--soft`},E={class:`hero-actions`},D={class:`metrics`},O={class:`metric`},k={class:`metric`},A={class:`metric`},j={class:`hero-panels`},M={class:`panel panel--android`},N={class:`panel__head`},P={class:`status status--live`},F={class:`panel__text`},I={key:0,class:`qr-frame`},L={class:`panel__footer`},R={class:`panel__meta`},z={class:`panel panel--ios`},B={class:`panel__head`},V={class:`status status--pending`},H={class:`panel__text`},U={class:`panel__footer panel__footer--stacked`},W={key:0,class:`button-group`},G={class:`panel__meta`},K={class:`advantage-grid`},q={class:`advantage-card`},J={class:`advantage-card`},Y={class:`advantage-card`},X={class:`note`};function Z(a,d,f,p,m,h){let g=c(`el-button`),Z=c(`qr-code`);return s(),l(`div`,_,[d[9]||=t(`div`,{class:`ambient ambient--cyan`},null,-1),d[10]||=t(`div`,{class:`ambient ambient--gold`},null,-1),t(`div`,v,[t(`section`,y,[t(`div`,b,[d[2]||=t(`p`,{class:`eyebrow`},`AceData App`,-1),t(`h1`,null,o(a.$t(`common.title.mobileApp`)),1),t(`p`,x,o(a.$t(`common.message.mobileAppDescription`)),1),t(`div`,S,[t(`span`,C,o(a.$t(`common.message.mobileAvailableNow`)),1),t(`span`,w,`v`+o(a.version),1),t(`span`,T,o(a.$t(`common.message.mobileSecureDelivery`)),1)]),t(`div`,E,[a.hasAndroidDownload?(s(),e(g,{key:0,type:`primary`,round:``,size:`large`,tag:`a`,href:a.androidDownloadUrl,target:`_blank`},{default:u(()=>[n(o(a.$t(`common.button.downloadAndroid`)),1)]),_:1},8,[`href`])):i(``,!0),r(g,{round:``,size:`large`,class:`secondary-action`,onClick:a.openSupport},{default:u(()=>[n(o(a.$t(`common.nav.support`)),1)]),_:1},8,[`onClick`])]),t(`div`,D,[t(`article`,O,[d[0]||=t(`strong`,null,`Android`,-1),t(`span`,null,o(a.$t(`common.message.mobileDirectInstall`)),1)]),t(`article`,k,[t(`strong`,null,`v`+o(a.version),1),t(`span`,null,o(a.$t(`common.message.mobileLatestRelease`)),1)]),t(`article`,A,[d[1]||=t(`strong`,null,`AceData`,-1),t(`span`,null,o(a.$t(`common.message.mobileSharedAccount`)),1)])])]),t(`div`,j,[t(`article`,M,[t(`div`,N,[d[3]||=t(`span`,{class:`platform-badge`},`Android`,-1),t(`span`,P,o(a.$t(`common.message.mobileAvailableNow`)),1)]),t(`h2`,null,o(a.$t(`common.button.downloadAndroid`)),1),t(`p`,F,o(a.$t(`common.message.mobileAndroidHint`)),1),a.hasAndroidDownload?(s(),l(`div`,I,[r(Z,{value:a.androidDownloadUrl,width:176,height:176,class:`qr`,type:`image/png`,color:{dark:`#07253dff`,light:`#ffffffff`}},null,8,[`value`])])):i(``,!0),t(`div`,L,[a.hasAndroidDownload?(s(),e(g,{key:0,type:`primary`,round:``,size:`large`,tag:`a`,href:a.androidDownloadUrl,target:`_blank`},{default:u(()=>[n(o(a.$t(`common.button.downloadAndroid`)),1)]),_:1},8,[`href`])):i(``,!0),t(`span`,R,o(a.$t(`common.message.mobileSecureDelivery`)),1)])]),t(`article`,z,[t(`div`,B,[d[4]||=t(`span`,{class:`platform-badge platform-badge--ios`},`iOS`,-1),t(`span`,V,o(a.$t(`common.message.mobileIosPending`)),1)]),t(`h2`,null,o(a.$t(`common.button.downloadIos`)),1),t(`p`,H,o(a.hasIosDownload?a.$t(`common.message.mobileIosHint`):a.$t(`common.message.mobileIosPending`)),1),d[5]||=t(`div`,{class:`device-ghost`},[t(`div`,{class:`device-ghost__screen`},[t(`span`,null,`iOS`),t(`small`,null,`Signing in progress`)])],-1),t(`div`,U,[a.hasIosDownload?(s(),l(`div`,W,[r(g,{type:`primary`,round:``,size:`large`,tag:`a`,href:a.iosDownloadUrl,target:`_blank`},{default:u(()=>[n(o(a.$t(`common.button.installIos`)),1)]),_:1},8,[`href`]),r(g,{round:``,size:`large`,tag:`a`,href:a.iosFallbackUrl,target:`_blank`},{default:u(()=>[n(o(a.$t(`common.button.downloadIos`)),1)]),_:1},8,[`href`])])):(s(),e(g,{key:1,round:``,size:`large`,class:`secondary-action`,onClick:a.openSupport},{default:u(()=>[n(o(a.$t(`common.nav.support`)),1)]),_:1},8,[`onClick`])),t(`span`,G,o(a.$t(`common.message.mobileInstallNote`)),1)])])])]),t(`section`,K,[t(`article`,q,[d[6]||=t(`p`,{class:`advantage-card__eyebrow`},`01`,-1),t(`h3`,null,o(a.$t(`common.title.mobileFastAccess`)),1),t(`p`,null,o(a.$t(`common.message.mobileFastAccess`)),1)]),t(`article`,J,[d[7]||=t(`p`,{class:`advantage-card__eyebrow`},`02`,-1),t(`h3`,null,o(a.$t(`common.title.mobileTrustedRelease`)),1),t(`p`,null,o(a.$t(`common.message.mobileTrustedRelease`)),1)]),t(`article`,Y,[d[8]||=t(`p`,{class:`advantage-card__eyebrow`},`03`,-1),t(`h3`,null,o(a.$t(`common.title.mobileUnifiedExperience`)),1),t(`p`,null,o(a.$t(`common.message.mobileUnifiedExperience`)),1)])]),t(`section`,X,[t(`p`,null,o(a.$t(`common.message.mobileInstallNote`)),1)])])])}var Q=m(g,[[`render`,Z],[`__scopeId`,`data-v-8e81a800`]]);export{Q as default};
|