@acedatacloud/nexior 3.17.5 → 3.17.6
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-M-wj0J-w.js → Auth-Z-99geNh.js} +1 -1
- package/dist/assets/{BotPlaceholder-C1Azl5K7.js → BotPlaceholder-SNsOTqam.js} +1 -1
- package/dist/assets/{Callback-Bz3B9nx6.js → Callback-B9q8Zr2T.js} +1 -1
- package/dist/assets/{Console-BzLhkikT.js → Console-CHW9ggwE.js} +1 -1
- package/dist/assets/{Conversation-LVJfixVu.js → Conversation-BL8UlLED.js} +2 -2
- package/dist/assets/{CopyToClipboard-AFrGC6zu.js → CopyToClipboard-D3TJn93t.js} +1 -1
- package/dist/assets/{Detail-CqdREk_1.js → Detail-DL8kVcvW.js} +1 -1
- package/dist/assets/{EditArray-CGbwGpRK.js → EditArray-Coy2z-LG.js} +1 -1
- package/dist/assets/{Extra-yKXFVG1a.js → Extra-DOxffduZ.js} +1 -1
- package/dist/assets/{FilePreview-Dt2uzjGl.js → FilePreview-CKuFhx3n.js} +1 -1
- package/dist/assets/{History-Dc-8wkvv.js → History-SULvh7yR.js} +1 -1
- package/dist/assets/{ImagePreview-Vw_6gGQd.js → ImagePreview-CtulF2DE.js} +1 -1
- package/dist/assets/{ImageWrapper-BHZ6v6Hu.js → ImageWrapper-Dn1J-qcO.js} +1 -1
- package/dist/assets/Index-B06g2ziu.css +1 -0
- package/dist/assets/{Index-CTsXrHyW.js → Index-B7aymxRE.js} +1 -1
- package/dist/assets/{Index-CojbKmR3.js → Index-CGaj4BtN.js} +1 -1
- package/dist/assets/{Index-D2oiKbFP.js → Index-CZ6kKkKi.js} +1 -1
- package/dist/assets/{Index-QeCRKHNv.js → Index-CrJWyjpI.js} +1 -1
- package/dist/assets/{Index-CfbuVnfs.js → Index-CuCIzXVs.js} +1 -1
- package/dist/assets/{Index-YDLgar-q.js → Index-D-UJzWi5.js} +1 -1
- package/dist/assets/{Index-Cqzgq7iB.js → Index-D1hfa3ea.js} +1 -1
- package/dist/assets/{Index-0kgZhs6d.js → Index-DY6EG_JY.js} +1 -1
- package/dist/assets/{Index-QMfw1hIR.js → Index-DZuskX8o.js} +1 -1
- package/dist/assets/{Index-D_AMTZIC.js → Index-EDbG-gqF.js} +1 -1
- package/dist/assets/{Index-J7JlA35c.js → Index-_QYN_qzr.js} +1 -1
- package/dist/assets/Index-_X8PjGeI.js +1 -0
- package/dist/assets/{Index-BpDPvB2e.js → Index-mhY9TuYA.js} +1 -1
- package/dist/assets/{Index-C06T2dzl.js → Index-wwbm5_OR.js} +1 -1
- package/dist/assets/{InfoIcon-aG3xky6z.js → InfoIcon-CKWH7Unh.js} +1 -1
- package/dist/assets/{Invitees-EIz5GH1N.js → Invitees-BrmQKMQD.js} +1 -1
- package/dist/assets/{List-DY6olt_K.js → List-BNbO5H5s.js} +1 -1
- package/dist/assets/{List-eOJcJP2B.js → List-BV39rxdz.js} +1 -1
- package/dist/assets/{List-DoLXxtF6.js → List-ype9fjUG.js} +1 -1
- package/dist/assets/{Login-o4ywAw_b.js → Login-Dti2VtI6.js} +1 -1
- package/dist/assets/{Main-utEpcTki.js → Main-CFq8GbxO.js} +1 -1
- package/dist/assets/{Navigator-BL82vOxY.js → Navigator-f-o0tj8K.js} +1 -1
- package/dist/assets/{NoTasks-D6aQEQ_z.js → NoTasks-n2Y3Xi8d.js} +1 -1
- package/dist/assets/{Pagination-BUIYUPlC.js → Pagination-DT69FSqU.js} +1 -1
- package/dist/assets/{Status-DvmAEWo4.js → Status-BeHZ_qRe.js} +1 -1
- package/dist/assets/{Subscribe-CB1ThAcy.js → Subscribe-UgEGzsyS.js} +1 -1
- package/dist/assets/{VideoPlayer-B4hwt6p9.js → VideoPlayer-BX6yy2Ms.js} +1 -1
- package/dist/assets/{_Uint8Array-CKCrVCIW.js → _Uint8Array-BG2yH9Xs.js} +1 -1
- package/dist/assets/{_baseClone-2NfMeWJP.js → _baseClone-CIVWVsK_.js} +1 -1
- package/dist/assets/{_baseIteratee-DrOJ5XUl.js → _baseIteratee-CZXPuPK6.js} +1 -1
- package/dist/assets/{_initCloneObject-CfGFlXWr.js → _initCloneObject-OgD-mn93.js} +1 -1
- package/dist/assets/{castArray-DVyev9bJ.js → castArray-OJKbUui1.js} +1 -1
- package/dist/assets/{debounce-Dnlkicc5.js → debounce-Dp-VJZWt.js} +1 -1
- package/dist/assets/{distribution-BbSVq125.js → distribution-A0lQRpeo.js} +1 -1
- package/dist/assets/{dropdown-CxuXHpft.js → dropdown-CWB38Hp0.js} +1 -1
- package/dist/assets/{index-DgyERZhI.js → index-0-YolWpd.js} +1 -1
- package/dist/assets/{index-BFW05bY6.js → index-3x2q0pd-.js} +1 -1
- package/dist/assets/{index-DlFjlQy3.js → index-B-5Rco42.js} +1 -1
- package/dist/assets/{index-DI_C3Ao9.js → index-B-c97tkm.js} +13 -13
- package/dist/assets/{index-DPVwLadf.js → index-B1v80OQR.js} +1 -1
- package/dist/assets/{index-bcWh3aiG.js → index-BMjVMxw5.js} +1 -1
- package/dist/assets/{index-By0D1Y9r.js → index-BX_rgBZU.js} +1 -1
- package/dist/assets/{index-CGl7iLF3.js → index-BnYtZ9R0.js} +1 -1
- package/dist/assets/{index-BEf6ot_1.js → index-BnwCLUZ1.js} +1 -1
- package/dist/assets/{index-BZuQIN64.js → index-BodDUlK9.js} +1 -1
- package/dist/assets/{index-sVUmFHgv.js → index-Bpt-o1po.js} +1 -1
- package/dist/assets/{index-B099pfCb.js → index-CNQpLirn.js} +1 -1
- package/dist/assets/{index-BnwSAYOH.js → index-CNmM91HR.js} +1 -1
- package/dist/assets/{index-B3Ntk-No.js → index-CZ7J-ARg.js} +1 -1
- package/dist/assets/{index-CY75twqY.js → index-Ctj5Gs-R.js} +1 -1
- package/dist/assets/{index-B79QJXE0.css → index-Cy2PtLu1.css} +1 -1
- package/dist/assets/{index-BTbYbX3l.js → index-CyvEZaMN.js} +1 -1
- package/dist/assets/{index-BoPdW-Of.js → index-CzUGFL3v.js} +1 -1
- package/dist/assets/{index-CZ5FRTN3.js → index-D5tJfJHE.js} +1 -1
- package/dist/assets/{index-D67IuHtq.js → index-DbFYmaKg.js} +1 -1
- package/dist/assets/{index-DLRLNopw.js → index-DfwyVFPw.js} +1 -1
- package/dist/assets/{index-D7SIBJVO.js → index-Dh5CqsTj.js} +1 -1
- package/dist/assets/{index-ml3LR6LG.js → index-DxAHO5d6.js} +1 -1
- package/dist/assets/{index-ByY_tD9H.js → index-Dy8uomZn.js} +1 -1
- package/dist/assets/{index-Uz6VpvEs.js → index-_Y1ITuV6.js} +1 -1
- package/dist/assets/{index-DqzgaH2_.js → index-_dtyuPXT.js} +1 -1
- package/dist/assets/{index-D-xE_DuU.js → index-q2QI50Dk.js} +1 -1
- package/dist/assets/{index-BGGxyBYT.js → index-sT8-_wnR.js} +1 -1
- package/dist/assets/{index-PU4oJo9l.js → index-suS-ff0R.js} +1 -1
- package/dist/assets/{index-DDIFQJDx.js → index-y7eYX58P.js} +1 -1
- package/dist/assets/{index.es-Sv2RX3tE.js → index.es-C1YdrRxd.js} +1 -1
- package/dist/assets/{isEqual-rNurVTiM.js → isEqual-DPjHHy6z.js} +1 -1
- package/dist/assets/{isPlainObject-BiS_yJCA.js → isPlainObject-CYRUPzsf.js} +1 -1
- package/dist/assets/{midjourney-BOSLPXYd.js → midjourney-BItXAmFK.js} +1 -1
- package/dist/assets/midjourney-C38G8xdY.js +1 -0
- package/dist/assets/midjourney-CTGbD602.js +1 -0
- package/dist/assets/{midjourney-CKT0ckpN.js → midjourney-Cwt7yrdr.js} +1 -1
- package/dist/assets/midjourney-DVWKwayT.js +1 -0
- package/dist/assets/midjourney-DmVKy8My.js +1 -0
- package/dist/assets/{order-qoLDORAh.js → order-C7K7z0hb.js} +1 -1
- package/dist/assets/{price-CV9K1ebj.js → price-8cN6TCDJ.js} +1 -1
- package/dist/assets/{strings-CKxhwaoH.js → strings-B-LPfC97.js} +1 -1
- package/dist/assets/{typescript-8pw9sVHl.js → typescript-eNy_A1X5.js} +1 -1
- package/dist/assets/{use-form-item-D6NQ9sNV.js → use-form-item-FIYBugq7.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/Index-auc3aXY9.js +0 -1
- package/dist/assets/Index-lGPUVGER.css +0 -1
- package/dist/assets/midjourney-CLIyDa6j.js +0 -1
- package/dist/assets/midjourney-D4nnkrfR.js +0 -1
- package/dist/assets/midjourney-Dja-dCmE.js +0 -1
- package/dist/assets/midjourney-Dr2BQ3dQ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as E}from"./index.es-Sv2RX3tE.js";import{E as S}from"./index-Uz6VpvEs.js";import{E as U}from"./index-DlFjlQy3.js";import{d as h,h as $,b as i,t as a,k as t,r as T,j as _,l as s,o as r,eF as j,x as l,F as y,v as C,i as V,eG as D,D as f,y as x,n as I,eH as F,dr as P,dm as R}from"./index-DI_C3Ao9.js";import{E as L,a as M}from"./index-BnwSAYOH.js";import{I as G}from"./InfoIcon-aG3xky6z.js";import{E as B,a as O}from"./index-DPVwLadf.js";import{E as q}from"./index-DqzgaH2_.js";import{C as N,N as z}from"./NoTasks-D6aQEQ_z.js";import{a as H}from"./price-CV9K1ebj.js";import{C as X}from"./CopyToClipboard-AFrGC6zu.js";import{I as K}from"./ImageWrapper-BHZ6v6Hu.js";import{E as W}from"./index-ByY_tD9H.js";import{E as J}from"./index-D7SIBJVO.js";import{B as Q}from"./BotPlaceholder-C1Azl5K7.js";import{E as w}from"./index-B099pfCb.js";import"./use-form-item-D6NQ9sNV.js";import"./index-r5W6hzzQ.js";import"./index-PU4oJo9l.js";import"./index-sVUmFHgv.js";import"./typescript-8pw9sVHl.js";import"./index-D-xE_DuU.js";import"./strings-CKxhwaoH.js";import"./castArray-DVyev9bJ.js";import"./isEqual-rNurVTiM.js";import"./_Uint8Array-CKCrVCIW.js";import"./debounce-Dnlkicc5.js";import"./_baseIteratee-DrOJ5XUl.js";import"./index-bcWh3aiG.js";import"./index-BTbYbX3l.js";import"./index-BoPdW-Of.js";const Y=h({name:"LayoutFlux",components:{ElDrawer:U,ElButton:S,FontAwesomeIcon:E},data(){return{drawer:!1}}}),Z={class:"main"},ee={class:"config"},te={class:"result"};function oe(e,o,p,c,g,v){const d=s("font-awesome-icon"),m=s("el-button"),n=s("el-drawer");return r(),i("div",Z,[a("div",ee,[T(e.$slots,"config",{},void 0,!0)]),a("div",te,[T(e.$slots,"result",{},void 0,!0)]),t(m,{circle:"",class:"menu",onClick:o[0]||(o[0]=u=>e.drawer=!0)},{default:_(()=>[t(d,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=u=>e.drawer=u),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:_(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const se=$(Y,[["render",oe],["__scopeId","data-v-126e6454"]]),ne=h({name:"ModelSelector",components:{ElSelect:M,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"flux-schnell",label:"flux-schnell"},{value:"flux-dev",label:"flux-dev"},{value:"flux-pro",label:"flux-pro"},{value:"flux-pro-1.1",label:"flux-pro-1.1"},{value:"flux-pro-1.1-ultra",label:"flux-pro-1.1-ultra"},{value:"flux-kontext-pro",label:"flux-kontext-pro"},{value:"flux-kontext-max",label:"flux-kontext-max"}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||(this.value=j)}}),ae={class:"field"},le={class:"title font-bold"};function re(e,o,p,c,g,v){const d=s("el-option"),m=s("el-select");return r(),i("div",ae,[a("h2",le,l(e.$t("flux.name.model")),1),t(m,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:_(()=>[(r(!0),i(y,null,C(e.options,n=>(r(),V(d,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ie=$(ne,[["render",re],["__scopeId","data-v-2e94cca6"]]),ce=h({name:"CountSelector",components:{ElSlider:O,InfoIcon:G,ElInputNumber:B},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug("set count",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||(this.value=D)}}),ue={class:"flex justify-between"},de={class:"flex justify-start items-center"},me={class:"text-sm font-bold"},pe={class:"flex justify-end items-center"},fe={class:"w-full"};function _e(e,o,p,c,g,v){const d=s("info-icon"),m=s("el-input-number"),n=s("el-slider");return r(),i("div",null,[a("div",ue,[a("div",de,[a("span",me,l(e.$t("flux.name.numbers")),1),t(d,{content:e.$t("flux.description.numbers")},null,8,["content"])]),a("div",pe,[t(m,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=u=>e.value=u),"controls-position":"right"},null,8,["modelValue"])])]),a("div",fe,[t(n,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=u=>e.value=u),min:1,max:4,step:1},null,8,["modelValue"])])])}const he=$(ce,[["render",_e]]),$e="",ge=h({name:"PromptInput",components:{ElInput:q,InfoIcon:G},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=$e)}}),ve={class:"field"},be={class:"box"},xe={class:"title font-bold"};function ke(e,o,p,c,g,v){const d=s("info-icon"),m=s("el-input");return r(),i("div",ve,[a("div",be,[a("h2",xe,l(e.$t("flux.name.prompt")),1),t(d,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(m,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const we=$(ge,[["render",ke],["__scopeId","data-v-4c101a17"]]),ye=h({name:"PresetPanel",components:{ElButton:S,FontAwesomeIcon:E,PromptInput:we,ModelSelector:ie,CountSelector:he,Consumption:N},emits:["generate"],computed:{config(){return this.$store.state.flux?.config},consumption(){return H(this.config,this.service?.metadata?.price)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Ve={class:"flex flex-col h-full"},Te={class:"flex-1 overflow-y-auto p-[15px]"},Ee={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Ce(e,o,p,c,g,v){const d=s("prompt-input"),m=s("model-selector"),n=s("count-selector"),u=s("consumption"),b=s("font-awesome-icon"),k=s("el-button");return r(),i("div",Ve,[a("div",Te,[t(d,{class:"mb-4"}),t(m,{class:"mb-4"}),t(n,{class:"mb-4"})]),a("div",Ee,[t(u,{value:e.consumption,service:e.service},null,8,["value","service"]),t(k,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:_(()=>[t(b,{icon:"fa-solid fa-magic",class:"mr-2"}),f(" "+l(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])}const Ie=$(ye,[["render",Ce]]),Se=h({name:"TaskPreview",components:{ElImage:J,CopyToClipboard:X,FontAwesomeIcon:E,ElAlert:W,ImageWrapper:K},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(p=>{let c=p;o&&(c.action=o),e.push(c)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Ge={class:"preview"},Ae={class:"left"},Ue={class:"main"},je={class:"bot"},De={class:"datetime"},Fe={class:"info"},Pe={key:0,class:"prompt mt-2"},Re={key:0},Le={key:0,class:I({content:!0,failed:!0})},Me={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},Be={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Oe={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},qe={key:1,class:I({content:!0})},Ne={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ze={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},He={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Xe={key:2,class:I({content:!0})},Ke={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function We(e,o,p,c,g,v){const d=s("el-image"),m=s("image-wrapper"),n=s("font-awesome-icon"),u=s("copy-to-clipboard"),b=s("el-alert");return r(),i("div",Ge,[a("div",Ae,[t(d,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),a("div",Ue,[a("div",je,[f(l(e.$t("flux.name.fluxBot"))+" ",1),a("span",De,l(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Fe,[e.modelValue?.request?.prompt?(r(),i("p",Pe,[f(l(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?x("",!0):(r(),i("span",Re," - ("+l(e.$t("flux.status.pending"))+") ",1))])):x("",!0)]),e.modelValue?.response?.success===!0?(r(),i("div",Le,[a("div",Me,[(r(!0),i(y,null,C(e.images,(k,A)=>(r(),V(m,{key:A,src:k?.image_url,"raw-src":k?.image_url,"model-value":k},null,8,["src","raw-src","model-value"]))),128))]),t(b,{closable:!1,class:"mt-2 success"},{default:_(()=>[a("p",Be,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.model"))+": "+l(e.modelValue?.request?.model),1)]),a("p",Oe,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?.success===!1?(r(),i("div",qe,[t(b,{closable:!1,class:"failure"},{template:_(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",Ne,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),a("p",ze,[t(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),f(" "+l(e.$t("flux.name.failureReason"))+": "+l(e.modelValue?.response?.error?.message)+" ",1),t(u,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),a("p",He,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.traceId"))+": "+l(e.modelValue?.response?.trace_id)+" ",1),t(u,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?x("",!0):(r(),i("div",Xe,[t(b,{closable:!1,class:"info"},{template:_(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",Ke,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const Je=$(Se,[["render",We],["__scopeId","data-v-fd5838a5"]]),Qe=h({name:"RecentPanel",components:{TaskPreview:Je,BotPlaceholder:Q,NoTasks:z},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Ye={key:0},Ze={key:1,class:"tasks h-full w-full overflow-y-auto"},et={key:2,class:"w-full h-full flex items-center justify-center"};function tt(e,o,p,c,g,v){const d=s("bot-placeholder"),m=s("task-preview"),n=s("no-tasks");return r(),i(y,null,[e.tasks?.items===void 0?(r(),i("div",Ye,[t(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(r(),i("div",Ze,[(r(!0),i(y,null,C(e.tasks?.items,(u,b)=>(r(),V(m,{key:b,"model-value":u},null,8,["model-value"]))),128))])):x("",!0),e.tasks?.items?.length===0?(r(),i("div",et,[t(n)])):x("",!0)],64)}const ot=$(Qe,[["render",tt]]),st="https://webhook.acedata.cloud/flux",nt=h({name:"FluxIndex",components:{ConfigPanel:Ie,Layout:se,RecentPanel:ot},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===R.Request},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("flux/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("flux/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:c}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",c),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:p,createdAtMax:c})},async onGenerate(){const e={...this.config,callback_url:st},o=this.credential?.token;if(!o){console.error("no token specified");return}w.info(this.$t("flux.message.startingTask")),F.generate(e,{token:o}).then(()=>{w.success(this.$t("flux.message.startTaskSuccess"))}).catch(p=>{const c=p?.response?.data;c?.error?.code===P?w.error(this.$t("flux.message.usedUp")):w.error(this.$t("flux.message.startTaskFailed")+c?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function at(e,o,p,c,g,v){const d=s("config-panel"),m=s("recent-panel"),n=s("layout");return r(),V(n,null,{config:_(()=>[t(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:_(()=>[t(m,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Pt=$(nt,[["render",at]]);export{Pt as default};
|
|
1
|
+
import{F as E}from"./index.es-C1YdrRxd.js";import{E as S}from"./index-_Y1ITuV6.js";import{E as U}from"./index-B-5Rco42.js";import{d as h,h as $,b as i,t as a,k as t,r as T,j as _,l as s,o as r,eF as j,x as l,F as y,v as C,i as V,eG as D,D as f,y as x,n as I,eH as F,dr as P,dm as R}from"./index-B-c97tkm.js";import{E as L,a as M}from"./index-CNmM91HR.js";import{I as G}from"./InfoIcon-CKWH7Unh.js";import{E as B,a as O}from"./index-B1v80OQR.js";import{E as q}from"./index-_dtyuPXT.js";import{C as N,N as z}from"./NoTasks-n2Y3Xi8d.js";import{a as H}from"./price-8cN6TCDJ.js";import{C as X}from"./CopyToClipboard-D3TJn93t.js";import{I as K}from"./ImageWrapper-Dn1J-qcO.js";import{E as W}from"./index-Dy8uomZn.js";import{E as J}from"./index-Dh5CqsTj.js";import{B as Q}from"./BotPlaceholder-SNsOTqam.js";import{E as w}from"./index-CNQpLirn.js";import"./use-form-item-FIYBugq7.js";import"./index-r5W6hzzQ.js";import"./index-suS-ff0R.js";import"./index-Bpt-o1po.js";import"./typescript-eNy_A1X5.js";import"./index-q2QI50Dk.js";import"./strings-B-LPfC97.js";import"./castArray-OJKbUui1.js";import"./isEqual-DPjHHy6z.js";import"./_Uint8Array-BG2yH9Xs.js";import"./debounce-Dp-VJZWt.js";import"./_baseIteratee-CZXPuPK6.js";import"./index-BMjVMxw5.js";import"./index-CyvEZaMN.js";import"./index-CzUGFL3v.js";const Y=h({name:"LayoutFlux",components:{ElDrawer:U,ElButton:S,FontAwesomeIcon:E},data(){return{drawer:!1}}}),Z={class:"main"},ee={class:"config"},te={class:"result"};function oe(e,o,p,c,g,v){const d=s("font-awesome-icon"),m=s("el-button"),n=s("el-drawer");return r(),i("div",Z,[a("div",ee,[T(e.$slots,"config",{},void 0,!0)]),a("div",te,[T(e.$slots,"result",{},void 0,!0)]),t(m,{circle:"",class:"menu",onClick:o[0]||(o[0]=u=>e.drawer=!0)},{default:_(()=>[t(d,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=u=>e.drawer=u),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:_(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const se=$(Y,[["render",oe],["__scopeId","data-v-126e6454"]]),ne=h({name:"ModelSelector",components:{ElSelect:M,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"flux-schnell",label:"flux-schnell"},{value:"flux-dev",label:"flux-dev"},{value:"flux-pro",label:"flux-pro"},{value:"flux-pro-1.1",label:"flux-pro-1.1"},{value:"flux-pro-1.1-ultra",label:"flux-pro-1.1-ultra"},{value:"flux-kontext-pro",label:"flux-kontext-pro"},{value:"flux-kontext-max",label:"flux-kontext-max"}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||(this.value=j)}}),ae={class:"field"},le={class:"title font-bold"};function re(e,o,p,c,g,v){const d=s("el-option"),m=s("el-select");return r(),i("div",ae,[a("h2",le,l(e.$t("flux.name.model")),1),t(m,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:_(()=>[(r(!0),i(y,null,C(e.options,n=>(r(),V(d,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ie=$(ne,[["render",re],["__scopeId","data-v-2e94cca6"]]),ce=h({name:"CountSelector",components:{ElSlider:O,InfoIcon:G,ElInputNumber:B},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug("set count",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||(this.value=D)}}),ue={class:"flex justify-between"},de={class:"flex justify-start items-center"},me={class:"text-sm font-bold"},pe={class:"flex justify-end items-center"},fe={class:"w-full"};function _e(e,o,p,c,g,v){const d=s("info-icon"),m=s("el-input-number"),n=s("el-slider");return r(),i("div",null,[a("div",ue,[a("div",de,[a("span",me,l(e.$t("flux.name.numbers")),1),t(d,{content:e.$t("flux.description.numbers")},null,8,["content"])]),a("div",pe,[t(m,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=u=>e.value=u),"controls-position":"right"},null,8,["modelValue"])])]),a("div",fe,[t(n,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=u=>e.value=u),min:1,max:4,step:1},null,8,["modelValue"])])])}const he=$(ce,[["render",_e]]),$e="",ge=h({name:"PromptInput",components:{ElInput:q,InfoIcon:G},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=$e)}}),ve={class:"field"},be={class:"box"},xe={class:"title font-bold"};function ke(e,o,p,c,g,v){const d=s("info-icon"),m=s("el-input");return r(),i("div",ve,[a("div",be,[a("h2",xe,l(e.$t("flux.name.prompt")),1),t(d,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(m,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const we=$(ge,[["render",ke],["__scopeId","data-v-4c101a17"]]),ye=h({name:"PresetPanel",components:{ElButton:S,FontAwesomeIcon:E,PromptInput:we,ModelSelector:ie,CountSelector:he,Consumption:N},emits:["generate"],computed:{config(){return this.$store.state.flux?.config},consumption(){return H(this.config,this.service?.metadata?.price)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Ve={class:"flex flex-col h-full"},Te={class:"flex-1 overflow-y-auto p-[15px]"},Ee={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Ce(e,o,p,c,g,v){const d=s("prompt-input"),m=s("model-selector"),n=s("count-selector"),u=s("consumption"),b=s("font-awesome-icon"),k=s("el-button");return r(),i("div",Ve,[a("div",Te,[t(d,{class:"mb-4"}),t(m,{class:"mb-4"}),t(n,{class:"mb-4"})]),a("div",Ee,[t(u,{value:e.consumption,service:e.service},null,8,["value","service"]),t(k,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:_(()=>[t(b,{icon:"fa-solid fa-magic",class:"mr-2"}),f(" "+l(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])}const Ie=$(ye,[["render",Ce]]),Se=h({name:"TaskPreview",components:{ElImage:J,CopyToClipboard:X,FontAwesomeIcon:E,ElAlert:W,ImageWrapper:K},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(p=>{let c=p;o&&(c.action=o),e.push(c)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Ge={class:"preview"},Ae={class:"left"},Ue={class:"main"},je={class:"bot"},De={class:"datetime"},Fe={class:"info"},Pe={key:0,class:"prompt mt-2"},Re={key:0},Le={key:0,class:I({content:!0,failed:!0})},Me={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},Be={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Oe={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},qe={key:1,class:I({content:!0})},Ne={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ze={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},He={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Xe={key:2,class:I({content:!0})},Ke={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function We(e,o,p,c,g,v){const d=s("el-image"),m=s("image-wrapper"),n=s("font-awesome-icon"),u=s("copy-to-clipboard"),b=s("el-alert");return r(),i("div",Ge,[a("div",Ae,[t(d,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),a("div",Ue,[a("div",je,[f(l(e.$t("flux.name.fluxBot"))+" ",1),a("span",De,l(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Fe,[e.modelValue?.request?.prompt?(r(),i("p",Pe,[f(l(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?x("",!0):(r(),i("span",Re," - ("+l(e.$t("flux.status.pending"))+") ",1))])):x("",!0)]),e.modelValue?.response?.success===!0?(r(),i("div",Le,[a("div",Me,[(r(!0),i(y,null,C(e.images,(k,A)=>(r(),V(m,{key:A,src:k?.image_url,"raw-src":k?.image_url,"model-value":k},null,8,["src","raw-src","model-value"]))),128))]),t(b,{closable:!1,class:"mt-2 success"},{default:_(()=>[a("p",Be,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.model"))+": "+l(e.modelValue?.request?.model),1)]),a("p",Oe,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?.success===!1?(r(),i("div",qe,[t(b,{closable:!1,class:"failure"},{template:_(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",Ne,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),a("p",ze,[t(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),f(" "+l(e.$t("flux.name.failureReason"))+": "+l(e.modelValue?.response?.error?.message)+" ",1),t(u,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),a("p",He,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.traceId"))+": "+l(e.modelValue?.response?.trace_id)+" ",1),t(u,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?x("",!0):(r(),i("div",Xe,[t(b,{closable:!1,class:"info"},{template:_(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",Ke,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const Je=$(Se,[["render",We],["__scopeId","data-v-fd5838a5"]]),Qe=h({name:"RecentPanel",components:{TaskPreview:Je,BotPlaceholder:Q,NoTasks:z},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Ye={key:0},Ze={key:1,class:"tasks h-full w-full overflow-y-auto"},et={key:2,class:"w-full h-full flex items-center justify-center"};function tt(e,o,p,c,g,v){const d=s("bot-placeholder"),m=s("task-preview"),n=s("no-tasks");return r(),i(y,null,[e.tasks?.items===void 0?(r(),i("div",Ye,[t(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(r(),i("div",Ze,[(r(!0),i(y,null,C(e.tasks?.items,(u,b)=>(r(),V(m,{key:b,"model-value":u},null,8,["model-value"]))),128))])):x("",!0),e.tasks?.items?.length===0?(r(),i("div",et,[t(n)])):x("",!0)],64)}const ot=$(Qe,[["render",tt]]),st="https://webhook.acedata.cloud/flux",nt=h({name:"FluxIndex",components:{ConfigPanel:Ie,Layout:se,RecentPanel:ot},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===R.Request},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("flux/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("flux/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:c}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",c),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:p,createdAtMax:c})},async onGenerate(){const e={...this.config,callback_url:st},o=this.credential?.token;if(!o){console.error("no token specified");return}w.info(this.$t("flux.message.startingTask")),F.generate(e,{token:o}).then(()=>{w.success(this.$t("flux.message.startTaskSuccess"))}).catch(p=>{const c=p?.response?.data;c?.error?.code===P?w.error(this.$t("flux.message.usedUp")):w.error(this.$t("flux.message.startTaskFailed")+c?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function at(e,o,p,c,g,v){const d=s("config-panel"),m=s("recent-panel"),n=s("layout");return r(),V(n,null,{config:_(()=>[t(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:_(()=>[t(m,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Pt=$(nt,[["render",at]]);export{Pt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as C}from"./index.es-Sv2RX3tE.js";import{E as T}from"./index-Uz6VpvEs.js";import{E as q}from"./index-DlFjlQy3.js";import{d as v,h as k,b as r,t as l,k as t,r as G,j as u,l as o,o as n,ep as K,x as i,F as I,v as L,i as y,eq as H,er as J,es as Q,n as S,f as W,c6 as M,D as h,y as $,et as X,eu as Y,dr as Z,dm as x}from"./index-DI_C3Ao9.js";import{E as R,a as P}from"./index-BnwSAYOH.js";import{I as U}from"./InfoIcon-aG3xky6z.js";import{I as N}from"./ImagePreview-Vw_6gGQd.js";import{E as F}from"./index-DLRLNopw.js";import{E as V}from"./index-B099pfCb.js";import{C as ee,N as te}from"./NoTasks-D6aQEQ_z.js";import{E as oe,a as se}from"./index-DPVwLadf.js";import{E as O}from"./index-DqzgaH2_.js";import{a as ne}from"./price-CV9K1ebj.js";import{C as ae}from"./CopyToClipboard-AFrGC6zu.js";import{V as le}from"./VideoPlayer-B4hwt6p9.js";import{E as ie}from"./index-PU4oJo9l.js";import{E as re}from"./index-ByY_tD9H.js";import{E as ce}from"./index-D7SIBJVO.js";import{B as de}from"./BotPlaceholder-C1Azl5K7.js";import"./use-form-item-D6NQ9sNV.js";import"./index-r5W6hzzQ.js";import"./index-D-xE_DuU.js";import"./typescript-8pw9sVHl.js";import"./index-sVUmFHgv.js";import"./strings-CKxhwaoH.js";import"./castArray-DVyev9bJ.js";import"./isEqual-rNurVTiM.js";import"./_Uint8Array-CKCrVCIW.js";import"./debounce-Dnlkicc5.js";import"./_baseIteratee-DrOJ5XUl.js";import"./index-bcWh3aiG.js";import"./index-BEf6ot_1.js";import"./_baseClone-2NfMeWJP.js";import"./_initCloneObject-CfGFlXWr.js";import"./index-BTbYbX3l.js";import"./vue-plyr-QZFBikSk.js";import"./index-BoPdW-Of.js";const pe=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:T,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ue={class:"main"},me={class:"config"},fe={class:"result"};function ge(e,s,m,f,b,w){const c=o("font-awesome-icon"),d=o("el-button"),a=o("el-drawer");return n(),r("div",ue,[l("div",me,[G(e.$slots,"config",{},void 0,!0)]),l("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:s[0]||(s[0]=_=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=_=>e.drawer=_),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-babc1122"]]),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,[l("h2",ve,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.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,[l("h2",Ve,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.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,[l("h2",Te,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.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,[l("span",Ge,i(e.$t("kling.name.ratio")),1),l("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:a=>e.value=c.value},[l("div",{class:S(["preview",c.label])},[l("div",{class:"rect",style:W({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("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"),a=o("font-awesome-icon"),_=o("el-button"),g=o("el-upload");return n(),r("div",Fe,[l("div",Oe,[l("div",Be,[l("span",ze,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(g,{"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(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(a,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+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"),a=o("font-awesome-icon"),_=o("el-button"),g=o("el-upload");return n(),r("div",Je,[l("div",Qe,[l("div",We,[l("span",Xe,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(g,{"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(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(a,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+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 at(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input-number"),a=o("el-slider");return n(),r("div",null,[l("div",et,[l("div",tt,[l("span",ot,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),l("div",st,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=_=>e.value=_),"controls-position":"right"},null,8,["modelValue"])])]),l("div",nt,[t(a,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=_=>e.value=_),min:0,max:1,step:.1},null,8,["modelValue"])])])}const lt=k(xe,[["render",at]]),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,[l("div",dt,[l("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]=a=>e.prompt=a),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,[l("div",ht,[l("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]=a=>e.prompt=a),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:lt,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"),a=o("ratio-selector"),_=o("start-image"),g=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,[l("div",yt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(a,{class:"mb-4"}),t(_,{class:"mb-2"}),t(g,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"})]),l("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"}),h(" "+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"}),h(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])}const It=k(bt,[["render",Et]]),St=v({name:"TaskPreview",components:{ElImage:ce,CopyToClipboard:ae,FontAwesomeIcon:C,ElAlert:re,VideoPlayer:le,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"),a=o("el-button"),_=o("el-tooltip"),g=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Ct,[l("div",Tt,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),l("div",Lt,[l("div",Ut,[h(i(e.$t("kling.name.klingBot"))+" ",1),l("span",At,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Gt,[e.modelValue?.request?.prompt?(n(),r("p",Rt,[h(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(_,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(a,{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(()=>[h(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",Ft,[t(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),l("p",Ot,[t(g,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+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(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[l("p",zt,[t(g,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),l("p",qt,[t(g,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+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(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+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(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[l("p",Jt,[t(g,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+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(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+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"},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"),a=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,"model-value":_},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",eo,[t(a)])):$("",!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 ao(e,s,m,f,b,w){const c=o("config-panel"),d=o("recent-panel"),a=o("layout");return n(),y(a,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const qo=k(no,[["render",ao]]);export{qo as default};
|
|
1
|
+
import{F as C}from"./index.es-C1YdrRxd.js";import{E as T}from"./index-_Y1ITuV6.js";import{E as q}from"./index-B-5Rco42.js";import{d as v,h as k,b as r,t as l,k as t,r as G,j as u,l as o,o as n,ep as K,x as i,F as I,v as L,i as y,eq as H,er as J,es as Q,n as S,f as W,c6 as M,D as h,y as $,et as X,eu as Y,dr as Z,dm as x}from"./index-B-c97tkm.js";import{E as R,a as P}from"./index-CNmM91HR.js";import{I as U}from"./InfoIcon-CKWH7Unh.js";import{I as N}from"./ImagePreview-CtulF2DE.js";import{E as F}from"./index-DfwyVFPw.js";import{E as V}from"./index-CNQpLirn.js";import{C as ee,N as te}from"./NoTasks-n2Y3Xi8d.js";import{E as oe,a as se}from"./index-B1v80OQR.js";import{E as O}from"./index-_dtyuPXT.js";import{a as ne}from"./price-8cN6TCDJ.js";import{C as ae}from"./CopyToClipboard-D3TJn93t.js";import{V as le}from"./VideoPlayer-BX6yy2Ms.js";import{E as ie}from"./index-suS-ff0R.js";import{E as re}from"./index-Dy8uomZn.js";import{E as ce}from"./index-Dh5CqsTj.js";import{B as de}from"./BotPlaceholder-SNsOTqam.js";import"./use-form-item-FIYBugq7.js";import"./index-r5W6hzzQ.js";import"./index-q2QI50Dk.js";import"./typescript-eNy_A1X5.js";import"./index-Bpt-o1po.js";import"./strings-B-LPfC97.js";import"./castArray-OJKbUui1.js";import"./isEqual-DPjHHy6z.js";import"./_Uint8Array-BG2yH9Xs.js";import"./debounce-Dp-VJZWt.js";import"./_baseIteratee-CZXPuPK6.js";import"./index-BMjVMxw5.js";import"./index-BnwCLUZ1.js";import"./_baseClone-CIVWVsK_.js";import"./_initCloneObject-OgD-mn93.js";import"./index-CyvEZaMN.js";import"./vue-plyr-QZFBikSk.js";import"./index-CzUGFL3v.js";const pe=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:T,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ue={class:"main"},me={class:"config"},fe={class:"result"};function ge(e,s,m,f,b,w){const c=o("font-awesome-icon"),d=o("el-button"),a=o("el-drawer");return n(),r("div",ue,[l("div",me,[G(e.$slots,"config",{},void 0,!0)]),l("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:s[0]||(s[0]=_=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=_=>e.drawer=_),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-babc1122"]]),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,[l("h2",ve,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.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,[l("h2",Ve,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.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,[l("h2",Te,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.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,[l("span",Ge,i(e.$t("kling.name.ratio")),1),l("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:a=>e.value=c.value},[l("div",{class:S(["preview",c.label])},[l("div",{class:"rect",style:W({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("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"),a=o("font-awesome-icon"),_=o("el-button"),g=o("el-upload");return n(),r("div",Fe,[l("div",Oe,[l("div",Be,[l("span",ze,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(g,{"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(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(a,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+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"),a=o("font-awesome-icon"),_=o("el-button"),g=o("el-upload");return n(),r("div",Je,[l("div",Qe,[l("div",We,[l("span",Xe,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(g,{"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(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(a,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+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 at(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input-number"),a=o("el-slider");return n(),r("div",null,[l("div",et,[l("div",tt,[l("span",ot,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),l("div",st,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=_=>e.value=_),"controls-position":"right"},null,8,["modelValue"])])]),l("div",nt,[t(a,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=_=>e.value=_),min:0,max:1,step:.1},null,8,["modelValue"])])])}const lt=k(xe,[["render",at]]),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,[l("div",dt,[l("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]=a=>e.prompt=a),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,[l("div",ht,[l("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]=a=>e.prompt=a),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:lt,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"),a=o("ratio-selector"),_=o("start-image"),g=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,[l("div",yt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(a,{class:"mb-4"}),t(_,{class:"mb-2"}),t(g,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"})]),l("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"}),h(" "+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"}),h(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])}const It=k(bt,[["render",Et]]),St=v({name:"TaskPreview",components:{ElImage:ce,CopyToClipboard:ae,FontAwesomeIcon:C,ElAlert:re,VideoPlayer:le,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"),a=o("el-button"),_=o("el-tooltip"),g=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Ct,[l("div",Tt,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),l("div",Lt,[l("div",Ut,[h(i(e.$t("kling.name.klingBot"))+" ",1),l("span",At,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Gt,[e.modelValue?.request?.prompt?(n(),r("p",Rt,[h(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(_,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(a,{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(()=>[h(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",Ft,[t(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),l("p",Ot,[t(g,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+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(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[l("p",zt,[t(g,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),l("p",qt,[t(g,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+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(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+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(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[l("p",Jt,[t(g,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+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(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+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"},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"),a=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,"model-value":_},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",eo,[t(a)])):$("",!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 ao(e,s,m,f,b,w){const c=o("config-panel"),d=o("recent-panel"),a=o("layout");return n(),y(a,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const qo=k(no,[["render",ao]]);export{qo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as q}from"./index.es-Sv2RX3tE.js";import{E as H}from"./index-Uz6VpvEs.js";import{E as de}from"./index-DlFjlQy3.js";import{aj as pe,ap as me,bI as he,ak as ie,c9 as fe,_ as _e,d as C,a as $e,al as ve,c as V,bh as ge,bn as ke,aw as ae,b as _,o as a,i as w,r as U,f as oe,e as L,j as $,b8 as le,E as R,n as ye,g as we,h as A,t as l,k as s,l as c,eL as se,x as v,F as z,v as N,eM as Y,c6 as be,D as T,eN as x,eO as ee,y,J as Z,cN as te,eP as O,dm as W,eQ as G,an as Ce,K as Se,eR as Le,de as Ae,dl as je}from"./index-DI_C3Ao9.js";import{E as re}from"./index-By0D1Y9r.js";import{E as Ee,a as Ve}from"./index-BnwSAYOH.js";import{I as D}from"./InfoIcon-aG3xky6z.js";import{E as Ie}from"./index-DLRLNopw.js";import{E}from"./index-B099pfCb.js";import{E as K}from"./index-DqzgaH2_.js";import{E as Te,a as ce}from"./index-DPVwLadf.js";import{E as X}from"./index-D7SIBJVO.js";import{C as Pe,N as Fe}from"./NoTasks-D6aQEQ_z.js";import{a as Ue}from"./price-CV9K1ebj.js";import{E as ze,a as Me,b as Re}from"./index-CZ5FRTN3.js";import{E as Ge}from"./index-PU4oJo9l.js";import{E as De}from"./index-BFW05bY6.js";import{a as Oe,E as We}from"./index-BoPdW-Of.js";import{E as Be}from"./index-D-xE_DuU.js";import"./use-form-item-D6NQ9sNV.js";import"./index-r5W6hzzQ.js";import"./index-sVUmFHgv.js";import"./strings-CKxhwaoH.js";import"./castArray-DVyev9bJ.js";import"./isEqual-rNurVTiM.js";import"./_Uint8Array-CKCrVCIW.js";import"./typescript-8pw9sVHl.js";import"./debounce-Dnlkicc5.js";import"./_baseIteratee-DrOJ5XUl.js";import"./index-bcWh3aiG.js";import"./index-BEf6ot_1.js";import"./_baseClone-2NfMeWJP.js";import"./_initCloneObject-CfGFlXWr.js";import"./index-BTbYbX3l.js";import"./dropdown-CxuXHpft.js";const Ne=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ie(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:he},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),qe={error:e=>e instanceof Event},He=C({name:"ElAvatar"}),Ze=C({...He,props:Ne,emits:qe,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=V(()=>{const{size:n,icon:m,shape:k}=i,h=[o.b()];return ge(n)&&h.push(o.m(n)),m&&h.push(o.m("icon")),k&&h.push(o.m(k)),h}),u=V(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=V(()=>({objectFit:i.fit}));ae(()=>i.src,()=>r.value=!1);function f(n){r.value=!0,t("error",n)}return(n,m)=>(a(),_("span",{class:ye(L(d)),style:oe(L(u))},[(n.src||n.srcSet)&&!r.value?(a(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(L(p)),onError:f},null,44,["src","alt","srcset"])):n.icon?(a(),w(L(R),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ke=_e(Ze,[["__file","avatar.vue"]]);const Xe=we(Ke),Je=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:H,FontAwesomeIcon:q},data(){return{drawer:!1,preview:!1}},computed:{}}),Qe={class:"main"},Ye={class:"config"},xe={class:"result"},et={class:"preview"};function tt(e,t,i,o,r,d){const u=c("font-awesome-icon"),p=c("el-button"),f=c("el-drawer");return a(),_("div",Qe,[l("div",Ye,[U(e.$slots,"config",{},void 0,!0)]),l("div",xe,[U(e.$slots,"result",{},void 0,!0)]),l("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-magic"})]),_:1}),s(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ot=A(Je,[["render",tt],["__scopeId","data-v-ab3c4b78"]]),st=C({name:"VersionSelector",components:{ElSelect:Ve,ElOption:Ee,ElSwitch:re},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),nt={class:"field"},it={class:"title font-bold"};function at(e,t,i,o,r,d){const u=c("el-switch"),p=c("el-option"),f=c("el-select");return a(),_("div",nt,[l("h2",it,v(e.$t("suno.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(f,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(a(!0),_(z,null,N(e.options,n=>(a(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=A(st,[["render",at],["__scopeId","data-v-5a66a01f"]]),rt=C({name:"UploadAudio",components:{ElUpload:Ie,ElButton:H,InfoIcon:D,FontAwesomeIcon:q},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),Y.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const r=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:r,action:"upload_extend"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ct={class:"relative"},ut={class:"flex justify-between"},dt={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function mt(e,t,i,o,r,d){const u=c("info-icon"),p=c("font-awesome-icon"),f=c("el-button"),n=c("el-upload");return a(),_("div",ct,[l("div",ut,[l("div",dt,[l("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(u,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:$(()=>[s(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),T(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ht=A(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ft="",_t=C({name:"PromptInput",components:{ElInput:K,ElSwitch:re,InfoIcon:D},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},kt={class:"title font-bold"},yt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-switch"),f=c("el-input");return a(),_("div",$t,[l("div",vt,[l("div",gt,[l("h2",kt,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",yt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(f,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ct=A(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",Lt=C({name:"LyricInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=St)}}),At={class:"field"},jt={class:"box"},Et={class:"title font-bold"};function Vt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",At,[l("div",jt,[l("h2",Et,v(e.$t("suno.name.lyrics")),1),s(u,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(a(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(a(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const It=A(Lt,[["render",Vt],["__scopeId","data-v-99dfded8"]]),Tt=C({name:"StyleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Pt={class:"field"},Ft={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Pt,[l("div",Ft,[l("h2",Ut,v(e.$t("suno.name.style")),1),s(u,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=f=>e.style=f),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Mt=A(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Rt=C({name:"TitleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Dt={class:"title-container"},Ot={class:"title font-bold"};function Wt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Gt,[l("div",Dt,[l("h2",Ot,v(e.$t("suno.name.title")),1),s(u,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=f=>e.title=f),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Bt=A(Rt,[["render",Wt],["__scopeId","data-v-ce70fe34"]]);function M(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,r=t<10?`0${t}`:t;return o+":"+r}const Nt=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:R,ElInputNumber:Te,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),qt={class:"field"},Ht={class:"box"},Zt={class:"title font-bold"},Kt={class:"input-wrapper"},Xt={class:"task"},Jt={class:"left"},Qt={key:2,class:"duration"},Yt={class:"info"},xt={class:"title"},eo={class:"style"};function to(e,t,i,o,r,d){const u=c("el-input-number"),p=c("el-image"),f=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=te("loading");return a(),_("div",qt,[l("div",Ht,[l("h2",Zt,v(e.$t("suno.name.extend")),1),l("div",Kt,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=h=>e.value=h),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),l("div",Xt,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=h=>e.onClick(e.audio))},[Z((a(),_("div",Jt,[s(p,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=h=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(f)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=h=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",Qt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Yt,[l("h2",xt,v(e.audio?.title),1),l("p",eo,v(e.audio?.style),1)])])):y("",!0)])])}const oo=A(Nt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:R,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),no={class:"field"},io={class:"box"},ao={class:"title font-bold"},lo={class:"task"},ro={class:"left"},co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"};function ho(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=te("loading");return a(),_("div",no,[l("div",io,[l("h2",ao,v(e.$t("suno.name.cover")),1)]),l("div",lo,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),_("div",ro,[s(u,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(f,null,{default:$(()=>[s(p)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(f,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),l("div",uo,[l("h2",po,v(e.audio?.title),1),l("p",mo,v(e.audio?.style),1)])])):y("",!0)])])}const fo=A(so,[["render",ho],["__scopeId","data-v-06640216"]]),_o=C({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:It,StyleInput:Mt,TitleInput:Bt,ExtendFromInput:oo,CoverFromInput:fo,UploadAudio:ht,FontAwesomeIcon:q,ElButton:H,Consumption:Pe},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Ue(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$o={class:"flex flex-col h-full"},vo={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ko(e,t,i,o,r,d){const u=c("type-selector"),p=c("upload-audio"),f=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),h=c("extend-from-input"),b=c("cover-from-input"),P=c("consumption"),I=c("font-awesome-icon"),j=c("el-button");return a(),_("div",$o,[l("div",vo,[s(u,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?y("",!0):(a(),w(f,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(a(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(m,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(a(),w(h,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(a(),w(b,{key:5,class:"mb-4"})):y("",!0)]),l("div",go,[s(P,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(a(),w(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(I,{icon:"fa-solid fa-magic",class:"mr-2"}),T(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(I,{icon:"fa-solid fa-magic",class:"mr-2"}),T(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const yo=A(_o,[["render",ko],["__scopeId","data-v-b9fab929"]]);var B={exports:{}},wo=B.exports,ne;function bo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(wo,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,k){var h=new XMLHttpRequest;h.open("GET",n),h.responseType="blob",h.onload=function(){f(h.response,m,k)},h.onerror=function(){console.error("could not download file")},h.send()}function r(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function d(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,p=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),f=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var h=u.URL||u.webkitURL,b=document.createElement("a");m=m||n.name||"download",b.download=m,b.rel="noopener",typeof n=="string"?(b.href=n,b.origin===location.origin?d(b):r(b.href)?o(n,m,k):d(b,b.target="_blank")):(b.href=h.createObjectURL(n),setTimeout(function(){h.revokeObjectURL(b.href)},4e4),setTimeout(function(){d(b)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,k){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),m);else if(r(n))o(n,m,k);else{var h=document.createElement("a");h.href=n,h.target="_blank",setTimeout(function(){d(h)})}}:function(n,m,k,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,k);var b=n.type==="application/octet-stream",P=/constructor/i.test(u.HTMLElement)||u.safari,I=/CriOS\/[\d]+/.test(navigator.userAgent);if((I||b&&P||p)&&typeof FileReader<"u"){var j=new FileReader;j.onloadend=function(){var S=j.result;S=I?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=S:location=S,h=null},j.readAsDataURL(n)}else{var g=u.URL||u.webkitURL,F=g.createObjectURL(n);h?h.location=F:location.href=F,h=null,setTimeout(function(){g.revokeObjectURL(F)},4e4)}});u.saveAs=f.saveAs=f,e.exports=f})}(B)),B.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Lo=C({name:"TaskPreview",components:{ElImage:X,ElIcon:R,ElTooltip:Ge,ElButton:H,FontAwesomeIcon:q,VideoPlay:ee,VideoPause:x,ElDropdown:Re,ElDropdownMenu:Me,ElDropdownItem:ze},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=[];const t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(i=>{let o=i;t&&(o.action=t),e.push(o)}),e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{Co.saveAs(d,r)})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:So},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Y.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{E.error(r?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Ao={class:"task"},jo=["onClick"],Eo={class:"left"},Vo=["onClick"],Io=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Fo={class:"title"},Uo={class:"style"},zo={class:"right"},Mo={class:"el-dropdown-link"},Ro={class:"el-dropdown-link"};function Go(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=c("el-button"),k=c("font-awesome-icon"),h=c("el-tooltip"),b=c("el-dropdown-item"),P=c("el-dropdown-menu"),I=c("el-dropdown"),j=te("loading");return a(),_("div",Ao,[(a(!0),_(z,null,N(e.audios,(g,F)=>(a(),_("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),_("div",Eo,[s(u,{src:g?.image_url,class:"cover",fit:"cover"},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:S=>e.onPause(g)},[s(f,null,{default:$(()=>[s(p)]),_:1})],8,Vo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:S=>e.onPlay(g)},[s(f,null,{default:$(()=>[s(n)]),_:1})],8,Io)):y("",!0),g?.duration?(a(),_("div",To,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[j,!g?.audio_url]]),l("div",Po,[l("h2",Fo,v(g?.title),1),l("p",Uo,v(g?.style),1)]),l("div",zo,[g?.audio_url?(a(),w(m,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[T(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(h,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:$(()=>[g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:S=>e.onPreview(S,g?.video_url)},null,8,["onClick"])):y("",!0)]),_:2},1032,["content"]),s(I,null,{dropdown:$(()=>[s(P,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[T(v(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):y("",!0),g?.audio_url?(a(),w(b,{key:1,onClick:S=>e.onDownload(S,g?.audio_url)},{default:$(()=>[T(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Mo,[s(h,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(I,null,{dropdown:$(()=>[s(P,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[T(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[T(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(a(),w(b,{key:1,onClick:S=>e.onConcatMusic(g?.id)},{default:$(()=>[T(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Ro,[s(h,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,jo))),128))])}const Do=A(Lo,[["render",Go]]),Oo={class:"player-slider"},Wo=C({__name:"PlayerSlider",setup(e){const t=G(),i=V({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=V({get:()=>t.state.suno?.audio?.duration,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:u})}),r=()=>{},d=u=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:u});return(u,p)=>(a(),_("div",Oo,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}}),Bo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},qo=["src"],Ho={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ko={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=C({__name:"PlayerSong",setup(e){const t=G(),i=V({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return ae(i,(o,r)=>{if(o?.audio_url!==r?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if(o?.progress!==r?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else o?.state!==r?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==r?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>(a(),_("div",No,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||L(Bo)},null,8,qo),l("div",Ho,[l("div",Zo,[l("div",Ko,[l("span",null,v(i.value?.title||"Music"),1),l("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Qo={class:"flex justify-end items-center gap-x-2.5"},Yo={class:"text-xs"},xo=C({__name:"PlayerAction",setup(e){const t=G(),i=V({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=V({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),_("div",Qo,[l("span",Yo,v(L(M)(i.value))+" / "+v(L(M)(o.value)),1)]))}});var es={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function ts(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function os(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],r=[],d=t.theme||i.theme;switch(d){case"outline":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none");break;case"filled":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("#FFF"),r.push("#FFF");break;case"two-tone":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),r.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),r.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:r,id:e}}var ss=Symbol("icon-context");function J(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(d){var u=ts(),p=Ce(ss,es);return function(){var f=d.size,n=d.strokeWidth,m=d.strokeLinecap,k=d.strokeLinejoin,h=d.theme,b=d.fill,P=d.spin,I=os(u,{size:f,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:h,fill:b},p),j=[p.prefix+"-icon"];return j.push(p.prefix+"-icon-"+e),t&&p.rtl&&j.push(p.prefix+"-icon-rtl"),P&&j.push(p.prefix+"-icon-spin"),s("span",{class:j.join(" ")},[i(I)])}}};return o}const ns=J("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),is=J("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),as=J("volume-mute",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("rect",{opacity:"0.01",x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null),s("mask",{id:e.id+"603476ab",maskUnits:"userSpaceOnUse",x:"30",y:"18",width:"13",height:"13",style:{maskType:"alpha"}},[s("rect",{x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null)]),s("g",{mask:"url(#"+e.id+"603476ab)"},[s("path",{d:"M40.7348 20.2858L32.2495 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32.2496 20.2858L40.7349 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)]),s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ue=J("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Q=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(a(),w(le(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),ls={class:"player-volume flex flex-col items-center pt-2"},rs={class:"text-sm mt-3"},cs={class:"mt-2"},us=C({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=V({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=V({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),r=()=>t.dispatch("suno/toggleMuted"),d=u=>t.dispatch("suno/setVolume",u);return(u,p)=>(a(),_("div",ls,[l("div",null,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",rs,v(i.value),1),l("div",cs,[s(Q,{icon:o.value?L(as):L(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=C({__name:"PlayerController",setup(e){const t=G(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=V(()=>t.state.suno.audio);return(r,d)=>(a(),_("div",ds,[s(Q,{icon:o.value?.state==="playing"?L(ns):L(is),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(L(De),{placement:"top",width:"50px"},{reference:$(()=>[s(Q,{icon:L(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},hs={class:"flex grow px-5 items-center"},fs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=C({__name:"Player",setup(e){return(t,i)=>(a(),_("div",ms,[s(Wo),l("div",hs,[l("div",fs,[s(Jo)]),l("div",_s,[s(ps)]),l("div",$s,[s(xo)])])]))}}),gs=C({name:"RecentPanel",components:{TaskPreview:Do,ElSkeleton:We,ElSkeletonItem:Oe,Player:vs,NoTasks:Fe},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),ks={key:0,class:"tasks"},ys={class:"left"},ws={class:"main"},bs={key:1,class:"tasks"},Cs={key:2,class:"w-full h-full flex items-center justify-center"},Ss={class:"flex-1 flex flex-col"},Ls={class:"h-20"};function As(e,t,i,o,r,d){const u=c("el-skeleton-item"),p=c("el-skeleton"),f=c("task-preview"),n=c("no-tasks"),m=c("player");return a(),_(z,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...k)=>e.onHandleScroll&&e.onHandleScroll(...k))},[e.tasks?.items===void 0?(a(),_("div",ks,[(a(),_(z,null,N(3,k=>l("div",{key:k,class:"task placeholder"},[l("div",ys,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",ws,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"p",class:"title"}),s(u,{variant:"text",style:{"margin-right":"16px"}}),s(u,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),_("div",bs,[(a(!0),_(z,null,N(e.tasks?.items,(k,h)=>(a(),w(f,{key:h,"model-value":k,class:"preview"},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),_("div",Cs,[s(n)])):y("",!0)],544),Z(l("div",Ss,[l("div",Ls,[s(m)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const js=A(gs,[["render",As],["__scopeId","data-v-959f8920"]]),Es=C({name:"TaskPreview",components:{ElScrollbar:Be,IconPicture:Le,ElImage:X,ElAvatar:Xe,ElIcon:R},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Vs={key:0,class:"card"},Is={class:"image-container"},Ts={class:"image-slot"},Ps={class:"title"},Fs={class:"content"},Us={class:"artist"},zs={class:"style"},Ms={class:"time"},Rs={class:"lyrics"},Gs={key:1,class:"gradient-background"};function Ds(e,t,i,o,r,d){const u=c("icon-picture"),p=c("el-icon"),f=c("el-image"),n=c("el-avatar"),m=c("el-scrollbar");return a(),w(m,{class:"right-panel"},{default:$(()=>[e.audio?.object?(a(),_("div",Vs,[l("div",Is,[s(f,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",Ts,[s(p,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Ps,v(e.audio?.title),1)]),l("div",Fs,[l("div",Us,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",zs,v(e.audio?.style),1),l("p",Ms,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",Rs,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),_("div",Gs))]),_:1})}const Os=A(Es,[["render",Ds],["__scopeId","data-v-9b29e9f9"]]),Ws="https://webhook.acedata.cloud/suno",Bs=C({name:"SunoIndex",components:{Layout:ot,ConfigPanel:yo,RecentPanel:js,PreviewPanel:Os},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===W.Request},needApply(){return this.$store.state.suno.status.getApplications===W.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===je&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ws},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Y.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ns(e,t,i,o,r,d){const u=c("config-panel"),p=c("recent-panel"),f=c("preview-panel"),n=c("layout");return a(),w(n,null,{config:$(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(f)]),_:1})}const An=A(Bs,[["render",Ns],["__scopeId","data-v-f5721d95"]]);export{An as default};
|
|
1
|
+
import{F as q}from"./index.es-C1YdrRxd.js";import{E as H}from"./index-_Y1ITuV6.js";import{E as de}from"./index-B-5Rco42.js";import{aj as pe,ap as me,bI as he,ak as ie,c9 as fe,_ as _e,d as C,a as $e,al as ve,c as V,bh as ge,bn as ke,aw as ae,b as _,o as a,i as w,r as U,f as oe,e as L,j as $,b8 as le,E as R,n as ye,g as we,h as A,t as l,k as s,l as c,eL as se,x as v,F as z,v as N,eM as Y,c6 as be,D as T,eN as x,eO as ee,y,J as Z,cN as te,eP as O,dm as W,eQ as G,an as Ce,K as Se,eR as Le,de as Ae,dl as je}from"./index-B-c97tkm.js";import{E as re}from"./index-BX_rgBZU.js";import{E as Ee,a as Ve}from"./index-CNmM91HR.js";import{I as D}from"./InfoIcon-CKWH7Unh.js";import{E as Ie}from"./index-DfwyVFPw.js";import{E}from"./index-CNQpLirn.js";import{E as K}from"./index-_dtyuPXT.js";import{E as Te,a as ce}from"./index-B1v80OQR.js";import{E as X}from"./index-Dh5CqsTj.js";import{C as Pe,N as Fe}from"./NoTasks-n2Y3Xi8d.js";import{a as Ue}from"./price-8cN6TCDJ.js";import{E as ze,a as Me,b as Re}from"./index-D5tJfJHE.js";import{E as Ge}from"./index-suS-ff0R.js";import{E as De}from"./index-3x2q0pd-.js";import{a as Oe,E as We}from"./index-CzUGFL3v.js";import{E as Be}from"./index-q2QI50Dk.js";import"./use-form-item-FIYBugq7.js";import"./index-r5W6hzzQ.js";import"./index-Bpt-o1po.js";import"./strings-B-LPfC97.js";import"./castArray-OJKbUui1.js";import"./isEqual-DPjHHy6z.js";import"./_Uint8Array-BG2yH9Xs.js";import"./typescript-eNy_A1X5.js";import"./debounce-Dp-VJZWt.js";import"./_baseIteratee-CZXPuPK6.js";import"./index-BMjVMxw5.js";import"./index-BnwCLUZ1.js";import"./_baseClone-CIVWVsK_.js";import"./_initCloneObject-OgD-mn93.js";import"./index-CyvEZaMN.js";import"./dropdown-CWB38Hp0.js";const Ne=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ie(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:he},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),qe={error:e=>e instanceof Event},He=C({name:"ElAvatar"}),Ze=C({...He,props:Ne,emits:qe,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=V(()=>{const{size:n,icon:m,shape:k}=i,h=[o.b()];return ge(n)&&h.push(o.m(n)),m&&h.push(o.m("icon")),k&&h.push(o.m(k)),h}),u=V(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=V(()=>({objectFit:i.fit}));ae(()=>i.src,()=>r.value=!1);function f(n){r.value=!0,t("error",n)}return(n,m)=>(a(),_("span",{class:ye(L(d)),style:oe(L(u))},[(n.src||n.srcSet)&&!r.value?(a(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(L(p)),onError:f},null,44,["src","alt","srcset"])):n.icon?(a(),w(L(R),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ke=_e(Ze,[["__file","avatar.vue"]]);const Xe=we(Ke),Je=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:H,FontAwesomeIcon:q},data(){return{drawer:!1,preview:!1}},computed:{}}),Qe={class:"main"},Ye={class:"config"},xe={class:"result"},et={class:"preview"};function tt(e,t,i,o,r,d){const u=c("font-awesome-icon"),p=c("el-button"),f=c("el-drawer");return a(),_("div",Qe,[l("div",Ye,[U(e.$slots,"config",{},void 0,!0)]),l("div",xe,[U(e.$slots,"result",{},void 0,!0)]),l("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-magic"})]),_:1}),s(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ot=A(Je,[["render",tt],["__scopeId","data-v-ab3c4b78"]]),st=C({name:"VersionSelector",components:{ElSelect:Ve,ElOption:Ee,ElSwitch:re},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),nt={class:"field"},it={class:"title font-bold"};function at(e,t,i,o,r,d){const u=c("el-switch"),p=c("el-option"),f=c("el-select");return a(),_("div",nt,[l("h2",it,v(e.$t("suno.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(f,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(a(!0),_(z,null,N(e.options,n=>(a(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=A(st,[["render",at],["__scopeId","data-v-5a66a01f"]]),rt=C({name:"UploadAudio",components:{ElUpload:Ie,ElButton:H,InfoIcon:D,FontAwesomeIcon:q},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),Y.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const r=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:r,action:"upload_extend"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ct={class:"relative"},ut={class:"flex justify-between"},dt={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function mt(e,t,i,o,r,d){const u=c("info-icon"),p=c("font-awesome-icon"),f=c("el-button"),n=c("el-upload");return a(),_("div",ct,[l("div",ut,[l("div",dt,[l("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(u,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:$(()=>[s(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),T(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ht=A(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ft="",_t=C({name:"PromptInput",components:{ElInput:K,ElSwitch:re,InfoIcon:D},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},kt={class:"title font-bold"},yt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-switch"),f=c("el-input");return a(),_("div",$t,[l("div",vt,[l("div",gt,[l("h2",kt,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",yt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(f,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ct=A(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",Lt=C({name:"LyricInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=St)}}),At={class:"field"},jt={class:"box"},Et={class:"title font-bold"};function Vt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",At,[l("div",jt,[l("h2",Et,v(e.$t("suno.name.lyrics")),1),s(u,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(a(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(a(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const It=A(Lt,[["render",Vt],["__scopeId","data-v-99dfded8"]]),Tt=C({name:"StyleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Pt={class:"field"},Ft={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Pt,[l("div",Ft,[l("h2",Ut,v(e.$t("suno.name.style")),1),s(u,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=f=>e.style=f),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Mt=A(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Rt=C({name:"TitleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Dt={class:"title-container"},Ot={class:"title font-bold"};function Wt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Gt,[l("div",Dt,[l("h2",Ot,v(e.$t("suno.name.title")),1),s(u,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=f=>e.title=f),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Bt=A(Rt,[["render",Wt],["__scopeId","data-v-ce70fe34"]]);function M(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,r=t<10?`0${t}`:t;return o+":"+r}const Nt=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:R,ElInputNumber:Te,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),qt={class:"field"},Ht={class:"box"},Zt={class:"title font-bold"},Kt={class:"input-wrapper"},Xt={class:"task"},Jt={class:"left"},Qt={key:2,class:"duration"},Yt={class:"info"},xt={class:"title"},eo={class:"style"};function to(e,t,i,o,r,d){const u=c("el-input-number"),p=c("el-image"),f=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=te("loading");return a(),_("div",qt,[l("div",Ht,[l("h2",Zt,v(e.$t("suno.name.extend")),1),l("div",Kt,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=h=>e.value=h),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),l("div",Xt,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=h=>e.onClick(e.audio))},[Z((a(),_("div",Jt,[s(p,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=h=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(f)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=h=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",Qt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Yt,[l("h2",xt,v(e.audio?.title),1),l("p",eo,v(e.audio?.style),1)])])):y("",!0)])])}const oo=A(Nt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:R,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),no={class:"field"},io={class:"box"},ao={class:"title font-bold"},lo={class:"task"},ro={class:"left"},co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"};function ho(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=te("loading");return a(),_("div",no,[l("div",io,[l("h2",ao,v(e.$t("suno.name.cover")),1)]),l("div",lo,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),_("div",ro,[s(u,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(f,null,{default:$(()=>[s(p)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(f,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),l("div",uo,[l("h2",po,v(e.audio?.title),1),l("p",mo,v(e.audio?.style),1)])])):y("",!0)])])}const fo=A(so,[["render",ho],["__scopeId","data-v-06640216"]]),_o=C({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:It,StyleInput:Mt,TitleInput:Bt,ExtendFromInput:oo,CoverFromInput:fo,UploadAudio:ht,FontAwesomeIcon:q,ElButton:H,Consumption:Pe},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Ue(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$o={class:"flex flex-col h-full"},vo={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ko(e,t,i,o,r,d){const u=c("type-selector"),p=c("upload-audio"),f=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),h=c("extend-from-input"),b=c("cover-from-input"),P=c("consumption"),I=c("font-awesome-icon"),j=c("el-button");return a(),_("div",$o,[l("div",vo,[s(u,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?y("",!0):(a(),w(f,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(a(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(m,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(a(),w(h,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(a(),w(b,{key:5,class:"mb-4"})):y("",!0)]),l("div",go,[s(P,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(a(),w(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(I,{icon:"fa-solid fa-magic",class:"mr-2"}),T(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(I,{icon:"fa-solid fa-magic",class:"mr-2"}),T(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const yo=A(_o,[["render",ko],["__scopeId","data-v-b9fab929"]]);var B={exports:{}},wo=B.exports,ne;function bo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(wo,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,k){var h=new XMLHttpRequest;h.open("GET",n),h.responseType="blob",h.onload=function(){f(h.response,m,k)},h.onerror=function(){console.error("could not download file")},h.send()}function r(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function d(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,p=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),f=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var h=u.URL||u.webkitURL,b=document.createElement("a");m=m||n.name||"download",b.download=m,b.rel="noopener",typeof n=="string"?(b.href=n,b.origin===location.origin?d(b):r(b.href)?o(n,m,k):d(b,b.target="_blank")):(b.href=h.createObjectURL(n),setTimeout(function(){h.revokeObjectURL(b.href)},4e4),setTimeout(function(){d(b)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,k){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),m);else if(r(n))o(n,m,k);else{var h=document.createElement("a");h.href=n,h.target="_blank",setTimeout(function(){d(h)})}}:function(n,m,k,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,k);var b=n.type==="application/octet-stream",P=/constructor/i.test(u.HTMLElement)||u.safari,I=/CriOS\/[\d]+/.test(navigator.userAgent);if((I||b&&P||p)&&typeof FileReader<"u"){var j=new FileReader;j.onloadend=function(){var S=j.result;S=I?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=S:location=S,h=null},j.readAsDataURL(n)}else{var g=u.URL||u.webkitURL,F=g.createObjectURL(n);h?h.location=F:location.href=F,h=null,setTimeout(function(){g.revokeObjectURL(F)},4e4)}});u.saveAs=f.saveAs=f,e.exports=f})}(B)),B.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Lo=C({name:"TaskPreview",components:{ElImage:X,ElIcon:R,ElTooltip:Ge,ElButton:H,FontAwesomeIcon:q,VideoPlay:ee,VideoPause:x,ElDropdown:Re,ElDropdownMenu:Me,ElDropdownItem:ze},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=[];const t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(i=>{let o=i;t&&(o.action=t),e.push(o)}),e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{Co.saveAs(d,r)})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:So},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Y.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{E.error(r?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Ao={class:"task"},jo=["onClick"],Eo={class:"left"},Vo=["onClick"],Io=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Fo={class:"title"},Uo={class:"style"},zo={class:"right"},Mo={class:"el-dropdown-link"},Ro={class:"el-dropdown-link"};function Go(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=c("el-button"),k=c("font-awesome-icon"),h=c("el-tooltip"),b=c("el-dropdown-item"),P=c("el-dropdown-menu"),I=c("el-dropdown"),j=te("loading");return a(),_("div",Ao,[(a(!0),_(z,null,N(e.audios,(g,F)=>(a(),_("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),_("div",Eo,[s(u,{src:g?.image_url,class:"cover",fit:"cover"},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:S=>e.onPause(g)},[s(f,null,{default:$(()=>[s(p)]),_:1})],8,Vo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:S=>e.onPlay(g)},[s(f,null,{default:$(()=>[s(n)]),_:1})],8,Io)):y("",!0),g?.duration?(a(),_("div",To,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[j,!g?.audio_url]]),l("div",Po,[l("h2",Fo,v(g?.title),1),l("p",Uo,v(g?.style),1)]),l("div",zo,[g?.audio_url?(a(),w(m,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[T(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(h,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:$(()=>[g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:S=>e.onPreview(S,g?.video_url)},null,8,["onClick"])):y("",!0)]),_:2},1032,["content"]),s(I,null,{dropdown:$(()=>[s(P,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[T(v(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):y("",!0),g?.audio_url?(a(),w(b,{key:1,onClick:S=>e.onDownload(S,g?.audio_url)},{default:$(()=>[T(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Mo,[s(h,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(I,null,{dropdown:$(()=>[s(P,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[T(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[T(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(a(),w(b,{key:1,onClick:S=>e.onConcatMusic(g?.id)},{default:$(()=>[T(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Ro,[s(h,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,jo))),128))])}const Do=A(Lo,[["render",Go]]),Oo={class:"player-slider"},Wo=C({__name:"PlayerSlider",setup(e){const t=G(),i=V({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=V({get:()=>t.state.suno?.audio?.duration,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:u})}),r=()=>{},d=u=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:u});return(u,p)=>(a(),_("div",Oo,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}}),Bo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},qo=["src"],Ho={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ko={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=C({__name:"PlayerSong",setup(e){const t=G(),i=V({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return ae(i,(o,r)=>{if(o?.audio_url!==r?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if(o?.progress!==r?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else o?.state!==r?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==r?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>(a(),_("div",No,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||L(Bo)},null,8,qo),l("div",Ho,[l("div",Zo,[l("div",Ko,[l("span",null,v(i.value?.title||"Music"),1),l("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Qo={class:"flex justify-end items-center gap-x-2.5"},Yo={class:"text-xs"},xo=C({__name:"PlayerAction",setup(e){const t=G(),i=V({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=V({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),_("div",Qo,[l("span",Yo,v(L(M)(i.value))+" / "+v(L(M)(o.value)),1)]))}});var es={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function ts(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function os(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],r=[],d=t.theme||i.theme;switch(d){case"outline":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none");break;case"filled":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("#FFF"),r.push("#FFF");break;case"two-tone":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),r.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),r.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:r,id:e}}var ss=Symbol("icon-context");function J(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(d){var u=ts(),p=Ce(ss,es);return function(){var f=d.size,n=d.strokeWidth,m=d.strokeLinecap,k=d.strokeLinejoin,h=d.theme,b=d.fill,P=d.spin,I=os(u,{size:f,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:h,fill:b},p),j=[p.prefix+"-icon"];return j.push(p.prefix+"-icon-"+e),t&&p.rtl&&j.push(p.prefix+"-icon-rtl"),P&&j.push(p.prefix+"-icon-spin"),s("span",{class:j.join(" ")},[i(I)])}}};return o}const ns=J("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),is=J("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),as=J("volume-mute",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("rect",{opacity:"0.01",x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null),s("mask",{id:e.id+"603476ab",maskUnits:"userSpaceOnUse",x:"30",y:"18",width:"13",height:"13",style:{maskType:"alpha"}},[s("rect",{x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null)]),s("g",{mask:"url(#"+e.id+"603476ab)"},[s("path",{d:"M40.7348 20.2858L32.2495 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32.2496 20.2858L40.7349 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)]),s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ue=J("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Q=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(a(),w(le(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),ls={class:"player-volume flex flex-col items-center pt-2"},rs={class:"text-sm mt-3"},cs={class:"mt-2"},us=C({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=V({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=V({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),r=()=>t.dispatch("suno/toggleMuted"),d=u=>t.dispatch("suno/setVolume",u);return(u,p)=>(a(),_("div",ls,[l("div",null,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",rs,v(i.value),1),l("div",cs,[s(Q,{icon:o.value?L(as):L(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=C({__name:"PlayerController",setup(e){const t=G(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=V(()=>t.state.suno.audio);return(r,d)=>(a(),_("div",ds,[s(Q,{icon:o.value?.state==="playing"?L(ns):L(is),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(L(De),{placement:"top",width:"50px"},{reference:$(()=>[s(Q,{icon:L(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},hs={class:"flex grow px-5 items-center"},fs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=C({__name:"Player",setup(e){return(t,i)=>(a(),_("div",ms,[s(Wo),l("div",hs,[l("div",fs,[s(Jo)]),l("div",_s,[s(ps)]),l("div",$s,[s(xo)])])]))}}),gs=C({name:"RecentPanel",components:{TaskPreview:Do,ElSkeleton:We,ElSkeletonItem:Oe,Player:vs,NoTasks:Fe},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),ks={key:0,class:"tasks"},ys={class:"left"},ws={class:"main"},bs={key:1,class:"tasks"},Cs={key:2,class:"w-full h-full flex items-center justify-center"},Ss={class:"flex-1 flex flex-col"},Ls={class:"h-20"};function As(e,t,i,o,r,d){const u=c("el-skeleton-item"),p=c("el-skeleton"),f=c("task-preview"),n=c("no-tasks"),m=c("player");return a(),_(z,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...k)=>e.onHandleScroll&&e.onHandleScroll(...k))},[e.tasks?.items===void 0?(a(),_("div",ks,[(a(),_(z,null,N(3,k=>l("div",{key:k,class:"task placeholder"},[l("div",ys,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",ws,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"p",class:"title"}),s(u,{variant:"text",style:{"margin-right":"16px"}}),s(u,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),_("div",bs,[(a(!0),_(z,null,N(e.tasks?.items,(k,h)=>(a(),w(f,{key:h,"model-value":k,class:"preview"},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),_("div",Cs,[s(n)])):y("",!0)],544),Z(l("div",Ss,[l("div",Ls,[s(m)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const js=A(gs,[["render",As],["__scopeId","data-v-959f8920"]]),Es=C({name:"TaskPreview",components:{ElScrollbar:Be,IconPicture:Le,ElImage:X,ElAvatar:Xe,ElIcon:R},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Vs={key:0,class:"card"},Is={class:"image-container"},Ts={class:"image-slot"},Ps={class:"title"},Fs={class:"content"},Us={class:"artist"},zs={class:"style"},Ms={class:"time"},Rs={class:"lyrics"},Gs={key:1,class:"gradient-background"};function Ds(e,t,i,o,r,d){const u=c("icon-picture"),p=c("el-icon"),f=c("el-image"),n=c("el-avatar"),m=c("el-scrollbar");return a(),w(m,{class:"right-panel"},{default:$(()=>[e.audio?.object?(a(),_("div",Vs,[l("div",Is,[s(f,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",Ts,[s(p,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Ps,v(e.audio?.title),1)]),l("div",Fs,[l("div",Us,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",zs,v(e.audio?.style),1),l("p",Ms,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",Rs,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),_("div",Gs))]),_:1})}const Os=A(Es,[["render",Ds],["__scopeId","data-v-9b29e9f9"]]),Ws="https://webhook.acedata.cloud/suno",Bs=C({name:"SunoIndex",components:{Layout:ot,ConfigPanel:yo,RecentPanel:js,PreviewPanel:Os},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===W.Request},needApply(){return this.$store.state.suno.status.getApplications===W.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===je&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ws},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Y.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ns(e,t,i,o,r,d){const u=c("config-panel"),p=c("recent-panel"),f=c("preview-panel"),n=c("layout");return a(),w(n,null,{config:$(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(f)]),_:1})}const An=A(Bs,[["render",Ns],["__scopeId","data-v-f5721d95"]]);export{An as default};
|