@acedatacloud/nexior 3.23.0 → 3.24.1
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-Jv-eQvKt.js → Auth-CFU-bg09.js} +1 -1
- package/dist/assets/{BotPlaceholder-BLa0cpzt.js → BotPlaceholder-BRqNXjza.js} +1 -1
- package/dist/assets/{Callback-Bum9BiM1.js → Callback-CI-rsncj.js} +1 -1
- package/dist/assets/{Console-BRtrzR0A.js → Console-r58ni3P0.js} +1 -1
- package/dist/assets/{Conversation-BaJFtqm8.js → Conversation-D4i-z4Dh.js} +2 -2
- package/dist/assets/{CopyToClipboard-DY2B74b1.js → CopyToClipboard-HWj6DYZf.js} +1 -1
- package/dist/assets/{Detail-CsD16GOT.js → Detail-BACNWCSk.js} +1 -1
- package/dist/assets/{EditArray-4S9UzBWi.js → EditArray-Df7IyvM6.js} +1 -1
- package/dist/assets/{Extra-5VrW6DST.js → Extra-D7anukGq.js} +1 -1
- package/dist/assets/{FilePreview-wN5kQB_e.js → FilePreview-Bp0MjFlj.js} +1 -1
- package/dist/assets/{History-1TQ6OxMr.js → History-Bb5OFiJ4.js} +1 -1
- package/dist/assets/{ImagePreview-0sgpwQOv.js → ImagePreview-CigIbV96.js} +1 -1
- package/dist/assets/{ImageWrapper-DKM5_uAi.js → ImageWrapper-B4Lhs8FM.js} +1 -1
- package/dist/assets/{Index-BvPUbw3x.js → Index-B4g6gIcf.js} +1 -1
- package/dist/assets/{Index-Klpq_0LX.js → Index-BHRAMR9K.js} +1 -1
- package/dist/assets/{Index-NtKIB8DX.js → Index-BeN5lKLK.js} +1 -1
- package/dist/assets/{Index-CCn1iJlI.js → Index-BgPDR59p.js} +1 -1
- package/dist/assets/{Index-BgkCorWK.js → Index-BnPFSio9.js} +1 -1
- package/dist/assets/{Index-ic3DPXte.js → Index-C-ZAAlr-.js} +1 -1
- package/dist/assets/{Index-pH7if56e.js → Index-C0UBsl03.js} +1 -1
- package/dist/assets/{Index-2Kvi3ZG1.js → Index-CNiHRl7A.js} +1 -1
- package/dist/assets/{Index-DofUt9jJ.js → Index-CnE-npry.js} +1 -1
- package/dist/assets/{Index-CNM-0MfT.js → Index-D0StqaSK.js} +1 -1
- package/dist/assets/{Index-DVACGwRD.js → Index-DA-YQZF1.js} +1 -1
- package/dist/assets/{Index-Cc3XvXxK.js → Index-DEp2ir_r.js} +1 -1
- package/dist/assets/{Index-DJgYEmuh.js → Index-DacpM6pA.js} +1 -1
- package/dist/assets/Index-Dnw88d3s.js +1 -0
- package/dist/assets/{Index-n-YFdroV.js → Index-Dx4NKZab.js} +1 -1
- package/dist/assets/{Index-DwLZ1a2J.js → Index-DyMKKCCD.js} +1 -1
- package/dist/assets/Index-H2tBAlzy.css +1 -0
- package/dist/assets/{InfoIcon-GyiV0uTg.js → InfoIcon-XOoV07qh.js} +1 -1
- package/dist/assets/{Invitees-DR4v9AWr.js → Invitees-B3KEhu3q.js} +1 -1
- package/dist/assets/{List-D0g4cR_L.js → List-BbwoxXtp.js} +1 -1
- package/dist/assets/{List-CdFyoNeW.js → List-CZYhYHx8.js} +1 -1
- package/dist/assets/{List-BImE_WZ2.js → List-DBjhmxBd.js} +1 -1
- package/dist/assets/{Login-fI1z72UV.js → Login-BAcbYPKW.js} +1 -1
- package/dist/assets/{Main-D2_nU9FR.js → Main-BtzCPV-b.js} +1 -1
- package/dist/assets/{Navigator-VREjPTKi.js → Navigator-BsxtNnl3.js} +1 -1
- package/dist/assets/{NoTasks-DpyAtW8T.js → NoTasks-Bp2ijoHi.js} +1 -1
- package/dist/assets/{Pagination-Thhn5SDm.js → Pagination-Di8PkOqi.js} +1 -1
- package/dist/assets/{Status-BMJ-I8Pc.js → Status-k6h7yyt2.js} +1 -1
- package/dist/assets/{Subscribe-CfYHt3j-.js → Subscribe-Cmv_uiM9.js} +1 -1
- package/dist/assets/{VideoPlayer-CvwYdNWk.js → VideoPlayer-Dl77RqNS.js} +1 -1
- package/dist/assets/{_baseClone-Cfbcx9ep.js → _baseClone-ByiDqVMo.js} +1 -1
- package/dist/assets/{_baseIteratee-B9yhARKH.js → _baseIteratee-BT7cFN53.js} +1 -1
- package/dist/assets/{_initCloneObject-BWBFVXzM.js → _initCloneObject-CsjYnf5f.js} +1 -1
- package/dist/assets/{castArray-BOdIXw7P.js → castArray-DQV2cAXY.js} +1 -1
- package/dist/assets/{debounce-Dh9PsM_P.js → debounce-Dpng1Slf.js} +1 -1
- package/dist/assets/{distribution-DasSjrEb.js → distribution-igOwntQn.js} +1 -1
- package/dist/assets/{dropdown-4Npcf-Kr.js → dropdown-DyvuKpB1.js} +1 -1
- package/dist/assets/{index-TeONk5U_.js → index-7h29hOLy.js} +1 -1
- package/dist/assets/{index-GuFZ4Z-f.js → index-8NKQvM5X.js} +1 -1
- package/dist/assets/{index-DUw1QSi5.js → index-B2fZZPBz.js} +1 -1
- package/dist/assets/{index-BiBmUtMR.js → index-BGPtjmZc.js} +1 -1
- package/dist/assets/{index-B8kT6Wsa.js → index-BGegP6ry.js} +1 -1
- package/dist/assets/{index-23_QYN9_.js → index-BI5YGWKe.js} +1 -1
- package/dist/assets/{index-C82OwUK5.js → index-BX8SGicp.js} +1 -1
- package/dist/assets/{index-0bjCiAZ5.js → index-B_puVQOn.js} +1 -1
- package/dist/assets/{index-Dyigdg3o.js → index-BfrVKSM6.js} +1 -1
- package/dist/assets/{index-DQAnfDDD.js → index-BkEVr9W9.js} +1 -1
- package/dist/assets/{index-DHDO1-7Q.js → index-BsCz9MkJ.js} +1 -1
- package/dist/assets/{index-Bpm1ZwFr.js → index-CEgNqqlJ.js} +1 -1
- package/dist/assets/{index-CcrMfubT.js → index-CNgsi8VO.js} +1 -1
- package/dist/assets/{index-Z3Ble6S3.js → index-CQrPjFP_.js} +8 -8
- package/dist/assets/{index-Z-vlaGQn.js → index-CSysAZmU.js} +1 -1
- package/dist/assets/{index-k5p91wLN.js → index-CXgV7KQu.js} +1 -1
- package/dist/assets/{index-DEgVEBTr.js → index-CloSjXsD.js} +1 -1
- package/dist/assets/{index-BZ9SU4fU.js → index-DA01t0HA.js} +1 -1
- package/dist/assets/{index-rzb_p--k.js → index-DKQt0yVa.js} +1 -1
- package/dist/assets/{index-3GaWssMK.js → index-DKYZhlyA.js} +1 -1
- package/dist/assets/{index-XAvGfO8a.js → index-D_UuSSio.js} +1 -1
- package/dist/assets/{index-iPc5VB6N.js → index-DdabCetB.js} +1 -1
- package/dist/assets/{index-DKp7DEix.js → index-Dp1CPlmI.js} +1 -1
- package/dist/assets/{index-DksfIPPT.js → index-DwQ1Uy8r.js} +1 -1
- package/dist/assets/{index-TQTp7cjo.js → index-Dz48GK02.js} +1 -1
- package/dist/assets/{index-BEdCWb2D.js → index-JId3XsgM.js} +1 -1
- package/dist/assets/{index-DF1zc4Q3.js → index-QC8u_sh4.js} +1 -1
- package/dist/assets/{index-B6ZMVaO2.js → index-Sxls255a.js} +1 -1
- package/dist/assets/{index-BXPOquOZ.js → index-cgo1Pb2h.js} +1 -1
- package/dist/assets/{index.es-Biw5Cjoa.js → index.es-Bp770TJB.js} +1 -1
- package/dist/assets/{isEqual-yI-vexye.js → isEqual-CzYHFkcF.js} +1 -1
- package/dist/assets/{isPlainObject-DzEmpk4D.js → isPlainObject-BhuGqVtj.js} +1 -1
- package/dist/assets/nanobanana-0TD1aaKJ.js +1 -0
- package/dist/assets/nanobanana-1NdVL7Fl.js +1 -0
- package/dist/assets/nanobanana-9C3IuZSm.js +1 -0
- package/dist/assets/nanobanana-B0gG5lVj.js +1 -0
- package/dist/assets/nanobanana-BEfc9OH9.js +1 -0
- package/dist/assets/nanobanana-BoWxDTr8.js +1 -0
- package/dist/assets/nanobanana-CCcmmXa_.js +1 -0
- package/dist/assets/nanobanana-CN9fO8Hb.js +1 -0
- package/dist/assets/nanobanana-DFBTIrpV.js +1 -0
- package/dist/assets/nanobanana-DFQSatdc.js +1 -0
- package/dist/assets/nanobanana-DKgUjWoY.js +1 -0
- package/dist/assets/nanobanana-D_FNxm6c.js +1 -0
- package/dist/assets/nanobanana-Dft3VU_N.js +1 -0
- package/dist/assets/nanobanana-DiU6WlSl.js +1 -0
- package/dist/assets/nanobanana-Dmicr1QV.js +1 -0
- package/dist/assets/nanobanana-GgSlhAZH.js +1 -0
- package/dist/assets/nanobanana-MYtgyiLS.js +1 -0
- package/dist/assets/nanobanana-VqTavWjG.js +1 -0
- package/dist/assets/{order-DeDblogv.js → order-E0PA8pZk.js} +1 -1
- package/dist/assets/{price-Bv6OtNKd.js → price-DqAh1UX4.js} +1 -1
- package/dist/assets/{strings-qqMjRuAB.js → strings-CvXj94LS.js} +1 -1
- package/dist/assets/{typescript-CzuhH513.js → typescript-2uGAN6a6.js} +1 -1
- package/dist/assets/{use-form-item-CY8nvbwg.js → use-form-item-C-B0Mj_x.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/Index-CYdr8UQ2.css +0 -1
- package/dist/assets/Index-QmEJSwQc.js +0 -1
- package/dist/assets/nanobanana-B0ViKaD_.js +0 -1
- package/dist/assets/nanobanana-B7yj4kOe.js +0 -1
- package/dist/assets/nanobanana-B89QnYd4.js +0 -1
- package/dist/assets/nanobanana-B8Ae8gkp.js +0 -1
- package/dist/assets/nanobanana-BtRQd3w7.js +0 -1
- package/dist/assets/nanobanana-Bz89-Qb7.js +0 -1
- package/dist/assets/nanobanana-C6B46C-_.js +0 -1
- package/dist/assets/nanobanana-CUYyVMP1.js +0 -1
- package/dist/assets/nanobanana-D7vdmVw-.js +0 -1
- package/dist/assets/nanobanana-DFm4URNr.js +0 -1
- package/dist/assets/nanobanana-DKwkrzv-.js +0 -1
- package/dist/assets/nanobanana-DZufxl6k.js +0 -1
- package/dist/assets/nanobanana-DurrjwGy.js +0 -1
- package/dist/assets/nanobanana-Dw0I1Eb-.js +0 -1
- package/dist/assets/nanobanana-GEAVYS-8.js +0 -1
- package/dist/assets/nanobanana-HyGT4_eo.js +0 -1
- package/dist/assets/nanobanana-P-H1OheZ.js +0 -1
- package/dist/assets/nanobanana-vrR8h4Kp.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as K}from"./index.es-Biw5Cjoa.js";import{E as Z}from"./index-DEgVEBTr.js";import{E as de}from"./index-BXPOquOZ.js";import{as as pe,ay as me,bR as fe,at as ae,ci as he,_ as _e,d as b,a as $e,au as ve,c as F,bq as ge,bw as ye,aF as le,b as h,o as l,i as w,r as U,f as oe,e as V,j as $,bh as re,E as D,n as ke,g as we,h as E,t as r,k as s,l as c,fa as se,x as v,F as z,v as N,fb as H,cf as be,D as I,fc as Y,fd as Q,y as k,J as x,cW as ee,fe as B,b_ as Ce,dw as W,aq as P,ff as G,aw as Se,K as Ae,fg as Le,dn as Ee,dv as Ve}from"./index-Z3Ble6S3.js";import{E as ce}from"./index-XAvGfO8a.js";import{E as je,a as Fe}from"./index-Dyigdg3o.js";import{I as M}from"./InfoIcon-GyiV0uTg.js";import{E as Te}from"./index-Z-vlaGQn.js";import{E as L}from"./index-CcrMfubT.js";import{E as X}from"./index-BEdCWb2D.js";import{E as Pe,a as ue}from"./index-23_QYN9_.js";import{E as J}from"./index-k5p91wLN.js";import{C as Ie,N as Ue}from"./NoTasks-DpyAtW8T.js";import{a as ze}from"./price-Bv6OtNKd.js";import{E as Re,a as De,b as Ge}from"./index-C82OwUK5.js";import{E as Me}from"./index-DUw1QSi5.js";import{E as Oe}from"./index-0bjCiAZ5.js";import{E as Be,a as We}from"./index-iPc5VB6N.js";import"./use-form-item-CY8nvbwg.js";import"./index-r5W6hzzQ.js";import"./index-TQTp7cjo.js";import"./index-DksfIPPT.js";import"./typescript-CzuhH513.js";import"./strings-qqMjRuAB.js";import"./castArray-BOdIXw7P.js";import"./isEqual-yI-vexye.js";import"./_initCloneObject-BWBFVXzM.js";import"./debounce-Dh9PsM_P.js";import"./_baseIteratee-B9yhARKH.js";import"./index-DQAnfDDD.js";import"./index-rzb_p--k.js";import"./_baseClone-Cfbcx9ep.js";import"./index-BZ9SU4fU.js";import"./dropdown-4Npcf-Kr.js";const qe=pe({size:{type:[Number,String],values:he,default:"",validator:e=>ae(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:fe},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Ne={error:e=>e instanceof Event},He=b({name:"ElAvatar"}),Ke=b({...He,props:qe,emits:Ne,setup(e,{emit:t}){const i=e,o=$e("avatar"),a=ve(!1),u=F(()=>{const{size:n,icon:m,shape:y}=i,f=[o.b()];return ge(n)&&f.push(o.m(n)),m&&f.push(o.m("icon")),y&&f.push(o.m(y)),f}),d=F(()=>{const{size:n}=i;return ae(n)?o.cssVarBlock({size:ye(n)||""}):void 0}),p=F(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function _(n){a.value=!0,t("error",n)}return(n,m)=>(l(),h("span",{class:ke(V(u)),style:oe(V(d))},[(n.src||n.srcSet)&&!a.value?(l(),h("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(V(p)),onError:_},null,44,["src","alt","srcset"])):n.icon?(l(),w(V(D),{key:1},{default:$(()=>[(l(),w(re(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ze=_e(Ke,[["__file","avatar.vue"]]);const xe=we(Ze),Xe=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:Z,FontAwesomeIcon:K},data(){return{drawer:!1,preview:!1}},computed:{}}),Je={class:"main flex flex-row flex-1"},Ye={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},Qe={class:"result h-full flex flex-col flex-1 border-r border-[var(--el-border-color)]"},et={class:"preview h-full w-[300px] flex flex-col"};function tt(e,t,i,o,a,u){const d=c("font-awesome-icon"),p=c("el-button"),_=c("el-drawer");return l(),h("div",Je,[r("div",Ye,[U(e.$slots,"config",{},void 0,!0)]),r("div",Qe,[U(e.$slots,"result",{},void 0,!0)]),r("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(d,{icon:"fa-solid fa-magic"})]),_:1}),s(_,{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=E(Xe,[["render",tt],["__scopeId","data-v-6cc632e5"]]),st=b({name:"VersionSelector",components:{ElSelect:Fe,ElOption:je,ElSwitch:ce},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"},{label:this.$t("suno.model.model45plus"),value:"chirp-v4-5-plus"},{label:this.$t("suno.model.model5"),value:"chirp-v5"}]}},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,a,u){const d=c("el-switch"),p=c("el-option"),_=c("el-select");return l(),h("div",nt,[r("h2",it,v(e.$t("suno.name.type")),1),s(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(_,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(l(!0),h(z,null,N(e.options,n=>(l(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=E(st,[["render",at],["__scopeId","data-v-5ebe40d6"]]),rt=b({name:"UploadAudio",components:{ElUpload:Te,ElButton:Z,InfoIcon:M,FontAwesomeIcon:K},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(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.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}L.info(this.$t("suno.message.startingUploadAudio")),H.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const a=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:a,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{L.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,a,u){const d=c("info-icon"),p=c("font-awesome-icon"),_=c("el-button"),n=c("el-upload");return l(),h("div",ct,[r("div",ut,[r("div",dt,[r("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(d,{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(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ft=E(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ht="",_t=b({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:M},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=ht)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},yt={class:"title font-bold"},kt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-switch"),_=c("el-input");return l(),h("div",$t,[r("div",vt,[r("div",gt,[r("h2",yt,v(e.$t("suno.name.prompt")),1),s(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",kt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),r("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(_,{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=E(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",At=b({name:"LyricInput",components:{ElInput:X,InfoIcon:M},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)}}),Lt={class:"field"},Et={class:"box"},Vt={class:"title font-bold"};function jt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Lt,[r("div",Et,[r("h2",Vt,v(e.$t("suno.name.lyrics")),1),s(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Ft=E(At,[["render",jt],["__scopeId","data-v-99dfded8"]]),Tt=b({name:"StyleInput",components:{ElInput:X,InfoIcon:M},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"},It={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Pt,[r("div",It,[r("h2",Ut,v(e.$t("suno.name.style")),1),s(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=_=>e.style=_),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Rt=E(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Dt=b({name:"TitleInput",components:{ElInput:X,InfoIcon:M},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"},Mt={class:"title-container"},Ot={class:"title font-bold"};function Bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Gt,[r("div",Mt,[r("h2",Ot,v(e.$t("suno.name.title")),1),s(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=_=>e.title=_),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Wt=E(Dt,[["render",Bt],["__scopeId","data-v-ce70fe34"]]);function R(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const qt=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:D,ElInputNumber:Pe,VideoPlay:Q,VideoPause:Y},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:R,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})}}}),Nt={class:"field"},Ht={class:"box"},Kt={class:"title font-bold"},Zt={class:"input-wrapper"},xt={class:"task"},Xt={class:"left"},Jt={key:2,class:"duration"},Yt={class:"info"},Qt={class:"title"},eo={class:"style"};function to(e,t,i,o,a,u){const d=c("el-input-number"),p=c("el-image"),_=c("video-pause"),n=c("el-icon"),m=c("video-play"),y=ee("loading");return l(),h("div",Nt,[r("div",Ht,[r("h2",Kt,v(e.$t("suno.name.extend")),1),r("div",Zt,[s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),r("div",xt,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[3]||(t[3]=f=>e.onClick(e.audio))},[x((l(),h("div",Xt,[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"?(l(),h("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=f=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(_)]),_:1})])):k("",!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")?(l(),h("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=f=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):k("",!0),e.audio?.duration?(l(),h("div",Jt,v(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[y,!e.audio?.audio_url]]),r("div",Yt,[r("h2",Qt,v(e.audio?.title),1),r("p",eo,v(e.audio?.style),1)])])):k("",!0)])])}const oo=E(qt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:D,VideoPlay:Q,VideoPause:Y},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:R,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 fo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=ee("loading");return l(),h("div",no,[r("div",io,[r("h2",ao,v(e.$t("suno.name.cover")),1)]),r("div",lo,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[2]||(t[2]=y=>e.onClick(e.audio))},[x((l(),h("div",ro,[s(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=y=>e.onPause(e.audio))},[s(_,null,{default:$(()=>[s(p)]),_:1})])):k("",!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")?(l(),h("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPlay(e.audio))},[s(_,null,{default:$(()=>[s(n)]),_:1})])):k("",!0),e.audio?.duration?(l(),h("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[m,!e.audio?.audio_url]]),r("div",uo,[r("h2",po,v(e.audio?.title),1),r("p",mo,v(e.audio?.style),1)])])):k("",!0)])])}const ho=E(so,[["render",fo],["__scopeId","data-v-06640216"]]),_o=b({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:Ft,StyleInput:Rt,TitleInput:Wt,ExtendFromInput:oo,CoverFromInput:ho,UploadAudio:ft,FontAwesomeIcon:K,ElButton:Z,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return ze(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 yo(e,t,i,o,a,u){const d=c("type-selector"),p=c("upload-audio"),_=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),y=c("title-input"),f=c("extend-from-input"),C=c("cover-from-input"),j=c("consumption"),T=c("font-awesome-icon"),A=c("el-button");return l(),h("div",$o,[r("div",vo,[s(d,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?k("",!0):(l(),w(_,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(n,{key:1,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(m,{key:2,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(y,{key:3,class:"mb-4"})):k("",!0),e.config?.action==="extend"?(l(),w(f,{key:4,class:"mb-4"})):k("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):k("",!0)]),r("div",go,[s(j,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const ko=E(_o,[["render",yo],["__scopeId","data-v-b9fab929"]]);var q={exports:{}},wo=q.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,y){var f=new XMLHttpRequest;f.open("GET",n),f.responseType="blob",f.onload=function(){_(f.response,m,y)},f.onerror=function(){console.error("could not download file")},f.send()}function a(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function u(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 d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof B=="object"&&B.global===B?B:void 0,p=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),_=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,y){var f=d.URL||d.webkitURL,C=document.createElement("a");m=m||n.name||"download",C.download=m,C.rel="noopener",typeof n=="string"?(C.href=n,C.origin===location.origin?u(C):a(C.href)?o(n,m,y):u(C,C.target="_blank")):(C.href=f.createObjectURL(n),setTimeout(function(){f.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,y){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,y),m);else if(a(n))o(n,m,y);else{var f=document.createElement("a");f.href=n,f.target="_blank",setTimeout(function(){u(f)})}}:function(n,m,y,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,y);var C=n.type==="application/octet-stream",j=/constructor/i.test(d.HTMLElement)||d.safari,T=/CriOS\/[\d]+/.test(navigator.userAgent);if((T||C&&j||p)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var S=A.result;S=T?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=S:location=S,f=null},A.readAsDataURL(n)}else{var O=d.URL||d.webkitURL,g=O.createObjectURL(n);f?f.location=g:location.href=g,f=null,setTimeout(function(){O.revokeObjectURL(g)},4e4)}});d.saveAs=_.saveAs=_,e.exports=_})}(q)),q.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Ao=b({name:"TaskPreview",components:{ElImage:J,ElIcon:D,ElTooltip:Me,ElButton:Z,FontAwesomeIcon:K,VideoPlay:Q,VideoPause:Y,ElDropdown:Ge,ElDropdownMenu:De,ElDropdownItem:Re,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},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(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(i=>({...i,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:R,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{Co.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),L.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}H.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},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}L.info(this.$t("suno.message.startingTask")),H.audio(i,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{L.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Lo={class:"task"},Eo=["onClick"],Vo={class:"left"},jo=["onClick"],Fo=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Io={class:"title"},Uo={class:"style"},zo={class:"right"},Ro={class:"el-dropdown-link"},Do={class:"flex items-center min-w-[120px]"},Go={class:"el-dropdown-link"};function Mo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=c("el-button"),y=c("font-awesome-icon"),f=c("el-tooltip"),C=c("Loading"),j=c("el-dropdown-item"),T=c("el-dropdown-menu"),A=c("el-dropdown"),O=ee("loading");return l(),h("div",Lo,[(l(!0),h(z,null,N(e.audios,g=>(l(),h("div",{key:g.id,class:"audio",onClick:P(S=>e.onClick(g),["stop"])},[x((l(),h("div",Vo,[s(d,{src:g?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:P(S=>e.onPause(g),["stop"])},[s(_,null,{default:$(()=>[s(p)]),_:1})],8,jo)):k("",!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")?(l(),h("div",{key:1,class:"overlay",onClick:P(S=>e.onPlay(g),["stop"])},[s(_,null,{default:$(()=>[s(n)]),_:1})],8,Fo)):k("",!0),g?.duration?(l(),h("div",To,v(e.useFormatDuring(g?.duration)),1)):k("",!0)])),[[O,!g?.audio_url]]),r("div",Po,[r("h2",Io,v(g?.title),1),r("p",Uo,v(g?.style),1)]),r("div",zo,[g?.audio_url?(l(),w(m,{key:0,size:"small",round:"",onClick:P(S=>e.onExtend(S,g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):k("",!0),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[s(j,{disabled:e.isFetchingVideoUrl,onClick:S=>e.handleVideoDownload(g)},{default:$(()=>[r("div",Do,[e.isFetchingVideoUrl?(l(),w(_,{key:0,class:"is-loading mr-2"},{default:$(()=>[s(C)]),_:1})):k("",!0),r("span",null,v(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),g?.audio_url?(l(),w(j,{key:0,onClick:P(S=>e.onDownload(S,g?.audio_url),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:$(()=>[r("span",Ro,[s(f,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(l(),w(j,{key:0,onClick:P(S=>e.onGetStems(g.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):k("",!0),s(j,{onClick:P(S=>e.onCover(g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(l(),w(j,{key:1,onClick:P(S=>e.onConcatMusic(g?.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:$(()=>[r("span",Go,[s(f,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Eo))),128))])}const Oo=E(Ao,[["render",Mo]]),Bo={class:"player-slider"},Wo=b({__name:"PlayerSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=F({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),a=()=>{},u=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,p)=>(l(),h("div",Bo,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=_=>i.value=_),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),qo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},Ho=["src"],Ko={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},xo={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=b({__name:"PlayerSong",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),h("div",No,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||V(qo)},null,8,Ho),r("div",Ko,[r("div",Zo,[r("div",xo,[r("span",null,v(i.value?.title||"Music"),1),r("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Yo={class:"flex justify-end items-center gap-x-2.5"},Qo={class:"text-xs"},es=b({__name:"PlayerAction",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=F({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),h("div",Yo,[r("span",Qo,v(V(R)(i.value))+" / "+v(V(R)(o.value)),1)]))}});var ts={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 os(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function ss(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.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:a,id:e}}var ns=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=os(),p=Se(ns,ts);return function(){var _=u.size,n=u.strokeWidth,m=u.strokeLinecap,y=u.strokeLinejoin,f=u.theme,C=u.fill,j=u.spin,T=ss(d,{size:_,strokeWidth:n,strokeLinecap:m,strokeLinejoin:y,theme:f,fill:C},p),A=[p.prefix+"-icon"];return A.push(p.prefix+"-icon-"+e),t&&p.rtl&&A.push(p.prefix+"-icon-rtl"),j&&A.push(p.prefix+"-icon-spin"),s("span",{class:A.join(" ")},[i(T)])}}};return o}const is=te("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)])}),as=te("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)])}),ls=te("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)])}),ie=b({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),w(re(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"]))}}),rs={class:"player-volume flex flex-col items-center pt-2"},cs={class:"text-sm mt-3"},us=b({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=F({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),h("div",rs,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=p=>i.value=p),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",cs,v(i.value),1)]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=b({__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=F(()=>t.state.suno.audio);return(a,u)=>(l(),h("div",ds,[s(ie,{icon:o.value?.state==="playing"?V(is):V(as),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),s(V(Oe),{placement:"top",width:"50px",trigger:"click"},{reference:$(()=>[s(ie,{icon:V(ls),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},fs={class:"flex grow px-5 items-center"},hs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=b({__name:"Player",setup(e){return(t,i)=>(l(),h("div",ms,[s(Wo),r("div",fs,[r("div",hs,[s(Jo)]),r("div",_s,[s(ps)]),r("div",$s,[s(es)])])]))}}),gs=b({name:"RecentPanel",components:{ElSkeletonItem:We,ElSkeleton:Be,TaskPreview:Oo,Player:vs,NoTasks:Ue},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"),e.scrollTop===0&&this.$emit("reach-top")}}}),ys={key:0,class:"tasks"},ks={class:"left w-[70px] p-[10px] flex items-center"},ws={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},bs={key:2,class:"w-full flex-1 flex items-center justify-center"},Cs={class:"h-20"};function Ss(e,t,i,o,a,u){const d=c("el-skeleton-item"),p=c("el-skeleton"),_=c("task-preview"),n=c("no-tasks"),m=c("player");return l(),h(z,null,[e.tasks?.items===void 0?(l(),h("div",ys,[(l(),h(z,null,N(3,y=>r("div",{key:y,class:"flex"},[r("div",ks,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),r("div",ws,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),s(d,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),h("div",{key:1,class:"flex-1 w-full overflow-y-auto tasks p-2",onScroll:t[0]||(t[0]=(...y)=>e.onHandleScroll&&e.onHandleScroll(...y))},[(l(!0),h(z,null,N(e.tasks?.items,(y,f)=>(l(),w(_,{key:f,"model-value":y,class:"preview"},null,8,["model-value"]))),128))],32)):k("",!0),e.tasks?.items?.length===0?(l(),h("div",bs,[s(n)])):k("",!0),x(r("div",Cs,[s(m)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=E(gs,[["render",Ss]]),Ls=b({name:"TaskPreview",components:{IconPicture:Le,ElImage:J,ElAvatar:xe,ElIcon:D},computed:{audio(){return this.$store.state.suno?.audio}}}),Es={key:0,class:"size-full overflow-hidden"},Vs={class:"relative h-[300px]"},js={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Fs={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Ts={class:"p-4"},Ps={class:"flex items-center font-bold mb-2"},Is={class:"text-[var(--el-text-color-regular)] mb-2"},Us={class:"text-xs text-[var(--el-text-color-regular)]"},zs={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Rs={key:1,class:"w-full h-full"};function Ds(e,t,i,o,a,u){const d=c("icon-picture"),p=c("el-icon"),_=c("el-image"),n=c("el-avatar");return e.audio?.object?(l(),h("div",Es,[r("div",Vs,[s(_,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:$(()=>[r("div",js,[s(p,{class:"text-3xl"},{default:$(()=>[s(d)]),_:1})])]),_:1},8,["src"]),r("h2",Fs,v(e.audio?.title),1)]),r("div",Ts,[r("div",Ps,[s(n,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,v(e.audio?.title),1)]),r("p",Is,v(e.audio?.style),1),r("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),r("div",zs,[r("p",null,v(e.audio?.lyric),1)])])])):(l(),h("div",Rs))}const Gs=E(Ls,[["render",Ds]]),Ms="https://webhook.acedata.cloud/suno",Os=b({name:"SunoIndex",components:{Layout:ot,ConfigPanel:ko,RecentPanel:As,PreviewPanel:Gs},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(){Ee.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ve&&L.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:Ms},t=this.credential?.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{L.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Bs(e,t,i,o,a,u){const d=c("config-panel"),p=c("recent-panel"),_=c("preview-panel"),n=c("layout");return l(),w(n,null,{config:$(()=>[s(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(_)]),_:1})}const Cn=E(Os,[["render",Bs],["__scopeId","data-v-f5721d95"]]);export{Cn as default};
|
|
1
|
+
import{F as K}from"./index.es-Bp770TJB.js";import{E as Z}from"./index-CloSjXsD.js";import{E as de}from"./index-cgo1Pb2h.js";import{as as pe,ay as me,bR as fe,at as ae,ci as he,_ as _e,d as b,a as $e,au as ve,c as F,bq as ge,bw as ye,aF as le,b as h,o as l,i as w,r as U,f as oe,e as V,j as $,bh as re,E as D,n as ke,g as we,h as E,t as r,k as s,l as c,fa as se,x as v,F as z,v as N,fb as H,cf as be,D as I,fc as Y,fd as Q,y as k,J as x,cW as ee,fe as B,b_ as Ce,dw as W,aq as P,ff as G,aw as Se,K as Ae,fg as Le,dn as Ee,dv as Ve}from"./index-CQrPjFP_.js";import{E as ce}from"./index-D_UuSSio.js";import{E as je,a as Fe}from"./index-BfrVKSM6.js";import{I as M}from"./InfoIcon-XOoV07qh.js";import{E as Te}from"./index-CSysAZmU.js";import{E as L}from"./index-CNgsi8VO.js";import{E as X}from"./index-JId3XsgM.js";import{E as Pe,a as ue}from"./index-BI5YGWKe.js";import{E as J}from"./index-CXgV7KQu.js";import{C as Ie,N as Ue}from"./NoTasks-Bp2ijoHi.js";import{a as ze}from"./price-DqAh1UX4.js";import{E as Re,a as De,b as Ge}from"./index-BX8SGicp.js";import{E as Me}from"./index-B2fZZPBz.js";import{E as Oe}from"./index-B_puVQOn.js";import{E as Be,a as We}from"./index-DdabCetB.js";import"./use-form-item-C-B0Mj_x.js";import"./index-r5W6hzzQ.js";import"./index-Dz48GK02.js";import"./index-DwQ1Uy8r.js";import"./typescript-2uGAN6a6.js";import"./strings-CvXj94LS.js";import"./castArray-DQV2cAXY.js";import"./isEqual-CzYHFkcF.js";import"./_initCloneObject-CsjYnf5f.js";import"./debounce-Dpng1Slf.js";import"./_baseIteratee-BT7cFN53.js";import"./index-BkEVr9W9.js";import"./index-DKQt0yVa.js";import"./_baseClone-ByiDqVMo.js";import"./index-DA01t0HA.js";import"./dropdown-DyvuKpB1.js";const qe=pe({size:{type:[Number,String],values:he,default:"",validator:e=>ae(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:fe},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Ne={error:e=>e instanceof Event},He=b({name:"ElAvatar"}),Ke=b({...He,props:qe,emits:Ne,setup(e,{emit:t}){const i=e,o=$e("avatar"),a=ve(!1),u=F(()=>{const{size:n,icon:m,shape:y}=i,f=[o.b()];return ge(n)&&f.push(o.m(n)),m&&f.push(o.m("icon")),y&&f.push(o.m(y)),f}),d=F(()=>{const{size:n}=i;return ae(n)?o.cssVarBlock({size:ye(n)||""}):void 0}),p=F(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function _(n){a.value=!0,t("error",n)}return(n,m)=>(l(),h("span",{class:ke(V(u)),style:oe(V(d))},[(n.src||n.srcSet)&&!a.value?(l(),h("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(V(p)),onError:_},null,44,["src","alt","srcset"])):n.icon?(l(),w(V(D),{key:1},{default:$(()=>[(l(),w(re(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ze=_e(Ke,[["__file","avatar.vue"]]);const xe=we(Ze),Xe=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:Z,FontAwesomeIcon:K},data(){return{drawer:!1,preview:!1}},computed:{}}),Je={class:"main flex flex-row flex-1"},Ye={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},Qe={class:"result h-full flex flex-col flex-1 border-r border-[var(--el-border-color)]"},et={class:"preview h-full w-[300px] flex flex-col"};function tt(e,t,i,o,a,u){const d=c("font-awesome-icon"),p=c("el-button"),_=c("el-drawer");return l(),h("div",Je,[r("div",Ye,[U(e.$slots,"config",{},void 0,!0)]),r("div",Qe,[U(e.$slots,"result",{},void 0,!0)]),r("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(d,{icon:"fa-solid fa-magic"})]),_:1}),s(_,{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=E(Xe,[["render",tt],["__scopeId","data-v-6cc632e5"]]),st=b({name:"VersionSelector",components:{ElSelect:Fe,ElOption:je,ElSwitch:ce},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"},{label:this.$t("suno.model.model45plus"),value:"chirp-v4-5-plus"},{label:this.$t("suno.model.model5"),value:"chirp-v5"}]}},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,a,u){const d=c("el-switch"),p=c("el-option"),_=c("el-select");return l(),h("div",nt,[r("h2",it,v(e.$t("suno.name.type")),1),s(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(_,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(l(!0),h(z,null,N(e.options,n=>(l(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=E(st,[["render",at],["__scopeId","data-v-5ebe40d6"]]),rt=b({name:"UploadAudio",components:{ElUpload:Te,ElButton:Z,InfoIcon:M,FontAwesomeIcon:K},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(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.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}L.info(this.$t("suno.message.startingUploadAudio")),H.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const a=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:a,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{L.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,a,u){const d=c("info-icon"),p=c("font-awesome-icon"),_=c("el-button"),n=c("el-upload");return l(),h("div",ct,[r("div",ut,[r("div",dt,[r("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(d,{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(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ft=E(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ht="",_t=b({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:M},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=ht)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},yt={class:"title font-bold"},kt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-switch"),_=c("el-input");return l(),h("div",$t,[r("div",vt,[r("div",gt,[r("h2",yt,v(e.$t("suno.name.prompt")),1),s(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",kt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),r("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(_,{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=E(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",At=b({name:"LyricInput",components:{ElInput:X,InfoIcon:M},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)}}),Lt={class:"field"},Et={class:"box"},Vt={class:"title font-bold"};function jt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Lt,[r("div",Et,[r("h2",Vt,v(e.$t("suno.name.lyrics")),1),s(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Ft=E(At,[["render",jt],["__scopeId","data-v-99dfded8"]]),Tt=b({name:"StyleInput",components:{ElInput:X,InfoIcon:M},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"},It={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Pt,[r("div",It,[r("h2",Ut,v(e.$t("suno.name.style")),1),s(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=_=>e.style=_),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Rt=E(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Dt=b({name:"TitleInput",components:{ElInput:X,InfoIcon:M},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"},Mt={class:"title-container"},Ot={class:"title font-bold"};function Bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Gt,[r("div",Mt,[r("h2",Ot,v(e.$t("suno.name.title")),1),s(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=_=>e.title=_),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Wt=E(Dt,[["render",Bt],["__scopeId","data-v-ce70fe34"]]);function R(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const qt=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:D,ElInputNumber:Pe,VideoPlay:Q,VideoPause:Y},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:R,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})}}}),Nt={class:"field"},Ht={class:"box"},Kt={class:"title font-bold"},Zt={class:"input-wrapper"},xt={class:"task"},Xt={class:"left"},Jt={key:2,class:"duration"},Yt={class:"info"},Qt={class:"title"},eo={class:"style"};function to(e,t,i,o,a,u){const d=c("el-input-number"),p=c("el-image"),_=c("video-pause"),n=c("el-icon"),m=c("video-play"),y=ee("loading");return l(),h("div",Nt,[r("div",Ht,[r("h2",Kt,v(e.$t("suno.name.extend")),1),r("div",Zt,[s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),r("div",xt,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[3]||(t[3]=f=>e.onClick(e.audio))},[x((l(),h("div",Xt,[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"?(l(),h("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=f=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(_)]),_:1})])):k("",!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")?(l(),h("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=f=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):k("",!0),e.audio?.duration?(l(),h("div",Jt,v(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[y,!e.audio?.audio_url]]),r("div",Yt,[r("h2",Qt,v(e.audio?.title),1),r("p",eo,v(e.audio?.style),1)])])):k("",!0)])])}const oo=E(qt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:D,VideoPlay:Q,VideoPause:Y},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:R,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 fo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=ee("loading");return l(),h("div",no,[r("div",io,[r("h2",ao,v(e.$t("suno.name.cover")),1)]),r("div",lo,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[2]||(t[2]=y=>e.onClick(e.audio))},[x((l(),h("div",ro,[s(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=y=>e.onPause(e.audio))},[s(_,null,{default:$(()=>[s(p)]),_:1})])):k("",!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")?(l(),h("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPlay(e.audio))},[s(_,null,{default:$(()=>[s(n)]),_:1})])):k("",!0),e.audio?.duration?(l(),h("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[m,!e.audio?.audio_url]]),r("div",uo,[r("h2",po,v(e.audio?.title),1),r("p",mo,v(e.audio?.style),1)])])):k("",!0)])])}const ho=E(so,[["render",fo],["__scopeId","data-v-06640216"]]),_o=b({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:Ft,StyleInput:Rt,TitleInput:Wt,ExtendFromInput:oo,CoverFromInput:ho,UploadAudio:ft,FontAwesomeIcon:K,ElButton:Z,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return ze(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 yo(e,t,i,o,a,u){const d=c("type-selector"),p=c("upload-audio"),_=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),y=c("title-input"),f=c("extend-from-input"),C=c("cover-from-input"),j=c("consumption"),T=c("font-awesome-icon"),A=c("el-button");return l(),h("div",$o,[r("div",vo,[s(d,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?k("",!0):(l(),w(_,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(n,{key:1,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(m,{key:2,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(y,{key:3,class:"mb-4"})):k("",!0),e.config?.action==="extend"?(l(),w(f,{key:4,class:"mb-4"})):k("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):k("",!0)]),r("div",go,[s(j,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const ko=E(_o,[["render",yo],["__scopeId","data-v-b9fab929"]]);var q={exports:{}},wo=q.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,y){var f=new XMLHttpRequest;f.open("GET",n),f.responseType="blob",f.onload=function(){_(f.response,m,y)},f.onerror=function(){console.error("could not download file")},f.send()}function a(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function u(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 d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof B=="object"&&B.global===B?B:void 0,p=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),_=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,y){var f=d.URL||d.webkitURL,C=document.createElement("a");m=m||n.name||"download",C.download=m,C.rel="noopener",typeof n=="string"?(C.href=n,C.origin===location.origin?u(C):a(C.href)?o(n,m,y):u(C,C.target="_blank")):(C.href=f.createObjectURL(n),setTimeout(function(){f.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,y){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,y),m);else if(a(n))o(n,m,y);else{var f=document.createElement("a");f.href=n,f.target="_blank",setTimeout(function(){u(f)})}}:function(n,m,y,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,y);var C=n.type==="application/octet-stream",j=/constructor/i.test(d.HTMLElement)||d.safari,T=/CriOS\/[\d]+/.test(navigator.userAgent);if((T||C&&j||p)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var S=A.result;S=T?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=S:location=S,f=null},A.readAsDataURL(n)}else{var O=d.URL||d.webkitURL,g=O.createObjectURL(n);f?f.location=g:location.href=g,f=null,setTimeout(function(){O.revokeObjectURL(g)},4e4)}});d.saveAs=_.saveAs=_,e.exports=_})}(q)),q.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Ao=b({name:"TaskPreview",components:{ElImage:J,ElIcon:D,ElTooltip:Me,ElButton:Z,FontAwesomeIcon:K,VideoPlay:Q,VideoPause:Y,ElDropdown:Ge,ElDropdownMenu:De,ElDropdownItem:Re,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},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(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(i=>({...i,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:R,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{Co.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),L.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}H.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},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}L.info(this.$t("suno.message.startingTask")),H.audio(i,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{L.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Lo={class:"task"},Eo=["onClick"],Vo={class:"left"},jo=["onClick"],Fo=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Io={class:"title"},Uo={class:"style"},zo={class:"right"},Ro={class:"el-dropdown-link"},Do={class:"flex items-center min-w-[120px]"},Go={class:"el-dropdown-link"};function Mo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=c("el-button"),y=c("font-awesome-icon"),f=c("el-tooltip"),C=c("Loading"),j=c("el-dropdown-item"),T=c("el-dropdown-menu"),A=c("el-dropdown"),O=ee("loading");return l(),h("div",Lo,[(l(!0),h(z,null,N(e.audios,g=>(l(),h("div",{key:g.id,class:"audio",onClick:P(S=>e.onClick(g),["stop"])},[x((l(),h("div",Vo,[s(d,{src:g?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:P(S=>e.onPause(g),["stop"])},[s(_,null,{default:$(()=>[s(p)]),_:1})],8,jo)):k("",!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")?(l(),h("div",{key:1,class:"overlay",onClick:P(S=>e.onPlay(g),["stop"])},[s(_,null,{default:$(()=>[s(n)]),_:1})],8,Fo)):k("",!0),g?.duration?(l(),h("div",To,v(e.useFormatDuring(g?.duration)),1)):k("",!0)])),[[O,!g?.audio_url]]),r("div",Po,[r("h2",Io,v(g?.title),1),r("p",Uo,v(g?.style),1)]),r("div",zo,[g?.audio_url?(l(),w(m,{key:0,size:"small",round:"",onClick:P(S=>e.onExtend(S,g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):k("",!0),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[s(j,{disabled:e.isFetchingVideoUrl,onClick:S=>e.handleVideoDownload(g)},{default:$(()=>[r("div",Do,[e.isFetchingVideoUrl?(l(),w(_,{key:0,class:"is-loading mr-2"},{default:$(()=>[s(C)]),_:1})):k("",!0),r("span",null,v(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),g?.audio_url?(l(),w(j,{key:0,onClick:P(S=>e.onDownload(S,g?.audio_url),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:$(()=>[r("span",Ro,[s(f,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(l(),w(j,{key:0,onClick:P(S=>e.onGetStems(g.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):k("",!0),s(j,{onClick:P(S=>e.onCover(g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(l(),w(j,{key:1,onClick:P(S=>e.onConcatMusic(g?.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:$(()=>[r("span",Go,[s(f,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Eo))),128))])}const Oo=E(Ao,[["render",Mo]]),Bo={class:"player-slider"},Wo=b({__name:"PlayerSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=F({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),a=()=>{},u=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,p)=>(l(),h("div",Bo,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=_=>i.value=_),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),qo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},Ho=["src"],Ko={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},xo={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=b({__name:"PlayerSong",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),h("div",No,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||V(qo)},null,8,Ho),r("div",Ko,[r("div",Zo,[r("div",xo,[r("span",null,v(i.value?.title||"Music"),1),r("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Yo={class:"flex justify-end items-center gap-x-2.5"},Qo={class:"text-xs"},es=b({__name:"PlayerAction",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=F({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),h("div",Yo,[r("span",Qo,v(V(R)(i.value))+" / "+v(V(R)(o.value)),1)]))}});var ts={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 os(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function ss(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.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:a,id:e}}var ns=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=os(),p=Se(ns,ts);return function(){var _=u.size,n=u.strokeWidth,m=u.strokeLinecap,y=u.strokeLinejoin,f=u.theme,C=u.fill,j=u.spin,T=ss(d,{size:_,strokeWidth:n,strokeLinecap:m,strokeLinejoin:y,theme:f,fill:C},p),A=[p.prefix+"-icon"];return A.push(p.prefix+"-icon-"+e),t&&p.rtl&&A.push(p.prefix+"-icon-rtl"),j&&A.push(p.prefix+"-icon-spin"),s("span",{class:A.join(" ")},[i(T)])}}};return o}const is=te("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)])}),as=te("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)])}),ls=te("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)])}),ie=b({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),w(re(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"]))}}),rs={class:"player-volume flex flex-col items-center pt-2"},cs={class:"text-sm mt-3"},us=b({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=F({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),h("div",rs,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=p=>i.value=p),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",cs,v(i.value),1)]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=b({__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=F(()=>t.state.suno.audio);return(a,u)=>(l(),h("div",ds,[s(ie,{icon:o.value?.state==="playing"?V(is):V(as),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),s(V(Oe),{placement:"top",width:"50px",trigger:"click"},{reference:$(()=>[s(ie,{icon:V(ls),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},fs={class:"flex grow px-5 items-center"},hs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=b({__name:"Player",setup(e){return(t,i)=>(l(),h("div",ms,[s(Wo),r("div",fs,[r("div",hs,[s(Jo)]),r("div",_s,[s(ps)]),r("div",$s,[s(es)])])]))}}),gs=b({name:"RecentPanel",components:{ElSkeletonItem:We,ElSkeleton:Be,TaskPreview:Oo,Player:vs,NoTasks:Ue},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"),e.scrollTop===0&&this.$emit("reach-top")}}}),ys={key:0,class:"tasks"},ks={class:"left w-[70px] p-[10px] flex items-center"},ws={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},bs={key:2,class:"w-full flex-1 flex items-center justify-center"},Cs={class:"h-20"};function Ss(e,t,i,o,a,u){const d=c("el-skeleton-item"),p=c("el-skeleton"),_=c("task-preview"),n=c("no-tasks"),m=c("player");return l(),h(z,null,[e.tasks?.items===void 0?(l(),h("div",ys,[(l(),h(z,null,N(3,y=>r("div",{key:y,class:"flex"},[r("div",ks,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),r("div",ws,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),s(d,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),h("div",{key:1,class:"flex-1 w-full overflow-y-auto tasks p-2",onScroll:t[0]||(t[0]=(...y)=>e.onHandleScroll&&e.onHandleScroll(...y))},[(l(!0),h(z,null,N(e.tasks?.items,(y,f)=>(l(),w(_,{key:f,"model-value":y,class:"preview"},null,8,["model-value"]))),128))],32)):k("",!0),e.tasks?.items?.length===0?(l(),h("div",bs,[s(n)])):k("",!0),x(r("div",Cs,[s(m)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=E(gs,[["render",Ss]]),Ls=b({name:"TaskPreview",components:{IconPicture:Le,ElImage:J,ElAvatar:xe,ElIcon:D},computed:{audio(){return this.$store.state.suno?.audio}}}),Es={key:0,class:"size-full overflow-hidden"},Vs={class:"relative h-[300px]"},js={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Fs={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Ts={class:"p-4"},Ps={class:"flex items-center font-bold mb-2"},Is={class:"text-[var(--el-text-color-regular)] mb-2"},Us={class:"text-xs text-[var(--el-text-color-regular)]"},zs={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Rs={key:1,class:"w-full h-full"};function Ds(e,t,i,o,a,u){const d=c("icon-picture"),p=c("el-icon"),_=c("el-image"),n=c("el-avatar");return e.audio?.object?(l(),h("div",Es,[r("div",Vs,[s(_,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:$(()=>[r("div",js,[s(p,{class:"text-3xl"},{default:$(()=>[s(d)]),_:1})])]),_:1},8,["src"]),r("h2",Fs,v(e.audio?.title),1)]),r("div",Ts,[r("div",Ps,[s(n,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,v(e.audio?.title),1)]),r("p",Is,v(e.audio?.style),1),r("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),r("div",zs,[r("p",null,v(e.audio?.lyric),1)])])])):(l(),h("div",Rs))}const Gs=E(Ls,[["render",Ds]]),Ms="https://webhook.acedata.cloud/suno",Os=b({name:"SunoIndex",components:{Layout:ot,ConfigPanel:ko,RecentPanel:As,PreviewPanel:Gs},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(){Ee.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ve&&L.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:Ms},t=this.credential?.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{L.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Bs(e,t,i,o,a,u){const d=c("config-panel"),p=c("recent-panel"),_=c("preview-panel"),n=c("layout");return l(),w(n,null,{config:$(()=>[s(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(_)]),_:1})}const Cn=E(Os,[["render",Bs],["__scopeId","data-v-f5721d95"]]);export{Cn as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as S}from"./index.es-Bp770TJB.js";import{E as C}from"./index-CloSjXsD.js";import{E as z}from"./index-cgo1Pb2h.js";import{d as k,h as y,b as l,t as c,k as o,r as P,j as g,l as s,o as a,x as n,cf as W,D as d,F as w,v as V,i as A,fi as x,fj as K,fk as U,fl as T,fm as G,fn as M,fo as D,y as _,n as O,aq as H,fp as J,dA as Q,dw as X}from"./index-CQrPjFP_.js";import{I as q}from"./InfoIcon-XOoV07qh.js";import{E as Y}from"./index-JId3XsgM.js";import{I as F}from"./ImagePreview-CigIbV96.js";import{E as Z}from"./index-CSysAZmU.js";import{E}from"./index-CNgsi8VO.js";import{E as B,a as j}from"./index-BfrVKSM6.js";import{C as ee,N as te}from"./NoTasks-Bp2ijoHi.js";import{a as oe}from"./price-DqAh1UX4.js";import{C as ne}from"./CopyToClipboard-HWj6DYZf.js";import{I as ae}from"./ImageWrapper-B4Lhs8FM.js";import{E as se}from"./index-B2fZZPBz.js";import{E as le}from"./index-7h29hOLy.js";import{E as re}from"./index-CXgV7KQu.js";import{B as ie}from"./BotPlaceholder-BRqNXjza.js";import"./use-form-item-C-B0Mj_x.js";import"./index-r5W6hzzQ.js";import"./typescript-2uGAN6a6.js";import"./index-Dz48GK02.js";import"./index-DA01t0HA.js";import"./index-DKQt0yVa.js";import"./_baseClone-ByiDqVMo.js";import"./_initCloneObject-CsjYnf5f.js";import"./isEqual-CzYHFkcF.js";import"./index-DwQ1Uy8r.js";import"./strings-CvXj94LS.js";import"./castArray-DQV2cAXY.js";import"./debounce-Dpng1Slf.js";import"./_baseIteratee-BT7cFN53.js";import"./index-BkEVr9W9.js";import"./index-DdabCetB.js";const ce=k({name:"LayoutNanobanana",components:{ElDrawer:z,ElButton:C,FontAwesomeIcon:S},data(){return{drawer:!1}}}),ue={class:"main flex flex-row flex-1"},me={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},de={class:"result h-full p-[15px] flex-1 flex flex-col"};function pe(e,t,$,r,b,p){const f=s("font-awesome-icon"),h=s("el-button"),u=s("el-drawer");return a(),l("div",ue,[c("div",me,[P(e.$slots,"config",{},void 0,!0)]),c("div",de,[P(e.$slots,"result",{},void 0,!0)]),o(h,{circle:"",class:"menu",onClick:t[0]||(t[0]=m=>e.drawer=!0)},{default:g(()=>[o(f,{icon:"fa-solid fa-magic"})]),_:1}),o(u,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=m=>e.drawer=m),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:g(()=>[P(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const fe=y(ce,[["render",pe],["__scopeId","data-v-3794959b"]]),he="",_e=k({name:"PromptInput",components:{ElInput:Y,InfoIcon:q},computed:{prompt:{get(){return this.$store.state.nanobanana?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("nanobanana/setConfig",{...this.$store.state.nanobanana?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=he)}}),be={class:"field"},ge={class:"box"},$e={class:"title font-bold"};function ve(e,t,$,r,b,p){const f=s("info-icon"),h=s("el-input");return a(),l("div",be,[c("div",ge,[c("h2",$e,n(e.$t("nanobanana.name.prompt")),1),o(f,{content:e.$t("nanobanana.description.prompt"),class:"info"},null,8,["content"])]),o(h,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=u=>e.prompt=u),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("nanobanana.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ke=y(_e,[["render",ve],["__scopeId","data-v-38b040ab"]]),ye=k({name:"ImageUrlsInput",components:{ElUpload:Z,ElButton:C,InfoIcon:q,ImagePreview:F,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:W()+"/api/v1/files/",suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.nanobanana?.config?.image_urls}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){const r=(this.fileList||[]).filter(b=>!b?.response?.file_url);this.fileList=r.length?r:[];return}const t=[];e.forEach(r=>{const b=this.fileList.find(p=>p?.response?.file_url===r||p?.url===r);b?t.push(b):t.push({name:r.split("/").pop()||r,url:r,status:"success",percentage:100,response:{file_url:r}})}),(this.fileList||[]).filter(r=>!r?.response?.file_url).forEach(r=>{t.some(p=>p===r||p?.url===r?.url||p?.response?.file_url===r?.response?.file_url)||t.push(r)}),this.fileList=t}}},mounted(){},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url=="string"&&e.url.startsWith("blob:"))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImageUrls()},onExceed(){E.warning(this.$t("nanobanana.message.uploadImageExceed"))},onError(){E.error(this.$t("nanobanana.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.suppressWatch=!0,this.$store.commit("nanobanana/setConfig",{...this.$store.state.nanobanana?.config,image_urls:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImageUrls()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url=="string"&&t.url.startsWith("blob:"))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImageUrls()}}}),we={class:"field flex items-center justify-between"},Ae={class:"title font-bold text-[14px] mb-[10px]"},Ve={class:"upload-wrapper flex flex-col items-start gap-[8px]"},Ne={class:"controls flex items-center"},Ee={class:"file-list flex flex-wrap gap-[10px]"};function Ie(e,t,$,r,b,p){const f=s("font-awesome-icon"),h=s("el-button"),u=s("el-upload"),m=s("info-icon"),I=s("image-preview");return a(),l(w,null,[c("div",we,[c("h2",Ae,n(e.$t("nanobanana.name.imageUrls")),1),c("div",Ve,[c("div",Ne,[o(u,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=i=>e.fileList=i),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value",limit:5,multiple:!0,"show-file-list":!1,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-change":e.onChange,"on-remove":e.onRemove,headers:e.headers},{default:g(()=>[o(h,{size:"small",type:"primary",round:""},{default:g(()=>[o(f,{icon:"fa-solid fa-upload",class:"mr-1"}),d(" "+n(e.$t("nanobanana.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","on-change","on-remove","headers"]),o(m,{content:e.$t("nanobanana.description.imageUrls"),class:"ml-2"},null,8,["content"])])])]),c("div",Ee,[(a(!0),l(w,null,V(e.fileList,(i,v)=>(a(),A(I,{key:i.uid||i?.response?.file_url||i.url||v,url:i.url||i?.response?.file_url,name:i.name,percentage:i.percentage,onRemove:N=>e.onRemovePreview(v,i)},null,8,["url","name","percentage","onRemove"]))),128))])],64)}const Re=y(ye,[["render",Ie]]),Le=k({name:"AspectRatioSelector",components:{ElSelect:j,ElOption:B},data(){return{options:["1:1","3:2","2:3","16:9","9:16","4:3","3:4"]}},computed:{value:{get(){return this.$store.state.nanobanana?.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e);const t={...this.$store.state.nanobanana?.config||{}};e?t.aspect_ratio=e:delete t.aspect_ratio,this.$store.commit("nanobanana/setConfig",t)}}}}),Te={class:"field"},Ue={class:"title font-bold"};function Se(e,t,$,r,b,p){const f=s("el-option"),h=s("el-select");return a(),l("div",Te,[c("h2",Ue,n(e.$t("nanobanana.name.aspectRatio")),1),o(h,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=u=>e.value=u),class:"value",clearable:"",placeholder:e.$t("nanobanana.placeholder.select")},{default:g(()=>[(a(!0),l(w,null,V(e.options,u=>(a(),A(f,{key:u,label:u,value:u},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ce=y(Le,[["render",Se],["__scopeId","data-v-67f08a08"]]),Oe=k({name:"NanobananaModelSelector",components:{ElSelect:j,ElOption:B,InfoIcon:q},data(){return{options:[{value:K,label:this.$t("nanobanana.model.nanoBanana")},{value:U,label:this.$t("nanobanana.model.nanoBananaPro")}]}},computed:{value:{get(){return this.$store.state.nanobanana?.config?.model},set(e){this.$store.commit("nanobanana/setConfig",{...this.$store.state.nanobanana?.config,model:e})}},modelDescription(){return this.$t("nanobanana.description.model")}},mounted(){this.value||(this.value=x)}}),qe={class:"field"},Pe={class:"label"},Be={class:"box"},je={class:"title font-bold"};function Ge(e,t,$,r,b,p){const f=s("info-icon"),h=s("el-option"),u=s("el-select");return a(),l("div",qe,[c("div",Pe,[c("div",Be,[c("h2",je,n(e.$t("nanobanana.name.model")),1),o(f,{content:e.modelDescription,class:"info"},null,8,["content"])])]),o(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=m=>e.value=m),class:"value",placeholder:e.$t("nanobanana.placeholder.select")},{default:g(()=>[(a(!0),l(w,null,V(e.options,m=>(a(),A(h,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Me=y(Oe,[["render",Ge],["__scopeId","data-v-e279ee32"]]),De=k({name:"NanobananaResolutionSelector",components:{ElSelect:j,ElOption:B,InfoIcon:q},data(){return{cachedResolution:T,options:[{value:G,label:G},{value:M,label:M},{value:D,label:D}]}},computed:{value:{get(){return this.$store.state.nanobanana?.config?.resolution},set(e){this.$store.commit("nanobanana/setConfig",{...this.$store.state.nanobanana?.config,resolution:e})}},isProModel(){return this.$store.state.nanobanana?.config?.model===U}},watch:{value(e){this.isProModel&&e&&(this.cachedResolution=e)},isProModel(e){e?this.value||(this.value=this.cachedResolution||T):(this.value&&(this.cachedResolution=this.value),this.$store.commit("nanobanana/setConfig",{...this.$store.state.nanobanana?.config,resolution:void 0}))}},mounted(){this.isProModel&&!this.value&&(this.value=T),!this.isProModel&&this.value&&(this.cachedResolution=this.value,this.$store.commit("nanobanana/setConfig",{...this.$store.state.nanobanana?.config,resolution:void 0}))}}),Fe={class:"field"},ze={class:"label"},We={class:"box"},xe={class:"title font-bold"};function Ke(e,t,$,r,b,p){const f=s("info-icon"),h=s("el-option"),u=s("el-select");return a(),l("div",Fe,[c("div",ze,[c("div",We,[c("h2",xe,n(e.$t("nanobanana.name.resolution")),1),o(f,{content:e.$t("nanobanana.description.resolutionProOnly"),class:"info"},null,8,["content"])])]),o(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=m=>e.value=m),class:"value",placeholder:e.$t("nanobanana.placeholder.select"),disabled:!e.isProModel},{default:g(()=>[(a(!0),l(w,null,V(e.options,m=>(a(),A(h,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])])}const He=y(De,[["render",Ke],["__scopeId","data-v-05ae87bb"]]),Je=k({name:"ConfigPanel",components:{ElButton:C,FontAwesomeIcon:S,PromptInput:ke,Consumption:ee,ImageUrlsInput:Re,AspectRatioSelector:Ce,ModelSelector:Me,ResolutionSelector:He},emits:["generate"],computed:{config(){return this.$store.state.nanobanana?.config},consumption(){const e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;return oe({...e,action:t?"edit":"generate"},this.service?.metadata?.price)},service(){return this.$store.state.nanobanana?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Qe={class:"flex flex-col h-full"},Xe={class:"flex-1 overflow-y-auto p-[15px]"},Ye={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Ze(e,t,$,r,b,p){const f=s("model-selector"),h=s("resolution-selector"),u=s("prompt-input"),m=s("aspect-ratio-selector"),I=s("image-urls-input"),i=s("consumption"),v=s("font-awesome-icon"),N=s("el-button");return a(),l("div",Qe,[c("div",Xe,[o(f,{class:"mb-4"}),o(h,{class:"mb-4"}),o(u,{class:"mb-4"}),o(m,{class:"mb-4"}),o(I,{class:"mb-4"})]),c("div",Ye,[o(i,{value:e.consumption,service:e.service},null,8,["value","service"]),o(N,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[o(v,{icon:"fa-solid fa-magic",class:"mr-2"}),d(" "+n(e.$t("nanobanana.button.generate")),1)]),_:1},8,["onClick"])])])}const et=y(Je,[["render",Ze]]),tt=k({name:"TaskPreview",components:{ElImage:re,CopyToClipboard:ne,FontAwesomeIcon:S,ElAlert:le,ImageWrapper:ae,ElButton:C,ElTooltip:se,ImagePreview:F},props:{modelValue:{type:Object,required:!0}},computed:{images(){const e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{onEdit(e){if(!e)return;console.debug("Edit image:",e);const t={...this.$store.state.nanobanana?.config||{}};delete t.action,t.image_urls=[e],this.$store.commit("nanobanana/setConfig",t)}}}),ot={class:"preview"},nt={class:"left"},at={class:"main"},st={class:"bot"},lt={class:"datetime"},rt={class:"info"},it={key:0,class:"flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto"},ct={key:1,class:"prompt mt-2"},ut={key:0},mt={key:0,class:O({content:!0,failed:!0})},dt={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},pt={class:O({operations:!0,"mt-2":!0,"mb-2":!0})},ft={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ht={key:1,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},_t={key:2,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},bt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},gt={key:3,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},$t={key:1,class:O({content:!0})},vt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},kt={key:1,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},yt={key:2,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},wt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},At={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Vt={key:3,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Nt={key:2,class:O({content:!0})},Et={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},It={key:1,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Rt={key:2,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Lt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"};function Tt(e,t,$,r,b,p){const f=s("el-image"),h=s("image-preview"),u=s("image-wrapper"),m=s("el-button"),I=s("el-tooltip"),i=s("font-awesome-icon"),v=s("copy-to-clipboard"),N=s("el-alert");return a(),l("div",ot,[c("div",nt,[o(f,{src:"https://cdn.acedata.cloud/859plc.jpg",class:"avatar"})]),c("div",at,[c("div",st,[d(n(e.$t("nanobanana.name.nanobananaBot"))+" ",1),c("span",lt,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",rt,[e.modelValue?.request?.image_urls&&e.modelValue?.request?.image_urls.length>0?(a(),l("div",it,[(a(!0),l(w,null,V(e.modelValue?.request?.image_urls,(R,L)=>(a(),A(h,{key:L,url:R,name:`image-${L+1}`,closable:!1},null,8,["url","name"]))),128))])):_("",!0),e.modelValue?.request?.prompt?(a(),l("p",ct,[d(n(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?_("",!0):(a(),l("span",ut," - ("+n(e.$t("nanobanana.status.pending"))+") ",1))])):_("",!0)]),e.modelValue?.response?.success===!0?(a(),l("div",mt,[c("div",dt,[(a(!0),l(w,null,V(e.images,(R,L)=>(a(),A(u,{key:L,src:R?.image_url,"raw-src":R?.image_url},null,8,["src","raw-src"]))),128))]),c("div",pt,[o(I,{class:"box-item",effect:"dark",content:e.$t("common.button.edit"),placement:"top-start"},{default:g(()=>[o(m,{type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=H(R=>e.onEdit(e.images?.[0]?.image_url),["stop"]))},{default:g(()=>[d(n(e.$t("common.button.edit")),1)]),_:1})]),_:1},8,["content"])]),o(N,{closable:!1,class:"mt-2 success"},{default:g(()=>[e.modelValue?.request?.model?(a(),l("p",ft,[o(i,{icon:"fa-solid fa-cube",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.model"))+": "+n(e.modelValue?.request?.model),1)])):_("",!0),e.modelValue?.request?.resolution?(a(),l("p",ht,[o(i,{icon:"fa-solid fa-image",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.resolution"))+": "+n(e.modelValue?.request?.resolution),1)])):_("",!0),e.modelValue?.request?.action?(a(),l("p",_t,[o(i,{icon:"fa-solid fa-bolt",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.task"))+": "+n(e.modelValue?.request?.action==="generate"?e.$t("nanobanana.name.generate"):e.$t("nanobanana.name.edits")),1)])):_("",!0),c("p",bt,[o(i,{icon:"fa-solid fa-magic",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),o(v,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),l("p",gt,[o(i,{icon:"fa-solid fa-hashtag",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),o(v,{content:e.modelValue?.response?.trace_id,class:"btn-copy inline-block"},null,8,["content"])])):_("",!0)]),_:1})])):_("",!0),e.modelValue?.response?.success===!1?(a(),l("div",$t,[o(N,{closable:!1,class:"failure"},{template:g(()=>[o(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.failure")),1)]),default:g(()=>[e.modelValue?.request?.model?(a(),l("p",vt,[o(i,{icon:"fa-solid fa-cube",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.model"))+": "+n(e.modelValue?.request?.model),1)])):_("",!0),e.modelValue?.request?.resolution?(a(),l("p",kt,[o(i,{icon:"fa-solid fa-image",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.resolution"))+": "+n(e.modelValue?.request?.resolution),1)])):_("",!0),e.modelValue?.request?.action?(a(),l("p",yt,[o(i,{icon:"fa-solid fa-bolt",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.task"))+": "+n(e.modelValue?.request?.action==="generate"?e.$t("nanobanana.name.generate"):e.$t("nanobanana.name.edits")),1)])):_("",!0),c("p",wt,[o(i,{icon:"fa-solid fa-magic",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),o(v,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),c("p",At,[o(i,{icon:"fa-solid fa-circle-info",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),o(v,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),l("p",Vt,[o(i,{icon:"fa-solid fa-hashtag",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),o(v,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])):_("",!0)]),_:1})])):_("",!0),e.modelValue?.response?_("",!0):(a(),l("div",Nt,[o(N,{closable:!1,class:"info"},{template:g(()=>[o(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.failure")),1)]),default:g(()=>[e.modelValue?.request?.model?(a(),l("p",Et,[o(i,{icon:"fa-solid fa-cube",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.model"))+": "+n(e.modelValue?.request?.model),1)])):_("",!0),e.modelValue?.request?.resolution?(a(),l("p",It,[o(i,{icon:"fa-solid fa-image",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.resolution"))+": "+n(e.modelValue?.request?.resolution),1)])):_("",!0),e.modelValue?.request?.action?(a(),l("p",Rt,[o(i,{icon:"fa-solid fa-bolt",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.task"))+": "+n(e.modelValue?.request?.action==="generate"?e.$t("nanobanana.name.generate"):e.$t("nanobanana.name.edits")),1)])):_("",!0),c("p",Lt,[o(i,{icon:"fa-solid fa-magic",class:"mr-1"}),d(" "+n(e.$t("nanobanana.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),o(v,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const Ut=y(tt,[["render",Tt],["__scopeId","data-v-c93459a1"]]),St=k({name:"RecentPanel",components:{TaskPreview:Ut,BotPlaceholder:ie,NoTasks:te},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.nanobanana?.tasks,items:this.$store.state.nanobanana?.tasks?.items?.slice()}}},methods:{onHandleScroll(){this.$refs.panel.scrollTop===0&&this.$emit("reach-top")}}}),Ct={key:0},Ot={key:1,class:"tasks h-full w-full overflow-y-auto"},qt={key:2,class:"w-full h-full flex items-center justify-center"};function Pt(e,t,$,r,b,p){const f=s("bot-placeholder"),h=s("task-preview"),u=s("no-tasks");return a(),l(w,null,[e.tasks?.items===void 0?(a(),l("div",Ct,[o(f)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),l("div",Ot,[(a(!0),l(w,null,V(e.tasks?.items,m=>(a(),A(h,{key:m.id,"model-value":m},null,8,["model-value"]))),128))])):_("",!0),e.tasks?.items?.length===0?(a(),l("div",qt,[o(u)])):_("",!0)],64)}const Bt=y(St,[["render",Pt]]),jt="https://webhook.acedata.cloud/nanobanana",Gt=k({name:"NanobananaIndex",components:{ConfigPanel:et,Layout:fe,RecentPanel:Bt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.nanobanana?.status?.getApplications===X.Request},credential(){return this.$store.state.nanobanana?.credential},config(){return this.$store.state.nanobanana?.config},application(){return this.$store.state.nanobanana?.application},tasks(){return this.$store.state.nanobanana?.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("nanobanana/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("nanobanana/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:t=5,createdAtMin:$,createdAtMax:r}=e||{};console.debug("limit",t,"createdAtMin",$,"createdAtMax",r),await this.$store.dispatch("nanobanana/getTasks",{limit:t,createdAtMin:$,createdAtMax:r})},async onGenerate(){const e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;delete e.action,!t&&"image_urls"in e&&delete e.image_urls,e?.aspect_ratio||delete e.aspect_ratio,e?.model!==U&&"resolution"in e&&delete e.resolution,e?.model===U&&!e?.resolution&&(e.resolution=T);const $={...e,action:t?"edit":"generate",callback_url:jt},r=this.credential?.token;if(!r){console.error("no token specified");return}E.info(this.$t("nanobanana.message.startingTask")),J.generate($,{token:r}).then(()=>{E.success(this.$t("nanobanana.message.startTaskSuccess"))}).catch(b=>{const p=b?.response?.data;p?.error?.code===Q?E.error(this.$t("nanobanana.message.usedUp")):E.error(this.$t("nanobanana.message.startTaskFailed")+(p?.error?.message||""))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Mt(e,t,$,r,b,p){const f=s("config-panel"),h=s("recent-panel"),u=s("layout");return a(),A(u,null,{config:g(()=>[o(f,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:g(()=>[o(h,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const wo=y(Gt,[["render",Mt]]);export{wo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as U}from"./index.es-Biw5Cjoa.js";import{E as R}from"./index-DEgVEBTr.js";import{E as M}from"./index-BXPOquOZ.js";import{d as f,h,b as r,t as l,k as t,r as P,j as u,l as o,o as a,eY as O,x as c,F as V,v as x,i as k,eZ as q,e_ as B,e$ as z,f0 as N,f1 as X,n as I,f as Q,cf as Y,D as w,y,f2 as H,dA as Z,dw as J}from"./index-Z3Ble6S3.js";import{E as T,a as C}from"./index-Dyigdg3o.js";import{I as L}from"./InfoIcon-GyiV0uTg.js";import{E as K,a as W}from"./index-23_QYN9_.js";import{I as ee}from"./ImagePreview-0sgpwQOv.js";import{E as te}from"./index-Z-vlaGQn.js";import{E as S}from"./index-CcrMfubT.js";import{E as oe}from"./index-BEdCWb2D.js";import{C as se,N as ne}from"./NoTasks-DpyAtW8T.js";import{a as ae}from"./price-Bv6OtNKd.js";import{C as le}from"./CopyToClipboard-DY2B74b1.js";import{V as re}from"./VideoPlayer-CvwYdNWk.js";import{E as ie}from"./index-DUw1QSi5.js";import{E as ce}from"./index-TeONk5U_.js";import{E as pe}from"./index-k5p91wLN.js";import{B as de}from"./BotPlaceholder-BLa0cpzt.js";import"./use-form-item-CY8nvbwg.js";import"./index-r5W6hzzQ.js";import"./index-DksfIPPT.js";import"./typescript-CzuhH513.js";import"./index-TQTp7cjo.js";import"./strings-qqMjRuAB.js";import"./castArray-BOdIXw7P.js";import"./isEqual-yI-vexye.js";import"./_initCloneObject-BWBFVXzM.js";import"./debounce-Dh9PsM_P.js";import"./_baseIteratee-B9yhARKH.js";import"./index-DQAnfDDD.js";import"./index-rzb_p--k.js";import"./_baseClone-Cfbcx9ep.js";import"./index-BZ9SU4fU.js";import"./vue-plyr-QZFBikSk.js";import"./index-iPc5VB6N.js";const ue=f({name:"LayoutPixverse",components:{ElDrawer:M,ElButton:R,FontAwesomeIcon:U},data(){return{drawer:!1}}}),me={class:"main flex flex-row flex-1"},ve={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},_e={class:"result h-full p-[15px] flex-1 flex flex-col"};function fe(e,s,d,m,$,g){const i=o("font-awesome-icon"),p=o("el-button"),n=o("el-drawer");return a(),r("div",me,[l("div",ve,[P(e.$slots,"config",{},void 0,!0)]),l("div",_e,[P(e.$slots,"result",{},void 0,!0)]),t(p,{circle:"",class:"menu",onClick:s[0]||(s[0]=_=>e.drawer=!0)},{default:u(()=>[t(i,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[P(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const he=h(ue,[["render",fe],["__scopeId","data-v-0646853d"]]),$e=f({name:"ModelSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"v3.5",label:"v3.5"},{value:"v4",label:"v4"},{value:"v4.5",label:"v4.5"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.model},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,model:e})}}},mounted(){this.value||(this.value=O)}}),ge={class:"field"},be={class:"title font-bold"};function ye(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",ge,[l("h2",be,c(e.$t("pixverse.name.model")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const we=h($e,[["render",ye],["__scopeId","data-v-e8f337ca"]]),ke=f({name:"QualitySelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"360p",label:"360p"},{value:"540p",label:"540p"},{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.quality},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,quality:e})}}},mounted(){this.value||(this.value=q)}}),Ve={class:"field"},xe={class:"title font-bold"};function Se(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Ve,[l("h2",xe,c(e.$t("pixverse.name.quality")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=h(ke,[["render",Se],["__scopeId","data-v-64aeaae9"]]),Ie=f({name:"MotionSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"normal",label:this.$t("pixverse.name.motion1")},{value:"fast",label:this.$t("pixverse.name.motion2")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.motion},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,motion:e})}}},mounted(){this.value||(this.value=B)}}),Te={class:"field"},Ce={class:"title font-bold"};function Ue(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Te,[l("h2",Ce,c(e.$t("pixverse.name.motion")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Re=h(Ie,[["render",Ue],["__scopeId","data-v-94237408"]]),Ae=f({name:"StyleSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"cyberpunk",label:this.$t("pixverse.name.style1")},{value:"anime",label:this.$t("pixverse.name.style2")},{value:"comic",label:this.$t("pixverse.name.style3")},{value:"clay",label:this.$t("pixverse.name.style4")},{value:"3d_animation",label:this.$t("pixverse.name.style5")},{value:"realistic",label:this.$t("pixverse.name.style6")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.style},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,style:e})}}},mounted(){this.value||(this.value=z)}}),Pe={class:"field"},Le={class:"title font-bold"};function De(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Pe,[l("h2",Le,c(e.$t("pixverse.name.style")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ge=h(Ae,[["render",De],["__scopeId","data-v-64e17b3c"]]),je=f({name:"SeedSelector",components:{ElSlider:W,InfoIcon:L,ElInputNumber:K},computed:{value:{get(){return this.$store.state?.pixverse?.config?.seed},set(e){console.debug("set seed",e),this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,seed:e})}}},mounted(){this.value||(this.value=void 0)}}),Fe={class:"flex justify-between"},Me={class:"flex justify-start items-center"},Oe={class:"text-sm font-bold"},qe={class:"flex justify-end items-center"},Be={class:"w-full"};function ze(e,s,d,m,$,g){const i=o("info-icon"),p=o("el-input-number"),n=o("el-slider");return a(),r("div",null,[l("div",Fe,[l("div",Me,[l("span",Oe,c(e.$t("pixverse.name.seed")),1),t(i,{content:e.$t("pixverse.description.seed")},null,8,["content"])]),l("div",qe,[t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=_=>e.value=_),"controls-position":"right"},null,8,["modelValue"])])]),l("div",Be,[t(n,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=_=>e.value=_),min:0,max:1e3,step:1},null,8,["modelValue"])])])}const Ne=h(je,[["render",ze]]),Xe=f({name:"DurationSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5s"},{value:8,label:"8s"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.duration},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,duration:e})}}},mounted(){this.value||(this.value=N)}}),Qe={class:"field"},Ye={class:"title font-bold"};function He(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Qe,[l("h2",Ye,c(e.$t("pixverse.name.duration")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ze=h(Xe,[["render",He],["__scopeId","data-v-065c77ef"]]),Je=f({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.pixverse.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=X)}}),Ke={class:"text-sm font-bold mb-2 block"},We={class:"items"},et=["onClick"],tt={class:"name"};function ot(e,s,d,m,$,g){return a(),r("div",null,[l("span",Ke,c(e.$t("pixverse.name.aspectRatio")),1),l("div",We,[(a(!0),r(V,null,x(e.options,(i,p)=>(a(),r("div",{key:p,class:I({active:e.active===p,item:!0}),onClick:n=>e.value=i.value},[l("div",{class:I(["preview",i.label])},[l("div",{class:"rect",style:Q({width:i.width+"px",height:i.height+"px"})},null,4)],2),l("p",tt,c(i.label),1)],10,et))),128))])])}const st=h(Je,[["render",ot],["__scopeId","data-v-32a7677f"]]),nt=f({name:"StartImage",components:{ElUpload:te,ElButton:R,InfoIcon:L,FontAwesomeIcon:U,ImagePreview:ee},emits:["change"],data(){return{fileList:[],uploadUrl:Y()+"/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?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){S.warning(this.$t("pixverse.message.uploadReferencesExceed"))},onError(){S.error(this.$t("pixverse.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),at={class:"relative"},lt={class:"flex justify-between"},rt={class:"flex justify-start items-center"},it={class:"text-sm font-bold"};function ct(e,s,d,m,$,g){const i=o("info-icon"),p=o("image-preview"),n=o("font-awesome-icon"),_=o("el-button"),b=o("el-upload");return a(),r("div",at,[l("div",lt,[l("div",rt,[l("span",it,c(e.$t("pixverse.name.startImage")),1),t(i,{content:e.$t("pixverse.description.uploadStartImage")},null,8,["content"])])]),t(b,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=v=>e.fileList=v),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:v})=>[v.url&&v.percentage!==void 0?(a(),k(p,{key:0,url:v.url,name:v.name,percentage:v.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(v),1)},null,8,["url","name","percentage","onRemove"])):y("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+c(e.$t("pixverse.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const pt=h(nt,[["render",ct],["__scopeId","data-v-666104e4"]]),dt="",ut=f({name:"PromptInput",components:{ElInput:oe,InfoIcon:L},computed:{prompt:{get(){return this.$store.state.pixverse?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=dt)}}),mt={class:"field"},vt={class:"box"},_t={class:"title font-bold"};function ft(e,s,d,m,$,g){const i=o("info-icon"),p=o("el-input");return a(),r("div",mt,[l("div",vt,[l("h2",_t,c(e.$t("pixverse.name.prompt")),1),t(i,{content:e.$t("pixverse.description.prompt"),class:"info"},null,8,["content"])]),t(p,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("pixverse.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ht=h(ut,[["render",ft],["__scopeId","data-v-b3dd608e"]]),$t=f({name:"ConfigPanel",components:{ElButton:R,FontAwesomeIcon:U,PromptInput:ht,ModelSelector:we,QualitySelector:Ee,MotionSelector:Re,StyleSelector:Ge,DurationSelector:Ze,StartImage:pt,SeedSelector:Ne,RatioSelector:st,Consumption:se},emits:["generate"],computed:{config(){return this.$store.state.pixverse?.config},consumption(){return ae(this.config,this.service?.metadata?.price)},service(){return this.$store.state.pixverse?.service}},methods:{onGenerate(){this.$emit("generate")}}}),gt={class:"flex flex-col h-full"},bt={class:"flex-1 overflow-y-auto p-[15px]"},yt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function wt(e,s,d,m,$,g){const i=o("prompt-input"),p=o("model-selector"),n=o("style-selector"),_=o("ratio-selector"),b=o("motion-selector"),v=o("quality-selector"),E=o("start-image"),A=o("seed-selector"),D=o("duration-selector"),G=o("consumption"),j=o("font-awesome-icon"),F=o("el-button");return a(),r("div",gt,[l("div",bt,[t(i,{class:"mb-4"}),t(p,{class:"mb-4"}),t(n,{class:"mb-4"}),t(_,{class:"mb-4"}),t(b,{class:"mb-4"}),t(v,{class:"mb-4"}),t(E,{class:"mb-2"}),t(A,{class:"mb-4"}),t(D,{class:"mb-4"})]),l("div",yt,[t(G,{value:e.consumption,service:e.service},null,8,["value","service"]),t(F,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(j,{icon:"fa-solid fa-magic",class:"mr-2"}),w(" "+c(e.$t("pixverse.button.generate")),1)]),_:1},8,["onClick"])])])}const kt=h($t,[["render",wt]]),Vt=f({name:"TaskPreview",components:{ElImage:pe,CopyToClipboard:le,FontAwesomeIcon:U,ElAlert:ce,VideoPlayer:re,ElTooltip:ie,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pixverse?.application},config(){return this.$store.state.pixverse?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),xt={class:"preview"},St={class:"left"},Et={class:"main"},It={class:"bot"},Tt={class:"datetime"},Ct={class:"info"},Ut={key:0,class:"prompt mt-2"},Rt={key:0},At={key:1},Pt={key:0,class:I({content:!0,failed:!0})},Lt={key:0,class:"mb-4"},Dt={key:1,class:I({operations:!0,"mt-2":!0})},Gt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},jt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ft={key:1,class:I({content:!0})},Mt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Bt(e,s,d,m,$,g){const i=o("el-image"),p=o("video-player"),n=o("el-button"),_=o("el-tooltip"),b=o("font-awesome-icon"),v=o("copy-to-clipboard"),E=o("el-alert");return a(),r("div",xt,[l("div",St,[t(i,{src:"https://cdn.acedata.cloud/viy61r.jpg",class:"avatar"})]),l("div",Et,[l("div",It,[w(c(e.$t("pixverse.name.pixverseBot"))+" ",1),l("span",Tt,c(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Ct,[e.modelValue?.request?.prompt?(a(),r("p",Ut,[w(c(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?y("",!0):(a(),r("span",Rt," - ("+c(e.$t("pixverse.status.pending"))+") ",1)),e.modelValue?.response?.data&&(e.modelValue?.response?.data[0]?.state==="processing"||e.modelValue?.response?.data[0]?.state==="pending")?(a(),r("span",At," - ("+c(e.$t("pixverse.status.processing"))+") ",1)):y("",!0)])):y("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(a(),r("div",Pt,[e.modelValue?.response?.data[0]?.video_url?(a(),r("div",Lt,[t(p,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):y("",!0),e.modelValue?.response.success?(a(),r("div",Dt,[t(_,{class:"box-item",effect:"dark",content:e.$t("pixverse.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(a(),k(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[w(c(e.$t("pixverse.button.download")),1)]),_:1})):y("",!0)]),_:1},8,["content"])])):y("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",Gt,[t(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.model"))+": "+c(e.modelValue?.request?.model),1)]),l("p",jt,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),t(v,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):y("",!0),e.modelValue?.response?.success===!1?(a(),r("div",Ft,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.failure")),1)]),default:u(()=>[l("p",Mt,[t(b,{icon:"fa-solid fa-circle-info",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.failureReason"))+": "+c(e.modelValue?.response?.error?.message)+" ",1),t(v,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),l("p",Ot,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),t(v,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),r("p",qt,[t(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.traceId"))+": "+c(e.modelValue?.response?.trace_id)+" ",1),t(v,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):y("",!0)]),_:1})])):y("",!0)])])}const zt=h(Vt,[["render",Bt],["__scopeId","data-v-3f3bff8a"]]),Nt=f({name:"RecentPanel",components:{TaskPreview:zt,NoTasks:ne,BotPlaceholder:de},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pixverse?.tasks,items:this.$store.state.pixverse?.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")}}}),Xt={key:0},Qt={key:1,class:"h-full w-full overflow-y-auto tasks"},Yt={key:2,class:"w-full h-full flex items-center justify-center"};function Ht(e,s,d,m,$,g){const i=o("bot-placeholder"),p=o("task-preview"),n=o("no-tasks");return a(),r(V,null,[e.tasks?.items===void 0?(a(),r("div",Xt,[t(i)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),r("div",Qt,[(a(!0),r(V,null,x(e.tasks?.items,(_,b)=>(a(),k(p,{key:b,"model-value":_},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),r("div",Yt,[t(n)])):y("",!0)],64)}const Zt=h(Nt,[["render",Ht]]),Jt="https://webhook.acedata.cloud/pixverse",Kt=f({name:"PixverseIndex",components:{ConfigPanel:kt,Layout:he,RecentPanel:Zt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.pixverse?.status?.getApplications===J.Request},credential(){return this.$store.state.pixverse.credential},config(){return this.$store.state.pixverse.config},tasks(){return this.$store.state.pixverse.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("pixverse/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pixverse/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:s=5,createdAtMin:d,createdAtMax:m}=e||{};console.debug("limit",s,"createdAtMin",d,"createdAtMax",m),await this.$store.dispatch("pixverse/getTasks",{limit:s,createdAtMin:d,createdAtMax:m})},async onGenerate(){const e={...this.config,callback_url:Jt},s=this.credential?.token;if(!s){console.error("no token specified");return}S.info(this.$t("pixverse.message.startingTask")),H.generate(e,{token:s}).then(()=>{S.success(this.$t("pixverse.message.startTaskSuccess"))}).catch(d=>{d?.response?.data?.error?.code===Z?S.error(this.$t("pixverse.message.usedUp")):S.error(this.$t("pixverse.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Wt(e,s,d,m,$,g){const i=o("config-panel"),p=o("recent-panel"),n=o("layout");return a(),k(n,null,{config:u(()=>[t(i,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(p,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Go=h(Kt,[["render",Wt]]);export{Go as default};
|
|
1
|
+
import{F as U}from"./index.es-Bp770TJB.js";import{E as R}from"./index-CloSjXsD.js";import{E as M}from"./index-cgo1Pb2h.js";import{d as f,h,b as r,t as l,k as t,r as P,j as u,l as o,o as a,eY as O,x as c,F as V,v as x,i as k,eZ as q,e_ as B,e$ as z,f0 as N,f1 as X,n as I,f as Q,cf as Y,D as w,y,f2 as H,dA as Z,dw as J}from"./index-CQrPjFP_.js";import{E as T,a as C}from"./index-BfrVKSM6.js";import{I as L}from"./InfoIcon-XOoV07qh.js";import{E as K,a as W}from"./index-BI5YGWKe.js";import{I as ee}from"./ImagePreview-CigIbV96.js";import{E as te}from"./index-CSysAZmU.js";import{E as S}from"./index-CNgsi8VO.js";import{E as oe}from"./index-JId3XsgM.js";import{C as se,N as ne}from"./NoTasks-Bp2ijoHi.js";import{a as ae}from"./price-DqAh1UX4.js";import{C as le}from"./CopyToClipboard-HWj6DYZf.js";import{V as re}from"./VideoPlayer-Dl77RqNS.js";import{E as ie}from"./index-B2fZZPBz.js";import{E as ce}from"./index-7h29hOLy.js";import{E as pe}from"./index-CXgV7KQu.js";import{B as de}from"./BotPlaceholder-BRqNXjza.js";import"./use-form-item-C-B0Mj_x.js";import"./index-r5W6hzzQ.js";import"./index-DwQ1Uy8r.js";import"./typescript-2uGAN6a6.js";import"./index-Dz48GK02.js";import"./strings-CvXj94LS.js";import"./castArray-DQV2cAXY.js";import"./isEqual-CzYHFkcF.js";import"./_initCloneObject-CsjYnf5f.js";import"./debounce-Dpng1Slf.js";import"./_baseIteratee-BT7cFN53.js";import"./index-BkEVr9W9.js";import"./index-DKQt0yVa.js";import"./_baseClone-ByiDqVMo.js";import"./index-DA01t0HA.js";import"./vue-plyr-QZFBikSk.js";import"./index-DdabCetB.js";const ue=f({name:"LayoutPixverse",components:{ElDrawer:M,ElButton:R,FontAwesomeIcon:U},data(){return{drawer:!1}}}),me={class:"main flex flex-row flex-1"},ve={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},_e={class:"result h-full p-[15px] flex-1 flex flex-col"};function fe(e,s,d,m,$,g){const i=o("font-awesome-icon"),p=o("el-button"),n=o("el-drawer");return a(),r("div",me,[l("div",ve,[P(e.$slots,"config",{},void 0,!0)]),l("div",_e,[P(e.$slots,"result",{},void 0,!0)]),t(p,{circle:"",class:"menu",onClick:s[0]||(s[0]=_=>e.drawer=!0)},{default:u(()=>[t(i,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[P(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const he=h(ue,[["render",fe],["__scopeId","data-v-0646853d"]]),$e=f({name:"ModelSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"v3.5",label:"v3.5"},{value:"v4",label:"v4"},{value:"v4.5",label:"v4.5"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.model},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,model:e})}}},mounted(){this.value||(this.value=O)}}),ge={class:"field"},be={class:"title font-bold"};function ye(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",ge,[l("h2",be,c(e.$t("pixverse.name.model")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const we=h($e,[["render",ye],["__scopeId","data-v-e8f337ca"]]),ke=f({name:"QualitySelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"360p",label:"360p"},{value:"540p",label:"540p"},{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.quality},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,quality:e})}}},mounted(){this.value||(this.value=q)}}),Ve={class:"field"},xe={class:"title font-bold"};function Se(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Ve,[l("h2",xe,c(e.$t("pixverse.name.quality")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=h(ke,[["render",Se],["__scopeId","data-v-64aeaae9"]]),Ie=f({name:"MotionSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"normal",label:this.$t("pixverse.name.motion1")},{value:"fast",label:this.$t("pixverse.name.motion2")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.motion},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,motion:e})}}},mounted(){this.value||(this.value=B)}}),Te={class:"field"},Ce={class:"title font-bold"};function Ue(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Te,[l("h2",Ce,c(e.$t("pixverse.name.motion")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Re=h(Ie,[["render",Ue],["__scopeId","data-v-94237408"]]),Ae=f({name:"StyleSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"cyberpunk",label:this.$t("pixverse.name.style1")},{value:"anime",label:this.$t("pixverse.name.style2")},{value:"comic",label:this.$t("pixverse.name.style3")},{value:"clay",label:this.$t("pixverse.name.style4")},{value:"3d_animation",label:this.$t("pixverse.name.style5")},{value:"realistic",label:this.$t("pixverse.name.style6")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.style},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,style:e})}}},mounted(){this.value||(this.value=z)}}),Pe={class:"field"},Le={class:"title font-bold"};function De(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Pe,[l("h2",Le,c(e.$t("pixverse.name.style")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ge=h(Ae,[["render",De],["__scopeId","data-v-64e17b3c"]]),je=f({name:"SeedSelector",components:{ElSlider:W,InfoIcon:L,ElInputNumber:K},computed:{value:{get(){return this.$store.state?.pixverse?.config?.seed},set(e){console.debug("set seed",e),this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,seed:e})}}},mounted(){this.value||(this.value=void 0)}}),Fe={class:"flex justify-between"},Me={class:"flex justify-start items-center"},Oe={class:"text-sm font-bold"},qe={class:"flex justify-end items-center"},Be={class:"w-full"};function ze(e,s,d,m,$,g){const i=o("info-icon"),p=o("el-input-number"),n=o("el-slider");return a(),r("div",null,[l("div",Fe,[l("div",Me,[l("span",Oe,c(e.$t("pixverse.name.seed")),1),t(i,{content:e.$t("pixverse.description.seed")},null,8,["content"])]),l("div",qe,[t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=_=>e.value=_),"controls-position":"right"},null,8,["modelValue"])])]),l("div",Be,[t(n,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=_=>e.value=_),min:0,max:1e3,step:1},null,8,["modelValue"])])])}const Ne=h(je,[["render",ze]]),Xe=f({name:"DurationSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5s"},{value:8,label:"8s"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.duration},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,duration:e})}}},mounted(){this.value||(this.value=N)}}),Qe={class:"field"},Ye={class:"title font-bold"};function He(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Qe,[l("h2",Ye,c(e.$t("pixverse.name.duration")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ze=h(Xe,[["render",He],["__scopeId","data-v-065c77ef"]]),Je=f({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.pixverse.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=X)}}),Ke={class:"text-sm font-bold mb-2 block"},We={class:"items"},et=["onClick"],tt={class:"name"};function ot(e,s,d,m,$,g){return a(),r("div",null,[l("span",Ke,c(e.$t("pixverse.name.aspectRatio")),1),l("div",We,[(a(!0),r(V,null,x(e.options,(i,p)=>(a(),r("div",{key:p,class:I({active:e.active===p,item:!0}),onClick:n=>e.value=i.value},[l("div",{class:I(["preview",i.label])},[l("div",{class:"rect",style:Q({width:i.width+"px",height:i.height+"px"})},null,4)],2),l("p",tt,c(i.label),1)],10,et))),128))])])}const st=h(Je,[["render",ot],["__scopeId","data-v-32a7677f"]]),nt=f({name:"StartImage",components:{ElUpload:te,ElButton:R,InfoIcon:L,FontAwesomeIcon:U,ImagePreview:ee},emits:["change"],data(){return{fileList:[],uploadUrl:Y()+"/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?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){S.warning(this.$t("pixverse.message.uploadReferencesExceed"))},onError(){S.error(this.$t("pixverse.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),at={class:"relative"},lt={class:"flex justify-between"},rt={class:"flex justify-start items-center"},it={class:"text-sm font-bold"};function ct(e,s,d,m,$,g){const i=o("info-icon"),p=o("image-preview"),n=o("font-awesome-icon"),_=o("el-button"),b=o("el-upload");return a(),r("div",at,[l("div",lt,[l("div",rt,[l("span",it,c(e.$t("pixverse.name.startImage")),1),t(i,{content:e.$t("pixverse.description.uploadStartImage")},null,8,["content"])])]),t(b,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=v=>e.fileList=v),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:v})=>[v.url&&v.percentage!==void 0?(a(),k(p,{key:0,url:v.url,name:v.name,percentage:v.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(v),1)},null,8,["url","name","percentage","onRemove"])):y("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+c(e.$t("pixverse.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const pt=h(nt,[["render",ct],["__scopeId","data-v-666104e4"]]),dt="",ut=f({name:"PromptInput",components:{ElInput:oe,InfoIcon:L},computed:{prompt:{get(){return this.$store.state.pixverse?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=dt)}}),mt={class:"field"},vt={class:"box"},_t={class:"title font-bold"};function ft(e,s,d,m,$,g){const i=o("info-icon"),p=o("el-input");return a(),r("div",mt,[l("div",vt,[l("h2",_t,c(e.$t("pixverse.name.prompt")),1),t(i,{content:e.$t("pixverse.description.prompt"),class:"info"},null,8,["content"])]),t(p,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("pixverse.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ht=h(ut,[["render",ft],["__scopeId","data-v-b3dd608e"]]),$t=f({name:"ConfigPanel",components:{ElButton:R,FontAwesomeIcon:U,PromptInput:ht,ModelSelector:we,QualitySelector:Ee,MotionSelector:Re,StyleSelector:Ge,DurationSelector:Ze,StartImage:pt,SeedSelector:Ne,RatioSelector:st,Consumption:se},emits:["generate"],computed:{config(){return this.$store.state.pixverse?.config},consumption(){return ae(this.config,this.service?.metadata?.price)},service(){return this.$store.state.pixverse?.service}},methods:{onGenerate(){this.$emit("generate")}}}),gt={class:"flex flex-col h-full"},bt={class:"flex-1 overflow-y-auto p-[15px]"},yt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function wt(e,s,d,m,$,g){const i=o("prompt-input"),p=o("model-selector"),n=o("style-selector"),_=o("ratio-selector"),b=o("motion-selector"),v=o("quality-selector"),E=o("start-image"),A=o("seed-selector"),D=o("duration-selector"),G=o("consumption"),j=o("font-awesome-icon"),F=o("el-button");return a(),r("div",gt,[l("div",bt,[t(i,{class:"mb-4"}),t(p,{class:"mb-4"}),t(n,{class:"mb-4"}),t(_,{class:"mb-4"}),t(b,{class:"mb-4"}),t(v,{class:"mb-4"}),t(E,{class:"mb-2"}),t(A,{class:"mb-4"}),t(D,{class:"mb-4"})]),l("div",yt,[t(G,{value:e.consumption,service:e.service},null,8,["value","service"]),t(F,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(j,{icon:"fa-solid fa-magic",class:"mr-2"}),w(" "+c(e.$t("pixverse.button.generate")),1)]),_:1},8,["onClick"])])])}const kt=h($t,[["render",wt]]),Vt=f({name:"TaskPreview",components:{ElImage:pe,CopyToClipboard:le,FontAwesomeIcon:U,ElAlert:ce,VideoPlayer:re,ElTooltip:ie,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pixverse?.application},config(){return this.$store.state.pixverse?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),xt={class:"preview"},St={class:"left"},Et={class:"main"},It={class:"bot"},Tt={class:"datetime"},Ct={class:"info"},Ut={key:0,class:"prompt mt-2"},Rt={key:0},At={key:1},Pt={key:0,class:I({content:!0,failed:!0})},Lt={key:0,class:"mb-4"},Dt={key:1,class:I({operations:!0,"mt-2":!0})},Gt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},jt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ft={key:1,class:I({content:!0})},Mt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Bt(e,s,d,m,$,g){const i=o("el-image"),p=o("video-player"),n=o("el-button"),_=o("el-tooltip"),b=o("font-awesome-icon"),v=o("copy-to-clipboard"),E=o("el-alert");return a(),r("div",xt,[l("div",St,[t(i,{src:"https://cdn.acedata.cloud/viy61r.jpg",class:"avatar"})]),l("div",Et,[l("div",It,[w(c(e.$t("pixverse.name.pixverseBot"))+" ",1),l("span",Tt,c(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Ct,[e.modelValue?.request?.prompt?(a(),r("p",Ut,[w(c(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?y("",!0):(a(),r("span",Rt," - ("+c(e.$t("pixverse.status.pending"))+") ",1)),e.modelValue?.response?.data&&(e.modelValue?.response?.data[0]?.state==="processing"||e.modelValue?.response?.data[0]?.state==="pending")?(a(),r("span",At," - ("+c(e.$t("pixverse.status.processing"))+") ",1)):y("",!0)])):y("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(a(),r("div",Pt,[e.modelValue?.response?.data[0]?.video_url?(a(),r("div",Lt,[t(p,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):y("",!0),e.modelValue?.response.success?(a(),r("div",Dt,[t(_,{class:"box-item",effect:"dark",content:e.$t("pixverse.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(a(),k(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[w(c(e.$t("pixverse.button.download")),1)]),_:1})):y("",!0)]),_:1},8,["content"])])):y("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",Gt,[t(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.model"))+": "+c(e.modelValue?.request?.model),1)]),l("p",jt,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),t(v,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):y("",!0),e.modelValue?.response?.success===!1?(a(),r("div",Ft,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.failure")),1)]),default:u(()=>[l("p",Mt,[t(b,{icon:"fa-solid fa-circle-info",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.failureReason"))+": "+c(e.modelValue?.response?.error?.message)+" ",1),t(v,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),l("p",Ot,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),t(v,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),r("p",qt,[t(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.traceId"))+": "+c(e.modelValue?.response?.trace_id)+" ",1),t(v,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):y("",!0)]),_:1})])):y("",!0)])])}const zt=h(Vt,[["render",Bt],["__scopeId","data-v-3f3bff8a"]]),Nt=f({name:"RecentPanel",components:{TaskPreview:zt,NoTasks:ne,BotPlaceholder:de},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pixverse?.tasks,items:this.$store.state.pixverse?.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")}}}),Xt={key:0},Qt={key:1,class:"h-full w-full overflow-y-auto tasks"},Yt={key:2,class:"w-full h-full flex items-center justify-center"};function Ht(e,s,d,m,$,g){const i=o("bot-placeholder"),p=o("task-preview"),n=o("no-tasks");return a(),r(V,null,[e.tasks?.items===void 0?(a(),r("div",Xt,[t(i)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),r("div",Qt,[(a(!0),r(V,null,x(e.tasks?.items,(_,b)=>(a(),k(p,{key:b,"model-value":_},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),r("div",Yt,[t(n)])):y("",!0)],64)}const Zt=h(Nt,[["render",Ht]]),Jt="https://webhook.acedata.cloud/pixverse",Kt=f({name:"PixverseIndex",components:{ConfigPanel:kt,Layout:he,RecentPanel:Zt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.pixverse?.status?.getApplications===J.Request},credential(){return this.$store.state.pixverse.credential},config(){return this.$store.state.pixverse.config},tasks(){return this.$store.state.pixverse.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("pixverse/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pixverse/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:s=5,createdAtMin:d,createdAtMax:m}=e||{};console.debug("limit",s,"createdAtMin",d,"createdAtMax",m),await this.$store.dispatch("pixverse/getTasks",{limit:s,createdAtMin:d,createdAtMax:m})},async onGenerate(){const e={...this.config,callback_url:Jt},s=this.credential?.token;if(!s){console.error("no token specified");return}S.info(this.$t("pixverse.message.startingTask")),H.generate(e,{token:s}).then(()=>{S.success(this.$t("pixverse.message.startTaskSuccess"))}).catch(d=>{d?.response?.data?.error?.code===Z?S.error(this.$t("pixverse.message.usedUp")):S.error(this.$t("pixverse.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Wt(e,s,d,m,$,g){const i=o("config-panel"),p=o("recent-panel"),n=o("layout");return a(),k(n,null,{config:u(()=>[t(i,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(p,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Go=h(Kt,[["render",Wt]]);export{Go as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as C}from"./index.es-Biw5Cjoa.js";import{E as T}from"./index-DEgVEBTr.js";import{E as q}from"./index-BXPOquOZ.js";import{d as v,h as k,b as r,t as a,k as t,r as G,j as u,l as o,o as n,eD as K,x as i,F as I,v as L,i as y,eE as H,eF as J,eG as Q,n as S,f as W,cf as M,D as _,y as $,eH as X,eI as Y,dA as Z,dw as x}from"./index-Z3Ble6S3.js";import{E as R,a as P}from"./index-Dyigdg3o.js";import{I as U}from"./InfoIcon-GyiV0uTg.js";import{I as N}from"./ImagePreview-0sgpwQOv.js";import{E as F}from"./index-Z-vlaGQn.js";import{E as V}from"./index-CcrMfubT.js";import{C as ee,N as te}from"./NoTasks-DpyAtW8T.js";import{E as oe,a as se}from"./index-23_QYN9_.js";import{E as O}from"./index-BEdCWb2D.js";import{a as ne}from"./price-Bv6OtNKd.js";import{C as le}from"./CopyToClipboard-DY2B74b1.js";import{V as ae}from"./VideoPlayer-CvwYdNWk.js";import{E as ie}from"./index-DUw1QSi5.js";import{E as re}from"./index-TeONk5U_.js";import{E as ce}from"./index-k5p91wLN.js";import{B as de}from"./BotPlaceholder-BLa0cpzt.js";import"./use-form-item-CY8nvbwg.js";import"./index-r5W6hzzQ.js";import"./index-DksfIPPT.js";import"./typescript-CzuhH513.js";import"./index-TQTp7cjo.js";import"./strings-qqMjRuAB.js";import"./castArray-BOdIXw7P.js";import"./isEqual-yI-vexye.js";import"./_initCloneObject-BWBFVXzM.js";import"./debounce-Dh9PsM_P.js";import"./_baseIteratee-B9yhARKH.js";import"./index-DQAnfDDD.js";import"./index-rzb_p--k.js";import"./_baseClone-Cfbcx9ep.js";import"./index-BZ9SU4fU.js";import"./vue-plyr-QZFBikSk.js";import"./index-iPc5VB6N.js";const pe=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:T,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ue={class:"main flex flex-row flex-1"},me={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},fe={class:"result h-full p-[15px] flex-1 flex flex-col"};function ge(e,s,m,f,b,w){const c=o("font-awesome-icon"),d=o("el-button"),l=o("el-drawer");return n(),r("div",ue,[a("div",me,[G(e.$slots,"config",{},void 0,!0)]),a("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:s[0]||(s[0]=g=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(l,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=g=>e.drawer=g),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const _e=k(pe,[["render",ge],["__scopeId","data-v-fae64b48"]]),he=v({name:"ModelSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"kling-v1",label:"v1"},{value:"kling-v1-5",label:"v1.5"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v2-1",label:"v2.1"},{value:"kling-v2-1-master",label:"v2.1-Master"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.model},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}},mounted(){this.value||(this.value=K)}}),$e={class:"field"},ve={class:"title font-bold"};function ke(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",$e,[a("h2",ve,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=k(he,[["render",ke],["__scopeId","data-v-4a40b66a"]]),we=v({name:"ModeSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"std",label:this.$t("kling.name.modeStd")},{value:"pro",label:this.$t("kling.name.modePro")}]}},computed:{value:{get(){return this.$store.state.kling?.config?.mode},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}},mounted(){this.value||(this.value=H)}}),ye={class:"field"},Ve={class:"title font-bold"};function Ee(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",ye,[a("h2",Ve,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=k(we,[["render",Ee],["__scopeId","data-v-daa57765"]]),Se=v({name:"DurationSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5秒"},{value:10,label:"10秒"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.duration},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}},mounted(){this.value||(this.value=J)}}),Ce={class:"field"},Te={class:"title font-bold"};function Le(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",Ce,[a("h2",Te,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=k(Se,[["render",Le],["__scopeId","data-v-02112e2c"]]),Ae=v({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug("set ratio",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=Q)}}),Ge={class:"text-sm font-bold mb-2 block"},Re={class:"items"},Pe=["onClick"],De={class:"name"};function je(e,s,m,f,b,w){return n(),r("div",null,[a("span",Ge,i(e.$t("kling.name.ratio")),1),a("div",Re,[(n(!0),r(I,null,L(e.options,(c,d)=>(n(),r("div",{key:d,class:S({active:e.active===d,item:!0}),onClick:l=>e.value=c.value},[a("div",{class:S(["preview",c.label])},[a("div",{class:"rect",style:W({width:c.width+"px",height:c.height+"px"})},null,4)],2),a("p",De,i(c.label),1)],10,Pe))),128))])])}const Me=k(Ae,[["render",je],["__scopeId","data-v-2601284f"]]),Ne=v({name:"StartImage",components:{ElUpload:F,ElButton:T,InfoIcon:U,FontAwesomeIcon:C,ImagePreview:N},emits:["change"],data(){return{fileList:[],uploadUrl:M()+"/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?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Fe={class:"relative"},Oe={class:"flex justify-between"},Be={class:"flex justify-start items-center"},ze={class:"text-sm font-bold"};function qe(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Fe,[a("div",Oe,[a("div",Be,[a("span",ze,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ke=k(Ne,[["render",qe],["__scopeId","data-v-e2205d5b"]]),He=v({name:"EndImage",components:{ElUpload:F,ElButton:T,ImagePreview:N,InfoIcon:U,FontAwesomeIcon:C},data(){return{fileList:[],uploadUrl:M()+"/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?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Je={class:"relative"},Qe={class:"flex justify-between"},We={class:"flex justify-start items-center"},Xe={class:"text-sm font-bold"};function Ye(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Je,[a("div",Qe,[a("div",We,[a("span",Xe,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ze=k(He,[["render",Ye],["__scopeId","data-v-caf87d80"]]),xe=v({name:"CfgScaleSelector",components:{ElSlider:se,InfoIcon:U,ElInputNumber:oe},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug("set cfg_scale",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||(this.value=X)}}),et={class:"flex justify-between"},tt={class:"flex justify-start items-center"},ot={class:"text-sm font-bold"},st={class:"flex justify-end items-center"},nt={class:"w-full"};function lt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input-number"),l=o("el-slider");return n(),r("div",null,[a("div",et,[a("div",tt,[a("span",ot,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),a("div",st,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=g=>e.value=g),"controls-position":"right"},null,8,["modelValue"])])]),a("div",nt,[t(l,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=g=>e.value=g),min:0,max:1,step:.1},null,8,["modelValue"])])])}const at=k(xe,[["render",lt]]),it="",rt=v({name:"PromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=it)}}),ct={class:"field"},dt={class:"box"},pt={class:"title font-bold"};function ut(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",ct,[a("div",dt,[a("h2",pt,i(e.$t("kling.name.prompt")),1),t(c,{content:e.$t("kling.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const mt=k(rt,[["render",ut],["__scopeId","data-v-0e95dea6"]]),ft="",gt=v({name:"NegativePromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),_t={class:"field"},ht={class:"box"},$t={class:"title font-bold"};function vt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",_t,[a("div",ht,[a("h2",$t,i(e.$t("kling.name.negativePrompt")),1),t(c,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const kt=k(gt,[["render",vt],["__scopeId","data-v-dfc5338b"]]),bt=v({name:"ConfigPanel",components:{ElButton:T,Consumption:ee,FontAwesomeIcon:C,PromptInput:mt,NegativePromptInput:kt,ModelSelector:be,ModeSelector:Ie,DurationSelector:Ue,RatioSelector:Me,StartImage:Ke,CfgScaleSelector:at,EndImage:Ze},emits:["generate"],computed:{config(){return this.$store.state.kling?.config},consumption(){return ne(this.config,this.service?.metadata?.price)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),wt={class:"flex flex-col h-full"},yt={class:"flex-1 overflow-y-auto p-[15px]"},Vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Et(e,s,m,f,b,w){const c=o("prompt-input"),d=o("model-selector"),l=o("ratio-selector"),g=o("start-image"),h=o("end-image"),p=o("duration-selector"),E=o("mode-selector"),A=o("cfg-scale-selector"),B=o("negative-prompt-input"),z=o("consumption"),D=o("font-awesome-icon"),j=o("el-button");return n(),r("div",wt,[a("div",yt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(l,{class:"mb-4"}),t(g,{class:"mb-2"}),t(h,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"})]),a("div",Vt,[t(z,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(n(),y(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(n(),y(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])}const It=k(bt,[["render",Et]]),St=v({name:"TaskPreview",components:{ElImage:ce,CopyToClipboard:le,FontAwesomeIcon:C,ElAlert:re,VideoPlayer:ae,ElTooltip:ie,ElButton:T},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Ct={class:"preview"},Tt={class:"left"},Lt={class:"main"},Ut={class:"bot"},At={class:"datetime"},Gt={class:"info"},Rt={key:0,class:"prompt mt-2"},Pt={key:0},Dt={key:1},jt={key:0,class:S({content:!0,failed:!0})},Mt={key:0,class:"mb-4"},Nt={key:1,class:S({operations:!0,"mt-2":!0})},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Bt={key:1,class:S({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Kt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ht={key:2,class:S({content:!0})},Jt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Qt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Wt(e,s,m,f,b,w){const c=o("el-image"),d=o("video-player"),l=o("el-button"),g=o("el-tooltip"),h=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Ct,[a("div",Tt,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),a("div",Lt,[a("div",Ut,[_(i(e.$t("kling.name.klingBot"))+" ",1),a("span",At,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Gt,[e.modelValue?.request?.prompt?(n(),r("p",Rt,[_(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),r("span",Pt," - ("+i(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(n(),r("span",Dt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),r("div",jt,[e.modelValue?.response.video_url?(n(),r("div",Mt,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),r("div",Nt,[t(g,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(l,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,e.modelValue?.response.video_url))},{default:u(()=>[_(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[a("p",Ft,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),a("p",Ot,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Bt,[t(E,{closable:!1,class:"failure"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",zt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),a("p",qt,[t(h,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("kling.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Kt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Ht,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",Jt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Qt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0)])])}const Xt=k(St,[["render",Wt],["__scopeId","data-v-c0a171a2"]]),Yt=v({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:te,BotPlaceholder:de},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.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")}}}),Zt={key:0},xt={key:1,class:"h-full w-full overflow-y-auto tasks"},eo={key:2,class:"w-full h-full flex items-center justify-center"};function to(e,s,m,f,b,w){const c=o("bot-placeholder"),d=o("task-preview"),l=o("no-tasks");return n(),r(I,null,[e.tasks?.items===void 0?(n(),r("div",Zt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",xt,[(n(!0),r(I,null,L(e.tasks?.items,g=>(n(),y(d,{key:g.id,"model-value":g},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",eo,[t(l)])):$("",!0)],64)}const oo=k(Yt,[["render",to]]),so="https://webhook.acedata.cloud/kling",no=v({name:"KlingIndex",components:{ConfigPanel:It,Layout:_e,RecentPanel:oo},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.kling?.status?.getApplications===x.Request},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},tasks(){return this.$store.state.kling.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("kling/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("kling/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:s=5,createdAtMin:m,createdAtMax:f}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",f),await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:m,createdAtMax:f})},async onGenerate(){const e={...this.config,callback_url:so},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),Y.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===Z?V.error(this.$t("kling.message.usedUp")):V.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function lo(e,s,m,f,b,w){const c=o("config-panel"),d=o("recent-panel"),l=o("layout");return n(),y(l,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const zo=k(no,[["render",lo]]);export{zo as default};
|
|
1
|
+
import{F as C}from"./index.es-Bp770TJB.js";import{E as T}from"./index-CloSjXsD.js";import{E as q}from"./index-cgo1Pb2h.js";import{d as v,h as k,b as r,t as a,k as t,r as G,j as u,l as o,o as n,eD as K,x as i,F as I,v as L,i as y,eE as H,eF as J,eG as Q,n as S,f as W,cf as M,D as _,y as $,eH as X,eI as Y,dA as Z,dw as x}from"./index-CQrPjFP_.js";import{E as R,a as P}from"./index-BfrVKSM6.js";import{I as U}from"./InfoIcon-XOoV07qh.js";import{I as N}from"./ImagePreview-CigIbV96.js";import{E as F}from"./index-CSysAZmU.js";import{E as V}from"./index-CNgsi8VO.js";import{C as ee,N as te}from"./NoTasks-Bp2ijoHi.js";import{E as oe,a as se}from"./index-BI5YGWKe.js";import{E as O}from"./index-JId3XsgM.js";import{a as ne}from"./price-DqAh1UX4.js";import{C as le}from"./CopyToClipboard-HWj6DYZf.js";import{V as ae}from"./VideoPlayer-Dl77RqNS.js";import{E as ie}from"./index-B2fZZPBz.js";import{E as re}from"./index-7h29hOLy.js";import{E as ce}from"./index-CXgV7KQu.js";import{B as de}from"./BotPlaceholder-BRqNXjza.js";import"./use-form-item-C-B0Mj_x.js";import"./index-r5W6hzzQ.js";import"./index-DwQ1Uy8r.js";import"./typescript-2uGAN6a6.js";import"./index-Dz48GK02.js";import"./strings-CvXj94LS.js";import"./castArray-DQV2cAXY.js";import"./isEqual-CzYHFkcF.js";import"./_initCloneObject-CsjYnf5f.js";import"./debounce-Dpng1Slf.js";import"./_baseIteratee-BT7cFN53.js";import"./index-BkEVr9W9.js";import"./index-DKQt0yVa.js";import"./_baseClone-ByiDqVMo.js";import"./index-DA01t0HA.js";import"./vue-plyr-QZFBikSk.js";import"./index-DdabCetB.js";const pe=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:T,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ue={class:"main flex flex-row flex-1"},me={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},fe={class:"result h-full p-[15px] flex-1 flex flex-col"};function ge(e,s,m,f,b,w){const c=o("font-awesome-icon"),d=o("el-button"),l=o("el-drawer");return n(),r("div",ue,[a("div",me,[G(e.$slots,"config",{},void 0,!0)]),a("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:s[0]||(s[0]=g=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(l,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=g=>e.drawer=g),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const _e=k(pe,[["render",ge],["__scopeId","data-v-fae64b48"]]),he=v({name:"ModelSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"kling-v1",label:"v1"},{value:"kling-v1-5",label:"v1.5"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v2-1",label:"v2.1"},{value:"kling-v2-1-master",label:"v2.1-Master"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.model},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}},mounted(){this.value||(this.value=K)}}),$e={class:"field"},ve={class:"title font-bold"};function ke(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",$e,[a("h2",ve,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=k(he,[["render",ke],["__scopeId","data-v-4a40b66a"]]),we=v({name:"ModeSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"std",label:this.$t("kling.name.modeStd")},{value:"pro",label:this.$t("kling.name.modePro")}]}},computed:{value:{get(){return this.$store.state.kling?.config?.mode},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}},mounted(){this.value||(this.value=H)}}),ye={class:"field"},Ve={class:"title font-bold"};function Ee(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",ye,[a("h2",Ve,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=k(we,[["render",Ee],["__scopeId","data-v-daa57765"]]),Se=v({name:"DurationSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5秒"},{value:10,label:"10秒"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.duration},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}},mounted(){this.value||(this.value=J)}}),Ce={class:"field"},Te={class:"title font-bold"};function Le(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",Ce,[a("h2",Te,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=k(Se,[["render",Le],["__scopeId","data-v-02112e2c"]]),Ae=v({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug("set ratio",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=Q)}}),Ge={class:"text-sm font-bold mb-2 block"},Re={class:"items"},Pe=["onClick"],De={class:"name"};function je(e,s,m,f,b,w){return n(),r("div",null,[a("span",Ge,i(e.$t("kling.name.ratio")),1),a("div",Re,[(n(!0),r(I,null,L(e.options,(c,d)=>(n(),r("div",{key:d,class:S({active:e.active===d,item:!0}),onClick:l=>e.value=c.value},[a("div",{class:S(["preview",c.label])},[a("div",{class:"rect",style:W({width:c.width+"px",height:c.height+"px"})},null,4)],2),a("p",De,i(c.label),1)],10,Pe))),128))])])}const Me=k(Ae,[["render",je],["__scopeId","data-v-2601284f"]]),Ne=v({name:"StartImage",components:{ElUpload:F,ElButton:T,InfoIcon:U,FontAwesomeIcon:C,ImagePreview:N},emits:["change"],data(){return{fileList:[],uploadUrl:M()+"/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?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Fe={class:"relative"},Oe={class:"flex justify-between"},Be={class:"flex justify-start items-center"},ze={class:"text-sm font-bold"};function qe(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Fe,[a("div",Oe,[a("div",Be,[a("span",ze,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ke=k(Ne,[["render",qe],["__scopeId","data-v-e2205d5b"]]),He=v({name:"EndImage",components:{ElUpload:F,ElButton:T,ImagePreview:N,InfoIcon:U,FontAwesomeIcon:C},data(){return{fileList:[],uploadUrl:M()+"/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?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Je={class:"relative"},Qe={class:"flex justify-between"},We={class:"flex justify-start items-center"},Xe={class:"text-sm font-bold"};function Ye(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Je,[a("div",Qe,[a("div",We,[a("span",Xe,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ze=k(He,[["render",Ye],["__scopeId","data-v-caf87d80"]]),xe=v({name:"CfgScaleSelector",components:{ElSlider:se,InfoIcon:U,ElInputNumber:oe},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug("set cfg_scale",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||(this.value=X)}}),et={class:"flex justify-between"},tt={class:"flex justify-start items-center"},ot={class:"text-sm font-bold"},st={class:"flex justify-end items-center"},nt={class:"w-full"};function lt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input-number"),l=o("el-slider");return n(),r("div",null,[a("div",et,[a("div",tt,[a("span",ot,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),a("div",st,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=g=>e.value=g),"controls-position":"right"},null,8,["modelValue"])])]),a("div",nt,[t(l,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=g=>e.value=g),min:0,max:1,step:.1},null,8,["modelValue"])])])}const at=k(xe,[["render",lt]]),it="",rt=v({name:"PromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=it)}}),ct={class:"field"},dt={class:"box"},pt={class:"title font-bold"};function ut(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",ct,[a("div",dt,[a("h2",pt,i(e.$t("kling.name.prompt")),1),t(c,{content:e.$t("kling.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const mt=k(rt,[["render",ut],["__scopeId","data-v-0e95dea6"]]),ft="",gt=v({name:"NegativePromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),_t={class:"field"},ht={class:"box"},$t={class:"title font-bold"};function vt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",_t,[a("div",ht,[a("h2",$t,i(e.$t("kling.name.negativePrompt")),1),t(c,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const kt=k(gt,[["render",vt],["__scopeId","data-v-dfc5338b"]]),bt=v({name:"ConfigPanel",components:{ElButton:T,Consumption:ee,FontAwesomeIcon:C,PromptInput:mt,NegativePromptInput:kt,ModelSelector:be,ModeSelector:Ie,DurationSelector:Ue,RatioSelector:Me,StartImage:Ke,CfgScaleSelector:at,EndImage:Ze},emits:["generate"],computed:{config(){return this.$store.state.kling?.config},consumption(){return ne(this.config,this.service?.metadata?.price)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),wt={class:"flex flex-col h-full"},yt={class:"flex-1 overflow-y-auto p-[15px]"},Vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Et(e,s,m,f,b,w){const c=o("prompt-input"),d=o("model-selector"),l=o("ratio-selector"),g=o("start-image"),h=o("end-image"),p=o("duration-selector"),E=o("mode-selector"),A=o("cfg-scale-selector"),B=o("negative-prompt-input"),z=o("consumption"),D=o("font-awesome-icon"),j=o("el-button");return n(),r("div",wt,[a("div",yt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(l,{class:"mb-4"}),t(g,{class:"mb-2"}),t(h,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"})]),a("div",Vt,[t(z,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(n(),y(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(n(),y(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])}const It=k(bt,[["render",Et]]),St=v({name:"TaskPreview",components:{ElImage:ce,CopyToClipboard:le,FontAwesomeIcon:C,ElAlert:re,VideoPlayer:ae,ElTooltip:ie,ElButton:T},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Ct={class:"preview"},Tt={class:"left"},Lt={class:"main"},Ut={class:"bot"},At={class:"datetime"},Gt={class:"info"},Rt={key:0,class:"prompt mt-2"},Pt={key:0},Dt={key:1},jt={key:0,class:S({content:!0,failed:!0})},Mt={key:0,class:"mb-4"},Nt={key:1,class:S({operations:!0,"mt-2":!0})},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Bt={key:1,class:S({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Kt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ht={key:2,class:S({content:!0})},Jt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Qt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Wt(e,s,m,f,b,w){const c=o("el-image"),d=o("video-player"),l=o("el-button"),g=o("el-tooltip"),h=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Ct,[a("div",Tt,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),a("div",Lt,[a("div",Ut,[_(i(e.$t("kling.name.klingBot"))+" ",1),a("span",At,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Gt,[e.modelValue?.request?.prompt?(n(),r("p",Rt,[_(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),r("span",Pt," - ("+i(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(n(),r("span",Dt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),r("div",jt,[e.modelValue?.response.video_url?(n(),r("div",Mt,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),r("div",Nt,[t(g,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(l,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,e.modelValue?.response.video_url))},{default:u(()=>[_(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[a("p",Ft,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),a("p",Ot,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Bt,[t(E,{closable:!1,class:"failure"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",zt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),a("p",qt,[t(h,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("kling.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Kt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Ht,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",Jt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Qt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0)])])}const Xt=k(St,[["render",Wt],["__scopeId","data-v-c0a171a2"]]),Yt=v({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:te,BotPlaceholder:de},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.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")}}}),Zt={key:0},xt={key:1,class:"h-full w-full overflow-y-auto tasks"},eo={key:2,class:"w-full h-full flex items-center justify-center"};function to(e,s,m,f,b,w){const c=o("bot-placeholder"),d=o("task-preview"),l=o("no-tasks");return n(),r(I,null,[e.tasks?.items===void 0?(n(),r("div",Zt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",xt,[(n(!0),r(I,null,L(e.tasks?.items,g=>(n(),y(d,{key:g.id,"model-value":g},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",eo,[t(l)])):$("",!0)],64)}const oo=k(Yt,[["render",to]]),so="https://webhook.acedata.cloud/kling",no=v({name:"KlingIndex",components:{ConfigPanel:It,Layout:_e,RecentPanel:oo},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.kling?.status?.getApplications===x.Request},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},tasks(){return this.$store.state.kling.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("kling/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("kling/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:s=5,createdAtMin:m,createdAtMax:f}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",f),await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:m,createdAtMax:f})},async onGenerate(){const e={...this.config,callback_url:so},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),Y.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===Z?V.error(this.$t("kling.message.usedUp")):V.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function lo(e,s,m,f,b,w){const c=o("config-panel"),d=o("recent-panel"),l=o("layout");return n(),y(l,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const zo=k(no,[["render",lo]]);export{zo as default};
|