@acedatacloud/nexior 3.30.0 → 3.30.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/{Auth-BFD9CUrX.js → Auth-BkGrZ4Al.js} +1 -1
- package/dist/assets/{BotPlaceholder-BfDpV6UE.js → BotPlaceholder-ClX8uvvo.js} +1 -1
- package/dist/assets/{Callback-CqMwYExD.js → Callback-IUPA4O7m.js} +1 -1
- package/dist/assets/{Console-DJ0LvdzB.js → Console-BTsHmxR2.js} +1 -1
- package/dist/assets/{Conversation-CG7Vuksf.js → Conversation-BQBR_j0K.js} +1 -1
- package/dist/assets/{CopyToClipboard-C_hpGFI6.js → CopyToClipboard-D0yPTPYW.js} +1 -1
- package/dist/assets/{Detail-DY6A4sD9.js → Detail-BcwTLOZv.js} +1 -1
- package/dist/assets/{EditArray-IlWOQ17d.js → EditArray-DpGXSb1V.js} +1 -1
- package/dist/assets/{Extra-3lJtHZjg.js → Extra-CE80Lwfe.js} +1 -1
- package/dist/assets/{FilePreview-Bpmd6-yb.js → FilePreview-FTIIxIUg.js} +1 -1
- package/dist/assets/{History-xXil8VVh.js → History-Cq4Psb81.js} +1 -1
- package/dist/assets/{ImagePreview-C81-sroB.js → ImagePreview-Dun0qhAC.js} +1 -1
- package/dist/assets/{ImageWrapper-CafePFBU.js → ImageWrapper-DAJLZ3ud.js} +1 -1
- package/dist/assets/{Index-Bq-4vMGX.js → Index-B3g6nU2_.js} +1 -1
- package/dist/assets/{Index-D7cpbssY.js → Index-B8R2yKg9.js} +1 -1
- package/dist/assets/{Index-Cwduph5Y.js → Index-B8lqf5YW.js} +1 -1
- package/dist/assets/{Index-BHWbH-IB.js → Index-BEZF06uI.js} +1 -1
- package/dist/assets/{Index-BPsxCJLR.css → Index-BS4HFQ5A.css} +1 -1
- package/dist/assets/{Index-BttSzwZS.js → Index-BdtTQ6vy.js} +1 -1
- package/dist/assets/{Index-BTMnpHAB.js → Index-Bj7Azusj.js} +1 -1
- package/dist/assets/{Index-D4VINF4l.js → Index-BlTMjqXS.js} +1 -1
- package/dist/assets/{Index-ByRQW5yK.css → Index-C1IT2qoC.css} +1 -1
- package/dist/assets/{Index-D0HSsKHV.css → Index-CB8Rnaiw.css} +1 -1
- package/dist/assets/{Index-BHPQlSrx.css → Index-CXVGa2ZU.css} +1 -1
- package/dist/assets/{Index-BvGIjCeq.js → Index-CisgqdWF.js} +1 -1
- package/dist/assets/{Index-BFGf-YYs.js → Index-DOEux2Eg.js} +1 -1
- package/dist/assets/{Index-DFtrjaKk.js → Index-DQFKWn2R.js} +1 -1
- package/dist/assets/{Index-D1QgA58M.css → Index-DWp92Qyv.css} +1 -1
- package/dist/assets/{Index-CczNCX1V.js → Index-DWvt1qKL.js} +1 -1
- package/dist/assets/{Index-C_lTdl1n.js → Index-DXqYbSJL.js} +1 -1
- package/dist/assets/{Index-qHMVcnL5.js → Index-DfUlcZfy.js} +1 -1
- package/dist/assets/{Index-DE-Le67g.js → Index-DyjIS2LR.js} +1 -1
- package/dist/assets/{Index-Dlkri-Nx.js → Index-KwYNRzOz.js} +1 -1
- package/dist/assets/{Index-DOijBIse.js → Index-M5tWRCsH.js} +1 -1
- package/dist/assets/{Index-D_fTTJPb.js → Index-Zpzkw1HQ.js} +1 -1
- package/dist/assets/{Index-D_ER7_wh.css → Index-feu64dNe.css} +1 -1
- package/dist/assets/{Index-DeBTh_5M.js → Index-ocDyFWdk.js} +1 -1
- package/dist/assets/{Invitees-Bwf6Sx5L.js → Invitees-BCHKmn__.js} +1 -1
- package/dist/assets/{List-BuzBZYNs.js → List-0wMSr6sl.js} +1 -1
- package/dist/assets/{List-DykznTcB.js → List-D-RW25bD.js} +1 -1
- package/dist/assets/{List-Cm_1Pl_m.js → List-DX7teWzL.js} +1 -1
- package/dist/assets/{Main-U-Zwfh9K.js → Main-DgiFebD-.js} +1 -1
- package/dist/assets/{Navigator--_Jw-oQ6.js → Navigator-D08MfOeK.js} +1 -1
- package/dist/assets/{NoTasks-Bg3dk3Zk.js → NoTasks-CQZOGbwI.js} +1 -1
- package/dist/assets/{Pagination-Chbfcf6l.js → Pagination-B1kOfzR8.js} +1 -1
- package/dist/assets/{ScrollList-DtikpNk7.js → ScrollList-CfFOKFbb.js} +1 -1
- package/dist/assets/{Status-CaUFs7gn.js → Status-CviAA8Me.js} +1 -1
- package/dist/assets/{Subscribe-Ccl8kWoO.js → Subscribe-QybZFlvY.js} +1 -1
- package/dist/assets/{VideoPlayer-CXGW06AO.js → VideoPlayer-Bx5Q-Jo7.js} +1 -1
- package/dist/assets/{distribution-dxlLtIkZ.js → distribution-D9pkXpfI.js} +1 -1
- package/dist/assets/{index-BceQaAb7.js → index-BwtxyV6k.js} +2 -2
- package/dist/assets/{order-C7LItaBN.js → order-DYcfG_Yw.js} +1 -1
- package/dist/assets/{price-DtWUJRlS.js → price-Clo8IP03.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/robots.txt +42 -0
- package/dist/sitemap.xml +124 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as g}from"./Pagination-
|
|
1
|
+
import{P as g}from"./Pagination-B1kOfzR8.js";import{C as b}from"./CopyToClipboard-D0yPTPYW.js";import{b as w}from"./distribution-D9pkXpfI.js";import{_ as y}from"./index-BwtxyV6k.js";import"./vendor-B4-12K57.js";import{g as $}from"./price-Clo8IP03.js";import{t as C,u as v,w as D,x as H,y as P}from"./vendor-element-plus-C2t7-rNg.js";import{d as S,R as p,S as o,l as e,am as s,a,Z as n,U as E,at as F,o as u}from"./vendor-vue-BzRnDgD5.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-nHemWFue.js";import"./vendor-dayjs-D6Igi227.js";import"./vendor-katex-DHBGsivc.js";const k=S({name:"ConsoleDistributionList",components:{Pagination:g,CopyToClipboard:b,ElRow:P,ElCol:H,ElTable:D,ElTableColumn:v,ElCard:C},data(){return{distributionHistories:[],distributionStatus:void 0,loading:!1,total:void 0,limit:10}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||"1")}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onFetchData()},methods:{getPriceString:$,onPageChange(t){this.$router.push({name:this.$route.name?.toString(),query:{page:t}})},onFetchData(){this.loading=!0,Promise.all([this.onFetchDistributionHistory()]).finally(()=>{this.loading=!1})},async onFetchDistributionHistory(){const{data:t}=await w.getAll({user_id:this.$store.getters.user.id,ordering:"-created_at",limit:this.limit,offset:(this.page-1)*this.limit});this.distributionHistories=t.items,this.total=t.count}}}),q={class:"title"},B={class:"key"},I={class:"copy"},T={class:"key"},z={class:"copy"},A={class:"price"},N={class:"description"},R={class:"description"},V={class:"created-at"},j={class:"pagination m-v-lg"};function L(t,O,U,Z,G,J){const l=s("el-col"),d=s("el-row"),c=s("copy-to-clipboard"),r=s("el-table-column"),_=s("el-table"),m=s("el-card"),h=s("pagination"),f=F("loading");return u(),p(d,{class:"panel"},{default:o(()=>[e(l,{span:24},{default:o(()=>[e(d,null,{default:o(()=>[e(l,{span:24},{default:o(()=>[a("h2",q,n(t.$t("common.title.distributionHistory")),1)]),_:1})]),_:1}),e(d,null,{default:o(()=>[e(l,{span:24},{default:o(()=>[e(m,{shadow:"hover"},{default:o(()=>[E((u(),p(_,{data:t.distributionHistories,stripe:""},{default:o(()=>[e(r,{prop:"id",label:t.$t("distribution.field.id"),"class-name":"text-center",width:"350px"},{default:o(i=>[a("span",B,n(i.row.id),1),a("span",I,[e(c,{content:i.row.id},null,8,["content"])])]),_:1},8,["label"]),e(r,{prop:"id",label:t.$t("distribution.field.userId"),"class-name":"text-center",width:"350px"},{default:o(i=>[a("span",T,n(i.row.user_id),1),a("span",z,[e(c,{content:i.row.user_id},null,8,["content"])])]),_:1},8,["label"]),e(r,{label:t.$t("distribution.field.price"),width:"100px"},{default:o(i=>[a("span",A,n(t.getPriceString({value:i.row?.price})),1)]),_:1},8,["label"]),e(r,{label:t.$t("distribution.field.reward"),width:"100px"},{default:o(i=>[a("span",N,n(t.getPriceString({value:i.row?.reward})),1)]),_:1},8,["label"]),e(r,{label:t.$t("distribution.field.percentage"),width:"120px"},{default:o(i=>[a("span",R,n(i.row.percentage)+"%",1)]),_:1},8,["label"]),e(r,{label:t.$t("distribution.field.createdAt"),width:"200px"},{default:o(i=>[a("span",V,n(t.$dayjs.format(i.row.created_at)),1)]),_:1},8,["label"])]),_:1},8,["data"])),[[f,t.loading]])]),_:1})]),_:1})]),_:1}),e(d,null,{default:o(()=>[e(l,{span:10,offset:14},{default:o(()=>[a("div",j,[e(h,{"current-page":t.page,"page-size":t.limit,total:t.total,onChange:t.onPageChange},null,8,["current-page","page-size","total","onChange"])])]),_:1})]),_:1})]),_:1})]),_:1})}const st=y(k,[["render",L],["__scopeId","data-v-74b9e778"]]);export{st as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bH as m}from"./vendor-B4-12K57.js";import{P as d}from"./vendor-element-plus-C2t7-rNg.js";import{d as u,c as r,a as t,U as s,W as f,_ as a,l as n,am as l,a1 as g,o as i}from"./vendor-vue-BzRnDgD5.js";import{_ as v}from"./index-
|
|
1
|
+
import{bH as m}from"./vendor-B4-12K57.js";import{P as d}from"./vendor-element-plus-C2t7-rNg.js";import{d as u,c as r,a as t,U as s,W as f,_ as a,l as n,am as l,a1 as g,o as i}from"./vendor-vue-BzRnDgD5.js";import{_ as v}from"./index-BwtxyV6k.js";const b=u({name:"ImagePreview",components:{FontAwesomeIcon:m,ElProgress:d},props:{url:{type:String,required:!0},name:{type:String,required:!0},percentage:{type:Number,required:!1,default:void 0},closable:{type:Boolean,required:!1,default:!0}},emits:["remove"]}),h={class:"image w-[50px] h-[50px] relative rounded-[var(--el-border-radius-base)] overflow-hidden shadow-sm bg-[var(--el-fill-color-lighter)]"},w=["src","alt"],_={class:"overlay absolute inset-0 bg-[var(--el-mask-color)] backdrop-blur-[1px]"},x={key:0,class:"close absolute cursor-pointer top-[4px] right-[4px] bg-[rgba(0,0,0,0.65)] text-white w-[16px] h-[16px] rounded-full flex text-[10px] text-center items-center justify-center hover:bg-[rgba(0,0,0,0.8)]"};function y(e,o,k,$,q,B){const c=l("el-progress"),p=l("font-awesome-icon");return i(),r("div",h,[t("img",{class:"w-full h-full object-cover",src:e.url,alt:e.name},null,8,w),s(t("div",_,null,512),[[a,e.percentage&&e.percentage<100]]),s(n(c,{type:"circle","stroke-width":4,percentage:e.percentage,width:34,class:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[34px] h-[34px] z-[10] m-auto text-[12px]"},null,8,["percentage"]),[[a,e.percentage&&e.percentage<100]]),e.closable?(i(),r("div",x,[n(p,{icon:"fa-solid fa-xmark",class:"icon icon-close",onClick:o[0]||(o[0]=g(C=>e.$emit("remove"),["stop"]))})])):f("",!0)])}const V=v(b,[["render",y]]);export{V as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as i}from"./vendor-element-plus-C2t7-rNg.js";import{d as m,c as a,W as p,R as l,S as d,Y as u,Z as f,am as g,o as s}from"./vendor-vue-BzRnDgD5.js";import{_ as w}from"./index-
|
|
1
|
+
import{k as i}from"./vendor-element-plus-C2t7-rNg.js";import{d as m,c as a,W as p,R as l,S as d,Y as u,Z as f,am as g,o as s}from"./vendor-vue-BzRnDgD5.js";import{_ as w}from"./index-BwtxyV6k.js";const y=m({name:"ImageWrapper",components:{ElButton:i},props:{src:{type:String,required:!0},rawSrc:{type:String,required:!1,default:void 0}},methods:{onOpenUrl(e){window.open(e,"_blank")},onReload(e){const r=e.target,t=new URL(r.src),o=t.searchParams.get("retry");if(!o)t.searchParams.set("retry","1");else if(parseInt(o)<2)t.searchParams.set("retry",(parseInt(o)+1).toString());else return;r.src=t.toString()}}}),S={class:"image-wrapper"},_=["src"];function k(e,r,t,o,I,b){const c=g("el-button");return s(),a("div",S,[e.src?(s(),a("img",{key:0,src:e.src,class:"image",onError:r[0]||(r[0]=n=>e.onReload(n))},null,40,_)):p("",!0),e.rawSrc?(s(),l(c,{key:1,type:"info",round:"",class:"btn-raw",onClick:r[1]||(r[1]=n=>e.onOpenUrl(e.rawSrc))},{default:d(()=>[u(f(e.$t("common.button.seeRawImage")),1)]),_:1})):p("",!0)])}const R=w(y,[["render",k],["__scopeId","data-v-012b4a9e"]]);export{R as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as T,a as D,b as E}from"./EditArray-
|
|
1
|
+
import{E as T,a as D,b as E}from"./EditArray-DpGXSb1V.js";import{d as U,_ as F}from"./index-BwtxyV6k.js";import"./vendor-B4-12K57.js";import{I as V,j as _,J as q,t as A,x as j,i as B,y as L,n as N}from"./vendor-element-plus-C2t7-rNg.js";import{d as R,R as O,S as s,l as t,am as n,a as l,Z as o,Y as m,c as y,ak as Q,F as W,o as w,U as k,W as J,_ as C}from"./vendor-vue-BzRnDgD5.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-nHemWFue.js";import"./vendor-dayjs-D6Igi227.js";import"./vendor-katex-DHBGsivc.js";const K=R({name:"SiteIndex",components:{EditText:E,EditImage:D,EditArray:T,ElDivider:N,ElRow:L,ElImage:B,ElCol:j,ElCard:A,ElForm:q,ElSwitch:_,ElFormItem:V},data(){return{editing:{title:!1}}},computed:{site(){return this.$store.getters.site}},methods:{onSave(e){const a={...this.site,...e};U.update(this.site?.id,a).then(()=>{console.debug("getSite for id",this.site?.id),this.$store.dispatch("getSite")})}}}),Y={class:"title"},Z={class:"title"},z={class:"block w-full"},G={class:"block tip"},H={class:"block w-full"},M={class:"block tip"},P={class:"block w-full"},X={class:"block tip"},x={class:"block w-full"},ee={class:"block tip"},te={class:"block w-full"},ie={class:"block tip"},se={class:"title"},le={class:"block w-full"},oe={class:"block tip"},ae={class:"block w-full"},de={class:"block tip"},ne={class:"title"},re={class:"block tip"},me={class:"block tip"},ue={class:"title"},pe={class:"w-full"},fe={class:"block tip w-full"},be={key:0},ve={class:"block w-full"},he={class:"block w-full"};function ce(e,a,$e,ge,we,ke){const f=n("el-col"),h=n("el-row"),u=n("el-divider"),d=n("el-form-item"),p=n("edit-text"),c=n("el-image"),$=n("edit-image"),I=n("edit-array"),b=n("el-form"),v=n("el-card"),g=n("el-switch");return w(),O(h,{class:"panel"},{default:s(()=>[t(f,{span:24},{default:s(()=>[t(h,null,{default:s(()=>[t(f,{span:24},{default:s(()=>[l("h2",Y,o(e.$t("common.title.site")),1)]),_:1})]),_:1}),t(h,{gutter:15},{default:s(()=>[t(f,{md:12,xs:24},{default:s(()=>[t(v,{shadow:"hover",class:"mb-4"},{default:s(()=>[l("h4",Z,o(e.$t("site.title.basicConfig")),1),t(u),t(b,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:s(()=>[t(d,{label:e.$t("site.field.origin")},{default:s(()=>[l("span",z,o(e.site.origin),1),l("span",G,o(e.$t("site.message.originTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.title")},{default:s(()=>[l("span",H,[m(o(e.site.title)+" ",1),t(p,{"model-value":e.site.title,title:e.$t("site.title.editTitle"),placeholder:e.$t("site.placeholder.title"),onConfirm:a[0]||(a[0]=i=>e.onSave({title:i}))},null,8,["model-value","title","placeholder"])]),l("span",M,o(e.$t("site.message.titleTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.logo")},{default:s(()=>[l("span",P,[t(c,{src:e.site.logo,class:"logo"},null,8,["src"]),t($,{"model-value":e.site.logo,title:e.$t("site.title.editLogo"),tip:e.$t("site.message.editLogoTip"),onConfirm:a[1]||(a[1]=i=>e.onSave({logo:i}))},null,8,["model-value","title","tip"])]),l("span",X,o(e.$t("site.message.logoTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.favicon")},{default:s(()=>[l("span",x,[t(c,{src:e.site.favicon,class:"favicon"},null,8,["src"]),t($,{"model-value":e.site.favicon,title:e.$t("site.title.editFavicon"),tip:e.$t("site.message.editFaviconTip"),onConfirm:a[2]||(a[2]=i=>e.onSave({favicon:i}))},null,8,["model-value","title","tip"])]),l("span",ee,o(e.$t("site.message.faviconTip")),1)]),_:1},8,["label"]),t(u,{"border-style":"dashed"}),t(d,{label:e.$t("site.field.admins")},{default:s(()=>[l("span",te,[m(o(e.site.admins?.join(", "))+" ",1),t(I,{"model-value":e.site?.admins||[],title:e.$t("site.title.editAdmins"),placeholder:e.$t("site.placeholder.admins"),tip:e.$t("site.message.adminsTip2"),min:1,"min-error-message":e.$t("site.message.atLeastOneAdmin"),onConfirm:a[3]||(a[3]=i=>e.onSave({admins:i}))},null,8,["model-value","title","placeholder","tip","min-error-message"])]),l("span",ie,o(e.$t("site.message.adminsTip")),1)]),_:1},8,["label"])]),_:1},8,["model"])]),_:1}),t(v,{shadow:"hover"},{default:s(()=>[l("h4",se,o(e.$t("site.title.seoConfig")),1),t(u),t(b,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:s(()=>[t(d,{label:e.$t("site.field.description")},{default:s(()=>[l("span",le,[m(o(e.site.description)+" ",1),t(p,{"model-value":e.site.description,title:e.$t("site.title.editDescription"),placeholder:e.$t("site.placeholder.description"),onConfirm:a[4]||(a[4]=i=>e.onSave({description:i}))},null,8,["model-value","title","placeholder"])]),l("span",oe,o(e.$t("site.message.descriptionTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.keywords")},{default:s(()=>[l("span",ae,[m(o(e.site.keywords?.join(", "))+" ",1),t(I,{"model-value":e.site?.keywords||[],title:e.$t("site.title.editKeywords"),placeholder:e.$t("site.placeholder.keywords"),tip:e.$t("site.message.keywordsTip2"),onConfirm:a[5]||(a[5]=i=>e.onSave({keywords:i}))},null,8,["model-value","title","placeholder","tip"])]),l("span",de,o(e.$t("site.message.keywordsTip")),1)]),_:1},8,["label"])]),_:1},8,["model"])]),_:1})]),_:1}),t(f,{md:12,xs:24},{default:s(()=>[t(v,{shadow:"hover",class:"mb-4"},{default:s(()=>[l("h4",ne,o(e.$t("site.title.distributionConfig")),1),t(u),t(b,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:s(()=>[t(d,{label:e.$t("site.field.distributionDefaultInviterId")},{default:s(()=>[m(o(e.site.distribution?.default_inviter_id)+" ",1),t(p,{"model-value":e.site.distribution?.default_inviter_id,title:e.$t("site.title.editDistributionDefaultInviterId"),placeholder:e.$t("site.placeholder.editDistributionDefaultInviterId"),onConfirm:a[6]||(a[6]=i=>e.onSave({distribution:{...e.site.distribution,default_inviter_id:i}}))},null,8,["model-value","title","placeholder"]),l("span",re,o(e.$t("site.message.distributionDefaultInviterIdTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.distributionForceInviterId")},{default:s(()=>[m(o(e.site.distribution?.force_inviter_id)+" ",1),t(p,{"model-value":e.site.distribution?.force_inviter_id,title:e.$t("site.title.editDistributionForceInviterId"),placeholder:e.$t("site.placeholder.editDistributionForceInviterId"),onConfirm:a[7]||(a[7]=i=>e.onSave({distribution:{...e.site.distribution,force_inviter_id:i}}))},null,8,["model-value","title","placeholder"]),l("span",me,o(e.$t("site.message.distributionForceInviterIdTip")),1)]),_:1},8,["label"])]),_:1},8,["model"])]),_:1}),t(v,{shadow:"hover"},{default:s(()=>[l("h4",ue,o(e.$t("site.title.featuresConfig")),1),t(u),t(b,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:s(()=>[(w(),y(W,null,Q(["chat","midjourney","qrart","nanobanana","seedream","seedance","suno","luma","pika","kling","flux","hailuo","headshots","support"],(i,S)=>t(d,{key:S,label:e.$t("site.field.features"+i.charAt(0).toUpperCase()+i.slice(1))},{default:s(()=>[l("div",pe,[t(g,{"model-value":e.site.features[i]?.enabled||!1,"inline-prompt":"","active-text":e.$t("site.button.enabled"),"inactive-text":e.$t("site.button.disabled"),"onUpdate:modelValue":r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],enabled:r}}})},null,8,["model-value","active-text","inactive-text","onUpdate:modelValue"])]),l("span",fe,o(e.$t("site.message.features"+i.charAt(0).toUpperCase()+i.slice(1))),1),i==="support"?k((w(),y("div",be,[t(d,{label:"WeChat"},{default:s(()=>[t(g,{"model-value":e.site.features[i]?.wechat?.enabled||!1,"inline-prompt":"","active-text":e.$t("site.button.enabled"),"inactive-text":e.$t("site.button.disabled"),"onUpdate:modelValue":r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],wechat:{...e.site.features[i]?.wechat,enabled:r}}}})},null,8,["model-value","active-text","inactive-text","onUpdate:modelValue"])]),_:2},1024),k(t(d,{label:e.$t("site.field.qr")},{default:s(()=>[l("span",ve,[t(c,{src:e.site.features[i]?.wechat?.qr},null,8,["src"]),t($,{"model-value":e.site.features[i]?.wechat?.qr,title:e.$t("site.title.editQR"),tip:e.$t("site.message.editQRTip"),onConfirm:r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],wechat:{...e.site.features[i]?.wechat,qr:r}}}})},null,8,["model-value","title","tip","onConfirm"])])]),_:2},1032,["label"]),[[C,e.site.features[i]?.wechat?.enabled]]),t(d,{label:"Discord"},{default:s(()=>[t(g,{"model-value":e.site.features[i]?.discord?.enabled||!1,"inline-prompt":"","active-text":e.$t("site.button.enabled"),"inactive-text":e.$t("site.button.disabled"),"onUpdate:modelValue":r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],discord:{...e.site.features[i]?.discord,enabled:r}}}})},null,8,["model-value","active-text","inactive-text","onUpdate:modelValue"])]),_:2},1024),k(t(d,{label:e.$t("site.field.url")},{default:s(()=>[l("span",he,[m(o(e.site.features[i]?.discord?.url)+" ",1),t(p,{"model-value":e.site.features[i]?.discord?.url,title:e.$t("site.title.editUrl"),placeholder:e.$t("site.placeholder.editUrl"),onConfirm:r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],discord:{...e.site.features[i]?.discord,url:r}}}})},null,8,["model-value","title","placeholder","onConfirm"])])]),_:2},1032,["label"]),[[C,e.site.features[i]?.discord?.enabled]])],512)),[[C,e.site.features[i]?.enabled]]):J("",!0)]),_:2},1032,["label"])),64))]),_:1},8,["model"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}const Ve=F(K,[["render",ce],["__scopeId","data-v-de742379"]]);export{Ve as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bH as A}from"./vendor-B4-12K57.js";import{k as C,O as W,q as H,r as N,s as V,K as j,L as O,o as Z,C as K,i as Y}from"./vendor-element-plus-C2t7-rNg.js";import{d as k,c as i,a as c,l as s,P as D,S as _,am as n,o as a,Z as o,Y as u,F as w,ak as I,R as E,W as v,V as R,a1 as J}from"./vendor-vue-BzRnDgD5.js";import{_ as y,a5 as Q,bY as X,bZ as x,b_ as ee,b$ as se,c0 as te,c1 as oe,c2 as U,c3 as q,c4 as G,c5 as B,c6 as ae,ak as ne,ah as P}from"./index-BceQaAb7.js";import{I as M,S as le}from"./ScrollList-DtikpNk7.js";import{I as F}from"./ImagePreview-C81-sroB.js";import{C as re,N as ie}from"./NoTasks-Bg3dk3Zk.js";import{a as ce}from"./price-DtWUJRlS.js";import{C as de}from"./CopyToClipboard-C_hpGFI6.js";import{I as me}from"./ImageWrapper-CafePFBU.js";import{B as ue}from"./BotPlaceholder-BfDpV6UE.js";import"./vendor-dayjs-D6Igi227.js";import"./vendor-katex-DHBGsivc.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-nHemWFue.js";const pe=k({name:"LayoutSeedream",components:{ElDrawer:W,ElButton:C,FontAwesomeIcon:A},data(){return{drawer:!1}}}),fe={class:"main flex flex-row flex-1"},he={class:"config w-[300px] h-full overflow-y-scroll bg-[var(--app-sidebar-bg)]"},_e={class:"result h-full p-[15px] flex-1 flex flex-col"};function ge(e,t,g,r,m,p){const f=n("font-awesome-icon"),h=n("el-button"),l=n("el-drawer");return a(),i("div",fe,[c("div",he,[D(e.$slots,"config",{},void 0,!0)]),c("div",_e,[D(e.$slots,"result",{},void 0,!0)]),s(h,{circle:"",class:"menu",onClick:t[0]||(t[0]=d=>e.drawer=!0)},{default:_(()=>[s(f,{icon:"fa-solid fa-magic"})]),_:1}),s(l,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=d=>e.drawer=d),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:_(()=>[D(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const $e=y(pe,[["render",ge],["__scopeId","data-v-b4ad94f1"]]),ve="",be=k({name:"SeedreamPromptInput",components:{ElInput:H,InfoIcon:M},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("seedream/setConfig",{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=ve)}}),ke={class:"field"},ye={class:"box"},we={class:"title font-bold"};function Ee(e,t,g,r,m,p){const f=n("info-icon"),h=n("el-input");return a(),i("div",ke,[c("div",ye,[c("h2",we,o(e.$t("seedream.name.prompt")),1),s(f,{content:e.$t("seedream.description.prompt"),class:"info"},null,8,["content"])]),s(h,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("seedream.placeholder.prompt")},null,8,["modelValue","placeholder"])])}const Se=y(be,[["render",Ee],["__scopeId","data-v-5559520a"]]),Ve=k({name:"SeedreamImageInput",components:{ElUpload:N,ElButton:C,InfoIcon:M,ImagePreview:F,FontAwesomeIcon:A},data(){return{fileList:[],uploadUrl:Q()+"/api/v1/files/",suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.seedream?.config?.image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){const r=(this.fileList||[]).filter(m=>!m?.response?.file_url);this.fileList=r.length?r:[];return}const t=[];e.forEach(r=>{const m=this.fileList.find(p=>p?.response?.file_url===r||p?.url===r);m?t.push(m):t.push({name:r.split("/").pop()||r,url:r,status:"success",percentage:100,response:{file_url:r}})}),(this.fileList||[]).filter(r=>!r?.response?.file_url).forEach(r=>{t.some(p=>p===r||p?.url===r?.url||p?.response?.file_url===r?.response?.file_url)||t.push(r)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url=="string"&&e.url.startsWith("blob:"))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){V.warning(this.$t("seedream.message.uploadImageExceed"))},onError(){V.error(this.$t("seedream.message.uploadImageError"))},onSetImages(){const e=this.urls;this.suppressWatch=!0,this.$store.commit("seedream/setConfig",{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url=="string"&&t.url.startsWith("blob:"))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),Ie={class:"field"},Le={class:"label"},Re={class:"box"},Te={class:"title font-bold"},Ae={class:"value"},Ce={class:"file-list mt-2 flex flex-wrap gap-[10px]"};function Me(e,t,g,r,m,p){const f=n("info-icon"),h=n("font-awesome-icon"),l=n("el-button"),d=n("el-upload"),b=n("image-preview");return a(),i(w,null,[c("div",Ie,[c("div",Le,[c("div",Re,[c("h2",Te,o(e.$t("seedream.name.imageUrls")),1),s(f,{content:e.$t("seedream.description.imageUrls"),class:"info"},null,8,["content"])])]),c("div",Ae,[s(d,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=$=>e.fileList=$),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",limit:14,multiple:!0,"show-file-list":!1,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-change":e.onChange,"on-remove":e.onRemove,headers:e.headers},{default:_(()=>[s(l,{size:"small",type:"primary",round:""},{default:_(()=>[s(h,{icon:"fa-solid fa-upload",class:"mr-1"}),u(" "+o(e.$t("seedream.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","on-change","on-remove","headers"])])]),c("div",Ce,[(a(!0),i(w,null,I(e.fileList,($,S)=>(a(),E(b,{key:$.uid||$?.response?.file_url||$.url||S,url:$.url||$?.response?.file_url,name:$.name,percentage:$.percentage,onRemove:z=>e.onRemovePreview(S,$)},null,8,["url","name","percentage","onRemove"]))),128))])],64)}const De=y(Ve,[["render",Me],["__scopeId","data-v-29737ed9"]]),ze=k({name:"SeedreamModelSelector",components:{ElSelect:O,ElOption:j,InfoIcon:M},data(){return{options:[{value:x,label:this.$t("seedream.model.seedream45")},{value:ee,label:this.$t("seedream.model.seedream40")},{value:se,label:this.$t("seedream.model.seedream30t2i")},{value:te,label:this.$t("seedream.model.seededit30i2i")}]}},computed:{value:{get(){return this.$store.state.seedream?.config?.model},set(e){this.$store.commit("seedream/setConfig",{...this.$store.state.seedream?.config,model:e})}}},mounted(){this.value||(this.value=X)}}),Ue={class:"field"},qe={class:"label"},Ge={class:"box"},Pe={class:"title font-bold"};function je(e,t,g,r,m,p){const f=n("info-icon"),h=n("el-option"),l=n("el-select");return a(),i("div",Ue,[c("div",qe,[c("div",Ge,[c("h2",Pe,o(e.$t("seedream.name.model")),1),s(f,{content:e.$t("seedream.description.model"),class:"info"},null,8,["content"])])]),s(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=d=>e.value=d),class:"value",placeholder:e.$t("seedream.placeholder.select")},{default:_(()=>[(a(!0),i(w,null,I(e.options,d=>(a(),E(h,{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Oe=y(ze,[["render",je],["__scopeId","data-v-3c3ca27d"]]),Be=k({name:"SeedreamSizeSelector",components:{ElSelect:O,ElOption:j,InfoIcon:M},data(){return{options:[{value:U,label:U},{value:q,label:q},{value:G,label:G}]}},computed:{value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit("seedream/setConfig",{...this.$store.state.seedream?.config,size:e})}}},mounted(){this.value||(this.value=oe)}}),Fe={class:"field"},We={class:"label"},He={class:"box"},Ne={class:"title font-bold"};function Ze(e,t,g,r,m,p){const f=n("info-icon"),h=n("el-option"),l=n("el-select");return a(),i("div",Fe,[c("div",We,[c("div",He,[c("h2",Ne,o(e.$t("seedream.name.size")),1),s(f,{content:e.$t("seedream.description.size"),class:"info"},null,8,["content"])])]),s(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=d=>e.value=d),class:"value",placeholder:e.$t("seedream.placeholder.select"),filterable:"","allow-create":"","default-first-option":""},{default:_(()=>[(a(!0),i(w,null,I(e.options,d=>(a(),E(h,{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ke=y(Be,[["render",Ze],["__scopeId","data-v-54a9a469"]]),Ye=k({name:"SeedreamConfigPanel",components:{ElButton:C,FontAwesomeIcon:A,PromptInput:Se,Consumption:re,ImageInput:De,ModelSelector:Oe,SizeSelector:Ke},emits:["generate"],computed:{config(){return this.$store.state.seedream?.config},consumption(){const e={...this.config||{}},t=Array.isArray(e?.image)&&e.image.length>0;return ce({...e,action:t?"edit":"generate",model:B(e?.model),count:1},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Je={class:"flex flex-col h-full"},Qe={class:"flex-1 overflow-y-auto p-[15px]"},Xe={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function xe(e,t,g,r,m,p){const f=n("model-selector"),h=n("size-selector"),l=n("prompt-input"),d=n("image-input"),b=n("consumption"),$=n("font-awesome-icon"),S=n("el-button");return a(),i("div",Je,[c("div",Qe,[s(f,{class:"mb-4"}),s(h,{class:"mb-4"}),s(l,{class:"mb-4"}),s(d,{class:"mb-4"})]),c("div",Xe,[s(b,{value:e.consumption,service:e.service},null,8,["value","service"]),s(S,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:_(()=>[s($,{icon:"fa-solid fa-magic",class:"mr-2"}),u(" "+o(e.$t("seedream.button.generate")),1)]),_:1},8,["onClick"])])])}const es=y(Ye,[["render",xe]]),ss=k({name:"SeedreamTaskPreview",components:{ElImage:Y,CopyToClipboard:de,FontAwesomeIcon:A,ElAlert:K,ImageWrapper:me,ElButton:C,ElTooltip:Z,ImagePreview:F},props:{modelValue:{type:Object,required:!0}},computed:{isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){const e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{shortModel(e){return B(e)||e},onEdit(e){if(!e)return;console.debug("Edit image:",e);const t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit("seedream/setConfig",t)}}}),ts={class:"preview"},os={class:"left"},as={class:"main"},ns={class:"bot"},ls={class:"datetime"},rs={class:"info"},is={key:0,class:"flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto"},cs={key:1,class:"prompt mt-2"},ds={key:0},ms={key:0,class:R({content:!0})},us={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ps={key:1,class:R({content:!0,failed:!0})},fs={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},hs={class:R({operations:!0,"mt-2":!0,"mb-2":!0})},_s={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},gs={key:1,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},$s={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},vs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},bs={key:2,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ks={key:2,class:R({content:!0})},ys={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ws={key:1,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Es={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ss={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Vs={key:2,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Is={key:3,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ls={key:3,class:R({content:!0})},Rs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ts={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function As(e,t,g,r,m,p){const f=n("el-image"),h=n("image-preview"),l=n("font-awesome-icon"),d=n("copy-to-clipboard"),b=n("el-alert"),$=n("image-wrapper"),S=n("el-button"),z=n("el-tooltip");return a(),i("div",ts,[c("div",os,[s(f,{src:"https://cdn.acedata.cloud/9egrbn.png",class:"avatar"})]),c("div",as,[c("div",ns,[u(o(e.$t("seedream.name.seedreamBot"))+" ",1),c("span",ls,o(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",rs,[Array.isArray(e.modelValue?.request?.image)&&e.modelValue?.request?.image.length>0?(a(),i("div",is,[(a(!0),i(w,null,I(e.modelValue?.request?.image,(L,T)=>(a(),E(h,{key:T,url:L,name:`image-${T+1}`,closable:!1},null,8,["url","name"]))),128))])):v("",!0),e.modelValue?.request?.prompt?(a(),i("p",cs,[u(o(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?v("",!0):(a(),i("span",ds," - ("+o(e.$t("seedream.status.pending"))+") ",1))])):v("",!0)]),e.modelValue?.response?e.modelValue?.response?.success===!0?(a(),i("div",ps,[c("div",fs,[(a(!0),i(w,null,I(e.images,(L,T)=>(a(),E($,{key:T,src:L?.image_url,"raw-src":L?.image_url},null,8,["src","raw-src"]))),128))]),c("div",hs,[s(z,{class:"box-item",effect:"dark",content:e.$t("common.button.edit"),placement:"top-start"},{default:_(()=>[s(S,{type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=J(L=>e.onEdit(e.images?.[0]?.image_url),["stop"]))},{default:_(()=>[u(o(e.$t("common.button.edit")),1)]),_:1})]),_:1},8,["content"])]),s(b,{closable:!1,class:"mt-2 success"},{default:_(()=>[e.modelValue?.request?.model?(a(),i("p",_s,[s(l,{icon:"fa-solid fa-cube",class:"mr-1"}),u(" "+o(e.$t("seedream.name.model"))+": "+o(e.shortModel(e.modelValue?.request?.model)),1)])):v("",!0),e.modelValue?.request?.size?(a(),i("p",gs,[s(l,{icon:"fa-solid fa-image",class:"mr-1"}),u(" "+o(e.$t("seedream.name.size"))+": "+o(e.modelValue?.request?.size),1)])):v("",!0),c("p",$s,[s(l,{icon:"fa-solid fa-bolt",class:"mr-1"}),u(" "+o(e.$t("seedream.name.task"))+": "+o(e.isEdit?e.$t("seedream.name.edits"):e.$t("seedream.name.generate")),1)]),c("p",vs,[s(l,{icon:"fa-solid fa-magic",class:"mr-1"}),u(" "+o(e.$t("seedream.name.taskId"))+": "+o(e.modelValue?.id)+" ",1),s(d,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),i("p",bs,[s(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),u(" "+o(e.$t("seedream.name.traceId"))+": "+o(e.modelValue?.response?.trace_id)+" ",1),s(d,{content:e.modelValue?.response?.trace_id,class:"btn-copy inline-block"},null,8,["content"])])):v("",!0)]),_:1})])):e.modelValue?.response?.success===!1?(a(),i("div",ks,[s(b,{closable:!1,class:"failure"},{template:_(()=>[s(l,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),u(" "+o(e.$t("seedream.name.failure")),1)]),default:_(()=>[e.modelValue?.request?.model?(a(),i("p",ys,[s(l,{icon:"fa-solid fa-cube",class:"mr-1"}),u(" "+o(e.$t("seedream.name.model"))+": "+o(e.shortModel(e.modelValue?.request?.model)),1)])):v("",!0),e.modelValue?.request?.size?(a(),i("p",ws,[s(l,{icon:"fa-solid fa-image",class:"mr-1"}),u(" "+o(e.$t("seedream.name.size"))+": "+o(e.modelValue?.request?.size),1)])):v("",!0),c("p",Es,[s(l,{icon:"fa-solid fa-bolt",class:"mr-1"}),u(" "+o(e.$t("seedream.name.task"))+": "+o(e.isEdit?e.$t("seedream.name.edits"):e.$t("seedream.name.generate")),1)]),c("p",Ss,[s(l,{icon:"fa-solid fa-magic",class:"mr-1"}),u(" "+o(e.$t("seedream.name.taskId"))+": "+o(e.modelValue?.id)+" ",1),s(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),e.modelValue?.response?.error?.message?(a(),i("p",Vs,[s(l,{icon:"fa-solid fa-circle-info",class:"mr-1"}),u(" "+o(e.$t("seedream.name.failureReason"))+": "+o(e.modelValue?.response?.error?.message)+" ",1),s(d,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])])):v("",!0),e.modelValue?.response?.trace_id?(a(),i("p",Is,[s(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),u(" "+o(e.$t("seedream.name.traceId"))+": "+o(e.modelValue?.response?.trace_id)+" ",1),s(d,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])):v("",!0)]),_:1})])):(a(),i("div",Ls,[s(b,{closable:!1,class:"info"},{template:_(()=>[s(l,{icon:"fa-solid fa-circle-info",class:"mr-1"}),u(" "+o(e.$t("seedream.name.status")),1)]),default:_(()=>[c("p",Rs,[s(l,{icon:"fa-solid fa-magic",class:"mr-1"}),u(" "+o(e.$t("seedream.name.taskId"))+": "+o(e.modelValue?.id)+" ",1),s(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),i("p",Ts,[s(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),u(" "+o(e.$t("seedream.name.traceId"))+": "+o(e.modelValue?.response?.trace_id)+" ",1),s(d,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])):v("",!0)]),_:1})])):(a(),i("div",ms,[s(b,{closable:!1,class:"info"},{template:_(()=>[s(l,{icon:"fa-regular fa-clock",class:"mr-1"}),u(" "+o(e.$t("seedream.status.pending")),1)]),default:_(()=>[c("p",us,[s(l,{icon:"fa-solid fa-magic",class:"mr-1"}),u(" "+o(e.$t("seedream.name.taskId"))+": "+o(e.modelValue?.id)+" ",1),s(d,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})]))])])}const Cs=y(ss,[["render",As],["__scopeId","data-v-f34f00b9"]]),Ms=k({name:"SeedreamRecentPanel",components:{TaskPreview:Cs,BotPlaceholder:ue,NoTasks:ie,ScrollList:le},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Ds={key:0},zs={key:2,class:"w-full h-full flex items-center justify-center"};function Us(e,t,g,r,m,p){const f=n("bot-placeholder"),h=n("task-preview"),l=n("scroll-list"),d=n("no-tasks");return a(),i(w,null,[e.tasks?.items===void 0?(a(),i("div",Ds,[s(f)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),E(l,{key:1,ref:"scrollList",class:"tasks h-full w-full overflow-y-auto",loading:e.loading,onReachTop:t[0]||(t[0]=b=>e.$emit("reach-top"))},{default:_(()=>[(a(!0),i(w,null,I(e.tasks?.items,b=>(a(),E(h,{key:b.id,"model-value":b},null,8,["model-value"]))),128))]),_:1},8,["loading"])):v("",!0),e.tasks?.items?.length===0?(a(),i("div",zs,[s(d)])):v("",!0)],64)}const qs=y(Ms,[["render",Us]]),Gs="https://webhook.acedata.cloud/seedream",Ps=k({name:"SeedreamIndex",components:{ConfigPanel:es,Layout:$e,RecentPanel:qs},inject:["initialized"],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===P.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===P.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.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(){if(console.debug("reached top"),this.loading||this.tasksLoading)return;const e=this.tasks?.total,t=this.tasks?.items?.length||0;if(e!==void 0&&e<=t)return;const g=this.tasks?.items?.[0];if(!g?.created_at)return;const m=this.$refs.recentPanel?.getScrollElement?.(),p=m?.scrollHeight||0,f=m?.scrollTop||0;this.loading=!0;try{if(await this.onGetTasks({createdAtMax:g.created_at}),await this.$nextTick(),m){const h=m.scrollHeight;m.scrollTop=h-p+f}}finally{this.loading=!1}},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("seedream/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("seedream/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=20,createdAtMin:g,createdAtMax:r}=e||{};console.debug("limit",t,"createdAtMin",g,"createdAtMax",r),await this.$store.dispatch("seedream/getTasks",{limit:t,createdAtMin:g,createdAtMax:r})},async onGenerate(){const e={...this.config||{}};!(Array.isArray(e?.image)&&e.image.length>0)&&"image"in e&&delete e.image,e?.size||delete e.size;const g={...e,callback_url:Gs},r=this.credential?.token;if(!r){console.error("no token specified");return}V.info(this.$t("seedream.message.startingTask")),ae.generate(g,{token:r}).then(()=>{V.success(this.$t("seedream.message.startTaskSuccess"))}).catch(m=>{const p=m?.response?.data;p?.error?.code===ne?V.error(this.$t("seedream.message.usedUp")):V.error(this.$t("seedream.message.startTaskFailed")+(p?.error?.message||""))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function js(e,t,g,r,m,p){const f=n("config-panel"),h=n("recent-panel"),l=n("layout");return a(),E(l,null,{config:_(()=>[s(f,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:_(()=>[s(h,{ref:"recentPanel",loading:e.loading,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const tt=y(Ps,[["render",js]]);export{tt as default};
|
|
1
|
+
import{bH as A}from"./vendor-B4-12K57.js";import{k as C,O as W,q as H,r as N,s as V,K as j,L as O,o as Z,C as K,i as Y}from"./vendor-element-plus-C2t7-rNg.js";import{d as k,c as i,a as c,l as s,P as D,S as _,am as n,o as a,Z as o,Y as u,F as w,ak as I,R as E,W as v,V as R,a1 as J}from"./vendor-vue-BzRnDgD5.js";import{_ as y,a5 as Q,bY as X,bZ as x,b_ as ee,b$ as se,c0 as te,c1 as oe,c2 as U,c3 as q,c4 as G,c5 as B,c6 as ae,ak as ne,ah as P}from"./index-BwtxyV6k.js";import{I as M,S as le}from"./ScrollList-CfFOKFbb.js";import{I as F}from"./ImagePreview-Dun0qhAC.js";import{C as re,N as ie}from"./NoTasks-CQZOGbwI.js";import{a as ce}from"./price-Clo8IP03.js";import{C as de}from"./CopyToClipboard-D0yPTPYW.js";import{I as me}from"./ImageWrapper-DAJLZ3ud.js";import{B as ue}from"./BotPlaceholder-ClX8uvvo.js";import"./vendor-dayjs-D6Igi227.js";import"./vendor-katex-DHBGsivc.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-nHemWFue.js";const pe=k({name:"LayoutSeedream",components:{ElDrawer:W,ElButton:C,FontAwesomeIcon:A},data(){return{drawer:!1}}}),fe={class:"main flex flex-row flex-1"},he={class:"config w-[300px] h-full overflow-y-scroll bg-[var(--app-sidebar-bg)]"},_e={class:"result h-full p-[15px] flex-1 flex flex-col"};function ge(e,t,g,r,m,p){const f=n("font-awesome-icon"),h=n("el-button"),l=n("el-drawer");return a(),i("div",fe,[c("div",he,[D(e.$slots,"config",{},void 0,!0)]),c("div",_e,[D(e.$slots,"result",{},void 0,!0)]),s(h,{circle:"",class:"menu",onClick:t[0]||(t[0]=d=>e.drawer=!0)},{default:_(()=>[s(f,{icon:"fa-solid fa-magic"})]),_:1}),s(l,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=d=>e.drawer=d),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:_(()=>[D(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const $e=y(pe,[["render",ge],["__scopeId","data-v-b4ad94f1"]]),ve="",be=k({name:"SeedreamPromptInput",components:{ElInput:H,InfoIcon:M},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("seedream/setConfig",{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=ve)}}),ke={class:"field"},ye={class:"box"},we={class:"title font-bold"};function Ee(e,t,g,r,m,p){const f=n("info-icon"),h=n("el-input");return a(),i("div",ke,[c("div",ye,[c("h2",we,o(e.$t("seedream.name.prompt")),1),s(f,{content:e.$t("seedream.description.prompt"),class:"info"},null,8,["content"])]),s(h,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("seedream.placeholder.prompt")},null,8,["modelValue","placeholder"])])}const Se=y(be,[["render",Ee],["__scopeId","data-v-5559520a"]]),Ve=k({name:"SeedreamImageInput",components:{ElUpload:N,ElButton:C,InfoIcon:M,ImagePreview:F,FontAwesomeIcon:A},data(){return{fileList:[],uploadUrl:Q()+"/api/v1/files/",suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.seedream?.config?.image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){const r=(this.fileList||[]).filter(m=>!m?.response?.file_url);this.fileList=r.length?r:[];return}const t=[];e.forEach(r=>{const m=this.fileList.find(p=>p?.response?.file_url===r||p?.url===r);m?t.push(m):t.push({name:r.split("/").pop()||r,url:r,status:"success",percentage:100,response:{file_url:r}})}),(this.fileList||[]).filter(r=>!r?.response?.file_url).forEach(r=>{t.some(p=>p===r||p?.url===r?.url||p?.response?.file_url===r?.response?.file_url)||t.push(r)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url=="string"&&e.url.startsWith("blob:"))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){V.warning(this.$t("seedream.message.uploadImageExceed"))},onError(){V.error(this.$t("seedream.message.uploadImageError"))},onSetImages(){const e=this.urls;this.suppressWatch=!0,this.$store.commit("seedream/setConfig",{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url=="string"&&t.url.startsWith("blob:"))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),Ie={class:"field"},Le={class:"label"},Re={class:"box"},Te={class:"title font-bold"},Ae={class:"value"},Ce={class:"file-list mt-2 flex flex-wrap gap-[10px]"};function Me(e,t,g,r,m,p){const f=n("info-icon"),h=n("font-awesome-icon"),l=n("el-button"),d=n("el-upload"),b=n("image-preview");return a(),i(w,null,[c("div",Ie,[c("div",Le,[c("div",Re,[c("h2",Te,o(e.$t("seedream.name.imageUrls")),1),s(f,{content:e.$t("seedream.description.imageUrls"),class:"info"},null,8,["content"])])]),c("div",Ae,[s(d,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=$=>e.fileList=$),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",limit:14,multiple:!0,"show-file-list":!1,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-change":e.onChange,"on-remove":e.onRemove,headers:e.headers},{default:_(()=>[s(l,{size:"small",type:"primary",round:""},{default:_(()=>[s(h,{icon:"fa-solid fa-upload",class:"mr-1"}),u(" "+o(e.$t("seedream.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","on-change","on-remove","headers"])])]),c("div",Ce,[(a(!0),i(w,null,I(e.fileList,($,S)=>(a(),E(b,{key:$.uid||$?.response?.file_url||$.url||S,url:$.url||$?.response?.file_url,name:$.name,percentage:$.percentage,onRemove:z=>e.onRemovePreview(S,$)},null,8,["url","name","percentage","onRemove"]))),128))])],64)}const De=y(Ve,[["render",Me],["__scopeId","data-v-29737ed9"]]),ze=k({name:"SeedreamModelSelector",components:{ElSelect:O,ElOption:j,InfoIcon:M},data(){return{options:[{value:x,label:this.$t("seedream.model.seedream45")},{value:ee,label:this.$t("seedream.model.seedream40")},{value:se,label:this.$t("seedream.model.seedream30t2i")},{value:te,label:this.$t("seedream.model.seededit30i2i")}]}},computed:{value:{get(){return this.$store.state.seedream?.config?.model},set(e){this.$store.commit("seedream/setConfig",{...this.$store.state.seedream?.config,model:e})}}},mounted(){this.value||(this.value=X)}}),Ue={class:"field"},qe={class:"label"},Ge={class:"box"},Pe={class:"title font-bold"};function je(e,t,g,r,m,p){const f=n("info-icon"),h=n("el-option"),l=n("el-select");return a(),i("div",Ue,[c("div",qe,[c("div",Ge,[c("h2",Pe,o(e.$t("seedream.name.model")),1),s(f,{content:e.$t("seedream.description.model"),class:"info"},null,8,["content"])])]),s(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=d=>e.value=d),class:"value",placeholder:e.$t("seedream.placeholder.select")},{default:_(()=>[(a(!0),i(w,null,I(e.options,d=>(a(),E(h,{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Oe=y(ze,[["render",je],["__scopeId","data-v-3c3ca27d"]]),Be=k({name:"SeedreamSizeSelector",components:{ElSelect:O,ElOption:j,InfoIcon:M},data(){return{options:[{value:U,label:U},{value:q,label:q},{value:G,label:G}]}},computed:{value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit("seedream/setConfig",{...this.$store.state.seedream?.config,size:e})}}},mounted(){this.value||(this.value=oe)}}),Fe={class:"field"},We={class:"label"},He={class:"box"},Ne={class:"title font-bold"};function Ze(e,t,g,r,m,p){const f=n("info-icon"),h=n("el-option"),l=n("el-select");return a(),i("div",Fe,[c("div",We,[c("div",He,[c("h2",Ne,o(e.$t("seedream.name.size")),1),s(f,{content:e.$t("seedream.description.size"),class:"info"},null,8,["content"])])]),s(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=d=>e.value=d),class:"value",placeholder:e.$t("seedream.placeholder.select"),filterable:"","allow-create":"","default-first-option":""},{default:_(()=>[(a(!0),i(w,null,I(e.options,d=>(a(),E(h,{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ke=y(Be,[["render",Ze],["__scopeId","data-v-54a9a469"]]),Ye=k({name:"SeedreamConfigPanel",components:{ElButton:C,FontAwesomeIcon:A,PromptInput:Se,Consumption:re,ImageInput:De,ModelSelector:Oe,SizeSelector:Ke},emits:["generate"],computed:{config(){return this.$store.state.seedream?.config},consumption(){const e={...this.config||{}},t=Array.isArray(e?.image)&&e.image.length>0;return ce({...e,action:t?"edit":"generate",model:B(e?.model),count:1},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Je={class:"flex flex-col h-full"},Qe={class:"flex-1 overflow-y-auto p-[15px]"},Xe={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function xe(e,t,g,r,m,p){const f=n("model-selector"),h=n("size-selector"),l=n("prompt-input"),d=n("image-input"),b=n("consumption"),$=n("font-awesome-icon"),S=n("el-button");return a(),i("div",Je,[c("div",Qe,[s(f,{class:"mb-4"}),s(h,{class:"mb-4"}),s(l,{class:"mb-4"}),s(d,{class:"mb-4"})]),c("div",Xe,[s(b,{value:e.consumption,service:e.service},null,8,["value","service"]),s(S,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:_(()=>[s($,{icon:"fa-solid fa-magic",class:"mr-2"}),u(" "+o(e.$t("seedream.button.generate")),1)]),_:1},8,["onClick"])])])}const es=y(Ye,[["render",xe]]),ss=k({name:"SeedreamTaskPreview",components:{ElImage:Y,CopyToClipboard:de,FontAwesomeIcon:A,ElAlert:K,ImageWrapper:me,ElButton:C,ElTooltip:Z,ImagePreview:F},props:{modelValue:{type:Object,required:!0}},computed:{isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){const e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{shortModel(e){return B(e)||e},onEdit(e){if(!e)return;console.debug("Edit image:",e);const t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit("seedream/setConfig",t)}}}),ts={class:"preview"},os={class:"left"},as={class:"main"},ns={class:"bot"},ls={class:"datetime"},rs={class:"info"},is={key:0,class:"flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto"},cs={key:1,class:"prompt mt-2"},ds={key:0},ms={key:0,class:R({content:!0})},us={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ps={key:1,class:R({content:!0,failed:!0})},fs={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},hs={class:R({operations:!0,"mt-2":!0,"mb-2":!0})},_s={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},gs={key:1,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},$s={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},vs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},bs={key:2,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ks={key:2,class:R({content:!0})},ys={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ws={key:1,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Es={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ss={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Vs={key:2,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Is={key:3,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ls={key:3,class:R({content:!0})},Rs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ts={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function As(e,t,g,r,m,p){const f=n("el-image"),h=n("image-preview"),l=n("font-awesome-icon"),d=n("copy-to-clipboard"),b=n("el-alert"),$=n("image-wrapper"),S=n("el-button"),z=n("el-tooltip");return a(),i("div",ts,[c("div",os,[s(f,{src:"https://cdn.acedata.cloud/9egrbn.png",class:"avatar"})]),c("div",as,[c("div",ns,[u(o(e.$t("seedream.name.seedreamBot"))+" ",1),c("span",ls,o(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",rs,[Array.isArray(e.modelValue?.request?.image)&&e.modelValue?.request?.image.length>0?(a(),i("div",is,[(a(!0),i(w,null,I(e.modelValue?.request?.image,(L,T)=>(a(),E(h,{key:T,url:L,name:`image-${T+1}`,closable:!1},null,8,["url","name"]))),128))])):v("",!0),e.modelValue?.request?.prompt?(a(),i("p",cs,[u(o(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?v("",!0):(a(),i("span",ds," - ("+o(e.$t("seedream.status.pending"))+") ",1))])):v("",!0)]),e.modelValue?.response?e.modelValue?.response?.success===!0?(a(),i("div",ps,[c("div",fs,[(a(!0),i(w,null,I(e.images,(L,T)=>(a(),E($,{key:T,src:L?.image_url,"raw-src":L?.image_url},null,8,["src","raw-src"]))),128))]),c("div",hs,[s(z,{class:"box-item",effect:"dark",content:e.$t("common.button.edit"),placement:"top-start"},{default:_(()=>[s(S,{type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=J(L=>e.onEdit(e.images?.[0]?.image_url),["stop"]))},{default:_(()=>[u(o(e.$t("common.button.edit")),1)]),_:1})]),_:1},8,["content"])]),s(b,{closable:!1,class:"mt-2 success"},{default:_(()=>[e.modelValue?.request?.model?(a(),i("p",_s,[s(l,{icon:"fa-solid fa-cube",class:"mr-1"}),u(" "+o(e.$t("seedream.name.model"))+": "+o(e.shortModel(e.modelValue?.request?.model)),1)])):v("",!0),e.modelValue?.request?.size?(a(),i("p",gs,[s(l,{icon:"fa-solid fa-image",class:"mr-1"}),u(" "+o(e.$t("seedream.name.size"))+": "+o(e.modelValue?.request?.size),1)])):v("",!0),c("p",$s,[s(l,{icon:"fa-solid fa-bolt",class:"mr-1"}),u(" "+o(e.$t("seedream.name.task"))+": "+o(e.isEdit?e.$t("seedream.name.edits"):e.$t("seedream.name.generate")),1)]),c("p",vs,[s(l,{icon:"fa-solid fa-magic",class:"mr-1"}),u(" "+o(e.$t("seedream.name.taskId"))+": "+o(e.modelValue?.id)+" ",1),s(d,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),i("p",bs,[s(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),u(" "+o(e.$t("seedream.name.traceId"))+": "+o(e.modelValue?.response?.trace_id)+" ",1),s(d,{content:e.modelValue?.response?.trace_id,class:"btn-copy inline-block"},null,8,["content"])])):v("",!0)]),_:1})])):e.modelValue?.response?.success===!1?(a(),i("div",ks,[s(b,{closable:!1,class:"failure"},{template:_(()=>[s(l,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),u(" "+o(e.$t("seedream.name.failure")),1)]),default:_(()=>[e.modelValue?.request?.model?(a(),i("p",ys,[s(l,{icon:"fa-solid fa-cube",class:"mr-1"}),u(" "+o(e.$t("seedream.name.model"))+": "+o(e.shortModel(e.modelValue?.request?.model)),1)])):v("",!0),e.modelValue?.request?.size?(a(),i("p",ws,[s(l,{icon:"fa-solid fa-image",class:"mr-1"}),u(" "+o(e.$t("seedream.name.size"))+": "+o(e.modelValue?.request?.size),1)])):v("",!0),c("p",Es,[s(l,{icon:"fa-solid fa-bolt",class:"mr-1"}),u(" "+o(e.$t("seedream.name.task"))+": "+o(e.isEdit?e.$t("seedream.name.edits"):e.$t("seedream.name.generate")),1)]),c("p",Ss,[s(l,{icon:"fa-solid fa-magic",class:"mr-1"}),u(" "+o(e.$t("seedream.name.taskId"))+": "+o(e.modelValue?.id)+" ",1),s(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),e.modelValue?.response?.error?.message?(a(),i("p",Vs,[s(l,{icon:"fa-solid fa-circle-info",class:"mr-1"}),u(" "+o(e.$t("seedream.name.failureReason"))+": "+o(e.modelValue?.response?.error?.message)+" ",1),s(d,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])])):v("",!0),e.modelValue?.response?.trace_id?(a(),i("p",Is,[s(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),u(" "+o(e.$t("seedream.name.traceId"))+": "+o(e.modelValue?.response?.trace_id)+" ",1),s(d,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])):v("",!0)]),_:1})])):(a(),i("div",Ls,[s(b,{closable:!1,class:"info"},{template:_(()=>[s(l,{icon:"fa-solid fa-circle-info",class:"mr-1"}),u(" "+o(e.$t("seedream.name.status")),1)]),default:_(()=>[c("p",Rs,[s(l,{icon:"fa-solid fa-magic",class:"mr-1"}),u(" "+o(e.$t("seedream.name.taskId"))+": "+o(e.modelValue?.id)+" ",1),s(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),i("p",Ts,[s(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),u(" "+o(e.$t("seedream.name.traceId"))+": "+o(e.modelValue?.response?.trace_id)+" ",1),s(d,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])):v("",!0)]),_:1})])):(a(),i("div",ms,[s(b,{closable:!1,class:"info"},{template:_(()=>[s(l,{icon:"fa-regular fa-clock",class:"mr-1"}),u(" "+o(e.$t("seedream.status.pending")),1)]),default:_(()=>[c("p",us,[s(l,{icon:"fa-solid fa-magic",class:"mr-1"}),u(" "+o(e.$t("seedream.name.taskId"))+": "+o(e.modelValue?.id)+" ",1),s(d,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})]))])])}const Cs=y(ss,[["render",As],["__scopeId","data-v-f34f00b9"]]),Ms=k({name:"SeedreamRecentPanel",components:{TaskPreview:Cs,BotPlaceholder:ue,NoTasks:ie,ScrollList:le},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Ds={key:0},zs={key:2,class:"w-full h-full flex items-center justify-center"};function Us(e,t,g,r,m,p){const f=n("bot-placeholder"),h=n("task-preview"),l=n("scroll-list"),d=n("no-tasks");return a(),i(w,null,[e.tasks?.items===void 0?(a(),i("div",Ds,[s(f)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),E(l,{key:1,ref:"scrollList",class:"tasks h-full w-full overflow-y-auto",loading:e.loading,onReachTop:t[0]||(t[0]=b=>e.$emit("reach-top"))},{default:_(()=>[(a(!0),i(w,null,I(e.tasks?.items,b=>(a(),E(h,{key:b.id,"model-value":b},null,8,["model-value"]))),128))]),_:1},8,["loading"])):v("",!0),e.tasks?.items?.length===0?(a(),i("div",zs,[s(d)])):v("",!0)],64)}const qs=y(Ms,[["render",Us]]),Gs="https://webhook.acedata.cloud/seedream",Ps=k({name:"SeedreamIndex",components:{ConfigPanel:es,Layout:$e,RecentPanel:qs},inject:["initialized"],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===P.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===P.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.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(){if(console.debug("reached top"),this.loading||this.tasksLoading)return;const e=this.tasks?.total,t=this.tasks?.items?.length||0;if(e!==void 0&&e<=t)return;const g=this.tasks?.items?.[0];if(!g?.created_at)return;const m=this.$refs.recentPanel?.getScrollElement?.(),p=m?.scrollHeight||0,f=m?.scrollTop||0;this.loading=!0;try{if(await this.onGetTasks({createdAtMax:g.created_at}),await this.$nextTick(),m){const h=m.scrollHeight;m.scrollTop=h-p+f}}finally{this.loading=!1}},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("seedream/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("seedream/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=20,createdAtMin:g,createdAtMax:r}=e||{};console.debug("limit",t,"createdAtMin",g,"createdAtMax",r),await this.$store.dispatch("seedream/getTasks",{limit:t,createdAtMin:g,createdAtMax:r})},async onGenerate(){const e={...this.config||{}};!(Array.isArray(e?.image)&&e.image.length>0)&&"image"in e&&delete e.image,e?.size||delete e.size;const g={...e,callback_url:Gs},r=this.credential?.token;if(!r){console.error("no token specified");return}V.info(this.$t("seedream.message.startingTask")),ae.generate(g,{token:r}).then(()=>{V.success(this.$t("seedream.message.startTaskSuccess"))}).catch(m=>{const p=m?.response?.data;p?.error?.code===ne?V.error(this.$t("seedream.message.usedUp")):V.error(this.$t("seedream.message.startTaskFailed")+(p?.error?.message||""))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function js(e,t,g,r,m,p){const f=n("config-panel"),h=n("recent-panel"),l=n("layout");return a(),E(l,null,{config:_(()=>[s(f,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:_(()=>[s(h,{ref:"recentPanel",loading:e.loading,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const tt=y(Ps,[["render",js]]);export{tt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bH as z,bX as Z,bY as Q,l as ne,bZ as ie,b_ as D,b$ as ae,c0 as le,c1 as re,c2 as ce}from"./vendor-B4-12K57.js";import{k as R,O as ue,j as de,K as pe,L as me,r as fe,s as k,q as M,Q as ee,e as X,i as W,A as te,B as se,R as J,V as he,W as _e,f as $e,g as ge,h as ve,o as ye,p as ke,H as be,U as we,X as Ce}from"./vendor-element-plus-C2t7-rNg.js";import{d as w,c as u,a as s,l as o,P as q,S as c,am as a,o as n,W as m,Z as l,F as G,ak as H,R as v,Y as C,U as N,at as K,a1 as U,b as I,z as T,w as Ve,X as Se,_ as Ae}from"./vendor-vue-BzRnDgD5.js";import{_ as S,bN as Pe,bO as E,a5 as Ue,ah as F,aa as Te,ag as Ee}from"./index-BceQaAb7.js";import{I as L,S as Ie}from"./ScrollList-DtikpNk7.js";import{C as Le,N as ze}from"./NoTasks-Bg3dk3Zk.js";import{a as Fe}from"./price-DtWUJRlS.js";import{l as Ge}from"./pagination-bjoHZNQW.js";import"./vendor-dayjs-D6Igi227.js";import"./vendor-katex-DHBGsivc.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-nHemWFue.js";const je=w({name:"LayoutSuno",components:{ElDrawer:ue,ElButton:R,FontAwesomeIcon:z},data(){return{drawer:!1,preview:!1}},computed:{}}),De={class:"main flex flex-row flex-1"},Re={class:"config w-[300px] h-full overflow-y-scroll bg-[var(--app-sidebar-bg)]"},Me={class:"result h-full flex flex-col flex-1"},We={class:"preview h-full w-[300px] flex flex-col"};function Ne(e,t,r,i,f,p){const d=a("font-awesome-icon"),h=a("el-button"),_=a("el-drawer");return n(),u("div",De,[s("div",Re,[q(e.$slots,"config",{},void 0,!0)]),s("div",Me,[q(e.$slots,"result",{},void 0,!0)]),s("div",We,[q(e.$slots,"preview",{},void 0,!0)]),o(h,{circle:"",class:"menu",onClick:t[0]||(t[0]=$=>e.drawer=!0)},{default:c(()=>[o(d,{icon:"fa-solid fa-magic"})]),_:1}),o(_,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=$=>e.drawer=$),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:c(()=>[q(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const Oe=S(je,[["render",Ne],["__scopeId","data-v-087f869f"]]),Be=w({name:"TypeSelector",components:{ElSelect:me,ElOption:pe,ElSwitch:de},data(){return{options:[{label:"Suno v5",value:"chirp-v5",info:"8 min"},{label:"Suno v4.5+",value:"chirp-v4-5-plus",info:"8 min"},{label:"Suno v4.5",value:"chirp-v4-5",info:"4 min"},{label:"Suno v4",value:"chirp-v4",info:"2.5 min"},{label:"Suno v3.5",value:"chirp-v3-5",info:"2 min"},{label:"Suno v3",value:"chirp-v3-0",info:"2 min"}]}},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||(this.model=Pe)}}),qe={class:"flex items-center justify-between mb-3"},He={class:"text-sm font-bold"},Xe={class:"mb-3"},Ke={class:"flex items-center mb-1"},Ye={class:"text-sm font-bold"},Ze={class:"flex items-center justify-between w-full"},Qe={class:"text-xs text-[var(--el-text-color-placeholder)]"},Je={key:0,class:"flex items-center justify-between mb-3"},xe={class:"text-sm font-bold"};function et(e,t,r,i,f,p){const d=a("el-switch"),h=a("el-option"),_=a("el-select");return n(),u("div",null,[s("div",qe,[s("span",He,l(e.$t("suno.name.type")),1),o(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=$=>e.custom=$),size:"small"},null,8,["modelValue"])]),s("div",Xe,[s("div",Ke,[s("span",Ye,l(e.$t("suno.name.model")),1)]),o(_,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=$=>e.model=$),class:"w-full",size:"default",placeholder:e.$t("suno.placeholder.select")},{default:c(()=>[(n(!0),u(G,null,H(e.options,$=>(n(),v(h,{key:$.value,label:$.label,value:$.value},{default:c(()=>[s("div",Ze,[s("span",null,l($.label),1),s("span",Qe,l($.info),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),e.custom?(n(),u("div",Je,[s("span",xe,l(e.$t("suno.name.instrumental")),1),o(d,{modelValue:e.instrumental,"onUpdate:modelValue":t[2]||(t[2]=$=>e.instrumental=$),size:"small"},null,8,["modelValue"])])):m("",!0)])}const tt=S(Be,[["render",et]]),st=w({name:"UploadAudio",components:{ElUpload:fe,ElButton:R,InfoIcon:L,FontAwesomeIcon:z},emits:["change"],data(){return{fileList:[],uploadUrl:Ue()+"/api/v1/files/"}},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(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){k.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){k.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},r=this.credential?.token;if(!r){console.error("no token specified");return}k.info(this.$t("suno.message.startingUploadAudio")),E.upload(t,{token:r}).then(i=>{console.debug("get upload music success",i.data);const f=i.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:f,action:"upload_extend"}),k.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(i=>{k.error(i?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ot={class:"relative"},nt={class:"flex justify-between"},it={class:"flex justify-start items-center"},at={class:"text-sm font-bold"};function lt(e,t,r,i,f,p){const d=a("info-icon"),h=a("font-awesome-icon"),_=a("el-button"),$=a("el-upload");return n(),u("div",ot,[s("div",nt,[s("div",it,[s("span",at,l(e.$t("suno.name.referenceAudios")),1),o(d,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),o($,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=b=>e.fileList=b),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:c(()=>[o(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:c(()=>[o(h,{icon:"fa-solid fa-upload",class:"icon mr-1"}),C(" "+l(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const rt=S(st,[["render",lt],["__scopeId","data-v-6236152c"]]),ct="",ut=w({name:"PromptInput",components:{ElInput:M,InfoIcon:L},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=ct)}}),dt={class:"field"},pt={class:"flex items-center mb-1"},mt={class:"text-sm font-bold"};function ft(e,t,r,i,f,p){const d=a("info-icon"),h=a("el-input");return n(),u("div",dt,[s("div",pt,[s("span",mt,l(e.$t("suno.name.songDescription")),1),o(d,{content:e.$t("suno.description.prompt")},null,8,["content"])]),o(h,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=_=>e.prompt=_),rows:4,type:"textarea",placeholder:e.$t("suno.placeholder.prompt")},null,8,["modelValue","placeholder"])])}const ht=S(ut,[["render",ft]]),_t="",$t=w({name:"LyricInput",components:{ElInput:M,ElButton:R,FontAwesomeIcon:z,InfoIcon:L},data(){return{generatingLyrics:!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||(this.lyric=_t)},methods:{async onGenerateLyrics(){const e=this.credential?.token;if(!e)return;const t=this.config?.style||this.config?.title||"a beautiful song";this.generatingLyrics=!0,k.info(this.$t("suno.message.generatingLyrics"));try{const i=(await E.lyric({prompt:t},{token:e})).data?.data;i?.text&&(this.lyric=i.text,i?.title&&!this.config?.title&&this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:i.text,title:i.title}),k.success(this.$t("suno.message.generateLyricsSuccess")))}catch{k.error(this.$t("suno.message.generateLyricsFailed"))}finally{this.generatingLyrics=!1}}}}),gt={class:"field"},vt={class:"flex items-center justify-between mb-1"},yt={class:"flex items-center"},kt={class:"text-sm font-bold"};function bt(e,t,r,i,f,p){const d=a("info-icon"),h=a("font-awesome-icon"),_=a("el-button"),$=a("el-input");return n(),u("div",gt,[s("div",vt,[s("div",yt,[s("span",kt,l(e.$t("suno.name.lyrics")),1),o(d,{content:e.$t("suno.description.lyrics")},null,8,["content"])]),e.config?.action!=="extend"?(n(),v(_,{key:0,size:"small",loading:e.generatingLyrics,round:"",onClick:e.onGenerateLyrics},{default:c(()=>[e.generatingLyrics?m("",!0):(n(),v(h,{key:0,icon:"fa-solid fa-wand-magic-sparkles",class:"mr-1"})),C(" "+l(e.$t("suno.button.generate_lyrics")),1)]),_:1},8,["loading","onClick"])):m("",!0)]),e.config?.action!=="extend"?(n(),v($,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=b=>e.lyric=b),rows:5,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics")},null,8,["modelValue","placeholder"])):(n(),v($,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=b=>e.lyric=b),rows:5,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics")},null,8,["modelValue","placeholder"]))])}const wt=S($t,[["render",bt],["__scopeId","data-v-210d2670"]]),Ct=w({name:"StyleInput",components:{ElInput:M,ElButton:R,FontAwesomeIcon:z,InfoIcon:L},data(){return{optimizing:!1}},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}},methods:{async onOptimizeStyle(){const e=this.credential?.token;if(!(!e||!this.style)){this.optimizing=!0,k.info(this.$t("suno.message.optimizingStyle"));try{const t=await E.style({prompt:this.style},{token:e}),r=t.data?.text||t.data?.data?.text;r&&(this.style=r,k.success(this.$t("suno.message.optimizeStyleSuccess")))}catch{k.error(this.$t("suno.message.optimizeStyleFailed"))}finally{this.optimizing=!1}}}}}),Vt={class:"field"},St={class:"flex items-center justify-between mb-1"},At={class:"flex items-center"},Pt={class:"text-sm font-bold"};function Ut(e,t,r,i,f,p){const d=a("info-icon"),h=a("font-awesome-icon"),_=a("el-button"),$=a("el-input");return n(),u("div",Vt,[s("div",St,[s("div",At,[s("span",Pt,l(e.$t("suno.name.style")),1),o(d,{content:e.$t("suno.description.style")},null,8,["content"])]),o(_,{size:"small",loading:e.optimizing,round:"",onClick:e.onOptimizeStyle},{default:c(()=>[e.optimizing?m("",!0):(n(),v(h,{key:0,icon:"fa-solid fa-wand-magic-sparkles",class:"mr-1"})),C(" "+l(e.$t("suno.button.optimize_style")),1)]),_:1},8,["loading","onClick"])]),o($,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=b=>e.style=b),rows:2,type:"textarea",placeholder:e.$t("suno.placeholder.style")},null,8,["modelValue","placeholder"])])}const Tt=S(Ct,[["render",Ut]]),Et=w({name:"TitleInput",components:{ElInput:M,InfoIcon:L},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}}}}),It={class:"field"},Lt={class:"flex items-center mb-1"},zt={class:"text-sm font-bold"};function Ft(e,t,r,i,f,p){const d=a("info-icon"),h=a("el-input");return n(),u("div",It,[s("div",Lt,[s("span",zt,l(e.$t("suno.name.title")),1),o(d,{content:e.$t("suno.description.title")},null,8,["content"])]),o(h,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=_=>e.title=_),placeholder:e.$t("suno.placeholder.title")},null,8,["modelValue","placeholder"])])}const Gt=S(Et,[["render",Ft]]);function j(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const r=e%60,i=r<10?`0${r}`:r,f=t<10?`0${t}`:t;return i+":"+f}const jt=w({name:"ExtendFromInput",components:{ElImage:W,ElIcon:X,ElInputNumber:ee,VideoPlay:Q,VideoPause:Z},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||(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:j,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})}}}),Dt={class:"field"},Rt={class:"box"},Mt={class:"title font-bold"},Wt={class:"input-wrapper"},Nt={class:"task"},Ot={class:"left"},Bt={key:2,class:"duration"},qt={class:"info"},Ht={class:"title"},Xt={class:"style"};function Kt(e,t,r,i,f,p){const d=a("el-input-number"),h=a("el-image"),_=a("video-pause"),$=a("el-icon"),b=a("video-play"),P=K("loading");return n(),u("div",Dt,[s("div",Rt,[s("h2",Mt,l(e.$t("suno.name.extend")),1),s("div",Wt,[o(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=y=>e.value=y),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"])])]),s("div",Nt,[e.audio?(n(),u("div",{key:0,class:"audio",onClick:t[3]||(t[3]=y=>e.onClick(e.audio))},[N((n(),u("div",Ot,[o(h,{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"?(n(),u("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPause(e.audio))},[o($,null,{default:c(()=>[o(_)]),_:1})])):m("",!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")?(n(),u("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=y=>e.onPlay(e.audio))},[o($,null,{default:c(()=>[o(b)]),_:1})])):m("",!0),e.audio?.duration?(n(),u("div",Bt,l(e.useFormatDuring(e.audio?.duration)),1)):m("",!0)])),[[P,!e.audio?.audio_url]]),s("div",qt,[s("h2",Ht,l(e.audio?.title),1),s("p",Xt,l(e.audio?.style),1)])])):m("",!0)])])}const Yt=S(jt,[["render",Kt],["__scopeId","data-v-bcce4821"]]),Zt=w({name:"CoverFromInput",components:{ElImage:W,ElIcon:X,VideoPlay:Q,VideoPause:Z},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||(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:j,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})}}}),Qt={class:"field"},Jt={class:"box"},xt={class:"title font-bold"},es={class:"task"},ts={class:"left"},ss={key:2,class:"duration"},os={class:"info"},ns={class:"title"},is={class:"style"};function as(e,t,r,i,f,p){const d=a("el-image"),h=a("video-pause"),_=a("el-icon"),$=a("video-play"),b=K("loading");return n(),u("div",Qt,[s("div",Jt,[s("h2",xt,l(e.$t("suno.name.cover")),1)]),s("div",es,[e.audio?(n(),u("div",{key:0,class:"audio",onClick:t[2]||(t[2]=P=>e.onClick(e.audio))},[N((n(),u("div",ts,[o(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"?(n(),u("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=P=>e.onPause(e.audio))},[o(_,null,{default:c(()=>[o(h)]),_:1})])):m("",!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")?(n(),u("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=P=>e.onPlay(e.audio))},[o(_,null,{default:c(()=>[o($)]),_:1})])):m("",!0),e.audio?.duration?(n(),u("div",ss,l(e.useFormatDuring(e.audio?.duration)),1)):m("",!0)])),[[b,!e.audio?.audio_url]]),s("div",os,[s("h2",ns,l(e.audio?.title),1),s("p",is,l(e.audio?.style),1)])])):m("",!0)])])}const ls=S(Zt,[["render",as],["__scopeId","data-v-06640216"]]),rs=w({name:"VocalGenderSelector",components:{ElRadioGroup:se,ElRadioButton:te,InfoIcon:L},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})}}}}),cs={class:"mb-2"},us={class:"flex items-center mb-1"},ds={class:"text-sm font-bold"};function ps(e,t,r,i,f,p){const d=a("info-icon"),h=a("el-radio-button"),_=a("el-radio-group");return n(),u("div",cs,[s("div",us,[s("span",ds,l(e.$t("suno.name.vocalGender")),1),o(d,{content:e.$t("suno.description.vocalGender")},null,8,["content"])]),o(_,{modelValue:e.vocalGender,"onUpdate:modelValue":t[0]||(t[0]=$=>e.vocalGender=$),size:"small"},{default:c(()=>[o(h,{value:""},{default:c(()=>[C(l(e.$t("suno.gender.auto")),1)]),_:1}),o(h,{value:"f"},{default:c(()=>[C(l(e.$t("suno.gender.female")),1)]),_:1}),o(h,{value:"m"},{default:c(()=>[C(l(e.$t("suno.gender.male")),1)]),_:1})]),_:1},8,["modelValue"])])}const ms=S(rs,[["render",ps]]),fs=w({name:"AdvancedParams",components:{ElCollapse:_e,ElCollapseItem:he,ElInput:M,ElSlider:J,ElRadioGroup:se,ElRadioButton:te},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.suno?.config},isV5OrAbove(){return(this.config?.model||"")==="chirp-v5"},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??50},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??50},set(e){this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_weight:e})}}}}),hs={key:0,class:"mb-3"},_s={class:"flex items-center mb-1"},$s={class:"text-xs font-bold"},gs={key:1,class:"mb-3"},vs={class:"flex items-center mb-1"},ys={class:"text-xs font-bold"},ks={key:2,class:"mb-3"},bs={class:"flex items-center justify-between mb-1"},ws={class:"text-xs font-bold"},Cs={class:"text-xs text-[var(--el-text-color-secondary)]"},Vs={key:3,class:"mb-3"},Ss={class:"flex items-center justify-between mb-1"},As={class:"text-xs font-bold"},Ps={class:"text-xs text-[var(--el-text-color-secondary)]"},Us={key:4,class:"mb-3"},Ts={class:"flex items-center mb-1"},Es={class:"text-xs font-bold"},Is={key:5,class:"mb-3"},Ls={class:"flex items-center justify-between mb-1"},zs={class:"text-xs font-bold"},Fs={class:"text-xs text-[var(--el-text-color-secondary)]"};function Gs(e,t,r,i,f,p){const d=a("el-input"),h=a("el-slider"),_=a("el-radio-button"),$=a("el-radio-group"),b=a("el-collapse-item"),P=a("el-collapse");return n(),v(P,{modelValue:e.activeNames,"onUpdate:modelValue":t[6]||(t[6]=y=>e.activeNames=y),class:"advanced-collapse"},{default:c(()=>[o(b,{title:e.$t("suno.name.advancedParams"),name:"advanced"},{default:c(()=>[e.config?.custom?(n(),u("div",hs,[s("div",_s,[s("span",$s,l(e.$t("suno.name.styleNegative")),1)]),o(d,{modelValue:e.styleNegative,"onUpdate:modelValue":t[0]||(t[0]=y=>e.styleNegative=y),size:"small",placeholder:e.$t("suno.placeholder.styleNegative")},null,8,["modelValue","placeholder"])])):m("",!0),e.config?.custom&&!e.config?.instrumental?(n(),u("div",gs,[s("div",vs,[s("span",ys,l(e.$t("suno.name.lyricPrompt")),1)]),o(d,{modelValue:e.lyricPrompt,"onUpdate:modelValue":t[1]||(t[1]=y=>e.lyricPrompt=y),size:"small",placeholder:e.$t("suno.placeholder.lyricPrompt")},null,8,["modelValue","placeholder"])])):m("",!0),e.config?.custom?(n(),u("div",ks,[s("div",bs,[s("span",ws,l(e.$t("suno.name.weirdness")),1),s("span",Cs,l(e.weirdness??0),1)]),o(h,{modelValue:e.weirdness,"onUpdate:modelValue":t[2]||(t[2]=y=>e.weirdness=y),min:0,max:100,step:1,size:"small"},null,8,["modelValue"])])):m("",!0),e.config?.custom?(n(),u("div",Vs,[s("div",Ss,[s("span",As,l(e.$t("suno.name.styleInfluence")),1),s("span",Ps,l(e.styleInfluence??50),1)]),o(h,{modelValue:e.styleInfluence,"onUpdate:modelValue":t[3]||(t[3]=y=>e.styleInfluence=y),min:0,max:100,step:1,size:"small"},null,8,["modelValue"])])):m("",!0),e.isV5OrAbove?(n(),u("div",Us,[s("div",Ts,[s("span",Es,l(e.$t("suno.name.variationCategory")),1)]),o($,{modelValue:e.variationCategory,"onUpdate:modelValue":t[4]||(t[4]=y=>e.variationCategory=y),size:"small"},{default:c(()=>[o(_,{value:""},{default:c(()=>[C(l(e.$t("suno.gender.auto")),1)]),_:1}),o(_,{value:"high"},{default:c(()=>[C(l(e.$t("suno.variation.high")),1)]),_:1}),o(_,{value:"low"},{default:c(()=>[C(l(e.$t("suno.variation.low")),1)]),_:1})]),_:1},8,["modelValue"])])):m("",!0),e.config?.action==="cover"?(n(),u("div",Is,[s("div",Ls,[s("span",zs,l(e.$t("suno.name.audioWeight")),1),s("span",Fs,l(e.audioWeight??50),1)]),o(h,{modelValue:e.audioWeight,"onUpdate:modelValue":t[5]||(t[5]=y=>e.audioWeight=y),min:0,max:100,step:1,size:"small"},null,8,["modelValue"])])):m("",!0)]),_:1},8,["title"])]),_:1},8,["modelValue"])}const js=S(fs,[["render",Gs],["__scopeId","data-v-2f7e6648"]]),Ds=w({name:"ReplaceSectionInput",components:{ElInputNumber:ee,ElImage:W,InfoIcon:L},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"})}}}),Rs={class:"field"},Ms={class:"flex items-center mb-2"},Ws={class:"text-sm font-bold m-0"},Ns={key:0,class:"task mb-2"},Os={class:"left relative w-[50px] h-[50px] mr-3 flex-shrink-0"},Bs={class:"info flex-1 min-w-0"},qs={class:"text-sm font-bold m-0 truncate"},Hs={class:"text-xs text-[var(--el-text-color-secondary)] m-0 truncate"},Xs={class:"flex gap-2"};function Ks(e,t,r,i,f,p){const d=a("info-icon"),h=a("el-image"),_=a("el-input-number"),$=K("loading");return n(),u("div",Rs,[s("div",Ms,[s("h2",Ws,l(e.$t("suno.name.replaceSection")),1),o(d,{content:e.$t("suno.description.replaceSection")},null,8,["content"])]),e.audio?(n(),u("div",Ns,[s("div",{class:"audio flex items-center",onClick:t[0]||(t[0]=b=>e.onClick(e.audio))},[N((n(),u("div",Os,[o(h,{src:e.audio?.image_url,class:"w-full h-full rounded",fit:"cover"},null,8,["src"])])),[[$,!e.audio?.audio_url]]),s("div",Bs,[s("h2",qs,l(e.audio?.title),1),s("p",Hs,l(e.audio?.style),1)])])])):m("",!0),s("div",Xs,[o(_,{modelValue:e.replaceSectionStart,"onUpdate:modelValue":t[1]||(t[1]=b=>e.replaceSectionStart=b),class:"flex-1",size:"small",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.replaceSectionStart")},null,8,["modelValue","max","placeholder"]),o(_,{modelValue:e.replaceSectionEnd,"onUpdate:modelValue":t[2]||(t[2]=b=>e.replaceSectionEnd=b),class:"flex-1",size:"small",min:e.replaceSectionStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.replaceSectionEnd")},null,8,["modelValue","min","max","placeholder"])])])}const Ys=S(Ds,[["render",Ks]]),Zs=w({name:"PresetPanel",components:{TypeSelector:tt,PromptInput:ht,LyricInput:wt,StyleInput:Tt,TitleInput:Gt,ExtendFromInput:Yt,CoverFromInput:ls,UploadAudio:rt,VocalGenderSelector:ms,AdvancedParams:js,ReplaceSectionInput:Ys,FontAwesomeIcon:z,ElButton:R,Consumption:Le},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Fe(this.config,this.service?.cost)},service(){return this.$store.state.suno?.service},supportsVocalGender(){const e=this.config?.model||"";return["chirp-v4-5-plus","chirp-v5"].includes(e)},generateButtonText(){const 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"):this.$t("suno.button.generate")}},methods:{onGenerate(){this.$emit("generate")}}}),Qs={class:"flex flex-col h-full"},Js={class:"flex-1 overflow-y-auto p-[15px]"},xs={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function eo(e,t,r,i,f,p){const d=a("type-selector"),h=a("upload-audio"),_=a("prompt-input"),$=a("lyric-input"),b=a("style-input"),P=a("title-input"),y=a("vocal-gender-selector"),A=a("extend-from-input"),O=a("cover-from-input"),B=a("replace-section-input"),Y=a("advanced-params"),g=a("consumption"),V=a("font-awesome-icon"),oe=a("el-button");return n(),u("div",Qs,[s("div",Js,[o(d,{class:"mb-4"}),o(h,{class:"mb-4"}),e.config?.custom?m("",!0):(n(),v(_,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(n(),v($,{key:1,class:"mb-4"})):m("",!0),e.config?.custom?(n(),v(b,{key:2,class:"mb-4"})):m("",!0),e.config?.custom?(n(),v(P,{key:3,class:"mb-4"})):m("",!0),e.config?.custom&&!e.config.instrumental&&e.supportsVocalGender?(n(),v(y,{key:4,class:"mb-4"})):m("",!0),e.config?.action==="extend"?(n(),v(A,{key:5,class:"mb-4"})):m("",!0),e.config?.action==="cover"?(n(),v(O,{key:6,class:"mb-4"})):m("",!0),e.config?.action==="replace_section"?(n(),v(B,{key:7,class:"mb-4"})):m("",!0),o(Y,{class:"mb-4"})]),s("div",xs,[o(g,{value:e.consumption,service:e.service},null,8,["value","service"]),o(oe,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:c(()=>[o(V,{icon:"fa-solid fa-magic",class:"mr-2"}),C(" "+l(e.generateButtonText),1)]),_:1},8,["onClick"])])])}const to=S(Zs,[["render",eo],["__scopeId","data-v-8201f79d"]]),so="https://webhook.acedata.cloud/suno",oo=w({name:"TaskPreview",components:{ElImage:W,ElIcon:X,ElTooltip:ye,FontAwesomeIcon:z,VideoPlay:Q,VideoPause:Z,ElDropdown:ve,ElDropdownMenu:ge,ElDropdownItem:$e,Loading:ne},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1,isFetchingMidi:!1}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===F.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(r=>({...r,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:j,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);const i=new URL(t).pathname,f=i.substring(i.lastIndexOf("/")+1);console.log("on preview",f),fetch(t).then(p=>p.blob()).then(p=>{ie.saveAs(p,f)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),k.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,r)=>{const i={audio_id:e},f=this.credential?.token;if(!f){console.error("no token specified"),r(new Error("No token specified"));return}E.mp4(i,{token:f}).then(p=>{const d=p.data?.data?.video_url;d?t(d):r(new Error("Video URL not found in response"))}).catch(p=>{r(p)})})},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]})},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;const t=this.credential?.token;if(t)try{this.isFetchingWav=!0,k.info(this.$t("suno.message.fetchingWav"));const i=(await E.wav({audio_id:e.id},{token:t})).data?.data?.audio_url;i?this.onDownload(null,i):k.error(this.$t("suno.message.fetchWavFailed"))}catch{k.error(this.$t("suno.message.fetchWavFailed"))}finally{this.isFetchingWav=!1}},async handleMidiDownload(e){if(!e?.id||this.isFetchingMidi)return;const t=this.credential?.token;if(t)try{this.isFetchingMidi=!0,k.info(this.$t("suno.message.fetchingMidi"));const i=(await E.midi({audio_id:e.id},{token:t})).data?.data?.midi_url;i?this.onDownload(null,i):k.error(this.$t("suno.message.fetchMidiFailed"))}catch{k.error(this.$t("suno.message.fetchMidiFailed"))}finally{this.isFetchingMidi=!1}},async onGenerateAudioUrl(e,t){const r={action:e,audio_id:t,callback_url:so},i=this.credential?.token;if(!i){console.error("no token specified");return}k.info(this.$t("suno.message.startingTask")),E.audio(r,{token:i}).then(()=>{k.success(this.$t("suno.message.startTaskSuccess"))}).catch(f=>{k.error(f?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),no={class:"task"},io=["onClick"],ao={class:"left"},lo=["onClick"],ro=["onClick"],co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"},fo={class:"right"},ho={class:"el-dropdown-link"},_o={class:"flex items-center min-w-[120px]"},$o={class:"flex items-center min-w-[120px]"},go={class:"flex items-center min-w-[120px]"},vo={class:"el-dropdown-link"};function yo(e,t,r,i,f,p){const d=a("el-image"),h=a("video-pause"),_=a("el-icon"),$=a("video-play"),b=a("font-awesome-icon"),P=a("el-tooltip"),y=a("Loading"),A=a("el-dropdown-item"),O=a("el-dropdown-menu"),B=a("el-dropdown"),Y=K("loading");return n(),u("div",no,[(n(!0),u(G,null,H(e.audios,g=>(n(),u("div",{key:g.id,class:"audio",onClick:U(V=>e.onClick(g),["stop"])},[N((n(),u("div",ao,[o(d,{src:g?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(n(),u("div",{key:0,class:"overlay",onClick:U(V=>e.onPause(g),["stop"])},[o(_,null,{default:c(()=>[o(h)]),_:1})],8,lo)):m("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(n(),u("div",{key:1,class:"overlay",onClick:U(V=>e.onPlay(g),["stop"])},[o(_,null,{default:c(()=>[o($)]),_:1})],8,ro)):m("",!0),g?.duration?(n(),u("div",co,l(e.useFormatDuring(g?.duration)),1)):m("",!0)])),[[Y,!g?.audio_url]]),s("div",uo,[s("h2",po,l(g?.title),1),s("p",mo,l(g?.style),1)]),s("div",fo,[o(B,null,{dropdown:c(()=>[o(O,null,{default:c(()=>[o(A,{disabled:e.isFetchingVideoUrl,onClick:V=>e.handleVideoDownload(g)},{default:c(()=>[s("div",_o,[e.isFetchingVideoUrl?(n(),v(_,{key:0,class:"is-loading mr-2"},{default:c(()=>[o(y)]),_:1})):m("",!0),s("span",null,l(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),g?.audio_url?(n(),v(A,{key:0,onClick:U(V=>e.onDownload(V,g?.audio_url),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):m("",!0),o(A,{disabled:e.isFetchingWav,onClick:V=>e.handleWavDownload(g)},{default:c(()=>[s("div",$o,[e.isFetchingWav?(n(),v(_,{key:0,class:"is-loading mr-2"},{default:c(()=>[o(y)]),_:1})):m("",!0),s("span",null,l(e.$t("suno.button.download_wav")),1)])]),_:2},1032,["disabled","onClick"]),o(A,{disabled:e.isFetchingMidi,onClick:V=>e.handleMidiDownload(g)},{default:c(()=>[s("div",go,[e.isFetchingMidi?(n(),v(_,{key:0,class:"is-loading mr-2"},{default:c(()=>[o(y)]),_:1})):m("",!0),s("span",null,l(e.$t("suno.button.download_midi")),1)])]),_:2},1032,["disabled","onClick"])]),_:2},1024)]),default:c(()=>[s("span",ho,[o(P,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:c(()=>[g?.audio_url||g?.video_url?(n(),v(b,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):m("",!0)]),_:2},1032,["content"])])]),_:2},1024),o(B,null,{dropdown:c(()=>[o(O,null,{default:c(()=>[g?.audio_url?(n(),v(A,{key:0,onClick:U(V=>e.onExtend(V,g),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):m("",!0),g.id?(n(),v(A,{key:1,onClick:U(V=>e.onGetStems(g.id),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):m("",!0),g.id?(n(),v(A,{key:2,onClick:U(V=>e.onGetAllStems(g.id),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.all_stems")),1)]),_:2},1032,["onClick"])):m("",!0),o(A,{onClick:U(V=>e.onCover(g),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id?(n(),v(A,{key:3,onClick:U(V=>e.onRemaster(g.id),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.remaster")),1)]),_:2},1032,["onClick"])):m("",!0),g?.id?(n(),v(A,{key:4,onClick:U(V=>e.onReplaceSection(g),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.replace_section")),1)]),_:2},1032,["onClick"])):m("",!0),g?.id?(n(),v(A,{key:5,onClick:U(V=>e.onMashup(g),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.mashup")),1)]),_:2},1032,["onClick"])):m("",!0),g?.id&&g?.action==="extend"?(n(),v(A,{key:6,onClick:U(V=>e.onConcatMusic(g?.id),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):m("",!0)]),_:2},1024)]),default:c(()=>[s("span",vo,[o(P,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:c(()=>[g?.audio_url||g?.video_url?(n(),v(b,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):m("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,io))),128))])}const ko=S(oo,[["render",yo]]),bo={class:"player-slider"},wo=w({__name:"PlayerSlider",setup(e){const t=D(),r=I({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),i=I({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),f=()=>{},p=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,h)=>(n(),u("div",bo,[o(T(J),{modelValue:r.value,"onUpdate:modelValue":h[0]||(h[0]=_=>r.value=_),"show-tooltip":!1,min:0,max:i.value,onChange:p,onInput:f},null,8,["modelValue","max"])]))}}),Co="/assets/disk-XFRmVAfp.png",Vo={class:"flex player-song"},So=["src"],Ao={class:"ml-2 text-xs flex flex-col justify-between"},Po={class:"w-52 2xl:w-96 cursor-pointer truncate"},Uo={class:"flex"},To={class:"ml-2 text-dc"},Eo=w({__name:"PlayerSong",setup(e){const t=D(),r=I({get:()=>t.state.suno.audio,set:i=>t.commit("suno/setAudio",i)});return Ve(r,(i,f)=>{if(i?.audio_url!==f?.audio_url){console.log("audio changed",i),i.object&&(console.log("111",i.object),i.object.pause(),delete i.object);const p=new Audio(i.audio_url);i.state==="playing"?p.play():p.pause(),p.addEventListener("loadedmetadata",()=>{p.currentTime=0,p.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:p.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:p})}else if(i?.progress!==f?.progress&&Math.abs(i.progress-i.object.currentTime)>2){console.log("progress changed",i.progress);const p=t.state.suno.audio;p.object&&(p.object.currentTime=p.progress)}else i?.state!==f?.state&&(console.log("state changed",i.state),i.object&&(i.state==="playing"?i.object.play():i.object.pause()));i?.volume!==f?.volume&&(console.log("volume changed",i.volume),i.object&&(i.object.volume=i.volume/100))}),(i,f)=>(n(),u("div",Vo,[s("img",{alt:"",class:"w-11 h-11 rounded",src:r.value?.image_url||T(Co)},null,8,So),s("div",Ao,[s("div",Po,[s("div",Uo,[s("span",null,l(r.value?.title||"Music"),1),s("span",To,"- "+l(r.value?.style||"SmallRuralDog"),1)])])])]))}}),Io={class:"flex justify-end items-center gap-x-2.5"},Lo={class:"text-xs"},zo=w({__name:"PlayerAction",setup(e){const t=D(),r=I({get:()=>t.state.suno?.audio?.progress,set:f=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:f})}),i=I({get:()=>t.state.suno?.audio?.duration,set:f=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:f})});return(f,p)=>(n(),u("div",Io,[s("span",Lo,l(T(j)(r.value))+" / "+l(T(j)(i.value)),1)]))}}),x=w({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,r)=>(n(),v(Se(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),Fo={class:"player-volume flex flex-col items-center pt-2"},Go={class:"text-sm mt-3"},jo=w({__name:"PlayerVolumeSlider",setup(e){const t=D(),r=I({get:()=>t.state.suno.audio?.volume,set:p=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:p})}),i=I({get:()=>t.state.suno.audio?.muted,set:p=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:p})}),f=p=>t.dispatch("suno/setVolume",p);return(p,d)=>(n(),u("div",Fo,[o(T(J),{modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=h=>r.value=h),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:i.value,onInput:f},null,8,["modelValue","disabled"]),s("div",Go,l(r.value),1)]))}}),Do={class:"flex items-center justify-center gap-x-3"},Ro=w({__name:"PlayerController",setup(e){const t=D(),r=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),i=I(()=>t.state.suno.audio);return(f,p)=>(n(),u("div",Do,[o(x,{icon:i.value?.state==="playing"?T(ae):T(le),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:r},null,8,["icon"]),o(T(ke),{placement:"top",width:"50px",trigger:"click"},{reference:c(()=>[o(x,{icon:T(re),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:c(()=>[o(jo)]),_:1})]))}}),Mo={class:"flex flex-col items-stretch h-20"},Wo={class:"flex grow px-5 items-center"},No={class:"flex-1"},Oo={class:"flex-1"},Bo={class:"flex-1"},qo=w({__name:"Player",setup(e){return(t,r)=>(n(),u("div",Mo,[o(wo),s("div",Wo,[s("div",No,[o(Eo)]),s("div",Oo,[o(Ro)]),s("div",Bo,[o(zo)])])]))}}),Ho=w({name:"RecentPanel",components:{ElSkeletonItem:we,ElSkeleton:be,TaskPreview:ko,Player:qo,NoTasks:ze,ScrollList:Ie},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Xo={key:0,class:"tasks"},Ko={class:"left w-[70px] p-[10px] flex items-center"},Yo={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},Zo={key:2,class:"w-full flex-1 flex items-center justify-center"},Qo={class:"h-20"};function Jo(e,t,r,i,f,p){const d=a("el-skeleton-item"),h=a("el-skeleton"),_=a("task-preview"),$=a("scroll-list"),b=a("no-tasks"),P=a("player");return n(),u(G,null,[e.tasks?.items===void 0?(n(),u("div",Xo,[(n(),u(G,null,H(3,y=>s("div",{key:y,class:"flex"},[s("div",Ko,[o(h,{animated:""},{template:c(()=>[o(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),s("div",Yo,[o(h,{animated:""},{template:c(()=>[o(d,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),o(d,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),v($,{key:1,ref:"scrollList",class:"flex-1 w-full overflow-y-auto tasks p-2",loading:e.loading,onReachTop:t[0]||(t[0]=y=>e.$emit("reach-top"))},{default:c(()=>[(n(!0),u(G,null,H(e.tasks?.items,(y,A)=>(n(),v(_,{key:A,"model-value":y,class:"preview"},null,8,["model-value"]))),128))]),_:1},8,["loading"])):m("",!0),e.tasks?.items?.length===0?(n(),u("div",Zo,[o(b)])):m("",!0),N(s("div",Qo,[o(P)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const xo=S(Ho,[["render",Jo]]),en=w({name:"TaskPreview",components:{IconPicture:ce,ElImage:W,ElAvatar:Ce,ElIcon:X},computed:{audio(){return this.$store.state.suno?.audio}}}),tn={key:0,class:"size-full overflow-hidden"},sn={class:"relative h-[300px]"},on={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},nn={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"},an={class:"p-4"},ln={class:"flex items-center font-bold mb-2"},rn={class:"text-[var(--el-text-color-regular)] mb-2"},cn={class:"text-xs text-[var(--el-text-color-regular)]"},un={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},dn={key:1,class:"w-full h-full"};function pn(e,t,r,i,f,p){const d=a("icon-picture"),h=a("el-icon"),_=a("el-image"),$=a("el-avatar");return e.audio?.object?(n(),u("div",tn,[s("div",sn,[o(_,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:c(()=>[s("div",on,[o(h,{class:"text-3xl"},{default:c(()=>[o(d)]),_:1})])]),_:1},8,["src"]),s("h2",nn,l(e.audio?.title),1)]),s("div",an,[s("div",ln,[o($,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),s("span",null,l(e.audio?.title),1)]),s("p",rn,l(e.audio?.style),1),s("p",cn,l(e.$dayjs.format(e.audio?.created_at)),1),s("div",un,[s("p",null,l(e.audio?.lyric),1)])])])):(n(),u("div",dn))}const mn=S(en,[["render",pn]]),fn="https://webhook.acedata.cloud/suno",hn=w({name:"SunoIndex",components:{Layout:Oe,ConfigPanel:to,RecentPanel:xo,PreviewPanel:mn},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===F.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===F.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===F.Request},needApply(){return this.$store.state.suno.status.getApplications===F.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 Ge({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(){Te.create({application:this.application}).then(({data:e})=>{this.application=e,k.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ee&&k.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const 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);const{limit:t=5,createdAtMin:r,createdAtMax:i}=e||{};console.debug("limit",t,"createdAtMin",r,"createdAtMax",i),this.fetchingTasks=!0;try{await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:r,createdAtMax:i})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){const e={...this.config,callback_url:fn},t=this.credential?.token;if(!t){console.error("no token specified");return}k.info(this.$t("suno.message.startingTask")),E.audio(e,{token:t}).then(()=>{k.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{k.error(r?.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?.()}}});function _n(e,t,r,i,f,p){const d=a("config-panel"),h=a("recent-panel"),_=a("preview-panel"),$=a("layout");return n(),v($,null,{config:c(()=>[o(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:c(()=>[o(h,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),preview:c(()=>[o(_)]),_:1})}const Un=S(hn,[["render",_n],["__scopeId","data-v-d1296b1a"]]);export{Un as default};
|
|
1
|
+
import{bH as z,bX as Z,bY as Q,l as ne,bZ as ie,b_ as D,b$ as ae,c0 as le,c1 as re,c2 as ce}from"./vendor-B4-12K57.js";import{k as R,O as ue,j as de,K as pe,L as me,r as fe,s as k,q as M,Q as ee,e as X,i as W,A as te,B as se,R as J,V as he,W as _e,f as $e,g as ge,h as ve,o as ye,p as ke,H as be,U as we,X as Ce}from"./vendor-element-plus-C2t7-rNg.js";import{d as w,c as u,a as s,l as o,P as q,S as c,am as a,o as n,W as m,Z as l,F as G,ak as H,R as v,Y as C,U as N,at as K,a1 as U,b as I,z as T,w as Ve,X as Se,_ as Ae}from"./vendor-vue-BzRnDgD5.js";import{_ as S,bN as Pe,bO as E,a5 as Ue,ah as F,aa as Te,ag as Ee}from"./index-BwtxyV6k.js";import{I as L,S as Ie}from"./ScrollList-CfFOKFbb.js";import{C as Le,N as ze}from"./NoTasks-CQZOGbwI.js";import{a as Fe}from"./price-Clo8IP03.js";import{l as Ge}from"./pagination-bjoHZNQW.js";import"./vendor-dayjs-D6Igi227.js";import"./vendor-katex-DHBGsivc.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-nHemWFue.js";const je=w({name:"LayoutSuno",components:{ElDrawer:ue,ElButton:R,FontAwesomeIcon:z},data(){return{drawer:!1,preview:!1}},computed:{}}),De={class:"main flex flex-row flex-1"},Re={class:"config w-[300px] h-full overflow-y-scroll bg-[var(--app-sidebar-bg)]"},Me={class:"result h-full flex flex-col flex-1"},We={class:"preview h-full w-[300px] flex flex-col"};function Ne(e,t,r,i,f,p){const d=a("font-awesome-icon"),h=a("el-button"),_=a("el-drawer");return n(),u("div",De,[s("div",Re,[q(e.$slots,"config",{},void 0,!0)]),s("div",Me,[q(e.$slots,"result",{},void 0,!0)]),s("div",We,[q(e.$slots,"preview",{},void 0,!0)]),o(h,{circle:"",class:"menu",onClick:t[0]||(t[0]=$=>e.drawer=!0)},{default:c(()=>[o(d,{icon:"fa-solid fa-magic"})]),_:1}),o(_,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=$=>e.drawer=$),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:c(()=>[q(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const Oe=S(je,[["render",Ne],["__scopeId","data-v-087f869f"]]),Be=w({name:"TypeSelector",components:{ElSelect:me,ElOption:pe,ElSwitch:de},data(){return{options:[{label:"Suno v5",value:"chirp-v5",info:"8 min"},{label:"Suno v4.5+",value:"chirp-v4-5-plus",info:"8 min"},{label:"Suno v4.5",value:"chirp-v4-5",info:"4 min"},{label:"Suno v4",value:"chirp-v4",info:"2.5 min"},{label:"Suno v3.5",value:"chirp-v3-5",info:"2 min"},{label:"Suno v3",value:"chirp-v3-0",info:"2 min"}]}},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||(this.model=Pe)}}),qe={class:"flex items-center justify-between mb-3"},He={class:"text-sm font-bold"},Xe={class:"mb-3"},Ke={class:"flex items-center mb-1"},Ye={class:"text-sm font-bold"},Ze={class:"flex items-center justify-between w-full"},Qe={class:"text-xs text-[var(--el-text-color-placeholder)]"},Je={key:0,class:"flex items-center justify-between mb-3"},xe={class:"text-sm font-bold"};function et(e,t,r,i,f,p){const d=a("el-switch"),h=a("el-option"),_=a("el-select");return n(),u("div",null,[s("div",qe,[s("span",He,l(e.$t("suno.name.type")),1),o(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=$=>e.custom=$),size:"small"},null,8,["modelValue"])]),s("div",Xe,[s("div",Ke,[s("span",Ye,l(e.$t("suno.name.model")),1)]),o(_,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=$=>e.model=$),class:"w-full",size:"default",placeholder:e.$t("suno.placeholder.select")},{default:c(()=>[(n(!0),u(G,null,H(e.options,$=>(n(),v(h,{key:$.value,label:$.label,value:$.value},{default:c(()=>[s("div",Ze,[s("span",null,l($.label),1),s("span",Qe,l($.info),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),e.custom?(n(),u("div",Je,[s("span",xe,l(e.$t("suno.name.instrumental")),1),o(d,{modelValue:e.instrumental,"onUpdate:modelValue":t[2]||(t[2]=$=>e.instrumental=$),size:"small"},null,8,["modelValue"])])):m("",!0)])}const tt=S(Be,[["render",et]]),st=w({name:"UploadAudio",components:{ElUpload:fe,ElButton:R,InfoIcon:L,FontAwesomeIcon:z},emits:["change"],data(){return{fileList:[],uploadUrl:Ue()+"/api/v1/files/"}},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(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){k.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){k.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},r=this.credential?.token;if(!r){console.error("no token specified");return}k.info(this.$t("suno.message.startingUploadAudio")),E.upload(t,{token:r}).then(i=>{console.debug("get upload music success",i.data);const f=i.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:f,action:"upload_extend"}),k.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(i=>{k.error(i?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ot={class:"relative"},nt={class:"flex justify-between"},it={class:"flex justify-start items-center"},at={class:"text-sm font-bold"};function lt(e,t,r,i,f,p){const d=a("info-icon"),h=a("font-awesome-icon"),_=a("el-button"),$=a("el-upload");return n(),u("div",ot,[s("div",nt,[s("div",it,[s("span",at,l(e.$t("suno.name.referenceAudios")),1),o(d,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),o($,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=b=>e.fileList=b),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:c(()=>[o(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:c(()=>[o(h,{icon:"fa-solid fa-upload",class:"icon mr-1"}),C(" "+l(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const rt=S(st,[["render",lt],["__scopeId","data-v-6236152c"]]),ct="",ut=w({name:"PromptInput",components:{ElInput:M,InfoIcon:L},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=ct)}}),dt={class:"field"},pt={class:"flex items-center mb-1"},mt={class:"text-sm font-bold"};function ft(e,t,r,i,f,p){const d=a("info-icon"),h=a("el-input");return n(),u("div",dt,[s("div",pt,[s("span",mt,l(e.$t("suno.name.songDescription")),1),o(d,{content:e.$t("suno.description.prompt")},null,8,["content"])]),o(h,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=_=>e.prompt=_),rows:4,type:"textarea",placeholder:e.$t("suno.placeholder.prompt")},null,8,["modelValue","placeholder"])])}const ht=S(ut,[["render",ft]]),_t="",$t=w({name:"LyricInput",components:{ElInput:M,ElButton:R,FontAwesomeIcon:z,InfoIcon:L},data(){return{generatingLyrics:!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||(this.lyric=_t)},methods:{async onGenerateLyrics(){const e=this.credential?.token;if(!e)return;const t=this.config?.style||this.config?.title||"a beautiful song";this.generatingLyrics=!0,k.info(this.$t("suno.message.generatingLyrics"));try{const i=(await E.lyric({prompt:t},{token:e})).data?.data;i?.text&&(this.lyric=i.text,i?.title&&!this.config?.title&&this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:i.text,title:i.title}),k.success(this.$t("suno.message.generateLyricsSuccess")))}catch{k.error(this.$t("suno.message.generateLyricsFailed"))}finally{this.generatingLyrics=!1}}}}),gt={class:"field"},vt={class:"flex items-center justify-between mb-1"},yt={class:"flex items-center"},kt={class:"text-sm font-bold"};function bt(e,t,r,i,f,p){const d=a("info-icon"),h=a("font-awesome-icon"),_=a("el-button"),$=a("el-input");return n(),u("div",gt,[s("div",vt,[s("div",yt,[s("span",kt,l(e.$t("suno.name.lyrics")),1),o(d,{content:e.$t("suno.description.lyrics")},null,8,["content"])]),e.config?.action!=="extend"?(n(),v(_,{key:0,size:"small",loading:e.generatingLyrics,round:"",onClick:e.onGenerateLyrics},{default:c(()=>[e.generatingLyrics?m("",!0):(n(),v(h,{key:0,icon:"fa-solid fa-wand-magic-sparkles",class:"mr-1"})),C(" "+l(e.$t("suno.button.generate_lyrics")),1)]),_:1},8,["loading","onClick"])):m("",!0)]),e.config?.action!=="extend"?(n(),v($,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=b=>e.lyric=b),rows:5,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics")},null,8,["modelValue","placeholder"])):(n(),v($,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=b=>e.lyric=b),rows:5,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics")},null,8,["modelValue","placeholder"]))])}const wt=S($t,[["render",bt],["__scopeId","data-v-210d2670"]]),Ct=w({name:"StyleInput",components:{ElInput:M,ElButton:R,FontAwesomeIcon:z,InfoIcon:L},data(){return{optimizing:!1}},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}},methods:{async onOptimizeStyle(){const e=this.credential?.token;if(!(!e||!this.style)){this.optimizing=!0,k.info(this.$t("suno.message.optimizingStyle"));try{const t=await E.style({prompt:this.style},{token:e}),r=t.data?.text||t.data?.data?.text;r&&(this.style=r,k.success(this.$t("suno.message.optimizeStyleSuccess")))}catch{k.error(this.$t("suno.message.optimizeStyleFailed"))}finally{this.optimizing=!1}}}}}),Vt={class:"field"},St={class:"flex items-center justify-between mb-1"},At={class:"flex items-center"},Pt={class:"text-sm font-bold"};function Ut(e,t,r,i,f,p){const d=a("info-icon"),h=a("font-awesome-icon"),_=a("el-button"),$=a("el-input");return n(),u("div",Vt,[s("div",St,[s("div",At,[s("span",Pt,l(e.$t("suno.name.style")),1),o(d,{content:e.$t("suno.description.style")},null,8,["content"])]),o(_,{size:"small",loading:e.optimizing,round:"",onClick:e.onOptimizeStyle},{default:c(()=>[e.optimizing?m("",!0):(n(),v(h,{key:0,icon:"fa-solid fa-wand-magic-sparkles",class:"mr-1"})),C(" "+l(e.$t("suno.button.optimize_style")),1)]),_:1},8,["loading","onClick"])]),o($,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=b=>e.style=b),rows:2,type:"textarea",placeholder:e.$t("suno.placeholder.style")},null,8,["modelValue","placeholder"])])}const Tt=S(Ct,[["render",Ut]]),Et=w({name:"TitleInput",components:{ElInput:M,InfoIcon:L},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}}}}),It={class:"field"},Lt={class:"flex items-center mb-1"},zt={class:"text-sm font-bold"};function Ft(e,t,r,i,f,p){const d=a("info-icon"),h=a("el-input");return n(),u("div",It,[s("div",Lt,[s("span",zt,l(e.$t("suno.name.title")),1),o(d,{content:e.$t("suno.description.title")},null,8,["content"])]),o(h,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=_=>e.title=_),placeholder:e.$t("suno.placeholder.title")},null,8,["modelValue","placeholder"])])}const Gt=S(Et,[["render",Ft]]);function j(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const r=e%60,i=r<10?`0${r}`:r,f=t<10?`0${t}`:t;return i+":"+f}const jt=w({name:"ExtendFromInput",components:{ElImage:W,ElIcon:X,ElInputNumber:ee,VideoPlay:Q,VideoPause:Z},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||(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:j,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})}}}),Dt={class:"field"},Rt={class:"box"},Mt={class:"title font-bold"},Wt={class:"input-wrapper"},Nt={class:"task"},Ot={class:"left"},Bt={key:2,class:"duration"},qt={class:"info"},Ht={class:"title"},Xt={class:"style"};function Kt(e,t,r,i,f,p){const d=a("el-input-number"),h=a("el-image"),_=a("video-pause"),$=a("el-icon"),b=a("video-play"),P=K("loading");return n(),u("div",Dt,[s("div",Rt,[s("h2",Mt,l(e.$t("suno.name.extend")),1),s("div",Wt,[o(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=y=>e.value=y),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"])])]),s("div",Nt,[e.audio?(n(),u("div",{key:0,class:"audio",onClick:t[3]||(t[3]=y=>e.onClick(e.audio))},[N((n(),u("div",Ot,[o(h,{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"?(n(),u("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPause(e.audio))},[o($,null,{default:c(()=>[o(_)]),_:1})])):m("",!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")?(n(),u("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=y=>e.onPlay(e.audio))},[o($,null,{default:c(()=>[o(b)]),_:1})])):m("",!0),e.audio?.duration?(n(),u("div",Bt,l(e.useFormatDuring(e.audio?.duration)),1)):m("",!0)])),[[P,!e.audio?.audio_url]]),s("div",qt,[s("h2",Ht,l(e.audio?.title),1),s("p",Xt,l(e.audio?.style),1)])])):m("",!0)])])}const Yt=S(jt,[["render",Kt],["__scopeId","data-v-bcce4821"]]),Zt=w({name:"CoverFromInput",components:{ElImage:W,ElIcon:X,VideoPlay:Q,VideoPause:Z},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||(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:j,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})}}}),Qt={class:"field"},Jt={class:"box"},xt={class:"title font-bold"},es={class:"task"},ts={class:"left"},ss={key:2,class:"duration"},os={class:"info"},ns={class:"title"},is={class:"style"};function as(e,t,r,i,f,p){const d=a("el-image"),h=a("video-pause"),_=a("el-icon"),$=a("video-play"),b=K("loading");return n(),u("div",Qt,[s("div",Jt,[s("h2",xt,l(e.$t("suno.name.cover")),1)]),s("div",es,[e.audio?(n(),u("div",{key:0,class:"audio",onClick:t[2]||(t[2]=P=>e.onClick(e.audio))},[N((n(),u("div",ts,[o(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"?(n(),u("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=P=>e.onPause(e.audio))},[o(_,null,{default:c(()=>[o(h)]),_:1})])):m("",!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")?(n(),u("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=P=>e.onPlay(e.audio))},[o(_,null,{default:c(()=>[o($)]),_:1})])):m("",!0),e.audio?.duration?(n(),u("div",ss,l(e.useFormatDuring(e.audio?.duration)),1)):m("",!0)])),[[b,!e.audio?.audio_url]]),s("div",os,[s("h2",ns,l(e.audio?.title),1),s("p",is,l(e.audio?.style),1)])])):m("",!0)])])}const ls=S(Zt,[["render",as],["__scopeId","data-v-06640216"]]),rs=w({name:"VocalGenderSelector",components:{ElRadioGroup:se,ElRadioButton:te,InfoIcon:L},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})}}}}),cs={class:"mb-2"},us={class:"flex items-center mb-1"},ds={class:"text-sm font-bold"};function ps(e,t,r,i,f,p){const d=a("info-icon"),h=a("el-radio-button"),_=a("el-radio-group");return n(),u("div",cs,[s("div",us,[s("span",ds,l(e.$t("suno.name.vocalGender")),1),o(d,{content:e.$t("suno.description.vocalGender")},null,8,["content"])]),o(_,{modelValue:e.vocalGender,"onUpdate:modelValue":t[0]||(t[0]=$=>e.vocalGender=$),size:"small"},{default:c(()=>[o(h,{value:""},{default:c(()=>[C(l(e.$t("suno.gender.auto")),1)]),_:1}),o(h,{value:"f"},{default:c(()=>[C(l(e.$t("suno.gender.female")),1)]),_:1}),o(h,{value:"m"},{default:c(()=>[C(l(e.$t("suno.gender.male")),1)]),_:1})]),_:1},8,["modelValue"])])}const ms=S(rs,[["render",ps]]),fs=w({name:"AdvancedParams",components:{ElCollapse:_e,ElCollapseItem:he,ElInput:M,ElSlider:J,ElRadioGroup:se,ElRadioButton:te},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.suno?.config},isV5OrAbove(){return(this.config?.model||"")==="chirp-v5"},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??50},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??50},set(e){this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_weight:e})}}}}),hs={key:0,class:"mb-3"},_s={class:"flex items-center mb-1"},$s={class:"text-xs font-bold"},gs={key:1,class:"mb-3"},vs={class:"flex items-center mb-1"},ys={class:"text-xs font-bold"},ks={key:2,class:"mb-3"},bs={class:"flex items-center justify-between mb-1"},ws={class:"text-xs font-bold"},Cs={class:"text-xs text-[var(--el-text-color-secondary)]"},Vs={key:3,class:"mb-3"},Ss={class:"flex items-center justify-between mb-1"},As={class:"text-xs font-bold"},Ps={class:"text-xs text-[var(--el-text-color-secondary)]"},Us={key:4,class:"mb-3"},Ts={class:"flex items-center mb-1"},Es={class:"text-xs font-bold"},Is={key:5,class:"mb-3"},Ls={class:"flex items-center justify-between mb-1"},zs={class:"text-xs font-bold"},Fs={class:"text-xs text-[var(--el-text-color-secondary)]"};function Gs(e,t,r,i,f,p){const d=a("el-input"),h=a("el-slider"),_=a("el-radio-button"),$=a("el-radio-group"),b=a("el-collapse-item"),P=a("el-collapse");return n(),v(P,{modelValue:e.activeNames,"onUpdate:modelValue":t[6]||(t[6]=y=>e.activeNames=y),class:"advanced-collapse"},{default:c(()=>[o(b,{title:e.$t("suno.name.advancedParams"),name:"advanced"},{default:c(()=>[e.config?.custom?(n(),u("div",hs,[s("div",_s,[s("span",$s,l(e.$t("suno.name.styleNegative")),1)]),o(d,{modelValue:e.styleNegative,"onUpdate:modelValue":t[0]||(t[0]=y=>e.styleNegative=y),size:"small",placeholder:e.$t("suno.placeholder.styleNegative")},null,8,["modelValue","placeholder"])])):m("",!0),e.config?.custom&&!e.config?.instrumental?(n(),u("div",gs,[s("div",vs,[s("span",ys,l(e.$t("suno.name.lyricPrompt")),1)]),o(d,{modelValue:e.lyricPrompt,"onUpdate:modelValue":t[1]||(t[1]=y=>e.lyricPrompt=y),size:"small",placeholder:e.$t("suno.placeholder.lyricPrompt")},null,8,["modelValue","placeholder"])])):m("",!0),e.config?.custom?(n(),u("div",ks,[s("div",bs,[s("span",ws,l(e.$t("suno.name.weirdness")),1),s("span",Cs,l(e.weirdness??0),1)]),o(h,{modelValue:e.weirdness,"onUpdate:modelValue":t[2]||(t[2]=y=>e.weirdness=y),min:0,max:100,step:1,size:"small"},null,8,["modelValue"])])):m("",!0),e.config?.custom?(n(),u("div",Vs,[s("div",Ss,[s("span",As,l(e.$t("suno.name.styleInfluence")),1),s("span",Ps,l(e.styleInfluence??50),1)]),o(h,{modelValue:e.styleInfluence,"onUpdate:modelValue":t[3]||(t[3]=y=>e.styleInfluence=y),min:0,max:100,step:1,size:"small"},null,8,["modelValue"])])):m("",!0),e.isV5OrAbove?(n(),u("div",Us,[s("div",Ts,[s("span",Es,l(e.$t("suno.name.variationCategory")),1)]),o($,{modelValue:e.variationCategory,"onUpdate:modelValue":t[4]||(t[4]=y=>e.variationCategory=y),size:"small"},{default:c(()=>[o(_,{value:""},{default:c(()=>[C(l(e.$t("suno.gender.auto")),1)]),_:1}),o(_,{value:"high"},{default:c(()=>[C(l(e.$t("suno.variation.high")),1)]),_:1}),o(_,{value:"low"},{default:c(()=>[C(l(e.$t("suno.variation.low")),1)]),_:1})]),_:1},8,["modelValue"])])):m("",!0),e.config?.action==="cover"?(n(),u("div",Is,[s("div",Ls,[s("span",zs,l(e.$t("suno.name.audioWeight")),1),s("span",Fs,l(e.audioWeight??50),1)]),o(h,{modelValue:e.audioWeight,"onUpdate:modelValue":t[5]||(t[5]=y=>e.audioWeight=y),min:0,max:100,step:1,size:"small"},null,8,["modelValue"])])):m("",!0)]),_:1},8,["title"])]),_:1},8,["modelValue"])}const js=S(fs,[["render",Gs],["__scopeId","data-v-be135363"]]),Ds=w({name:"ReplaceSectionInput",components:{ElInputNumber:ee,ElImage:W,InfoIcon:L},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"})}}}),Rs={class:"field"},Ms={class:"flex items-center mb-2"},Ws={class:"text-sm font-bold m-0"},Ns={key:0,class:"task mb-2"},Os={class:"left relative w-[50px] h-[50px] mr-3 flex-shrink-0"},Bs={class:"info flex-1 min-w-0"},qs={class:"text-sm font-bold m-0 truncate"},Hs={class:"text-xs text-[var(--el-text-color-secondary)] m-0 truncate"},Xs={class:"flex gap-2"};function Ks(e,t,r,i,f,p){const d=a("info-icon"),h=a("el-image"),_=a("el-input-number"),$=K("loading");return n(),u("div",Rs,[s("div",Ms,[s("h2",Ws,l(e.$t("suno.name.replaceSection")),1),o(d,{content:e.$t("suno.description.replaceSection")},null,8,["content"])]),e.audio?(n(),u("div",Ns,[s("div",{class:"audio flex items-center",onClick:t[0]||(t[0]=b=>e.onClick(e.audio))},[N((n(),u("div",Os,[o(h,{src:e.audio?.image_url,class:"w-full h-full rounded",fit:"cover"},null,8,["src"])])),[[$,!e.audio?.audio_url]]),s("div",Bs,[s("h2",qs,l(e.audio?.title),1),s("p",Hs,l(e.audio?.style),1)])])])):m("",!0),s("div",Xs,[o(_,{modelValue:e.replaceSectionStart,"onUpdate:modelValue":t[1]||(t[1]=b=>e.replaceSectionStart=b),class:"flex-1",size:"small",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.replaceSectionStart")},null,8,["modelValue","max","placeholder"]),o(_,{modelValue:e.replaceSectionEnd,"onUpdate:modelValue":t[2]||(t[2]=b=>e.replaceSectionEnd=b),class:"flex-1",size:"small",min:e.replaceSectionStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.replaceSectionEnd")},null,8,["modelValue","min","max","placeholder"])])])}const Ys=S(Ds,[["render",Ks]]),Zs=w({name:"PresetPanel",components:{TypeSelector:tt,PromptInput:ht,LyricInput:wt,StyleInput:Tt,TitleInput:Gt,ExtendFromInput:Yt,CoverFromInput:ls,UploadAudio:rt,VocalGenderSelector:ms,AdvancedParams:js,ReplaceSectionInput:Ys,FontAwesomeIcon:z,ElButton:R,Consumption:Le},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Fe(this.config,this.service?.cost)},service(){return this.$store.state.suno?.service},supportsVocalGender(){const e=this.config?.model||"";return["chirp-v4-5-plus","chirp-v5"].includes(e)},generateButtonText(){const 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"):this.$t("suno.button.generate")}},methods:{onGenerate(){this.$emit("generate")}}}),Qs={class:"flex flex-col h-full"},Js={class:"flex-1 overflow-y-auto p-[15px]"},xs={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function eo(e,t,r,i,f,p){const d=a("type-selector"),h=a("upload-audio"),_=a("prompt-input"),$=a("lyric-input"),b=a("style-input"),P=a("title-input"),y=a("vocal-gender-selector"),A=a("extend-from-input"),O=a("cover-from-input"),B=a("replace-section-input"),Y=a("advanced-params"),g=a("consumption"),V=a("font-awesome-icon"),oe=a("el-button");return n(),u("div",Qs,[s("div",Js,[o(d,{class:"mb-4"}),o(h,{class:"mb-4"}),e.config?.custom?m("",!0):(n(),v(_,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(n(),v($,{key:1,class:"mb-4"})):m("",!0),e.config?.custom?(n(),v(b,{key:2,class:"mb-4"})):m("",!0),e.config?.custom?(n(),v(P,{key:3,class:"mb-4"})):m("",!0),e.config?.custom&&!e.config.instrumental&&e.supportsVocalGender?(n(),v(y,{key:4,class:"mb-4"})):m("",!0),e.config?.action==="extend"?(n(),v(A,{key:5,class:"mb-4"})):m("",!0),e.config?.action==="cover"?(n(),v(O,{key:6,class:"mb-4"})):m("",!0),e.config?.action==="replace_section"?(n(),v(B,{key:7,class:"mb-4"})):m("",!0),o(Y,{class:"mb-4"})]),s("div",xs,[o(g,{value:e.consumption,service:e.service},null,8,["value","service"]),o(oe,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:c(()=>[o(V,{icon:"fa-solid fa-magic",class:"mr-2"}),C(" "+l(e.generateButtonText),1)]),_:1},8,["onClick"])])])}const to=S(Zs,[["render",eo],["__scopeId","data-v-8201f79d"]]),so="https://webhook.acedata.cloud/suno",oo=w({name:"TaskPreview",components:{ElImage:W,ElIcon:X,ElTooltip:ye,FontAwesomeIcon:z,VideoPlay:Q,VideoPause:Z,ElDropdown:ve,ElDropdownMenu:ge,ElDropdownItem:$e,Loading:ne},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1,isFetchingMidi:!1}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===F.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(r=>({...r,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:j,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);const i=new URL(t).pathname,f=i.substring(i.lastIndexOf("/")+1);console.log("on preview",f),fetch(t).then(p=>p.blob()).then(p=>{ie.saveAs(p,f)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),k.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,r)=>{const i={audio_id:e},f=this.credential?.token;if(!f){console.error("no token specified"),r(new Error("No token specified"));return}E.mp4(i,{token:f}).then(p=>{const d=p.data?.data?.video_url;d?t(d):r(new Error("Video URL not found in response"))}).catch(p=>{r(p)})})},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]})},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;const t=this.credential?.token;if(t)try{this.isFetchingWav=!0,k.info(this.$t("suno.message.fetchingWav"));const i=(await E.wav({audio_id:e.id},{token:t})).data?.data?.audio_url;i?this.onDownload(null,i):k.error(this.$t("suno.message.fetchWavFailed"))}catch{k.error(this.$t("suno.message.fetchWavFailed"))}finally{this.isFetchingWav=!1}},async handleMidiDownload(e){if(!e?.id||this.isFetchingMidi)return;const t=this.credential?.token;if(t)try{this.isFetchingMidi=!0,k.info(this.$t("suno.message.fetchingMidi"));const i=(await E.midi({audio_id:e.id},{token:t})).data?.data?.midi_url;i?this.onDownload(null,i):k.error(this.$t("suno.message.fetchMidiFailed"))}catch{k.error(this.$t("suno.message.fetchMidiFailed"))}finally{this.isFetchingMidi=!1}},async onGenerateAudioUrl(e,t){const r={action:e,audio_id:t,callback_url:so},i=this.credential?.token;if(!i){console.error("no token specified");return}k.info(this.$t("suno.message.startingTask")),E.audio(r,{token:i}).then(()=>{k.success(this.$t("suno.message.startTaskSuccess"))}).catch(f=>{k.error(f?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),no={class:"task"},io=["onClick"],ao={class:"left"},lo=["onClick"],ro=["onClick"],co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"},fo={class:"right"},ho={class:"el-dropdown-link"},_o={class:"flex items-center min-w-[120px]"},$o={class:"flex items-center min-w-[120px]"},go={class:"flex items-center min-w-[120px]"},vo={class:"el-dropdown-link"};function yo(e,t,r,i,f,p){const d=a("el-image"),h=a("video-pause"),_=a("el-icon"),$=a("video-play"),b=a("font-awesome-icon"),P=a("el-tooltip"),y=a("Loading"),A=a("el-dropdown-item"),O=a("el-dropdown-menu"),B=a("el-dropdown"),Y=K("loading");return n(),u("div",no,[(n(!0),u(G,null,H(e.audios,g=>(n(),u("div",{key:g.id,class:"audio",onClick:U(V=>e.onClick(g),["stop"])},[N((n(),u("div",ao,[o(d,{src:g?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(n(),u("div",{key:0,class:"overlay",onClick:U(V=>e.onPause(g),["stop"])},[o(_,null,{default:c(()=>[o(h)]),_:1})],8,lo)):m("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(n(),u("div",{key:1,class:"overlay",onClick:U(V=>e.onPlay(g),["stop"])},[o(_,null,{default:c(()=>[o($)]),_:1})],8,ro)):m("",!0),g?.duration?(n(),u("div",co,l(e.useFormatDuring(g?.duration)),1)):m("",!0)])),[[Y,!g?.audio_url]]),s("div",uo,[s("h2",po,l(g?.title),1),s("p",mo,l(g?.style),1)]),s("div",fo,[o(B,null,{dropdown:c(()=>[o(O,null,{default:c(()=>[o(A,{disabled:e.isFetchingVideoUrl,onClick:V=>e.handleVideoDownload(g)},{default:c(()=>[s("div",_o,[e.isFetchingVideoUrl?(n(),v(_,{key:0,class:"is-loading mr-2"},{default:c(()=>[o(y)]),_:1})):m("",!0),s("span",null,l(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),g?.audio_url?(n(),v(A,{key:0,onClick:U(V=>e.onDownload(V,g?.audio_url),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):m("",!0),o(A,{disabled:e.isFetchingWav,onClick:V=>e.handleWavDownload(g)},{default:c(()=>[s("div",$o,[e.isFetchingWav?(n(),v(_,{key:0,class:"is-loading mr-2"},{default:c(()=>[o(y)]),_:1})):m("",!0),s("span",null,l(e.$t("suno.button.download_wav")),1)])]),_:2},1032,["disabled","onClick"]),o(A,{disabled:e.isFetchingMidi,onClick:V=>e.handleMidiDownload(g)},{default:c(()=>[s("div",go,[e.isFetchingMidi?(n(),v(_,{key:0,class:"is-loading mr-2"},{default:c(()=>[o(y)]),_:1})):m("",!0),s("span",null,l(e.$t("suno.button.download_midi")),1)])]),_:2},1032,["disabled","onClick"])]),_:2},1024)]),default:c(()=>[s("span",ho,[o(P,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:c(()=>[g?.audio_url||g?.video_url?(n(),v(b,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):m("",!0)]),_:2},1032,["content"])])]),_:2},1024),o(B,null,{dropdown:c(()=>[o(O,null,{default:c(()=>[g?.audio_url?(n(),v(A,{key:0,onClick:U(V=>e.onExtend(V,g),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):m("",!0),g.id?(n(),v(A,{key:1,onClick:U(V=>e.onGetStems(g.id),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):m("",!0),g.id?(n(),v(A,{key:2,onClick:U(V=>e.onGetAllStems(g.id),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.all_stems")),1)]),_:2},1032,["onClick"])):m("",!0),o(A,{onClick:U(V=>e.onCover(g),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id?(n(),v(A,{key:3,onClick:U(V=>e.onRemaster(g.id),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.remaster")),1)]),_:2},1032,["onClick"])):m("",!0),g?.id?(n(),v(A,{key:4,onClick:U(V=>e.onReplaceSection(g),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.replace_section")),1)]),_:2},1032,["onClick"])):m("",!0),g?.id?(n(),v(A,{key:5,onClick:U(V=>e.onMashup(g),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.mashup")),1)]),_:2},1032,["onClick"])):m("",!0),g?.id&&g?.action==="extend"?(n(),v(A,{key:6,onClick:U(V=>e.onConcatMusic(g?.id),["stop"])},{default:c(()=>[C(l(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):m("",!0)]),_:2},1024)]),default:c(()=>[s("span",vo,[o(P,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:c(()=>[g?.audio_url||g?.video_url?(n(),v(b,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):m("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,io))),128))])}const ko=S(oo,[["render",yo]]),bo={class:"player-slider"},wo=w({__name:"PlayerSlider",setup(e){const t=D(),r=I({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),i=I({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),f=()=>{},p=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,h)=>(n(),u("div",bo,[o(T(J),{modelValue:r.value,"onUpdate:modelValue":h[0]||(h[0]=_=>r.value=_),"show-tooltip":!1,min:0,max:i.value,onChange:p,onInput:f},null,8,["modelValue","max"])]))}}),Co="/assets/disk-XFRmVAfp.png",Vo={class:"flex player-song"},So=["src"],Ao={class:"ml-2 text-xs flex flex-col justify-between"},Po={class:"w-52 2xl:w-96 cursor-pointer truncate"},Uo={class:"flex"},To={class:"ml-2 text-dc"},Eo=w({__name:"PlayerSong",setup(e){const t=D(),r=I({get:()=>t.state.suno.audio,set:i=>t.commit("suno/setAudio",i)});return Ve(r,(i,f)=>{if(i?.audio_url!==f?.audio_url){console.log("audio changed",i),i.object&&(console.log("111",i.object),i.object.pause(),delete i.object);const p=new Audio(i.audio_url);i.state==="playing"?p.play():p.pause(),p.addEventListener("loadedmetadata",()=>{p.currentTime=0,p.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:p.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:p})}else if(i?.progress!==f?.progress&&Math.abs(i.progress-i.object.currentTime)>2){console.log("progress changed",i.progress);const p=t.state.suno.audio;p.object&&(p.object.currentTime=p.progress)}else i?.state!==f?.state&&(console.log("state changed",i.state),i.object&&(i.state==="playing"?i.object.play():i.object.pause()));i?.volume!==f?.volume&&(console.log("volume changed",i.volume),i.object&&(i.object.volume=i.volume/100))}),(i,f)=>(n(),u("div",Vo,[s("img",{alt:"",class:"w-11 h-11 rounded",src:r.value?.image_url||T(Co)},null,8,So),s("div",Ao,[s("div",Po,[s("div",Uo,[s("span",null,l(r.value?.title||"Music"),1),s("span",To,"- "+l(r.value?.style||"SmallRuralDog"),1)])])])]))}}),Io={class:"flex justify-end items-center gap-x-2.5"},Lo={class:"text-xs"},zo=w({__name:"PlayerAction",setup(e){const t=D(),r=I({get:()=>t.state.suno?.audio?.progress,set:f=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:f})}),i=I({get:()=>t.state.suno?.audio?.duration,set:f=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:f})});return(f,p)=>(n(),u("div",Io,[s("span",Lo,l(T(j)(r.value))+" / "+l(T(j)(i.value)),1)]))}}),x=w({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,r)=>(n(),v(Se(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),Fo={class:"player-volume flex flex-col items-center pt-2"},Go={class:"text-sm mt-3"},jo=w({__name:"PlayerVolumeSlider",setup(e){const t=D(),r=I({get:()=>t.state.suno.audio?.volume,set:p=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:p})}),i=I({get:()=>t.state.suno.audio?.muted,set:p=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:p})}),f=p=>t.dispatch("suno/setVolume",p);return(p,d)=>(n(),u("div",Fo,[o(T(J),{modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=h=>r.value=h),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:i.value,onInput:f},null,8,["modelValue","disabled"]),s("div",Go,l(r.value),1)]))}}),Do={class:"flex items-center justify-center gap-x-3"},Ro=w({__name:"PlayerController",setup(e){const t=D(),r=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),i=I(()=>t.state.suno.audio);return(f,p)=>(n(),u("div",Do,[o(x,{icon:i.value?.state==="playing"?T(ae):T(le),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:r},null,8,["icon"]),o(T(ke),{placement:"top",width:"50px",trigger:"click"},{reference:c(()=>[o(x,{icon:T(re),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:c(()=>[o(jo)]),_:1})]))}}),Mo={class:"flex flex-col items-stretch h-20"},Wo={class:"flex grow px-5 items-center"},No={class:"flex-1"},Oo={class:"flex-1"},Bo={class:"flex-1"},qo=w({__name:"Player",setup(e){return(t,r)=>(n(),u("div",Mo,[o(wo),s("div",Wo,[s("div",No,[o(Eo)]),s("div",Oo,[o(Ro)]),s("div",Bo,[o(zo)])])]))}}),Ho=w({name:"RecentPanel",components:{ElSkeletonItem:we,ElSkeleton:be,TaskPreview:ko,Player:qo,NoTasks:ze,ScrollList:Ie},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Xo={key:0,class:"tasks"},Ko={class:"left w-[70px] p-[10px] flex items-center"},Yo={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},Zo={key:2,class:"w-full flex-1 flex items-center justify-center"},Qo={class:"h-20"};function Jo(e,t,r,i,f,p){const d=a("el-skeleton-item"),h=a("el-skeleton"),_=a("task-preview"),$=a("scroll-list"),b=a("no-tasks"),P=a("player");return n(),u(G,null,[e.tasks?.items===void 0?(n(),u("div",Xo,[(n(),u(G,null,H(3,y=>s("div",{key:y,class:"flex"},[s("div",Ko,[o(h,{animated:""},{template:c(()=>[o(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),s("div",Yo,[o(h,{animated:""},{template:c(()=>[o(d,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),o(d,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),v($,{key:1,ref:"scrollList",class:"flex-1 w-full overflow-y-auto tasks p-2",loading:e.loading,onReachTop:t[0]||(t[0]=y=>e.$emit("reach-top"))},{default:c(()=>[(n(!0),u(G,null,H(e.tasks?.items,(y,A)=>(n(),v(_,{key:A,"model-value":y,class:"preview"},null,8,["model-value"]))),128))]),_:1},8,["loading"])):m("",!0),e.tasks?.items?.length===0?(n(),u("div",Zo,[o(b)])):m("",!0),N(s("div",Qo,[o(P)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const xo=S(Ho,[["render",Jo]]),en=w({name:"TaskPreview",components:{IconPicture:ce,ElImage:W,ElAvatar:Ce,ElIcon:X},computed:{audio(){return this.$store.state.suno?.audio}}}),tn={key:0,class:"size-full overflow-hidden"},sn={class:"relative h-[300px]"},on={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},nn={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"},an={class:"p-4"},ln={class:"flex items-center font-bold mb-2"},rn={class:"text-[var(--el-text-color-regular)] mb-2"},cn={class:"text-xs text-[var(--el-text-color-regular)]"},un={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},dn={key:1,class:"w-full h-full"};function pn(e,t,r,i,f,p){const d=a("icon-picture"),h=a("el-icon"),_=a("el-image"),$=a("el-avatar");return e.audio?.object?(n(),u("div",tn,[s("div",sn,[o(_,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:c(()=>[s("div",on,[o(h,{class:"text-3xl"},{default:c(()=>[o(d)]),_:1})])]),_:1},8,["src"]),s("h2",nn,l(e.audio?.title),1)]),s("div",an,[s("div",ln,[o($,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),s("span",null,l(e.audio?.title),1)]),s("p",rn,l(e.audio?.style),1),s("p",cn,l(e.$dayjs.format(e.audio?.created_at)),1),s("div",un,[s("p",null,l(e.audio?.lyric),1)])])])):(n(),u("div",dn))}const mn=S(en,[["render",pn]]),fn="https://webhook.acedata.cloud/suno",hn=w({name:"SunoIndex",components:{Layout:Oe,ConfigPanel:to,RecentPanel:xo,PreviewPanel:mn},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===F.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===F.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===F.Request},needApply(){return this.$store.state.suno.status.getApplications===F.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 Ge({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(){Te.create({application:this.application}).then(({data:e})=>{this.application=e,k.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ee&&k.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const 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);const{limit:t=5,createdAtMin:r,createdAtMax:i}=e||{};console.debug("limit",t,"createdAtMin",r,"createdAtMax",i),this.fetchingTasks=!0;try{await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:r,createdAtMax:i})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){const e={...this.config,callback_url:fn},t=this.credential?.token;if(!t){console.error("no token specified");return}k.info(this.$t("suno.message.startingTask")),E.audio(e,{token:t}).then(()=>{k.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{k.error(r?.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?.()}}});function _n(e,t,r,i,f,p){const d=a("config-panel"),h=a("recent-panel"),_=a("preview-panel"),$=a("layout");return n(),v($,null,{config:c(()=>[o(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:c(()=>[o(h,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),preview:c(()=>[o(_)]),_:1})}const Un=S(hn,[["render",_n],["__scopeId","data-v-d1296b1a"]]);export{Un as default};
|