@acedatacloud/nexior 3.34.1 → 3.35.0
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-BR7AQdFb.js → Auth-BzXswjE4.js} +1 -1
- package/dist/assets/{BotPlaceholder-CcWrwFmL.js → BotPlaceholder-BV2w6Q4w.js} +1 -1
- package/dist/assets/Browse-BHDvC_mG.js +1 -0
- package/dist/assets/Browse-oFjzU0X9.css +1 -0
- package/dist/assets/{Callback-xXjmMOcU.js → Callback-CQ8ko7C9.js} +1 -1
- package/dist/assets/{Console-nj_hwu1u.js → Console-UbGToFD6.js} +1 -1
- package/dist/assets/{Consumption-DB4jsCIw.js → Consumption-DEB600BC.js} +1 -1
- package/dist/assets/Conversation-B30jTIbD.js +23 -0
- package/dist/assets/{Conversation-BhCBL3G3.css → Conversation-T2K_c37M.css} +1 -1
- package/dist/assets/{CopyToClipboard-DY-UF17o.js → CopyToClipboard-cTbsayFn.js} +1 -1
- package/dist/assets/{Detail-Ja14bXDU.js → Detail-BQ0XJdOr.js} +2 -2
- package/dist/assets/{EditArray-BFLjz-wW.js → EditArray-DzSfUZdI.js} +1 -1
- package/dist/assets/{Extra-Clq8boad.js → Extra-BGXzckZL.js} +1 -1
- package/dist/assets/{FilePreview-xVo0BsJp.js → FilePreview-B3Gtn-Tg.js} +1 -1
- package/dist/assets/{History-Do3SJVGQ.js → History-BeUw1IaF.js} +1 -1
- package/dist/assets/{ImagePreview-eVaabJZn.js → ImagePreview-B5F24-Vs.js} +1 -1
- package/dist/assets/{ImageWrapper-BPES620_.js → ImageWrapper-hN1Hdu08.js} +1 -1
- package/dist/assets/Index-1KNMLovE.js +1 -0
- package/dist/assets/{Index-Bv3aPtGw.js → Index-3ZiNs4kq.js} +1 -1
- package/dist/assets/{Index-DPCPO7cj.js → Index-BAn75ep1.js} +1 -1
- package/dist/assets/{Index-DyFEHsky.js → Index-BJdy1_Z6.js} +1 -1
- package/dist/assets/{Index-D27OMdID.js → Index-BRov3UHm.js} +1 -1
- package/dist/assets/{Index-C7lBym9k.js → Index-BUjIH0UD.js} +1 -1
- package/dist/assets/{Index-Dq4ojYPG.js → Index-BacfL0a5.js} +1 -1
- package/dist/assets/{Index-mq2BOvvk.js → Index-Bc2v2omV.js} +1 -1
- package/dist/assets/{Index-B_SMVoYZ.js → Index-BfnWocKp.js} +1 -1
- package/dist/assets/{Index-Be0Zf-VK.js → Index-BjX115MB.js} +1 -1
- package/dist/assets/{Index-BGwx8RuY.js → Index-Bnh_m2KM.js} +1 -1
- package/dist/assets/{Index-CwPif7U2.js → Index-C6QkxZY6.js} +1 -1
- package/dist/assets/{Index-BU9oZ6JY.js → Index-CBMnYQ1o.js} +1 -1
- package/dist/assets/Index-CBgAolPo.css +1 -0
- package/dist/assets/{Index-JUELlnZe.css → Index-CGa5D6En.css} +1 -1
- package/dist/assets/{Index-DqZLjJG6.js → Index-CLPm-Y4w.js} +1 -1
- package/dist/assets/{Index-DWgoBNcF.js → Index-CqyShhjI.js} +1 -1
- package/dist/assets/{Index-BipMjUVy.js → Index-CylCKIXE.js} +1 -1
- package/dist/assets/{Index-edVjS9Fq.js → Index-D7ez9jbr.js} +1 -1
- package/dist/assets/Index-DgEoij9q.js +1 -0
- package/dist/assets/{Index-DT-Iu1eV.js → Index-DlN6WUHV.js} +1 -1
- package/dist/assets/{Index-DpR3wEnE.js → Index-N-iGX0tk.js} +1 -1
- package/dist/assets/{Index-DS9xL4zc.js → Index-UoZMsXXk.js} +1 -1
- package/dist/assets/{Index-B6QAUsOF.js → Index-W2feDC-T.js} +1 -1
- package/dist/assets/Index-fbC-lfAY.js +1 -0
- package/dist/assets/{Index-BoI2jXTx.js → Index-j-TXpN-y.js} +1 -1
- package/dist/assets/{Index-BtuiXvN8.js → Index-q9gZ0XTy.js} +1 -1
- package/dist/assets/{Invitees-BFkwxUqa.js → Invitees-D4zwToOW.js} +1 -1
- package/dist/assets/{List-C-kCE03H.js → List-8Caks5m2.js} +1 -1
- package/dist/assets/{List-Br3Pd6pi.js → List-CnZ4wBge.js} +1 -1
- package/dist/assets/{List-BGUJQ1_j.js → List-Cogewp0B.js} +1 -1
- package/dist/assets/{Main-BYUMd6qO.js → Main-COqAQDqW.js} +1 -1
- package/dist/assets/McpManager-B62KLQ2Z.js +1 -0
- package/dist/assets/McpManager-Be2fvTdO.css +1 -0
- package/dist/assets/Navigator-semGmQ89.js +1 -0
- package/dist/assets/{NoTasks-Dk7Wt2AG.js → NoTasks-ZsLHgPuo.js} +1 -1
- package/dist/assets/{OAuthCallback-8_rUp3M5.js → OAuthCallback-CGTHAbtF.js} +1 -1
- package/dist/assets/OAuthCallback-CbG9_OQj.js +1 -0
- package/dist/assets/OAuthCallback-CeJPNVj3.css +1 -0
- package/dist/assets/{Pagination-CfUAmnFo.js → Pagination-BihGJLjm.js} +1 -1
- package/dist/assets/{ScrollList-ZiMJkMBw.js → ScrollList-OteSDitY.js} +1 -1
- package/dist/assets/Status-De0L9Wnu.js +1 -0
- package/dist/assets/Subscribe-DoFhvrGJ.js +1 -0
- package/dist/assets/{TransportWebHID-CdbyD8Nb.js → TransportWebHID-D9wUjmBD.js} +1 -1
- package/dist/assets/{VideoPlayer-DCxEj90A.js → VideoPlayer-DcumvLkR.js} +1 -1
- package/dist/assets/{avatar-DhwSCd0o.js → avatar-B2oLnm2w.js} +1 -1
- package/dist/assets/{bignumber-qGuqSDbJ.js → bignumber-geB-LwaY.js} +1 -1
- package/dist/assets/connector-DYad3Crz.js +1 -0
- package/dist/assets/connector-P8ccoph7.js +1 -0
- package/dist/assets/{distribution-ClKMo0TJ.js → distribution-Dmd3XvVp.js} +1 -1
- package/dist/assets/{index-BK4USX41.js → index-BKVUDuw-.js} +1 -1
- package/dist/assets/{index-0JZkSLcy.js → index-BmwlFP6v.js} +1 -1
- package/dist/assets/{index-DzuxpefT.js → index-CLJileDK.js} +1 -1
- package/dist/assets/{index-MSQW00oH.js → index-CXXU863B.js} +1 -1
- package/dist/assets/{index-ssOK1z8u.js → index-CZR89jLL.js} +1 -1
- package/dist/assets/{index-Bw6POElb.js → index-CbXbnDya.js} +1 -1
- package/dist/assets/{index-muIEJvsu.js → index-CtkD2JaX.js} +14 -14
- package/dist/assets/{index-D3HoJv4E.js → index-DrABKNoZ.js} +1 -1
- package/dist/assets/{index.es-Bqj83sQx.js → index.es-DMehEjXB.js} +1 -1
- package/dist/assets/{order-D4zdmHv8.js → order-Bw8DFW1R.js} +1 -1
- package/dist/assets/{price-Bva0CFLK.js → price-lQeFOa8Q.js} +1 -1
- package/dist/assets/{solana-wallets-nnfzRTGt.js → solana-wallets-CKHfeojs.js} +2 -2
- package/dist/assets/{solanaEmbed.esm-MqSs0vxC.js → solanaEmbed.esm-CbqLlFds.js} +1 -1
- package/dist/assets/{string_decoder-BUnST7cI.js → string_decoder-CEgnOzHn.js} +1 -1
- package/dist/assets/types-BnylCDhI.js +1 -0
- package/dist/assets/{vendor-element-plus-DN048TGi.js → vendor-element-plus-CmP9-3lX.js} +1 -1
- package/dist/assets/{vendor-web3-CIJ0oOq5.js → vendor-web3-C5RrfhAy.js} +4 -4
- package/dist/assets/{web-wXYMF4s3.js → web-Bokrd0eW.js} +1 -1
- package/dist/assets/{web-COanpFvz.js → web-CV8nB6ef.js} +1 -1
- package/dist/index.html +3 -3
- package/package.json +12 -1
- package/dist/assets/Conversation-CiAYoNDT.js +0 -23
- package/dist/assets/Index-BA5k_6bJ.js +0 -1
- package/dist/assets/Index-Bnsr9aoW.js +0 -1
- package/dist/assets/Navigator-qudQv6Ew.js +0 -1
- package/dist/assets/Status-KsOIucfx.js +0 -1
- package/dist/assets/Subscribe-De8de3Zo.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as $,_ as v,R as x,
|
|
1
|
+
import{r as $,_ as v,R as x,bm as S,a as T,b as N,c as L,d5 as R,av as D}from"./index-CtkD2JaX.js";import{F as k}from"./index.es-DMehEjXB.js";import{n as U,o as P,r as B,E as A,j as b}from"./vendor-element-plus-CmP9-3lX.js";import{d as E,J as f,K as n,T as o,O as h,ai as t,Q as g,R as m,G as s,D as l,C as _,Y as M,S as V,ag as F,M as H}from"./vendor-vue-BhXato7y.js";import"./vendor-web3-C5RrfhAy.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-8bYQCSwj.js";const J=E({name:"HelpEntry",components:{ElImage:b,ElDialog:A,ElPopover:B,ElMenu:P,ElMenuItem:U,FontAwesomeIcon:k},props:{visible:{type:Boolean,default:!0}},emits:["close"],computed:{site(){return this.$store.state.site}},methods:{onJoin(){window.open(this.$store.state.site?.features?.support?.discord?.url,"_blank")},onProfit(){this.$router.push({name:$})}}}),X={class:"flex"},j={class:"flex-1 text-center"};function q(e,i,w,I,y,C){const c=t("font-awesome-icon"),r=t("el-menu-item"),d=t("el-image"),u=t("el-popover"),a=t("el-menu"),p=t("el-dialog");return l(),f(p,{"model-value":e.visible,width:200,class:"text-center",onClose:i[0]||(i[0]=O=>e.$emit("close"))},{default:n(()=>[o(a,{collapse:!1,class:"menu"},{default:n(()=>[e.site?.features?.support?.discord?.enabled?(l(),f(r,{key:0,index:"1",onClick:e.onJoin},{title:n(()=>[g(m(e.$t("common.message.joinDiscord")),1)]),default:n(()=>[o(c,{icon:"fa-brands fa-discord",class:"mr-2"})]),_:1},8,["onClick"])):h("",!0),o(u,{width:350,trigger:"hover"},{reference:n(()=>[e.site?.features?.support?.wechat?.enabled?(l(),f(r,{key:0,index:"2"},{title:n(()=>[g(m(e.$t("common.message.addWeChat")),1)]),default:n(()=>[o(c,{icon:"fa-brands fa-weixin",class:"mr-2"})]),_:1})):h("",!0)]),default:n(()=>[s("div",X,[s("div",j,[o(d,{src:e.site?.features?.support?.wechat?.qr},null,8,["src"])])])]),_:1})]),_:1})]),_:1},8,["model-value"])}const z=v(J,[["render",q],["__scopeId","data-v-0fce633f"]]),G=E({name:"ProfileIndex",components:{ElImage:b,HelpDialog:z,FontAwesomeIcon:k},data(){return{operating:{locale:!1,dark:!1,help:!1}}},computed:{user(){return this.$store.getters.user},showSupport(){return this.$store?.state?.site?.features?.support?.enabled&&(this.$store?.state?.site?.features?.support?.discord?.enabled||this.$store?.state?.site?.features?.support?.wechat?.enabled)},showSite(){return this.$store?.state?.site?.admins?.includes(this.$store.getters.user?.id)},links(){return[{key:"profile",text:this.$t("console.menu.userProfile"),href:`${S()}/user/profile`,icon:"fa-regular fa-user"},{key:"application-list",text:this.$t("console.menu.applicationList"),name:T,icon:"fa-solid fa-cube"},{key:"order-list",text:this.$t("console.menu.orderList"),name:N,icon:"fa-solid fa-store"},{key:"usage-list",text:this.$t("console.menu.usageList"),name:L,icon:"fa-solid fa-rotate-left"},{key:"distribution-index",text:this.$t("console.menu.distributionIndex"),name:$,icon:"fa-solid fa-coins"},...this.showSite?[{key:"site-index",text:this.$t("common.nav.site"),name:R,icon:"fa-solid fa-gear"}]:[],{key:"dark-setting",text:this.$t("common.nav.darkMode"),icon:"fa-solid fa-moon",callback:()=>{this.operating.dark=!0}},{key:"locale-setting",text:this.$t("common.nav.locale"),icon:"fa-solid fa-language",callback:()=>{this.operating.locale=!0}},{key:"developerPlatform",text:this.$t("console.menu.developerPlatform"),href:D(),icon:"fa-solid fa-laptop-code"},...this.showSupport?[{key:"support",text:this.$t("common.nav.support"),callback:()=>{this.operating.help=!0},icon:"fa-solid fa-question"}]:[],{key:"logout",text:this.$t("common.nav.logOut"),icon:"fa-solid fa-arrow-right-from-bracket",callback:async()=>{await this.$store.dispatch("logout")}}]}},methods:{onHome(){this.$router.push({name:x})},onNavigate(e){e.name?this.$router.push({name:e.name}):e.href?window.open(e.href,"_blank"):e.callback&&e.callback()}}}),K={class:"profile"},Q={class:"info"},W={class:"links"},Y=["onClick"],Z={class:"icon"},ee={class:"text"},te={class:"suffix"};function oe(e,i,w,I,y,C){const c=t("el-image"),r=t("font-awesome-icon"),d=t("locale-selector"),u=t("help-dialog");return l(),_("div",K,[s("div",Q,[o(c,{src:e.user.avatar,fit:"cover",class:"avatar"},null,8,["src"]),s("h2",null,m(e.user.username),1),s("div",{style:M({backgroundImage:"url("+e.user.avatar+")"}),class:"background"},null,4)]),s("div",W,[(l(!0),_(V,null,F(e.links,(a,p)=>(l(),_("a",{key:p,class:H({link:!0,active:e.$route.name===a.name}),onClick:O=>e.onNavigate(a)},[s("span",Z,[o(r,{icon:a.icon,class:"text-sm"},null,8,["icon"])]),s("span",ee,m(a.text),1),s("span",te,[o(r,{icon:"fa-solid fa-chevron-right",class:"text-sm"})])],10,Y))),128))]),o(d,{visible:e.operating.locale==!0,onClose:i[0]||(i[0]=a=>e.operating.locale=!1)},null,8,["visible"]),o(u,{visible:e.operating.help==!0,onClose:i[1]||(i[1]=a=>e.operating.help=!1)},null,8,["visible"])])}const de=v(G,[["render",oe],["__scopeId","data-v-eeab02e4"]]);export{de as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as D}from"./index.es-Bqj83sQx.js";import{m as W,Y as oe,k as se,O as ne,P as re,u as ie,w,t as R,a6 as Y,a7 as Q,_ as X,e as K,j as Z,F as ae,G as le,$ as x,a8 as ce,a9 as de,l as ue,f as pe,g as me,h as fe,q as he,r as _e,L as $e,a2 as ge,aa as ve,ab as ye}from"./vendor-element-plus-DN048TGi.js";import{d as b,C as c,G as o,T as s,E as B,K as d,ai as r,D as n,O as f,R as a,S as G,ag as q,J as v,Q as U,L as z,aq as H,X as A,c as T,u as E,w as ke,U as be}from"./vendor-vue-BhXato7y.js";import{_ as V,cm as we,cn as I,au as Ce,aJ as L,cl as N,aC as Ve,aI as Se}from"./index-muIEJvsu.js";import{I as F,S as Ue}from"./ScrollList-ZiMJkMBw.js";import{u as j,F as Pe,O as Ae,_ as ee,P as Ee,a as Te,V as Fe}from"./IconPark.vue_vue_type_script_setup_true_lang-C7eA9UI3.js";import{C as Ie}from"./Consumption-DB4jsCIw.js";import{a as Le}from"./price-Bva0CFLK.js";import{N as Ge}from"./NoTasks-Dk7Wt2AG.js";import{l as je}from"./pagination-DLJ2pbsx.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-CIJ0oOq5.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-8bYQCSwj.js";const De=b({name:"LayoutProducer",components:{ElDrawer:oe,ElButton:W,FontAwesomeIcon:D},data(){return{drawer:!1,preview:!1}},computed:{}}),Re={class:"main flex flex-row flex-1"},Ze={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},ze={class:"result h-full flex flex-col flex-1 min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"},Ne={class:"preview h-full w-[300px] flex flex-col"};function Me(e,t,l,i,h,p){const u=r("font-awesome-icon"),m=r("el-button"),_=r("el-drawer");return n(),c("div",Re,[o("div",Ze,[B(e.$slots,"config",{},void 0,!0)]),o("div",ze,[B(e.$slots,"result",{},void 0,!0)]),o("div",Ne,[B(e.$slots,"preview",{},void 0,!0)]),s(m,{circle:"",class:"menu",onClick:t[0]||(t[0]=$=>e.drawer=!0)},{default:d(()=>[s(u,{icon:"fa-solid fa-magic"})]),_:1}),s(_,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=$=>e.drawer=$),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:d(()=>[B(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const Oe=V(De,[["render",Me],["__scopeId","data-v-7453886f"]]),Be=b({name:"TypeSelector",components:{ElSelect:re,ElOption:ne,ElSwitch:se},data(){return{options:[{label:"FUZZ-2.0 Pro",value:"FUZZ-2.0 Pro",info:"8 min"},{label:"FUZZ-2.0",value:"FUZZ-2.0",info:"8 min"},{label:"FUZZ-2.0 Raw",value:"FUZZ-2.0 Raw",info:"8 min"},{label:"FUZZ-1.1 Pro",value:"FUZZ-1.1 Pro",info:"4 min"},{label:"FUZZ-1.0 Pro",value:"FUZZ-1.0 Pro",info:"4 min"},{label:"FUZZ-1.1",value:"FUZZ-1.1",info:"4 min"},{label:"FUZZ-1.0",value:"FUZZ-1.0",info:"2 min"},{label:"FUZZ-0.8",value:"FUZZ-0.8",info:"2 min"}]}},computed:{custom:{get(){return this.$store.state.producer?.config?.custom||!1},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,custom:e})}},instrumental:{get(){return this.$store.state.producer?.config?.instrumental||!1},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,instrumental:e})}},model:{get(){return this.$store.state.producer?.config?.model},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,model:e})}}},mounted(){this.model||(this.model=we)}}),qe={class:"flex items-center justify-between mb-3"},We={class:"text-sm font-bold"},Ke={class:"mb-3"},He={class:"flex items-center mb-1"},Je={class:"text-sm font-bold"},Ye={class:"flex items-center justify-between w-full"},Qe={class:"text-xs text-[var(--el-text-color-placeholder)]"},Xe={key:0,class:"flex items-center justify-between mb-3"},xe={class:"text-sm font-bold"};function et(e,t,l,i,h,p){const u=r("el-switch"),m=r("el-option"),_=r("el-select");return n(),c("div",null,[o("div",qe,[o("span",We,a(e.$t("producer.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=$=>e.custom=$)},null,8,["modelValue"])]),o("div",Ke,[o("div",He,[o("span",Je,a(e.$t("producer.name.model")),1)]),s(_,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=$=>e.model=$),class:"w-full",size:"default",placeholder:e.$t("producer.placeholder.select")},{default:d(()=>[(n(!0),c(G,null,q(e.options,$=>(n(),v(m,{key:$.value,label:$.label,value:$.value},{default:d(()=>[o("div",Ye,[o("span",null,a($.label),1),o("span",Qe,a($.info),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),e.custom?(n(),c("div",Xe,[o("span",xe,a(e.$t("producer.name.instrumental")),1),s(u,{modelValue:e.instrumental,"onUpdate:modelValue":t[2]||(t[2]=$=>e.instrumental=$)},null,8,["modelValue"])])):f("",!0)])}const tt=V(Be,[["render",et]]),ot=b({name:"UploadAudio",components:{ElUpload:ie,ElButton:W,InfoIcon:F,FontAwesomeIcon:D},emits:["change"],data(){return{fileList:[],uploadUrl:Ce()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.producer?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){w.warning(this.$t("producer.message.uploadReferencesExceed"))},onError(){w.error(this.$t("producer.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},l=this.credential?.token;if(!l){console.error("no token specified");return}w.info(this.$t("producer.message.startingUploadAudio")),I.upload(t,{token:l}).then(i=>{console.debug("get upload music success",i.data);const h=i.data?.data.audio_id;this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,audio_id:h,action:"upload_extend"}),w.success(this.$t("producer.message.startUploadAudioSuccess"))}).catch(i=>{w.error(i?.response?.data?.error?.message||this.$t("producer.message.startUploadAudioFailed"))})},onSetAudio(){}}}),st={class:"relative"},nt={class:"flex justify-between"},rt={class:"flex justify-start items-center"},it={class:"text-sm font-bold"};function at(e,t,l,i,h,p){const u=r("info-icon"),m=r("font-awesome-icon"),_=r("el-button"),$=r("el-upload");return n(),c("div",st,[o("div",nt,[o("div",rt,[o("span",it,a(e.$t("producer.name.referenceAudios")),1),s(u,{content:e.$t("producer.description.uploadAudios")},null,8,["content"])])]),s($,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=k=>e.fileList=k),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:d(()=>[s(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:d(()=>[s(m,{icon:"fa-solid fa-upload",class:"icon mr-1"}),U(" "+a(e.$t("producer.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const lt=V(ot,[["render",at],["__scopeId","data-v-e4cd0467"]]),ct="",dt=b({name:"PromptInput",components:{ElInput:R,InfoIcon:F},computed:{prompt:{get(){return this.$store.state.producer?.config?.prompt},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=ct)}}),ut={class:"field"},pt={class:"flex items-center mb-1"},mt={class:"text-sm font-bold"};function ft(e,t,l,i,h,p){const u=r("info-icon"),m=r("el-input");return n(),c("div",ut,[o("div",pt,[o("span",mt,a(e.$t("producer.name.songDescription")),1),s(u,{content:e.$t("producer.description.prompt")},null,8,["content"])]),s(m,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=_=>e.prompt=_),rows:4,type:"textarea",placeholder:e.$t("producer.placeholder.prompt")},null,8,["modelValue","placeholder"])])}const ht=V(dt,[["render",ft]]),_t="",$t=b({name:"LyricInput",components:{ElInput:R,ElButton:W,FontAwesomeIcon:D,InfoIcon:F},data(){return{generatingLyrics:!1}},computed:{lyric:{get(){return this.$store.state.producer?.config?.lyric},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,lyric:e})}},config(){return this.$store.state.producer?.config},credential(){return this.$store.state.producer?.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,w.info(this.$t("producer.message.generatingLyrics"));try{const i=(await I.lyric({prompt:t},{token:e})).data?.data;i?.text&&(this.lyric=i.text,i?.title&&!this.config?.title&&this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,lyric:i.text,title:i.title}),w.success(this.$t("producer.message.generateLyricsSuccess")))}catch{w.error(this.$t("producer.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,l,i,h,p){const u=r("info-icon"),m=r("font-awesome-icon"),_=r("el-button"),$=r("el-input");return n(),c("div",gt,[o("div",vt,[o("div",yt,[o("span",kt,a(e.$t("producer.name.lyrics")),1),s(u,{content:e.$t("producer.description.lyrics")},null,8,["content"])]),e.config?.action!=="extend"?(n(),v(_,{key:0,size:"small",loading:e.generatingLyrics,round:"",onClick:e.onGenerateLyrics},{default:d(()=>[e.generatingLyrics?f("",!0):(n(),v(m,{key:0,icon:"fa-solid fa-wand-magic-sparkles",class:"mr-1"})),U(" "+a(e.$t("producer.button.generate_lyrics")),1)]),_:1},8,["loading","onClick"])):f("",!0)]),e.config?.action!=="extend"?(n(),v($,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=k=>e.lyric=k),rows:5,type:"textarea",class:"lyrics",placeholder:e.$t("producer.placeholder.lyrics")},null,8,["modelValue","placeholder"])):(n(),v($,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=k=>e.lyric=k),rows:5,type:"textarea",class:"lyrics",placeholder:e.$t("producer.placeholder.extend.lyrics")},null,8,["modelValue","placeholder"]))])}const wt=V($t,[["render",bt],["__scopeId","data-v-88c6da2b"]]),Ct=b({name:"StyleInput",components:{ElInput:R,InfoIcon:F},computed:{style:{get(){return this.$store.state.producer?.config?.style},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,style:e})}}}}),Vt={class:"field"},St={class:"flex items-center justify-between mb-1"},Ut={class:"flex items-center"},Pt={class:"text-sm font-bold"};function At(e,t,l,i,h,p){const u=r("info-icon"),m=r("el-input");return n(),c("div",Vt,[o("div",St,[o("div",Ut,[o("span",Pt,a(e.$t("producer.name.style")),1),s(u,{content:e.$t("producer.description.style")},null,8,["content"])])]),s(m,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=_=>e.style=_),rows:2,type:"textarea",placeholder:e.$t("producer.placeholder.style")},null,8,["modelValue","placeholder"])])}const Et=V(Ct,[["render",At]]),Tt=b({name:"TitleInput",components:{ElInput:R,InfoIcon:F},computed:{title:{get(){return this.$store.state.producer?.config?.title},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,title:e})}}}}),Ft={class:"field"},It={class:"flex items-center mb-1"},Lt={class:"text-sm font-bold"};function Gt(e,t,l,i,h,p){const u=r("info-icon"),m=r("el-input");return n(),c("div",Ft,[o("div",It,[o("span",Lt,a(e.$t("producer.name.title")),1),s(u,{content:e.$t("producer.description.title")},null,8,["content"])]),s(m,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=_=>e.title=_),placeholder:e.$t("producer.placeholder.title")},null,8,["modelValue","placeholder"])])}const jt=V(Tt,[["render",Gt]]),Dt=b({name:"ExtendFromInput",components:{ElImage:Z,ElIcon:K,ElInputNumber:X,VideoPlay:Q,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.producer?.config?.audio},value:{get(){return this.$store.state.producer?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("producer/setConfig",{...this.$store.state.producer?.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("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Rt={class:"field"},Zt={class:"box"},zt={class:"title font-bold"},Nt={class:"input-wrapper"},Mt={class:"task"},Ot={class:"left"},Bt={key:2,class:"duration"},qt={class:"info"},Wt={class:"title"},Kt={class:"style"};function Ht(e,t,l,i,h,p){const u=r("el-input-number"),m=r("el-image"),_=r("video-pause"),$=r("el-icon"),k=r("video-play"),y=H("loading");return n(),c("div",Rt,[o("div",Zt,[o("h2",zt,a(e.$t("producer.name.extend")),1),o("div",Nt,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=P=>e.value=P),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("producer.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),o("div",Mt,[e.audio?(n(),c("div",{key:0,class:"audio",onClick:t[3]||(t[3]=P=>e.onClick(e.audio))},[z((n(),c("div",Ot,[s(m,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.producer?.audio?.id===e.audio.id&&e.$store.state?.producer?.audio?.state==="playing"?(n(),c("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=P=>e.onPause(e.audio))},[s($,null,{default:d(()=>[s(_)]),_:1})])):f("",!0),e.audio?.audio_url&&(e.$store.state?.producer?.audio?.id!==e.audio.id||e.$store.state?.producer?.audio?.id===e.audio.id&&e.$store.state?.producer?.audio?.state==="paused")?(n(),c("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=P=>e.onPlay(e.audio))},[s($,null,{default:d(()=>[s(k)]),_:1})])):f("",!0),e.audio?.duration?(n(),c("div",Bt,a(e.useFormatDuring(e.audio?.duration)),1)):f("",!0)])),[[y,!e.audio?.audio_url]]),o("div",qt,[o("h2",Wt,a(e.audio?.title),1),o("p",Kt,a(e.audio?.style),1)])])):f("",!0)])])}const Jt=V(Dt,[["render",Ht],["__scopeId","data-v-26d43480"]]),Yt=b({name:"CoverFromInput",components:{ElImage:Z,ElIcon:K,VideoPlay:Q,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.producer?.config?.audio},value:{get(){return this.$store.state.producer?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("producer/setConfig",{...this.$store.state.producer?.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("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Qt={class:"field"},Xt={class:"box"},xt={class:"title font-bold"},eo={class:"task"},to={class:"left"},oo={key:2,class:"duration"},so={class:"info"},no={class:"title"},ro={class:"style"};function io(e,t,l,i,h,p){const u=r("el-image"),m=r("video-pause"),_=r("el-icon"),$=r("video-play"),k=H("loading");return n(),c("div",Qt,[o("div",Xt,[o("h2",xt,a(e.$t("producer.name.cover")),1)]),o("div",eo,[e.audio?(n(),c("div",{key:0,class:"audio",onClick:t[2]||(t[2]=y=>e.onClick(e.audio))},[z((n(),c("div",to,[s(u,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.producer?.audio?.id===e.audio.id&&e.$store.state?.producer?.audio?.state==="playing"?(n(),c("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=y=>e.onPause(e.audio))},[s(_,null,{default:d(()=>[s(m)]),_:1})])):f("",!0),e.audio?.audio_url&&(e.$store.state?.producer?.audio?.id!==e.audio.id||e.$store.state?.producer?.audio?.id===e.audio.id&&e.$store.state?.producer?.audio?.state==="paused")?(n(),c("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPlay(e.audio))},[s(_,null,{default:d(()=>[s($)]),_:1})])):f("",!0),e.audio?.duration?(n(),c("div",oo,a(e.useFormatDuring(e.audio?.duration)),1)):f("",!0)])),[[k,!e.audio?.audio_url]]),o("div",so,[o("h2",no,a(e.audio?.title),1),o("p",ro,a(e.audio?.style),1)])])):f("",!0)])])}const ao=V(Yt,[["render",io],["__scopeId","data-v-d8a8e583"]]),lo=b({name:"VocalGenderSelector",components:{ElRadioGroup:le,ElRadioButton:ae,InfoIcon:F},computed:{vocalGender:{get(){return this.$store.state.producer?.config?.vocal_gender||""},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,vocal_gender:e||void 0})}}}}),co={class:"mb-2"},uo={class:"flex items-center mb-1"},po={class:"text-sm font-bold"};function mo(e,t,l,i,h,p){const u=r("info-icon"),m=r("el-radio-button"),_=r("el-radio-group");return n(),c("div",co,[o("div",uo,[o("span",po,a(e.$t("producer.name.vocalGender")),1),s(u,{content:e.$t("producer.description.vocalGender")},null,8,["content"])]),s(_,{modelValue:e.vocalGender,"onUpdate:modelValue":t[0]||(t[0]=$=>e.vocalGender=$)},{default:d(()=>[s(m,{value:""},{default:d(()=>[U(a(e.$t("producer.gender.auto")),1)]),_:1}),s(m,{value:"f"},{default:d(()=>[U(a(e.$t("producer.gender.female")),1)]),_:1}),s(m,{value:"m"},{default:d(()=>[U(a(e.$t("producer.gender.male")),1)]),_:1})]),_:1},8,["modelValue"])])}const fo=V(lo,[["render",mo]]),ho=b({name:"AdvancedParams",components:{ElCollapse:de,ElCollapseItem:ce,ElInput:R,ElSlider:x,ElInputNumber:X},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.producer?.config},styleNegative:{get(){return this.$store.state.producer?.config?.style_negative||""},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,style_negative:e||void 0})}},lyricPrompt:{get(){return this.$store.state.producer?.config?.lyric_prompt||""},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,lyric_prompt:e||void 0})}},weirdness:{get(){return this.$store.state.producer?.config?.weirdness??0},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,weirdness:e||void 0})}},soundStrength:{get(){return this.$store.state.producer?.config?.sound_strength??50},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,sound_strength:e})}},lyricsStrength:{get(){return this.$store.state.producer?.config?.lyrics_strength??50},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,lyrics_strength:e})}},seed:{get(){return this.$store.state.producer?.config?.seed},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,seed:e})}}}}),_o={key:0,class:"mb-3"},$o={class:"flex items-center mb-1"},go={class:"text-xs font-bold"},vo={key:1,class:"mb-3"},yo={class:"flex items-center mb-1"},ko={class:"text-xs font-bold"},bo={key:2,class:"mb-3"},wo={class:"flex items-center justify-between mb-1"},Co={class:"text-xs font-bold"},Vo={class:"text-xs text-[var(--el-text-color-secondary)]"},So={key:3,class:"mb-3"},Uo={class:"flex items-center justify-between mb-1"},Po={class:"text-xs font-bold"},Ao={class:"text-xs text-[var(--el-text-color-secondary)]"},Eo={key:4,class:"mb-3"},To={class:"flex items-center justify-between mb-1"},Fo={class:"text-xs font-bold"},Io={class:"text-xs text-[var(--el-text-color-secondary)]"},Lo={key:5,class:"mb-3"},Go={class:"flex items-center mb-1"},jo={class:"text-xs font-bold"};function Do(e,t,l,i,h,p){const u=r("el-input"),m=r("el-slider"),_=r("el-input-number"),$=r("el-collapse-item"),k=r("el-collapse");return n(),v(k,{modelValue:e.activeNames,"onUpdate:modelValue":t[6]||(t[6]=y=>e.activeNames=y),class:"advanced-collapse"},{default:d(()=>[s($,{title:e.$t("producer.name.advancedParams"),name:"advanced"},{default:d(()=>[e.config?.custom?(n(),c("div",_o,[o("div",$o,[o("span",go,a(e.$t("producer.name.styleNegative")),1)]),s(u,{modelValue:e.styleNegative,"onUpdate:modelValue":t[0]||(t[0]=y=>e.styleNegative=y),placeholder:e.$t("producer.placeholder.styleNegative")},null,8,["modelValue","placeholder"])])):f("",!0),e.config?.custom&&!e.config?.instrumental?(n(),c("div",vo,[o("div",yo,[o("span",ko,a(e.$t("producer.name.lyricPrompt")),1)]),s(u,{modelValue:e.lyricPrompt,"onUpdate:modelValue":t[1]||(t[1]=y=>e.lyricPrompt=y),placeholder:e.$t("producer.placeholder.lyricPrompt")},null,8,["modelValue","placeholder"])])):f("",!0),e.config?.custom?(n(),c("div",bo,[o("div",wo,[o("span",Co,a(e.$t("producer.name.weirdness")),1),o("span",Vo,a(e.weirdness??0),1)]),s(m,{modelValue:e.weirdness,"onUpdate:modelValue":t[2]||(t[2]=y=>e.weirdness=y),min:0,max:100,step:1},null,8,["modelValue"])])):f("",!0),e.config?.custom?(n(),c("div",So,[o("div",Uo,[o("span",Po,a(e.$t("producer.name.soundStrength")),1),o("span",Ao,a(e.soundStrength??50),1)]),s(m,{modelValue:e.soundStrength,"onUpdate:modelValue":t[3]||(t[3]=y=>e.soundStrength=y),min:0,max:100,step:1},null,8,["modelValue"])])):f("",!0),e.config?.custom&&!e.config?.instrumental?(n(),c("div",Eo,[o("div",To,[o("span",Fo,a(e.$t("producer.name.lyricsStrength")),1),o("span",Io,a(e.lyricsStrength??50),1)]),s(m,{modelValue:e.lyricsStrength,"onUpdate:modelValue":t[4]||(t[4]=y=>e.lyricsStrength=y),min:0,max:100,step:1},null,8,["modelValue"])])):f("",!0),e.config?.custom?(n(),c("div",Lo,[o("div",Go,[o("span",jo,a(e.$t("producer.name.seed")),1)]),s(_,{modelValue:e.seed,"onUpdate:modelValue":t[5]||(t[5]=y=>e.seed=y),min:0,controls:!1,placeholder:e.$t("producer.placeholder.seed"),class:"w-full"},null,8,["modelValue","placeholder"])])):f("",!0)]),_:1},8,["title"])]),_:1},8,["modelValue"])}const Ro=V(ho,[["render",Do],["__scopeId","data-v-88e65aee"]]),Zo=b({name:"ReplaceSectionInput",components:{ElInputNumber:X,ElImage:Z,InfoIcon:F},computed:{audio(){return this.$store.state.producer?.config?.audio},replaceSectionStart:{get(){return this.$store.state.producer?.config?.replace_section_start},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,replace_section_start:e})}},replaceSectionEnd:{get(){return this.$store.state.producer?.config?.replace_section_end},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,replace_section_end:e})}}},methods:{onClick(e){this.$store.dispatch("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"playing"})}}}),zo={class:"field"},No={class:"flex items-center mb-2"},Mo={class:"text-sm font-bold m-0"},Oo={key:0,class:"task mb-2"},Bo={class:"left relative w-[50px] h-[50px] mr-3 flex-shrink-0"},qo={class:"info flex-1 min-w-0"},Wo={class:"text-sm font-bold m-0 truncate"},Ko={class:"text-xs text-[var(--el-text-color-secondary)] m-0 truncate"},Ho={class:"flex gap-2"};function Jo(e,t,l,i,h,p){const u=r("info-icon"),m=r("el-image"),_=r("el-input-number"),$=H("loading");return n(),c("div",zo,[o("div",No,[o("h2",Mo,a(e.$t("producer.name.replaceSection")),1),s(u,{content:e.$t("producer.description.replaceSection")},null,8,["content"])]),e.audio?(n(),c("div",Oo,[o("div",{class:"audio flex items-center",onClick:t[0]||(t[0]=k=>e.onClick(e.audio))},[z((n(),c("div",Bo,[s(m,{src:e.audio?.image_url,class:"w-full h-full rounded",fit:"cover"},null,8,["src"])])),[[$,!e.audio?.audio_url]]),o("div",qo,[o("h2",Wo,a(e.audio?.title),1),o("p",Ko,a(e.audio?.style),1)])])])):f("",!0),o("div",Ho,[s(_,{modelValue:e.replaceSectionStart,"onUpdate:modelValue":t[1]||(t[1]=k=>e.replaceSectionStart=k),class:"flex-1",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("producer.placeholder.replaceSectionStart")},null,8,["modelValue","max","placeholder"]),s(_,{modelValue:e.replaceSectionEnd,"onUpdate:modelValue":t[2]||(t[2]=k=>e.replaceSectionEnd=k),class:"flex-1",min:e.replaceSectionStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t("producer.placeholder.replaceSectionEnd")},null,8,["modelValue","min","max","placeholder"])])])}const Yo=V(Zo,[["render",Jo]]),Qo=b({name:"PresetPanel",components:{TypeSelector:tt,PromptInput:ht,LyricInput:wt,StyleInput:Et,TitleInput:jt,ExtendFromInput:Jt,CoverFromInput:ao,UploadAudio:lt,VocalGenderSelector:fo,AdvancedParams:Ro,ReplaceSectionInput:Yo,FontAwesomeIcon:D,ElButton:W,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.producer?.config},consumption(){return Le(this.config,this.service?.cost)},service(){return this.$store.state.producer?.service},generateButtonText(){const e=this.config?.action;return e==="extend"?this.$t("producer.button.extend"):e==="cover"?this.$t("producer.button.cover_music"):e==="variation"?this.$t("producer.button.variation"):e==="replace_section"?this.$t("producer.button.replace_section"):e==="stems"?this.$t("producer.button.get_stems"):e==="swap_vocals"?this.$t("producer.button.swap_vocals"):e==="swap_instrumentals"?this.$t("producer.button.swap_instrumentals"):this.$t("producer.button.generate")}},methods:{onGenerate(){this.$emit("generate")}}}),Xo={class:"flex flex-col h-full"},xo={class:"flex-1 overflow-y-auto p-5"},es={class:"flex flex-col items-center justify-center px-5 pb-5"};function ts(e,t,l,i,h,p){const u=r("type-selector"),m=r("upload-audio"),_=r("prompt-input"),$=r("lyric-input"),k=r("style-input"),y=r("title-input"),P=r("vocal-gender-selector"),S=r("extend-from-input"),M=r("cover-from-input"),O=r("replace-section-input"),J=r("advanced-params"),g=r("consumption"),C=r("font-awesome-icon"),te=r("el-button");return n(),c("div",Xo,[o("div",xo,[s(u,{class:"mb-4"}),s(m,{class:"mb-4"}),e.config?.custom?f("",!0):(n(),v(_,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(n(),v($,{key:1,class:"mb-4"})):f("",!0),e.config?.custom?(n(),v(k,{key:2,class:"mb-4"})):f("",!0),e.config?.custom?(n(),v(y,{key:3,class:"mb-4"})):f("",!0),e.config?.custom&&!e.config.instrumental?(n(),v(P,{key:4,class:"mb-4"})):f("",!0),e.config?.action==="extend"?(n(),v(S,{key:5,class:"mb-4"})):f("",!0),e.config?.action==="cover"?(n(),v(M,{key:6,class:"mb-4"})):f("",!0),e.config?.action==="replace_section"?(n(),v(O,{key:7,class:"mb-4"})):f("",!0),s(J,{class:"mb-4"})]),o("div",es,[s(g,{value:e.consumption,service:e.service},null,8,["value","service"]),s(te,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[s(C,{icon:"fa-solid fa-magic",class:"mr-2"}),U(" "+a(e.generateButtonText),1)]),_:1},8,["onClick"])])])}const os=V(Qo,[["render",ts],["__scopeId","data-v-6642bb3c"]]),ss="https://webhook.acedata.cloud/producer",ns=b({name:"TaskPreview",components:{ElImage:Z,ElIcon:K,ElTooltip:he,FontAwesomeIcon:D,VideoPlay:Q,VideoPause:Y,ElDropdown:fe,ElDropdownMenu:me,ElDropdownItem:pe,Loading:ue},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1}},computed:{loading(){return this.$store.state.producer?.status?.getApplications===L.Request},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},task(){return this.$store.state.producer?.tasks},audios(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(l=>({...l,action:t})):e},application(){return this.$store.state.producer?.application},active(){return this.$store.state.producer?.tasks?.active}},methods:{useFormatDuring:j,onPlay(e){this.$store.dispatch("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.debug("set config",t),this.$store.commit("producer/setConfig",{...this.$store.state.producer?.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();const i=new URL(t).pathname,h=i.substring(i.lastIndexOf("/")+1);fetch(t).then(p=>p.blob()).then(p=>{Pe.saveAs(p,h)})},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),w.error(this.$t("producer.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,l)=>{const i={audio_id:e},h=this.credential?.token;if(!h){console.error("no token specified"),l(new Error("No token specified"));return}I.video(i,{token:h}).then(p=>{const u=p.data?.data?.video_url;u?t(u):l(new Error("Video URL not found in response"))}).catch(p=>{l(p)})})},onPreview(e,t){e.stopPropagation(),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},onVariation(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,model:e.model,custom:!0,style:e.style,action:"variation",audio:e,audio_id:e.id})},async onSwapVocals(e){await this.onGenerateAudioUrl("swap_vocals",e)},async onSwapInstrumentals(e){await this.onGenerateAudioUrl("swap_instrumentals",e)},async onGetAllStems(e){await this.onGenerateAudioUrl("all_stems",e)},onReplaceSection(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.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)})},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;const t=this.credential?.token;if(t)try{this.isFetchingWav=!0,w.info(this.$t("producer.message.fetchingWav"));const i=(await I.wav({audio_id:e.id},{token:t})).data?.data?.audio_url;i?this.onDownload(null,i):w.error(this.$t("producer.message.fetchWavFailed"))}catch{w.error(this.$t("producer.message.fetchWavFailed"))}finally{this.isFetchingWav=!1}},async onGenerateAudioUrl(e,t){const l={action:e,audio_id:t,callback_url:ss},i=this.credential?.token;if(!i){console.error("no token specified");return}w.info(this.$t("producer.message.startingTask")),I.audio(l,{token:i}).then(()=>{w.success(this.$t("producer.message.startTaskSuccess"))}).catch(h=>{w.error(h?.response?.data?.error?.message||this.$t("producer.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("producer/getTasks",{limit:30,offset:0})}}}),rs={class:"task"},is=["onClick"],as={class:"left"},ls=["onClick"],cs=["onClick"],ds={key:2,class:"duration"},us={class:"info"},ps={class:"title"},ms={class:"style"},fs={class:"right"},hs={class:"el-dropdown-link"},_s={class:"flex items-center min-w-[120px]"},$s={class:"flex items-center min-w-[120px]"},gs={class:"el-dropdown-link"};function vs(e,t,l,i,h,p){const u=r("el-image"),m=r("video-pause"),_=r("el-icon"),$=r("video-play"),k=r("font-awesome-icon"),y=r("el-tooltip"),P=r("Loading"),S=r("el-dropdown-item"),M=r("el-dropdown-menu"),O=r("el-dropdown"),J=H("loading");return n(),c("div",rs,[(n(!0),c(G,null,q(e.audios,g=>(n(),c("div",{key:g.id,class:"audio",onClick:A(C=>e.onClick(g),["stop"])},[z((n(),c("div",as,[s(u,{src:g?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),g?.audio_url&&e.$store.state?.producer?.audio?.id===g.id&&e.$store.state?.producer?.audio?.state==="playing"?(n(),c("div",{key:0,class:"overlay",onClick:A(C=>e.onPause(g),["stop"])},[s(_,null,{default:d(()=>[s(m)]),_:1})],8,ls)):f("",!0),g?.audio_url&&(e.$store.state?.producer?.audio?.id!==g.id||e.$store.state?.producer?.audio?.id===g.id&&e.$store.state?.producer?.audio?.state==="paused")?(n(),c("div",{key:1,class:"overlay",onClick:A(C=>e.onPlay(g),["stop"])},[s(_,null,{default:d(()=>[s($)]),_:1})],8,cs)):f("",!0),g?.duration?(n(),c("div",ds,a(e.useFormatDuring(g?.duration)),1)):f("",!0)])),[[J,!g?.audio_url]]),o("div",us,[o("h2",ps,a(g?.title),1),o("p",ms,a(g?.style),1)]),o("div",fs,[s(O,null,{dropdown:d(()=>[s(M,null,{default:d(()=>[s(S,{disabled:e.isFetchingVideoUrl,onClick:C=>e.handleVideoDownload(g)},{default:d(()=>[o("div",_s,[e.isFetchingVideoUrl?(n(),v(_,{key:0,class:"is-loading mr-2"},{default:d(()=>[s(P)]),_:1})):f("",!0),o("span",null,a(e.$t("producer.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),g?.audio_url?(n(),v(S,{key:0,onClick:A(C=>e.onDownload(C,g?.audio_url),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.download_audio")),1)]),_:2},1032,["onClick"])):f("",!0),s(S,{disabled:e.isFetchingWav,onClick:C=>e.handleWavDownload(g)},{default:d(()=>[o("div",$s,[e.isFetchingWav?(n(),v(_,{key:0,class:"is-loading mr-2"},{default:d(()=>[s(P)]),_:1})):f("",!0),o("span",null,a(e.$t("producer.button.download_wav")),1)])]),_:2},1032,["disabled","onClick"])]),_:2},1024)]),default:d(()=>[o("span",hs,[s(y,{effect:"dark",content:e.$t("producer.button.download"),placement:"top"},{default:d(()=>[g?.audio_url||g?.video_url?(n(),v(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):f("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(O,null,{dropdown:d(()=>[s(M,null,{default:d(()=>[g?.audio_url?(n(),v(S,{key:0,onClick:A(C=>e.onExtend(C,g),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.extend")),1)]),_:2},1032,["onClick"])):f("",!0),g.id?(n(),v(S,{key:1,onClick:A(C=>e.onGetStems(g.id),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.get_stems")),1)]),_:2},1032,["onClick"])):f("",!0),g.id?(n(),v(S,{key:2,onClick:A(C=>e.onGetAllStems(g.id),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.all_stems")),1)]),_:2},1032,["onClick"])):f("",!0),s(S,{onClick:A(C=>e.onCover(g),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id?(n(),v(S,{key:3,onClick:A(C=>e.onVariation(g),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.variation")),1)]),_:2},1032,["onClick"])):f("",!0),g?.id?(n(),v(S,{key:4,onClick:A(C=>e.onSwapVocals(g.id),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.swap_vocals")),1)]),_:2},1032,["onClick"])):f("",!0),g?.id?(n(),v(S,{key:5,onClick:A(C=>e.onSwapInstrumentals(g.id),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.swap_instrumentals")),1)]),_:2},1032,["onClick"])):f("",!0),g?.id?(n(),v(S,{key:6,onClick:A(C=>e.onReplaceSection(g),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.replace_section")),1)]),_:2},1032,["onClick"])):f("",!0)]),_:2},1024)]),default:d(()=>[o("span",gs,[s(y,{effect:"dark",content:e.$t("producer.button.more"),placement:"top"},{default:d(()=>[g?.audio_url||g?.video_url?(n(),v(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):f("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,is))),128))])}const ys=V(ns,[["render",vs]]),ks={class:"player-slider"},bs=b({__name:"PlayerSlider",setup(e){const t=N(),l=T({get:()=>t.state.producer?.audio?.progress,set:u=>t.commit("producer/setAudio",{...t.state.producer.audio,progress:u})}),i=T({get:()=>t.state.producer?.audio?.duration,set:u=>t.commit("producer/setAudio",{...t.state.producer.audio,duration:u})}),h=()=>{},p=u=>t.dispatch("producer/setAudio",{...t.state.producer.audio,progress:u});return(u,m)=>(n(),c("div",ks,[s(E(x),{modelValue:l.value,"onUpdate:modelValue":m[0]||(m[0]=_=>l.value=_),"show-tooltip":!1,min:0,max:i.value,onChange:p,onInput:h},null,8,["modelValue","max"])]))}}),ws={class:"flex player-song"},Cs=["src"],Vs={class:"ml-2 text-xs flex flex-col justify-between"},Ss={class:"w-52 2xl:w-96 cursor-pointer truncate"},Us={class:"flex"},Ps={class:"ml-2 text-dc"},As=b({__name:"PlayerSong",setup(e){const t=N(),l=T({get:()=>t.state.producer.audio,set:i=>t.commit("producer/setAudio",i)});return ke(l,(i,h)=>{if(i?.audio_url!==h?.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("producer/setAudio",{...t.state.producer.audio,progress:p.currentTime})})}),t.commit("producer/setAudio",{...t.state.producer.audio,object:p})}else if(i?.progress!==h?.progress&&Math.abs(i.progress-i.object.currentTime)>2){console.log("progress changed",i.progress);const p=t.state.producer.audio;p.object&&(p.object.currentTime=p.progress)}else i?.state!==h?.state&&(console.log("state changed",i.state),i.object&&(i.state==="playing"?i.object.play():i.object.pause()));i?.volume!==h?.volume&&(console.log("volume changed",i.volume),i.object&&(i.object.volume=i.volume/100))}),(i,h)=>(n(),c("div",ws,[o("img",{alt:"",class:"w-11 h-11 rounded",src:l.value?.image_url||E(Ae)},null,8,Cs),o("div",Vs,[o("div",Ss,[o("div",Us,[o("span",null,a(l.value?.title||"Music"),1),o("span",Ps,"- "+a(l.value?.style||"SmallRuralDog"),1)])])])]))}}),Es={class:"flex justify-end items-center gap-x-2.5"},Ts={class:"text-xs"},Fs=b({__name:"PlayerAction",setup(e){const t=N(),l=T({get:()=>t.state.producer?.audio?.progress,set:h=>t.commit("producer/setAudio",{...t.state.producer.audio,progress:h})}),i=T({get:()=>t.state.producer?.audio?.duration,set:h=>t.commit("producer/setAudio",{...t.state.producer.audio,duration:h})});return(h,p)=>(n(),c("div",Es,[o("span",Ts,a(E(j)(l.value))+" / "+a(E(j)(i.value)),1)]))}}),Is={class:"player-volume flex flex-col items-center pt-2"},Ls={class:"text-sm mt-3"},Gs=b({__name:"PlayerVolumeSlider",setup(e){const t=N(),l=T({get:()=>t.state.producer.audio?.volume,set:p=>t.commit("producer/setAudio",{...t.state.producer.audio,volume:p})}),i=T({get:()=>t.state.producer.audio?.muted,set:p=>t.commit("producer/setAudio",{...t.state.producer.audio,muted:p})}),h=p=>t.dispatch("producer/setVolume",p);return(p,u)=>(n(),c("div",Is,[s(E(x),{modelValue:l.value,"onUpdate:modelValue":u[0]||(u[0]=m=>l.value=m),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:i.value,onInput:h},null,8,["modelValue","disabled"]),o("div",Ls,a(l.value),1)]))}}),js={class:"flex items-center justify-center gap-x-3"},Ds=b({__name:"PlayerController",setup(e){const t=N(),l=()=>t.dispatch("producer/setAudio",{...t.state.producer.audio,state:t.state.producer.audio.state==="playing"?"paused":"playing"}),i=T(()=>t.state.producer.audio);return(h,p)=>(n(),c("div",js,[s(ee,{icon:i.value?.state==="playing"?E(Ee):E(Te),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:l},null,8,["icon"]),s(E(_e),{placement:"top",width:"50px",trigger:"click"},{reference:d(()=>[s(ee,{icon:E(Fe),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:d(()=>[s(Gs)]),_:1})]))}}),Rs={class:"flex flex-col items-stretch h-20"},Zs={class:"flex grow px-5 items-center"},zs={class:"flex-1"},Ns={class:"flex-1"},Ms={class:"flex-1"},Os=b({__name:"Player",setup(e){return(t,l)=>(n(),c("div",Rs,[s(bs),o("div",Zs,[o("div",zs,[s(As)]),o("div",Ns,[s(Ds)]),o("div",Ms,[s(Fs)])])]))}}),Bs=b({name:"RecentPanel",components:{ElSkeletonItem:ge,ElSkeleton:$e,TaskPreview:ys,Player:Os,NoTasks:Ge,ScrollList:Ue},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.producer?.tasks,items:this.$store.state.producer?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),qs={key:0,class:"tasks"},Ws={class:"left w-[70px] p-[10px] flex items-center"},Ks={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},Hs={key:2,class:"w-full flex-1 flex items-center justify-center"},Js={class:"h-20"};function Ys(e,t,l,i,h,p){const u=r("el-skeleton-item"),m=r("el-skeleton"),_=r("task-preview"),$=r("scroll-list"),k=r("no-tasks"),y=r("player");return n(),c(G,null,[e.tasks?.items===void 0?(n(),c("div",qs,[(n(),c(G,null,q(3,P=>o("div",{key:P,class:"flex"},[o("div",Ws,[s(m,{animated:""},{template:d(()=>[s(u,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),o("div",Ks,[s(m,{animated:""},{template:d(()=>[s(u,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),s(u,{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]=P=>e.$emit("reach-top"))},{default:d(()=>[(n(!0),c(G,null,q(e.tasks?.items,(P,S)=>(n(),v(_,{key:S,"model-value":P,class:"preview"},null,8,["model-value"]))),128))]),_:1},8,["loading"])):f("",!0),e.tasks?.items?.length===0?(n(),c("div",Hs,[s(k)])):f("",!0),z(o("div",Js,[s(y)],512),[[be,!!e.$store?.state?.producer?.audio?.object]])],64)}const Qs=V(Bs,[["render",Ys]]),Xs=b({name:"TaskPreview",components:{IconPicture:ye,ElImage:Z,ElAvatar:ve,ElIcon:K},computed:{audio(){return this.$store.state.producer?.audio}}}),xs={key:0,class:"size-full overflow-hidden"},en={class:"relative h-[300px]"},tn={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},on={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"},sn={class:"p-4"},nn={class:"flex items-center font-bold mb-2"},rn={class:"text-[var(--el-text-color-regular)] mb-2"},an={class:"text-xs text-[var(--el-text-color-regular)]"},ln={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},cn={key:1,class:"w-full h-full"};function dn(e,t,l,i,h,p){const u=r("icon-picture"),m=r("el-icon"),_=r("el-image"),$=r("el-avatar");return e.audio?.object?(n(),c("div",xs,[o("div",en,[s(_,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:d(()=>[o("div",tn,[s(m,{class:"text-3xl"},{default:d(()=>[s(u)]),_:1})])]),_:1},8,["src"]),o("h2",on,a(e.audio?.title),1)]),o("div",sn,[o("div",nn,[s($,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),o("span",null,a(e.audio?.title),1)]),o("p",rn,a(e.audio?.style),1),o("p",an,a(e.$dayjs.format(e.audio?.created_at)),1),o("div",ln,[o("p",null,a(e.audio?.lyric),1)])])])):(n(),c("div",cn))}const un=V(Xs,[["render",dn]]),pn="https://webhook.acedata.cloud/producer",mn=b({name:"ProducerIndex",components:{Layout:Oe,ConfigPanel:os,RecentPanel:Qs,PreviewPanel:un},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.producer?.status?.getApplications===L.Request},tasksLoading(){return this.$store.state.producer?.status?.getTasks===L.Request||this.fetchingTasks},service(){return this.$store.state.producer.service},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},initializing(){return this.$store.state.producer.status.getApplications===L.Request},needApply(){return this.$store.state.producer.status.getApplications===L.Success&&!this.application},application(){return this.$store.state.producer.application},tasks(){return this.$store.state.producer.tasks},applications(){return this.$store.state.producer.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 je({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("producer/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("producer/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ve.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Se&&w.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:l,createdAtMax:i}=e||{};console.debug("limit",t,"createdAtMin",l,"createdAtMax",i),this.fetchingTasks=!0;try{await this.$store.dispatch("producer/getTasks",{limit:t,createdAtMin:l,createdAtMax:i})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){const e={...this.config,callback_url:pn},t=this.credential?.token;if(!t){console.error("no token specified");return}w.info(this.$t("producer.message.startingTask")),I.audio(e,{token:t}).then(()=>{w.success(this.$t("producer.message.startTaskSuccess"))}).catch(l=>{w.error(l?.response?.data?.error?.message||this.$t("producer.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function fn(e,t,l,i,h,p){const u=r("config-panel"),m=r("recent-panel"),_=r("preview-panel"),$=r("layout");return n(),v($,null,{config:d(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:d(()=>[s(m,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),preview:d(()=>[s(_)]),_:1})}const An=V(mn,[["render",fn],["__scopeId","data-v-638e0ac5"]]);export{An as default};
|
|
1
|
+
import{F as D}from"./index.es-DMehEjXB.js";import{m as W,X as oe,k as se,O as ne,P as re,u as ie,w,t as R,a6 as X,a7 as Q,_ as Y,e as K,j as Z,F as ae,G as le,$ as x,a8 as ce,a9 as de,l as ue,f as pe,g as me,h as fe,q as he,r as _e,L as $e,a2 as ge,aa as ve,ab as ye}from"./vendor-element-plus-CmP9-3lX.js";import{d as b,C as c,G as o,T as s,E as B,K as d,ai as r,D as n,O as f,R as a,S as G,ag as q,J as v,Q as U,L as z,aq as H,X as A,c as T,u as E,w as ke,U as be}from"./vendor-vue-BhXato7y.js";import{_ as V,cn as we,co as I,av as Ce,aK as L,cm as N,aD as Ve,aJ as Se}from"./index-CtkD2JaX.js";import{I as F,S as Ue}from"./ScrollList-OteSDitY.js";import{u as j,F as Pe,O as Ae,_ as ee,P as Ee,a as Te,V as Fe}from"./IconPark.vue_vue_type_script_setup_true_lang-C7eA9UI3.js";import{C as Ie}from"./Consumption-DEB600BC.js";import{a as Le}from"./price-lQeFOa8Q.js";import{N as Ge}from"./NoTasks-ZsLHgPuo.js";import{l as je}from"./pagination-DLJ2pbsx.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-C5RrfhAy.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-8bYQCSwj.js";const De=b({name:"LayoutProducer",components:{ElDrawer:oe,ElButton:W,FontAwesomeIcon:D},data(){return{drawer:!1,preview:!1}},computed:{}}),Re={class:"main flex flex-row flex-1"},Ze={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},ze={class:"result h-full flex flex-col flex-1 min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"},Ne={class:"preview h-full w-[300px] flex flex-col"};function Me(e,t,l,i,h,p){const u=r("font-awesome-icon"),m=r("el-button"),_=r("el-drawer");return n(),c("div",Re,[o("div",Ze,[B(e.$slots,"config",{},void 0,!0)]),o("div",ze,[B(e.$slots,"result",{},void 0,!0)]),o("div",Ne,[B(e.$slots,"preview",{},void 0,!0)]),s(m,{circle:"",class:"menu",onClick:t[0]||(t[0]=$=>e.drawer=!0)},{default:d(()=>[s(u,{icon:"fa-solid fa-magic"})]),_:1}),s(_,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=$=>e.drawer=$),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:d(()=>[B(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const Oe=V(De,[["render",Me],["__scopeId","data-v-7453886f"]]),Be=b({name:"TypeSelector",components:{ElSelect:re,ElOption:ne,ElSwitch:se},data(){return{options:[{label:"FUZZ-2.0 Pro",value:"FUZZ-2.0 Pro",info:"8 min"},{label:"FUZZ-2.0",value:"FUZZ-2.0",info:"8 min"},{label:"FUZZ-2.0 Raw",value:"FUZZ-2.0 Raw",info:"8 min"},{label:"FUZZ-1.1 Pro",value:"FUZZ-1.1 Pro",info:"4 min"},{label:"FUZZ-1.0 Pro",value:"FUZZ-1.0 Pro",info:"4 min"},{label:"FUZZ-1.1",value:"FUZZ-1.1",info:"4 min"},{label:"FUZZ-1.0",value:"FUZZ-1.0",info:"2 min"},{label:"FUZZ-0.8",value:"FUZZ-0.8",info:"2 min"}]}},computed:{custom:{get(){return this.$store.state.producer?.config?.custom||!1},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,custom:e})}},instrumental:{get(){return this.$store.state.producer?.config?.instrumental||!1},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,instrumental:e})}},model:{get(){return this.$store.state.producer?.config?.model},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,model:e})}}},mounted(){this.model||(this.model=we)}}),qe={class:"flex items-center justify-between mb-3"},We={class:"text-sm font-bold"},Ke={class:"mb-3"},He={class:"flex items-center mb-1"},Je={class:"text-sm font-bold"},Xe={class:"flex items-center justify-between w-full"},Qe={class:"text-xs text-[var(--el-text-color-placeholder)]"},Ye={key:0,class:"flex items-center justify-between mb-3"},xe={class:"text-sm font-bold"};function et(e,t,l,i,h,p){const u=r("el-switch"),m=r("el-option"),_=r("el-select");return n(),c("div",null,[o("div",qe,[o("span",We,a(e.$t("producer.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=$=>e.custom=$)},null,8,["modelValue"])]),o("div",Ke,[o("div",He,[o("span",Je,a(e.$t("producer.name.model")),1)]),s(_,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=$=>e.model=$),class:"w-full",size:"default",placeholder:e.$t("producer.placeholder.select")},{default:d(()=>[(n(!0),c(G,null,q(e.options,$=>(n(),v(m,{key:$.value,label:$.label,value:$.value},{default:d(()=>[o("div",Xe,[o("span",null,a($.label),1),o("span",Qe,a($.info),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),e.custom?(n(),c("div",Ye,[o("span",xe,a(e.$t("producer.name.instrumental")),1),s(u,{modelValue:e.instrumental,"onUpdate:modelValue":t[2]||(t[2]=$=>e.instrumental=$)},null,8,["modelValue"])])):f("",!0)])}const tt=V(Be,[["render",et]]),ot=b({name:"UploadAudio",components:{ElUpload:ie,ElButton:W,InfoIcon:F,FontAwesomeIcon:D},emits:["change"],data(){return{fileList:[],uploadUrl:Ce()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.producer?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){w.warning(this.$t("producer.message.uploadReferencesExceed"))},onError(){w.error(this.$t("producer.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},l=this.credential?.token;if(!l){console.error("no token specified");return}w.info(this.$t("producer.message.startingUploadAudio")),I.upload(t,{token:l}).then(i=>{console.debug("get upload music success",i.data);const h=i.data?.data.audio_id;this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,audio_id:h,action:"upload_extend"}),w.success(this.$t("producer.message.startUploadAudioSuccess"))}).catch(i=>{w.error(i?.response?.data?.error?.message||this.$t("producer.message.startUploadAudioFailed"))})},onSetAudio(){}}}),st={class:"relative"},nt={class:"flex justify-between"},rt={class:"flex justify-start items-center"},it={class:"text-sm font-bold"};function at(e,t,l,i,h,p){const u=r("info-icon"),m=r("font-awesome-icon"),_=r("el-button"),$=r("el-upload");return n(),c("div",st,[o("div",nt,[o("div",rt,[o("span",it,a(e.$t("producer.name.referenceAudios")),1),s(u,{content:e.$t("producer.description.uploadAudios")},null,8,["content"])])]),s($,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=k=>e.fileList=k),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:d(()=>[s(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:d(()=>[s(m,{icon:"fa-solid fa-upload",class:"icon mr-1"}),U(" "+a(e.$t("producer.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const lt=V(ot,[["render",at],["__scopeId","data-v-e4cd0467"]]),ct="",dt=b({name:"PromptInput",components:{ElInput:R,InfoIcon:F},computed:{prompt:{get(){return this.$store.state.producer?.config?.prompt},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=ct)}}),ut={class:"field"},pt={class:"flex items-center mb-1"},mt={class:"text-sm font-bold"};function ft(e,t,l,i,h,p){const u=r("info-icon"),m=r("el-input");return n(),c("div",ut,[o("div",pt,[o("span",mt,a(e.$t("producer.name.songDescription")),1),s(u,{content:e.$t("producer.description.prompt")},null,8,["content"])]),s(m,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=_=>e.prompt=_),rows:4,type:"textarea",placeholder:e.$t("producer.placeholder.prompt")},null,8,["modelValue","placeholder"])])}const ht=V(dt,[["render",ft]]),_t="",$t=b({name:"LyricInput",components:{ElInput:R,ElButton:W,FontAwesomeIcon:D,InfoIcon:F},data(){return{generatingLyrics:!1}},computed:{lyric:{get(){return this.$store.state.producer?.config?.lyric},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,lyric:e})}},config(){return this.$store.state.producer?.config},credential(){return this.$store.state.producer?.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,w.info(this.$t("producer.message.generatingLyrics"));try{const i=(await I.lyric({prompt:t},{token:e})).data?.data;i?.text&&(this.lyric=i.text,i?.title&&!this.config?.title&&this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,lyric:i.text,title:i.title}),w.success(this.$t("producer.message.generateLyricsSuccess")))}catch{w.error(this.$t("producer.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,l,i,h,p){const u=r("info-icon"),m=r("font-awesome-icon"),_=r("el-button"),$=r("el-input");return n(),c("div",gt,[o("div",vt,[o("div",yt,[o("span",kt,a(e.$t("producer.name.lyrics")),1),s(u,{content:e.$t("producer.description.lyrics")},null,8,["content"])]),e.config?.action!=="extend"?(n(),v(_,{key:0,size:"small",loading:e.generatingLyrics,round:"",onClick:e.onGenerateLyrics},{default:d(()=>[e.generatingLyrics?f("",!0):(n(),v(m,{key:0,icon:"fa-solid fa-wand-magic-sparkles",class:"mr-1"})),U(" "+a(e.$t("producer.button.generate_lyrics")),1)]),_:1},8,["loading","onClick"])):f("",!0)]),e.config?.action!=="extend"?(n(),v($,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=k=>e.lyric=k),rows:5,type:"textarea",class:"lyrics",placeholder:e.$t("producer.placeholder.lyrics")},null,8,["modelValue","placeholder"])):(n(),v($,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=k=>e.lyric=k),rows:5,type:"textarea",class:"lyrics",placeholder:e.$t("producer.placeholder.extend.lyrics")},null,8,["modelValue","placeholder"]))])}const wt=V($t,[["render",bt],["__scopeId","data-v-88c6da2b"]]),Ct=b({name:"StyleInput",components:{ElInput:R,InfoIcon:F},computed:{style:{get(){return this.$store.state.producer?.config?.style},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,style:e})}}}}),Vt={class:"field"},St={class:"flex items-center justify-between mb-1"},Ut={class:"flex items-center"},Pt={class:"text-sm font-bold"};function At(e,t,l,i,h,p){const u=r("info-icon"),m=r("el-input");return n(),c("div",Vt,[o("div",St,[o("div",Ut,[o("span",Pt,a(e.$t("producer.name.style")),1),s(u,{content:e.$t("producer.description.style")},null,8,["content"])])]),s(m,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=_=>e.style=_),rows:2,type:"textarea",placeholder:e.$t("producer.placeholder.style")},null,8,["modelValue","placeholder"])])}const Et=V(Ct,[["render",At]]),Tt=b({name:"TitleInput",components:{ElInput:R,InfoIcon:F},computed:{title:{get(){return this.$store.state.producer?.config?.title},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,title:e})}}}}),Ft={class:"field"},It={class:"flex items-center mb-1"},Lt={class:"text-sm font-bold"};function Gt(e,t,l,i,h,p){const u=r("info-icon"),m=r("el-input");return n(),c("div",Ft,[o("div",It,[o("span",Lt,a(e.$t("producer.name.title")),1),s(u,{content:e.$t("producer.description.title")},null,8,["content"])]),s(m,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=_=>e.title=_),placeholder:e.$t("producer.placeholder.title")},null,8,["modelValue","placeholder"])])}const jt=V(Tt,[["render",Gt]]),Dt=b({name:"ExtendFromInput",components:{ElImage:Z,ElIcon:K,ElInputNumber:Y,VideoPlay:Q,VideoPause:X},data(){return{}},computed:{audio(){return this.$store.state.producer?.config?.audio},value:{get(){return this.$store.state.producer?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("producer/setConfig",{...this.$store.state.producer?.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("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Rt={class:"field"},Zt={class:"box"},zt={class:"title font-bold"},Nt={class:"input-wrapper"},Mt={class:"task"},Ot={class:"left"},Bt={key:2,class:"duration"},qt={class:"info"},Wt={class:"title"},Kt={class:"style"};function Ht(e,t,l,i,h,p){const u=r("el-input-number"),m=r("el-image"),_=r("video-pause"),$=r("el-icon"),k=r("video-play"),y=H("loading");return n(),c("div",Rt,[o("div",Zt,[o("h2",zt,a(e.$t("producer.name.extend")),1),o("div",Nt,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=P=>e.value=P),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("producer.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),o("div",Mt,[e.audio?(n(),c("div",{key:0,class:"audio",onClick:t[3]||(t[3]=P=>e.onClick(e.audio))},[z((n(),c("div",Ot,[s(m,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.producer?.audio?.id===e.audio.id&&e.$store.state?.producer?.audio?.state==="playing"?(n(),c("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=P=>e.onPause(e.audio))},[s($,null,{default:d(()=>[s(_)]),_:1})])):f("",!0),e.audio?.audio_url&&(e.$store.state?.producer?.audio?.id!==e.audio.id||e.$store.state?.producer?.audio?.id===e.audio.id&&e.$store.state?.producer?.audio?.state==="paused")?(n(),c("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=P=>e.onPlay(e.audio))},[s($,null,{default:d(()=>[s(k)]),_:1})])):f("",!0),e.audio?.duration?(n(),c("div",Bt,a(e.useFormatDuring(e.audio?.duration)),1)):f("",!0)])),[[y,!e.audio?.audio_url]]),o("div",qt,[o("h2",Wt,a(e.audio?.title),1),o("p",Kt,a(e.audio?.style),1)])])):f("",!0)])])}const Jt=V(Dt,[["render",Ht],["__scopeId","data-v-26d43480"]]),Xt=b({name:"CoverFromInput",components:{ElImage:Z,ElIcon:K,VideoPlay:Q,VideoPause:X},data(){return{}},computed:{audio(){return this.$store.state.producer?.config?.audio},value:{get(){return this.$store.state.producer?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("producer/setConfig",{...this.$store.state.producer?.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("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Qt={class:"field"},Yt={class:"box"},xt={class:"title font-bold"},eo={class:"task"},to={class:"left"},oo={key:2,class:"duration"},so={class:"info"},no={class:"title"},ro={class:"style"};function io(e,t,l,i,h,p){const u=r("el-image"),m=r("video-pause"),_=r("el-icon"),$=r("video-play"),k=H("loading");return n(),c("div",Qt,[o("div",Yt,[o("h2",xt,a(e.$t("producer.name.cover")),1)]),o("div",eo,[e.audio?(n(),c("div",{key:0,class:"audio",onClick:t[2]||(t[2]=y=>e.onClick(e.audio))},[z((n(),c("div",to,[s(u,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.producer?.audio?.id===e.audio.id&&e.$store.state?.producer?.audio?.state==="playing"?(n(),c("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=y=>e.onPause(e.audio))},[s(_,null,{default:d(()=>[s(m)]),_:1})])):f("",!0),e.audio?.audio_url&&(e.$store.state?.producer?.audio?.id!==e.audio.id||e.$store.state?.producer?.audio?.id===e.audio.id&&e.$store.state?.producer?.audio?.state==="paused")?(n(),c("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPlay(e.audio))},[s(_,null,{default:d(()=>[s($)]),_:1})])):f("",!0),e.audio?.duration?(n(),c("div",oo,a(e.useFormatDuring(e.audio?.duration)),1)):f("",!0)])),[[k,!e.audio?.audio_url]]),o("div",so,[o("h2",no,a(e.audio?.title),1),o("p",ro,a(e.audio?.style),1)])])):f("",!0)])])}const ao=V(Xt,[["render",io],["__scopeId","data-v-d8a8e583"]]),lo=b({name:"VocalGenderSelector",components:{ElRadioGroup:le,ElRadioButton:ae,InfoIcon:F},computed:{vocalGender:{get(){return this.$store.state.producer?.config?.vocal_gender||""},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,vocal_gender:e||void 0})}}}}),co={class:"mb-2"},uo={class:"flex items-center mb-1"},po={class:"text-sm font-bold"};function mo(e,t,l,i,h,p){const u=r("info-icon"),m=r("el-radio-button"),_=r("el-radio-group");return n(),c("div",co,[o("div",uo,[o("span",po,a(e.$t("producer.name.vocalGender")),1),s(u,{content:e.$t("producer.description.vocalGender")},null,8,["content"])]),s(_,{modelValue:e.vocalGender,"onUpdate:modelValue":t[0]||(t[0]=$=>e.vocalGender=$)},{default:d(()=>[s(m,{value:""},{default:d(()=>[U(a(e.$t("producer.gender.auto")),1)]),_:1}),s(m,{value:"f"},{default:d(()=>[U(a(e.$t("producer.gender.female")),1)]),_:1}),s(m,{value:"m"},{default:d(()=>[U(a(e.$t("producer.gender.male")),1)]),_:1})]),_:1},8,["modelValue"])])}const fo=V(lo,[["render",mo]]),ho=b({name:"AdvancedParams",components:{ElCollapse:de,ElCollapseItem:ce,ElInput:R,ElSlider:x,ElInputNumber:Y},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.producer?.config},styleNegative:{get(){return this.$store.state.producer?.config?.style_negative||""},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,style_negative:e||void 0})}},lyricPrompt:{get(){return this.$store.state.producer?.config?.lyric_prompt||""},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,lyric_prompt:e||void 0})}},weirdness:{get(){return this.$store.state.producer?.config?.weirdness??0},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,weirdness:e||void 0})}},soundStrength:{get(){return this.$store.state.producer?.config?.sound_strength??50},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,sound_strength:e})}},lyricsStrength:{get(){return this.$store.state.producer?.config?.lyrics_strength??50},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,lyrics_strength:e})}},seed:{get(){return this.$store.state.producer?.config?.seed},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,seed:e})}}}}),_o={key:0,class:"mb-3"},$o={class:"flex items-center mb-1"},go={class:"text-xs font-bold"},vo={key:1,class:"mb-3"},yo={class:"flex items-center mb-1"},ko={class:"text-xs font-bold"},bo={key:2,class:"mb-3"},wo={class:"flex items-center justify-between mb-1"},Co={class:"text-xs font-bold"},Vo={class:"text-xs text-[var(--el-text-color-secondary)]"},So={key:3,class:"mb-3"},Uo={class:"flex items-center justify-between mb-1"},Po={class:"text-xs font-bold"},Ao={class:"text-xs text-[var(--el-text-color-secondary)]"},Eo={key:4,class:"mb-3"},To={class:"flex items-center justify-between mb-1"},Fo={class:"text-xs font-bold"},Io={class:"text-xs text-[var(--el-text-color-secondary)]"},Lo={key:5,class:"mb-3"},Go={class:"flex items-center mb-1"},jo={class:"text-xs font-bold"};function Do(e,t,l,i,h,p){const u=r("el-input"),m=r("el-slider"),_=r("el-input-number"),$=r("el-collapse-item"),k=r("el-collapse");return n(),v(k,{modelValue:e.activeNames,"onUpdate:modelValue":t[6]||(t[6]=y=>e.activeNames=y),class:"advanced-collapse"},{default:d(()=>[s($,{title:e.$t("producer.name.advancedParams"),name:"advanced"},{default:d(()=>[e.config?.custom?(n(),c("div",_o,[o("div",$o,[o("span",go,a(e.$t("producer.name.styleNegative")),1)]),s(u,{modelValue:e.styleNegative,"onUpdate:modelValue":t[0]||(t[0]=y=>e.styleNegative=y),placeholder:e.$t("producer.placeholder.styleNegative")},null,8,["modelValue","placeholder"])])):f("",!0),e.config?.custom&&!e.config?.instrumental?(n(),c("div",vo,[o("div",yo,[o("span",ko,a(e.$t("producer.name.lyricPrompt")),1)]),s(u,{modelValue:e.lyricPrompt,"onUpdate:modelValue":t[1]||(t[1]=y=>e.lyricPrompt=y),placeholder:e.$t("producer.placeholder.lyricPrompt")},null,8,["modelValue","placeholder"])])):f("",!0),e.config?.custom?(n(),c("div",bo,[o("div",wo,[o("span",Co,a(e.$t("producer.name.weirdness")),1),o("span",Vo,a(e.weirdness??0),1)]),s(m,{modelValue:e.weirdness,"onUpdate:modelValue":t[2]||(t[2]=y=>e.weirdness=y),min:0,max:100,step:1},null,8,["modelValue"])])):f("",!0),e.config?.custom?(n(),c("div",So,[o("div",Uo,[o("span",Po,a(e.$t("producer.name.soundStrength")),1),o("span",Ao,a(e.soundStrength??50),1)]),s(m,{modelValue:e.soundStrength,"onUpdate:modelValue":t[3]||(t[3]=y=>e.soundStrength=y),min:0,max:100,step:1},null,8,["modelValue"])])):f("",!0),e.config?.custom&&!e.config?.instrumental?(n(),c("div",Eo,[o("div",To,[o("span",Fo,a(e.$t("producer.name.lyricsStrength")),1),o("span",Io,a(e.lyricsStrength??50),1)]),s(m,{modelValue:e.lyricsStrength,"onUpdate:modelValue":t[4]||(t[4]=y=>e.lyricsStrength=y),min:0,max:100,step:1},null,8,["modelValue"])])):f("",!0),e.config?.custom?(n(),c("div",Lo,[o("div",Go,[o("span",jo,a(e.$t("producer.name.seed")),1)]),s(_,{modelValue:e.seed,"onUpdate:modelValue":t[5]||(t[5]=y=>e.seed=y),min:0,controls:!1,placeholder:e.$t("producer.placeholder.seed"),class:"w-full"},null,8,["modelValue","placeholder"])])):f("",!0)]),_:1},8,["title"])]),_:1},8,["modelValue"])}const Ro=V(ho,[["render",Do],["__scopeId","data-v-88e65aee"]]),Zo=b({name:"ReplaceSectionInput",components:{ElInputNumber:Y,ElImage:Z,InfoIcon:F},computed:{audio(){return this.$store.state.producer?.config?.audio},replaceSectionStart:{get(){return this.$store.state.producer?.config?.replace_section_start},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,replace_section_start:e})}},replaceSectionEnd:{get(){return this.$store.state.producer?.config?.replace_section_end},set(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,replace_section_end:e})}}},methods:{onClick(e){this.$store.dispatch("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"playing"})}}}),zo={class:"field"},No={class:"flex items-center mb-2"},Mo={class:"text-sm font-bold m-0"},Oo={key:0,class:"task mb-2"},Bo={class:"left relative w-[50px] h-[50px] mr-3 flex-shrink-0"},qo={class:"info flex-1 min-w-0"},Wo={class:"text-sm font-bold m-0 truncate"},Ko={class:"text-xs text-[var(--el-text-color-secondary)] m-0 truncate"},Ho={class:"flex gap-2"};function Jo(e,t,l,i,h,p){const u=r("info-icon"),m=r("el-image"),_=r("el-input-number"),$=H("loading");return n(),c("div",zo,[o("div",No,[o("h2",Mo,a(e.$t("producer.name.replaceSection")),1),s(u,{content:e.$t("producer.description.replaceSection")},null,8,["content"])]),e.audio?(n(),c("div",Oo,[o("div",{class:"audio flex items-center",onClick:t[0]||(t[0]=k=>e.onClick(e.audio))},[z((n(),c("div",Bo,[s(m,{src:e.audio?.image_url,class:"w-full h-full rounded",fit:"cover"},null,8,["src"])])),[[$,!e.audio?.audio_url]]),o("div",qo,[o("h2",Wo,a(e.audio?.title),1),o("p",Ko,a(e.audio?.style),1)])])])):f("",!0),o("div",Ho,[s(_,{modelValue:e.replaceSectionStart,"onUpdate:modelValue":t[1]||(t[1]=k=>e.replaceSectionStart=k),class:"flex-1",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("producer.placeholder.replaceSectionStart")},null,8,["modelValue","max","placeholder"]),s(_,{modelValue:e.replaceSectionEnd,"onUpdate:modelValue":t[2]||(t[2]=k=>e.replaceSectionEnd=k),class:"flex-1",min:e.replaceSectionStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t("producer.placeholder.replaceSectionEnd")},null,8,["modelValue","min","max","placeholder"])])])}const Xo=V(Zo,[["render",Jo]]),Qo=b({name:"PresetPanel",components:{TypeSelector:tt,PromptInput:ht,LyricInput:wt,StyleInput:Et,TitleInput:jt,ExtendFromInput:Jt,CoverFromInput:ao,UploadAudio:lt,VocalGenderSelector:fo,AdvancedParams:Ro,ReplaceSectionInput:Xo,FontAwesomeIcon:D,ElButton:W,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.producer?.config},consumption(){return Le(this.config,this.service?.cost)},service(){return this.$store.state.producer?.service},generateButtonText(){const e=this.config?.action;return e==="extend"?this.$t("producer.button.extend"):e==="cover"?this.$t("producer.button.cover_music"):e==="variation"?this.$t("producer.button.variation"):e==="replace_section"?this.$t("producer.button.replace_section"):e==="stems"?this.$t("producer.button.get_stems"):e==="swap_vocals"?this.$t("producer.button.swap_vocals"):e==="swap_instrumentals"?this.$t("producer.button.swap_instrumentals"):this.$t("producer.button.generate")}},methods:{onGenerate(){this.$emit("generate")}}}),Yo={class:"flex flex-col h-full"},xo={class:"flex-1 overflow-y-auto p-5"},es={class:"flex flex-col items-center justify-center px-5 pb-5"};function ts(e,t,l,i,h,p){const u=r("type-selector"),m=r("upload-audio"),_=r("prompt-input"),$=r("lyric-input"),k=r("style-input"),y=r("title-input"),P=r("vocal-gender-selector"),S=r("extend-from-input"),M=r("cover-from-input"),O=r("replace-section-input"),J=r("advanced-params"),g=r("consumption"),C=r("font-awesome-icon"),te=r("el-button");return n(),c("div",Yo,[o("div",xo,[s(u,{class:"mb-4"}),s(m,{class:"mb-4"}),e.config?.custom?f("",!0):(n(),v(_,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(n(),v($,{key:1,class:"mb-4"})):f("",!0),e.config?.custom?(n(),v(k,{key:2,class:"mb-4"})):f("",!0),e.config?.custom?(n(),v(y,{key:3,class:"mb-4"})):f("",!0),e.config?.custom&&!e.config.instrumental?(n(),v(P,{key:4,class:"mb-4"})):f("",!0),e.config?.action==="extend"?(n(),v(S,{key:5,class:"mb-4"})):f("",!0),e.config?.action==="cover"?(n(),v(M,{key:6,class:"mb-4"})):f("",!0),e.config?.action==="replace_section"?(n(),v(O,{key:7,class:"mb-4"})):f("",!0),s(J,{class:"mb-4"})]),o("div",es,[s(g,{value:e.consumption,service:e.service},null,8,["value","service"]),s(te,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[s(C,{icon:"fa-solid fa-magic",class:"mr-2"}),U(" "+a(e.generateButtonText),1)]),_:1},8,["onClick"])])])}const os=V(Qo,[["render",ts],["__scopeId","data-v-6642bb3c"]]),ss="https://webhook.acedata.cloud/producer",ns=b({name:"TaskPreview",components:{ElImage:Z,ElIcon:K,ElTooltip:he,FontAwesomeIcon:D,VideoPlay:Q,VideoPause:X,ElDropdown:fe,ElDropdownMenu:me,ElDropdownItem:pe,Loading:ue},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1}},computed:{loading(){return this.$store.state.producer?.status?.getApplications===L.Request},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},task(){return this.$store.state.producer?.tasks},audios(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(l=>({...l,action:t})):e},application(){return this.$store.state.producer?.application},active(){return this.$store.state.producer?.tasks?.active}},methods:{useFormatDuring:j,onPlay(e){this.$store.dispatch("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("producer/setAudio",{...this.$store.state.producer.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.debug("set config",t),this.$store.commit("producer/setConfig",{...this.$store.state.producer?.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();const i=new URL(t).pathname,h=i.substring(i.lastIndexOf("/")+1);fetch(t).then(p=>p.blob()).then(p=>{Pe.saveAs(p,h)})},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),w.error(this.$t("producer.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,l)=>{const i={audio_id:e},h=this.credential?.token;if(!h){console.error("no token specified"),l(new Error("No token specified"));return}I.video(i,{token:h}).then(p=>{const u=p.data?.data?.video_url;u?t(u):l(new Error("Video URL not found in response"))}).catch(p=>{l(p)})})},onPreview(e,t){e.stopPropagation(),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},onVariation(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.config,model:e.model,custom:!0,style:e.style,action:"variation",audio:e,audio_id:e.id})},async onSwapVocals(e){await this.onGenerateAudioUrl("swap_vocals",e)},async onSwapInstrumentals(e){await this.onGenerateAudioUrl("swap_instrumentals",e)},async onGetAllStems(e){await this.onGenerateAudioUrl("all_stems",e)},onReplaceSection(e){this.$store.commit("producer/setConfig",{...this.$store.state.producer?.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)})},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;const t=this.credential?.token;if(t)try{this.isFetchingWav=!0,w.info(this.$t("producer.message.fetchingWav"));const i=(await I.wav({audio_id:e.id},{token:t})).data?.data?.audio_url;i?this.onDownload(null,i):w.error(this.$t("producer.message.fetchWavFailed"))}catch{w.error(this.$t("producer.message.fetchWavFailed"))}finally{this.isFetchingWav=!1}},async onGenerateAudioUrl(e,t){const l={action:e,audio_id:t,callback_url:ss},i=this.credential?.token;if(!i){console.error("no token specified");return}w.info(this.$t("producer.message.startingTask")),I.audio(l,{token:i}).then(()=>{w.success(this.$t("producer.message.startTaskSuccess"))}).catch(h=>{w.error(h?.response?.data?.error?.message||this.$t("producer.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("producer/getTasks",{limit:30,offset:0})}}}),rs={class:"task"},is=["onClick"],as={class:"left"},ls=["onClick"],cs=["onClick"],ds={key:2,class:"duration"},us={class:"info"},ps={class:"title"},ms={class:"style"},fs={class:"right"},hs={class:"el-dropdown-link"},_s={class:"flex items-center min-w-[120px]"},$s={class:"flex items-center min-w-[120px]"},gs={class:"el-dropdown-link"};function vs(e,t,l,i,h,p){const u=r("el-image"),m=r("video-pause"),_=r("el-icon"),$=r("video-play"),k=r("font-awesome-icon"),y=r("el-tooltip"),P=r("Loading"),S=r("el-dropdown-item"),M=r("el-dropdown-menu"),O=r("el-dropdown"),J=H("loading");return n(),c("div",rs,[(n(!0),c(G,null,q(e.audios,g=>(n(),c("div",{key:g.id,class:"audio",onClick:A(C=>e.onClick(g),["stop"])},[z((n(),c("div",as,[s(u,{src:g?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),g?.audio_url&&e.$store.state?.producer?.audio?.id===g.id&&e.$store.state?.producer?.audio?.state==="playing"?(n(),c("div",{key:0,class:"overlay",onClick:A(C=>e.onPause(g),["stop"])},[s(_,null,{default:d(()=>[s(m)]),_:1})],8,ls)):f("",!0),g?.audio_url&&(e.$store.state?.producer?.audio?.id!==g.id||e.$store.state?.producer?.audio?.id===g.id&&e.$store.state?.producer?.audio?.state==="paused")?(n(),c("div",{key:1,class:"overlay",onClick:A(C=>e.onPlay(g),["stop"])},[s(_,null,{default:d(()=>[s($)]),_:1})],8,cs)):f("",!0),g?.duration?(n(),c("div",ds,a(e.useFormatDuring(g?.duration)),1)):f("",!0)])),[[J,!g?.audio_url]]),o("div",us,[o("h2",ps,a(g?.title),1),o("p",ms,a(g?.style),1)]),o("div",fs,[s(O,null,{dropdown:d(()=>[s(M,null,{default:d(()=>[s(S,{disabled:e.isFetchingVideoUrl,onClick:C=>e.handleVideoDownload(g)},{default:d(()=>[o("div",_s,[e.isFetchingVideoUrl?(n(),v(_,{key:0,class:"is-loading mr-2"},{default:d(()=>[s(P)]),_:1})):f("",!0),o("span",null,a(e.$t("producer.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),g?.audio_url?(n(),v(S,{key:0,onClick:A(C=>e.onDownload(C,g?.audio_url),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.download_audio")),1)]),_:2},1032,["onClick"])):f("",!0),s(S,{disabled:e.isFetchingWav,onClick:C=>e.handleWavDownload(g)},{default:d(()=>[o("div",$s,[e.isFetchingWav?(n(),v(_,{key:0,class:"is-loading mr-2"},{default:d(()=>[s(P)]),_:1})):f("",!0),o("span",null,a(e.$t("producer.button.download_wav")),1)])]),_:2},1032,["disabled","onClick"])]),_:2},1024)]),default:d(()=>[o("span",hs,[s(y,{effect:"dark",content:e.$t("producer.button.download"),placement:"top"},{default:d(()=>[g?.audio_url||g?.video_url?(n(),v(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):f("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(O,null,{dropdown:d(()=>[s(M,null,{default:d(()=>[g?.audio_url?(n(),v(S,{key:0,onClick:A(C=>e.onExtend(C,g),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.extend")),1)]),_:2},1032,["onClick"])):f("",!0),g.id?(n(),v(S,{key:1,onClick:A(C=>e.onGetStems(g.id),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.get_stems")),1)]),_:2},1032,["onClick"])):f("",!0),g.id?(n(),v(S,{key:2,onClick:A(C=>e.onGetAllStems(g.id),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.all_stems")),1)]),_:2},1032,["onClick"])):f("",!0),s(S,{onClick:A(C=>e.onCover(g),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id?(n(),v(S,{key:3,onClick:A(C=>e.onVariation(g),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.variation")),1)]),_:2},1032,["onClick"])):f("",!0),g?.id?(n(),v(S,{key:4,onClick:A(C=>e.onSwapVocals(g.id),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.swap_vocals")),1)]),_:2},1032,["onClick"])):f("",!0),g?.id?(n(),v(S,{key:5,onClick:A(C=>e.onSwapInstrumentals(g.id),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.swap_instrumentals")),1)]),_:2},1032,["onClick"])):f("",!0),g?.id?(n(),v(S,{key:6,onClick:A(C=>e.onReplaceSection(g),["stop"])},{default:d(()=>[U(a(e.$t("producer.button.replace_section")),1)]),_:2},1032,["onClick"])):f("",!0)]),_:2},1024)]),default:d(()=>[o("span",gs,[s(y,{effect:"dark",content:e.$t("producer.button.more"),placement:"top"},{default:d(()=>[g?.audio_url||g?.video_url?(n(),v(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):f("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,is))),128))])}const ys=V(ns,[["render",vs]]),ks={class:"player-slider"},bs=b({__name:"PlayerSlider",setup(e){const t=N(),l=T({get:()=>t.state.producer?.audio?.progress,set:u=>t.commit("producer/setAudio",{...t.state.producer.audio,progress:u})}),i=T({get:()=>t.state.producer?.audio?.duration,set:u=>t.commit("producer/setAudio",{...t.state.producer.audio,duration:u})}),h=()=>{},p=u=>t.dispatch("producer/setAudio",{...t.state.producer.audio,progress:u});return(u,m)=>(n(),c("div",ks,[s(E(x),{modelValue:l.value,"onUpdate:modelValue":m[0]||(m[0]=_=>l.value=_),"show-tooltip":!1,min:0,max:i.value,onChange:p,onInput:h},null,8,["modelValue","max"])]))}}),ws={class:"flex player-song"},Cs=["src"],Vs={class:"ml-2 text-xs flex flex-col justify-between"},Ss={class:"w-52 2xl:w-96 cursor-pointer truncate"},Us={class:"flex"},Ps={class:"ml-2 text-dc"},As=b({__name:"PlayerSong",setup(e){const t=N(),l=T({get:()=>t.state.producer.audio,set:i=>t.commit("producer/setAudio",i)});return ke(l,(i,h)=>{if(i?.audio_url!==h?.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("producer/setAudio",{...t.state.producer.audio,progress:p.currentTime})})}),t.commit("producer/setAudio",{...t.state.producer.audio,object:p})}else if(i?.progress!==h?.progress&&Math.abs(i.progress-i.object.currentTime)>2){console.log("progress changed",i.progress);const p=t.state.producer.audio;p.object&&(p.object.currentTime=p.progress)}else i?.state!==h?.state&&(console.log("state changed",i.state),i.object&&(i.state==="playing"?i.object.play():i.object.pause()));i?.volume!==h?.volume&&(console.log("volume changed",i.volume),i.object&&(i.object.volume=i.volume/100))}),(i,h)=>(n(),c("div",ws,[o("img",{alt:"",class:"w-11 h-11 rounded",src:l.value?.image_url||E(Ae)},null,8,Cs),o("div",Vs,[o("div",Ss,[o("div",Us,[o("span",null,a(l.value?.title||"Music"),1),o("span",Ps,"- "+a(l.value?.style||"SmallRuralDog"),1)])])])]))}}),Es={class:"flex justify-end items-center gap-x-2.5"},Ts={class:"text-xs"},Fs=b({__name:"PlayerAction",setup(e){const t=N(),l=T({get:()=>t.state.producer?.audio?.progress,set:h=>t.commit("producer/setAudio",{...t.state.producer.audio,progress:h})}),i=T({get:()=>t.state.producer?.audio?.duration,set:h=>t.commit("producer/setAudio",{...t.state.producer.audio,duration:h})});return(h,p)=>(n(),c("div",Es,[o("span",Ts,a(E(j)(l.value))+" / "+a(E(j)(i.value)),1)]))}}),Is={class:"player-volume flex flex-col items-center pt-2"},Ls={class:"text-sm mt-3"},Gs=b({__name:"PlayerVolumeSlider",setup(e){const t=N(),l=T({get:()=>t.state.producer.audio?.volume,set:p=>t.commit("producer/setAudio",{...t.state.producer.audio,volume:p})}),i=T({get:()=>t.state.producer.audio?.muted,set:p=>t.commit("producer/setAudio",{...t.state.producer.audio,muted:p})}),h=p=>t.dispatch("producer/setVolume",p);return(p,u)=>(n(),c("div",Is,[s(E(x),{modelValue:l.value,"onUpdate:modelValue":u[0]||(u[0]=m=>l.value=m),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:i.value,onInput:h},null,8,["modelValue","disabled"]),o("div",Ls,a(l.value),1)]))}}),js={class:"flex items-center justify-center gap-x-3"},Ds=b({__name:"PlayerController",setup(e){const t=N(),l=()=>t.dispatch("producer/setAudio",{...t.state.producer.audio,state:t.state.producer.audio.state==="playing"?"paused":"playing"}),i=T(()=>t.state.producer.audio);return(h,p)=>(n(),c("div",js,[s(ee,{icon:i.value?.state==="playing"?E(Ee):E(Te),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:l},null,8,["icon"]),s(E(_e),{placement:"top",width:"50px",trigger:"click"},{reference:d(()=>[s(ee,{icon:E(Fe),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:d(()=>[s(Gs)]),_:1})]))}}),Rs={class:"flex flex-col items-stretch h-20"},Zs={class:"flex grow px-5 items-center"},zs={class:"flex-1"},Ns={class:"flex-1"},Ms={class:"flex-1"},Os=b({__name:"Player",setup(e){return(t,l)=>(n(),c("div",Rs,[s(bs),o("div",Zs,[o("div",zs,[s(As)]),o("div",Ns,[s(Ds)]),o("div",Ms,[s(Fs)])])]))}}),Bs=b({name:"RecentPanel",components:{ElSkeletonItem:ge,ElSkeleton:$e,TaskPreview:ys,Player:Os,NoTasks:Ge,ScrollList:Ue},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.producer?.tasks,items:this.$store.state.producer?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),qs={key:0,class:"tasks"},Ws={class:"left w-[70px] p-[10px] flex items-center"},Ks={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},Hs={key:2,class:"w-full flex-1 flex items-center justify-center"},Js={class:"h-20"};function Xs(e,t,l,i,h,p){const u=r("el-skeleton-item"),m=r("el-skeleton"),_=r("task-preview"),$=r("scroll-list"),k=r("no-tasks"),y=r("player");return n(),c(G,null,[e.tasks?.items===void 0?(n(),c("div",qs,[(n(),c(G,null,q(3,P=>o("div",{key:P,class:"flex"},[o("div",Ws,[s(m,{animated:""},{template:d(()=>[s(u,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),o("div",Ks,[s(m,{animated:""},{template:d(()=>[s(u,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),s(u,{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]=P=>e.$emit("reach-top"))},{default:d(()=>[(n(!0),c(G,null,q(e.tasks?.items,(P,S)=>(n(),v(_,{key:S,"model-value":P,class:"preview"},null,8,["model-value"]))),128))]),_:1},8,["loading"])):f("",!0),e.tasks?.items?.length===0?(n(),c("div",Hs,[s(k)])):f("",!0),z(o("div",Js,[s(y)],512),[[be,!!e.$store?.state?.producer?.audio?.object]])],64)}const Qs=V(Bs,[["render",Xs]]),Ys=b({name:"TaskPreview",components:{IconPicture:ye,ElImage:Z,ElAvatar:ve,ElIcon:K},computed:{audio(){return this.$store.state.producer?.audio}}}),xs={key:0,class:"size-full overflow-hidden"},en={class:"relative h-[300px]"},tn={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},on={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"},sn={class:"p-4"},nn={class:"flex items-center font-bold mb-2"},rn={class:"text-[var(--el-text-color-regular)] mb-2"},an={class:"text-xs text-[var(--el-text-color-regular)]"},ln={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},cn={key:1,class:"w-full h-full"};function dn(e,t,l,i,h,p){const u=r("icon-picture"),m=r("el-icon"),_=r("el-image"),$=r("el-avatar");return e.audio?.object?(n(),c("div",xs,[o("div",en,[s(_,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:d(()=>[o("div",tn,[s(m,{class:"text-3xl"},{default:d(()=>[s(u)]),_:1})])]),_:1},8,["src"]),o("h2",on,a(e.audio?.title),1)]),o("div",sn,[o("div",nn,[s($,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),o("span",null,a(e.audio?.title),1)]),o("p",rn,a(e.audio?.style),1),o("p",an,a(e.$dayjs.format(e.audio?.created_at)),1),o("div",ln,[o("p",null,a(e.audio?.lyric),1)])])])):(n(),c("div",cn))}const un=V(Ys,[["render",dn]]),pn="https://webhook.acedata.cloud/producer",mn=b({name:"ProducerIndex",components:{Layout:Oe,ConfigPanel:os,RecentPanel:Qs,PreviewPanel:un},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.producer?.status?.getApplications===L.Request},tasksLoading(){return this.$store.state.producer?.status?.getTasks===L.Request||this.fetchingTasks},service(){return this.$store.state.producer.service},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},initializing(){return this.$store.state.producer.status.getApplications===L.Request},needApply(){return this.$store.state.producer.status.getApplications===L.Success&&!this.application},application(){return this.$store.state.producer.application},tasks(){return this.$store.state.producer.tasks},applications(){return this.$store.state.producer.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 je({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("producer/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("producer/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ve.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Se&&w.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:l,createdAtMax:i}=e||{};console.debug("limit",t,"createdAtMin",l,"createdAtMax",i),this.fetchingTasks=!0;try{await this.$store.dispatch("producer/getTasks",{limit:t,createdAtMin:l,createdAtMax:i})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){const e={...this.config,callback_url:pn},t=this.credential?.token;if(!t){console.error("no token specified");return}w.info(this.$t("producer.message.startingTask")),I.audio(e,{token:t}).then(()=>{w.success(this.$t("producer.message.startTaskSuccess"))}).catch(l=>{w.error(l?.response?.data?.error?.message||this.$t("producer.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function fn(e,t,l,i,h,p){const u=r("config-panel"),m=r("recent-panel"),_=r("preview-panel"),$=r("layout");return n(),v($,null,{config:d(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:d(()=>[s(m,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),preview:d(()=>[s(_)]),_:1})}const An=V(mn,[["render",fn],["__scopeId","data-v-638e0ac5"]]);export{An as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as C}from"./index.es-Bqj83sQx.js";import{m as A,Y as P,u as U,w,G as D,F as M,j as L,a0 as j,a1 as O,H as z,a2 as B,L as q}from"./vendor-element-plus-DN048TGi.js";import{d as v,C as l,G as r,T as s,E as R,K as d,ai as o,D as a,R as i,Q as _,S as I,ag as T,J as S,M as V,c as N,O as $}from"./vendor-vue-BhXato7y.js";import{_ as b,au as F,ci as H,aN as J,aC as K,aI as Q,aJ as E}from"./index-muIEJvsu.js";import{p as Y}from"./pasteUploadMixin-BurWbGNQ.js";import{I as W,S as X}from"./ScrollList-ZiMJkMBw.js";import{I as Z}from"./ImagePreview-eVaabJZn.js";import{A as x}from"./Status-KsOIucfx.js";import{C as ee}from"./CopyToClipboard-DY-UF17o.js";import{l as se}from"./pagination-DLJ2pbsx.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-CIJ0oOq5.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-8bYQCSwj.js";const te=v({name:"LayoutHeadshots",components:{ElDrawer:P,ElButton:A,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ae={class:"main flex flex-row flex-1"},oe={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},ne={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function ie(e,t,m,u,k,y){const p=o("font-awesome-icon"),h=o("el-button"),n=o("el-drawer");return a(),l("div",ae,[r("div",oe,[R(e.$slots,"config",{},void 0,!0)]),r("div",ne,[R(e.$slots,"result",{},void 0,!0)]),s(h,{circle:"",class:"menu",onClick:t[0]||(t[0]=c=>e.drawer=!0)},{default:d(()=>[s(p,{icon:"fa-solid fa-gear"})]),_:1}),s(n,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=c=>e.drawer=c),"with-header":!1,size:"340px",class:"drawer"},{default:d(()=>[R(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const le=b(te,[["render",ie],["__scopeId","data-v-202b355b"]]),re=v({name:"ImageUrlsInput",components:{ElUpload:U,ElButton:A,InfoIcon:W,ImagePreview:Z,FontAwesomeIcon:C},mixins:[Y],data(){return{fileList:[],uploadUrl:F()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){w.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){w.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),ce={class:"field"},de={class:"title font-bold"},pe={class:"upload-wrapper"};function me(e,t,m,u,k,y){const p=o("image-preview"),h=o("font-awesome-icon"),n=o("el-button"),c=o("el-upload"),g=o("info-icon");return a(),l("div",ce,[r("h2",de,i(e.$t("headshots.name.endImageUrls")),1),r("div",pe,[s(c,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=f=>e.fileList=f),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value upload-wrapper",limit:2,multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:d(({file:f})=>[s(p,{url:f.url||f.response?.file_url,name:f.name,percentage:f.percentage,onRemove:G=>e.fileList.splice(e.fileList.indexOf(f),1)},null,8,["url","name","percentage","onRemove"])]),default:d(()=>[s(n,{size:"small",type:"primary",round:""},{default:d(()=>[s(h,{icon:"fa-solid fa-upload",class:"mr-1"}),_(" "+i(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),s(g,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const ue=b(re,[["render",me],["__scopeId","data-v-ca56051e"]]),he="fast",ge=v({name:"ModeSelector",components:{ElRadioButton:M,ElRadioGroup:D},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=he)}}),fe={class:"field"},_e={class:"title font-bold"};function $e(e,t,m,u,k,y){const p=o("el-radio-button"),h=o("el-radio-group");return a(),l("div",fe,[r("h2",_e,i(e.$t("headshots.name.mode")),1),s(h,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"mode"},{default:d(()=>[(a(!0),l(I,null,T(e.options,n=>(a(),S(p,{key:n.value,label:n.value},{default:d(()=>[_(i(n.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const ve=b(ge,[["render",$e],["__scopeId","data-v-e7702494"]]),be=v({name:"StylizeSelector",components:{ElTabs:O,ElTabPane:j,ElImage:L},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){console.debug("set template",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})}}}),ke={class:"field"},ye=["onClick"],we={class:"name"};function Ie(e,t,m,u,k,y){const p=o("el-image"),h=o("el-tab-pane"),n=o("el-tabs");return a(),l("div",ke,[s(n,{modelValue:e.tab,"onUpdate:modelValue":t[0]||(t[0]=c=>e.tab=c)},{default:d(()=>[(a(!0),l(I,null,T(e.elements,(c,g)=>(a(),S(h,{key:g,label:c.displayName,name:g,class:"pane"},{default:d(()=>[(a(!0),l(I,null,T(c.items,(f,G)=>(a(),l("div",{key:G,class:V({item:!0,active:e.value===f.value}),onClick:$s=>e.onToggle(f.value)},[s(p,{src:f.image,fit:"fill",class:"preview"},null,8,["src"]),r("span",we,i(f.label),1)],10,ye))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const Te=b(be,[["render",Ie],["__scopeId","data-v-be4bd25d"]]),Se=v({name:"PresetPanel",components:{ModeSelector:ve,ImageUrlsInput:ue,ElButton:A,FontAwesomeIcon:C,ElementsSelector:Te},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),Ve={class:"panel"},Ee={class:"config"},Ce={class:"actions"};function Re(e,t,m,u,k,y){const p=o("elements-selector"),h=o("mode-selector"),n=o("image-urls-input"),c=o("font-awesome-icon"),g=o("el-button");return a(),l("div",Ve,[r("div",Ee,[s(p,{class:"mb-4"}),s(h,{class:"mb-4"}),s(n,{class:"mb-4"}),r("div",Ce,[s(g,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[s(c,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ae=b(Se,[["render",Re],["__scopeId","data-v-848739f6"]]),Ge=v({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:N(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:u=>{window.open(u,"_blank")}}}}),Le={class:"image-gallery"},Pe=["src"],Ue=["onClick"];function De(e,t,m,u,k,y){return a(),l("div",Le,[(a(!0),l(I,null,T(e.images,(p,h)=>(a(),l("div",{key:h,class:"image-container"},[r("img",{src:p.image_url,alt:"Image"},null,8,Pe),p.image_url?(a(),l("button",{key:0,class:"view-button",onClick:n=>e.viewImage(p.image_url)},i(e.$t("headshots.button.viewImage")),9,Ue)):$("",!0)]))),128))])}const Me=b(Ge,[["render",De],["__scopeId","data-v-42f0a7be"]]),je=v({name:"TaskPreview",components:{ElImage:L,CopyToClipboard:ee,FontAwesomeIcon:C,ElAlert:z,ImageGallery:Me},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onReload(e){const t=e.target,m=new URL(t.src),u=m.searchParams.get("retry");if(!u)m.searchParams.set("retry","1");else if(parseInt(u)<2)m.searchParams.set("retry",(parseInt(u)+1).toString());else return;t.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),Oe={class:"preview"},ze={class:"left"},Be={class:"main"},qe={class:"bot"},Ne={class:"datetime"},Fe={class:"info"},He={key:0,class:"prompt mt-2"},Je={key:0},Ke={key:1},Qe={key:0,class:V({content:!0,failed:!0})},Ye={class:"image-wrapper"},We={class:"description"},Xe={key:1,class:V({content:!0})},Ze={class:"description"},xe={class:"description"},es={class:"description"},ss={key:2,class:V({content:!0})},ts={class:"description"},as={key:3,class:V({content:!0})},os={class:"description"};function ns(e,t,m,u,k,y){const p=o("el-image"),h=o("image-gallery"),n=o("font-awesome-icon"),c=o("copy-to-clipboard"),g=o("el-alert");return a(),l("div",Oe,[r("div",ze,[s(p,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),r("div",Be,[r("div",qe,[_(i(e.$t("headshots.name.headshotsBot"))+" ",1),r("span",Ne,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),r("div",Fe,[e.modelValue?.request?.template?(a(),l("p",He,[_(i(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?$("",!0):(a(),l("span",Je," - ("+i(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(a(),l("span",Ke," - ("+i(e.$t("headshots.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(a(),l("div",Qe,[r("div",Ye,[s(h,{"model-value":e.modelValue},null,8,["model-value"])]),s(g,{closable:!1,class:"mt-2 success"},{default:d(()=>[r("p",We,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(a(),l("div",Xe,[s(g,{closable:!1,class:"failure"},{template:d(()=>[s(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",Ze,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),r("p",xe,[s(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),s(c,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),r("p",es,[s(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("headshots.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),s(c,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?$("",!0):(a(),l("div",ss,[s(g,{closable:!1,class:"info"},{template:d(()=>[s(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",ts,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(a(),l("div",as,[s(g,{closable:!1,class:"info"},{template:d(()=>[s(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",os,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0)])])}const is=b(je,[["render",ns],["__scopeId","data-v-91e2f073"]]),ls=v({name:"RecentPanel",components:{TaskPreview:is,ElSkeleton:q,ElSkeletonItem:B,ScrollList:X},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),rs={key:0,class:"tasks"},cs={class:"left"},ds={class:"main"},ps={key:1,class:"tasks"},ms={key:2,class:"description"};function us(e,t,m,u,k,y){const p=o("el-skeleton-item"),h=o("el-skeleton"),n=o("task-preview"),c=o("scroll-list");return a(),S(c,{ref:"scrollList",class:"panel recent",loading:e.loading,onReachTop:t[0]||(t[0]=g=>e.$emit("reach-top"))},{default:d(()=>[e.tasks?.items===void 0?(a(),l("div",rs,[(a(),l(I,null,T(3,g=>r("div",{key:g,class:"task placeholder"},[r("div",cs,[s(h,{animated:""},{template:d(()=>[s(p,{variant:"image",class:"avatar"})]),_:1})]),r("div",ds,[s(h,{animated:""},{template:d(()=>[s(p,{variant:"p",class:"title"}),s(p,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),l("div",ps,[(a(!0),l(I,null,T(e.tasks?.items,(g,f)=>(a(),S(n,{key:f,"model-value":g,class:"preview"},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(a(),l("p",ms,i(e.$t("headshots.message.noTasks")),1)):$("",!0)]),_:1},8,["loading"])}const hs=b(ls,[["render",us],["__scopeId","data-v-ffd55c16"]]),gs="https://webhook.acedata.cloud/headshots",fs=v({name:"HeadshotsIndex",components:{ConfigPanel:Ae,Layout:le,ApplicationStatus:x,RecentPanel:hs},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.headshots?.status?.getApplications===E.Request},tasksLoading(){return this.$store.state.headshots?.status?.getTasks===E.Request||this.fetchingTasks},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===E.Request},needApply(){return this.$store.state.headshots.status.getApplications===E.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await se({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("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){K.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Q&&w.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:m,createdAtMax:u}=e||{};console.debug("limit",t,"createdAtMin",m,"createdAtMax",u),this.fetchingTasks=!0;try{await this.$store.dispatch("headshots/getTasks",{limit:t,createdAtMin:m,createdAtMax:u})}finally{this.fetchingTasks=!1}},async onGeneratePicture(){const e={...this.config,callback_url:gs},t=this.credential?.token;if(!t){console.error("no token specified");return}w.info(this.$t("headshots.message.startingTask")),H.generate(e,{token:t}).then(()=>{w.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===J?w.error(this.$t("headshots.message.usedUp")):w.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function _s(e,t,m,u,k,y){const p=o("config-panel"),h=o("application-status"),n=o("recent-panel"),c=o("layout");return a(),S(c,null,{config:d(()=>[s(p,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:d(()=>[s(h,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:t[0]||(t[0]=g=>e.$store.dispatch("headshots/setApplication",g))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),s(n,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Ls=b(fs,[["render",_s],["__scopeId","data-v-6cafffbd"]]);export{Ls as default};
|
|
1
|
+
import{F as C}from"./index.es-DMehEjXB.js";import{m as A,X as P,u as U,w,G as D,F as j,j as L,a0 as M,a1 as O,H as z,a2 as B,L as q}from"./vendor-element-plus-CmP9-3lX.js";import{d as v,C as l,G as r,T as s,E as R,K as d,ai as o,D as a,R as i,Q as _,S as T,ag as I,J as S,M as V,c as F,O as $}from"./vendor-vue-BhXato7y.js";import{_ as b,av as N,cj as H,aO as J,aD as K,aJ as Q,aK as E}from"./index-CtkD2JaX.js";import{p as X}from"./pasteUploadMixin-BurWbGNQ.js";import{I as W,S as Y}from"./ScrollList-OteSDitY.js";import{I as Z}from"./ImagePreview-B5F24-Vs.js";import{A as x}from"./Status-De0L9Wnu.js";import{C as ee}from"./CopyToClipboard-cTbsayFn.js";import{l as se}from"./pagination-DLJ2pbsx.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-C5RrfhAy.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-8bYQCSwj.js";const te=v({name:"LayoutHeadshots",components:{ElDrawer:P,ElButton:A,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ae={class:"main flex flex-row flex-1"},oe={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},ne={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function ie(e,t,m,h,k,y){const p=o("font-awesome-icon"),u=o("el-button"),n=o("el-drawer");return a(),l("div",ae,[r("div",oe,[R(e.$slots,"config",{},void 0,!0)]),r("div",ne,[R(e.$slots,"result",{},void 0,!0)]),s(u,{circle:"",class:"menu",onClick:t[0]||(t[0]=c=>e.drawer=!0)},{default:d(()=>[s(p,{icon:"fa-solid fa-gear"})]),_:1}),s(n,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=c=>e.drawer=c),"with-header":!1,size:"340px",class:"drawer"},{default:d(()=>[R(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const le=b(te,[["render",ie],["__scopeId","data-v-202b355b"]]),re=v({name:"ImageUrlsInput",components:{ElUpload:U,ElButton:A,InfoIcon:W,ImagePreview:Z,FontAwesomeIcon:C},mixins:[X],data(){return{fileList:[],uploadUrl:N()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){w.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){w.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),ce={class:"field"},de={class:"title font-bold"},pe={class:"upload-wrapper"};function me(e,t,m,h,k,y){const p=o("image-preview"),u=o("font-awesome-icon"),n=o("el-button"),c=o("el-upload"),g=o("info-icon");return a(),l("div",ce,[r("h2",de,i(e.$t("headshots.name.endImageUrls")),1),r("div",pe,[s(c,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=f=>e.fileList=f),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value upload-wrapper",limit:2,multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:d(({file:f})=>[s(p,{url:f.url||f.response?.file_url,name:f.name,percentage:f.percentage,onRemove:G=>e.fileList.splice(e.fileList.indexOf(f),1)},null,8,["url","name","percentage","onRemove"])]),default:d(()=>[s(n,{size:"small",type:"primary",round:""},{default:d(()=>[s(u,{icon:"fa-solid fa-upload",class:"mr-1"}),_(" "+i(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),s(g,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const he=b(re,[["render",me],["__scopeId","data-v-ca56051e"]]),ue="fast",ge=v({name:"ModeSelector",components:{ElRadioButton:j,ElRadioGroup:D},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=ue)}}),fe={class:"field"},_e={class:"title font-bold"};function $e(e,t,m,h,k,y){const p=o("el-radio-button"),u=o("el-radio-group");return a(),l("div",fe,[r("h2",_e,i(e.$t("headshots.name.mode")),1),s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"mode"},{default:d(()=>[(a(!0),l(T,null,I(e.options,n=>(a(),S(p,{key:n.value,label:n.value},{default:d(()=>[_(i(n.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const ve=b(ge,[["render",$e],["__scopeId","data-v-e7702494"]]),be=v({name:"StylizeSelector",components:{ElTabs:O,ElTabPane:M,ElImage:L},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){console.debug("set template",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})}}}),ke={class:"field"},ye=["onClick"],we={class:"name"};function Te(e,t,m,h,k,y){const p=o("el-image"),u=o("el-tab-pane"),n=o("el-tabs");return a(),l("div",ke,[s(n,{modelValue:e.tab,"onUpdate:modelValue":t[0]||(t[0]=c=>e.tab=c)},{default:d(()=>[(a(!0),l(T,null,I(e.elements,(c,g)=>(a(),S(u,{key:g,label:c.displayName,name:g,class:"pane"},{default:d(()=>[(a(!0),l(T,null,I(c.items,(f,G)=>(a(),l("div",{key:G,class:V({item:!0,active:e.value===f.value}),onClick:$s=>e.onToggle(f.value)},[s(p,{src:f.image,fit:"fill",class:"preview"},null,8,["src"]),r("span",we,i(f.label),1)],10,ye))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const Ie=b(be,[["render",Te],["__scopeId","data-v-be4bd25d"]]),Se=v({name:"PresetPanel",components:{ModeSelector:ve,ImageUrlsInput:he,ElButton:A,FontAwesomeIcon:C,ElementsSelector:Ie},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),Ve={class:"panel"},Ee={class:"config"},Ce={class:"actions"};function Re(e,t,m,h,k,y){const p=o("elements-selector"),u=o("mode-selector"),n=o("image-urls-input"),c=o("font-awesome-icon"),g=o("el-button");return a(),l("div",Ve,[r("div",Ee,[s(p,{class:"mb-4"}),s(u,{class:"mb-4"}),s(n,{class:"mb-4"}),r("div",Ce,[s(g,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[s(c,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ae=b(Se,[["render",Re],["__scopeId","data-v-848739f6"]]),Ge=v({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:F(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:h=>{window.open(h,"_blank")}}}}),Le={class:"image-gallery"},Pe=["src"],Ue=["onClick"];function De(e,t,m,h,k,y){return a(),l("div",Le,[(a(!0),l(T,null,I(e.images,(p,u)=>(a(),l("div",{key:u,class:"image-container"},[r("img",{src:p.image_url,alt:"Image"},null,8,Pe),p.image_url?(a(),l("button",{key:0,class:"view-button",onClick:n=>e.viewImage(p.image_url)},i(e.$t("headshots.button.viewImage")),9,Ue)):$("",!0)]))),128))])}const je=b(Ge,[["render",De],["__scopeId","data-v-42f0a7be"]]),Me=v({name:"TaskPreview",components:{ElImage:L,CopyToClipboard:ee,FontAwesomeIcon:C,ElAlert:z,ImageGallery:je},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onReload(e){const t=e.target,m=new URL(t.src),h=m.searchParams.get("retry");if(!h)m.searchParams.set("retry","1");else if(parseInt(h)<2)m.searchParams.set("retry",(parseInt(h)+1).toString());else return;t.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),Oe={class:"preview"},ze={class:"left"},Be={class:"main"},qe={class:"bot"},Fe={class:"datetime"},Ne={class:"info"},He={key:0,class:"prompt mt-2"},Je={key:0},Ke={key:1},Qe={key:0,class:V({content:!0,failed:!0})},Xe={class:"image-wrapper"},We={class:"description"},Ye={key:1,class:V({content:!0})},Ze={class:"description"},xe={class:"description"},es={class:"description"},ss={key:2,class:V({content:!0})},ts={class:"description"},as={key:3,class:V({content:!0})},os={class:"description"};function ns(e,t,m,h,k,y){const p=o("el-image"),u=o("image-gallery"),n=o("font-awesome-icon"),c=o("copy-to-clipboard"),g=o("el-alert");return a(),l("div",Oe,[r("div",ze,[s(p,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),r("div",Be,[r("div",qe,[_(i(e.$t("headshots.name.headshotsBot"))+" ",1),r("span",Fe,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),r("div",Ne,[e.modelValue?.request?.template?(a(),l("p",He,[_(i(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?$("",!0):(a(),l("span",Je," - ("+i(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(a(),l("span",Ke," - ("+i(e.$t("headshots.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(a(),l("div",Qe,[r("div",Xe,[s(u,{"model-value":e.modelValue},null,8,["model-value"])]),s(g,{closable:!1,class:"mt-2 success"},{default:d(()=>[r("p",We,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(a(),l("div",Ye,[s(g,{closable:!1,class:"failure"},{template:d(()=>[s(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",Ze,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),r("p",xe,[s(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),s(c,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),r("p",es,[s(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("headshots.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),s(c,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?$("",!0):(a(),l("div",ss,[s(g,{closable:!1,class:"info"},{template:d(()=>[s(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",ts,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(a(),l("div",as,[s(g,{closable:!1,class:"info"},{template:d(()=>[s(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",os,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0)])])}const is=b(Me,[["render",ns],["__scopeId","data-v-91e2f073"]]),ls=v({name:"RecentPanel",components:{TaskPreview:is,ElSkeleton:q,ElSkeletonItem:B,ScrollList:Y},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),rs={key:0,class:"tasks"},cs={class:"left"},ds={class:"main"},ps={key:1,class:"tasks"},ms={key:2,class:"description"};function hs(e,t,m,h,k,y){const p=o("el-skeleton-item"),u=o("el-skeleton"),n=o("task-preview"),c=o("scroll-list");return a(),S(c,{ref:"scrollList",class:"panel recent",loading:e.loading,onReachTop:t[0]||(t[0]=g=>e.$emit("reach-top"))},{default:d(()=>[e.tasks?.items===void 0?(a(),l("div",rs,[(a(),l(T,null,I(3,g=>r("div",{key:g,class:"task placeholder"},[r("div",cs,[s(u,{animated:""},{template:d(()=>[s(p,{variant:"image",class:"avatar"})]),_:1})]),r("div",ds,[s(u,{animated:""},{template:d(()=>[s(p,{variant:"p",class:"title"}),s(p,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),l("div",ps,[(a(!0),l(T,null,I(e.tasks?.items,(g,f)=>(a(),S(n,{key:f,"model-value":g,class:"preview"},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(a(),l("p",ms,i(e.$t("headshots.message.noTasks")),1)):$("",!0)]),_:1},8,["loading"])}const us=b(ls,[["render",hs],["__scopeId","data-v-ffd55c16"]]),gs="https://webhook.acedata.cloud/headshots",fs=v({name:"HeadshotsIndex",components:{ConfigPanel:Ae,Layout:le,ApplicationStatus:x,RecentPanel:us},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.headshots?.status?.getApplications===E.Request},tasksLoading(){return this.$store.state.headshots?.status?.getTasks===E.Request||this.fetchingTasks},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===E.Request},needApply(){return this.$store.state.headshots.status.getApplications===E.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await se({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("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){K.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Q&&w.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:m,createdAtMax:h}=e||{};console.debug("limit",t,"createdAtMin",m,"createdAtMax",h),this.fetchingTasks=!0;try{await this.$store.dispatch("headshots/getTasks",{limit:t,createdAtMin:m,createdAtMax:h})}finally{this.fetchingTasks=!1}},async onGeneratePicture(){const e={...this.config,callback_url:gs},t=this.credential?.token;if(!t){console.error("no token specified");return}w.info(this.$t("headshots.message.startingTask")),H.generate(e,{token:t}).then(()=>{w.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===J?w.error(this.$t("headshots.message.usedUp")):w.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function _s(e,t,m,h,k,y){const p=o("config-panel"),u=o("application-status"),n=o("recent-panel"),c=o("layout");return a(),S(c,null,{config:d(()=>[s(p,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:d(()=>[s(u,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:t[0]||(t[0]=g=>e.$store.dispatch("headshots/setApplication",g))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),s(n,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Ls=b(fs,[["render",_s],["__scopeId","data-v-6cafffbd"]]);export{Ls as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as L}from"./index.es-DMehEjXB.js";import{m as R,X as q,O as j,P as D,k as z,u as N,w as E,t as H,q as K,H as X,j as J}from"./vendor-element-plus-CmP9-3lX.js";import{d as g,C as r,G as l,T as t,E as G,K as u,ai as s,D as n,R as a,S as A,ag as U,J as y,M as I,Y as Q,O as v,Q as h,L as S,U as T}from"./vendor-vue-BhXato7y.js";import{_ as $,bT as W,bU as Y,bV as Z,bW as x,av as ee,bX as te,aO as oe,aK as O}from"./index-CtkD2JaX.js";import{I as P,S as se}from"./ScrollList-OteSDitY.js";import{V as M}from"./VideoPlayer-DcumvLkR.js";import{p as ne}from"./pasteUploadMixin-BurWbGNQ.js";import{I as ae}from"./ImagePreview-B5F24-Vs.js";import{C as le}from"./Consumption-DEB600BC.js";import{a as ie}from"./price-lQeFOa8Q.js";import{C as re}from"./CopyToClipboard-cTbsayFn.js";import{B as ce}from"./BotPlaceholder-BV2w6Q4w.js";import{N as de}from"./NoTasks-ZsLHgPuo.js";import{l as ue}from"./pagination-DLJ2pbsx.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-C5RrfhAy.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-8bYQCSwj.js";import"./vue-plyr-QZFBikSk.js";const pe=g({name:"LayoutVeo",components:{ElDrawer:q,ElButton:R,FontAwesomeIcon:L},data(){return{drawer:!1}}}),me={class:"main flex flex-row flex-1"},fe={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},ve={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function _e(e,o,m,_,b,k){const c=s("font-awesome-icon"),d=s("el-button"),i=s("el-drawer");return n(),r("div",me,[l("div",fe,[G(e.$slots,"config",{},void 0,!0)]),l("div",ve,[G(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=w=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=w=>e.drawer=w),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const he=$(pe,[["render",_e],["__scopeId","data-v-816b984c"]]),ge=g({name:"ModelSelector",components:{ElSelect:D,ElOption:j},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"veo2",label:"veo2"},{value:"veo2-fast",label:"veo2-fast"},{value:"veo3",label:"veo3"},{value:"veo3-fast",label:"veo3-fast"},{value:"veo31-fast",label:"veo31-fast"},{value:"veo31",label:"veo31"},{value:"veo31-fast-ingredients",label:"veo31-fast-ingredients"}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||(this.value=W)}}),$e={class:"field"},be={class:"title font-bold"};function ke(e,o,m,_,b,k){const c=s("el-option"),d=s("el-select");return n(),r("div",$e,[l("h2",be,a(e.$t("veo.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select")},{default:u(()=>[(n(!0),r(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const we=$(ge,[["render",ke],["__scopeId","data-v-a59d89c9"]]),ye=g({name:"ActionSelector",components:{ElSelect:D,ElOption:j},data(){return{}},computed:{options(){return[{value:"text2video",label:this.$t("veo.button.action1")},{value:"image2video",label:this.$t("veo.button.action2")},{value:"get1080p",label:this.$t("veo.button.action3")}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||(this.value=Y)}}),Ve={class:"field"},Se={class:"title font-bold"},Te={class:"float-left"};function Ee(e,o,m,_,b,k){const c=s("el-option"),d=s("el-select");return n(),r("div",Ve,[l("h2",Se,a(e.$t("veo.name.action")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select"),clearable:""},{default:u(()=>[(n(!0),r(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},{default:u(()=>[l("span",Te,a(i.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=$(ye,[["render",Ee],["__scopeId","data-v-ba5abc8a"]]),Ce=g({name:"TranslationSelector",components:{ElSwitch:z,InfoIcon:P},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug("set translation",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=Z)}}),Ae={class:"relative"},Le={class:"flex justify-between"},Re={class:"flex justify-start items-center"},Ue={class:"text-sm font-bold"},Ge={class:"flex justify-end items-center"};function Pe(e,o,m,_,b,k){const c=s("info-icon"),d=s("el-switch");return n(),r("div",Ae,[l("div",Le,[l("div",Re,[l("span",Ue,a(e.$t("veo.name.translation")),1),t(c,{content:e.$t("veo.description.translation")},null,8,["content"])]),l("div",Ge,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value"},null,8,["modelValue"])])])])}const Oe=$(Ce,[["render",Pe]]),je=g({name:"AspectRatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=x)}}),De={class:"text-sm font-bold mb-2 block"},Me={class:"items"},Be=["onClick"],Fe={class:"name"};function qe(e,o,m,_,b,k){return n(),r("div",null,[l("span",De,a(e.$t("veo.name.ratio")),1),l("div",Me,[(n(!0),r(A,null,U(e.options,(c,d)=>(n(),r("div",{key:d,class:I({active:e.active===d,item:!0}),onClick:i=>e.value=c.value},[l("div",{class:I(["preview",c.label])},[l("div",{class:"rect",style:Q({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",Fe,a(c.label),1)],10,Be))),128))])])}const ze=$(je,[["render",qe],["__scopeId","data-v-0f16be77"]]),Ne=g({name:"VideoFromInput",components:{VideoPlayer:M},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.veo?.config}}}),He={class:"relative"},Ke={class:"flex mb-2"},Xe={class:"text-sm font-bold"};function Je(e,o,m,_,b,k){const c=s("video-player");return n(),r("div",He,[l("div",Ke,[l("span",Xe,a(e.$t("veo.name.action3")),1)]),l("div",null,[e.config?.video_url?(n(),y(c,{key:0,src:e.config?.video_url},null,8,["src"])):v("",!0)])])}const Qe=$(Ne,[["render",Je]]),We=g({name:"StartEndImage",components:{ElUpload:N,ElButton:R,InfoIcon:P,FontAwesomeIcon:L,ImagePreview:ae},mixins:[ne],emits:["change"],data(){return{fileList:[],uploadUrl:ee()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartEndImageUrl()},methods:{onExceed(){E.warning(this.$t("veo.message.uploadReferencesExceed"))},onError(){E.error(this.$t("veo.message.uploadReferencesError"))},onSetStartEndImageUrl(){const e=this.urls;this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Ye={class:"relative"},Ze={class:"flex justify-between"},xe={class:"flex justify-start items-center"},et={class:"text-sm font-bold"};function tt(e,o,m,_,b,k){const c=s("info-icon"),d=s("image-preview"),i=s("font-awesome-icon"),w=s("el-button"),f=s("el-upload");return n(),r("div",Ye,[l("div",Ze,[l("div",xe,[l("span",et,a(e.$t("veo.name.startEndImage")),1),t(c,{content:e.$t("veo.description.uploadStartEndImage")},null,8,["content"])])]),t(f,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:2,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:u(()=>[t(w,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(i,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+a(e.$t("veo.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ot=$(We,[["render",tt],["__scopeId","data-v-b8ddb8fb"]]),st="",nt=g({name:"PromptInput",components:{ElInput:H,InfoIcon:P},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=st)}}),at={class:"field"},lt={class:"box"},it={class:"title font-bold"};function rt(e,o,m,_,b,k){const c=s("info-icon"),d=s("el-input");return n(),r("div",at,[l("div",lt,[l("h2",it,a(e.$t("veo.name.prompt")),1),t(c,{content:e.$t("veo.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=i=>e.prompt=i),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("veo.placeholder.prompt")},null,8,["modelValue","placeholder"])])}const ct=$(nt,[["render",rt],["__scopeId","data-v-84c55ea0"]]),dt=g({name:"ConfigPanel",components:{ElButton:R,Consumption:le,FontAwesomeIcon:L,PromptInput:ct,ModelSelector:we,StartEndImage:ot,ActionSelector:Ie,VideoFromInput:Qe,TranslationSelector:Oe,AspectRatioSelector:ze},emits:["generate"],computed:{config(){return this.$store.state.veo?.config},consumption(){return ie(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),ut={class:"flex flex-col h-full"},pt={class:"flex-1 overflow-y-auto p-5"},mt={class:"flex flex-col items-center justify-center px-5 pb-5"};function ft(e,o,m,_,b,k){const c=s("video-from-input"),d=s("action-selector"),i=s("translation-selector"),w=s("aspect-ratio-selector"),f=s("prompt-input"),p=s("model-selector"),V=s("start-end-image"),C=s("consumption"),B=s("font-awesome-icon"),F=s("el-button");return n(),r("div",ut,[l("div",pt,[S(t(c,{class:"mb-4"},null,512),[[T,e.config?.action==="get1080p"]]),t(d,{class:"mb-4"}),S(t(i,{class:"mb-4"},null,512),[[T,e.config?.action!=="get1080p"]]),S(t(w,{class:"mb-4"},null,512),[[T,e.config?.action==="image2video"]]),S(t(f,{class:"mb-4"},null,512),[[T,e.config?.action!=="get1080p"]]),S(t(p,{class:"mb-4"},null,512),[[T,e.config?.action!=="get1080p"]]),S(t(V,{class:"mb-2"},null,512),[[T,e.config?.action==="image2video"]])]),l("div",mt,[t(C,{value:e.consumption,service:e.service},null,8,["value","service"]),t(F,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(B,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+a(e.$t("veo.button.generate")),1)]),_:1},8,["onClick"])])])}const vt=$(dt,[["render",ft]]),_t=g({name:"TaskPreview",components:{ElImage:J,CopyToClipboard:re,FontAwesomeIcon:L,ElAlert:X,VideoPlayer:M,ElTooltip:K,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onGet1080p(e,o){console.debug("set config",o),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,video_id:o?.data?.[0]?.id,video_url:o?.data[0]?.video_url,action:"get1080p"})},onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),ht={class:"preview"},gt={class:"left"},$t={class:"main"},bt={class:"bot"},kt={class:"datetime"},wt={class:"info"},yt={key:0,class:"prompt mt-2"},Vt={key:0},St={key:1},Tt={key:0,class:I({content:!0,failed:!0})},Et={key:0,class:"mb-4"},It={key:1,class:I({operations:!0,"mt-2":!0})},Ct={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},At={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Lt={key:1,class:I({content:!0})},Rt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ut={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Gt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Pt={key:2,class:I({content:!0})},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},jt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Dt(e,o,m,_,b,k){const c=s("el-image"),d=s("video-player"),i=s("el-button"),w=s("el-tooltip"),f=s("font-awesome-icon"),p=s("copy-to-clipboard"),V=s("el-alert");return n(),r("div",ht,[l("div",gt,[t(c,{src:"https://cdn.acedata.cloud/8nxyy9.jpg",class:"avatar"})]),l("div",$t,[l("div",bt,[h(a(e.$t("veo.name.veoBot"))+" ",1),l("span",kt,a(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",wt,[e.modelValue?.request?.prompt?(n(),r("p",yt,[h(a(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?v("",!0):(n(),r("span",Vt," - ("+a(e.$t("veo.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="running"?(n(),r("span",St," - ("+a(e.$t("veo.status.processing"))+") ",1)):v("",!0)])):v("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),r("div",Tt,[e.modelValue?.response?.data[0]?.video_url?(n(),r("div",Et,[t(d,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):v("",!0),e.modelValue?.response.success?(n(),r("div",It,[t(w,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=C=>e.onGet1080p(C,e.modelValue?.response))},{default:u(()=>[h(a(e.$t("veo.button.action3")),1)]),_:1})):v("",!0)]),_:1},8,["content"]),t(w,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=C=>e.onDownload(C,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[h(a(e.$t("veo.button.download")),1)]),_:1})):v("",!0)]),_:1},8,["content"])])):v("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",Ct,[t(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.model"))+": "+a(e.modelValue?.request?.model),1)]),l("p",At,[t(f,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):v("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Lt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Rt,[t(f,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),l("p",Ut,[t(f,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+a(e.$t("veo.name.failureReason"))+": "+a(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Gt,[t(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):v("",!0)]),_:1})])):v("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Pt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Ot,[t(f,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",jt,[t(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):v("",!0)]),_:1})])):v("",!0)])])}const Mt=$(_t,[["render",Dt],["__scopeId","data-v-4c98c3a2"]]),Bt=g({name:"RecentPanel",components:{TaskPreview:Mt,NoTasks:de,BotPlaceholder:ce,ScrollList:se},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Ft={key:0},qt={key:2,class:"w-full h-full flex items-center justify-center"};function zt(e,o,m,_,b,k){const c=s("bot-placeholder"),d=s("task-preview"),i=s("scroll-list"),w=s("no-tasks");return n(),r(A,null,[e.tasks?.items===void 0?(n(),r("div",Ft,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),y(i,{key:1,ref:"scrollList",class:"tasks h-full w-full overflow-y-auto",loading:e.loading,onReachTop:o[0]||(o[0]=f=>e.$emit("reach-top"))},{default:u(()=>[(n(!0),r(A,null,U(e.tasks?.items,(f,p)=>(n(),y(d,{key:p,"model-value":f},null,8,["model-value"]))),128))]),_:1},8,["loading"])):v("",!0),e.tasks?.items?.length===0?(n(),r("div",qt,[t(w)])):v("",!0)],64)}const Nt=$(Bt,[["render",zt]]),Ht="https://webhook.acedata.cloud/veo",Kt=g({name:"VeoIndex",components:{ConfigPanel:vt,Layout:he,RecentPanel:Nt},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===O.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===O.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.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 ue({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("veo/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("veo/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();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:o=5,createdAtMin:m,createdAtMax:_}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",_),this.fetchingTasks=!0;try{await this.$store.dispatch("veo/getTasks",{limit:o,createdAtMin:m,createdAtMax:_})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:Ht},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("veo.message.startingTask")),te.generate(e,{token:o}).then(()=>{E.success(this.$t("veo.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===oe?E.error(this.$t("veo.message.usedUp")):E.error(this.$t("veo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Xt(e,o,m,_,b,k){const c=s("config-panel"),d=s("recent-panel"),i=s("layout");return n(),y(i,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const fo=$(Kt,[["render",Xt]]);export{fo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as I}from"./CopyToClipboard-
|
|
1
|
+
import{C as I}from"./CopyToClipboard-cTbsayFn.js";import{aB as E,bj as T,bk as F,bl as N,_ as B}from"./index-CtkD2JaX.js";import{d as P,a as $,s as O}from"./distribution-Dmd3XvVp.js";import{g as q}from"./price-lQeFOa8Q.js";import{F as M}from"./index.es-DMehEjXB.js";import{L as R,y as z,z as U,q as V,x as A,p as G,m as H,A as Q,B as j,Z as J}from"./vendor-element-plus-CmP9-3lX.js";import{d as K,J as r,K as o,T as i,ai as l,G as e,R as s,C as p,Q as _,O as k,D as n}from"./vendor-vue-BhXato7y.js";import"./vendor-web3-C5RrfhAy.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-8bYQCSwj.js";const W=K({name:"ConsoleDistributionList",components:{CopyToClipboard:I,FontAwesomeIcon:M,QrCode:E,ElProgress:J,ElRow:j,ElCol:Q,ElButton:H,ElDivider:G,ElCard:A,ElTooltip:V,ElTable:U,ElTableColumn:z,ElSkeleton:R},data(){return{invitees:[],inviteesCount:void 0,distributionLevels:[],distributionLink:void 0,distributionStatus:void 0,loading:!1}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||"1")},qrColor(){const t=document.documentElement.classList.contains("dark");return{dark:t?"#ffffff":"#000000",light:t?"#1e1e1e":"#ffffff"}},distributionLevelMap(){let t={};return this.distributionLevels.forEach(a=>{t[a.level]=a}),t}},watch:{page:{handler(){this.onFetchData()}}},async mounted(){this.onFetchData(),this.onGenerateDistributionLink()},methods:{getPriceString:q,goHistory(){this.$router.push({name:N})},goInvitees(){this.$router.push({name:F})},onPageChange(t){this.$router.push({name:this.$route.name?.toString(),query:{page:t}})},getPercentageForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level]?.threshold,a=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor((this.distributionStatus?.price-t)/(a-t)*100)},getDeltaForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor(t-this.distributionStatus?.price)},async onFetchData(){this.loading=!0,await $.initialize(),Promise.all([this.onFetchDistributionStatus(),this.onFetchDistributionLevels(),this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onGenerateDistributionLink(){const a=`${window.location.origin}?inviter_id=${this.$store.getters.user.id}`;try{const v=(await O.create(a))?.data?.data?.url;this.distributionLink=(v||a).replace("surl.id","share.acedata.cloud")}catch{this.distributionLink=a}},async onFetchDistributionStatus(){const{data:t}=await $.getAll({user_id:this.$store.getters.user.id});t.items&&t.items.length>0&&(this.distributionStatus=t.items[0])},async onFetchDistributionLevels(){const{data:t}=await P.getAll({limit:20,user_id:this.$store.getters.user.id});this.distributionLevels=t.items},async onFetchInvitees(){const{data:t}=await T.getInvitees({});this.invitees=t.items,this.inviteesCount=t.count}}}),Y={class:"title"},Z={key:1},X={class:"icon-wrapper"},x={class:"text-left"},tt={class:"description"},et={class:"value"},it={key:1},st={class:"icon-wrapper"},ot={class:"text-left"},nt={class:"description"},lt={class:"value"},at={key:1},rt={class:"icon-wrapper"},dt={class:"text-left"},ct={class:"description"},ut={class:"value"},pt={key:1},ht={class:"icon-wrapper"},_t={class:"text-left"},mt={class:"description"},bt={class:"value"},vt={key:1},ft={class:"title"},gt={class:"clear-both overflow-hidden"},kt={class:"float-left description"},yt={class:"float-right description"},Lt={class:"description"},$t={class:"level"},wt={class:"level"},St={class:"level"},Ct={key:1},Dt={class:"title"},It={class:"link-wrapper text-center"},Et=["href"],Tt={class:"qr-wrapper ml-auto mr-auto"},Ft={class:"mt-0"},Nt={class:"description"},Bt={class:"more"};function Pt(t,a,v,Ot,qt,Mt){const d=l("el-col"),m=l("el-row"),c=l("el-skeleton"),b=l("font-awesome-icon"),f=l("el-button"),u=l("el-card"),y=l("el-tooltip"),w=l("el-progress"),L=l("el-divider"),g=l("el-table-column"),S=l("el-table"),C=l("copy-to-clipboard"),D=l("qr-code");return n(),r(m,{class:"panel"},{default:o(()=>[i(d,{span:24},{default:o(()=>[i(m,null,{default:o(()=>[i(d,{span:24},{default:o(()=>[e("h2",Y,s(t.$t("common.title.distribution")),1)]),_:1})]),_:1}),i(m,{gutter:15},{default:o(()=>[i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",Z,[e("div",X,[i(b,{icon:"fa-solid fa-wallet",class:"icon"})]),e("div",x,[e("p",tt,s(t.$t("distribution.title.price")),1),e("p",et,s(t.getPriceString({value:t.distributionStatus?.price})),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goHistory},{default:o(()=>[_(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",it,[e("div",st,[i(b,{icon:"fa-solid fa-coins",class:"icon"})]),e("div",ot,[e("p",nt,s(t.$t("distribution.title.reward")),1),e("p",lt,s(t.getPriceString({value:t.distributionStatus?.reward})),1)]),i(y,{effect:"dark",content:t.$t("distribution.message.developingWithDrawal"),placement:"top"},{default:o(()=>[i(f,{type:"primary",round:"",size:"small",class:"btn"},{default:o(()=>[_(s(t.$t("distribution.button.withdrawal")),1)]),_:1})]),_:1},8,["content"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",at,[e("div",rt,[i(b,{icon:"fa-solid fa-percent",class:"icon"})]),e("div",dt,[e("p",ct,s(t.$t("distribution.title.percentage")),1),e("p",ut,s(t.distributionStatus?.level?.percentage)+"%",1)])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",pt,[e("div",ht,[i(b,{icon:"fa-regular fa-user",class:"icon"})]),e("div",_t,[e("p",mt,s(t.$t("distribution.title.inviteesCount")),1),e("p",bt,s(t.inviteesCount),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goInvitees},{default:o(()=>[_(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1})]),_:1}),i(m,{gutter:15},{default:o(()=>[i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"level-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",vt,[e("h4",ft,s(t.$t("distribution.title.levelInfo")),1),e("div",gt,[e("div",kt,[e("p",null,s(t.$t("distribution.title.currentLevel"))+": L"+s(t.distributionStatus?.level?.level),1),e("p",null,s(t.$t("distribution.title.currentPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level]?.percentage)+"% ",1)]),e("div",yt,[e("p",null,s(t.$t("distribution.title.nextLevel"))+": L"+s(t.distributionStatus?.level?.level+1),1),e("p",null,s(t.$t("distribution.title.nextPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level+1]?.percentage)+"% ",1)])]),i(w,{"text-inside":!0,"stroke-width":20,percentage:t.getPercentageForNextLevel(),class:"mb-2"},null,8,["percentage"]),e("p",Lt,s(t.$t("distribution.message.deltaPriceForNextLevel"))+": $"+s(t.getDeltaForNextLevel()),1),i(L),t.distributionLevels?(n(),r(S,{key:0,data:t.distributionLevels,stripe:""},{default:o(()=>[i(g,{label:t.$t("distribution.field.level")},{default:o(h=>[e("span",$t,"L"+s(h.row?.level),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.threshold")},{default:o(h=>[e("span",wt,"$"+s(h.row?.threshold),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.percentage")},{default:o(h=>[e("span",St,s(h.row?.percentage)+"%",1)]),_:1},8,["label"])]),_:1},8,["data"])):k("",!0)]))]),_:1})]),_:1}),i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"distribution-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",Ct,[e("h4",Dt,s(t.$t("distribution.title.distributionLink")),1),i(L),e("div",It,[k("",!0),e("a",{href:t.distributionLink,class:"link"},s(t.distributionLink),9,Et),i(C,{content:t.distributionLink},null,8,["content"])]),e("div",Tt,[t.distributionLink?(n(),r(D,{key:0,value:t.distributionLink,size:180,margin:2,class:"block mb-2 ml-auto mr-auto",type:"image/png",color:t.qrColor},null,8,["value","color"])):k("",!0),e("p",Ft,s(t.$t("distribution.message.distributionQrDescription")),1)]),e("p",Nt,[_(s(t.$t("distribution.message.distributionLinkDescription"))+" ",1),e("span",Bt,[i(y,{effect:"dark",content:t.$t("distribution.message.distributionLinkDescription2"),placement:"top"},{default:o(()=>[_(s(t.$t("distribution.message.technicalDetail")),1)]),_:1},8,["content"])])])]))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}const Wt=B(W,[["render",Pt],["__scopeId","data-v-1ca0740d"]]);export{Wt as default};
|