@acedatacloud/nexior 3.17.0 → 3.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{Auth-BOyf0KUK.js → Auth-CxfBylg9.js} +1 -1
- package/dist/assets/{BotPlaceholder-DLI4FHw7.js → BotPlaceholder-DN22Fc21.js} +1 -1
- package/dist/assets/{Callback-CfZSbFhQ.js → Callback-B_0EeZCg.js} +1 -1
- package/dist/assets/{Console-f-tEsvV2.js → Console-BtwoN1gX.js} +1 -1
- package/dist/assets/{Conversation-DdQtvYCm.js → Conversation-Ccon1fZH.js} +2 -2
- package/dist/assets/{CopyToClipboard-dTRt17Kr.js → CopyToClipboard-OXkvUoT-.js} +1 -1
- package/dist/assets/{Detail-Dd4zICiT.js → Detail-D6mnH-ZZ.js} +1 -1
- package/dist/assets/{EditArray-CxfYCs2l.js → EditArray-CqltjhTI.js} +1 -1
- package/dist/assets/{Extra-BDJHXOT4.js → Extra-BlqnTbc-.js} +1 -1
- package/dist/assets/{FilePreview-CrWNTrmN.js → FilePreview-CX04wwXU.js} +1 -1
- package/dist/assets/{History-DxRtYYYe.js → History-CqJmXxg2.js} +1 -1
- package/dist/assets/{ImagePreview-DV1WrQNh.js → ImagePreview-DuSC9aPC.js} +1 -1
- package/dist/assets/{ImageWrapper-BDxTSoQ7.js → ImageWrapper-C7z6Wqul.js} +1 -1
- package/dist/assets/{Index-DhH_Hyi1.js → Index-1_gssCIu.js} +1 -1
- package/dist/assets/{Index-BOskpYwm.js → Index-BAXEXf2k.js} +1 -1
- package/dist/assets/{Index-CElNZ-cy.js → Index-BHxdbzhp.js} +1 -1
- package/dist/assets/{Index-3vx5D-V7.js → Index-BIAu_Q-T.js} +1 -1
- package/dist/assets/{Index-9lJWmMdn.js → Index-BKiDVMuc.js} +1 -1
- package/dist/assets/{Index-DoRTKRbk.js → Index-BStBdmbF.js} +1 -1
- package/dist/assets/Index-BXBdP5A3.js +1 -0
- package/dist/assets/{Index-DtnCCz5o.js → Index-BaHJko1Q.js} +1 -1
- package/dist/assets/{Index-CcfWRB15.js → Index-BxAjaxJ0.js} +1 -1
- package/dist/assets/{Index-Bi5kUBP-.css → Index-CuveKqEU.css} +1 -1
- package/dist/assets/{Index-CVy4MFuO.js → Index-DC3EX8Oe.js} +1 -1
- package/dist/assets/{Index-BsHw6nn2.js → Index-DrgF2hy5.js} +1 -1
- package/dist/assets/{Index-Dx1OzPHf.js → Index-JkuCR26q.js} +1 -1
- package/dist/assets/{Index-BmCu8slL.js → Index-XFKL03oX.js} +1 -1
- package/dist/assets/{Index-BAKgeqiC.js → Index-wKl400P6.js} +1 -1
- package/dist/assets/{InfoIcon-CR695ufA.js → InfoIcon-CWVvZnOl.js} +1 -1
- package/dist/assets/{Invitees-C7ideZ_0.js → Invitees-BUR1xhWK.js} +1 -1
- package/dist/assets/{List-CqhCJaVx.js → List-CfUFn9-L.js} +1 -1
- package/dist/assets/{List-DScXjyY4.js → List-DVchSYYT.js} +1 -1
- package/dist/assets/{List-CvWTVbrj.js → List-Db5BW8Pn.js} +1 -1
- package/dist/assets/{Login--kTnSJn-.js → Login-FmJIdomS.js} +1 -1
- package/dist/assets/{Main-Cof4ZOB6.js → Main-hP5_pane.js} +1 -1
- package/dist/assets/Navigator-C7a274p_.js +1 -0
- package/dist/assets/{Navigator-DPaFseDr.css → Navigator-Ceq4Wad_.css} +1 -1
- package/dist/assets/{NoTasks-DPySH-qR.js → NoTasks-D-PxBwiz.js} +1 -1
- package/dist/assets/{Pagination-3rQ7JXeW.js → Pagination-BgbnRYUv.js} +1 -1
- package/dist/assets/{Status-BC8c7-WE.js → Status-D2fneldj.js} +1 -1
- package/dist/assets/{Subscribe-DJjsckst.js → Subscribe-rX5Wwiew.js} +1 -1
- package/dist/assets/{VideoPlayer-LYCV9MuE.js → VideoPlayer-Cd9C_ZH8.js} +1 -1
- package/dist/assets/{_Uint8Array-Bdooy9AK.js → _Uint8Array-D2_20NB1.js} +1 -1
- package/dist/assets/{_baseClone-qufK5Sex.js → _baseClone-C7rLiyxP.js} +1 -1
- package/dist/assets/{_baseIteratee-DZ2YvAcL.js → _baseIteratee-Ct4ORPe7.js} +1 -1
- package/dist/assets/{_initCloneObject-Bk5aFlNA.js → _initCloneObject-De4hbrPJ.js} +1 -1
- package/dist/assets/{castArray-Bfjgey1B.js → castArray-B9qiBuq3.js} +1 -1
- package/dist/assets/chat-B5Al0CFp.js +1 -0
- package/dist/assets/chat-BVmkvx9n.js +1 -0
- package/dist/assets/chat-BsHurUDy.js +1 -0
- package/dist/assets/chat-BtS5zgiD.js +1 -0
- package/dist/assets/chat-C3GBlv37.js +1 -0
- package/dist/assets/chat-C4TvLN22.js +1 -0
- package/dist/assets/chat-CHRGLtTK.js +1 -0
- package/dist/assets/chat-CO5XWuo6.js +1 -0
- package/dist/assets/chat-CT3O79eb.js +1 -0
- package/dist/assets/chat-CbqcbCmj.js +1 -0
- package/dist/assets/chat-Ch0TXjo-.js +1 -0
- package/dist/assets/chat-Ck9_j5BU.js +1 -0
- package/dist/assets/chat-DDSycA1O.js +1 -0
- package/dist/assets/chat-DDf8gpQL.js +1 -0
- package/dist/assets/chat-DRMjq7ZQ.js +1 -0
- package/dist/assets/chat-DmyegYis.js +1 -0
- package/dist/assets/chat-Kb-y83hi.js +1 -0
- package/dist/assets/chat-ySOGGFzW.js +1 -0
- package/dist/assets/{debounce-znxeRhUH.js → debounce-XchV9dnA.js} +1 -1
- package/dist/assets/{distribution-B0ArTNTv.js → distribution-EKH9XLs8.js} +1 -1
- package/dist/assets/{dropdown-CXePO7wS.js → dropdown-DTW9Kzcf.js} +1 -1
- package/dist/assets/{index-DchjM2DH.js → index-4akd2uM4.js} +1 -1
- package/dist/assets/{index-Ci_9zUBa.js → index-718NSZgM.js} +1 -1
- package/dist/assets/{index-CUBWoiru.js → index-B0XUgi49.js} +1 -1
- package/dist/assets/{index-DieUsk35.js → index-B3SVNm-k.js} +1 -1
- package/dist/assets/{index-DwBHjA3D.js → index-BSwIBR6M.js} +1 -1
- package/dist/assets/{index-CKtAhY-s.js → index-BWOXXVg8.js} +1 -1
- package/dist/assets/{index-nA-KAadb.js → index-BsGpMJTb.js} +35 -35
- package/dist/assets/{index-Bn92fKGe.js → index-C2ZFsyaY.js} +1 -1
- package/dist/assets/{index-C5fxjt4O.js → index-C58ZzxdA.js} +1 -1
- package/dist/assets/{index-ByuWOFZS.js → index-C9b_qrYa.js} +1 -1
- package/dist/assets/{index-BunkSVlB.js → index-CAJyadtC.js} +1 -1
- package/dist/assets/{index-BNeU4duQ.js → index-CBIyu8MY.js} +1 -1
- package/dist/assets/{index-XCXDGhWV.js → index-CJUWE8re.js} +1 -1
- package/dist/assets/{index-CB99gthx.js → index-CPfOvcsc.js} +1 -1
- package/dist/assets/{index-DZOe-iSx.js → index-CxRCvRBZ.js} +1 -1
- package/dist/assets/{index-BmNvGNis.js → index-D2Y3gAJL.js} +1 -1
- package/dist/assets/{index-CYhI27vG.js → index-D5QUlWJ2.js} +1 -1
- package/dist/assets/{index-DIe9QyqZ.js → index-DFklJOqx.js} +1 -1
- package/dist/assets/{index-CAn3RarN.js → index-DJcFf6kq.js} +1 -1
- package/dist/assets/{index-CWL1zWCv.js → index-DY9jZOUy.js} +1 -1
- package/dist/assets/{index-DhsSA5Ku.js → index-Di4fVUMw.js} +1 -1
- package/dist/assets/{index-BiH-ehNW.js → index-IpqKHPW0.js} +1 -1
- package/dist/assets/{index-CR5eH4ys.js → index-R8KVxj24.js} +1 -1
- package/dist/assets/{index-3Ez9HcS_.js → index-h-hLCwa1.js} +1 -1
- package/dist/assets/{index-BbKd2na-.js → index-hmk_5mNY.js} +1 -1
- package/dist/assets/{index-DrPuBcQd.js → index-i2yOuXdD.js} +1 -1
- package/dist/assets/{index-Cr990IMl.js → index-jkLgEM33.js} +1 -1
- package/dist/assets/{index-C--_iHhn.js → index-nNlgbirs.js} +1 -1
- package/dist/assets/{index-K2-1oMVV.js → index-tynyZ2ck.js} +1 -1
- package/dist/assets/{index.es-BWmc-Ids.js → index.es-j7hA4q1g.js} +1 -1
- package/dist/assets/{isEqual-BwZuGT6W.js → isEqual-DV-fric-.js} +1 -1
- package/dist/assets/{isPlainObject-CVrnJwwT.js → isPlainObject-CoL8-sdZ.js} +1 -1
- package/dist/assets/midjourney-DPAw3bi8.js +1 -0
- package/dist/assets/{order-CtrL1NTP.js → order-DSDE4UL5.js} +1 -1
- package/dist/assets/{price-CCwZcNw3.js → price-B4pvZaQV.js} +1 -1
- package/dist/assets/{strings-B0sKE5ZU.js → strings-kuNfgIBh.js} +1 -1
- package/dist/assets/{typescript-b8ZbHHzg.js → typescript-Dc6IjKEd.js} +1 -1
- package/dist/assets/{use-form-item-DUTsbuH3.js → use-form-item-B27IDTSh.js} +1 -1
- package/dist/assets/veo-3zKgxer5.js +1 -0
- package/dist/assets/veo-BI4g6x_1.js +1 -0
- package/dist/assets/veo-BR3H2R4F.js +1 -0
- package/dist/assets/veo-BXcltFVR.js +1 -0
- package/dist/assets/veo-BocIIMgA.js +1 -0
- package/dist/assets/veo-CVaSyNQn.js +1 -0
- package/dist/assets/veo-CZOVKp22.js +1 -0
- package/dist/assets/veo-CZqDkrPQ.js +1 -0
- package/dist/assets/veo-CZra50B-.js +1 -0
- package/dist/assets/veo-DDTWG0_-.js +1 -0
- package/dist/assets/veo-DU-VU18f.js +1 -0
- package/dist/assets/veo-D_Y5yWq9.js +1 -0
- package/dist/assets/veo-DhJcbz6F.js +1 -0
- package/dist/assets/veo-Ds3v9g7y.js +1 -0
- package/dist/assets/veo-Dv9GDwlT.js +1 -0
- package/dist/assets/veo-K6G5xBEu.js +1 -0
- package/dist/assets/veo-RAvxcZeN.js +1 -0
- package/dist/assets/veo-a4_wVvTS.js +1 -0
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/Index-Bg6aPqWI.js +0 -1
- package/dist/assets/Navigator-DOkEz1_T.js +0 -1
- package/dist/assets/chat-BOvh2JVT.js +0 -1
- package/dist/assets/chat-BhlGtYCb.js +0 -1
- package/dist/assets/chat-BiQ9-OuF.js +0 -1
- package/dist/assets/chat-BuOUpCjc.js +0 -1
- package/dist/assets/chat-BzOZ-NNb.js +0 -1
- package/dist/assets/chat-CS9AcMwV.js +0 -1
- package/dist/assets/chat-CTHmx5bf.js +0 -1
- package/dist/assets/chat-ChQF2VOr.js +0 -1
- package/dist/assets/chat-Co3i4Nqd.js +0 -1
- package/dist/assets/chat-D-4GqjPf.js +0 -1
- package/dist/assets/chat-D15RFySP.js +0 -1
- package/dist/assets/chat-DLu-VcUn.js +0 -1
- package/dist/assets/chat-DVINcjTQ.js +0 -1
- package/dist/assets/chat-D_oRWFvl.js +0 -1
- package/dist/assets/chat-Km0aOnGR.js +0 -1
- package/dist/assets/chat-QSIHwjsq.js +0 -1
- package/dist/assets/chat-ZxnT324p.js +0 -1
- package/dist/assets/chat-yQfpt1lj.js +0 -1
- package/dist/assets/midjourney-ClhQVRIK.js +0 -1
- package/dist/assets/veo-BAdFM5rx.js +0 -1
- package/dist/assets/veo-BFwiIe48.js +0 -1
- package/dist/assets/veo-BXaYgclf.js +0 -1
- package/dist/assets/veo-BbLI9GvB.js +0 -1
- package/dist/assets/veo-Bd8c0cZH.js +0 -1
- package/dist/assets/veo-CAqSBfJQ.js +0 -1
- package/dist/assets/veo-CDOAeF7t.js +0 -1
- package/dist/assets/veo-CFH9k3NO.js +0 -1
- package/dist/assets/veo-CJamipKx.js +0 -1
- package/dist/assets/veo-CNfDSPQ2.js +0 -1
- package/dist/assets/veo-CWA-468q.js +0 -1
- package/dist/assets/veo-CZXCPJiQ.js +0 -1
- package/dist/assets/veo-CaFb0TUk.js +0 -1
- package/dist/assets/veo-CgjflTg6.js +0 -1
- package/dist/assets/veo-DGmUHtSI.js +0 -1
- package/dist/assets/veo-DYtp0NV7.js +0 -1
- package/dist/assets/veo-LVcXNxc8.js +0 -1
- package/dist/assets/veo-pdDM2t7d.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as q}from"./index.es-BWmc-Ids.js";import{E as H}from"./index-ByuWOFZS.js";import{E as de}from"./index-DwBHjA3D.js";import{aj as pe,ap as me,bI as he,ak as ie,c9 as fe,_ as _e,d as C,a as $e,al as ve,c as V,bh as ge,bn as ke,aw as ae,b as _,o as a,i as w,r as U,f as oe,e as L,j as $,b8 as le,E as R,n as ye,g as we,h as A,t as l,k as s,l as c,eL as se,x as v,F as z,v as N,eM as Y,c6 as be,D as T,eN as x,eO as ee,y,J as Z,cN as te,eP as O,dm as W,eQ as G,an as Ce,K as Se,eR as Le,de as Ae,dl as je}from"./index-nA-KAadb.js";import{E as re}from"./index-3Ez9HcS_.js";import{E as Ee,a as Ve}from"./index-DhsSA5Ku.js";import{I as D}from"./InfoIcon-CR695ufA.js";import{E as Ie}from"./index-Cr990IMl.js";import{E}from"./index-DIe9QyqZ.js";import{E as K}from"./index-CYhI27vG.js";import{E as Te,a as ce}from"./index-Ci_9zUBa.js";import{E as X}from"./index-CB99gthx.js";import{C as Pe,N as Fe}from"./NoTasks-DPySH-qR.js";import{a as Ue}from"./price-CCwZcNw3.js";import{E as ze,a as Me,b as Re}from"./index-BbKd2na-.js";import{E as Ge}from"./index-CAn3RarN.js";import{E as De}from"./index-C--_iHhn.js";import{a as Oe,E as We}from"./index-DchjM2DH.js";import{E as Be}from"./index-BmNvGNis.js";import"./use-form-item-DUTsbuH3.js";import"./index-r5W6hzzQ.js";import"./index-DZOe-iSx.js";import"./strings-B0sKE5ZU.js";import"./castArray-Bfjgey1B.js";import"./isEqual-BwZuGT6W.js";import"./_Uint8Array-Bdooy9AK.js";import"./typescript-b8ZbHHzg.js";import"./debounce-znxeRhUH.js";import"./_baseIteratee-DZ2YvAcL.js";import"./index-CWL1zWCv.js";import"./index-CR5eH4ys.js";import"./_baseClone-qufK5Sex.js";import"./_initCloneObject-Bk5aFlNA.js";import"./index-BiH-ehNW.js";import"./dropdown-CXePO7wS.js";const Ne=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ie(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:he},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),qe={error:e=>e instanceof Event},He=C({name:"ElAvatar"}),Ze=C({...He,props:Ne,emits:qe,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=V(()=>{const{size:n,icon:m,shape:k}=i,h=[o.b()];return ge(n)&&h.push(o.m(n)),m&&h.push(o.m("icon")),k&&h.push(o.m(k)),h}),u=V(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=V(()=>({objectFit:i.fit}));ae(()=>i.src,()=>r.value=!1);function f(n){r.value=!0,t("error",n)}return(n,m)=>(a(),_("span",{class:ye(L(d)),style:oe(L(u))},[(n.src||n.srcSet)&&!r.value?(a(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(L(p)),onError:f},null,44,["src","alt","srcset"])):n.icon?(a(),w(L(R),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ke=_e(Ze,[["__file","avatar.vue"]]);const Xe=we(Ke),Je=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:H,FontAwesomeIcon:q},data(){return{drawer:!1,preview:!1}},computed:{}}),Qe={class:"main"},Ye={class:"config"},xe={class:"result"},et={class:"preview"};function tt(e,t,i,o,r,d){const u=c("font-awesome-icon"),p=c("el-button"),f=c("el-drawer");return a(),_("div",Qe,[l("div",Ye,[U(e.$slots,"config",{},void 0,!0)]),l("div",xe,[U(e.$slots,"result",{},void 0,!0)]),l("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{round:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-magic"})]),_:1}),s(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ot=A(Je,[["render",tt],["__scopeId","data-v-5859e958"]]),st=C({name:"VersionSelector",components:{ElSelect:Ve,ElOption:Ee,ElSwitch:re},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),nt={class:"field"},it={class:"title font-bold"};function at(e,t,i,o,r,d){const u=c("el-switch"),p=c("el-option"),f=c("el-select");return a(),_("div",nt,[l("h2",it,v(e.$t("suno.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(f,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(a(!0),_(z,null,N(e.options,n=>(a(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=A(st,[["render",at],["__scopeId","data-v-5a66a01f"]]),rt=C({name:"UploadAudio",components:{ElUpload:Ie,ElButton:H,InfoIcon:D,FontAwesomeIcon:q},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),Y.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const r=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:r,action:"upload_extend"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ct={class:"relative"},ut={class:"flex justify-between"},dt={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function mt(e,t,i,o,r,d){const u=c("info-icon"),p=c("font-awesome-icon"),f=c("el-button"),n=c("el-upload");return a(),_("div",ct,[l("div",ut,[l("div",dt,[l("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(u,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),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:$(()=>[s(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),T(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ht=A(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ft="",_t=C({name:"PromptInput",components:{ElInput:K,ElSwitch:re,InfoIcon:D},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},kt={class:"title font-bold"},yt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-switch"),f=c("el-input");return a(),_("div",$t,[l("div",vt,[l("div",gt,[l("h2",kt,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",yt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(f,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ct=A(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",Lt=C({name:"LyricInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=St)}}),At={class:"field"},jt={class:"box"},Et={class:"title font-bold"};function Vt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",At,[l("div",jt,[l("h2",Et,v(e.$t("suno.name.lyrics")),1),s(u,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(a(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(a(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const It=A(Lt,[["render",Vt],["__scopeId","data-v-99dfded8"]]),Tt=C({name:"StyleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Pt={class:"field"},Ft={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Pt,[l("div",Ft,[l("h2",Ut,v(e.$t("suno.name.style")),1),s(u,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=f=>e.style=f),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Mt=A(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Rt=C({name:"TitleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Dt={class:"title-container"},Ot={class:"title font-bold"};function Wt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Gt,[l("div",Dt,[l("h2",Ot,v(e.$t("suno.name.title")),1),s(u,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=f=>e.title=f),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Bt=A(Rt,[["render",Wt],["__scopeId","data-v-ce70fe34"]]);function M(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,r=t<10?`0${t}`:t;return o+":"+r}const Nt=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:R,ElInputNumber:Te,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),qt={class:"field"},Ht={class:"box"},Zt={class:"title font-bold"},Kt={class:"input-wrapper"},Xt={class:"task"},Jt={class:"left"},Qt={key:2,class:"duration"},Yt={class:"info"},xt={class:"title"},eo={class:"style"};function to(e,t,i,o,r,d){const u=c("el-input-number"),p=c("el-image"),f=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=te("loading");return a(),_("div",qt,[l("div",Ht,[l("h2",Zt,v(e.$t("suno.name.extend")),1),l("div",Kt,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=h=>e.value=h),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),l("div",Xt,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=h=>e.onClick(e.audio))},[Z((a(),_("div",Jt,[s(p,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=h=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(f)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=h=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",Qt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Yt,[l("h2",xt,v(e.audio?.title),1),l("p",eo,v(e.audio?.style),1)])])):y("",!0)])])}const oo=A(Nt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:R,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),no={class:"field"},io={class:"box"},ao={class:"title font-bold"},lo={class:"task"},ro={class:"left"},co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"};function ho(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=te("loading");return a(),_("div",no,[l("div",io,[l("h2",ao,v(e.$t("suno.name.cover")),1)]),l("div",lo,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),_("div",ro,[s(u,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(f,null,{default:$(()=>[s(p)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(f,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),l("div",uo,[l("h2",po,v(e.audio?.title),1),l("p",mo,v(e.audio?.style),1)])])):y("",!0)])])}const fo=A(so,[["render",ho],["__scopeId","data-v-06640216"]]),_o=C({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:It,StyleInput:Mt,TitleInput:Bt,ExtendFromInput:oo,CoverFromInput:fo,UploadAudio:ht,FontAwesomeIcon:q,ElButton:H,Consumption:Pe},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Ue(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$o={class:"flex flex-col h-full"},vo={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ko(e,t,i,o,r,d){const u=c("type-selector"),p=c("upload-audio"),f=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),h=c("extend-from-input"),b=c("cover-from-input"),P=c("consumption"),I=c("font-awesome-icon"),j=c("el-button");return a(),_("div",$o,[l("div",vo,[s(u,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?y("",!0):(a(),w(f,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(a(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(m,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(a(),w(h,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(a(),w(b,{key:5,class:"mb-4"})):y("",!0)]),l("div",go,[s(P,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(a(),w(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(I,{icon:"fa-solid fa-magic",class:"mr-2"}),T(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(I,{icon:"fa-solid fa-magic",class:"mr-2"}),T(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const yo=A(_o,[["render",ko],["__scopeId","data-v-b9fab929"]]);var B={exports:{}},wo=B.exports,ne;function bo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(wo,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,k){var h=new XMLHttpRequest;h.open("GET",n),h.responseType="blob",h.onload=function(){f(h.response,m,k)},h.onerror=function(){console.error("could not download file")},h.send()}function r(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function d(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,p=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),f=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var h=u.URL||u.webkitURL,b=document.createElement("a");m=m||n.name||"download",b.download=m,b.rel="noopener",typeof n=="string"?(b.href=n,b.origin===location.origin?d(b):r(b.href)?o(n,m,k):d(b,b.target="_blank")):(b.href=h.createObjectURL(n),setTimeout(function(){h.revokeObjectURL(b.href)},4e4),setTimeout(function(){d(b)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,k){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),m);else if(r(n))o(n,m,k);else{var h=document.createElement("a");h.href=n,h.target="_blank",setTimeout(function(){d(h)})}}:function(n,m,k,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,k);var b=n.type==="application/octet-stream",P=/constructor/i.test(u.HTMLElement)||u.safari,I=/CriOS\/[\d]+/.test(navigator.userAgent);if((I||b&&P||p)&&typeof FileReader<"u"){var j=new FileReader;j.onloadend=function(){var S=j.result;S=I?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=S:location=S,h=null},j.readAsDataURL(n)}else{var g=u.URL||u.webkitURL,F=g.createObjectURL(n);h?h.location=F:location.href=F,h=null,setTimeout(function(){g.revokeObjectURL(F)},4e4)}});u.saveAs=f.saveAs=f,e.exports=f})}(B)),B.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Lo=C({name:"TaskPreview",components:{ElImage:X,ElIcon:R,ElTooltip:Ge,ElButton:H,FontAwesomeIcon:q,VideoPlay:ee,VideoPause:x,ElDropdown:Re,ElDropdownMenu:Me,ElDropdownItem:ze},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=[];const t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(i=>{let o=i;t&&(o.action=t),e.push(o)}),e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{Co.saveAs(d,r)})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:So},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Y.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{E.error(r?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Ao={class:"task"},jo=["onClick"],Eo={class:"left"},Vo=["onClick"],Io=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Fo={class:"title"},Uo={class:"style"},zo={class:"right"},Mo={class:"el-dropdown-link"},Ro={class:"el-dropdown-link"};function Go(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=c("el-button"),k=c("font-awesome-icon"),h=c("el-tooltip"),b=c("el-dropdown-item"),P=c("el-dropdown-menu"),I=c("el-dropdown"),j=te("loading");return a(),_("div",Ao,[(a(!0),_(z,null,N(e.audios,(g,F)=>(a(),_("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),_("div",Eo,[s(u,{src:g?.image_url,class:"cover",fit:"cover"},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:S=>e.onPause(g)},[s(f,null,{default:$(()=>[s(p)]),_:1})],8,Vo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:S=>e.onPlay(g)},[s(f,null,{default:$(()=>[s(n)]),_:1})],8,Io)):y("",!0),g?.duration?(a(),_("div",To,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[j,!g?.audio_url]]),l("div",Po,[l("h2",Fo,v(g?.title),1),l("p",Uo,v(g?.style),1)]),l("div",zo,[g?.audio_url?(a(),w(m,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[T(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(h,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:$(()=>[g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:S=>e.onPreview(S,g?.video_url)},null,8,["onClick"])):y("",!0)]),_:2},1032,["content"]),s(I,null,{dropdown:$(()=>[s(P,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[T(v(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):y("",!0),g?.audio_url?(a(),w(b,{key:1,onClick:S=>e.onDownload(S,g?.audio_url)},{default:$(()=>[T(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Mo,[s(h,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(I,null,{dropdown:$(()=>[s(P,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[T(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[T(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(a(),w(b,{key:1,onClick:S=>e.onConcatMusic(g?.id)},{default:$(()=>[T(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Ro,[s(h,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,jo))),128))])}const Do=A(Lo,[["render",Go]]),Oo={class:"player-slider"},Wo=C({__name:"PlayerSlider",setup(e){const t=G(),i=V({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=V({get:()=>t.state.suno?.audio?.duration,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:u})}),r=()=>{},d=u=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:u});return(u,p)=>(a(),_("div",Oo,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}}),Bo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},qo=["src"],Ho={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ko={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=C({__name:"PlayerSong",setup(e){const t=G(),i=V({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return ae(i,(o,r)=>{if(o?.audio_url!==r?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if(o?.progress!==r?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else o?.state!==r?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==r?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>(a(),_("div",No,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||L(Bo)},null,8,qo),l("div",Ho,[l("div",Zo,[l("div",Ko,[l("span",null,v(i.value?.title||"Music"),1),l("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Qo={class:"flex justify-end items-center gap-x-2.5"},Yo={class:"text-xs"},xo=C({__name:"PlayerAction",setup(e){const t=G(),i=V({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=V({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),_("div",Qo,[l("span",Yo,v(L(M)(i.value))+" / "+v(L(M)(o.value)),1)]))}});var es={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function ts(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function os(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],r=[],d=t.theme||i.theme;switch(d){case"outline":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none");break;case"filled":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("#FFF"),r.push("#FFF");break;case"two-tone":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),r.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),r.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:r,id:e}}var ss=Symbol("icon-context");function J(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(d){var u=ts(),p=Ce(ss,es);return function(){var f=d.size,n=d.strokeWidth,m=d.strokeLinecap,k=d.strokeLinejoin,h=d.theme,b=d.fill,P=d.spin,I=os(u,{size:f,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:h,fill:b},p),j=[p.prefix+"-icon"];return j.push(p.prefix+"-icon-"+e),t&&p.rtl&&j.push(p.prefix+"-icon-rtl"),P&&j.push(p.prefix+"-icon-spin"),s("span",{class:j.join(" ")},[i(I)])}}};return o}const ns=J("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),is=J("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),as=J("volume-mute",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("rect",{opacity:"0.01",x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null),s("mask",{id:e.id+"603476ab",maskUnits:"userSpaceOnUse",x:"30",y:"18",width:"13",height:"13",style:{maskType:"alpha"}},[s("rect",{x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null)]),s("g",{mask:"url(#"+e.id+"603476ab)"},[s("path",{d:"M40.7348 20.2858L32.2495 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32.2496 20.2858L40.7349 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)]),s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ue=J("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Q=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(a(),w(le(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),ls={class:"player-volume flex flex-col items-center pt-2"},rs={class:"text-sm mt-3"},cs={class:"mt-2"},us=C({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=V({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=V({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),r=()=>t.dispatch("suno/toggleMuted"),d=u=>t.dispatch("suno/setVolume",u);return(u,p)=>(a(),_("div",ls,[l("div",null,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",rs,v(i.value),1),l("div",cs,[s(Q,{icon:o.value?L(as):L(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=C({__name:"PlayerController",setup(e){const t=G(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=V(()=>t.state.suno.audio);return(r,d)=>(a(),_("div",ds,[s(Q,{icon:o.value?.state==="playing"?L(ns):L(is),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(L(De),{placement:"top",width:"50px"},{reference:$(()=>[s(Q,{icon:L(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},hs={class:"flex grow px-5 items-center"},fs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=C({__name:"Player",setup(e){return(t,i)=>(a(),_("div",ms,[s(Wo),l("div",hs,[l("div",fs,[s(Jo)]),l("div",_s,[s(ps)]),l("div",$s,[s(xo)])])]))}}),gs=C({name:"RecentPanel",components:{TaskPreview:Do,ElSkeleton:We,ElSkeletonItem:Oe,Player:vs,NoTasks:Fe},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),ks={key:0,class:"tasks"},ys={class:"left"},ws={class:"main"},bs={key:1,class:"tasks"},Cs={key:2,class:"w-full h-full flex items-center justify-center"},Ss={class:"flex-1 flex flex-col"},Ls={class:"h-20"};function As(e,t,i,o,r,d){const u=c("el-skeleton-item"),p=c("el-skeleton"),f=c("task-preview"),n=c("no-tasks"),m=c("player");return a(),_(z,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...k)=>e.onHandleScroll&&e.onHandleScroll(...k))},[e.tasks?.items===void 0?(a(),_("div",ks,[(a(),_(z,null,N(3,k=>l("div",{key:k,class:"task placeholder"},[l("div",ys,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",ws,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"p",class:"title"}),s(u,{variant:"text",style:{"margin-right":"16px"}}),s(u,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),_("div",bs,[(a(!0),_(z,null,N(e.tasks?.items,(k,h)=>(a(),w(f,{key:h,"model-value":k,class:"preview"},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),_("div",Cs,[s(n)])):y("",!0)],544),Z(l("div",Ss,[l("div",Ls,[s(m)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const js=A(gs,[["render",As],["__scopeId","data-v-959f8920"]]),Es=C({name:"TaskPreview",components:{ElScrollbar:Be,IconPicture:Le,ElImage:X,ElAvatar:Xe,ElIcon:R},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Vs={key:0,class:"card"},Is={class:"image-container"},Ts={class:"image-slot"},Ps={class:"title"},Fs={class:"content"},Us={class:"artist"},zs={class:"style"},Ms={class:"time"},Rs={class:"lyrics"},Gs={key:1,class:"gradient-background"};function Ds(e,t,i,o,r,d){const u=c("icon-picture"),p=c("el-icon"),f=c("el-image"),n=c("el-avatar"),m=c("el-scrollbar");return a(),w(m,{class:"right-panel"},{default:$(()=>[e.audio?.object?(a(),_("div",Vs,[l("div",Is,[s(f,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",Ts,[s(p,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Ps,v(e.audio?.title),1)]),l("div",Fs,[l("div",Us,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",zs,v(e.audio?.style),1),l("p",Ms,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",Rs,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),_("div",Gs))]),_:1})}const Os=A(Es,[["render",Ds],["__scopeId","data-v-9b29e9f9"]]),Ws="https://webhook.acedata.cloud/suno",Bs=C({name:"SunoIndex",components:{Layout:ot,ConfigPanel:yo,RecentPanel:js,PreviewPanel:Os},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===W.Request},needApply(){return this.$store.state.suno.status.getApplications===W.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===je&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ws},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Y.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ns(e,t,i,o,r,d){const u=c("config-panel"),p=c("recent-panel"),f=c("preview-panel"),n=c("layout");return a(),w(n,null,{config:$(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(f)]),_:1})}const An=A(Bs,[["render",Ns],["__scopeId","data-v-f5721d95"]]);export{An as default};
|
|
1
|
+
import{F as q}from"./index.es-j7hA4q1g.js";import{E as H}from"./index-C9b_qrYa.js";import{E as de}from"./index-BSwIBR6M.js";import{aj as pe,ap as me,bI as he,ak as ie,c9 as fe,_ as _e,d as C,a as $e,al as ve,c as V,bh as ge,bn as ke,aw as ae,b as _,o as a,i as w,r as U,f as oe,e as L,j as $,b8 as le,E as R,n as ye,g as we,h as A,t as l,k as s,l as c,eL as se,x as v,F as z,v as N,eM as Y,c6 as be,D as T,eN as x,eO as ee,y,J as Z,cN as te,eP as O,dm as W,eQ as G,an as Ce,K as Se,eR as Le,de as Ae,dl as je}from"./index-BsGpMJTb.js";import{E as re}from"./index-h-hLCwa1.js";import{E as Ee,a as Ve}from"./index-Di4fVUMw.js";import{I as D}from"./InfoIcon-CWVvZnOl.js";import{E as Ie}from"./index-jkLgEM33.js";import{E}from"./index-DFklJOqx.js";import{E as K}from"./index-D5QUlWJ2.js";import{E as Te,a as ce}from"./index-718NSZgM.js";import{E as X}from"./index-CPfOvcsc.js";import{C as Pe,N as Fe}from"./NoTasks-D-PxBwiz.js";import{a as Ue}from"./price-B4pvZaQV.js";import{E as ze,a as Me,b as Re}from"./index-hmk_5mNY.js";import{E as Ge}from"./index-DJcFf6kq.js";import{E as De}from"./index-nNlgbirs.js";import{a as Oe,E as We}from"./index-4akd2uM4.js";import{E as Be}from"./index-D2Y3gAJL.js";import"./use-form-item-B27IDTSh.js";import"./index-r5W6hzzQ.js";import"./index-CxRCvRBZ.js";import"./strings-kuNfgIBh.js";import"./castArray-B9qiBuq3.js";import"./isEqual-DV-fric-.js";import"./_Uint8Array-D2_20NB1.js";import"./typescript-Dc6IjKEd.js";import"./debounce-XchV9dnA.js";import"./_baseIteratee-Ct4ORPe7.js";import"./index-DY9jZOUy.js";import"./index-R8KVxj24.js";import"./_baseClone-C7rLiyxP.js";import"./_initCloneObject-De4hbrPJ.js";import"./index-IpqKHPW0.js";import"./dropdown-DTW9Kzcf.js";const Ne=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ie(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:he},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),qe={error:e=>e instanceof Event},He=C({name:"ElAvatar"}),Ze=C({...He,props:Ne,emits:qe,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=V(()=>{const{size:n,icon:m,shape:k}=i,h=[o.b()];return ge(n)&&h.push(o.m(n)),m&&h.push(o.m("icon")),k&&h.push(o.m(k)),h}),u=V(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=V(()=>({objectFit:i.fit}));ae(()=>i.src,()=>r.value=!1);function f(n){r.value=!0,t("error",n)}return(n,m)=>(a(),_("span",{class:ye(L(d)),style:oe(L(u))},[(n.src||n.srcSet)&&!r.value?(a(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(L(p)),onError:f},null,44,["src","alt","srcset"])):n.icon?(a(),w(L(R),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ke=_e(Ze,[["__file","avatar.vue"]]);const Xe=we(Ke),Je=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:H,FontAwesomeIcon:q},data(){return{drawer:!1,preview:!1}},computed:{}}),Qe={class:"main"},Ye={class:"config"},xe={class:"result"},et={class:"preview"};function tt(e,t,i,o,r,d){const u=c("font-awesome-icon"),p=c("el-button"),f=c("el-drawer");return a(),_("div",Qe,[l("div",Ye,[U(e.$slots,"config",{},void 0,!0)]),l("div",xe,[U(e.$slots,"result",{},void 0,!0)]),l("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{round:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-magic"})]),_:1}),s(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ot=A(Je,[["render",tt],["__scopeId","data-v-5859e958"]]),st=C({name:"VersionSelector",components:{ElSelect:Ve,ElOption:Ee,ElSwitch:re},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),nt={class:"field"},it={class:"title font-bold"};function at(e,t,i,o,r,d){const u=c("el-switch"),p=c("el-option"),f=c("el-select");return a(),_("div",nt,[l("h2",it,v(e.$t("suno.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(f,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(a(!0),_(z,null,N(e.options,n=>(a(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=A(st,[["render",at],["__scopeId","data-v-5a66a01f"]]),rt=C({name:"UploadAudio",components:{ElUpload:Ie,ElButton:H,InfoIcon:D,FontAwesomeIcon:q},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),Y.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const r=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:r,action:"upload_extend"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ct={class:"relative"},ut={class:"flex justify-between"},dt={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function mt(e,t,i,o,r,d){const u=c("info-icon"),p=c("font-awesome-icon"),f=c("el-button"),n=c("el-upload");return a(),_("div",ct,[l("div",ut,[l("div",dt,[l("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(u,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),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:$(()=>[s(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),T(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ht=A(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ft="",_t=C({name:"PromptInput",components:{ElInput:K,ElSwitch:re,InfoIcon:D},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},kt={class:"title font-bold"},yt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-switch"),f=c("el-input");return a(),_("div",$t,[l("div",vt,[l("div",gt,[l("h2",kt,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",yt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(f,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ct=A(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",Lt=C({name:"LyricInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=St)}}),At={class:"field"},jt={class:"box"},Et={class:"title font-bold"};function Vt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",At,[l("div",jt,[l("h2",Et,v(e.$t("suno.name.lyrics")),1),s(u,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(a(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(a(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const It=A(Lt,[["render",Vt],["__scopeId","data-v-99dfded8"]]),Tt=C({name:"StyleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Pt={class:"field"},Ft={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Pt,[l("div",Ft,[l("h2",Ut,v(e.$t("suno.name.style")),1),s(u,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=f=>e.style=f),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Mt=A(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Rt=C({name:"TitleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Dt={class:"title-container"},Ot={class:"title font-bold"};function Wt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Gt,[l("div",Dt,[l("h2",Ot,v(e.$t("suno.name.title")),1),s(u,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=f=>e.title=f),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Bt=A(Rt,[["render",Wt],["__scopeId","data-v-ce70fe34"]]);function M(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,r=t<10?`0${t}`:t;return o+":"+r}const Nt=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:R,ElInputNumber:Te,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),qt={class:"field"},Ht={class:"box"},Zt={class:"title font-bold"},Kt={class:"input-wrapper"},Xt={class:"task"},Jt={class:"left"},Qt={key:2,class:"duration"},Yt={class:"info"},xt={class:"title"},eo={class:"style"};function to(e,t,i,o,r,d){const u=c("el-input-number"),p=c("el-image"),f=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=te("loading");return a(),_("div",qt,[l("div",Ht,[l("h2",Zt,v(e.$t("suno.name.extend")),1),l("div",Kt,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=h=>e.value=h),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),l("div",Xt,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=h=>e.onClick(e.audio))},[Z((a(),_("div",Jt,[s(p,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=h=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(f)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=h=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",Qt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Yt,[l("h2",xt,v(e.audio?.title),1),l("p",eo,v(e.audio?.style),1)])])):y("",!0)])])}const oo=A(Nt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:R,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),no={class:"field"},io={class:"box"},ao={class:"title font-bold"},lo={class:"task"},ro={class:"left"},co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"};function ho(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=te("loading");return a(),_("div",no,[l("div",io,[l("h2",ao,v(e.$t("suno.name.cover")),1)]),l("div",lo,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),_("div",ro,[s(u,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(f,null,{default:$(()=>[s(p)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(f,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),l("div",uo,[l("h2",po,v(e.audio?.title),1),l("p",mo,v(e.audio?.style),1)])])):y("",!0)])])}const fo=A(so,[["render",ho],["__scopeId","data-v-06640216"]]),_o=C({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:It,StyleInput:Mt,TitleInput:Bt,ExtendFromInput:oo,CoverFromInput:fo,UploadAudio:ht,FontAwesomeIcon:q,ElButton:H,Consumption:Pe},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Ue(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$o={class:"flex flex-col h-full"},vo={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ko(e,t,i,o,r,d){const u=c("type-selector"),p=c("upload-audio"),f=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),h=c("extend-from-input"),b=c("cover-from-input"),P=c("consumption"),I=c("font-awesome-icon"),j=c("el-button");return a(),_("div",$o,[l("div",vo,[s(u,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?y("",!0):(a(),w(f,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(a(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(m,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(a(),w(h,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(a(),w(b,{key:5,class:"mb-4"})):y("",!0)]),l("div",go,[s(P,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(a(),w(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(I,{icon:"fa-solid fa-magic",class:"mr-2"}),T(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(I,{icon:"fa-solid fa-magic",class:"mr-2"}),T(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const yo=A(_o,[["render",ko],["__scopeId","data-v-b9fab929"]]);var B={exports:{}},wo=B.exports,ne;function bo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(wo,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,k){var h=new XMLHttpRequest;h.open("GET",n),h.responseType="blob",h.onload=function(){f(h.response,m,k)},h.onerror=function(){console.error("could not download file")},h.send()}function r(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function d(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,p=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),f=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var h=u.URL||u.webkitURL,b=document.createElement("a");m=m||n.name||"download",b.download=m,b.rel="noopener",typeof n=="string"?(b.href=n,b.origin===location.origin?d(b):r(b.href)?o(n,m,k):d(b,b.target="_blank")):(b.href=h.createObjectURL(n),setTimeout(function(){h.revokeObjectURL(b.href)},4e4),setTimeout(function(){d(b)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,k){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),m);else if(r(n))o(n,m,k);else{var h=document.createElement("a");h.href=n,h.target="_blank",setTimeout(function(){d(h)})}}:function(n,m,k,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,k);var b=n.type==="application/octet-stream",P=/constructor/i.test(u.HTMLElement)||u.safari,I=/CriOS\/[\d]+/.test(navigator.userAgent);if((I||b&&P||p)&&typeof FileReader<"u"){var j=new FileReader;j.onloadend=function(){var S=j.result;S=I?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=S:location=S,h=null},j.readAsDataURL(n)}else{var g=u.URL||u.webkitURL,F=g.createObjectURL(n);h?h.location=F:location.href=F,h=null,setTimeout(function(){g.revokeObjectURL(F)},4e4)}});u.saveAs=f.saveAs=f,e.exports=f})}(B)),B.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Lo=C({name:"TaskPreview",components:{ElImage:X,ElIcon:R,ElTooltip:Ge,ElButton:H,FontAwesomeIcon:q,VideoPlay:ee,VideoPause:x,ElDropdown:Re,ElDropdownMenu:Me,ElDropdownItem:ze},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=[];const t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(i=>{let o=i;t&&(o.action=t),e.push(o)}),e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{Co.saveAs(d,r)})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:So},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Y.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{E.error(r?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Ao={class:"task"},jo=["onClick"],Eo={class:"left"},Vo=["onClick"],Io=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Fo={class:"title"},Uo={class:"style"},zo={class:"right"},Mo={class:"el-dropdown-link"},Ro={class:"el-dropdown-link"};function Go(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=c("el-button"),k=c("font-awesome-icon"),h=c("el-tooltip"),b=c("el-dropdown-item"),P=c("el-dropdown-menu"),I=c("el-dropdown"),j=te("loading");return a(),_("div",Ao,[(a(!0),_(z,null,N(e.audios,(g,F)=>(a(),_("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),_("div",Eo,[s(u,{src:g?.image_url,class:"cover",fit:"cover"},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:S=>e.onPause(g)},[s(f,null,{default:$(()=>[s(p)]),_:1})],8,Vo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:S=>e.onPlay(g)},[s(f,null,{default:$(()=>[s(n)]),_:1})],8,Io)):y("",!0),g?.duration?(a(),_("div",To,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[j,!g?.audio_url]]),l("div",Po,[l("h2",Fo,v(g?.title),1),l("p",Uo,v(g?.style),1)]),l("div",zo,[g?.audio_url?(a(),w(m,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[T(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(h,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:$(()=>[g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:S=>e.onPreview(S,g?.video_url)},null,8,["onClick"])):y("",!0)]),_:2},1032,["content"]),s(I,null,{dropdown:$(()=>[s(P,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[T(v(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):y("",!0),g?.audio_url?(a(),w(b,{key:1,onClick:S=>e.onDownload(S,g?.audio_url)},{default:$(()=>[T(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Mo,[s(h,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(I,null,{dropdown:$(()=>[s(P,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[T(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[T(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(a(),w(b,{key:1,onClick:S=>e.onConcatMusic(g?.id)},{default:$(()=>[T(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Ro,[s(h,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,jo))),128))])}const Do=A(Lo,[["render",Go]]),Oo={class:"player-slider"},Wo=C({__name:"PlayerSlider",setup(e){const t=G(),i=V({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=V({get:()=>t.state.suno?.audio?.duration,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:u})}),r=()=>{},d=u=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:u});return(u,p)=>(a(),_("div",Oo,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}}),Bo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},qo=["src"],Ho={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ko={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=C({__name:"PlayerSong",setup(e){const t=G(),i=V({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return ae(i,(o,r)=>{if(o?.audio_url!==r?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if(o?.progress!==r?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else o?.state!==r?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==r?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>(a(),_("div",No,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||L(Bo)},null,8,qo),l("div",Ho,[l("div",Zo,[l("div",Ko,[l("span",null,v(i.value?.title||"Music"),1),l("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Qo={class:"flex justify-end items-center gap-x-2.5"},Yo={class:"text-xs"},xo=C({__name:"PlayerAction",setup(e){const t=G(),i=V({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=V({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),_("div",Qo,[l("span",Yo,v(L(M)(i.value))+" / "+v(L(M)(o.value)),1)]))}});var es={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function ts(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function os(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],r=[],d=t.theme||i.theme;switch(d){case"outline":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none");break;case"filled":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("#FFF"),r.push("#FFF");break;case"two-tone":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),r.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),r.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:r,id:e}}var ss=Symbol("icon-context");function J(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(d){var u=ts(),p=Ce(ss,es);return function(){var f=d.size,n=d.strokeWidth,m=d.strokeLinecap,k=d.strokeLinejoin,h=d.theme,b=d.fill,P=d.spin,I=os(u,{size:f,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:h,fill:b},p),j=[p.prefix+"-icon"];return j.push(p.prefix+"-icon-"+e),t&&p.rtl&&j.push(p.prefix+"-icon-rtl"),P&&j.push(p.prefix+"-icon-spin"),s("span",{class:j.join(" ")},[i(I)])}}};return o}const ns=J("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),is=J("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),as=J("volume-mute",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("rect",{opacity:"0.01",x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null),s("mask",{id:e.id+"603476ab",maskUnits:"userSpaceOnUse",x:"30",y:"18",width:"13",height:"13",style:{maskType:"alpha"}},[s("rect",{x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null)]),s("g",{mask:"url(#"+e.id+"603476ab)"},[s("path",{d:"M40.7348 20.2858L32.2495 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32.2496 20.2858L40.7349 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)]),s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ue=J("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Q=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(a(),w(le(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),ls={class:"player-volume flex flex-col items-center pt-2"},rs={class:"text-sm mt-3"},cs={class:"mt-2"},us=C({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=V({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=V({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),r=()=>t.dispatch("suno/toggleMuted"),d=u=>t.dispatch("suno/setVolume",u);return(u,p)=>(a(),_("div",ls,[l("div",null,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",rs,v(i.value),1),l("div",cs,[s(Q,{icon:o.value?L(as):L(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=C({__name:"PlayerController",setup(e){const t=G(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=V(()=>t.state.suno.audio);return(r,d)=>(a(),_("div",ds,[s(Q,{icon:o.value?.state==="playing"?L(ns):L(is),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(L(De),{placement:"top",width:"50px"},{reference:$(()=>[s(Q,{icon:L(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},hs={class:"flex grow px-5 items-center"},fs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=C({__name:"Player",setup(e){return(t,i)=>(a(),_("div",ms,[s(Wo),l("div",hs,[l("div",fs,[s(Jo)]),l("div",_s,[s(ps)]),l("div",$s,[s(xo)])])]))}}),gs=C({name:"RecentPanel",components:{TaskPreview:Do,ElSkeleton:We,ElSkeletonItem:Oe,Player:vs,NoTasks:Fe},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),ks={key:0,class:"tasks"},ys={class:"left"},ws={class:"main"},bs={key:1,class:"tasks"},Cs={key:2,class:"w-full h-full flex items-center justify-center"},Ss={class:"flex-1 flex flex-col"},Ls={class:"h-20"};function As(e,t,i,o,r,d){const u=c("el-skeleton-item"),p=c("el-skeleton"),f=c("task-preview"),n=c("no-tasks"),m=c("player");return a(),_(z,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...k)=>e.onHandleScroll&&e.onHandleScroll(...k))},[e.tasks?.items===void 0?(a(),_("div",ks,[(a(),_(z,null,N(3,k=>l("div",{key:k,class:"task placeholder"},[l("div",ys,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",ws,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"p",class:"title"}),s(u,{variant:"text",style:{"margin-right":"16px"}}),s(u,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),_("div",bs,[(a(!0),_(z,null,N(e.tasks?.items,(k,h)=>(a(),w(f,{key:h,"model-value":k,class:"preview"},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),_("div",Cs,[s(n)])):y("",!0)],544),Z(l("div",Ss,[l("div",Ls,[s(m)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const js=A(gs,[["render",As],["__scopeId","data-v-959f8920"]]),Es=C({name:"TaskPreview",components:{ElScrollbar:Be,IconPicture:Le,ElImage:X,ElAvatar:Xe,ElIcon:R},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Vs={key:0,class:"card"},Is={class:"image-container"},Ts={class:"image-slot"},Ps={class:"title"},Fs={class:"content"},Us={class:"artist"},zs={class:"style"},Ms={class:"time"},Rs={class:"lyrics"},Gs={key:1,class:"gradient-background"};function Ds(e,t,i,o,r,d){const u=c("icon-picture"),p=c("el-icon"),f=c("el-image"),n=c("el-avatar"),m=c("el-scrollbar");return a(),w(m,{class:"right-panel"},{default:$(()=>[e.audio?.object?(a(),_("div",Vs,[l("div",Is,[s(f,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",Ts,[s(p,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Ps,v(e.audio?.title),1)]),l("div",Fs,[l("div",Us,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",zs,v(e.audio?.style),1),l("p",Ms,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",Rs,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),_("div",Gs))]),_:1})}const Os=A(Es,[["render",Ds],["__scopeId","data-v-9b29e9f9"]]),Ws="https://webhook.acedata.cloud/suno",Bs=C({name:"SunoIndex",components:{Layout:ot,ConfigPanel:yo,RecentPanel:js,PreviewPanel:Os},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===W.Request},needApply(){return this.$store.state.suno.status.getApplications===W.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===je&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ws},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Y.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ns(e,t,i,o,r,d){const u=c("config-panel"),p=c("recent-panel"),f=c("preview-panel"),n=c("layout");return a(),w(n,null,{config:$(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(f)]),_:1})}const An=A(Bs,[["render",Ns],["__scopeId","data-v-f5721d95"]]);export{An as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as A}from"./index.es-BWmc-Ids.js";import{E as G}from"./index-ByuWOFZS.js";import{E as P}from"./index-DwBHjA3D.js";import{d as $,h as v,b as l,t as c,k as t,r as E,j as p,l as i,o,c6 as D,x as n,D as _,F as w,v as I,i as V,n as T,c as L,y as g,eK as j,dr as z,de as O,dl as B,dm as C}from"./index-nA-KAadb.js";import{I as M}from"./InfoIcon-CR695ufA.js";import{E as q}from"./index-Cr990IMl.js";import{E as k}from"./index-DIe9QyqZ.js";import{a as F,E as N}from"./index-DieUsk35.js";import{E as U}from"./index-CB99gthx.js";import{E as H,a as K}from"./index-C5fxjt4O.js";import{A as J}from"./Status-BC8c7-WE.js";import{C as Q}from"./CopyToClipboard-dTRt17Kr.js";import{E as W}from"./index-K2-1oMVV.js";import{a as X,E as Y}from"./index-DchjM2DH.js";import"./use-form-item-DUTsbuH3.js";import"./index-r5W6hzzQ.js";import"./index-CAn3RarN.js";import"./index-DZOe-iSx.js";import"./typescript-b8ZbHHzg.js";import"./index-CR5eH4ys.js";import"./_baseClone-qufK5Sex.js";import"./_Uint8Array-Bdooy9AK.js";import"./_initCloneObject-Bk5aFlNA.js";import"./isEqual-BwZuGT6W.js";import"./debounce-znxeRhUH.js";import"./index-BiH-ehNW.js";import"./strings-B0sKE5ZU.js";import"./isPlainObject-CVrnJwwT.js";const Z=$({name:"LayoutHeadshots",components:{ElDrawer:P,ElButton:G,FontAwesomeIcon:A},data(){return{drawer:!1}}}),x={class:"main"},ee={class:"config"},te={class:"result"};function se(e,s,m,u,b,y){const d=i("font-awesome-icon"),h=i("el-button"),a=i("el-drawer");return o(),l("div",x,[c("div",ee,[E(e.$slots,"config",{},void 0,!0)]),c("div",te,[E(e.$slots,"result",{},void 0,!0)]),t(h,{round:"",class:"menu",onClick:s[0]||(s[0]=r=>e.drawer=!0)},{default:p(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=r=>e.drawer=r),"with-header":!1,size:"340px",class:"drawer"},{default:p(()=>[E(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const oe=v(Z,[["render",se],["__scopeId","data-v-38abce67"]]),ae=$({name:"ImageUrlsInput",components:{ElUpload:q,ElButton:G,InfoIcon:M},data(){return{fileList:[],uploadUrl:D()+"/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(){k.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){k.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()}}}),ne={class:"field"},ie={class:"title font-bold"},le={class:"upload-wrapper"};function re(e,s,m,u,b,y){const d=i("el-button"),h=i("el-upload"),a=i("info-icon");return o(),l("div",ne,[c("h2",ie,n(e.$t("headshots.name.endImageUrls")),1),c("div",le,[t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=r=>e.fileList=r),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:2,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:p(()=>[t(d,{size:"small",type:"primary",round:""},{default:p(()=>[_(n(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(a,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const ce=v(ae,[["render",re],["__scopeId","data-v-a6bd8c31"]]),de="fast",pe=$({name:"ModeSelector",components:{ElRadioButton:N,ElRadioGroup:F},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=de)}}),me={class:"field"},ue={class:"title font-bold"};function he(e,s,m,u,b,y){const d=i("el-radio-button"),h=i("el-radio-group");return o(),l("div",me,[c("h2",ue,n(e.$t("headshots.name.mode")),1),t(h,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),size:"small",class:"mode"},{default:p(()=>[(o(!0),l(w,null,I(e.options,a=>(o(),V(d,{key:a.value,label:a.value},{default:p(()=>[_(n(a.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const _e=v(pe,[["render",he],["__scopeId","data-v-a2a0d5fa"]]),fe=$({name:"StylizeSelector",components:{ElTabs:K,ElTabPane:H,ElImage:U},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})}}}),ge={class:"field"},$e=["onClick"],ve={class:"name"};function be(e,s,m,u,b,y){const d=i("el-image"),h=i("el-tab-pane"),a=i("el-tabs");return o(),l("div",ge,[t(a,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=r=>e.tab=r)},{default:p(()=>[(o(!0),l(w,null,I(e.elements,(r,f)=>(o(),V(h,{key:f,label:r.displayName,name:f,class:"pane"},{default:p(()=>[(o(!0),l(w,null,I(r.items,(S,R)=>(o(),l("div",{key:R,class:T({item:!0,active:e.value===S.value}),onClick:ht=>e.onToggle(S.value)},[t(d,{src:S.image,fit:"fill",class:"preview"},null,8,["src"]),c("span",ve,n(S.label),1)],10,$e))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const ye=v(fe,[["render",be],["__scopeId","data-v-be4bd25d"]]),ke=$({name:"PresetPanel",components:{ModeSelector:_e,ImageUrlsInput:ce,ElButton:G,FontAwesomeIcon:A,ElementsSelector:ye},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),we={class:"panel"},Ie={class:"config"},Te={class:"actions"};function Se(e,s,m,u,b,y){const d=i("elements-selector"),h=i("mode-selector"),a=i("image-urls-input"),r=i("font-awesome-icon"),f=i("el-button");return o(),l("div",we,[c("div",Ie,[t(d,{class:"mb-4"}),t(h,{class:"mb-4"}),t(a,{class:"mb-4"}),c("div",Te,[t(f,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(r,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+n(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ve=v(ke,[["render",Se],["__scopeId","data-v-78172a54"]]),Ee=$({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:L(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:u=>{window.open(u,"_blank")}}}}),Ce={class:"image-gallery"},Ae=["src"],Ge=["onClick"];function Ue(e,s,m,u,b,y){return o(),l("div",Ce,[(o(!0),l(w,null,I(e.images,(d,h)=>(o(),l("div",{key:h,class:"image-container"},[c("img",{src:d.image_url,alt:"Image"},null,8,Ae),d.image_url?(o(),l("button",{key:0,class:"view-button",onClick:a=>e.viewImage(d.image_url)},n(e.$t("headshots.button.viewImage")),9,Ge)):g("",!0)]))),128))])}const Re=v(Ee,[["render",Ue],["__scopeId","data-v-03641510"]]),Pe=$({name:"TaskPreview",components:{ElImage:U,CopyToClipboard:Q,FontAwesomeIcon:A,ElAlert:W,ImageGallery:Re},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,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,m=new URL(s.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;s.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),De={class:"preview"},Le={class:"left"},je={class:"main"},ze={class:"bot"},Oe={class:"datetime"},Be={class:"info"},Me={key:0,class:"prompt mt-2"},qe={key:0},Fe={key:1},Ne={key:0,class:T({content:!0,failed:!0})},He={class:"image-wrapper"},Ke={class:"description"},Je={key:1,class:T({content:!0})},Qe={class:"description"},We={class:"description"},Xe={class:"description"},Ye={key:2,class:T({content:!0})},Ze={class:"description"},xe={key:3,class:T({content:!0})},et={class:"description"};function tt(e,s,m,u,b,y){const d=i("el-image"),h=i("image-gallery"),a=i("font-awesome-icon"),r=i("copy-to-clipboard"),f=i("el-alert");return o(),l("div",De,[c("div",Le,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),c("div",je,[c("div",ze,[_(n(e.$t("headshots.name.headshotsBot"))+" ",1),c("span",Oe,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",Be,[e.modelValue?.request?.template?(o(),l("p",Me,[_(n(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?g("",!0):(o(),l("span",qe," - ("+n(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(o(),l("span",Fe," - ("+n(e.$t("headshots.status.processing"))+") ",1)):g("",!0)])):g("",!0)]),e.modelValue?.response?.success===!0?(o(),l("div",Ne,[c("div",He,[t(h,{"model-value":e.modelValue},null,8,["model-value"])]),t(f,{closable:!1,class:"mt-2 success"},{default:p(()=>[c("p",Ke,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?.success===!1?(o(),l("div",Je,[t(f,{closable:!1,class:"failure"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Qe,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),c("p",We,[t(a,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t(r,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),c("p",Xe,[t(a,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("headshots.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t(r,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?g("",!0):(o(),l("div",Ye,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Ze,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(o(),l("div",xe,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",et,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0)])])}const st=v(Pe,[["render",tt],["__scopeId","data-v-77229910"]]),ot=$({name:"RecentPanel",components:{TaskPreview:st,ElSkeleton:Y,ElSkeletonItem:X},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),at={key:0,class:"tasks"},nt={class:"left"},it={class:"main"},lt={key:1,class:"tasks"},rt={key:2,class:"description"};function ct(e,s,m,u,b,y){const d=i("el-skeleton-item"),h=i("el-skeleton"),a=i("task-preview");return o(),l("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...r)=>e.onHandleScroll&&e.onHandleScroll(...r))},[e.tasks?.items===void 0?(o(),l("div",at,[(o(),l(w,null,I(3,r=>c("div",{key:r,class:"task placeholder"},[c("div",nt,[t(h,{animated:""},{template:p(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),c("div",it,[t(h,{animated:""},{template:p(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(o(),l("div",lt,[(o(!0),l(w,null,I(e.tasks?.items,(r,f)=>(o(),V(a,{key:f,"model-value":r,class:"preview"},null,8,["model-value"]))),128))])):g("",!0),e.tasks?.items?.length===0?(o(),l("p",rt,n(e.$t("headshots.message.noTasks")),1)):g("",!0)],544)}const dt=v(ot,[["render",ct],["__scopeId","data-v-d79bcb1f"]]),pt="https://webhook.acedata.cloud/headshots",mt=$({name:"HeadshotsIndex",components:{ConfigPanel:Ve,Layout:oe,ApplicationStatus:J,RecentPanel:dt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.headshots?.status?.getApplications===C.Request},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===C.Request},needApply(){return this.$store.state.headshots.status.getApplications===C.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,s){e?.items?.length>s?.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=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},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(){O.create({application:this.application}).then(({data:e})=>{this.application=e,k.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===B&&k.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:u}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",u),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:m,createdAtMax:u})},async onGeneratePicture(){const e={...this.config,callback_url:pt},s=this.credential?.token;if(!s){console.error("no token specified");return}k.info(this.$t("headshots.message.startingTask")),j.generate(e,{token:s}).then(()=>{k.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===z?k.error(this.$t("headshots.message.usedUp")):k.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ut(e,s,m,u,b,y){const d=i("config-panel"),h=i("application-status"),a=i("recent-panel"),r=i("layout");return o(),V(r,null,{config:p(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:p(()=>[t(h,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:s[0]||(s[0]=f=>e.$store.dispatch("headshots/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(a,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Ft=v(mt,[["render",ut],["__scopeId","data-v-19d3c623"]]);export{Ft as default};
|
|
1
|
+
import{F as A}from"./index.es-j7hA4q1g.js";import{E as G}from"./index-C9b_qrYa.js";import{E as P}from"./index-BSwIBR6M.js";import{d as $,h as v,b as l,t as c,k as t,r as E,j as p,l as i,o,c6 as D,x as n,D as _,F as w,v as I,i as V,n as T,c as L,y as g,eK as j,dr as z,de as O,dl as B,dm as C}from"./index-BsGpMJTb.js";import{I as M}from"./InfoIcon-CWVvZnOl.js";import{E as q}from"./index-jkLgEM33.js";import{E as k}from"./index-DFklJOqx.js";import{a as F,E as N}from"./index-B3SVNm-k.js";import{E as U}from"./index-CPfOvcsc.js";import{E as H,a as K}from"./index-C58ZzxdA.js";import{A as J}from"./Status-D2fneldj.js";import{C as Q}from"./CopyToClipboard-OXkvUoT-.js";import{E as W}from"./index-tynyZ2ck.js";import{a as X,E as Y}from"./index-4akd2uM4.js";import"./use-form-item-B27IDTSh.js";import"./index-r5W6hzzQ.js";import"./index-DJcFf6kq.js";import"./index-CxRCvRBZ.js";import"./typescript-Dc6IjKEd.js";import"./index-R8KVxj24.js";import"./_baseClone-C7rLiyxP.js";import"./_Uint8Array-D2_20NB1.js";import"./_initCloneObject-De4hbrPJ.js";import"./isEqual-DV-fric-.js";import"./debounce-XchV9dnA.js";import"./index-IpqKHPW0.js";import"./strings-kuNfgIBh.js";import"./isPlainObject-CoL8-sdZ.js";const Z=$({name:"LayoutHeadshots",components:{ElDrawer:P,ElButton:G,FontAwesomeIcon:A},data(){return{drawer:!1}}}),x={class:"main"},ee={class:"config"},te={class:"result"};function se(e,s,m,u,b,y){const d=i("font-awesome-icon"),h=i("el-button"),a=i("el-drawer");return o(),l("div",x,[c("div",ee,[E(e.$slots,"config",{},void 0,!0)]),c("div",te,[E(e.$slots,"result",{},void 0,!0)]),t(h,{round:"",class:"menu",onClick:s[0]||(s[0]=r=>e.drawer=!0)},{default:p(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=r=>e.drawer=r),"with-header":!1,size:"340px",class:"drawer"},{default:p(()=>[E(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const oe=v(Z,[["render",se],["__scopeId","data-v-38abce67"]]),ae=$({name:"ImageUrlsInput",components:{ElUpload:q,ElButton:G,InfoIcon:M},data(){return{fileList:[],uploadUrl:D()+"/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(){k.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){k.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()}}}),ne={class:"field"},ie={class:"title font-bold"},le={class:"upload-wrapper"};function re(e,s,m,u,b,y){const d=i("el-button"),h=i("el-upload"),a=i("info-icon");return o(),l("div",ne,[c("h2",ie,n(e.$t("headshots.name.endImageUrls")),1),c("div",le,[t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=r=>e.fileList=r),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:2,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:p(()=>[t(d,{size:"small",type:"primary",round:""},{default:p(()=>[_(n(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(a,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const ce=v(ae,[["render",re],["__scopeId","data-v-a6bd8c31"]]),de="fast",pe=$({name:"ModeSelector",components:{ElRadioButton:N,ElRadioGroup:F},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=de)}}),me={class:"field"},ue={class:"title font-bold"};function he(e,s,m,u,b,y){const d=i("el-radio-button"),h=i("el-radio-group");return o(),l("div",me,[c("h2",ue,n(e.$t("headshots.name.mode")),1),t(h,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),size:"small",class:"mode"},{default:p(()=>[(o(!0),l(w,null,I(e.options,a=>(o(),V(d,{key:a.value,label:a.value},{default:p(()=>[_(n(a.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const _e=v(pe,[["render",he],["__scopeId","data-v-a2a0d5fa"]]),fe=$({name:"StylizeSelector",components:{ElTabs:K,ElTabPane:H,ElImage:U},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})}}}),ge={class:"field"},$e=["onClick"],ve={class:"name"};function be(e,s,m,u,b,y){const d=i("el-image"),h=i("el-tab-pane"),a=i("el-tabs");return o(),l("div",ge,[t(a,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=r=>e.tab=r)},{default:p(()=>[(o(!0),l(w,null,I(e.elements,(r,f)=>(o(),V(h,{key:f,label:r.displayName,name:f,class:"pane"},{default:p(()=>[(o(!0),l(w,null,I(r.items,(S,R)=>(o(),l("div",{key:R,class:T({item:!0,active:e.value===S.value}),onClick:ht=>e.onToggle(S.value)},[t(d,{src:S.image,fit:"fill",class:"preview"},null,8,["src"]),c("span",ve,n(S.label),1)],10,$e))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const ye=v(fe,[["render",be],["__scopeId","data-v-be4bd25d"]]),ke=$({name:"PresetPanel",components:{ModeSelector:_e,ImageUrlsInput:ce,ElButton:G,FontAwesomeIcon:A,ElementsSelector:ye},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),we={class:"panel"},Ie={class:"config"},Te={class:"actions"};function Se(e,s,m,u,b,y){const d=i("elements-selector"),h=i("mode-selector"),a=i("image-urls-input"),r=i("font-awesome-icon"),f=i("el-button");return o(),l("div",we,[c("div",Ie,[t(d,{class:"mb-4"}),t(h,{class:"mb-4"}),t(a,{class:"mb-4"}),c("div",Te,[t(f,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(r,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+n(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ve=v(ke,[["render",Se],["__scopeId","data-v-78172a54"]]),Ee=$({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:L(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:u=>{window.open(u,"_blank")}}}}),Ce={class:"image-gallery"},Ae=["src"],Ge=["onClick"];function Ue(e,s,m,u,b,y){return o(),l("div",Ce,[(o(!0),l(w,null,I(e.images,(d,h)=>(o(),l("div",{key:h,class:"image-container"},[c("img",{src:d.image_url,alt:"Image"},null,8,Ae),d.image_url?(o(),l("button",{key:0,class:"view-button",onClick:a=>e.viewImage(d.image_url)},n(e.$t("headshots.button.viewImage")),9,Ge)):g("",!0)]))),128))])}const Re=v(Ee,[["render",Ue],["__scopeId","data-v-03641510"]]),Pe=$({name:"TaskPreview",components:{ElImage:U,CopyToClipboard:Q,FontAwesomeIcon:A,ElAlert:W,ImageGallery:Re},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,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,m=new URL(s.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;s.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),De={class:"preview"},Le={class:"left"},je={class:"main"},ze={class:"bot"},Oe={class:"datetime"},Be={class:"info"},Me={key:0,class:"prompt mt-2"},qe={key:0},Fe={key:1},Ne={key:0,class:T({content:!0,failed:!0})},He={class:"image-wrapper"},Ke={class:"description"},Je={key:1,class:T({content:!0})},Qe={class:"description"},We={class:"description"},Xe={class:"description"},Ye={key:2,class:T({content:!0})},Ze={class:"description"},xe={key:3,class:T({content:!0})},et={class:"description"};function tt(e,s,m,u,b,y){const d=i("el-image"),h=i("image-gallery"),a=i("font-awesome-icon"),r=i("copy-to-clipboard"),f=i("el-alert");return o(),l("div",De,[c("div",Le,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),c("div",je,[c("div",ze,[_(n(e.$t("headshots.name.headshotsBot"))+" ",1),c("span",Oe,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",Be,[e.modelValue?.request?.template?(o(),l("p",Me,[_(n(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?g("",!0):(o(),l("span",qe," - ("+n(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(o(),l("span",Fe," - ("+n(e.$t("headshots.status.processing"))+") ",1)):g("",!0)])):g("",!0)]),e.modelValue?.response?.success===!0?(o(),l("div",Ne,[c("div",He,[t(h,{"model-value":e.modelValue},null,8,["model-value"])]),t(f,{closable:!1,class:"mt-2 success"},{default:p(()=>[c("p",Ke,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?.success===!1?(o(),l("div",Je,[t(f,{closable:!1,class:"failure"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Qe,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),c("p",We,[t(a,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t(r,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),c("p",Xe,[t(a,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("headshots.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t(r,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?g("",!0):(o(),l("div",Ye,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Ze,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(o(),l("div",xe,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",et,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0)])])}const st=v(Pe,[["render",tt],["__scopeId","data-v-77229910"]]),ot=$({name:"RecentPanel",components:{TaskPreview:st,ElSkeleton:Y,ElSkeletonItem:X},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),at={key:0,class:"tasks"},nt={class:"left"},it={class:"main"},lt={key:1,class:"tasks"},rt={key:2,class:"description"};function ct(e,s,m,u,b,y){const d=i("el-skeleton-item"),h=i("el-skeleton"),a=i("task-preview");return o(),l("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...r)=>e.onHandleScroll&&e.onHandleScroll(...r))},[e.tasks?.items===void 0?(o(),l("div",at,[(o(),l(w,null,I(3,r=>c("div",{key:r,class:"task placeholder"},[c("div",nt,[t(h,{animated:""},{template:p(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),c("div",it,[t(h,{animated:""},{template:p(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(o(),l("div",lt,[(o(!0),l(w,null,I(e.tasks?.items,(r,f)=>(o(),V(a,{key:f,"model-value":r,class:"preview"},null,8,["model-value"]))),128))])):g("",!0),e.tasks?.items?.length===0?(o(),l("p",rt,n(e.$t("headshots.message.noTasks")),1)):g("",!0)],544)}const dt=v(ot,[["render",ct],["__scopeId","data-v-d79bcb1f"]]),pt="https://webhook.acedata.cloud/headshots",mt=$({name:"HeadshotsIndex",components:{ConfigPanel:Ve,Layout:oe,ApplicationStatus:J,RecentPanel:dt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.headshots?.status?.getApplications===C.Request},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===C.Request},needApply(){return this.$store.state.headshots.status.getApplications===C.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,s){e?.items?.length>s?.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=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},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(){O.create({application:this.application}).then(({data:e})=>{this.application=e,k.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===B&&k.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:u}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",u),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:m,createdAtMax:u})},async onGeneratePicture(){const e={...this.config,callback_url:pt},s=this.credential?.token;if(!s){console.error("no token specified");return}k.info(this.$t("headshots.message.startingTask")),j.generate(e,{token:s}).then(()=>{k.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===z?k.error(this.$t("headshots.message.usedUp")):k.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ut(e,s,m,u,b,y){const d=i("config-panel"),h=i("application-status"),a=i("recent-panel"),r=i("layout");return o(),V(r,null,{config:p(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:p(()=>[t(h,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:s[0]||(s[0]=f=>e.$store.dispatch("headshots/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(a,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Ft=v(mt,[["render",ut],["__scopeId","data-v-19d3c623"]]);export{Ft as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as E}from"./index.es-BWmc-Ids.js";import{E as S}from"./index-ByuWOFZS.js";import{E as U}from"./index-DwBHjA3D.js";import{d as h,h as $,b as i,t as a,k as t,r as T,j as _,l as s,o as r,eF as j,x as l,F as y,v as C,i as V,eG as D,D as f,y as x,n as I,eH as F,dr as P,dm as R}from"./index-nA-KAadb.js";import{E as L,a as M}from"./index-DhsSA5Ku.js";import{I as G}from"./InfoIcon-CR695ufA.js";import{E as B,a as O}from"./index-Ci_9zUBa.js";import{E as q}from"./index-CYhI27vG.js";import{C as N,N as z}from"./NoTasks-DPySH-qR.js";import{a as H}from"./price-CCwZcNw3.js";import{C as X}from"./CopyToClipboard-dTRt17Kr.js";import{I as K}from"./ImageWrapper-BDxTSoQ7.js";import{E as W}from"./index-K2-1oMVV.js";import{E as J}from"./index-CB99gthx.js";import{B as Q}from"./BotPlaceholder-DLI4FHw7.js";import{E as w}from"./index-DIe9QyqZ.js";import"./use-form-item-DUTsbuH3.js";import"./index-r5W6hzzQ.js";import"./index-CAn3RarN.js";import"./index-DZOe-iSx.js";import"./typescript-b8ZbHHzg.js";import"./index-BmNvGNis.js";import"./strings-B0sKE5ZU.js";import"./castArray-Bfjgey1B.js";import"./isEqual-BwZuGT6W.js";import"./_Uint8Array-Bdooy9AK.js";import"./debounce-znxeRhUH.js";import"./_baseIteratee-DZ2YvAcL.js";import"./index-CWL1zWCv.js";import"./index-BiH-ehNW.js";import"./index-DchjM2DH.js";const Y=h({name:"LayoutFlux",components:{ElDrawer:U,ElButton:S,FontAwesomeIcon:E},data(){return{drawer:!1}}}),Z={class:"main"},ee={class:"config"},te={class:"result"};function oe(e,o,p,c,g,v){const d=s("font-awesome-icon"),m=s("el-button"),n=s("el-drawer");return r(),i("div",Z,[a("div",ee,[T(e.$slots,"config",{},void 0,!0)]),a("div",te,[T(e.$slots,"result",{},void 0,!0)]),t(m,{round:"",class:"menu",onClick:o[0]||(o[0]=u=>e.drawer=!0)},{default:_(()=>[t(d,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=u=>e.drawer=u),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:_(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const se=$(Y,[["render",oe],["__scopeId","data-v-e9960b72"]]),ne=h({name:"ModelSelector",components:{ElSelect:M,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"flux-schnell",label:"flux-schnell"},{value:"flux-dev",label:"flux-dev"},{value:"flux-pro",label:"flux-pro"},{value:"flux-pro-1.1",label:"flux-pro-1.1"},{value:"flux-pro-1.1-ultra",label:"flux-pro-1.1-ultra"},{value:"flux-kontext-pro",label:"flux-kontext-pro"},{value:"flux-kontext-max",label:"flux-kontext-max"}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||(this.value=j)}}),ae={class:"field"},le={class:"title font-bold"};function re(e,o,p,c,g,v){const d=s("el-option"),m=s("el-select");return r(),i("div",ae,[a("h2",le,l(e.$t("flux.name.model")),1),t(m,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:_(()=>[(r(!0),i(y,null,C(e.options,n=>(r(),V(d,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ie=$(ne,[["render",re],["__scopeId","data-v-2e94cca6"]]),ce=h({name:"CountSelector",components:{ElSlider:O,InfoIcon:G,ElInputNumber:B},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug("set count",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||(this.value=D)}}),ue={class:"flex justify-between"},de={class:"flex justify-start items-center"},me={class:"text-sm font-bold"},pe={class:"flex justify-end items-center"},fe={class:"w-full"};function _e(e,o,p,c,g,v){const d=s("info-icon"),m=s("el-input-number"),n=s("el-slider");return r(),i("div",null,[a("div",ue,[a("div",de,[a("span",me,l(e.$t("flux.name.numbers")),1),t(d,{content:e.$t("flux.description.numbers")},null,8,["content"])]),a("div",pe,[t(m,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=u=>e.value=u),"controls-position":"right"},null,8,["modelValue"])])]),a("div",fe,[t(n,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=u=>e.value=u),min:1,max:4,step:1},null,8,["modelValue"])])])}const he=$(ce,[["render",_e]]),$e="",ge=h({name:"PromptInput",components:{ElInput:q,InfoIcon:G},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=$e)}}),ve={class:"field"},be={class:"box"},xe={class:"title font-bold"};function ke(e,o,p,c,g,v){const d=s("info-icon"),m=s("el-input");return r(),i("div",ve,[a("div",be,[a("h2",xe,l(e.$t("flux.name.prompt")),1),t(d,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(m,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const we=$(ge,[["render",ke],["__scopeId","data-v-4c101a17"]]),ye=h({name:"PresetPanel",components:{ElButton:S,FontAwesomeIcon:E,PromptInput:we,ModelSelector:ie,CountSelector:he,Consumption:N},emits:["generate"],computed:{config(){return this.$store.state.flux?.config},consumption(){return H(this.config,this.service?.metadata?.price)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Ve={class:"flex flex-col h-full"},Te={class:"flex-1 overflow-y-auto p-[15px]"},Ee={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Ce(e,o,p,c,g,v){const d=s("prompt-input"),m=s("model-selector"),n=s("count-selector"),u=s("consumption"),b=s("font-awesome-icon"),k=s("el-button");return r(),i("div",Ve,[a("div",Te,[t(d,{class:"mb-4"}),t(m,{class:"mb-4"}),t(n,{class:"mb-4"})]),a("div",Ee,[t(u,{value:e.consumption,service:e.service},null,8,["value","service"]),t(k,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:_(()=>[t(b,{icon:"fa-solid fa-magic",class:"mr-2"}),f(" "+l(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])}const Ie=$(ye,[["render",Ce]]),Se=h({name:"TaskPreview",components:{ElImage:J,CopyToClipboard:X,FontAwesomeIcon:E,ElAlert:W,ImageWrapper:K},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(p=>{let c=p;o&&(c.action=o),e.push(c)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Ge={class:"preview"},Ae={class:"left"},Ue={class:"main"},je={class:"bot"},De={class:"datetime"},Fe={class:"info"},Pe={key:0,class:"prompt mt-2"},Re={key:0},Le={key:0,class:I({content:!0,failed:!0})},Me={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},Be={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Oe={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},qe={key:1,class:I({content:!0})},Ne={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ze={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},He={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Xe={key:2,class:I({content:!0})},Ke={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function We(e,o,p,c,g,v){const d=s("el-image"),m=s("image-wrapper"),n=s("font-awesome-icon"),u=s("copy-to-clipboard"),b=s("el-alert");return r(),i("div",Ge,[a("div",Ae,[t(d,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),a("div",Ue,[a("div",je,[f(l(e.$t("flux.name.fluxBot"))+" ",1),a("span",De,l(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Fe,[e.modelValue?.request?.prompt?(r(),i("p",Pe,[f(l(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?x("",!0):(r(),i("span",Re," - ("+l(e.$t("flux.status.pending"))+") ",1))])):x("",!0)]),e.modelValue?.response?.success===!0?(r(),i("div",Le,[a("div",Me,[(r(!0),i(y,null,C(e.images,(k,A)=>(r(),V(m,{key:A,src:k?.image_url,"raw-src":k?.image_url,"model-value":k},null,8,["src","raw-src","model-value"]))),128))]),t(b,{closable:!1,class:"mt-2 success"},{default:_(()=>[a("p",Be,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.model"))+": "+l(e.modelValue?.request?.model),1)]),a("p",Oe,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?.success===!1?(r(),i("div",qe,[t(b,{closable:!1,class:"failure"},{template:_(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",Ne,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),a("p",ze,[t(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),f(" "+l(e.$t("flux.name.failureReason"))+": "+l(e.modelValue?.response?.error?.message)+" ",1),t(u,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),a("p",He,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.traceId"))+": "+l(e.modelValue?.response?.trace_id)+" ",1),t(u,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?x("",!0):(r(),i("div",Xe,[t(b,{closable:!1,class:"info"},{template:_(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",Ke,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const Je=$(Se,[["render",We],["__scopeId","data-v-fd5838a5"]]),Qe=h({name:"RecentPanel",components:{TaskPreview:Je,BotPlaceholder:Q,NoTasks:z},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Ye={key:0},Ze={key:1,class:"tasks h-full w-full overflow-y-auto"},et={key:2,class:"w-full h-full flex items-center justify-center"};function tt(e,o,p,c,g,v){const d=s("bot-placeholder"),m=s("task-preview"),n=s("no-tasks");return r(),i(y,null,[e.tasks?.items===void 0?(r(),i("div",Ye,[t(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(r(),i("div",Ze,[(r(!0),i(y,null,C(e.tasks?.items,(u,b)=>(r(),V(m,{key:b,"model-value":u},null,8,["model-value"]))),128))])):x("",!0),e.tasks?.items?.length===0?(r(),i("div",et,[t(n)])):x("",!0)],64)}const ot=$(Qe,[["render",tt]]),st="https://webhook.acedata.cloud/flux",nt=h({name:"FluxIndex",components:{ConfigPanel:Ie,Layout:se,RecentPanel:ot},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===R.Request},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.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=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("flux/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("flux/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:c}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",c),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:p,createdAtMax:c})},async onGenerate(){const e={...this.config,callback_url:st},o=this.credential?.token;if(!o){console.error("no token specified");return}w.info(this.$t("flux.message.startingTask")),F.generate(e,{token:o}).then(()=>{w.success(this.$t("flux.message.startTaskSuccess"))}).catch(p=>{const c=p?.response?.data;c?.error?.code===P?w.error(this.$t("flux.message.usedUp")):w.error(this.$t("flux.message.startTaskFailed")+c?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function at(e,o,p,c,g,v){const d=s("config-panel"),m=s("recent-panel"),n=s("layout");return r(),V(n,null,{config:_(()=>[t(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:_(()=>[t(m,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Pt=$(nt,[["render",at]]);export{Pt as default};
|
|
1
|
+
import{F as E}from"./index.es-j7hA4q1g.js";import{E as S}from"./index-C9b_qrYa.js";import{E as U}from"./index-BSwIBR6M.js";import{d as h,h as $,b as i,t as a,k as t,r as T,j as _,l as s,o as r,eF as j,x as l,F as y,v as C,i as V,eG as D,D as f,y as x,n as I,eH as F,dr as P,dm as R}from"./index-BsGpMJTb.js";import{E as L,a as M}from"./index-Di4fVUMw.js";import{I as G}from"./InfoIcon-CWVvZnOl.js";import{E as B,a as O}from"./index-718NSZgM.js";import{E as q}from"./index-D5QUlWJ2.js";import{C as N,N as z}from"./NoTasks-D-PxBwiz.js";import{a as H}from"./price-B4pvZaQV.js";import{C as X}from"./CopyToClipboard-OXkvUoT-.js";import{I as K}from"./ImageWrapper-C7z6Wqul.js";import{E as W}from"./index-tynyZ2ck.js";import{E as J}from"./index-CPfOvcsc.js";import{B as Q}from"./BotPlaceholder-DN22Fc21.js";import{E as w}from"./index-DFklJOqx.js";import"./use-form-item-B27IDTSh.js";import"./index-r5W6hzzQ.js";import"./index-DJcFf6kq.js";import"./index-CxRCvRBZ.js";import"./typescript-Dc6IjKEd.js";import"./index-D2Y3gAJL.js";import"./strings-kuNfgIBh.js";import"./castArray-B9qiBuq3.js";import"./isEqual-DV-fric-.js";import"./_Uint8Array-D2_20NB1.js";import"./debounce-XchV9dnA.js";import"./_baseIteratee-Ct4ORPe7.js";import"./index-DY9jZOUy.js";import"./index-IpqKHPW0.js";import"./index-4akd2uM4.js";const Y=h({name:"LayoutFlux",components:{ElDrawer:U,ElButton:S,FontAwesomeIcon:E},data(){return{drawer:!1}}}),Z={class:"main"},ee={class:"config"},te={class:"result"};function oe(e,o,p,c,g,v){const d=s("font-awesome-icon"),m=s("el-button"),n=s("el-drawer");return r(),i("div",Z,[a("div",ee,[T(e.$slots,"config",{},void 0,!0)]),a("div",te,[T(e.$slots,"result",{},void 0,!0)]),t(m,{round:"",class:"menu",onClick:o[0]||(o[0]=u=>e.drawer=!0)},{default:_(()=>[t(d,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=u=>e.drawer=u),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:_(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const se=$(Y,[["render",oe],["__scopeId","data-v-e9960b72"]]),ne=h({name:"ModelSelector",components:{ElSelect:M,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"flux-schnell",label:"flux-schnell"},{value:"flux-dev",label:"flux-dev"},{value:"flux-pro",label:"flux-pro"},{value:"flux-pro-1.1",label:"flux-pro-1.1"},{value:"flux-pro-1.1-ultra",label:"flux-pro-1.1-ultra"},{value:"flux-kontext-pro",label:"flux-kontext-pro"},{value:"flux-kontext-max",label:"flux-kontext-max"}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||(this.value=j)}}),ae={class:"field"},le={class:"title font-bold"};function re(e,o,p,c,g,v){const d=s("el-option"),m=s("el-select");return r(),i("div",ae,[a("h2",le,l(e.$t("flux.name.model")),1),t(m,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:_(()=>[(r(!0),i(y,null,C(e.options,n=>(r(),V(d,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ie=$(ne,[["render",re],["__scopeId","data-v-2e94cca6"]]),ce=h({name:"CountSelector",components:{ElSlider:O,InfoIcon:G,ElInputNumber:B},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug("set count",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||(this.value=D)}}),ue={class:"flex justify-between"},de={class:"flex justify-start items-center"},me={class:"text-sm font-bold"},pe={class:"flex justify-end items-center"},fe={class:"w-full"};function _e(e,o,p,c,g,v){const d=s("info-icon"),m=s("el-input-number"),n=s("el-slider");return r(),i("div",null,[a("div",ue,[a("div",de,[a("span",me,l(e.$t("flux.name.numbers")),1),t(d,{content:e.$t("flux.description.numbers")},null,8,["content"])]),a("div",pe,[t(m,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=u=>e.value=u),"controls-position":"right"},null,8,["modelValue"])])]),a("div",fe,[t(n,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=u=>e.value=u),min:1,max:4,step:1},null,8,["modelValue"])])])}const he=$(ce,[["render",_e]]),$e="",ge=h({name:"PromptInput",components:{ElInput:q,InfoIcon:G},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=$e)}}),ve={class:"field"},be={class:"box"},xe={class:"title font-bold"};function ke(e,o,p,c,g,v){const d=s("info-icon"),m=s("el-input");return r(),i("div",ve,[a("div",be,[a("h2",xe,l(e.$t("flux.name.prompt")),1),t(d,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(m,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const we=$(ge,[["render",ke],["__scopeId","data-v-4c101a17"]]),ye=h({name:"PresetPanel",components:{ElButton:S,FontAwesomeIcon:E,PromptInput:we,ModelSelector:ie,CountSelector:he,Consumption:N},emits:["generate"],computed:{config(){return this.$store.state.flux?.config},consumption(){return H(this.config,this.service?.metadata?.price)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Ve={class:"flex flex-col h-full"},Te={class:"flex-1 overflow-y-auto p-[15px]"},Ee={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Ce(e,o,p,c,g,v){const d=s("prompt-input"),m=s("model-selector"),n=s("count-selector"),u=s("consumption"),b=s("font-awesome-icon"),k=s("el-button");return r(),i("div",Ve,[a("div",Te,[t(d,{class:"mb-4"}),t(m,{class:"mb-4"}),t(n,{class:"mb-4"})]),a("div",Ee,[t(u,{value:e.consumption,service:e.service},null,8,["value","service"]),t(k,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:_(()=>[t(b,{icon:"fa-solid fa-magic",class:"mr-2"}),f(" "+l(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])}const Ie=$(ye,[["render",Ce]]),Se=h({name:"TaskPreview",components:{ElImage:J,CopyToClipboard:X,FontAwesomeIcon:E,ElAlert:W,ImageWrapper:K},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(p=>{let c=p;o&&(c.action=o),e.push(c)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Ge={class:"preview"},Ae={class:"left"},Ue={class:"main"},je={class:"bot"},De={class:"datetime"},Fe={class:"info"},Pe={key:0,class:"prompt mt-2"},Re={key:0},Le={key:0,class:I({content:!0,failed:!0})},Me={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},Be={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Oe={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},qe={key:1,class:I({content:!0})},Ne={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ze={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},He={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Xe={key:2,class:I({content:!0})},Ke={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function We(e,o,p,c,g,v){const d=s("el-image"),m=s("image-wrapper"),n=s("font-awesome-icon"),u=s("copy-to-clipboard"),b=s("el-alert");return r(),i("div",Ge,[a("div",Ae,[t(d,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),a("div",Ue,[a("div",je,[f(l(e.$t("flux.name.fluxBot"))+" ",1),a("span",De,l(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Fe,[e.modelValue?.request?.prompt?(r(),i("p",Pe,[f(l(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?x("",!0):(r(),i("span",Re," - ("+l(e.$t("flux.status.pending"))+") ",1))])):x("",!0)]),e.modelValue?.response?.success===!0?(r(),i("div",Le,[a("div",Me,[(r(!0),i(y,null,C(e.images,(k,A)=>(r(),V(m,{key:A,src:k?.image_url,"raw-src":k?.image_url,"model-value":k},null,8,["src","raw-src","model-value"]))),128))]),t(b,{closable:!1,class:"mt-2 success"},{default:_(()=>[a("p",Be,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.model"))+": "+l(e.modelValue?.request?.model),1)]),a("p",Oe,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?.success===!1?(r(),i("div",qe,[t(b,{closable:!1,class:"failure"},{template:_(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",Ne,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),a("p",ze,[t(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),f(" "+l(e.$t("flux.name.failureReason"))+": "+l(e.modelValue?.response?.error?.message)+" ",1),t(u,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),a("p",He,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.traceId"))+": "+l(e.modelValue?.response?.trace_id)+" ",1),t(u,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?x("",!0):(r(),i("div",Xe,[t(b,{closable:!1,class:"info"},{template:_(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",Ke,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const Je=$(Se,[["render",We],["__scopeId","data-v-fd5838a5"]]),Qe=h({name:"RecentPanel",components:{TaskPreview:Je,BotPlaceholder:Q,NoTasks:z},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Ye={key:0},Ze={key:1,class:"tasks h-full w-full overflow-y-auto"},et={key:2,class:"w-full h-full flex items-center justify-center"};function tt(e,o,p,c,g,v){const d=s("bot-placeholder"),m=s("task-preview"),n=s("no-tasks");return r(),i(y,null,[e.tasks?.items===void 0?(r(),i("div",Ye,[t(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(r(),i("div",Ze,[(r(!0),i(y,null,C(e.tasks?.items,(u,b)=>(r(),V(m,{key:b,"model-value":u},null,8,["model-value"]))),128))])):x("",!0),e.tasks?.items?.length===0?(r(),i("div",et,[t(n)])):x("",!0)],64)}const ot=$(Qe,[["render",tt]]),st="https://webhook.acedata.cloud/flux",nt=h({name:"FluxIndex",components:{ConfigPanel:Ie,Layout:se,RecentPanel:ot},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===R.Request},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.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=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("flux/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("flux/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:c}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",c),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:p,createdAtMax:c})},async onGenerate(){const e={...this.config,callback_url:st},o=this.credential?.token;if(!o){console.error("no token specified");return}w.info(this.$t("flux.message.startingTask")),F.generate(e,{token:o}).then(()=>{w.success(this.$t("flux.message.startTaskSuccess"))}).catch(p=>{const c=p?.response?.data;c?.error?.code===P?w.error(this.$t("flux.message.usedUp")):w.error(this.$t("flux.message.startTaskFailed")+c?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function at(e,o,p,c,g,v){const d=s("config-panel"),m=s("recent-panel"),n=s("layout");return r(),V(n,null,{config:_(()=>[t(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:_(()=>[t(m,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Pt=$(nt,[["render",at]]);export{Pt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as A}from"./index.es-j7hA4q1g.js";import{E as G}from"./index-C9b_qrYa.js";import{E as B}from"./index-BSwIBR6M.js";import{d as g,h as b,b as r,t as i,k as o,r as R,j as c,l as s,o as n,ev as F,x as a,F as C,v as L,i as w,ew as M,y as u,c6 as q,D as v,J as S,K as T,n as U,ex as z,dr as N,dm as H}from"./index-BsGpMJTb.js";import{E as j,a as D}from"./index-Di4fVUMw.js";import{V as P}from"./VideoPlayer-Cd9C_ZH8.js";import{I as O}from"./InfoIcon-CWVvZnOl.js";import{I as K}from"./ImagePreview-DuSC9aPC.js";import{E as J}from"./index-jkLgEM33.js";import{E}from"./index-DFklJOqx.js";import{C as Q,N as W}from"./NoTasks-D-PxBwiz.js";import{E as X}from"./index-D5QUlWJ2.js";import{a as Y}from"./price-B4pvZaQV.js";import{C as Z}from"./CopyToClipboard-OXkvUoT-.js";import{E as x}from"./index-DJcFf6kq.js";import{E as ee}from"./index-tynyZ2ck.js";import{E as oe}from"./index-CPfOvcsc.js";import{B as te}from"./BotPlaceholder-DN22Fc21.js";import"./use-form-item-B27IDTSh.js";import"./index-r5W6hzzQ.js";import"./index-D2Y3gAJL.js";import"./typescript-Dc6IjKEd.js";import"./index-CxRCvRBZ.js";import"./strings-kuNfgIBh.js";import"./castArray-B9qiBuq3.js";import"./isEqual-DV-fric-.js";import"./_Uint8Array-D2_20NB1.js";import"./debounce-XchV9dnA.js";import"./_baseIteratee-Ct4ORPe7.js";import"./index-DY9jZOUy.js";import"./vue-plyr-QZFBikSk.js";import"./index-R8KVxj24.js";import"./_baseClone-C7rLiyxP.js";import"./_initCloneObject-De4hbrPJ.js";import"./index-IpqKHPW0.js";import"./index-4akd2uM4.js";const se=g({name:"LayoutVeo",components:{ElDrawer:B,ElButton:G,FontAwesomeIcon:A},data(){return{drawer:!1}}}),ne={class:"main"},ae={class:"config"},le={class:"result"};function re(e,t,_,h,k,y){const d=s("font-awesome-icon"),p=s("el-button"),l=s("el-drawer");return n(),r("div",ne,[i("div",ae,[R(e.$slots,"config",{},void 0,!0)]),i("div",le,[R(e.$slots,"result",{},void 0,!0)]),o(p,{round:"",class:"menu",onClick:t[0]||(t[0]=$=>e.drawer=!0)},{default:c(()=>[o(d,{icon:"fa-solid fa-magic"})]),_:1}),o(l,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=$=>e.drawer=$),direction:"ltr","with-header":!1,size:"350px"},{default:c(()=>[R(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ie=b(se,[["render",re],["__scopeId","data-v-4d2fe7ef"]]),ce=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"}]}},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=F)}}),de={class:"field"},pe={class:"title font-bold"};function me(e,t,_,h,k,y){const d=s("el-option"),p=s("el-select");return n(),r("div",de,[i("h2",pe,a(e.$t("veo.name.model")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=l=>e.value=l),class:"value",placeholder:e.$t("veo.placeholder.select")},{default:c(()=>[(n(!0),r(C,null,L(e.options,l=>(n(),w(d,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ue=b(ce,[["render",me],["__scopeId","data-v-ef445fc5"]]),fe=g({name:"ModelSelector",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=M)}}),ve={class:"field"},_e={class:"title font-bold"},he={class:"float-left"};function $e(e,t,_,h,k,y){const d=s("el-option"),p=s("el-select");return n(),r("div",ve,[i("h2",_e,a(e.$t("veo.name.action")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=l=>e.value=l),class:"value",placeholder:e.$t("veo.placeholder.select"),clearable:""},{default:c(()=>[(n(!0),r(C,null,L(e.options,l=>(n(),w(d,{key:l.value,label:l.label,value:l.value},{default:c(()=>[i("span",he,a(l.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ge=b(fe,[["render",$e],["__scopeId","data-v-821be9a3"]]),be=g({name:"VideoFromInput",components:{VideoPlayer:P},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.veo?.config}}}),ke={class:"relative"},ye={class:"flex mb-2"},we={class:"text-sm font-bold"};function Ve(e,t,_,h,k,y){const d=s("video-player");return n(),r("div",ke,[i("div",ye,[i("span",we,a(e.$t("veo.name.action3")),1)]),i("div",null,[e.config?.video_url?(n(),w(d,{key:0,src:e.config?.video_url},null,8,["src"])):u("",!0)])])}const Ee=b(be,[["render",Ve]]),Ie=g({name:"StartEndImage",components:{ElUpload:J,ElButton:G,InfoIcon:O,FontAwesomeIcon:A,ImagePreview:K},emits:["change"],data(){return{fileList:[],uploadUrl:q()+"/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()}}}),Se={class:"relative"},Te={class:"flex justify-between"},Ce={class:"flex justify-start items-center"},Ae={class:"text-sm font-bold"};function Ge(e,t,_,h,k,y){const d=s("info-icon"),p=s("image-preview"),l=s("font-awesome-icon"),$=s("el-button"),f=s("el-upload");return n(),r("div",Se,[i("div",Te,[i("div",Ce,[i("span",Ae,a(e.$t("veo.name.startEndImage")),1),o(d,{content:e.$t("veo.description.uploadStartEndImage")},null,8,["content"])])]),o(f,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),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:c(({file:m})=>[m.url&&m.percentage!==void 0?(n(),w(p,{key:0,url:m.url,name:m.name,percentage:m.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(m),1)},null,8,["url","name","percentage","onRemove"])):u("",!0)]),default:c(()=>[o($,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:c(()=>[o(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),v(" "+a(e.$t("veo.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ue=b(Ie,[["render",Ge],["__scopeId","data-v-43d971b7"]]),Re="",Le=g({name:"PromptInput",components:{ElInput:X,InfoIcon:O},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=Re)}}),je={class:"field"},De={class:"box"},Pe={class:"title font-bold"};function Oe(e,t,_,h,k,y){const d=s("info-icon"),p=s("el-input");return n(),r("div",je,[i("div",De,[i("h2",Pe,a(e.$t("veo.name.prompt")),1),o(d,{content:e.$t("veo.description.prompt"),class:"info"},null,8,["content"])]),o(p,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("veo.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Be=b(Le,[["render",Oe],["__scopeId","data-v-9189572a"]]),Fe=g({name:"ConfigPanel",components:{ElButton:G,Consumption:Q,FontAwesomeIcon:A,PromptInput:Be,ModelSelector:ue,StartEndImage:Ue,ActionSelector:ge,VideoFromInput:Ee},emits:["generate"],computed:{config(){return this.$store.state.veo?.config},consumption(){return Y(this.config,this.service?.metadata?.price)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Me={class:"flex flex-col h-full"},qe={class:"flex-1 overflow-y-auto p-[15px]"},ze={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Ne(e,t,_,h,k,y){const d=s("video-from-input"),p=s("action-selector"),l=s("prompt-input"),$=s("model-selector"),f=s("start-end-image"),m=s("consumption"),V=s("font-awesome-icon"),I=s("el-button");return n(),r("div",Me,[i("div",qe,[S(o(d,{class:"mb-4"},null,512),[[T,e.config?.action==="get1080p"]]),o(p,{class:"mb-4"}),S(o(l,{class:"mb-4"},null,512),[[T,e.config?.action!=="get1080p"]]),S(o($,{class:"mb-4"},null,512),[[T,e.config?.action!=="get1080p"]]),S(o(f,{class:"mb-2"},null,512),[[T,e.config?.action==="image2video"]])]),i("div",ze,[o(m,{value:e.consumption,service:e.service},null,8,["value","service"]),o(I,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:c(()=>[o(V,{icon:"fa-solid fa-magic",class:"mr-2"}),v(" "+a(e.$t("veo.button.generate")),1)]),_:1},8,["onClick"])])])}const He=b(Fe,[["render",Ne]]),Ke=g({name:"TaskPreview",components:{ElImage:oe,CopyToClipboard:Z,FontAwesomeIcon:A,ElAlert:ee,VideoPlayer:P,ElTooltip:x,ElButton:G},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,t){console.debug("set config",t),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,video_id:t?.data?.[0]?.id,video_url:t?.data[0]?.video_url,action:"get1080p"})},onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Je={class:"preview"},Qe={class:"left"},We={class:"main"},Xe={class:"bot"},Ye={class:"datetime"},Ze={class:"info"},xe={key:0,class:"prompt mt-2"},eo={key:0},oo={key:1},to={key:0,class:U({content:!0,failed:!0})},so={key:0,class:"mb-4"},no={key:1,class:U({operations:!0,"mt-2":!0})},ao={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},lo={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ro={key:1,class:U({content:!0})},io={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},co={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},po={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},mo={key:2,class:U({content:!0})},uo={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},fo={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function vo(e,t,_,h,k,y){const d=s("el-image"),p=s("video-player"),l=s("el-button"),$=s("el-tooltip"),f=s("font-awesome-icon"),m=s("copy-to-clipboard"),V=s("el-alert");return n(),r("div",Je,[i("div",Qe,[o(d,{src:"https://cdn.acedata.cloud/8nxyy9.jpg",class:"avatar"})]),i("div",We,[i("div",Xe,[v(a(e.$t("veo.name.veoBot"))+" ",1),i("span",Ye,a(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),i("div",Ze,[e.modelValue?.request?.prompt?(n(),r("p",xe,[v(a(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?u("",!0):(n(),r("span",eo," - ("+a(e.$t("veo.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="running"?(n(),r("span",oo," - ("+a(e.$t("veo.status.processing"))+") ",1)):u("",!0)])):u("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),r("div",to,[e.modelValue?.response?.data[0]?.video_url?(n(),r("div",so,[o(p,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):u("",!0),e.modelValue?.response.success?(n(),r("div",no,[o($,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:c(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),w(l,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=I=>e.onGet1080p(I,e.modelValue?.response))},{default:c(()=>[v(a(e.$t("veo.button.action3")),1)]),_:1})):u("",!0)]),_:1},8,["content"]),o($,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:c(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),w(l,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[1]||(t[1]=I=>e.onDownload(I,e.modelValue?.response?.data[0]?.video_url))},{default:c(()=>[v(a(e.$t("veo.button.download")),1)]),_:1})):u("",!0)]),_:1},8,["content"])])):u("",!0),o(V,{closable:!1,class:"mt-2 success"},{default:c(()=>[i("p",ao,[o(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),v(" "+a(e.$t("veo.name.model"))+": "+a(e.modelValue?.request?.model),1)]),i("p",lo,[o(f,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),o(m,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):u("",!0),e.modelValue?.response?.success===!1?(n(),r("div",ro,[o(V,{closable:!1,class:"failure"},{template:c(()=>[o(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),v(" "+a(e.$t("veo.name.failure")),1)]),default:c(()=>[i("p",io,[o(f,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),o(m,{content:e.modelValue?.id},null,8,["content"])]),i("p",co,[o(f,{icon:"fa-solid fa-circle-info",class:"mr-1"}),v(" "+a(e.$t("veo.name.failureReason"))+": "+a(e.modelValue?.response?.error?.message)+" ",1),o(m,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",po,[o(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),v(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),o(m,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):u("",!0)]),_:1})])):u("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",mo,[o(V,{closable:!1,class:"info"},{template:c(()=>[o(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),v(" "+a(e.$t("veo.name.failure")),1)]),default:c(()=>[i("p",uo,[o(f,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),o(m,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",fo,[o(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),v(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),o(m,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):u("",!0)]),_:1})])):u("",!0)])])}const _o=b(Ke,[["render",vo],["__scopeId","data-v-5372c9d1"]]),ho=g({name:"RecentPanel",components:{TaskPreview:_o,NoTasks:W,BotPlaceholder:te},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),$o={key:0},go={key:1,class:"h-full w-full overflow-y-auto"},bo={key:2,class:"w-full h-full flex items-center justify-center"};function ko(e,t,_,h,k,y){const d=s("bot-placeholder"),p=s("task-preview"),l=s("no-tasks");return n(),r(C,null,[e.tasks?.items===void 0?(n(),r("div",$o,[o(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",go,[(n(!0),r(C,null,L(e.tasks?.items,($,f)=>(n(),w(p,{key:f,"model-value":$},null,8,["model-value"]))),128))])):u("",!0),e.tasks?.items?.length===0?(n(),r("div",bo,[o(l)])):u("",!0)],64)}const yo=b(ho,[["render",ko]]),wo="https://webhook.acedata.cloud/veo",Vo=g({name:"VeoIndex",components:{ConfigPanel:He,Layout:ie,RecentPanel:yo},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.veo?.status?.getApplications===H.Request},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},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(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:_,createdAtMax:h}=e||{};console.debug("limit",t,"createdAtMin",_,"createdAtMax",h),await this.$store.dispatch("veo/getTasks",{limit:t,createdAtMin:_,createdAtMax:h})},async onGenerate(){const e={...this.config,callback_url:wo},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("veo.message.startingTask")),z.generate(e,{token:t}).then(()=>{E.success(this.$t("veo.message.startTaskSuccess"))}).catch(_=>{_?.response?.data?.error?.code===N?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)})}}});function Eo(e,t,_,h,k,y){const d=s("config-panel"),p=s("recent-panel"),l=s("layout");return n(),w(l,null,{config:c(()=>[o(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:c(()=>[o(p,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const it=b(Vo,[["render",Eo]]);export{it as default};
|