@acedatacloud/nexior 3.10.4 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{Auth-fCGySikp.js → Auth-yB0CeE45.js} +1 -1
- package/dist/assets/{BotPlaceholder-BC0knnbs.js → BotPlaceholder-UYTmTQfX.js} +1 -1
- package/dist/assets/{Callback-BGbyGLvp.js → Callback-BtSDibG6.js} +1 -1
- package/dist/assets/{Console-fBL4i8uf.js → Console-C9ZaBgGb.js} +1 -1
- package/dist/assets/{Conversation-DmICjOOx.js → Conversation-C2Bxv62z.js} +2 -2
- package/dist/assets/{CopyToClipboard-CdHjrONV.js → CopyToClipboard-CVDOXZ-a.js} +1 -1
- package/dist/assets/{Detail-cInuu5bC.js → Detail-SSvP24MP.js} +1 -1
- package/dist/assets/{EditArray-DC_vlLzS.js → EditArray-BoexcGfM.js} +1 -1
- package/dist/assets/{Extra-SeOUcjb8.js → Extra-OoDxCqCt.js} +1 -1
- package/dist/assets/{FilePreview-B9JRPnA_.js → FilePreview-Dlnwdpd4.js} +1 -1
- package/dist/assets/{History-CsFMSTaL.js → History-SNU6XfwJ.js} +1 -1
- package/dist/assets/{ImagePreview-Bq6TmnB_.js → ImagePreview-KNv7fJqR.js} +1 -1
- package/dist/assets/{ImageWrapper-BOvl3-ww.js → ImageWrapper-C_vFtEZX.js} +1 -1
- package/dist/assets/Index-B4wVJnzn.css +1 -0
- package/dist/assets/{Index-ec-kjqE5.js → Index-B7mf0uql.js} +1 -1
- package/dist/assets/{Index-BLvNZPBX.js → Index-BDfHKHFK.js} +1 -1
- package/dist/assets/{Index-DBBmJy7I.js → Index-Bglj4mEd.js} +1 -1
- package/dist/assets/{Index-eklOiB1M.js → Index-BwPijVkk.js} +1 -1
- package/dist/assets/Index-C3wChpL_.js +1 -0
- package/dist/assets/{Index-DIGc7JfA.js → Index-CC4G3jtU.js} +1 -1
- package/dist/assets/{Index-CabE0hlE.js → Index-CbJhphXQ.js} +1 -1
- package/dist/assets/{Index-Cucgh0cQ.js → Index-CfzeJAfW.js} +1 -1
- package/dist/assets/{Index-Ce39jMAv.js → Index-Cpudt58V.js} +1 -1
- package/dist/assets/{Index-D2DRx_80.js → Index-D9QA5j35.js} +1 -1
- package/dist/assets/{Index-DctQEcJj.js → Index-DvUTtwhr.js} +1 -1
- package/dist/assets/{Index-CvsP3Vba.js → Index-QWMJwQdg.js} +1 -1
- package/dist/assets/{Index-D0FVvbog.js → Index-Tx4dngrL.js} +1 -1
- package/dist/assets/{InfoIcon-9Wan39hE.js → InfoIcon-CijoMMMz.js} +1 -1
- package/dist/assets/{Invitees-Cvq-SEAb.js → Invitees-BJRwEWVb.js} +1 -1
- package/dist/assets/{List-D9TqBpdA.js → List-CdyalDB0.js} +1 -1
- package/dist/assets/{List-CIhFeK3Q.js → List-ChZSO58k.js} +1 -1
- package/dist/assets/{List-CwuM7-Uu.js → List-Ivm0DPbF.js} +1 -1
- package/dist/assets/{Login-D-Um3iIv.js → Login-BhN-WMGi.js} +1 -1
- package/dist/assets/{Main-JdlREU9F.js → Main-CMPcVepk.js} +1 -1
- package/dist/assets/{Navigator-C6jSlmBW.css → Navigator--ejw7E_g.css} +1 -1
- package/dist/assets/Navigator-B01Aq9Hg.js +1 -0
- package/dist/assets/{NoTasks-DN70KO5R.js → NoTasks-CocWVrlG.js} +1 -1
- package/dist/assets/{Pagination-Bk4PwhOS.js → Pagination-Ots2yYuN.js} +1 -1
- package/dist/assets/{Status-PiW0hxrr.js → Status-BQn5-WVc.js} +1 -1
- package/dist/assets/{Subscribe-_k2xoqJV.js → Subscribe-iEJxZHxT.js} +1 -1
- package/dist/assets/{VideoPlayer-BoUYJJAY.js → VideoPlayer-C0MqtCQO.js} +1 -1
- package/dist/assets/_Uint8Array-CFF3tqTI.js +1 -0
- package/dist/assets/{_baseClone-Lvb_uHUX.js → _baseClone-DxikSyNf.js} +1 -1
- package/dist/assets/_baseIteratee-DkeT1DK7.js +1 -0
- package/dist/assets/{_initCloneObject-By_nB0aA.js → _initCloneObject-15wE_65Y.js} +1 -1
- package/dist/assets/{castArray-pyQty71k.js → castArray-DF9exNaC.js} +1 -1
- package/dist/assets/common-1iQSWUd1.js +1 -0
- package/dist/assets/common-Be4H6jdV.js +1 -0
- package/dist/assets/common-BghFkLWM.js +1 -0
- package/dist/assets/common-BrFby4Ky.js +1 -0
- package/dist/assets/common-Bvick_UR.js +1 -0
- package/dist/assets/common-C2rm-k66.js +1 -0
- package/dist/assets/common-C_J4y2JE.js +1 -0
- package/dist/assets/common-CkuUcrO9.js +1 -0
- package/dist/assets/common-D-6r_-m9.js +1 -0
- package/dist/assets/common-DG3cTgFD.js +1 -0
- package/dist/assets/common-DRBnXSRp.js +1 -0
- package/dist/assets/common-Dilv4fxi.js +1 -0
- package/dist/assets/common-DvIXsScc.js +1 -0
- package/dist/assets/common-DyFFpr0B.js +1 -0
- package/dist/assets/common-HS8SvCoT.js +1 -0
- package/dist/assets/{common-BmnICXcK.js → common-NwnpPmOh.js} +1 -1
- package/dist/assets/common-OL48uI-0.js +1 -0
- package/dist/assets/common-pw6hDCQ6.js +1 -0
- package/dist/assets/debounce-DIgj7DCo.js +1 -0
- package/dist/assets/{distribution-DvkLxkfU.js → distribution-CLzzUrpW.js} +1 -1
- package/dist/assets/dropdown-CxWjiH2O.js +1 -0
- package/dist/assets/{index-DatrTq9p.js → index-5RZmISot.js} +1 -1
- package/dist/assets/index-BPSPAB35.js +1 -0
- package/dist/assets/{index-kKC0Ivrh.js → index-BTeCKWcI.js} +1 -1
- package/dist/assets/{index-M0OikGrA.js → index-Bc05C7Iq.js} +1 -1
- package/dist/assets/{index-gPxTnhlP.js → index-BiFV7IEN.js} +1 -1
- package/dist/assets/{index-BmefQh1G.js → index-BmqnE4_p.js} +1 -1
- package/dist/assets/{index-Bs5qMSYG.js → index-Bq_Fgsk6.js} +1 -1
- package/dist/assets/index-BrdKF5yA.js +1 -0
- package/dist/assets/{index-CT9MQhzA.js → index-BtkTmjB7.js} +2 -2
- package/dist/assets/index-C0t9rMvj.js +1 -0
- package/dist/assets/{index-BTFJb86a.js → index-C7Wx0X9v.js} +1 -1
- package/dist/assets/{index-Bj6DujvH.js → index-CCbHa9JO.js} +1 -1
- package/dist/assets/index-CGMy-mxm.js +1 -0
- package/dist/assets/{index-DFneqctn.js → index-Cb8UQUPX.js} +2 -2
- package/dist/assets/{index-B13u5BWJ.js → index-CwfVnyAs.js} +2 -2
- package/dist/assets/{index-BbIXTRxd.js → index-D2tyb6wy.js} +1 -1
- package/dist/assets/index-DKr_xH2f.js +1 -0
- package/dist/assets/index-DM-McChS.js +638 -0
- package/dist/assets/{index-UcV0p3Hx.js → index-DdY8PKQv.js} +1 -1
- package/dist/assets/{index-apGSFDpN.js → index-Dl_ff5ni.js} +1 -1
- package/dist/assets/{index-CFlyKjX7.js → index-DocBE9iv.js} +1 -1
- package/dist/assets/index-Dy-wDVPV.js +1 -0
- package/dist/assets/index-Hc-BbYQ6.js +1 -0
- package/dist/assets/{index-_HE2vSD7.js → index-JW39oOEU.js} +1 -1
- package/dist/assets/{index-BQTBPAa8.js → index-T_Hh32Hb.js} +1 -1
- package/dist/assets/{index-DTy3KHpU.js → index-UCEZcelc.js} +1 -1
- package/dist/assets/{index-T8sKVr0g.js → index-UrRqTynA.js} +1 -1
- package/dist/assets/{index-C2MdqaEN.js → index-cm1Ch8j7.js} +1 -1
- package/dist/assets/{index-Dv2Wumb_.js → index-tl1Kf-hL.js} +1 -1
- package/dist/assets/{index.es-ybdv8tNh.js → index.es-CmAoTyVL.js} +1 -1
- package/dist/assets/{isEqual-BVGhOXu9.js → isEqual-BerUtaWm.js} +1 -1
- package/dist/assets/{isPlainObject-DgkzW7S8.js → isPlainObject-BY0szB_N.js} +1 -1
- package/dist/assets/{order-C0QtiKvd.js → order-DGTaix-M.js} +1 -1
- package/dist/assets/pixverse-B3cYOTI7.js +1 -0
- package/dist/assets/pixverse-BHazkwmb.js +1 -0
- package/dist/assets/pixverse-BHrgrssK.js +1 -0
- package/dist/assets/pixverse-BUsFUNYe.js +1 -0
- package/dist/assets/pixverse-BVUmE2Nz.js +1 -0
- package/dist/assets/pixverse-BX5LFx92.js +1 -0
- package/dist/assets/pixverse-BklbmbzE.js +1 -0
- package/dist/assets/pixverse-Bla6EPVw.js +1 -0
- package/dist/assets/pixverse-BvOLrP6a.js +1 -0
- package/dist/assets/pixverse-C1faQ-22.js +1 -0
- package/dist/assets/pixverse-C7GS_3y9.js +1 -0
- package/dist/assets/pixverse-CBzURIc5.js +1 -0
- package/dist/assets/pixverse-CEDjTFh1.js +1 -0
- package/dist/assets/pixverse-CRJTE3NA.js +1 -0
- package/dist/assets/pixverse-D_oI8Wqy.js +1 -0
- package/dist/assets/pixverse-U_eVFZLQ.js +1 -0
- package/dist/assets/pixverse-h4_s6pBy.js +1 -0
- package/dist/assets/pixverse-nwssKDpx.js +1 -0
- package/dist/assets/{price-8qoTPL6E.js → price-DrK20qlf.js} +1 -1
- package/dist/assets/site-BKEpp32T.js +1 -0
- package/dist/assets/site-Be_-UII9.js +1 -0
- package/dist/assets/site-BhvK4gec.js +1 -0
- package/dist/assets/site-BlMs9Zhy.js +1 -0
- package/dist/assets/site-Bx0QYEf2.js +1 -0
- package/dist/assets/site-C1NAEwMM.js +1 -0
- package/dist/assets/site-CQ4690VO.js +1 -0
- package/dist/assets/site-C_QQG80S.js +1 -0
- package/dist/assets/site-CozAKuXr.js +1 -0
- package/dist/assets/site-CsjaqKqY.js +1 -0
- package/dist/assets/site-CvoS6ApR.js +1 -0
- package/dist/assets/site-D551UBmE.js +1 -0
- package/dist/assets/site-DKA0eaC7.js +1 -0
- package/dist/assets/site-D_5Q7HUd.js +1 -0
- package/dist/assets/site-Dm90PXZn.js +1 -0
- package/dist/assets/site-God48tBE.js +1 -0
- package/dist/assets/site-QlkZcHVJ.js +1 -0
- package/dist/assets/site-r82zeRnp.js +1 -0
- package/dist/assets/{strings-C9YRIwNe.js → strings-RzDk29K3.js} +1 -1
- package/dist/assets/{typescript-BDQrJx_d.js → typescript-LPT8zmb-.js} +1 -1
- package/dist/assets/use-form-item-ckkxdj9G.js +1 -0
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/Navigator-BUTtk3Bz.js +0 -1
- package/dist/assets/_Uint8Array-fEFMYpOd.js +0 -1
- package/dist/assets/_baseIteratee-HPhqSc1g.js +0 -1
- package/dist/assets/common-BAi-7ftK.js +0 -1
- package/dist/assets/common-BGY9t90P.js +0 -1
- package/dist/assets/common-BJFo0mZw.js +0 -1
- package/dist/assets/common-Bcq_MIlS.js +0 -1
- package/dist/assets/common-BybKAVeo.js +0 -1
- package/dist/assets/common-CYWD5JzP.js +0 -1
- package/dist/assets/common-Cfr7QgCY.js +0 -1
- package/dist/assets/common-D-jj8uKZ.js +0 -1
- package/dist/assets/common-D6TbLY99.js +0 -1
- package/dist/assets/common-D6g-en5p.js +0 -1
- package/dist/assets/common-D7NDbKHR.js +0 -1
- package/dist/assets/common-DBl6xTme.js +0 -1
- package/dist/assets/common-DN2fCvLM.js +0 -1
- package/dist/assets/common-DWWHkG3m.js +0 -1
- package/dist/assets/common-kbQ_8xWS.js +0 -1
- package/dist/assets/common-scHLGxvu.js +0 -1
- package/dist/assets/common-yN0h54h8.js +0 -1
- package/dist/assets/debounce-CgXMcR6c.js +0 -1
- package/dist/assets/dropdown-VTyHUdNA.js +0 -1
- package/dist/assets/index-BS8OlUCn.js +0 -1
- package/dist/assets/index-Btm_EBDa.js +0 -1
- package/dist/assets/index-Bxp11rQw.js +0 -1
- package/dist/assets/index-CjM5Z7DY.js +0 -1
- package/dist/assets/index-D5IVFX4z.js +0 -1
- package/dist/assets/index-DjX0Bpo4.js +0 -1
- package/dist/assets/index-oUdhbQ0k.js +0 -638
- package/dist/assets/index-pkU4FPE0.js +0 -1
- package/dist/assets/site-1MybM8Lz.js +0 -1
- package/dist/assets/site-7rvlMh0j.js +0 -1
- package/dist/assets/site-BTdZAF1K.js +0 -1
- package/dist/assets/site-BjgwOMVm.js +0 -1
- package/dist/assets/site-ClFPyYgF.js +0 -1
- package/dist/assets/site-CsHB7i33.js +0 -1
- package/dist/assets/site-D2NZaN1F.js +0 -1
- package/dist/assets/site-D7uG_csZ.js +0 -1
- package/dist/assets/site-DIwFDdEJ.js +0 -1
- package/dist/assets/site-DV2Pakla.js +0 -1
- package/dist/assets/site-DZ7On1Fx.js +0 -1
- package/dist/assets/site-DfqBiOCq.js +0 -1
- package/dist/assets/site-DnRrg2dn.js +0 -1
- package/dist/assets/site-MjZX59Qi.js +0 -1
- package/dist/assets/site-S_azWFU-.js +0 -1
- package/dist/assets/site-drwuU4DF.js +0 -1
- package/dist/assets/site-k4_NSywn.js +0 -1
- package/dist/assets/site-wmziKldF.js +0 -1
- package/dist/assets/use-form-item-DHA73KI5.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as T}from"./index.es-ybdv8tNh.js";import{E as C}from"./index-apGSFDpN.js";import{E as q}from"./index-Btm_EBDa.js";import{d as v,h as k,b as r,t as l,k as t,r as G,j as m,l as o,o as n,ej as z,x as i,F as I,v as L,i as y,ek as K,el as H,em as J,n as S,f as Q,c2 as N,D as h,y as $,en as W,eo as X,dl as Y,dh as Z}from"./index-oUdhbQ0k.js";import{E as R,a as P}from"./index-BTFJb86a.js";import{I as U}from"./InfoIcon-9Wan39hE.js";import{I as F}from"./ImagePreview-Bq6TmnB_.js";import{E as M}from"./index-CjM5Z7DY.js";import{E as V}from"./index-D5IVFX4z.js";import{E as x,a as ee}from"./index-BQTBPAa8.js";import{E as O}from"./index-_HE2vSD7.js";import{C as te}from"./CopyToClipboard-CdHjrONV.js";import{V as oe}from"./VideoPlayer-BoUYJJAY.js";import{E as se}from"./index-BbIXTRxd.js";import{E as ne}from"./index-M0OikGrA.js";import{E as ae}from"./index-kKC0Ivrh.js";import{B as le}from"./BotPlaceholder-BC0knnbs.js";import{N as ie}from"./NoTasks-DN70KO5R.js";import"./use-form-item-DHA73KI5.js";import"./index-r5W6hzzQ.js";import"./index-DjX0Bpo4.js";import"./typescript-BDQrJx_d.js";import"./index-BS8OlUCn.js";import"./strings-C9YRIwNe.js";import"./castArray-pyQty71k.js";import"./isEqual-BVGhOXu9.js";import"./_Uint8Array-fEFMYpOd.js";import"./debounce-CgXMcR6c.js";import"./_baseIteratee-HPhqSc1g.js";import"./index-T8sKVr0g.js";import"./index-CT9MQhzA.js";import"./_baseClone-Lvb_uHUX.js";import"./_initCloneObject-By_nB0aA.js";import"./index-UcV0p3Hx.js";import"./vue-plyr-QZFBikSk.js";import"./index-pkU4FPE0.js";const re=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:C,FontAwesomeIcon:T},data(){return{drawer:!1}}}),ce={class:"main"},de={class:"config"},pe={class:"result"};function me(e,s,u,_,b,w){const c=o("font-awesome-icon"),d=o("el-button"),a=o("el-drawer");return n(),r("div",ce,[l("div",de,[G(e.$slots,"config",{},void 0,!0)]),l("div",pe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{round:"",class:"menu",onClick:s[0]||(s[0]=g=>e.drawer=!0)},{default:m(()=>[t(c,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=g=>e.drawer=g),"with-header":!1,size:"340px",class:"drawer"},{default:m(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ue=k(re,[["render",me],["__scopeId","data-v-fdac4146"]]),_e=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"}]}},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=z)}}),fe={class:"field"},ge={class:"title font-bold"};function he(e,s,u,_,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",fe,[l("h2",ge,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:m(()=>[(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 $e=k(_e,[["render",he],["__scopeId","data-v-060114ec"]]),ve=v({name:"ModeSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"std",label:"标准"},{value:"pro",label:"高速"}]}},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=K)}}),ke={class:"field"},be={class:"title font-bold"};function we(e,s,u,_,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",ke,[l("h2",be,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")},{default:m(()=>[(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 ye=k(ve,[["render",we],["__scopeId","data-v-a21ccbf8"]]),Ve=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=H)}}),Ee={class:"field"},Ie={class:"title font-bold"};function Se(e,s,u,_,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",Ee,[l("h2",Ie,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:m(()=>[(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 Te=k(Ve,[["render",Se],["__scopeId","data-v-02112e2c"]]),Ce=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=J)}}),Le={class:"text-sm font-bold mb-2 block"},Ue={class:"items"},Ae=["onClick"],Ge={class:"name"};function Re(e,s,u,_,b,w){return n(),r("div",null,[l("span",Le,i(e.$t("kling.name.ratio")),1),l("div",Ue,[(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:Q({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",Ge,i(c.label),1)],10,Ae))),128))])])}const Pe=k(Ce,[["render",Re],["__scopeId","data-v-2601284f"]]),De=v({name:"StartImage",components:{ElUpload:M,ElButton:C,InfoIcon:U,FontAwesomeIcon:T,ImagePreview:F},emits:["change"],data(){return{fileList:[],uploadUrl:N()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.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()}}}),je={class:"relative"},Ne={class:"flex justify-between"},Fe={class:"flex justify-start items-center"},Me={class:"text-sm font-bold"};function Oe(e,s,u,_,b,w){const c=o("info-icon"),d=o("image-preview"),a=o("font-awesome-icon"),g=o("el-button"),f=o("el-upload");return n(),r("div",je,[l("div",Ne,[l("div",Fe,[l("span",Me,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(f,{"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:m(({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:m(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:m(()=>[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 Be=k(De,[["render",Oe],["__scopeId","data-v-e2205d5b"]]),qe=v({name:"EndImage",components:{ElUpload:M,ElButton:C,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:T},data(){return{fileList:[],uploadUrl:N()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.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()}}}),ze={class:"relative"},Ke={class:"flex justify-between"},He={class:"flex justify-start items-center"},Je={class:"text-sm font-bold"};function Qe(e,s,u,_,b,w){const c=o("info-icon"),d=o("image-preview"),a=o("font-awesome-icon"),g=o("el-button"),f=o("el-upload");return n(),r("div",ze,[l("div",Ke,[l("div",He,[l("span",Je,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(f,{"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:m(({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:m(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:m(()=>[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 We=k(qe,[["render",Qe],["__scopeId","data-v-caf87d80"]]),Xe=v({name:"CfgScaleSelector",components:{ElSlider:ee,InfoIcon:U,ElInputNumber:x},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=W)}}),Ye={class:"flex justify-between"},Ze={class:"flex justify-start items-center"},xe={class:"text-sm font-bold"},et={class:"flex justify-end items-center"},tt={class:"w-full"};function ot(e,s,u,_,b,w){const c=o("info-icon"),d=o("el-input-number"),a=o("el-slider");return n(),r("div",null,[l("div",Ye,[l("div",Ze,[l("span",xe,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),l("div",et,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=g=>e.value=g),"controls-position":"right"},null,8,["modelValue"])])]),l("div",tt,[t(a,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=g=>e.value=g),min:0,max:1,step:.1},null,8,["modelValue"])])])}const st=k(Xe,[["render",ot]]),nt="",at=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=nt)}}),lt={class:"field"},it={class:"box"},rt={class:"title font-bold"};function ct(e,s,u,_,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",lt,[l("div",it,[l("h2",rt,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 dt=k(at,[["render",ct],["__scopeId","data-v-0e95dea6"]]),pt="",mt=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=pt)}}),ut={class:"field"},_t={class:"box"},ft={class:"title font-bold"};function gt(e,s,u,_,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",ut,[l("div",_t,[l("h2",ft,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 ht=k(mt,[["render",gt],["__scopeId","data-v-dfc5338b"]]),$t=v({name:"ConfigPanel",components:{ElButton:C,FontAwesomeIcon:T,PromptInput:dt,NegativePromptInput:ht,ModelSelector:$e,ModeSelector:ye,DurationSelector:Te,RatioSelector:Pe,StartImage:Be,CfgScaleSelector:st,EndImage:We},emits:["generate"],computed:{config(){return this.$store.state.kling?.config}},methods:{onGenerate(){this.$emit("generate")}}}),vt={class:"panel"},kt={class:"config"},bt={class:"actions"};function wt(e,s,u,_,b,w){const c=o("prompt-input"),d=o("model-selector"),a=o("mode-selector"),g=o("ratio-selector"),f=o("start-image"),p=o("end-image"),E=o("cfg-scale-selector"),A=o("duration-selector"),B=o("negative-prompt-input"),D=o("font-awesome-icon"),j=o("el-button");return n(),r("div",vt,[l("div",kt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(a,{class:"mb-4"}),t(g,{class:"mb-4"}),t(f,{class:"mb-2"}),t(p,{class:"mb-2"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"}),l("div",bt,[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:m(()=>[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:m(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])])}const yt=k($t,[["render",wt],["__scopeId","data-v-04a8d2a6"]]),Vt=v({name:"TaskPreview",components:{ElImage:ae,CopyToClipboard:te,FontAwesomeIcon:T,ElAlert:ne,VideoPlayer:oe,ElTooltip:se,ElButton:C},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")}}}),Et={class:"preview"},It={class:"left"},St={class:"main"},Tt={class:"bot"},Ct={class:"datetime"},Lt={class:"info"},Ut={key:0,class:"prompt mt-2"},At={key:0},Gt={key:1},Rt={key:0,class:S({content:!0,failed:!0})},Pt={key:0,class:"mb-4"},Dt={key:1,class:S({operations:!0,"mt-2":!0})},jt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Nt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ft={key:1,class:S({content:!0})},Mt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Bt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},qt={key:2,class:S({content:!0})},zt={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"};function Ht(e,s,u,_,b,w){const c=o("el-image"),d=o("video-player"),a=o("el-button"),g=o("el-tooltip"),f=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Et,[l("div",It,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),l("div",St,[l("div",Tt,[h(i(e.$t("kling.name.klingBot"))+" ",1),l("span",Ct,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Lt,[e.modelValue?.request?.prompt?(n(),r("p",Ut,[h(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),r("span",At," - ("+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",Gt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),r("div",Rt,[e.modelValue?.response.video_url?(n(),r("div",Pt,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),r("div",Dt,[t(g,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:m(()=>[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:m(()=>[h(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:m(()=>[l("p",jt,[t(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),l("p",Nt,[t(f,{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",Ft,[t(E,{closable:!1,class:"failure"},{template:m(()=>[t(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:m(()=>[l("p",Mt,[t(f,{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",Ot,[t(f,{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",Bt,[t(f,{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",qt,[t(E,{closable:!1,class:"info"},{template:m(()=>[t(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:m(()=>[l("p",zt,[t(f,{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",Kt,[t(f,{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 Jt=k(Vt,[["render",Ht],["__scopeId","data-v-3910e897"]]),Qt=v({name:"RecentPanel",components:{TaskPreview:Jt,NoTasks:ie,BotPlaceholder:le},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")}}}),Wt={key:0},Xt={key:1,class:"h-full w-full overflow-y-auto"},Yt={key:2,class:"w-full h-full flex items-center justify-center"};function Zt(e,s,u,_,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",Wt,[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,f)=>(n(),y(d,{key:f,"model-value":g},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",Yt,[t(a)])):$("",!0)],64)}const xt=k(Qt,[["render",Zt]]),eo="https://webhook.acedata.cloud/kling",to=v({name:"KlingIndex",components:{ConfigPanel:yt,Layout:ue,RecentPanel:xt},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.kling?.status?.getApplications===Z.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}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},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:u,createdAtMax:_}=e||{};console.debug("limit",s,"createdAtMin",u,"createdAtMax",_),await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:u,createdAtMax:_})},async onGenerate(){const e={...this.config,callback_url:eo},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),X.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(u=>{u?.response?.data?.error?.code===Y?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 oo(e,s,u,_,b,w){const c=o("config-panel"),d=o("recent-panel"),a=o("layout");return n(),y(a,null,{config:m(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:m(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Mo=k(to,[["render",oo]]);export{Mo as default};
|
|
1
|
+
import{F as T}from"./index.es-CmAoTyVL.js";import{E as C}from"./index-Dl_ff5ni.js";import{E as q}from"./index-C0t9rMvj.js";import{d as v,h as k,b as r,t as l,k as t,r as G,j as m,l as o,o as n,el as z,x as i,F as I,v as L,i as y,em as K,en as H,eo as J,n as S,f as Q,c4 as N,D as h,y as $,ep as W,eq as X,dn as Y,dj as Z}from"./index-DM-McChS.js";import{E as R,a as P}from"./index-C7Wx0X9v.js";import{I as U}from"./InfoIcon-CijoMMMz.js";import{I as F}from"./ImagePreview-KNv7fJqR.js";import{E as M}from"./index-CGMy-mxm.js";import{E as V}from"./index-BrdKF5yA.js";import{E as x,a as ee}from"./index-T_Hh32Hb.js";import{E as O}from"./index-JW39oOEU.js";import{C as te}from"./CopyToClipboard-CVDOXZ-a.js";import{V as oe}from"./VideoPlayer-C0MqtCQO.js";import{E as se}from"./index-D2tyb6wy.js";import{E as ne}from"./index-Bc05C7Iq.js";import{E as ae}from"./index-BTeCKWcI.js";import{B as le}from"./BotPlaceholder-UYTmTQfX.js";import{N as ie}from"./NoTasks-CocWVrlG.js";import"./use-form-item-ckkxdj9G.js";import"./index-r5W6hzzQ.js";import"./index-BPSPAB35.js";import"./typescript-LPT8zmb-.js";import"./index-DKr_xH2f.js";import"./strings-RzDk29K3.js";import"./castArray-DF9exNaC.js";import"./isEqual-BerUtaWm.js";import"./_Uint8Array-CFF3tqTI.js";import"./debounce-DIgj7DCo.js";import"./_baseIteratee-DkeT1DK7.js";import"./index-UrRqTynA.js";import"./index-BtkTmjB7.js";import"./_baseClone-DxikSyNf.js";import"./_initCloneObject-15wE_65Y.js";import"./index-DdY8PKQv.js";import"./vue-plyr-QZFBikSk.js";import"./index-Hc-BbYQ6.js";const re=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:C,FontAwesomeIcon:T},data(){return{drawer:!1}}}),ce={class:"main"},de={class:"config"},pe={class:"result"};function me(e,s,u,_,b,w){const c=o("font-awesome-icon"),d=o("el-button"),a=o("el-drawer");return n(),r("div",ce,[l("div",de,[G(e.$slots,"config",{},void 0,!0)]),l("div",pe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{round:"",class:"menu",onClick:s[0]||(s[0]=g=>e.drawer=!0)},{default:m(()=>[t(c,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=g=>e.drawer=g),"with-header":!1,size:"340px",class:"drawer"},{default:m(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ue=k(re,[["render",me],["__scopeId","data-v-fdac4146"]]),_e=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"}]}},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=z)}}),fe={class:"field"},ge={class:"title font-bold"};function he(e,s,u,_,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",fe,[l("h2",ge,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:m(()=>[(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 $e=k(_e,[["render",he],["__scopeId","data-v-060114ec"]]),ve=v({name:"ModeSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"std",label:"标准"},{value:"pro",label:"高速"}]}},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=K)}}),ke={class:"field"},be={class:"title font-bold"};function we(e,s,u,_,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",ke,[l("h2",be,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")},{default:m(()=>[(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 ye=k(ve,[["render",we],["__scopeId","data-v-a21ccbf8"]]),Ve=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=H)}}),Ee={class:"field"},Ie={class:"title font-bold"};function Se(e,s,u,_,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",Ee,[l("h2",Ie,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:m(()=>[(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 Te=k(Ve,[["render",Se],["__scopeId","data-v-02112e2c"]]),Ce=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=J)}}),Le={class:"text-sm font-bold mb-2 block"},Ue={class:"items"},Ae=["onClick"],Ge={class:"name"};function Re(e,s,u,_,b,w){return n(),r("div",null,[l("span",Le,i(e.$t("kling.name.ratio")),1),l("div",Ue,[(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:Q({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",Ge,i(c.label),1)],10,Ae))),128))])])}const Pe=k(Ce,[["render",Re],["__scopeId","data-v-2601284f"]]),De=v({name:"StartImage",components:{ElUpload:M,ElButton:C,InfoIcon:U,FontAwesomeIcon:T,ImagePreview:F},emits:["change"],data(){return{fileList:[],uploadUrl:N()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.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()}}}),je={class:"relative"},Ne={class:"flex justify-between"},Fe={class:"flex justify-start items-center"},Me={class:"text-sm font-bold"};function Oe(e,s,u,_,b,w){const c=o("info-icon"),d=o("image-preview"),a=o("font-awesome-icon"),g=o("el-button"),f=o("el-upload");return n(),r("div",je,[l("div",Ne,[l("div",Fe,[l("span",Me,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(f,{"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:m(({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:m(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:m(()=>[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 Be=k(De,[["render",Oe],["__scopeId","data-v-e2205d5b"]]),qe=v({name:"EndImage",components:{ElUpload:M,ElButton:C,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:T},data(){return{fileList:[],uploadUrl:N()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.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()}}}),ze={class:"relative"},Ke={class:"flex justify-between"},He={class:"flex justify-start items-center"},Je={class:"text-sm font-bold"};function Qe(e,s,u,_,b,w){const c=o("info-icon"),d=o("image-preview"),a=o("font-awesome-icon"),g=o("el-button"),f=o("el-upload");return n(),r("div",ze,[l("div",Ke,[l("div",He,[l("span",Je,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(f,{"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:m(({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:m(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:m(()=>[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 We=k(qe,[["render",Qe],["__scopeId","data-v-caf87d80"]]),Xe=v({name:"CfgScaleSelector",components:{ElSlider:ee,InfoIcon:U,ElInputNumber:x},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=W)}}),Ye={class:"flex justify-between"},Ze={class:"flex justify-start items-center"},xe={class:"text-sm font-bold"},et={class:"flex justify-end items-center"},tt={class:"w-full"};function ot(e,s,u,_,b,w){const c=o("info-icon"),d=o("el-input-number"),a=o("el-slider");return n(),r("div",null,[l("div",Ye,[l("div",Ze,[l("span",xe,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),l("div",et,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=g=>e.value=g),"controls-position":"right"},null,8,["modelValue"])])]),l("div",tt,[t(a,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=g=>e.value=g),min:0,max:1,step:.1},null,8,["modelValue"])])])}const st=k(Xe,[["render",ot]]),nt="",at=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=nt)}}),lt={class:"field"},it={class:"box"},rt={class:"title font-bold"};function ct(e,s,u,_,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",lt,[l("div",it,[l("h2",rt,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 dt=k(at,[["render",ct],["__scopeId","data-v-0e95dea6"]]),pt="",mt=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=pt)}}),ut={class:"field"},_t={class:"box"},ft={class:"title font-bold"};function gt(e,s,u,_,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",ut,[l("div",_t,[l("h2",ft,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 ht=k(mt,[["render",gt],["__scopeId","data-v-dfc5338b"]]),$t=v({name:"ConfigPanel",components:{ElButton:C,FontAwesomeIcon:T,PromptInput:dt,NegativePromptInput:ht,ModelSelector:$e,ModeSelector:ye,DurationSelector:Te,RatioSelector:Pe,StartImage:Be,CfgScaleSelector:st,EndImage:We},emits:["generate"],computed:{config(){return this.$store.state.kling?.config}},methods:{onGenerate(){this.$emit("generate")}}}),vt={class:"panel"},kt={class:"config"},bt={class:"actions"};function wt(e,s,u,_,b,w){const c=o("prompt-input"),d=o("model-selector"),a=o("mode-selector"),g=o("ratio-selector"),f=o("start-image"),p=o("end-image"),E=o("cfg-scale-selector"),A=o("duration-selector"),B=o("negative-prompt-input"),D=o("font-awesome-icon"),j=o("el-button");return n(),r("div",vt,[l("div",kt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(a,{class:"mb-4"}),t(g,{class:"mb-4"}),t(f,{class:"mb-2"}),t(p,{class:"mb-2"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"}),l("div",bt,[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:m(()=>[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:m(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])])}const yt=k($t,[["render",wt],["__scopeId","data-v-04a8d2a6"]]),Vt=v({name:"TaskPreview",components:{ElImage:ae,CopyToClipboard:te,FontAwesomeIcon:T,ElAlert:ne,VideoPlayer:oe,ElTooltip:se,ElButton:C},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")}}}),Et={class:"preview"},It={class:"left"},St={class:"main"},Tt={class:"bot"},Ct={class:"datetime"},Lt={class:"info"},Ut={key:0,class:"prompt mt-2"},At={key:0},Gt={key:1},Rt={key:0,class:S({content:!0,failed:!0})},Pt={key:0,class:"mb-4"},Dt={key:1,class:S({operations:!0,"mt-2":!0})},jt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Nt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ft={key:1,class:S({content:!0})},Mt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Bt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},qt={key:2,class:S({content:!0})},zt={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"};function Ht(e,s,u,_,b,w){const c=o("el-image"),d=o("video-player"),a=o("el-button"),g=o("el-tooltip"),f=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Et,[l("div",It,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),l("div",St,[l("div",Tt,[h(i(e.$t("kling.name.klingBot"))+" ",1),l("span",Ct,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Lt,[e.modelValue?.request?.prompt?(n(),r("p",Ut,[h(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),r("span",At," - ("+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",Gt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),r("div",Rt,[e.modelValue?.response.video_url?(n(),r("div",Pt,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),r("div",Dt,[t(g,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:m(()=>[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:m(()=>[h(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:m(()=>[l("p",jt,[t(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),l("p",Nt,[t(f,{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",Ft,[t(E,{closable:!1,class:"failure"},{template:m(()=>[t(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:m(()=>[l("p",Mt,[t(f,{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",Ot,[t(f,{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",Bt,[t(f,{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",qt,[t(E,{closable:!1,class:"info"},{template:m(()=>[t(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:m(()=>[l("p",zt,[t(f,{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",Kt,[t(f,{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 Jt=k(Vt,[["render",Ht],["__scopeId","data-v-3910e897"]]),Qt=v({name:"RecentPanel",components:{TaskPreview:Jt,NoTasks:ie,BotPlaceholder:le},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")}}}),Wt={key:0},Xt={key:1,class:"h-full w-full overflow-y-auto"},Yt={key:2,class:"w-full h-full flex items-center justify-center"};function Zt(e,s,u,_,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",Wt,[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,f)=>(n(),y(d,{key:f,"model-value":g},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",Yt,[t(a)])):$("",!0)],64)}const xt=k(Qt,[["render",Zt]]),eo="https://webhook.acedata.cloud/kling",to=v({name:"KlingIndex",components:{ConfigPanel:yt,Layout:ue,RecentPanel:xt},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.kling?.status?.getApplications===Z.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}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},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:u,createdAtMax:_}=e||{};console.debug("limit",s,"createdAtMin",u,"createdAtMax",_),await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:u,createdAtMax:_})},async onGenerate(){const e={...this.config,callback_url:eo},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),X.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(u=>{u?.response?.data?.error?.code===Y?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 oo(e,s,u,_,b,w){const c=o("config-panel"),d=o("recent-panel"),a=o("layout");return n(),y(a,null,{config:m(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:m(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Mo=k(to,[["render",oo]]);export{Mo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as A}from"./index.es-ybdv8tNh.js";import{E as G}from"./index-apGSFDpN.js";import{E as P}from"./index-Btm_EBDa.js";import{d as $,h as v,b as l,t as c,k as t,r as E,j as p,l as i,o,c2 as D,x as n,D as _,F as w,v as I,i as V,n as T,c as L,y as g,eu as j,dl as O,d9 as z,dg as B,dh as C}from"./index-oUdhbQ0k.js";import{I as M}from"./InfoIcon-9Wan39hE.js";import{E as q}from"./index-CjM5Z7DY.js";import{E as y}from"./index-D5IVFX4z.js";import{a as F,E as N}from"./index-Bxp11rQw.js";import{E as U}from"./index-kKC0Ivrh.js";import{E as H,a as J}from"./index-Bs5qMSYG.js";import{A as K}from"./Status-PiW0hxrr.js";import{C as Q}from"./CopyToClipboard-CdHjrONV.js";import{E as W}from"./index-M0OikGrA.js";import{a as X,E as Y}from"./index-pkU4FPE0.js";import"./use-form-item-DHA73KI5.js";import"./index-r5W6hzzQ.js";import"./index-BbIXTRxd.js";import"./index-BS8OlUCn.js";import"./typescript-BDQrJx_d.js";import"./index-CT9MQhzA.js";import"./_baseClone-Lvb_uHUX.js";import"./_Uint8Array-fEFMYpOd.js";import"./_initCloneObject-By_nB0aA.js";import"./isEqual-BVGhOXu9.js";import"./debounce-CgXMcR6c.js";import"./index-UcV0p3Hx.js";import"./strings-C9YRIwNe.js";import"./isPlainObject-DgkzW7S8.js";const Z=$({name:"LayoutHeadshots",components:{ElDrawer:P,ElButton:G,FontAwesomeIcon:A},data(){return{drawer:!1}}}),x={class:"main"},ee={class:"config"},te={class:"result"};function se(e,s,m,h,b,k){const d=i("font-awesome-icon"),u=i("el-button"),a=i("el-drawer");return o(),l("div",x,[c("div",ee,[E(e.$slots,"config",{},void 0,!0)]),c("div",te,[E(e.$slots,"result",{},void 0,!0)]),t(u,{round:"",class:"menu",onClick:s[0]||(s[0]=r=>e.drawer=!0)},{default:p(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=r=>e.drawer=r),"with-header":!1,size:"340px",class:"drawer"},{default:p(()=>[E(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const oe=v(Z,[["render",se],["__scopeId","data-v-38abce67"]]),ae=$({name:"ImageUrlsInput",components:{ElUpload:q,ElButton:G,InfoIcon:M},data(){return{fileList:[],uploadUrl:D()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){y.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){y.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),ne={class:"field"},ie={class:"title font-bold"},le={class:"upload-wrapper"};function re(e,s,m,h,b,k){const d=i("el-button"),u=i("el-upload"),a=i("info-icon");return o(),l("div",ne,[c("h2",ie,n(e.$t("headshots.name.endImageUrls")),1),c("div",le,[t(u,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=r=>e.fileList=r),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:2,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:p(()=>[t(d,{size:"small",type:"primary",round:""},{default:p(()=>[_(n(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(a,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const ce=v(ae,[["render",re],["__scopeId","data-v-a6bd8c31"]]),de="fast",pe=$({name:"ModeSelector",components:{ElRadioButton:N,ElRadioGroup:F},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=de)}}),me={class:"field"},he={class:"title font-bold"};function ue(e,s,m,h,b,k){const d=i("el-radio-button"),u=i("el-radio-group");return o(),l("div",me,[c("h2",he,n(e.$t("headshots.name.mode")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),size:"small",class:"mode"},{default:p(()=>[(o(!0),l(w,null,I(e.options,a=>(o(),V(d,{key:a.value,label:a.value},{default:p(()=>[_(n(a.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const _e=v(pe,[["render",ue],["__scopeId","data-v-a2a0d5fa"]]),fe=$({name:"StylizeSelector",components:{ElTabs:J,ElTabPane:H,ElImage:U},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){console.debug("set template",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})}}}),ge={class:"field"},$e=["onClick"],ve={class:"name"};function be(e,s,m,h,b,k){const d=i("el-image"),u=i("el-tab-pane"),a=i("el-tabs");return o(),l("div",ge,[t(a,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=r=>e.tab=r)},{default:p(()=>[(o(!0),l(w,null,I(e.elements,(r,f)=>(o(),V(u,{key:f,label:r.displayName,name:f,class:"pane"},{default:p(()=>[(o(!0),l(w,null,I(r.items,(S,R)=>(o(),l("div",{key:R,class:T({item:!0,active:e.value===S.value}),onClick:ut=>e.onToggle(S.value)},[t(d,{src:S.image,fit:"fill",class:"preview"},null,8,["src"]),c("span",ve,n(S.label),1)],10,$e))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const ke=v(fe,[["render",be],["__scopeId","data-v-be4bd25d"]]),ye=$({name:"PresetPanel",components:{ModeSelector:_e,ImageUrlsInput:ce,ElButton:G,FontAwesomeIcon:A,ElementsSelector:ke},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),we={class:"panel"},Ie={class:"config"},Te={class:"actions"};function Se(e,s,m,h,b,k){const d=i("elements-selector"),u=i("mode-selector"),a=i("image-urls-input"),r=i("font-awesome-icon"),f=i("el-button");return o(),l("div",we,[c("div",Ie,[t(d,{class:"mb-4"}),t(u,{class:"mb-4"}),t(a,{class:"mb-4"}),c("div",Te,[t(f,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(r,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+n(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ve=v(ye,[["render",Se],["__scopeId","data-v-78172a54"]]),Ee=$({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:L(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:h=>{window.open(h,"_blank")}}}}),Ce={class:"image-gallery"},Ae=["src"],Ge=["onClick"];function Ue(e,s,m,h,b,k){return o(),l("div",Ce,[(o(!0),l(w,null,I(e.images,(d,u)=>(o(),l("div",{key:u,class:"image-container"},[c("img",{src:d.image_url,alt:"Image"},null,8,Ae),d.image_url?(o(),l("button",{key:0,class:"view-button",onClick:a=>e.viewImage(d.image_url)},n(e.$t("headshots.button.viewImage")),9,Ge)):g("",!0)]))),128))])}const Re=v(Ee,[["render",Ue],["__scopeId","data-v-03641510"]]),Pe=$({name:"TaskPreview",components:{ElImage:U,CopyToClipboard:Q,FontAwesomeIcon:A,ElAlert:W,ImageGallery:Re},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,m=new URL(s.src),h=m.searchParams.get("retry");if(!h)m.searchParams.set("retry","1");else if(parseInt(h)<2)m.searchParams.set("retry",(parseInt(h)+1).toString());else return;s.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),De={class:"preview"},Le={class:"left"},je={class:"main"},Oe={class:"bot"},ze={class:"datetime"},Be={class:"info"},Me={key:0,class:"prompt mt-2"},qe={key:0},Fe={key:1},Ne={key:0,class:T({content:!0,failed:!0})},He={class:"image-wrapper"},Je={class:"description"},Ke={key:1,class:T({content:!0})},Qe={class:"description"},We={class:"description"},Xe={class:"description"},Ye={key:2,class:T({content:!0})},Ze={class:"description"},xe={key:3,class:T({content:!0})},et={class:"description"};function tt(e,s,m,h,b,k){const d=i("el-image"),u=i("image-gallery"),a=i("font-awesome-icon"),r=i("copy-to-clipboard"),f=i("el-alert");return o(),l("div",De,[c("div",Le,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),c("div",je,[c("div",Oe,[_(n(e.$t("headshots.name.headshotsBot"))+" ",1),c("span",ze,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",Be,[e.modelValue?.request?.template?(o(),l("p",Me,[_(n(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?g("",!0):(o(),l("span",qe," - ("+n(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(o(),l("span",Fe," - ("+n(e.$t("headshots.status.processing"))+") ",1)):g("",!0)])):g("",!0)]),e.modelValue?.response?.success===!0?(o(),l("div",Ne,[c("div",He,[t(u,{"model-value":e.modelValue},null,8,["model-value"])]),t(f,{closable:!1,class:"mt-2 success"},{default:p(()=>[c("p",Je,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?.success===!1?(o(),l("div",Ke,[t(f,{closable:!1,class:"failure"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Qe,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),c("p",We,[t(a,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t(r,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),c("p",Xe,[t(a,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("headshots.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t(r,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?g("",!0):(o(),l("div",Ye,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Ze,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(o(),l("div",xe,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",et,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0)])])}const st=v(Pe,[["render",tt],["__scopeId","data-v-8eb9dee0"]]),ot=$({name:"RecentPanel",components:{TaskPreview:st,ElSkeleton:Y,ElSkeletonItem:X},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),at={key:0,class:"tasks"},nt={class:"left"},it={class:"main"},lt={key:1,class:"tasks"},rt={key:2,class:"description"};function ct(e,s,m,h,b,k){const d=i("el-skeleton-item"),u=i("el-skeleton"),a=i("task-preview");return o(),l("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...r)=>e.onHandleScroll&&e.onHandleScroll(...r))},[e.tasks?.items===void 0?(o(),l("div",at,[(o(),l(w,null,I(3,r=>c("div",{key:r,class:"task placeholder"},[c("div",nt,[t(u,{animated:""},{template:p(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),c("div",it,[t(u,{animated:""},{template:p(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(o(),l("div",lt,[(o(!0),l(w,null,I(e.tasks?.items,(r,f)=>(o(),V(a,{key:f,"model-value":r,class:"preview"},null,8,["model-value"]))),128))])):g("",!0),e.tasks?.items?.length===0?(o(),l("p",rt,n(e.$t("headshots.message.noTasks")),1)):g("",!0)],544)}const dt=v(ot,[["render",ct],["__scopeId","data-v-d79bcb1f"]]),pt="https://webhook.acedata.cloud/headshots",mt=$({name:"HeadshotsIndex",components:{ConfigPanel:Ve,Layout:oe,ApplicationStatus:K,RecentPanel:dt},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.headshots?.status?.getApplications===C.Request},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===C.Request},needApply(){return this.$store.state.headshots.status.getApplications===C.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){z.create({application:this.application}).then(({data:e})=>{this.application=e,y.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===B&&y.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:h}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",h),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:m,createdAtMax:h})},async onGeneratePicture(){const e={...this.config,callback_url:pt},s=this.credential?.token;if(!s){console.error("no token specified");return}y.info(this.$t("headshots.message.startingTask")),j.generate(e,{token:s}).then(()=>{y.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===O?y.error(this.$t("headshots.message.usedUp")):y.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ht(e,s,m,h,b,k){const d=i("config-panel"),u=i("application-status"),a=i("recent-panel"),r=i("layout");return o(),V(r,null,{config:p(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:p(()=>[t(u,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:s[0]||(s[0]=f=>e.$store.dispatch("headshots/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(a,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Ft=v(mt,[["render",ht],["__scopeId","data-v-7db61db3"]]);export{Ft as default};
|
|
1
|
+
import{F as A}from"./index.es-CmAoTyVL.js";import{E as G}from"./index-Dl_ff5ni.js";import{E as P}from"./index-C0t9rMvj.js";import{d as $,h as v,b as l,t as c,k as t,r as E,j as p,l as i,o,c4 as D,x as n,D as _,F as w,v as I,i as V,n as T,c as L,y as g,ez as j,dn as z,db as O,di as B,dj as C}from"./index-DM-McChS.js";import{I as M}from"./InfoIcon-CijoMMMz.js";import{E as q}from"./index-CGMy-mxm.js";import{E as y}from"./index-BrdKF5yA.js";import{a as F,E as N}from"./index-Dy-wDVPV.js";import{E as U}from"./index-BTeCKWcI.js";import{E as H,a as J}from"./index-Bq_Fgsk6.js";import{A as K}from"./Status-BQn5-WVc.js";import{C as Q}from"./CopyToClipboard-CVDOXZ-a.js";import{E as W}from"./index-Bc05C7Iq.js";import{a as X,E as Y}from"./index-Hc-BbYQ6.js";import"./use-form-item-ckkxdj9G.js";import"./index-r5W6hzzQ.js";import"./index-D2tyb6wy.js";import"./index-DKr_xH2f.js";import"./typescript-LPT8zmb-.js";import"./index-BtkTmjB7.js";import"./_baseClone-DxikSyNf.js";import"./_Uint8Array-CFF3tqTI.js";import"./_initCloneObject-15wE_65Y.js";import"./isEqual-BerUtaWm.js";import"./debounce-DIgj7DCo.js";import"./index-DdY8PKQv.js";import"./strings-RzDk29K3.js";import"./isPlainObject-BY0szB_N.js";const Z=$({name:"LayoutHeadshots",components:{ElDrawer:P,ElButton:G,FontAwesomeIcon:A},data(){return{drawer:!1}}}),x={class:"main"},ee={class:"config"},te={class:"result"};function se(e,s,m,h,b,k){const d=i("font-awesome-icon"),u=i("el-button"),a=i("el-drawer");return o(),l("div",x,[c("div",ee,[E(e.$slots,"config",{},void 0,!0)]),c("div",te,[E(e.$slots,"result",{},void 0,!0)]),t(u,{round:"",class:"menu",onClick:s[0]||(s[0]=r=>e.drawer=!0)},{default:p(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=r=>e.drawer=r),"with-header":!1,size:"340px",class:"drawer"},{default:p(()=>[E(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const oe=v(Z,[["render",se],["__scopeId","data-v-38abce67"]]),ae=$({name:"ImageUrlsInput",components:{ElUpload:q,ElButton:G,InfoIcon:M},data(){return{fileList:[],uploadUrl:D()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){y.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){y.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),ne={class:"field"},ie={class:"title font-bold"},le={class:"upload-wrapper"};function re(e,s,m,h,b,k){const d=i("el-button"),u=i("el-upload"),a=i("info-icon");return o(),l("div",ne,[c("h2",ie,n(e.$t("headshots.name.endImageUrls")),1),c("div",le,[t(u,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=r=>e.fileList=r),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:2,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:p(()=>[t(d,{size:"small",type:"primary",round:""},{default:p(()=>[_(n(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(a,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const ce=v(ae,[["render",re],["__scopeId","data-v-a6bd8c31"]]),de="fast",pe=$({name:"ModeSelector",components:{ElRadioButton:N,ElRadioGroup:F},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=de)}}),me={class:"field"},he={class:"title font-bold"};function ue(e,s,m,h,b,k){const d=i("el-radio-button"),u=i("el-radio-group");return o(),l("div",me,[c("h2",he,n(e.$t("headshots.name.mode")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),size:"small",class:"mode"},{default:p(()=>[(o(!0),l(w,null,I(e.options,a=>(o(),V(d,{key:a.value,label:a.value},{default:p(()=>[_(n(a.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const _e=v(pe,[["render",ue],["__scopeId","data-v-a2a0d5fa"]]),fe=$({name:"StylizeSelector",components:{ElTabs:J,ElTabPane:H,ElImage:U},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){console.debug("set template",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})}}}),ge={class:"field"},$e=["onClick"],ve={class:"name"};function be(e,s,m,h,b,k){const d=i("el-image"),u=i("el-tab-pane"),a=i("el-tabs");return o(),l("div",ge,[t(a,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=r=>e.tab=r)},{default:p(()=>[(o(!0),l(w,null,I(e.elements,(r,f)=>(o(),V(u,{key:f,label:r.displayName,name:f,class:"pane"},{default:p(()=>[(o(!0),l(w,null,I(r.items,(S,R)=>(o(),l("div",{key:R,class:T({item:!0,active:e.value===S.value}),onClick:ut=>e.onToggle(S.value)},[t(d,{src:S.image,fit:"fill",class:"preview"},null,8,["src"]),c("span",ve,n(S.label),1)],10,$e))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const ke=v(fe,[["render",be],["__scopeId","data-v-be4bd25d"]]),ye=$({name:"PresetPanel",components:{ModeSelector:_e,ImageUrlsInput:ce,ElButton:G,FontAwesomeIcon:A,ElementsSelector:ke},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),we={class:"panel"},Ie={class:"config"},Te={class:"actions"};function Se(e,s,m,h,b,k){const d=i("elements-selector"),u=i("mode-selector"),a=i("image-urls-input"),r=i("font-awesome-icon"),f=i("el-button");return o(),l("div",we,[c("div",Ie,[t(d,{class:"mb-4"}),t(u,{class:"mb-4"}),t(a,{class:"mb-4"}),c("div",Te,[t(f,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(r,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+n(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ve=v(ye,[["render",Se],["__scopeId","data-v-78172a54"]]),Ee=$({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:L(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:h=>{window.open(h,"_blank")}}}}),Ce={class:"image-gallery"},Ae=["src"],Ge=["onClick"];function Ue(e,s,m,h,b,k){return o(),l("div",Ce,[(o(!0),l(w,null,I(e.images,(d,u)=>(o(),l("div",{key:u,class:"image-container"},[c("img",{src:d.image_url,alt:"Image"},null,8,Ae),d.image_url?(o(),l("button",{key:0,class:"view-button",onClick:a=>e.viewImage(d.image_url)},n(e.$t("headshots.button.viewImage")),9,Ge)):g("",!0)]))),128))])}const Re=v(Ee,[["render",Ue],["__scopeId","data-v-03641510"]]),Pe=$({name:"TaskPreview",components:{ElImage:U,CopyToClipboard:Q,FontAwesomeIcon:A,ElAlert:W,ImageGallery:Re},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,m=new URL(s.src),h=m.searchParams.get("retry");if(!h)m.searchParams.set("retry","1");else if(parseInt(h)<2)m.searchParams.set("retry",(parseInt(h)+1).toString());else return;s.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),De={class:"preview"},Le={class:"left"},je={class:"main"},ze={class:"bot"},Oe={class:"datetime"},Be={class:"info"},Me={key:0,class:"prompt mt-2"},qe={key:0},Fe={key:1},Ne={key:0,class:T({content:!0,failed:!0})},He={class:"image-wrapper"},Je={class:"description"},Ke={key:1,class:T({content:!0})},Qe={class:"description"},We={class:"description"},Xe={class:"description"},Ye={key:2,class:T({content:!0})},Ze={class:"description"},xe={key:3,class:T({content:!0})},et={class:"description"};function tt(e,s,m,h,b,k){const d=i("el-image"),u=i("image-gallery"),a=i("font-awesome-icon"),r=i("copy-to-clipboard"),f=i("el-alert");return o(),l("div",De,[c("div",Le,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),c("div",je,[c("div",ze,[_(n(e.$t("headshots.name.headshotsBot"))+" ",1),c("span",Oe,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",Be,[e.modelValue?.request?.template?(o(),l("p",Me,[_(n(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?g("",!0):(o(),l("span",qe," - ("+n(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(o(),l("span",Fe," - ("+n(e.$t("headshots.status.processing"))+") ",1)):g("",!0)])):g("",!0)]),e.modelValue?.response?.success===!0?(o(),l("div",Ne,[c("div",He,[t(u,{"model-value":e.modelValue},null,8,["model-value"])]),t(f,{closable:!1,class:"mt-2 success"},{default:p(()=>[c("p",Je,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?.success===!1?(o(),l("div",Ke,[t(f,{closable:!1,class:"failure"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Qe,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),c("p",We,[t(a,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t(r,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),c("p",Xe,[t(a,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("headshots.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t(r,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?g("",!0):(o(),l("div",Ye,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Ze,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(o(),l("div",xe,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",et,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0)])])}const st=v(Pe,[["render",tt],["__scopeId","data-v-8eb9dee0"]]),ot=$({name:"RecentPanel",components:{TaskPreview:st,ElSkeleton:Y,ElSkeletonItem:X},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),at={key:0,class:"tasks"},nt={class:"left"},it={class:"main"},lt={key:1,class:"tasks"},rt={key:2,class:"description"};function ct(e,s,m,h,b,k){const d=i("el-skeleton-item"),u=i("el-skeleton"),a=i("task-preview");return o(),l("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...r)=>e.onHandleScroll&&e.onHandleScroll(...r))},[e.tasks?.items===void 0?(o(),l("div",at,[(o(),l(w,null,I(3,r=>c("div",{key:r,class:"task placeholder"},[c("div",nt,[t(u,{animated:""},{template:p(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),c("div",it,[t(u,{animated:""},{template:p(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(o(),l("div",lt,[(o(!0),l(w,null,I(e.tasks?.items,(r,f)=>(o(),V(a,{key:f,"model-value":r,class:"preview"},null,8,["model-value"]))),128))])):g("",!0),e.tasks?.items?.length===0?(o(),l("p",rt,n(e.$t("headshots.message.noTasks")),1)):g("",!0)],544)}const dt=v(ot,[["render",ct],["__scopeId","data-v-d79bcb1f"]]),pt="https://webhook.acedata.cloud/headshots",mt=$({name:"HeadshotsIndex",components:{ConfigPanel:Ve,Layout:oe,ApplicationStatus:K,RecentPanel:dt},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.headshots?.status?.getApplications===C.Request},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===C.Request},needApply(){return this.$store.state.headshots.status.getApplications===C.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){O.create({application:this.application}).then(({data:e})=>{this.application=e,y.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===B&&y.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:h}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",h),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:m,createdAtMax:h})},async onGeneratePicture(){const e={...this.config,callback_url:pt},s=this.credential?.token;if(!s){console.error("no token specified");return}y.info(this.$t("headshots.message.startingTask")),j.generate(e,{token:s}).then(()=>{y.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===z?y.error(this.$t("headshots.message.usedUp")):y.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ht(e,s,m,h,b,k){const d=i("config-panel"),u=i("application-status"),a=i("recent-panel"),r=i("layout");return o(),V(r,null,{config:p(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:p(()=>[t(u,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:s[0]||(s[0]=f=>e.$store.dispatch("headshots/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(a,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Ft=v(mt,[["render",ht],["__scopeId","data-v-7db61db3"]]);export{Ft as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as q}from"./index.es-ybdv8tNh.js";import{E as H}from"./index-apGSFDpN.js";import{E as de}from"./index-Btm_EBDa.js";import{af as pe,al as me,bE as he,ag as ie,c5 as fe,_ as _e,d as C,a as $e,ah as ve,c as j,bd as ge,bj as ke,as as ae,b as _,o as a,i as w,r as U,f as oe,e as A,j as $,b4 as le,E as G,n as ye,g as we,h as L,t as l,k as s,l as c,ev as se,x as v,F as z,v as N,ew as Q,c2 as be,D as P,ex as x,ey as ee,y,J as Z,cJ as te,ez as O,dh as B,eA as R,aj as Ce,K as Se,eB as Ae,d9 as Le,dg as Ee}from"./index-oUdhbQ0k.js";import{E as re}from"./index-Dv2Wumb_.js";import{E as je,a as Ve}from"./index-BTFJb86a.js";import{I as D}from"./InfoIcon-9Wan39hE.js";import{E as Ie}from"./index-CjM5Z7DY.js";import{E}from"./index-D5IVFX4z.js";import{E as K}from"./index-_HE2vSD7.js";import{E as Te,a as ce}from"./index-BQTBPAa8.js";import{E as X}from"./index-kKC0Ivrh.js";import{E as Pe,a as Fe,b as Ue}from"./index-C2MdqaEN.js";import{E as ze}from"./index-BbIXTRxd.js";import{E as Me}from"./index-DatrTq9p.js";import{N as Ge}from"./NoTasks-DN70KO5R.js";import{a as Re,E as De}from"./index-pkU4FPE0.js";import{E as Oe}from"./index-DjX0Bpo4.js";import"./use-form-item-DHA73KI5.js";import"./index-r5W6hzzQ.js";import"./index-BS8OlUCn.js";import"./strings-C9YRIwNe.js";import"./castArray-pyQty71k.js";import"./isEqual-BVGhOXu9.js";import"./_Uint8Array-fEFMYpOd.js";import"./typescript-BDQrJx_d.js";import"./debounce-CgXMcR6c.js";import"./_baseIteratee-HPhqSc1g.js";import"./index-T8sKVr0g.js";import"./index-CT9MQhzA.js";import"./_baseClone-Lvb_uHUX.js";import"./_initCloneObject-By_nB0aA.js";import"./index-UcV0p3Hx.js";import"./dropdown-VTyHUdNA.js";const Be=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"}}),We={error:e=>e instanceof Event},Ne=C({name:"ElAvatar"}),qe=C({...Ne,props:Be,emits:We,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=j(()=>{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=j(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=j(()=>({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(A(d)),style:oe(A(u))},[(n.src||n.srcSet)&&!r.value?(a(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(A(p)),onError:f},null,44,["src","alt","srcset"])):n.icon?(a(),w(A(G),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var He=_e(qe,[["__file","avatar.vue"]]);const Ze=we(He),Ke=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:H,FontAwesomeIcon:q},data(){return{drawer:!1,preview:!1}},computed:{}}),Xe={class:"main"},Je={class:"config"},Ye={class:"result"},Qe={class:"preview"};function xe(e,t,i,o,r,d){const u=c("font-awesome-icon"),p=c("el-button"),f=c("el-drawer");return a(),_("div",Xe,[l("div",Je,[U(e.$slots,"config",{},void 0,!0)]),l("div",Ye,[U(e.$slots,"result",{},void 0,!0)]),l("div",Qe,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{round:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),"with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const et=L(Ke,[["render",xe],["__scopeId","data-v-230fd591"]]),tt=C({name:"VersionSelector",components:{ElSelect:Ve,ElOption:je,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)}}),ot={class:"field"},st={class:"title font-bold"};function nt(e,t,i,o,r,d){const u=c("el-switch"),p=c("el-option"),f=c("el-select");return a(),_("div",ot,[l("h2",st,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 it=L(tt,[["render",nt],["__scopeId","data-v-5a66a01f"]]),at=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")),Q.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(){}}}),lt={class:"relative"},rt={class:"flex justify-between"},ct={class:"flex justify-start items-center"},ut={class:"text-sm font-bold"};function dt(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",lt,[l("div",rt,[l("div",ct,[l("span",ut,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"}),P(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const pt=L(at,[["render",dt],["__scopeId","data-v-6236152c"]]),mt="",ht=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=mt)}}),ft={class:"field"},_t={class:"box"},$t={class:"title-info"},vt={class:"title font-bold"},gt={class:"instrumental"},kt={class:"title inline-block"};function yt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-switch"),f=c("el-input");return a(),_("div",ft,[l("div",_t,[l("div",$t,[l("h2",vt,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",gt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",kt,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 wt=L(ht,[["render",yt],["__scopeId","data-v-d7004a7c"]]),bt="",Ct=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=bt)}}),St={class:"field"},At={class:"box"},Lt={class:"title font-bold"};function Et(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",St,[l("div",At,[l("h2",Lt,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 jt=L(Ct,[["render",Et],["__scopeId","data-v-99dfded8"]]),Vt=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}}}),It={class:"field"},Tt={class:"title-container"},Pt={class:"titlefont-bold"};function Ft(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",It,[l("div",Tt,[l("h2",Pt,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 Ut=L(Vt,[["render",Ft],["__scopeId","data-v-85bbfcaa"]]),zt=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})}}}}),Mt={class:"field"},Gt={class:"title-container"},Rt={class:"title font-bold"};function Dt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Mt,[l("div",Gt,[l("h2",Rt,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 Ot=L(zt,[["render",Dt],["__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 Bt=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:G,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})}}}),Wt={class:"field"},Nt={class:"box"},qt={class:"title font-bold"},Ht={class:"input-wrapper"},Zt={class:"task"},Kt={class:"left"},Xt={key:2,class:"duration"},Jt={class:"info"},Yt={class:"title"},Qt={class:"style"};function xt(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",Wt,[l("div",Nt,[l("h2",qt,v(e.$t("suno.name.extend")),1),l("div",Ht,[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",Zt,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=h=>e.onClick(e.audio))},[Z((a(),_("div",Kt,[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",Xt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Jt,[l("h2",Yt,v(e.audio?.title),1),l("p",Qt,v(e.audio?.style),1)])])):y("",!0)])])}const eo=L(Bt,[["render",xt],["__scopeId","data-v-bcce4821"]]),to=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:G,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})}}}),oo={class:"field"},so={class:"box"},no={class:"title font-bold"},io={class:"task"},ao={class:"left"},lo={key:2,class:"duration"},ro={class:"info"},co={class:"title"},uo={class:"style"};function po(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",oo,[l("div",so,[l("h2",no,v(e.$t("suno.name.cover")),1)]),l("div",io,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),_("div",ao,[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",lo,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),l("div",ro,[l("h2",co,v(e.audio?.title),1),l("p",uo,v(e.audio?.style),1)])])):y("",!0)])])}const mo=L(to,[["render",po],["__scopeId","data-v-06640216"]]),ho=C({name:"PresetPanel",components:{TypeSelector:it,PromptInput:wt,LyricInput:jt,StyleInput:Ut,TitleInput:Ot,ExtendFromInput:eo,CoverFromInput:mo,UploadAudio:pt,FontAwesomeIcon:q,ElButton:H},emits:["generate"],computed:{config(){return this.$store.state.suno?.config}},methods:{onGenerate(){this.$emit("generate")}}}),fo={class:"panel"},_o={class:"config"},$o={class:"actions"};function vo(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"),T=c("font-awesome-icon"),V=c("el-button");return a(),_("div",fo,[l("div",_o,[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",$o,[e.config?.action!=="extend"?(a(),w(V,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(V,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])])}const go=L(ho,[["render",vo],["__scopeId","data-v-dc0dc608"]]);var W={exports:{}},ko=W.exports,ne;function yo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(ko,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",T=/constructor/i.test(u.HTMLElement)||u.safari,V=/CriOS\/[\d]+/.test(navigator.userAgent);if((V||b&&T||p)&&typeof FileReader<"u"){var I=new FileReader;I.onloadend=function(){var S=I.result;S=V?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=S:location=S,h=null},I.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})}(W)),W.exports}var wo=yo();const bo="https://webhook.acedata.cloud/suno",Co=C({name:"TaskPreview",components:{ElImage:X,ElIcon:G,ElTooltip:ze,ElButton:H,FontAwesomeIcon:q,VideoPlay:ee,VideoPause:x,ElDropdown:Ue,ElDropdownMenu:Fe,ElDropdownItem:Pe},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.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=>{wo.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:bo},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.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})}}}),So={class:"task"},Ao=["onClick"],Lo={class:"left"},Eo=["onClick"],jo=["onClick"],Vo={key:2,class:"duration"},Io={class:"info"},To={class:"title"},Po={class:"style"},Fo={class:"right"},Uo={class:"el-dropdown-link"},zo={class:"el-dropdown-link"};function Mo(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"),T=c("el-dropdown-menu"),V=c("el-dropdown"),I=te("loading");return a(),_("div",So,[(a(!0),_(z,null,N(e.audios,(g,F)=>(a(),_("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),_("div",Lo,[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,Eo)):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,jo)):y("",!0),g?.duration?(a(),_("div",Vo,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[I,!g?.audio_url]]),l("div",Io,[l("h2",To,v(g?.title),1),l("p",Po,v(g?.style),1)]),l("div",Fo,[g?.audio_url?(a(),w(m,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[P(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(V,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[P(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:$(()=>[P(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Uo,[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(V,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[P(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[P(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:$(()=>[P(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",zo,[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,Ao))),128))])}const Go=L(Co,[["render",Mo]]),Ro={class:"player-slider"},Do=C({__name:"PlayerSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=j({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",Ro,[s(A(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"])]))}}),Oo="/assets/disk-XFRmVAfp.png",Bo={class:"flex player-song"},Wo=["src"],No={class:"ml-2 text-xs flex flex-col justify-between"},qo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ho={class:"flex"},Zo={class:"ml-2 text-dc"},Ko=C({__name:"PlayerSong",setup(e){const t=R(),i=j({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",Bo,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||A(Oo)},null,8,Wo),l("div",No,[l("div",qo,[l("div",Ho,[l("span",null,v(i.value?.title||"Music"),1),l("span",Zo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Xo={class:"flex justify-end items-center gap-x-2.5"},Jo={class:"text-xs"},Yo=C({__name:"PlayerAction",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=j({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),_("div",Xo,[l("span",Jo,v(A(M)(i.value))+" / "+v(A(M)(o.value)),1)]))}});var Qo={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 xo(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function es(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 ts=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=xo(),p=Ce(ts,Qo);return function(){var f=d.size,n=d.strokeWidth,m=d.strokeLinecap,k=d.strokeLinejoin,h=d.theme,b=d.fill,T=d.spin,V=es(u,{size:f,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:h,fill:b},p),I=[p.prefix+"-icon"];return I.push(p.prefix+"-icon-"+e),t&&p.rtl&&I.push(p.prefix+"-icon-rtl"),T&&I.push(p.prefix+"-icon-spin"),s("span",{class:I.join(" ")},[i(V)])}}};return o}const os=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)])}),ss=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)])}),ns=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)])}),Y=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"]))}}),is={class:"player-volume flex flex-col items-center pt-2"},as={class:"text-sm mt-3"},ls={class:"mt-2"},rs=C({__name:"PlayerVolumeSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=j({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",is,[l("div",null,[s(A(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",as,v(i.value),1),l("div",ls,[s(Y,{icon:o.value?A(ns):A(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),cs={class:"flex items-center justify-center gap-x-3"},us=C({__name:"PlayerController",setup(e){const t=R(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=j(()=>t.state.suno.audio);return(r,d)=>(a(),_("div",cs,[s(Y,{icon:o.value?.state==="playing"?A(os):A(ss),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(A(Me),{placement:"top",width:"50px"},{reference:$(()=>[s(Y,{icon:A(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(rs)]),_:1})]))}}),ds={class:"flex flex-col items-stretch h-20"},ps={class:"flex grow px-5 items-center"},ms={class:"flex-1"},hs={class:"flex-1"},fs={class:"flex-1"},_s=C({__name:"Player",setup(e){return(t,i)=>(a(),_("div",ds,[s(Do),l("div",ps,[l("div",ms,[s(Ko)]),l("div",hs,[s(us)]),l("div",fs,[s(Yo)])])]))}}),$s=C({name:"RecentPanel",components:{TaskPreview:Go,ElSkeleton:De,ElSkeletonItem:Re,Player:_s,NoTasks:Ge},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")}}}),vs={key:0,class:"tasks"},gs={class:"left"},ks={class:"main"},ys={key:1,class:"tasks"},ws={key:2,class:"w-full h-full flex items-center justify-center"},bs={class:"flex-1 flex flex-col"},Cs={class:"h-20"};function Ss(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",vs,[(a(),_(z,null,N(3,k=>l("div",{key:k,class:"task placeholder"},[l("div",gs,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",ks,[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",ys,[(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",ws,[s(n)])):y("",!0)],544),Z(l("div",bs,[l("div",Cs,[s(m)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=L($s,[["render",Ss],["__scopeId","data-v-959f8920"]]),Ls=C({name:"TaskPreview",components:{ElScrollbar:Oe,IconPicture:Ae,ElImage:X,ElAvatar:Ze,ElIcon:G},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Es={key:0,class:"card"},js={class:"image-container"},Vs={class:"image-slot"},Is={class:"title"},Ts={class:"content"},Ps={class:"artist"},Fs={class:"style"},Us={class:"time"},zs={class:"lyrics"},Ms={key:1,class:"gradient-background"};function Gs(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",Es,[l("div",js,[s(f,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",Vs,[s(p,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Is,v(e.audio?.title),1)]),l("div",Ts,[l("div",Ps,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",Fs,v(e.audio?.style),1),l("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",zs,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),_("div",Ms))]),_:1})}const Rs=L(Ls,[["render",Gs],["__scopeId","data-v-9b29e9f9"]]),Ds="https://webhook.acedata.cloud/suno",Os=C({name:"SunoIndex",components:{Layout:et,ConfigPanel:go,RecentPanel:As,PreviewPanel:Rs},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.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===B.Request},needApply(){return this.$store.state.suno.status.getApplications===B.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}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},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(){Le.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ee&&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:Ds},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.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 Bs(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 Cn=L(Os,[["render",Bs],["__scopeId","data-v-69332928"]]);export{Cn as default};
|
|
1
|
+
import{F as q}from"./index.es-CmAoTyVL.js";import{E as H}from"./index-Dl_ff5ni.js";import{E as de}from"./index-C0t9rMvj.js";import{ah as pe,an as me,bG as he,ai as ie,c7 as fe,_ as _e,d as C,a as $e,aj as ve,c as j,bf as ge,bl as ke,au as ae,b as _,o as a,i as w,r as U,f as oe,e as L,j as $,b6 as le,E as M,n as ye,g as we,h as A,t as l,k as s,l as c,eA as se,x as v,F as z,v as N,eB as Q,c4 as be,D as P,eC as x,eD as ee,y,J as Z,cL as te,eE as O,dj as B,eF as R,al as Ce,K as Se,eG as Le,db as Ae,di as Ee}from"./index-DM-McChS.js";import{E as re}from"./index-tl1Kf-hL.js";import{E as je,a as Ve}from"./index-C7Wx0X9v.js";import{I as D}from"./InfoIcon-CijoMMMz.js";import{E as Ie}from"./index-CGMy-mxm.js";import{E}from"./index-BrdKF5yA.js";import{E as K}from"./index-JW39oOEU.js";import{E as Te,a as ce}from"./index-T_Hh32Hb.js";import{E as X}from"./index-BTeCKWcI.js";import{E as Pe,a as Fe,b as Ue}from"./index-cm1Ch8j7.js";import{E as ze}from"./index-D2tyb6wy.js";import{E as Ge}from"./index-5RZmISot.js";import{N as Me}from"./NoTasks-CocWVrlG.js";import{a as Re,E as De}from"./index-Hc-BbYQ6.js";import{E as Oe}from"./index-BPSPAB35.js";import"./use-form-item-ckkxdj9G.js";import"./index-r5W6hzzQ.js";import"./index-DKr_xH2f.js";import"./strings-RzDk29K3.js";import"./castArray-DF9exNaC.js";import"./isEqual-BerUtaWm.js";import"./_Uint8Array-CFF3tqTI.js";import"./typescript-LPT8zmb-.js";import"./debounce-DIgj7DCo.js";import"./_baseIteratee-DkeT1DK7.js";import"./index-UrRqTynA.js";import"./index-BtkTmjB7.js";import"./_baseClone-DxikSyNf.js";import"./_initCloneObject-15wE_65Y.js";import"./index-DdY8PKQv.js";import"./dropdown-CxWjiH2O.js";const Be=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"}}),We={error:e=>e instanceof Event},Ne=C({name:"ElAvatar"}),qe=C({...Ne,props:Be,emits:We,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=j(()=>{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=j(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=j(()=>({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(M),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var He=_e(qe,[["__file","avatar.vue"]]);const Ze=we(He),Ke=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:H,FontAwesomeIcon:q},data(){return{drawer:!1,preview:!1}},computed:{}}),Xe={class:"main"},Je={class:"config"},Ye={class:"result"},Qe={class:"preview"};function xe(e,t,i,o,r,d){const u=c("font-awesome-icon"),p=c("el-button"),f=c("el-drawer");return a(),_("div",Xe,[l("div",Je,[U(e.$slots,"config",{},void 0,!0)]),l("div",Ye,[U(e.$slots,"result",{},void 0,!0)]),l("div",Qe,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{round:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),"with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const et=A(Ke,[["render",xe],["__scopeId","data-v-230fd591"]]),tt=C({name:"VersionSelector",components:{ElSelect:Ve,ElOption:je,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)}}),ot={class:"field"},st={class:"title font-bold"};function nt(e,t,i,o,r,d){const u=c("el-switch"),p=c("el-option"),f=c("el-select");return a(),_("div",ot,[l("h2",st,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 it=A(tt,[["render",nt],["__scopeId","data-v-5a66a01f"]]),at=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")),Q.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(){}}}),lt={class:"relative"},rt={class:"flex justify-between"},ct={class:"flex justify-start items-center"},ut={class:"text-sm font-bold"};function dt(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",lt,[l("div",rt,[l("div",ct,[l("span",ut,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"}),P(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const pt=A(at,[["render",dt],["__scopeId","data-v-6236152c"]]),mt="",ht=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=mt)}}),ft={class:"field"},_t={class:"box"},$t={class:"title-info"},vt={class:"title font-bold"},gt={class:"instrumental"},kt={class:"title inline-block"};function yt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-switch"),f=c("el-input");return a(),_("div",ft,[l("div",_t,[l("div",$t,[l("h2",vt,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",gt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",kt,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 wt=A(ht,[["render",yt],["__scopeId","data-v-d7004a7c"]]),bt="",Ct=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=bt)}}),St={class:"field"},Lt={class:"box"},At={class:"title font-bold"};function Et(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",St,[l("div",Lt,[l("h2",At,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 jt=A(Ct,[["render",Et],["__scopeId","data-v-99dfded8"]]),Vt=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}}}),It={class:"field"},Tt={class:"title-container"},Pt={class:"titlefont-bold"};function Ft(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",It,[l("div",Tt,[l("h2",Pt,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 Ut=A(Vt,[["render",Ft],["__scopeId","data-v-85bbfcaa"]]),zt=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"},Mt={class:"title-container"},Rt={class:"title font-bold"};function Dt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Gt,[l("div",Mt,[l("h2",Rt,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 Ot=A(zt,[["render",Dt],["__scopeId","data-v-ce70fe34"]]);function G(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 Bt=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:M,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:G,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})}}}),Wt={class:"field"},Nt={class:"box"},qt={class:"title font-bold"},Ht={class:"input-wrapper"},Zt={class:"task"},Kt={class:"left"},Xt={key:2,class:"duration"},Jt={class:"info"},Yt={class:"title"},Qt={class:"style"};function xt(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",Wt,[l("div",Nt,[l("h2",qt,v(e.$t("suno.name.extend")),1),l("div",Ht,[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",Zt,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=h=>e.onClick(e.audio))},[Z((a(),_("div",Kt,[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",Xt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Jt,[l("h2",Yt,v(e.audio?.title),1),l("p",Qt,v(e.audio?.style),1)])])):y("",!0)])])}const eo=A(Bt,[["render",xt],["__scopeId","data-v-bcce4821"]]),to=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:M,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:G,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})}}}),oo={class:"field"},so={class:"box"},no={class:"title font-bold"},io={class:"task"},ao={class:"left"},lo={key:2,class:"duration"},ro={class:"info"},co={class:"title"},uo={class:"style"};function po(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",oo,[l("div",so,[l("h2",no,v(e.$t("suno.name.cover")),1)]),l("div",io,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),_("div",ao,[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",lo,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),l("div",ro,[l("h2",co,v(e.audio?.title),1),l("p",uo,v(e.audio?.style),1)])])):y("",!0)])])}const mo=A(to,[["render",po],["__scopeId","data-v-06640216"]]),ho=C({name:"PresetPanel",components:{TypeSelector:it,PromptInput:wt,LyricInput:jt,StyleInput:Ut,TitleInput:Ot,ExtendFromInput:eo,CoverFromInput:mo,UploadAudio:pt,FontAwesomeIcon:q,ElButton:H},emits:["generate"],computed:{config(){return this.$store.state.suno?.config}},methods:{onGenerate(){this.$emit("generate")}}}),fo={class:"panel"},_o={class:"config"},$o={class:"actions"};function vo(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"),T=c("font-awesome-icon"),V=c("el-button");return a(),_("div",fo,[l("div",_o,[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",$o,[e.config?.action!=="extend"?(a(),w(V,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(V,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])])}const go=A(ho,[["render",vo],["__scopeId","data-v-dc0dc608"]]);var W={exports:{}},ko=W.exports,ne;function yo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(ko,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",T=/constructor/i.test(u.HTMLElement)||u.safari,V=/CriOS\/[\d]+/.test(navigator.userAgent);if((V||b&&T||p)&&typeof FileReader<"u"){var I=new FileReader;I.onloadend=function(){var S=I.result;S=V?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=S:location=S,h=null},I.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})}(W)),W.exports}var wo=yo();const bo="https://webhook.acedata.cloud/suno",Co=C({name:"TaskPreview",components:{ElImage:X,ElIcon:M,ElTooltip:ze,ElButton:H,FontAwesomeIcon:q,VideoPlay:ee,VideoPause:x,ElDropdown:Ue,ElDropdownMenu:Fe,ElDropdownItem:Pe},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.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:G,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=>{wo.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:bo},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.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})}}}),So={class:"task"},Lo=["onClick"],Ao={class:"left"},Eo=["onClick"],jo=["onClick"],Vo={key:2,class:"duration"},Io={class:"info"},To={class:"title"},Po={class:"style"},Fo={class:"right"},Uo={class:"el-dropdown-link"},zo={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"),T=c("el-dropdown-menu"),V=c("el-dropdown"),I=te("loading");return a(),_("div",So,[(a(!0),_(z,null,N(e.audios,(g,F)=>(a(),_("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),_("div",Ao,[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,Eo)):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,jo)):y("",!0),g?.duration?(a(),_("div",Vo,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[I,!g?.audio_url]]),l("div",Io,[l("h2",To,v(g?.title),1),l("p",Po,v(g?.style),1)]),l("div",Fo,[g?.audio_url?(a(),w(m,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[P(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(V,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[P(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:$(()=>[P(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Uo,[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(V,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[P(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[P(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:$(()=>[P(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",zo,[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,Lo))),128))])}const Mo=A(Co,[["render",Go]]),Ro={class:"player-slider"},Do=C({__name:"PlayerSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=j({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",Ro,[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"])]))}}),Oo="/assets/disk-XFRmVAfp.png",Bo={class:"flex player-song"},Wo=["src"],No={class:"ml-2 text-xs flex flex-col justify-between"},qo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ho={class:"flex"},Zo={class:"ml-2 text-dc"},Ko=C({__name:"PlayerSong",setup(e){const t=R(),i=j({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",Bo,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||L(Oo)},null,8,Wo),l("div",No,[l("div",qo,[l("div",Ho,[l("span",null,v(i.value?.title||"Music"),1),l("span",Zo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Xo={class:"flex justify-end items-center gap-x-2.5"},Jo={class:"text-xs"},Yo=C({__name:"PlayerAction",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=j({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),_("div",Xo,[l("span",Jo,v(L(G)(i.value))+" / "+v(L(G)(o.value)),1)]))}});var Qo={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 xo(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function es(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 ts=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=xo(),p=Ce(ts,Qo);return function(){var f=d.size,n=d.strokeWidth,m=d.strokeLinecap,k=d.strokeLinejoin,h=d.theme,b=d.fill,T=d.spin,V=es(u,{size:f,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:h,fill:b},p),I=[p.prefix+"-icon"];return I.push(p.prefix+"-icon-"+e),t&&p.rtl&&I.push(p.prefix+"-icon-rtl"),T&&I.push(p.prefix+"-icon-spin"),s("span",{class:I.join(" ")},[i(V)])}}};return o}const os=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)])}),ss=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)])}),ns=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)])}),Y=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"]))}}),is={class:"player-volume flex flex-col items-center pt-2"},as={class:"text-sm mt-3"},ls={class:"mt-2"},rs=C({__name:"PlayerVolumeSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=j({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",is,[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",as,v(i.value),1),l("div",ls,[s(Y,{icon:o.value?L(ns):L(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),cs={class:"flex items-center justify-center gap-x-3"},us=C({__name:"PlayerController",setup(e){const t=R(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=j(()=>t.state.suno.audio);return(r,d)=>(a(),_("div",cs,[s(Y,{icon:o.value?.state==="playing"?L(os):L(ss),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(L(Ge),{placement:"top",width:"50px"},{reference:$(()=>[s(Y,{icon:L(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(rs)]),_:1})]))}}),ds={class:"flex flex-col items-stretch h-20"},ps={class:"flex grow px-5 items-center"},ms={class:"flex-1"},hs={class:"flex-1"},fs={class:"flex-1"},_s=C({__name:"Player",setup(e){return(t,i)=>(a(),_("div",ds,[s(Do),l("div",ps,[l("div",ms,[s(Ko)]),l("div",hs,[s(us)]),l("div",fs,[s(Yo)])])]))}}),$s=C({name:"RecentPanel",components:{TaskPreview:Mo,ElSkeleton:De,ElSkeletonItem:Re,Player:_s,NoTasks:Me},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")}}}),vs={key:0,class:"tasks"},gs={class:"left"},ks={class:"main"},ys={key:1,class:"tasks"},ws={key:2,class:"w-full h-full flex items-center justify-center"},bs={class:"flex-1 flex flex-col"},Cs={class:"h-20"};function Ss(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",vs,[(a(),_(z,null,N(3,k=>l("div",{key:k,class:"task placeholder"},[l("div",gs,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",ks,[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",ys,[(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",ws,[s(n)])):y("",!0)],544),Z(l("div",bs,[l("div",Cs,[s(m)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const Ls=A($s,[["render",Ss],["__scopeId","data-v-959f8920"]]),As=C({name:"TaskPreview",components:{ElScrollbar:Oe,IconPicture:Le,ElImage:X,ElAvatar:Ze,ElIcon:M},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Es={key:0,class:"card"},js={class:"image-container"},Vs={class:"image-slot"},Is={class:"title"},Ts={class:"content"},Ps={class:"artist"},Fs={class:"style"},Us={class:"time"},zs={class:"lyrics"},Gs={key:1,class:"gradient-background"};function Ms(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",Es,[l("div",js,[s(f,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",Vs,[s(p,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Is,v(e.audio?.title),1)]),l("div",Ts,[l("div",Ps,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",Fs,v(e.audio?.style),1),l("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",zs,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),_("div",Gs))]),_:1})}const Rs=A(As,[["render",Ms],["__scopeId","data-v-9b29e9f9"]]),Ds="https://webhook.acedata.cloud/suno",Os=C({name:"SunoIndex",components:{Layout:et,ConfigPanel:go,RecentPanel:Ls,PreviewPanel:Rs},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.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===B.Request},needApply(){return this.$store.state.suno.status.getApplications===B.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}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},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===Ee&&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:Ds},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.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 Bs(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 Cn=A(Os,[["render",Bs],["__scopeId","data-v-69332928"]]);export{Cn as default};
|