@acedatacloud/nexior 3.18.3 → 3.18.5

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.
Files changed (122) hide show
  1. package/dist/assets/{Auth-CzcixykT.js → Auth-Duvpfexr.js} +1 -1
  2. package/dist/assets/{Callback-CSE8uPxg.js → Callback-Cb2CSgs1.js} +1 -1
  3. package/dist/assets/{Console-D_uIzUzV.js → Console-DPd5nJQ6.js} +1 -1
  4. package/dist/assets/{Conversation-BD-pEQBC.js → Conversation-CZ6CkO76.js} +2 -2
  5. package/dist/assets/{CopyToClipboard-BpQdSord.js → CopyToClipboard-RknI4LM3.js} +1 -1
  6. package/dist/assets/{Detail-CbWYHOCr.js → Detail-BfRjUWYa.js} +1 -1
  7. package/dist/assets/{EditArray-lHtZVOOu.js → EditArray-DqKEu71Y.js} +1 -1
  8. package/dist/assets/{Extra-pVW5c6XV.js → Extra-Cs_Ma2Mw.js} +1 -1
  9. package/dist/assets/{FilePreview-Dt3xp0eX.js → FilePreview-D0-PWvO0.js} +1 -1
  10. package/dist/assets/{History-DW-oiGaj.js → History-xjK6Z4vN.js} +1 -1
  11. package/dist/assets/{ImagePreview-CrYUOIUC.js → ImagePreview-TfSPkY4U.js} +1 -1
  12. package/dist/assets/{ImageWrapper-zDTGbuxw.js → ImageWrapper-Clo9Sn7r.js} +1 -1
  13. package/dist/assets/Index-B8qS_0St.css +1 -0
  14. package/dist/assets/{Index-CLepQdJJ.js → Index-BLnc2ujJ.js} +1 -1
  15. package/dist/assets/{Index-ByAIW91F.js → Index-BVgISA1_.js} +1 -1
  16. package/dist/assets/{Index-DyPnFJIN.js → Index-BpZ5e9uu.js} +1 -1
  17. package/dist/assets/{Index-2pRpyesT.js → Index-BujiG4ye.js} +1 -1
  18. package/dist/assets/{Index-CDpExJOG.js → Index-CRVLW8Rz.js} +1 -1
  19. package/dist/assets/{Index-C8OsfDu7.js → Index-CZKcMgt4.js} +1 -1
  20. package/dist/assets/{Index-CiFUMUAx.js → Index-D9A7f8cq.js} +1 -1
  21. package/dist/assets/{Index-8FLWxWA-.js → Index-D9g9sYNT.js} +1 -1
  22. package/dist/assets/{Index-BYywcnIO.js → Index-DRfg8BG9.js} +1 -1
  23. package/dist/assets/{Index-BOFYUBiX.js → Index-DX38myeD.js} +1 -1
  24. package/dist/assets/{Index-BPwNtPBg.js → Index-DlskCX9F.js} +1 -1
  25. package/dist/assets/Index-DxNWg66E.js +1 -0
  26. package/dist/assets/{Index-D8G5WNR5.js → Index-Dym5ulon.js} +1 -1
  27. package/dist/assets/{Index-Cyzpd0t6.js → Index-c3LJz0E-.js} +1 -1
  28. package/dist/assets/{InfoIcon-B-pWYpXf.js → InfoIcon-A1xDvxpg.js} +1 -1
  29. package/dist/assets/{Invitees-Dt7Fnk0e.js → Invitees-99jEJQ1p.js} +1 -1
  30. package/dist/assets/{List-C_ij7kQe.js → List-BSLNdDsT.js} +1 -1
  31. package/dist/assets/{List-FRRrWOZW.js → List-Dr9BZ1FU.js} +1 -1
  32. package/dist/assets/{List-BiCEhsPI.js → List-T1IZ-72o.js} +1 -1
  33. package/dist/assets/{Login-Cj5RU_pE.js → Login-B6h-oco1.js} +1 -1
  34. package/dist/assets/{Main-MHdxhFG7.js → Main-BYLLCBpR.js} +1 -1
  35. package/dist/assets/{Navigator-Cl2ghwtG.js → Navigator-B5ifBSsu.js} +1 -1
  36. package/dist/assets/{NoTasks-DhMwy0fW.js → NoTasks-Cdp8T7aA.js} +1 -1
  37. package/dist/assets/{Pagination-C_ZRHLn9.js → Pagination-jZo6ton8.js} +1 -1
  38. package/dist/assets/{Status-BCZox05X.js → Status-DTw3gKLP.js} +1 -1
  39. package/dist/assets/{Subscribe-Ctk8Wn-s.js → Subscribe-CuRG2X0f.js} +1 -1
  40. package/dist/assets/{VideoPlayer-CMoCOK-2.js → VideoPlayer-bQ9vkI39.js} +1 -1
  41. package/dist/assets/{_baseClone-3DUpUcA-.js → _baseClone-CSJOYRf5.js} +1 -1
  42. package/dist/assets/{_baseIteratee-C1JMkkjb.js → _baseIteratee-EXwBHC6D.js} +1 -1
  43. package/dist/assets/{_initCloneObject-BFc9nFj7.js → _initCloneObject-BcH86D07.js} +1 -1
  44. package/dist/assets/{castArray-Bx9N9ecv.js → castArray-DMPMSVhG.js} +1 -1
  45. package/dist/assets/{debounce-LQ3BUvW2.js → debounce--4Ey-UiG.js} +1 -1
  46. package/dist/assets/{distribution-Xv4VZz9h.js → distribution-CRIdn9R_.js} +1 -1
  47. package/dist/assets/{dropdown-fAdK4kJL.js → dropdown-e5HICCuH.js} +1 -1
  48. package/dist/assets/{index-CLU7Dxwr.js → index-6-cLyr4W.js} +1 -1
  49. package/dist/assets/{index-BcnUxXVu.js → index-BOWgmkBj.js} +1 -1
  50. package/dist/assets/{index-Dg8v7nzu.js → index-BQq3lXfU.js} +1 -1
  51. package/dist/assets/{index-DyaSHTbp.js → index-BT7WrUPB.js} +1 -1
  52. package/dist/assets/{index-Bes0kUIX.js → index-BTalZB4F.js} +1 -1
  53. package/dist/assets/{index-CpDN4u_Q.js → index-BUJDKI34.js} +1 -1
  54. package/dist/assets/{index-AzDMYUSd.js → index-BdcqrZwU.js} +1 -1
  55. package/dist/assets/{index-BApEDemr.js → index-Bg5mlWRY.js} +1 -1
  56. package/dist/assets/{index-DajaCXwQ.js → index-BgUK6CFV.js} +1 -1
  57. package/dist/assets/{index-eLWTVVTa.js → index-Bt9N_pkq.js} +1 -1
  58. package/dist/assets/{index-D1DrOds3.js → index-C-wmX7EI.js} +1 -1
  59. package/dist/assets/{index-Ci6MZJbr.js → index-C1ao7hiD.js} +1 -1
  60. package/dist/assets/{index-Bgf7pKqR.js → index-C_tipjVA.js} +1 -1
  61. package/dist/assets/{index-FG_9wygy.js → index-CeFYRj3z.js} +1 -1
  62. package/dist/assets/{index-DlZrIwQl.js → index-Cgvi9qKr.js} +9 -9
  63. package/dist/assets/{index-C78CVb4w.js → index-CvSpx81L.js} +1 -1
  64. package/dist/assets/{index-DioM38n8.js → index-D2hwZIWA.js} +1 -1
  65. package/dist/assets/{index-GAwF9ld_.js → index-D402UB4e.js} +1 -1
  66. package/dist/assets/{index-XbSV-0Kh.js → index-DG1ztSVj.js} +1 -1
  67. package/dist/assets/{index-BjPXuIrm.js → index-DNgFozYk.js} +1 -1
  68. package/dist/assets/{index-BwvM90rm.js → index-DTCoUzbs.js} +1 -1
  69. package/dist/assets/{index-9hqvEdxz.js → index-Df5a9WGp.js} +1 -1
  70. package/dist/assets/{index-DooLsoG5.js → index-Dr1yWI9s.js} +1 -1
  71. package/dist/assets/{index-C-kuWklD.js → index-Gj7AGill.js} +1 -1
  72. package/dist/assets/{index-C_Y9FdbX.js → index-GjQsR5KG.js} +1 -1
  73. package/dist/assets/{index-DFFGaF-m.js → index-I8eUQ22m.js} +1 -1
  74. package/dist/assets/{index-DQrPLSAi.js → index-VD3Emf8V.js} +1 -1
  75. package/dist/assets/{index-JR6VCEaW.js → index-qGVWSNsj.js} +1 -1
  76. package/dist/assets/{index-CITnANHC.js → index-spFFY5P2.js} +1 -1
  77. package/dist/assets/{index.es-DMKC3kSl.js → index.es-CIc56cl6.js} +1 -1
  78. package/dist/assets/{isEqual-DDj5e66m.js → isEqual-CNVV21LA.js} +1 -1
  79. package/dist/assets/{isPlainObject-qanlNx3E.js → isPlainObject-CBF1AW8-.js} +1 -1
  80. package/dist/assets/midjourney-B2bOgE1j.js +1 -0
  81. package/dist/assets/{midjourney-Cl5-scaP.js → midjourney-BBd3OIBk.js} +1 -1
  82. package/dist/assets/midjourney-BF_JrVvE.js +1 -0
  83. package/dist/assets/{midjourney-DZEhjPH8.js → midjourney-BWfqLBwH.js} +1 -1
  84. package/dist/assets/midjourney-Bhs_dRmV.js +1 -0
  85. package/dist/assets/midjourney-BxgfRLiq.js +1 -0
  86. package/dist/assets/midjourney-By1jqSWd.js +1 -0
  87. package/dist/assets/midjourney-ByOwuNuf.js +1 -0
  88. package/dist/assets/midjourney-CETW2Phw.js +1 -0
  89. package/dist/assets/midjourney-CHObw1mv.js +1 -0
  90. package/dist/assets/midjourney-C_L4ls4U.js +1 -0
  91. package/dist/assets/midjourney-CgRiDam8.js +1 -0
  92. package/dist/assets/midjourney-CllT1fEy.js +1 -0
  93. package/dist/assets/midjourney-Cm5Y2fTK.js +1 -0
  94. package/dist/assets/midjourney-DCrzdY44.js +1 -0
  95. package/dist/assets/midjourney-DELRXPWD.js +1 -0
  96. package/dist/assets/midjourney-DjRfty8I.js +1 -0
  97. package/dist/assets/midjourney-Djl917rg.js +1 -0
  98. package/dist/assets/{order-SS9PCE2P.js → order-hEvneraR.js} +1 -1
  99. package/dist/assets/{price-CopKH8wb.js → price-JcCbdpjd.js} +1 -1
  100. package/dist/assets/{strings-ClubiYVB.js → strings-CaFLJNhw.js} +1 -1
  101. package/dist/assets/{typescript-C7e2RhT_.js → typescript-BJQTyG9d.js} +1 -1
  102. package/dist/assets/{use-form-item-BrBRxl7V.js → use-form-item-tWhUsWWY.js} +1 -1
  103. package/dist/index.html +1 -1
  104. package/package.json +1 -1
  105. package/dist/assets/Index-C8CtYM9i.css +0 -1
  106. package/dist/assets/Index-DGFvS4Ef.js +0 -1
  107. package/dist/assets/midjourney-74-JTwvB.js +0 -1
  108. package/dist/assets/midjourney-BDo6kofj.js +0 -1
  109. package/dist/assets/midjourney-BHotNNlh.js +0 -1
  110. package/dist/assets/midjourney-CEbgOa2Y.js +0 -1
  111. package/dist/assets/midjourney-CHDYp3w8.js +0 -1
  112. package/dist/assets/midjourney-CKdpW_3z.js +0 -1
  113. package/dist/assets/midjourney-CYDiUNOG.js +0 -1
  114. package/dist/assets/midjourney-CaYCQpDc.js +0 -1
  115. package/dist/assets/midjourney-CeoTIpm9.js +0 -1
  116. package/dist/assets/midjourney-CrFDYpxb.js +0 -1
  117. package/dist/assets/midjourney-D1OsIHyH.js +0 -1
  118. package/dist/assets/midjourney-DLp_Jr3-.js +0 -1
  119. package/dist/assets/midjourney-UCP2SsDg.js +0 -1
  120. package/dist/assets/midjourney-XwtYTvQp.js +0 -1
  121. package/dist/assets/midjourney-YoX-ZqyJ.js +0 -1
  122. package/dist/assets/midjourney-zUXmCBUW.js +0 -1
@@ -1 +1 @@
1
- import{F as C}from"./index.es-DMKC3kSl.js";import{E as T}from"./index-JR6VCEaW.js";import{E as q}from"./index-DioM38n8.js";import{d as v,h as k,b as r,t as l,k as t,r as G,j as u,l as o,o as n,eq as K,x as i,F as I,v as L,i as y,er as H,es as J,et as Q,n as S,f as W,c6 as M,D as _,y as $,eu as X,ev as Y,dr as Z,dm as x}from"./index-DlZrIwQl.js";import{E as R,a as P}from"./index-BwvM90rm.js";import{I as U}from"./InfoIcon-B-pWYpXf.js";import{I as N}from"./ImagePreview-CrYUOIUC.js";import{E as F}from"./index-C78CVb4w.js";import{E as V}from"./index-DyaSHTbp.js";import{C as ee,B as te,N as oe}from"./NoTasks-DhMwy0fW.js";import{E as se,a as ne}from"./index-eLWTVVTa.js";import{E as O}from"./index-GAwF9ld_.js";import{a as ae}from"./price-CopKH8wb.js";import{C as le}from"./CopyToClipboard-BpQdSord.js";import{V as ie}from"./VideoPlayer-CMoCOK-2.js";import{E as re}from"./index-C-kuWklD.js";import{E as ce}from"./index-DajaCXwQ.js";import{E as de}from"./index-DQrPLSAi.js";import"./use-form-item-BrBRxl7V.js";import"./index-r5W6hzzQ.js";import"./index-DFFGaF-m.js";import"./typescript-C7e2RhT_.js";import"./index-Bes0kUIX.js";import"./strings-ClubiYVB.js";import"./castArray-Bx9N9ecv.js";import"./isEqual-DDj5e66m.js";import"./_initCloneObject-BFc9nFj7.js";import"./debounce-LQ3BUvW2.js";import"./_baseIteratee-C1JMkkjb.js";import"./index-BApEDemr.js";import"./index-D1DrOds3.js";import"./_baseClone-3DUpUcA-.js";import"./index-BcnUxXVu.js";import"./index-AzDMYUSd.js";import"./vue-plyr-QZFBikSk.js";const pe=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:T,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ue={class:"main"},me={class:"config"},fe={class:"result"};function ge(e,s,m,f,b,w){const c=o("font-awesome-icon"),d=o("el-button"),a=o("el-drawer");return n(),r("div",ue,[l("div",me,[G(e.$slots,"config",{},void 0,!0)]),l("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:s[0]||(s[0]=g=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=g=>e.drawer=g),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const _e=k(pe,[["render",ge],["__scopeId","data-v-babc1122"]]),he=v({name:"ModelSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"kling-v1",label:"v1"},{value:"kling-v1-5",label:"v1.5"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v2-1",label:"v2.1"},{value:"kling-v2-1-master",label:"v2.1-Master"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.model},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}},mounted(){this.value||(this.value=K)}}),$e={class:"field"},ve={class:"title font-bold"};function ke(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",$e,[l("h2",ve,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=k(he,[["render",ke],["__scopeId","data-v-4a40b66a"]]),we=v({name:"ModeSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"std",label:this.$t("kling.name.modeStd")},{value:"pro",label:this.$t("kling.name.modePro")}]}},computed:{value:{get(){return this.$store.state.kling?.config?.mode},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}},mounted(){this.value||(this.value=H)}}),ye={class:"field"},Ve={class:"title font-bold"};function Ee(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",ye,[l("h2",Ve,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=k(we,[["render",Ee],["__scopeId","data-v-daa57765"]]),Se=v({name:"DurationSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5秒"},{value:10,label:"10秒"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.duration},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}},mounted(){this.value||(this.value=J)}}),Ce={class:"field"},Te={class:"title font-bold"};function Le(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",Ce,[l("h2",Te,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=k(Se,[["render",Le],["__scopeId","data-v-02112e2c"]]),Ae=v({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug("set ratio",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=Q)}}),Ge={class:"text-sm font-bold mb-2 block"},Re={class:"items"},Pe=["onClick"],De={class:"name"};function je(e,s,m,f,b,w){return n(),r("div",null,[l("span",Ge,i(e.$t("kling.name.ratio")),1),l("div",Re,[(n(!0),r(I,null,L(e.options,(c,d)=>(n(),r("div",{key:d,class:S({active:e.active===d,item:!0}),onClick:a=>e.value=c.value},[l("div",{class:S(["preview",c.label])},[l("div",{class:"rect",style:W({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",De,i(c.label),1)],10,Pe))),128))])])}const Me=k(Ae,[["render",je],["__scopeId","data-v-2601284f"]]),Ne=v({name:"StartImage",components:{ElUpload:F,ElButton:T,InfoIcon:U,FontAwesomeIcon:C,ImagePreview:N},emits:["change"],data(){return{fileList:[],uploadUrl:M()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Fe={class:"relative"},Oe={class:"flex justify-between"},Be={class:"flex justify-start items-center"},ze={class:"text-sm font-bold"};function qe(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),a=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Fe,[l("div",Oe,[l("div",Be,[l("span",ze,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(a,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ke=k(Ne,[["render",qe],["__scopeId","data-v-e2205d5b"]]),He=v({name:"EndImage",components:{ElUpload:F,ElButton:T,ImagePreview:N,InfoIcon:U,FontAwesomeIcon:C},data(){return{fileList:[],uploadUrl:M()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Je={class:"relative"},Qe={class:"flex justify-between"},We={class:"flex justify-start items-center"},Xe={class:"text-sm font-bold"};function Ye(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),a=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Je,[l("div",Qe,[l("div",We,[l("span",Xe,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(a,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ze=k(He,[["render",Ye],["__scopeId","data-v-caf87d80"]]),xe=v({name:"CfgScaleSelector",components:{ElSlider:ne,InfoIcon:U,ElInputNumber:se},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug("set cfg_scale",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||(this.value=X)}}),et={class:"flex justify-between"},tt={class:"flex justify-start items-center"},ot={class:"text-sm font-bold"},st={class:"flex justify-end items-center"},nt={class:"w-full"};function at(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input-number"),a=o("el-slider");return n(),r("div",null,[l("div",et,[l("div",tt,[l("span",ot,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),l("div",st,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=g=>e.value=g),"controls-position":"right"},null,8,["modelValue"])])]),l("div",nt,[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 lt=k(xe,[["render",at]]),it="",rt=v({name:"PromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=it)}}),ct={class:"field"},dt={class:"box"},pt={class:"title font-bold"};function ut(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",ct,[l("div",dt,[l("h2",pt,i(e.$t("kling.name.prompt")),1),t(c,{content:e.$t("kling.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=a=>e.prompt=a),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const mt=k(rt,[["render",ut],["__scopeId","data-v-0e95dea6"]]),ft="",gt=v({name:"NegativePromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),_t={class:"field"},ht={class:"box"},$t={class:"title font-bold"};function vt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",_t,[l("div",ht,[l("h2",$t,i(e.$t("kling.name.negativePrompt")),1),t(c,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=a=>e.prompt=a),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const kt=k(gt,[["render",vt],["__scopeId","data-v-dfc5338b"]]),bt=v({name:"ConfigPanel",components:{ElButton:T,Consumption:ee,FontAwesomeIcon:C,PromptInput:mt,NegativePromptInput:kt,ModelSelector:be,ModeSelector:Ie,DurationSelector:Ue,RatioSelector:Me,StartImage:Ke,CfgScaleSelector:lt,EndImage:Ze},emits:["generate"],computed:{config(){return this.$store.state.kling?.config},consumption(){return ae(this.config,this.service?.metadata?.price)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),wt={class:"flex flex-col h-full"},yt={class:"flex-1 overflow-y-auto p-[15px]"},Vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Et(e,s,m,f,b,w){const c=o("prompt-input"),d=o("model-selector"),a=o("ratio-selector"),g=o("start-image"),h=o("end-image"),p=o("duration-selector"),E=o("mode-selector"),A=o("cfg-scale-selector"),B=o("negative-prompt-input"),z=o("consumption"),D=o("font-awesome-icon"),j=o("el-button");return n(),r("div",wt,[l("div",yt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(a,{class:"mb-4"}),t(g,{class:"mb-2"}),t(h,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"})]),l("div",Vt,[t(z,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(n(),y(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(n(),y(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])}const It=k(bt,[["render",Et]]),St=v({name:"TaskPreview",components:{ElImage:de,CopyToClipboard:le,FontAwesomeIcon:C,ElAlert:ce,VideoPlayer:ie,ElTooltip:re,ElButton:T},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Ct={class:"preview"},Tt={class:"left"},Lt={class:"main"},Ut={class:"bot"},At={class:"datetime"},Gt={class:"info"},Rt={key:0,class:"prompt mt-2"},Pt={key:0},Dt={key:1},jt={key:0,class:S({content:!0,failed:!0})},Mt={key:0,class:"mb-4"},Nt={key:1,class:S({operations:!0,"mt-2":!0})},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Bt={key:1,class:S({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Kt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ht={key:2,class:S({content:!0})},Jt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Qt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Wt(e,s,m,f,b,w){const c=o("el-image"),d=o("video-player"),a=o("el-button"),g=o("el-tooltip"),h=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Ct,[l("div",Tt,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),l("div",Lt,[l("div",Ut,[_(i(e.$t("kling.name.klingBot"))+" ",1),l("span",At,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Gt,[e.modelValue?.request?.prompt?(n(),r("p",Rt,[_(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),r("span",Pt," - ("+i(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(n(),r("span",Dt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),r("div",jt,[e.modelValue?.response.video_url?(n(),r("div",Mt,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),r("div",Nt,[t(g,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(a,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,e.modelValue?.response.video_url))},{default:u(()=>[_(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",Ft,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),l("p",Ot,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Bt,[t(E,{closable:!1,class:"failure"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[l("p",zt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),l("p",qt,[t(h,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("kling.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Kt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Ht,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[l("p",Jt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Qt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0)])])}const Xt=k(St,[["render",Wt],["__scopeId","data-v-c0a171a2"]]),Yt=v({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:oe,BotPlaceholder:te},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Zt={key:0},xt={key:1,class:"h-full w-full overflow-y-auto tasks"},eo={key:2,class:"w-full h-full flex items-center justify-center"};function to(e,s,m,f,b,w){const c=o("bot-placeholder"),d=o("task-preview"),a=o("no-tasks");return n(),r(I,null,[e.tasks?.items===void 0?(n(),r("div",Zt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",xt,[(n(!0),r(I,null,L(e.tasks?.items,g=>(n(),y(d,{key:g.id,"model-value":g},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",eo,[t(a)])):$("",!0)],64)}const oo=k(Yt,[["render",to]]),so="https://webhook.acedata.cloud/kling",no=v({name:"KlingIndex",components:{ConfigPanel:It,Layout:_e,RecentPanel:oo},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.kling?.status?.getApplications===x.Request},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("kling/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("kling/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:f}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",f),await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:m,createdAtMax:f})},async onGenerate(){const e={...this.config,callback_url:so},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),Y.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===Z?V.error(this.$t("kling.message.usedUp")):V.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ao(e,s,m,f,b,w){const c=o("config-panel"),d=o("recent-panel"),a=o("layout");return n(),y(a,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Bo=k(no,[["render",ao]]);export{Bo as default};
1
+ import{F as C}from"./index.es-CIc56cl6.js";import{E as T}from"./index-qGVWSNsj.js";import{E as q}from"./index-D2hwZIWA.js";import{d as v,h as k,b as r,t as l,k as t,r as G,j as u,l as o,o as n,es as K,x as i,F as I,v as L,i as y,et as H,eu as J,ev as Q,n as S,f as W,c6 as M,D as _,y as $,ew as X,ex as Y,dr as Z,dm as x}from"./index-Cgvi9qKr.js";import{E as R,a as P}from"./index-DTCoUzbs.js";import{I as U}from"./InfoIcon-A1xDvxpg.js";import{I as N}from"./ImagePreview-TfSPkY4U.js";import{E as F}from"./index-CvSpx81L.js";import{E as V}from"./index-BT7WrUPB.js";import{C as ee,B as te,N as oe}from"./NoTasks-Cdp8T7aA.js";import{E as se,a as ne}from"./index-Bt9N_pkq.js";import{E as O}from"./index-D402UB4e.js";import{a as ae}from"./price-JcCbdpjd.js";import{C as le}from"./CopyToClipboard-RknI4LM3.js";import{V as ie}from"./VideoPlayer-bQ9vkI39.js";import{E as re}from"./index-Gj7AGill.js";import{E as ce}from"./index-BgUK6CFV.js";import{E as de}from"./index-VD3Emf8V.js";import"./use-form-item-tWhUsWWY.js";import"./index-r5W6hzzQ.js";import"./index-I8eUQ22m.js";import"./typescript-BJQTyG9d.js";import"./index-BTalZB4F.js";import"./strings-CaFLJNhw.js";import"./castArray-DMPMSVhG.js";import"./isEqual-CNVV21LA.js";import"./_initCloneObject-BcH86D07.js";import"./debounce--4Ey-UiG.js";import"./_baseIteratee-EXwBHC6D.js";import"./index-Bg5mlWRY.js";import"./index-C-wmX7EI.js";import"./_baseClone-CSJOYRf5.js";import"./index-BOWgmkBj.js";import"./index-BdcqrZwU.js";import"./vue-plyr-QZFBikSk.js";const pe=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:T,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ue={class:"main"},me={class:"config"},fe={class:"result"};function ge(e,s,m,f,b,w){const c=o("font-awesome-icon"),d=o("el-button"),a=o("el-drawer");return n(),r("div",ue,[l("div",me,[G(e.$slots,"config",{},void 0,!0)]),l("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:s[0]||(s[0]=g=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=g=>e.drawer=g),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const _e=k(pe,[["render",ge],["__scopeId","data-v-babc1122"]]),he=v({name:"ModelSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"kling-v1",label:"v1"},{value:"kling-v1-5",label:"v1.5"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v2-1",label:"v2.1"},{value:"kling-v2-1-master",label:"v2.1-Master"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.model},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}},mounted(){this.value||(this.value=K)}}),$e={class:"field"},ve={class:"title font-bold"};function ke(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",$e,[l("h2",ve,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=k(he,[["render",ke],["__scopeId","data-v-4a40b66a"]]),we=v({name:"ModeSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"std",label:this.$t("kling.name.modeStd")},{value:"pro",label:this.$t("kling.name.modePro")}]}},computed:{value:{get(){return this.$store.state.kling?.config?.mode},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}},mounted(){this.value||(this.value=H)}}),ye={class:"field"},Ve={class:"title font-bold"};function Ee(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",ye,[l("h2",Ve,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=k(we,[["render",Ee],["__scopeId","data-v-daa57765"]]),Se=v({name:"DurationSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5秒"},{value:10,label:"10秒"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.duration},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}},mounted(){this.value||(this.value=J)}}),Ce={class:"field"},Te={class:"title font-bold"};function Le(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",Ce,[l("h2",Te,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=k(Se,[["render",Le],["__scopeId","data-v-02112e2c"]]),Ae=v({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug("set ratio",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=Q)}}),Ge={class:"text-sm font-bold mb-2 block"},Re={class:"items"},Pe=["onClick"],De={class:"name"};function je(e,s,m,f,b,w){return n(),r("div",null,[l("span",Ge,i(e.$t("kling.name.ratio")),1),l("div",Re,[(n(!0),r(I,null,L(e.options,(c,d)=>(n(),r("div",{key:d,class:S({active:e.active===d,item:!0}),onClick:a=>e.value=c.value},[l("div",{class:S(["preview",c.label])},[l("div",{class:"rect",style:W({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",De,i(c.label),1)],10,Pe))),128))])])}const Me=k(Ae,[["render",je],["__scopeId","data-v-2601284f"]]),Ne=v({name:"StartImage",components:{ElUpload:F,ElButton:T,InfoIcon:U,FontAwesomeIcon:C,ImagePreview:N},emits:["change"],data(){return{fileList:[],uploadUrl:M()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Fe={class:"relative"},Oe={class:"flex justify-between"},Be={class:"flex justify-start items-center"},ze={class:"text-sm font-bold"};function qe(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),a=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Fe,[l("div",Oe,[l("div",Be,[l("span",ze,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(a,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ke=k(Ne,[["render",qe],["__scopeId","data-v-e2205d5b"]]),He=v({name:"EndImage",components:{ElUpload:F,ElButton:T,ImagePreview:N,InfoIcon:U,FontAwesomeIcon:C},data(){return{fileList:[],uploadUrl:M()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Je={class:"relative"},Qe={class:"flex justify-between"},We={class:"flex justify-start items-center"},Xe={class:"text-sm font-bold"};function Ye(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),a=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Je,[l("div",Qe,[l("div",We,[l("span",Xe,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(a,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ze=k(He,[["render",Ye],["__scopeId","data-v-caf87d80"]]),xe=v({name:"CfgScaleSelector",components:{ElSlider:ne,InfoIcon:U,ElInputNumber:se},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug("set cfg_scale",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||(this.value=X)}}),et={class:"flex justify-between"},tt={class:"flex justify-start items-center"},ot={class:"text-sm font-bold"},st={class:"flex justify-end items-center"},nt={class:"w-full"};function at(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input-number"),a=o("el-slider");return n(),r("div",null,[l("div",et,[l("div",tt,[l("span",ot,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),l("div",st,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=g=>e.value=g),"controls-position":"right"},null,8,["modelValue"])])]),l("div",nt,[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 lt=k(xe,[["render",at]]),it="",rt=v({name:"PromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=it)}}),ct={class:"field"},dt={class:"box"},pt={class:"title font-bold"};function ut(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",ct,[l("div",dt,[l("h2",pt,i(e.$t("kling.name.prompt")),1),t(c,{content:e.$t("kling.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=a=>e.prompt=a),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const mt=k(rt,[["render",ut],["__scopeId","data-v-0e95dea6"]]),ft="",gt=v({name:"NegativePromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),_t={class:"field"},ht={class:"box"},$t={class:"title font-bold"};function vt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",_t,[l("div",ht,[l("h2",$t,i(e.$t("kling.name.negativePrompt")),1),t(c,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=a=>e.prompt=a),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const kt=k(gt,[["render",vt],["__scopeId","data-v-dfc5338b"]]),bt=v({name:"ConfigPanel",components:{ElButton:T,Consumption:ee,FontAwesomeIcon:C,PromptInput:mt,NegativePromptInput:kt,ModelSelector:be,ModeSelector:Ie,DurationSelector:Ue,RatioSelector:Me,StartImage:Ke,CfgScaleSelector:lt,EndImage:Ze},emits:["generate"],computed:{config(){return this.$store.state.kling?.config},consumption(){return ae(this.config,this.service?.metadata?.price)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),wt={class:"flex flex-col h-full"},yt={class:"flex-1 overflow-y-auto p-[15px]"},Vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Et(e,s,m,f,b,w){const c=o("prompt-input"),d=o("model-selector"),a=o("ratio-selector"),g=o("start-image"),h=o("end-image"),p=o("duration-selector"),E=o("mode-selector"),A=o("cfg-scale-selector"),B=o("negative-prompt-input"),z=o("consumption"),D=o("font-awesome-icon"),j=o("el-button");return n(),r("div",wt,[l("div",yt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(a,{class:"mb-4"}),t(g,{class:"mb-2"}),t(h,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"})]),l("div",Vt,[t(z,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(n(),y(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(n(),y(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])}const It=k(bt,[["render",Et]]),St=v({name:"TaskPreview",components:{ElImage:de,CopyToClipboard:le,FontAwesomeIcon:C,ElAlert:ce,VideoPlayer:ie,ElTooltip:re,ElButton:T},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Ct={class:"preview"},Tt={class:"left"},Lt={class:"main"},Ut={class:"bot"},At={class:"datetime"},Gt={class:"info"},Rt={key:0,class:"prompt mt-2"},Pt={key:0},Dt={key:1},jt={key:0,class:S({content:!0,failed:!0})},Mt={key:0,class:"mb-4"},Nt={key:1,class:S({operations:!0,"mt-2":!0})},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Bt={key:1,class:S({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Kt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ht={key:2,class:S({content:!0})},Jt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Qt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Wt(e,s,m,f,b,w){const c=o("el-image"),d=o("video-player"),a=o("el-button"),g=o("el-tooltip"),h=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Ct,[l("div",Tt,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),l("div",Lt,[l("div",Ut,[_(i(e.$t("kling.name.klingBot"))+" ",1),l("span",At,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Gt,[e.modelValue?.request?.prompt?(n(),r("p",Rt,[_(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),r("span",Pt," - ("+i(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(n(),r("span",Dt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),r("div",jt,[e.modelValue?.response.video_url?(n(),r("div",Mt,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),r("div",Nt,[t(g,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(a,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,e.modelValue?.response.video_url))},{default:u(()=>[_(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",Ft,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),l("p",Ot,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Bt,[t(E,{closable:!1,class:"failure"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[l("p",zt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),l("p",qt,[t(h,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("kling.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Kt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Ht,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[l("p",Jt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Qt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0)])])}const Xt=k(St,[["render",Wt],["__scopeId","data-v-c0a171a2"]]),Yt=v({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:oe,BotPlaceholder:te},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Zt={key:0},xt={key:1,class:"h-full w-full overflow-y-auto tasks"},eo={key:2,class:"w-full h-full flex items-center justify-center"};function to(e,s,m,f,b,w){const c=o("bot-placeholder"),d=o("task-preview"),a=o("no-tasks");return n(),r(I,null,[e.tasks?.items===void 0?(n(),r("div",Zt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",xt,[(n(!0),r(I,null,L(e.tasks?.items,g=>(n(),y(d,{key:g.id,"model-value":g},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",eo,[t(a)])):$("",!0)],64)}const oo=k(Yt,[["render",to]]),so="https://webhook.acedata.cloud/kling",no=v({name:"KlingIndex",components:{ConfigPanel:It,Layout:_e,RecentPanel:oo},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.kling?.status?.getApplications===x.Request},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("kling/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("kling/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:f}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",f),await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:m,createdAtMax:f})},async onGenerate(){const e={...this.config,callback_url:so},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),Y.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===Z?V.error(this.$t("kling.message.usedUp")):V.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ao(e,s,m,f,b,w){const c=o("config-panel"),d=o("recent-panel"),a=o("layout");return n(),y(a,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Bo=k(no,[["render",ao]]);export{Bo as default};
@@ -1 +1 @@
1
- import{F as H}from"./index.es-DMKC3kSl.js";import{E as K}from"./index-JR6VCEaW.js";import{E as de}from"./index-DioM38n8.js";import{aj as pe,ap as me,bI as he,ak as ae,c9 as fe,_ as _e,d as b,a as $e,al as ge,c as F,bh as ve,bn as ye,aw as le,b as f,o as l,i as w,r as U,f as oe,e as j,j as g,b8 as re,E as R,n as ke,g as we,h as E,t as r,k as n,l as c,eN as se,x as $,F as W,v as Q,eO as q,c6 as be,D as I,eP as Y,eQ as x,y as k,J as Z,cN as ee,eR as O,bR as Ce,dm as B,ah as P,eS as D,an as Se,K as Ae,eT as Le,de as Ee,dl as je}from"./index-DlZrIwQl.js";import{E as ce}from"./index-C_Y9FdbX.js";import{E as Ve,a as Fe}from"./index-BwvM90rm.js";import{I as G}from"./InfoIcon-B-pWYpXf.js";import{E as Te}from"./index-C78CVb4w.js";import{E as L}from"./index-DyaSHTbp.js";import{E as X}from"./index-GAwF9ld_.js";import{E as Pe,a as ue}from"./index-eLWTVVTa.js";import{E as J}from"./index-DQrPLSAi.js";import{C as Ie,N as Ue,B as ze}from"./NoTasks-DhMwy0fW.js";import{a as Re}from"./price-CopKH8wb.js";import{E as De,a as Ge,b as Me}from"./index-Dg8v7nzu.js";import{E as Oe}from"./index-C-kuWklD.js";import{E as Be}from"./index-Ci6MZJbr.js";import"./use-form-item-BrBRxl7V.js";import"./index-r5W6hzzQ.js";import"./index-Bes0kUIX.js";import"./index-DFFGaF-m.js";import"./typescript-C7e2RhT_.js";import"./strings-ClubiYVB.js";import"./castArray-Bx9N9ecv.js";import"./isEqual-DDj5e66m.js";import"./_initCloneObject-BFc9nFj7.js";import"./debounce-LQ3BUvW2.js";import"./_baseIteratee-C1JMkkjb.js";import"./index-BApEDemr.js";import"./index-D1DrOds3.js";import"./_baseClone-3DUpUcA-.js";import"./index-AzDMYUSd.js";import"./index-BcnUxXVu.js";import"./dropdown-fAdK4kJL.js";const Ne=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ae(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},qe=b({name:"ElAvatar"}),He=b({...qe,props:Ne,emits:We,setup(e,{emit:t}){const i=e,o=$e("avatar"),a=ge(!1),u=F(()=>{const{size:s,icon:p,shape:y}=i,_=[o.b()];return ve(s)&&_.push(o.m(s)),p&&_.push(o.m("icon")),y&&_.push(o.m(y)),_}),d=F(()=>{const{size:s}=i;return ae(s)?o.cssVarBlock({size:ye(s)||""}):void 0}),m=F(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function h(s){a.value=!0,t("error",s)}return(s,p)=>(l(),f("span",{class:ke(j(u)),style:oe(j(d))},[(s.src||s.srcSet)&&!a.value?(l(),f("img",{key:0,src:s.src,alt:s.alt,srcset:s.srcSet,style:oe(j(m)),onError:h},null,44,["src","alt","srcset"])):s.icon?(l(),w(j(R),{key:1},{default:g(()=>[(l(),w(re(s.icon)))]),_:1})):U(s.$slots,"default",{key:2})],6))}});var Ke=_e(He,[["__file","avatar.vue"]]);const Ze=we(Ke),Xe=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:K,FontAwesomeIcon:H},data(){return{drawer:!1,preview:!1}},computed:{}}),Je={class:"main"},Qe={class:"config"},Ye={class:"result"},xe={class:"preview"};function et(e,t,i,o,a,u){const d=c("font-awesome-icon"),m=c("el-button"),h=c("el-drawer");return l(),f("div",Je,[r("div",Qe,[U(e.$slots,"config",{},void 0,!0)]),r("div",Ye,[U(e.$slots,"result",{},void 0,!0)]),r("div",xe,[U(e.$slots,"preview",{},void 0,!0)]),n(m,{circle:"",class:"menu",onClick:t[0]||(t[0]=s=>e.drawer=!0)},{default:g(()=>[n(d,{icon:"fa-solid fa-magic"})]),_:1}),n(h,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=s=>e.drawer=s),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:g(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const tt=E(Xe,[["render",et],["__scopeId","data-v-c954d282"]]),ot=b({name:"VersionSelector",components:{ElSelect:Fe,ElOption:Ve,ElSwitch:ce},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},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)}}),st={class:"field"},nt={class:"title font-bold"};function it(e,t,i,o,a,u){const d=c("el-switch"),m=c("el-option"),h=c("el-select");return l(),f("div",st,[r("h2",nt,$(e.$t("suno.name.type")),1),n(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=s=>e.custom=s),class:"value"},null,8,["modelValue"]),n(h,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=s=>e.model=s),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:g(()=>[(l(!0),f(W,null,Q(e.options,s=>(l(),w(m,{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const at=E(ot,[["render",it],["__scopeId","data-v-5a66a01f"]]),lt=b({name:"UploadAudio",components:{ElUpload:Te,ElButton:K,InfoIcon:G,FontAwesomeIcon:H},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}L.info(this.$t("suno.message.startingUploadAudio")),q.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const a=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:a,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{L.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),rt={class:"relative"},ct={class:"flex justify-between"},ut={class:"flex justify-start items-center"},dt={class:"text-sm font-bold"};function pt(e,t,i,o,a,u){const d=c("info-icon"),m=c("font-awesome-icon"),h=c("el-button"),s=c("el-upload");return l(),f("div",rt,[r("div",ct,[r("div",ut,[r("span",dt,$(e.$t("suno.name.referenceAudios")),1),n(d,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),n(s,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=p=>e.fileList=p),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:g(()=>[n(h,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:g(()=>[n(m,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+$(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const mt=E(lt,[["render",pt],["__scopeId","data-v-6236152c"]]),ht="",ft=b({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:G},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ht)}}),_t={class:"field"},$t={class:"box"},gt={class:"title-info"},vt={class:"title font-bold"},yt={class:"instrumental"},kt={class:"title inline-block"};function wt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-switch"),h=c("el-input");return l(),f("div",_t,[r("div",$t,[r("div",gt,[r("h2",vt,$(e.$t("suno.name.prompt")),1),n(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",yt,[n(m,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=s=>e.instrumental=s),class:"value mr-2"},null,8,["modelValue"]),r("h2",kt,$(e.$t("suno.name.instrumental")),1)])]),n(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=s=>e.prompt=s),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const bt=E(ft,[["render",wt],["__scopeId","data-v-d7004a7c"]]),Ct="",St=b({name:"LyricInput",components:{ElInput:X,InfoIcon:G},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=Ct)}}),At={class:"field"},Lt={class:"box"},Et={class:"title font-bold"};function jt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),f("div",At,[r("div",Lt,[r("h2",Et,$(e.$t("suno.name.lyrics")),1),n(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),w(m,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(m,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Vt=E(St,[["render",jt],["__scopeId","data-v-99dfded8"]]),Ft=b({name:"StyleInput",components:{ElInput:X,InfoIcon:G},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}}}),Tt={class:"field"},Pt={class:"title-container"},It={class:"titlefont-bold"};function Ut(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),f("div",Tt,[r("div",Pt,[r("h2",It,$(e.$t("suno.name.style")),1),n(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),n(m,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=h=>e.style=h),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const zt=E(Ft,[["render",Ut],["__scopeId","data-v-85bbfcaa"]]),Rt=b({name:"TitleInput",components:{ElInput:X,InfoIcon:G},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})}}}}),Dt={class:"field"},Gt={class:"title-container"},Mt={class:"title font-bold"};function Ot(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),f("div",Dt,[r("div",Gt,[r("h2",Mt,$(e.$t("suno.name.title")),1),n(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),n(m,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=h=>e.title=h),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Bt=E(Rt,[["render",Ot],["__scopeId","data-v-ce70fe34"]]);function z(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const Nt=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:R,ElInputNumber:Pe,VideoPlay:x,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:z,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"},qt={class:"box"},Ht={class:"title font-bold"},Kt={class:"input-wrapper"},Zt={class:"task"},Xt={class:"left"},Jt={key:2,class:"duration"},Qt={class:"info"},Yt={class:"title"},xt={class:"style"};function eo(e,t,i,o,a,u){const d=c("el-input-number"),m=c("el-image"),h=c("video-pause"),s=c("el-icon"),p=c("video-play"),y=ee("loading");return l(),f("div",Wt,[r("div",qt,[r("h2",Ht,$(e.$t("suno.name.extend")),1),r("div",Kt,[n(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=_=>e.value=_),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),r("div",Zt,[e.audio?(l(),f("div",{key:0,class:"audio",onClick:t[3]||(t[3]=_=>e.onClick(e.audio))},[Z((l(),f("div",Xt,[n(m,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),f("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=_=>e.onPause(e.audio))},[n(s,null,{default:g(()=>[n(h)]),_:1})])):k("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),f("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=_=>e.onPlay(e.audio))},[n(s,null,{default:g(()=>[n(p)]),_:1})])):k("",!0),e.audio?.duration?(l(),f("div",Jt,$(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[y,!e.audio?.audio_url]]),r("div",Qt,[r("h2",Yt,$(e.audio?.title),1),r("p",xt,$(e.audio?.style),1)])])):k("",!0)])])}const to=E(Nt,[["render",eo],["__scopeId","data-v-bcce4821"]]),oo=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:R,VideoPlay:x,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:z,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})}}}),so={class:"field"},no={class:"box"},io={class:"title font-bold"},ao={class:"task"},lo={class:"left"},ro={key:2,class:"duration"},co={class:"info"},uo={class:"title"},po={class:"style"};function mo(e,t,i,o,a,u){const d=c("el-image"),m=c("video-pause"),h=c("el-icon"),s=c("video-play"),p=ee("loading");return l(),f("div",so,[r("div",no,[r("h2",io,$(e.$t("suno.name.cover")),1)]),r("div",ao,[e.audio?(l(),f("div",{key:0,class:"audio",onClick:t[2]||(t[2]=y=>e.onClick(e.audio))},[Z((l(),f("div",lo,[n(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),f("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=y=>e.onPause(e.audio))},[n(h,null,{default:g(()=>[n(m)]),_:1})])):k("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),f("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPlay(e.audio))},[n(h,null,{default:g(()=>[n(s)]),_:1})])):k("",!0),e.audio?.duration?(l(),f("div",ro,$(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[p,!e.audio?.audio_url]]),r("div",co,[r("h2",uo,$(e.audio?.title),1),r("p",po,$(e.audio?.style),1)])])):k("",!0)])])}const ho=E(oo,[["render",mo],["__scopeId","data-v-06640216"]]),fo=b({name:"PresetPanel",components:{TypeSelector:at,PromptInput:bt,LyricInput:Vt,StyleInput:zt,TitleInput:Bt,ExtendFromInput:to,CoverFromInput:ho,UploadAudio:mt,FontAwesomeIcon:H,ElButton:K,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Re(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),_o={class:"flex flex-col h-full"},$o={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function vo(e,t,i,o,a,u){const d=c("type-selector"),m=c("upload-audio"),h=c("prompt-input"),s=c("lyric-input"),p=c("style-input"),y=c("title-input"),_=c("extend-from-input"),C=c("cover-from-input"),V=c("consumption"),T=c("font-awesome-icon"),A=c("el-button");return l(),f("div",_o,[r("div",$o,[n(d,{class:"mb-4"}),n(m,{class:"mb-4"}),e.config?.custom?k("",!0):(l(),w(h,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(s,{key:1,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(p,{key:2,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(y,{key:3,class:"mb-4"})):k("",!0),e.config?.action==="extend"?(l(),w(_,{key:4,class:"mb-4"})):k("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):k("",!0)]),r("div",go,[n(V,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[n(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[n(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const yo=E(fo,[["render",vo],["__scopeId","data-v-b9fab929"]]);var N={exports:{}},ko=N.exports,ne;function wo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(ko,function(){function i(s,p){return typeof p>"u"?p={autoBom:!1}:typeof p!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),p={autoBom:!p}),p.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(s.type)?new Blob(["\uFEFF",s],{type:s.type}):s}function o(s,p,y){var _=new XMLHttpRequest;_.open("GET",s),_.responseType="blob",_.onload=function(){h(_.response,p,y)},_.onerror=function(){console.error("could not download file")},_.send()}function a(s){var p=new XMLHttpRequest;p.open("HEAD",s,!1);try{p.send()}catch{}return 200<=p.status&&299>=p.status}function u(s){try{s.dispatchEvent(new MouseEvent("click"))}catch{var p=document.createEvent("MouseEvents");p.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),s.dispatchEvent(p)}}var d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,m=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),h=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!m?function(s,p,y){var _=d.URL||d.webkitURL,C=document.createElement("a");p=p||s.name||"download",C.download=p,C.rel="noopener",typeof s=="string"?(C.href=s,C.origin===location.origin?u(C):a(C.href)?o(s,p,y):u(C,C.target="_blank")):(C.href=_.createObjectURL(s),setTimeout(function(){_.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(s,p,y){if(p=p||s.name||"download",typeof s!="string")navigator.msSaveOrOpenBlob(i(s,y),p);else if(a(s))o(s,p,y);else{var _=document.createElement("a");_.href=s,_.target="_blank",setTimeout(function(){u(_)})}}:function(s,p,y,_){if(_=_||open("","_blank"),_&&(_.document.title=_.document.body.innerText="downloading..."),typeof s=="string")return o(s,p,y);var C=s.type==="application/octet-stream",V=/constructor/i.test(d.HTMLElement)||d.safari,T=/CriOS\/[\d]+/.test(navigator.userAgent);if((T||C&&V||m)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var S=A.result;S=T?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),_?_.location.href=S:location=S,_=null},A.readAsDataURL(s)}else{var M=d.URL||d.webkitURL,v=M.createObjectURL(s);_?_.location=v:location.href=v,_=null,setTimeout(function(){M.revokeObjectURL(v)},4e4)}});d.saveAs=h.saveAs=h,e.exports=h})}(N)),N.exports}var bo=wo();const Co="https://webhook.acedata.cloud/suno",So=b({name:"TaskPreview",components:{ElImage:J,ElIcon:R,ElTooltip:Oe,ElButton:K,FontAwesomeIcon:H,VideoPlay:x,VideoPause:Y,ElDropdown:Me,ElDropdownMenu:Ge,ElDropdownItem:De,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},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(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(i=>({...i,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:z,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{bo.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),L.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}q.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:Co},o=this.credential?.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),q.audio(i,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{L.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Ao={class:"task"},Lo=["onClick"],Eo={class:"left"},jo=["onClick"],Vo=["onClick"],Fo={key:2,class:"duration"},To={class:"info"},Po={class:"title"},Io={class:"style"},Uo={class:"right"},zo={class:"el-dropdown-link"},Ro={class:"flex items-center min-w-[120px]"},Do={class:"el-dropdown-link"};function Go(e,t,i,o,a,u){const d=c("el-image"),m=c("video-pause"),h=c("el-icon"),s=c("video-play"),p=c("el-button"),y=c("font-awesome-icon"),_=c("el-tooltip"),C=c("Loading"),V=c("el-dropdown-item"),T=c("el-dropdown-menu"),A=c("el-dropdown"),M=ee("loading");return l(),f("div",Ao,[(l(!0),f(W,null,Q(e.audios,v=>(l(),f("div",{key:v.id,class:"audio",onClick:P(S=>e.onClick(v),["stop"])},[Z((l(),f("div",Eo,[n(d,{src:v?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),v?.audio_url&&e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),f("div",{key:0,class:"overlay",onClick:P(S=>e.onPause(v),["stop"])},[n(h,null,{default:g(()=>[n(m)]),_:1})],8,jo)):k("",!0),v?.audio_url&&(e.$store.state?.suno?.audio?.id!==v.id||e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),f("div",{key:1,class:"overlay",onClick:P(S=>e.onPlay(v),["stop"])},[n(h,null,{default:g(()=>[n(s)]),_:1})],8,Vo)):k("",!0),v?.duration?(l(),f("div",Fo,$(e.useFormatDuring(v?.duration)),1)):k("",!0)])),[[M,!v?.audio_url]]),r("div",To,[r("h2",Po,$(v?.title),1),r("p",Io,$(v?.style),1)]),r("div",Uo,[v?.audio_url?(l(),w(p,{key:0,size:"small",round:"",onClick:P(S=>e.onExtend(S,v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):k("",!0),n(A,null,{dropdown:g(()=>[n(T,null,{default:g(()=>[n(V,{disabled:e.isFetchingVideoUrl,onClick:S=>e.handleVideoDownload(v)},{default:g(()=>[r("div",Ro,[e.isFetchingVideoUrl?(l(),w(h,{key:0,class:"is-loading mr-2"},{default:g(()=>[n(C)]),_:1})):k("",!0),r("span",null,$(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),v?.audio_url?(l(),w(V,{key:0,onClick:P(S=>e.onDownload(S,v?.audio_url),["stop"])},{default:g(()=>[I($(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:g(()=>[r("span",zo,[n(_,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024),n(A,null,{dropdown:g(()=>[n(T,null,{default:g(()=>[v.id?(l(),w(V,{key:0,onClick:P(S=>e.onGetStems(v.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):k("",!0),n(V,{onClick:P(S=>e.onCover(v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),v?.id&&v?.action==="extend"?(l(),w(V,{key:1,onClick:P(S=>e.onConcatMusic(v?.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:g(()=>[r("span",Do,[n(_,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Lo))),128))])}const Mo=E(So,[["render",Go]]),Oo={class:"player-slider"},Bo=b({__name:"PlayerSlider",setup(e){const t=D(),i=F({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=F({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),a=()=>{},u=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,m)=>(l(),f("div",Oo,[n(j(ue),{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=h=>i.value=h),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),No="/assets/disk-XFRmVAfp.png",Wo={class:"flex player-song"},qo=["src"],Ho={class:"ml-2 text-xs flex flex-col justify-between"},Ko={class:"w-52 2xl:w-96 cursor-pointer truncate"},Zo={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=b({__name:"PlayerSong",setup(e){const t=D(),i=F({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),f("div",Wo,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||j(No)},null,8,qo),r("div",Ho,[r("div",Ko,[r("div",Zo,[r("span",null,$(i.value?.title||"Music"),1),r("span",Xo,"- "+$(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Qo={class:"flex justify-end items-center gap-x-2.5"},Yo={class:"text-xs"},xo=b({__name:"PlayerAction",setup(e){const t=D(),i=F({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=F({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),f("div",Qo,[r("span",Yo,$(j(z)(i.value))+" / "+$(j(z)(o.value)),1)]))}});var es={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function ts(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function os(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:a,id:e}}var ss=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=ts(),m=Se(ss,es);return function(){var h=u.size,s=u.strokeWidth,p=u.strokeLinecap,y=u.strokeLinejoin,_=u.theme,C=u.fill,V=u.spin,T=os(d,{size:h,strokeWidth:s,strokeLinecap:p,strokeLinejoin:y,theme:_,fill:C},m),A=[m.prefix+"-icon"];return A.push(m.prefix+"-icon-"+e),t&&m.rtl&&A.push(m.prefix+"-icon-rtl"),V&&A.push(m.prefix+"-icon-spin"),n("span",{class:A.join(" ")},[i(T)])}}};return o}const ns=te("pause-one",!1,function(e){return n("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[n("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),n("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),n("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),is=te("play",!0,function(e){return n("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[n("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),n("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),as=te("volume-small",!0,function(e){return n("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[n("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),n("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ie=b({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),w(re(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),ls={class:"player-volume flex flex-col items-center pt-2"},rs={class:"text-sm mt-3"},cs=b({__name:"PlayerVolumeSlider",setup(e){const t=D(),i=F({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=F({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),f("div",ls,[n(j(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=m=>i.value=m),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",rs,$(i.value),1)]))}}),us={class:"flex items-center justify-center gap-x-3"},ds=b({__name:"PlayerController",setup(e){const t=D(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=F(()=>t.state.suno.audio);return(a,u)=>(l(),f("div",us,[n(ie,{icon:o.value?.state==="playing"?j(ns):j(is),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),n(j(Be),{placement:"top",width:"50px",trigger:"click"},{reference:g(()=>[n(ie,{icon:j(as),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:g(()=>[n(cs)]),_:1})]))}}),ps={class:"flex flex-col items-stretch h-20"},ms={class:"flex grow px-5 items-center"},hs={class:"flex-1"},fs={class:"flex-1"},_s={class:"flex-1"},$s=b({__name:"Player",setup(e){return(t,i)=>(l(),f("div",ps,[n(Bo),r("div",ms,[r("div",hs,[n(Jo)]),r("div",fs,[n(ds)]),r("div",_s,[n(xo)])])]))}}),gs=b({name:"RecentPanel",components:{BotPlaceholder:ze,TaskPreview:Mo,Player:$s,NoTasks:Ue},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),vs={key:0,class:"tasks"},ys={key:2,class:"w-full flex-1 flex items-center justify-center"},ks={class:"h-20"};function ws(e,t,i,o,a,u){const d=c("bot-placeholder"),m=c("task-preview"),h=c("no-tasks"),s=c("player");return l(),f(W,null,[e.tasks?.items===void 0?(l(),f("div",vs,[n(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),f("div",{key:1,class:"flex-1 w-full overflow-y-auto tasks p-2",onScroll:t[0]||(t[0]=(...p)=>e.onHandleScroll&&e.onHandleScroll(...p))},[(l(!0),f(W,null,Q(e.tasks?.items,(p,y)=>(l(),w(m,{key:y,"model-value":p,class:"preview"},null,8,["model-value"]))),128))],32)):k("",!0),e.tasks?.items?.length===0?(l(),f("div",ys,[n(h)])):k("",!0),Z(r("div",ks,[n(s)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const bs=E(gs,[["render",ws]]),Cs=b({name:"TaskPreview",components:{IconPicture:Le,ElImage:J,ElAvatar:Ze,ElIcon:R},computed:{audio(){return this.$store.state.suno?.audio}}}),Ss={key:0,class:"size-full overflow-hidden"},As={class:"relative h-[300px]"},Ls={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Es={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},js={class:"p-4"},Vs={class:"flex items-center font-bold mb-2"},Fs={class:"text-[var(--el-text-color-regular)] mb-2"},Ts={class:"text-xs text-[var(--el-text-color-regular)]"},Ps={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Is={key:1,class:"w-full h-full bg-gradient-to-b from-gray-200 to-gray-300"};function Us(e,t,i,o,a,u){const d=c("icon-picture"),m=c("el-icon"),h=c("el-image"),s=c("el-avatar");return e.audio?.object?(l(),f("div",Ss,[r("div",As,[n(h,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:g(()=>[r("div",Ls,[n(m,{class:"text-3xl"},{default:g(()=>[n(d)]),_:1})])]),_:1},8,["src"]),r("h2",Es,$(e.audio?.title),1)]),r("div",js,[r("div",Vs,[n(s,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,$(e.audio?.title),1)]),r("p",Fs,$(e.audio?.style),1),r("p",Ts,$(e.$dayjs.format(e.audio?.created_at)),1),r("div",Ps,[r("p",null,$(e.audio?.lyric),1)])])])):(l(),f("div",Is))}const zs=E(Cs,[["render",Us]]),Rs="https://webhook.acedata.cloud/suno",Ds=b({name:"SunoIndex",components:{Layout:tt,ConfigPanel:yo,RecentPanel:bs,PreviewPanel:zs},inject:["initialized"],data(){return{task:void 0,job: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},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ee.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===je&&L.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Rs},t=this.credential?.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),q.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{L.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Gs(e,t,i,o,a,u){const d=c("config-panel"),m=c("recent-panel"),h=c("preview-panel"),s=c("layout");return l(),w(s,null,{config:g(()=>[n(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:g(()=>[n(m,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:g(()=>[n(h)]),_:1})}const kn=E(Ds,[["render",Gs],["__scopeId","data-v-f5721d95"]]);export{kn as default};
1
+ import{F as H}from"./index.es-CIc56cl6.js";import{E as K}from"./index-qGVWSNsj.js";import{E as de}from"./index-D2hwZIWA.js";import{aj as pe,ap as me,bI as he,ak as ae,c9 as fe,_ as _e,d as b,a as $e,al as ge,c as F,bh as ve,bn as ye,aw as le,b as f,o as l,i as w,r as U,f as oe,e as V,j as g,b8 as re,E as R,n as ke,g as we,h as E,t as r,k as n,l as c,eP as se,x as $,F as N,v as Q,eQ as q,c6 as be,D as I,eR as Y,eS as x,y as k,J as Z,cN as ee,eT as O,bR as Ce,dm as B,ah as P,eU as D,an as Se,K as Ae,eV as Le,de as Ee,dl as Ve}from"./index-Cgvi9qKr.js";import{E as ce}from"./index-GjQsR5KG.js";import{E as je,a as Fe}from"./index-DTCoUzbs.js";import{I as G}from"./InfoIcon-A1xDvxpg.js";import{E as Te}from"./index-CvSpx81L.js";import{E as L}from"./index-BT7WrUPB.js";import{E as X}from"./index-D402UB4e.js";import{E as Pe,a as ue}from"./index-Bt9N_pkq.js";import{E as J}from"./index-VD3Emf8V.js";import{C as Ie,N as Ue,B as ze}from"./NoTasks-Cdp8T7aA.js";import{a as Re}from"./price-JcCbdpjd.js";import{E as De,a as Ge,b as Me}from"./index-BQq3lXfU.js";import{E as Oe}from"./index-Gj7AGill.js";import{E as Be}from"./index-C1ao7hiD.js";import"./use-form-item-tWhUsWWY.js";import"./index-r5W6hzzQ.js";import"./index-BTalZB4F.js";import"./index-I8eUQ22m.js";import"./typescript-BJQTyG9d.js";import"./strings-CaFLJNhw.js";import"./castArray-DMPMSVhG.js";import"./isEqual-CNVV21LA.js";import"./_initCloneObject-BcH86D07.js";import"./debounce--4Ey-UiG.js";import"./_baseIteratee-EXwBHC6D.js";import"./index-Bg5mlWRY.js";import"./index-C-wmX7EI.js";import"./_baseClone-CSJOYRf5.js";import"./index-BdcqrZwU.js";import"./index-BOWgmkBj.js";import"./dropdown-e5HICCuH.js";const We=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ae(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"}}),Ne={error:e=>e instanceof Event},qe=b({name:"ElAvatar"}),He=b({...qe,props:We,emits:Ne,setup(e,{emit:t}){const i=e,o=$e("avatar"),a=ge(!1),u=F(()=>{const{size:s,icon:p,shape:y}=i,_=[o.b()];return ve(s)&&_.push(o.m(s)),p&&_.push(o.m("icon")),y&&_.push(o.m(y)),_}),d=F(()=>{const{size:s}=i;return ae(s)?o.cssVarBlock({size:ye(s)||""}):void 0}),m=F(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function h(s){a.value=!0,t("error",s)}return(s,p)=>(l(),f("span",{class:ke(V(u)),style:oe(V(d))},[(s.src||s.srcSet)&&!a.value?(l(),f("img",{key:0,src:s.src,alt:s.alt,srcset:s.srcSet,style:oe(V(m)),onError:h},null,44,["src","alt","srcset"])):s.icon?(l(),w(V(R),{key:1},{default:g(()=>[(l(),w(re(s.icon)))]),_:1})):U(s.$slots,"default",{key:2})],6))}});var Ke=_e(He,[["__file","avatar.vue"]]);const Ze=we(Ke),Xe=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:K,FontAwesomeIcon:H},data(){return{drawer:!1,preview:!1}},computed:{}}),Je={class:"main"},Qe={class:"config"},Ye={class:"result"},xe={class:"preview"};function et(e,t,i,o,a,u){const d=c("font-awesome-icon"),m=c("el-button"),h=c("el-drawer");return l(),f("div",Je,[r("div",Qe,[U(e.$slots,"config",{},void 0,!0)]),r("div",Ye,[U(e.$slots,"result",{},void 0,!0)]),r("div",xe,[U(e.$slots,"preview",{},void 0,!0)]),n(m,{circle:"",class:"menu",onClick:t[0]||(t[0]=s=>e.drawer=!0)},{default:g(()=>[n(d,{icon:"fa-solid fa-magic"})]),_:1}),n(h,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=s=>e.drawer=s),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:g(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const tt=E(Xe,[["render",et],["__scopeId","data-v-c954d282"]]),ot=b({name:"VersionSelector",components:{ElSelect:Fe,ElOption:je,ElSwitch:ce},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},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)}}),st={class:"field"},nt={class:"title font-bold"};function it(e,t,i,o,a,u){const d=c("el-switch"),m=c("el-option"),h=c("el-select");return l(),f("div",st,[r("h2",nt,$(e.$t("suno.name.type")),1),n(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=s=>e.custom=s),class:"value"},null,8,["modelValue"]),n(h,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=s=>e.model=s),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:g(()=>[(l(!0),f(N,null,Q(e.options,s=>(l(),w(m,{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const at=E(ot,[["render",it],["__scopeId","data-v-5a66a01f"]]),lt=b({name:"UploadAudio",components:{ElUpload:Te,ElButton:K,InfoIcon:G,FontAwesomeIcon:H},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}L.info(this.$t("suno.message.startingUploadAudio")),q.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const a=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:a,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{L.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),rt={class:"relative"},ct={class:"flex justify-between"},ut={class:"flex justify-start items-center"},dt={class:"text-sm font-bold"};function pt(e,t,i,o,a,u){const d=c("info-icon"),m=c("font-awesome-icon"),h=c("el-button"),s=c("el-upload");return l(),f("div",rt,[r("div",ct,[r("div",ut,[r("span",dt,$(e.$t("suno.name.referenceAudios")),1),n(d,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),n(s,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=p=>e.fileList=p),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:g(()=>[n(h,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:g(()=>[n(m,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+$(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const mt=E(lt,[["render",pt],["__scopeId","data-v-6236152c"]]),ht="",ft=b({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:G},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ht)}}),_t={class:"field"},$t={class:"box"},gt={class:"title-info"},vt={class:"title font-bold"},yt={class:"instrumental"},kt={class:"title inline-block"};function wt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-switch"),h=c("el-input");return l(),f("div",_t,[r("div",$t,[r("div",gt,[r("h2",vt,$(e.$t("suno.name.prompt")),1),n(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",yt,[n(m,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=s=>e.instrumental=s),class:"value mr-2"},null,8,["modelValue"]),r("h2",kt,$(e.$t("suno.name.instrumental")),1)])]),n(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=s=>e.prompt=s),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const bt=E(ft,[["render",wt],["__scopeId","data-v-d7004a7c"]]),Ct="",St=b({name:"LyricInput",components:{ElInput:X,InfoIcon:G},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=Ct)}}),At={class:"field"},Lt={class:"box"},Et={class:"title font-bold"};function Vt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),f("div",At,[r("div",Lt,[r("h2",Et,$(e.$t("suno.name.lyrics")),1),n(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),w(m,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(m,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const jt=E(St,[["render",Vt],["__scopeId","data-v-99dfded8"]]),Ft=b({name:"StyleInput",components:{ElInput:X,InfoIcon:G},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}}}),Tt={class:"field"},Pt={class:"title-container"},It={class:"titlefont-bold"};function Ut(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),f("div",Tt,[r("div",Pt,[r("h2",It,$(e.$t("suno.name.style")),1),n(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),n(m,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=h=>e.style=h),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const zt=E(Ft,[["render",Ut],["__scopeId","data-v-85bbfcaa"]]),Rt=b({name:"TitleInput",components:{ElInput:X,InfoIcon:G},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})}}}}),Dt={class:"field"},Gt={class:"title-container"},Mt={class:"title font-bold"};function Ot(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),f("div",Dt,[r("div",Gt,[r("h2",Mt,$(e.$t("suno.name.title")),1),n(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),n(m,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=h=>e.title=h),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Bt=E(Rt,[["render",Ot],["__scopeId","data-v-ce70fe34"]]);function z(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const Wt=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:R,ElInputNumber:Pe,VideoPlay:x,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:z,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Nt={class:"field"},qt={class:"box"},Ht={class:"title font-bold"},Kt={class:"input-wrapper"},Zt={class:"task"},Xt={class:"left"},Jt={key:2,class:"duration"},Qt={class:"info"},Yt={class:"title"},xt={class:"style"};function eo(e,t,i,o,a,u){const d=c("el-input-number"),m=c("el-image"),h=c("video-pause"),s=c("el-icon"),p=c("video-play"),y=ee("loading");return l(),f("div",Nt,[r("div",qt,[r("h2",Ht,$(e.$t("suno.name.extend")),1),r("div",Kt,[n(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=_=>e.value=_),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),r("div",Zt,[e.audio?(l(),f("div",{key:0,class:"audio",onClick:t[3]||(t[3]=_=>e.onClick(e.audio))},[Z((l(),f("div",Xt,[n(m,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),f("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=_=>e.onPause(e.audio))},[n(s,null,{default:g(()=>[n(h)]),_:1})])):k("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),f("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=_=>e.onPlay(e.audio))},[n(s,null,{default:g(()=>[n(p)]),_:1})])):k("",!0),e.audio?.duration?(l(),f("div",Jt,$(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[y,!e.audio?.audio_url]]),r("div",Qt,[r("h2",Yt,$(e.audio?.title),1),r("p",xt,$(e.audio?.style),1)])])):k("",!0)])])}const to=E(Wt,[["render",eo],["__scopeId","data-v-bcce4821"]]),oo=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:R,VideoPlay:x,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:z,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})}}}),so={class:"field"},no={class:"box"},io={class:"title font-bold"},ao={class:"task"},lo={class:"left"},ro={key:2,class:"duration"},co={class:"info"},uo={class:"title"},po={class:"style"};function mo(e,t,i,o,a,u){const d=c("el-image"),m=c("video-pause"),h=c("el-icon"),s=c("video-play"),p=ee("loading");return l(),f("div",so,[r("div",no,[r("h2",io,$(e.$t("suno.name.cover")),1)]),r("div",ao,[e.audio?(l(),f("div",{key:0,class:"audio",onClick:t[2]||(t[2]=y=>e.onClick(e.audio))},[Z((l(),f("div",lo,[n(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),f("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=y=>e.onPause(e.audio))},[n(h,null,{default:g(()=>[n(m)]),_:1})])):k("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),f("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPlay(e.audio))},[n(h,null,{default:g(()=>[n(s)]),_:1})])):k("",!0),e.audio?.duration?(l(),f("div",ro,$(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[p,!e.audio?.audio_url]]),r("div",co,[r("h2",uo,$(e.audio?.title),1),r("p",po,$(e.audio?.style),1)])])):k("",!0)])])}const ho=E(oo,[["render",mo],["__scopeId","data-v-06640216"]]),fo=b({name:"PresetPanel",components:{TypeSelector:at,PromptInput:bt,LyricInput:jt,StyleInput:zt,TitleInput:Bt,ExtendFromInput:to,CoverFromInput:ho,UploadAudio:mt,FontAwesomeIcon:H,ElButton:K,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Re(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),_o={class:"flex flex-col h-full"},$o={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function vo(e,t,i,o,a,u){const d=c("type-selector"),m=c("upload-audio"),h=c("prompt-input"),s=c("lyric-input"),p=c("style-input"),y=c("title-input"),_=c("extend-from-input"),C=c("cover-from-input"),j=c("consumption"),T=c("font-awesome-icon"),A=c("el-button");return l(),f("div",_o,[r("div",$o,[n(d,{class:"mb-4"}),n(m,{class:"mb-4"}),e.config?.custom?k("",!0):(l(),w(h,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(s,{key:1,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(p,{key:2,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(y,{key:3,class:"mb-4"})):k("",!0),e.config?.action==="extend"?(l(),w(_,{key:4,class:"mb-4"})):k("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):k("",!0)]),r("div",go,[n(j,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[n(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[n(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const yo=E(fo,[["render",vo],["__scopeId","data-v-b9fab929"]]);var W={exports:{}},ko=W.exports,ne;function wo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(ko,function(){function i(s,p){return typeof p>"u"?p={autoBom:!1}:typeof p!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),p={autoBom:!p}),p.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(s.type)?new Blob(["\uFEFF",s],{type:s.type}):s}function o(s,p,y){var _=new XMLHttpRequest;_.open("GET",s),_.responseType="blob",_.onload=function(){h(_.response,p,y)},_.onerror=function(){console.error("could not download file")},_.send()}function a(s){var p=new XMLHttpRequest;p.open("HEAD",s,!1);try{p.send()}catch{}return 200<=p.status&&299>=p.status}function u(s){try{s.dispatchEvent(new MouseEvent("click"))}catch{var p=document.createEvent("MouseEvents");p.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),s.dispatchEvent(p)}}var d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,m=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),h=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!m?function(s,p,y){var _=d.URL||d.webkitURL,C=document.createElement("a");p=p||s.name||"download",C.download=p,C.rel="noopener",typeof s=="string"?(C.href=s,C.origin===location.origin?u(C):a(C.href)?o(s,p,y):u(C,C.target="_blank")):(C.href=_.createObjectURL(s),setTimeout(function(){_.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(s,p,y){if(p=p||s.name||"download",typeof s!="string")navigator.msSaveOrOpenBlob(i(s,y),p);else if(a(s))o(s,p,y);else{var _=document.createElement("a");_.href=s,_.target="_blank",setTimeout(function(){u(_)})}}:function(s,p,y,_){if(_=_||open("","_blank"),_&&(_.document.title=_.document.body.innerText="downloading..."),typeof s=="string")return o(s,p,y);var C=s.type==="application/octet-stream",j=/constructor/i.test(d.HTMLElement)||d.safari,T=/CriOS\/[\d]+/.test(navigator.userAgent);if((T||C&&j||m)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var S=A.result;S=T?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),_?_.location.href=S:location=S,_=null},A.readAsDataURL(s)}else{var M=d.URL||d.webkitURL,v=M.createObjectURL(s);_?_.location=v:location.href=v,_=null,setTimeout(function(){M.revokeObjectURL(v)},4e4)}});d.saveAs=h.saveAs=h,e.exports=h})}(W)),W.exports}var bo=wo();const Co="https://webhook.acedata.cloud/suno",So=b({name:"TaskPreview",components:{ElImage:J,ElIcon:R,ElTooltip:Oe,ElButton:K,FontAwesomeIcon:H,VideoPlay:x,VideoPause:Y,ElDropdown:Me,ElDropdownMenu:Ge,ElDropdownItem:De,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},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(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(i=>({...i,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:z,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{bo.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),L.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}q.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:Co},o=this.credential?.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),q.audio(i,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{L.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Ao={class:"task"},Lo=["onClick"],Eo={class:"left"},Vo=["onClick"],jo=["onClick"],Fo={key:2,class:"duration"},To={class:"info"},Po={class:"title"},Io={class:"style"},Uo={class:"right"},zo={class:"el-dropdown-link"},Ro={class:"flex items-center min-w-[120px]"},Do={class:"el-dropdown-link"};function Go(e,t,i,o,a,u){const d=c("el-image"),m=c("video-pause"),h=c("el-icon"),s=c("video-play"),p=c("el-button"),y=c("font-awesome-icon"),_=c("el-tooltip"),C=c("Loading"),j=c("el-dropdown-item"),T=c("el-dropdown-menu"),A=c("el-dropdown"),M=ee("loading");return l(),f("div",Ao,[(l(!0),f(N,null,Q(e.audios,v=>(l(),f("div",{key:v.id,class:"audio",onClick:P(S=>e.onClick(v),["stop"])},[Z((l(),f("div",Eo,[n(d,{src:v?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),v?.audio_url&&e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),f("div",{key:0,class:"overlay",onClick:P(S=>e.onPause(v),["stop"])},[n(h,null,{default:g(()=>[n(m)]),_:1})],8,Vo)):k("",!0),v?.audio_url&&(e.$store.state?.suno?.audio?.id!==v.id||e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),f("div",{key:1,class:"overlay",onClick:P(S=>e.onPlay(v),["stop"])},[n(h,null,{default:g(()=>[n(s)]),_:1})],8,jo)):k("",!0),v?.duration?(l(),f("div",Fo,$(e.useFormatDuring(v?.duration)),1)):k("",!0)])),[[M,!v?.audio_url]]),r("div",To,[r("h2",Po,$(v?.title),1),r("p",Io,$(v?.style),1)]),r("div",Uo,[v?.audio_url?(l(),w(p,{key:0,size:"small",round:"",onClick:P(S=>e.onExtend(S,v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):k("",!0),n(A,null,{dropdown:g(()=>[n(T,null,{default:g(()=>[n(j,{disabled:e.isFetchingVideoUrl,onClick:S=>e.handleVideoDownload(v)},{default:g(()=>[r("div",Ro,[e.isFetchingVideoUrl?(l(),w(h,{key:0,class:"is-loading mr-2"},{default:g(()=>[n(C)]),_:1})):k("",!0),r("span",null,$(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),v?.audio_url?(l(),w(j,{key:0,onClick:P(S=>e.onDownload(S,v?.audio_url),["stop"])},{default:g(()=>[I($(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:g(()=>[r("span",zo,[n(_,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024),n(A,null,{dropdown:g(()=>[n(T,null,{default:g(()=>[v.id?(l(),w(j,{key:0,onClick:P(S=>e.onGetStems(v.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):k("",!0),n(j,{onClick:P(S=>e.onCover(v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),v?.id&&v?.action==="extend"?(l(),w(j,{key:1,onClick:P(S=>e.onConcatMusic(v?.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:g(()=>[r("span",Do,[n(_,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Lo))),128))])}const Mo=E(So,[["render",Go]]),Oo={class:"player-slider"},Bo=b({__name:"PlayerSlider",setup(e){const t=D(),i=F({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=F({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),a=()=>{},u=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,m)=>(l(),f("div",Oo,[n(V(ue),{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=h=>i.value=h),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),Wo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},qo=["src"],Ho={class:"ml-2 text-xs flex flex-col justify-between"},Ko={class:"w-52 2xl:w-96 cursor-pointer truncate"},Zo={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=b({__name:"PlayerSong",setup(e){const t=D(),i=F({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),f("div",No,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||V(Wo)},null,8,qo),r("div",Ho,[r("div",Ko,[r("div",Zo,[r("span",null,$(i.value?.title||"Music"),1),r("span",Xo,"- "+$(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Qo={class:"flex justify-end items-center gap-x-2.5"},Yo={class:"text-xs"},xo=b({__name:"PlayerAction",setup(e){const t=D(),i=F({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=F({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),f("div",Qo,[r("span",Yo,$(V(z)(i.value))+" / "+$(V(z)(o.value)),1)]))}});var es={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function ts(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function os(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:a,id:e}}var ss=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=ts(),m=Se(ss,es);return function(){var h=u.size,s=u.strokeWidth,p=u.strokeLinecap,y=u.strokeLinejoin,_=u.theme,C=u.fill,j=u.spin,T=os(d,{size:h,strokeWidth:s,strokeLinecap:p,strokeLinejoin:y,theme:_,fill:C},m),A=[m.prefix+"-icon"];return A.push(m.prefix+"-icon-"+e),t&&m.rtl&&A.push(m.prefix+"-icon-rtl"),j&&A.push(m.prefix+"-icon-spin"),n("span",{class:A.join(" ")},[i(T)])}}};return o}const ns=te("pause-one",!1,function(e){return n("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[n("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),n("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),n("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),is=te("play",!0,function(e){return n("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[n("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),n("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),as=te("volume-small",!0,function(e){return n("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[n("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),n("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ie=b({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),w(re(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),ls={class:"player-volume flex flex-col items-center pt-2"},rs={class:"text-sm mt-3"},cs=b({__name:"PlayerVolumeSlider",setup(e){const t=D(),i=F({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=F({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),f("div",ls,[n(V(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=m=>i.value=m),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",rs,$(i.value),1)]))}}),us={class:"flex items-center justify-center gap-x-3"},ds=b({__name:"PlayerController",setup(e){const t=D(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=F(()=>t.state.suno.audio);return(a,u)=>(l(),f("div",us,[n(ie,{icon:o.value?.state==="playing"?V(ns):V(is),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),n(V(Be),{placement:"top",width:"50px",trigger:"click"},{reference:g(()=>[n(ie,{icon:V(as),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:g(()=>[n(cs)]),_:1})]))}}),ps={class:"flex flex-col items-stretch h-20"},ms={class:"flex grow px-5 items-center"},hs={class:"flex-1"},fs={class:"flex-1"},_s={class:"flex-1"},$s=b({__name:"Player",setup(e){return(t,i)=>(l(),f("div",ps,[n(Bo),r("div",ms,[r("div",hs,[n(Jo)]),r("div",fs,[n(ds)]),r("div",_s,[n(xo)])])]))}}),gs=b({name:"RecentPanel",components:{BotPlaceholder:ze,TaskPreview:Mo,Player:$s,NoTasks:Ue},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),vs={key:0,class:"tasks"},ys={key:2,class:"w-full flex-1 flex items-center justify-center"},ks={class:"h-20"};function ws(e,t,i,o,a,u){const d=c("bot-placeholder"),m=c("task-preview"),h=c("no-tasks"),s=c("player");return l(),f(N,null,[e.tasks?.items===void 0?(l(),f("div",vs,[n(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),f("div",{key:1,class:"flex-1 w-full overflow-y-auto tasks p-2",onScroll:t[0]||(t[0]=(...p)=>e.onHandleScroll&&e.onHandleScroll(...p))},[(l(!0),f(N,null,Q(e.tasks?.items,(p,y)=>(l(),w(m,{key:y,"model-value":p,class:"preview"},null,8,["model-value"]))),128))],32)):k("",!0),e.tasks?.items?.length===0?(l(),f("div",ys,[n(h)])):k("",!0),Z(r("div",ks,[n(s)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const bs=E(gs,[["render",ws]]),Cs=b({name:"TaskPreview",components:{IconPicture:Le,ElImage:J,ElAvatar:Ze,ElIcon:R},computed:{audio(){return this.$store.state.suno?.audio}}}),Ss={key:0,class:"size-full overflow-hidden"},As={class:"relative h-[300px]"},Ls={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Es={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Vs={class:"p-4"},js={class:"flex items-center font-bold mb-2"},Fs={class:"text-[var(--el-text-color-regular)] mb-2"},Ts={class:"text-xs text-[var(--el-text-color-regular)]"},Ps={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Is={key:1,class:"w-full h-full bg-gradient-to-b from-gray-200 to-gray-300"};function Us(e,t,i,o,a,u){const d=c("icon-picture"),m=c("el-icon"),h=c("el-image"),s=c("el-avatar");return e.audio?.object?(l(),f("div",Ss,[r("div",As,[n(h,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:g(()=>[r("div",Ls,[n(m,{class:"text-3xl"},{default:g(()=>[n(d)]),_:1})])]),_:1},8,["src"]),r("h2",Es,$(e.audio?.title),1)]),r("div",Vs,[r("div",js,[n(s,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,$(e.audio?.title),1)]),r("p",Fs,$(e.audio?.style),1),r("p",Ts,$(e.$dayjs.format(e.audio?.created_at)),1),r("div",Ps,[r("p",null,$(e.audio?.lyric),1)])])])):(l(),f("div",Is))}const zs=E(Cs,[["render",Us]]),Rs="https://webhook.acedata.cloud/suno",Ds=b({name:"SunoIndex",components:{Layout:tt,ConfigPanel:yo,RecentPanel:bs,PreviewPanel:zs},inject:["initialized"],data(){return{task:void 0,job: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},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ee.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ve&&L.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Rs},t=this.credential?.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),q.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{L.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Gs(e,t,i,o,a,u){const d=c("config-panel"),m=c("recent-panel"),h=c("preview-panel"),s=c("layout");return l(),w(s,null,{config:g(()=>[n(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:g(()=>[n(m,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:g(()=>[n(h)]),_:1})}const kn=E(Ds,[["render",Gs],["__scopeId","data-v-f5721d95"]]);export{kn as default};
@@ -1 +1 @@
1
- import{F as S}from"./index.es-DMKC3kSl.js";import{E as I}from"./index-JR6VCEaW.js";import{E as O}from"./index-DioM38n8.js";import{d as v,h as b,b as m,t as n,k as t,r as T,j as u,l as s,o as a,ei as N,x as i,ej as q,ek as H,c6 as j,D as g,i as k,y as f,n as C,ah as z,F as D,v as K,el as J,dr as Q,dm as W}from"./index-DlZrIwQl.js";import{I as U}from"./InfoIcon-B-pWYpXf.js";import{E as A}from"./index-C_Y9FdbX.js";import{I as F}from"./ImagePreview-CrYUOIUC.js";import{E as R}from"./index-C78CVb4w.js";import{E}from"./index-DyaSHTbp.js";import{F as X}from"./FilePreview-Dt3xp0eX.js";import{E as Y}from"./index-GAwF9ld_.js";import{V as M}from"./VideoPlayer-CMoCOK-2.js";import{C as Z,N as x,B as ee}from"./NoTasks-DhMwy0fW.js";import{a as te}from"./price-CopKH8wb.js";import{C as oe}from"./CopyToClipboard-BpQdSord.js";import{E as se}from"./index-C-kuWklD.js";import{E as ne}from"./index-DajaCXwQ.js";import{E as ae}from"./index-DQrPLSAi.js";import"./use-form-item-BrBRxl7V.js";import"./index-r5W6hzzQ.js";import"./index-Bes0kUIX.js";import"./index-D1DrOds3.js";import"./typescript-C7e2RhT_.js";import"./_baseClone-3DUpUcA-.js";import"./_initCloneObject-BFc9nFj7.js";import"./isEqual-DDj5e66m.js";import"./index-AzDMYUSd.js";import"./vue-plyr-QZFBikSk.js";import"./index-BcnUxXVu.js";import"./debounce-LQ3BUvW2.js";const le=v({name:"LayoutLuma",components:{ElDrawer:O,ElButton:I,FontAwesomeIcon:S},data(){return{drawer:!1}}}),ie={class:"main"},re={class:"config"},ce={class:"result"};function me(e,o,p,h,w,y){const r=s("font-awesome-icon"),d=s("el-button"),c=s("el-drawer");return a(),m("div",ie,[n("div",re,[T(e.$slots,"config",{},void 0,!0)]),n("div",ce,[T(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=_=>e.drawer=!0)},{default:u(()=>[t(r,{icon:"fa-solid fa-magic"})]),_:1}),t(c,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px",class:"drawer"},{default:u(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ue=b(le,[["render",me],["__scopeId","data-v-e43f6bbe"]]),de=v({name:"EnhancementSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug("set enhancement",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=N)}}),pe={class:"relative"},fe={class:"flex justify-between"},_e={class:"flex justify-start items-center"},he={class:"text-sm font-bold"},$e={class:"flex justify-end items-center"};function ge(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",pe,[n("div",fe,[n("div",_e,[n("span",he,i(e.$t("luma.name.enhancement")),1),t(r,{content:e.$t("luma.description.enhancement")},null,8,["content"])]),n("div",$e,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const ve=b(de,[["render",ge]]),be=v({name:"CustomSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=q)}}),we={class:"relative"},ye={class:"flex justify-between"},ke={class:"flex justify-start items-center"},Ee={class:"text-sm font-bold"},Ve={class:"flex justify-end items-center"};function Ue(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",we,[n("div",ye,[n("div",ke,[n("span",Ee,i(e.$t("luma.name.custom")),1),t(r,{content:e.$t("luma.description.custom")},null,8,["content"])]),n("div",Ve,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Se=b(be,[["render",Ue]]),Ie=v({name:"LoopSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug("set loop",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=H)}}),Le={class:"relative"},Ce={class:"flex justify-between"},Te={class:"flex justify-start items-center"},je={class:"text-sm font-bold"},Ae={class:"flex justify-end items-center"};function Re(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",Le,[n("div",Ce,[n("div",Te,[n("span",je,i(e.$t("luma.name.loop")),1),t(r,{content:e.$t("luma.description.loop")},null,8,["content"])]),n("div",Ae,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Ge=b(Ie,[["render",Re]]),Pe=v({name:"EndImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ze={class:"relative"},De={class:"flex justify-between"},Fe={class:"flex justify-start items-center"},Me={class:"text-sm font-bold"};function Be(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",ze,[n("div",De,[n("div",Fe,[n("span",Me,i(e.$t("luma.name.endImageUrl")),1),t(r,{content:e.$t("luma.description.endImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.url&&l.percentage!==void 0?(a(),k(d,{key:0,url:l.url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadEndImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Oe=b(Pe,[["render",Be],["__scopeId","data-v-7ab78c3e"]]),Ne=v({name:"StartImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),qe={class:"relative"},He={class:"flex justify-between"},Ke={class:"flex justify-start items-center"},Je={class:"text-sm font-bold"};function Qe(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",qe,[n("div",He,[n("div",Ke,[n("span",Je,i(e.$t("luma.name.startImageUrl")),1),t(r,{content:e.$t("luma.description.startImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const We=b(Ne,[["render",Qe],["__scopeId","data-v-425a8cec"]]),Xe=v({name:"UploadVideo",components:{ElUpload:R,ElButton:I,InfoIcon:U,FilePreview:X,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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.luma?.config?.video_url},set(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||(this.value=void 0)},methods:{onExceed(){E.warning(this.$t("luma.message.uploadVideoExceed"))},onError(){E.error(this.$t("luma.message.uploadVideoError"))},beforeUpload(e){const o=e.type==="video/mp4",p=e.size/1024/1024<10;return o?p?!0:(E.error(this.$t("luma.message.uploadVideoSizeExceed")),!1):(E.error(this.$t("luma.message.uploadVideoTypeFailed")),!1)},onSetVideoUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e,action:"extend"})},async onSuccess(){this.onSetVideoUrl()}}}),Ye={class:"relative"},Ze={class:"flex justify-between"},xe={class:"flex justify-start items-center"},et={class:"text-sm font-bold"};function tt(e,o,p,h,w,y){const r=s("info-icon"),d=s("file-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",Ye,[n("div",Ze,[n("div",xe,[n("span",et,i(e.$t("luma.name.videoUrl")),1),t(r,{content:e.$t("luma.description.videoUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),accept:".mp4",name:"file",class:"value","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response?.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadVideoUrl")),1)]),_:1})]),_:1},8,["file-list","action","before-upload","on-exceed","on-error","on-success","headers"])])}const ot=b(Xe,[["render",tt],["__scopeId","data-v-74e51526"]]),st="",nt=v({name:"PromptInput",components:{ElInput:Y,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=st)}}),at={class:"field"},lt={class:"box"},it={class:"title font-bold"};function rt(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-input");return a(),m("div",at,[n("div",lt,[n("h2",it,i(e.$t("luma.name.prompt")),1),t(r,{content:e.$t("luma.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=c=>e.prompt=c),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("luma.placeholder.prompt"),maxlength:2e3,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ct=b(nt,[["render",rt],["__scopeId","data-v-e8284075"]]),mt=v({name:"ExtendFromInput",components:{VideoPlayer:M},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.luma?.config}}}),ut={class:"relative"},dt={class:"flex mb-2"},pt={class:"text-sm font-bold"};function ft(e,o,p,h,w,y){const r=s("video-player");return a(),m("div",ut,[n("div",dt,[n("span",pt,i(e.$t("luma.name.extend")),1)]),n("div",null,[e.config?.video_url?(a(),k(r,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const _t=b(mt,[["render",ft]]),ht=v({name:"ConfigPanel",components:{LoopSelector:Ge,StartImageInput:We,EndImageInput:Oe,EnhancementSelector:ve,ElButton:I,FontAwesomeIcon:S,PromptInput:ct,ExtendFromInput:_t,CustomSelector:Se,UploadVideo:ot,Consumption:Z},emits:["generate"],computed:{config(){return this.$store.state.luma?.config},consumption(){return te(this.config,this.service?.metadata?.price)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$t={class:"flex flex-col h-full"},gt={class:"flex-1 overflow-y-auto p-[15px]"},vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function bt(e,o,p,h,w,y){const r=s("extend-from-input"),d=s("prompt-input"),c=s("custom-selector"),_=s("upload-video"),$=s("start-image-input"),l=s("end-image-input"),V=s("enhancement-selector"),L=s("loop-selector"),B=s("consumption"),G=s("font-awesome-icon"),P=s("el-button");return a(),m("div",$t,[n("div",gt,[e.config?.video_id||e.config?.video_url?(a(),k(r,{key:0,class:"mb-4"})):f("",!0),t(d,{class:"mb-4"}),e.config?.video_id?f("",!0):(a(),k(c,{key:1,class:"mb-4"})),e.config?.custom?(a(),k(_,{key:2,class:"mb-4"})):f("",!0),!(e.config?.video_id||e.config?.video_url)&&!e.config?.custom?(a(),k($,{key:3,class:"mb-4"})):f("",!0),t(l,{class:"mb-4"}),t(V,{class:"mb-4"}),t(L,{class:"mb-4"})]),n("div",vt,[t(B,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(a(),k(P,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.extend")),1)]),_:1},8,["onClick"])):(a(),k(P,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.generate")),1)]),_:1},8,["onClick"]))])])}const wt=b(ht,[["render",bt]]),yt=v({name:"TaskPreview",components:{ElImage:ae,CopyToClipboard:oe,FontAwesomeIcon:S,ElAlert:ne,VideoPlayer:M,ElTooltip:se,ElButton:I},props:{modelValue:{type:Object,required:!0}},emits:["extend"],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{onExtend(e,o){console.debug("set config",o),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_id:o.video_id,prompt:o.prompt,action:"extend",thumbnail_url:o.thumbnail_url,video_url:o.video_url}),this.$emit("extend")},onDownload(e){window.open(e,"_blank")}}}),kt={class:"preview"},Et={class:"left"},Vt={class:"main"},Ut={class:"bot"},St={class:"datetime"},It={class:"info"},Lt={key:0,class:"prompt mt-2"},Ct={key:0},Tt={key:1},jt={key:0,class:C({content:!0,failed:!0})},At={key:0,class:"mb-4"},Rt={key:1,class:C({operations:!0,"mt-2":!0,"mb-4":!0})},Gt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Pt={key:1,class:C({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Dt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Mt={key:2,class:C({content:!0})},Bt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Ot(e,o,p,h,w,y){const r=s("el-image"),d=s("video-player"),c=s("el-button"),_=s("el-tooltip"),$=s("font-awesome-icon"),l=s("copy-to-clipboard"),V=s("el-alert");return a(),m("div",kt,[n("div",Et,[t(r,{src:"https://cdn.acedata.cloud/ahjfwi.png",class:"avatar"})]),n("div",Vt,[n("div",Ut,[g(i(e.$t("luma.name.lumaBot"))+" ",1),n("span",St,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),n("div",It,[e.modelValue?.request?.prompt?(a(),m("p",Lt,[g(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(a(),m("span",Ct," - ("+i(e.$t("luma.status.pending"))+") ",1)),e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("span",Tt," - ("+i(e.$t("luma.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0?(a(),m("div",jt,[e.modelValue.response.video_url?(a(),m("div",At,[t(d,{src:e.modelValue.response.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response&&!e.config?.custom?(a(),m("div",Rt,[t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.extendVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=z(L=>e.onExtend(L,e.modelValue?.response),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.extend")),1)]),_:1})]),_:1},8,["content"]),t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.downloadVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=z(L=>e.onDownload(e.modelValue?.response?.video_url),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.download")),1)]),_:1})]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[n("p",Gt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.state==="failed"||e.modelValue?.response?.success===!1?(a(),m("div",Pt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",zt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])]),n("p",Dt,[t($,{icon:"fa-solid fa-circle-info",class:"mr-1"}),g(" "+i(e.$t("luma.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(l,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),n("p",Ft,[t($,{icon:"fa-solid fa-hashtag",class:"mr-1"}),g(" "+i(e.$t("luma.name.traceId"))+": "+i(e.modelValue?.trace_id)+" ",1),t(l,{content:e.modelValue?.response?.trace_id},null,8,["content"])])]),_:1})])):f("",!0),!e.modelValue?.response||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("div",Mt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",Bt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0)])])}const Nt=b(yt,[["render",Ot],["__scopeId","data-v-1b4a59bc"]]),qt=v({name:"RecentPanel",components:{BotPlaceholder:ee,TaskPreview:Nt,NoTasks:x},emits:["reach-top","extend"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.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")}}}),Ht={key:0},Kt={key:1,class:"tasks w-full h-full overflow-y-auto"},Jt={key:2,class:"w-full h-full flex items-center justify-center"};function Qt(e,o,p,h,w,y){const r=s("bot-placeholder"),d=s("task-preview"),c=s("no-tasks");return a(),m(D,null,[e.tasks?.items===void 0?(a(),m("div",Ht,[t(r)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),m("div",Kt,[(a(!0),m(D,null,K(e.tasks?.items,_=>(a(),k(d,{key:_.id,"model-value":_,onExtend:o[0]||(o[0]=$=>e.$emit("extend"))},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(a(),m("div",Jt,[t(c)])):f("",!0)],64)}const Wt=b(qt,[["render",Qt]]),Xt="https://webhook.acedata.cloud/luma",Yt=v({name:"LumaIndex",components:{ConfigPanel:wt,Layout:ue,RecentPanel:Wt},inject:["initialized"],emits:["extend"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.luma?.status?.getApplications===W.Request},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("luma/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("luma/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){console.debug("scrolling down"),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:o=5,createdAtMin:p,createdAtMax:h}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",h),await this.$store.dispatch("luma/getTasks",{limit:o,createdAtMin:p,createdAtMax:h})},async onGenerate(){const e={...this.config,callback_url:Xt},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("luma.message.startingTask")),J.generate(e,{token:o}).then(()=>{E.success(this.$t("luma.message.startTaskSuccess"))}).catch(p=>{p?.response?.data?.error?.code===Q?E.error(this.$t("luma.message.usedUp")):E.error(this.$t("luma.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Zt(e,o,p,h,w,y){const r=s("config-panel"),d=s("recent-panel"),c=s("layout");return a(),k(c,null,{config:u(()=>[t(r,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop,onExtend:o[0]||(o[0]=_=>e.$emit("extend"))},null,8,["onReachTop"])]),_:1})}const Co=b(Yt,[["render",Zt]]);export{Co as default};
1
+ import{F as S}from"./index.es-CIc56cl6.js";import{E as I}from"./index-qGVWSNsj.js";import{E as O}from"./index-D2hwZIWA.js";import{d as v,h as b,b as m,t as n,k as t,r as T,j as u,l as s,o as a,ek as N,x as i,el as q,em as H,c6 as j,D as g,i as k,y as f,n as C,ah as z,F as D,v as K,en as J,dr as Q,dm as W}from"./index-Cgvi9qKr.js";import{I as U}from"./InfoIcon-A1xDvxpg.js";import{E as A}from"./index-GjQsR5KG.js";import{I as F}from"./ImagePreview-TfSPkY4U.js";import{E as R}from"./index-CvSpx81L.js";import{E}from"./index-BT7WrUPB.js";import{F as X}from"./FilePreview-D0-PWvO0.js";import{E as Y}from"./index-D402UB4e.js";import{V as M}from"./VideoPlayer-bQ9vkI39.js";import{C as Z,N as x,B as ee}from"./NoTasks-Cdp8T7aA.js";import{a as te}from"./price-JcCbdpjd.js";import{C as oe}from"./CopyToClipboard-RknI4LM3.js";import{E as se}from"./index-Gj7AGill.js";import{E as ne}from"./index-BgUK6CFV.js";import{E as ae}from"./index-VD3Emf8V.js";import"./use-form-item-tWhUsWWY.js";import"./index-r5W6hzzQ.js";import"./index-BTalZB4F.js";import"./index-C-wmX7EI.js";import"./typescript-BJQTyG9d.js";import"./_baseClone-CSJOYRf5.js";import"./_initCloneObject-BcH86D07.js";import"./isEqual-CNVV21LA.js";import"./index-BdcqrZwU.js";import"./vue-plyr-QZFBikSk.js";import"./index-BOWgmkBj.js";import"./debounce--4Ey-UiG.js";const le=v({name:"LayoutLuma",components:{ElDrawer:O,ElButton:I,FontAwesomeIcon:S},data(){return{drawer:!1}}}),ie={class:"main"},re={class:"config"},ce={class:"result"};function me(e,o,p,h,w,y){const r=s("font-awesome-icon"),d=s("el-button"),c=s("el-drawer");return a(),m("div",ie,[n("div",re,[T(e.$slots,"config",{},void 0,!0)]),n("div",ce,[T(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=_=>e.drawer=!0)},{default:u(()=>[t(r,{icon:"fa-solid fa-magic"})]),_:1}),t(c,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px",class:"drawer"},{default:u(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ue=b(le,[["render",me],["__scopeId","data-v-e43f6bbe"]]),de=v({name:"EnhancementSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug("set enhancement",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=N)}}),pe={class:"relative"},fe={class:"flex justify-between"},_e={class:"flex justify-start items-center"},he={class:"text-sm font-bold"},$e={class:"flex justify-end items-center"};function ge(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",pe,[n("div",fe,[n("div",_e,[n("span",he,i(e.$t("luma.name.enhancement")),1),t(r,{content:e.$t("luma.description.enhancement")},null,8,["content"])]),n("div",$e,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const ve=b(de,[["render",ge]]),be=v({name:"CustomSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=q)}}),we={class:"relative"},ye={class:"flex justify-between"},ke={class:"flex justify-start items-center"},Ee={class:"text-sm font-bold"},Ve={class:"flex justify-end items-center"};function Ue(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",we,[n("div",ye,[n("div",ke,[n("span",Ee,i(e.$t("luma.name.custom")),1),t(r,{content:e.$t("luma.description.custom")},null,8,["content"])]),n("div",Ve,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Se=b(be,[["render",Ue]]),Ie=v({name:"LoopSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug("set loop",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=H)}}),Le={class:"relative"},Ce={class:"flex justify-between"},Te={class:"flex justify-start items-center"},je={class:"text-sm font-bold"},Ae={class:"flex justify-end items-center"};function Re(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",Le,[n("div",Ce,[n("div",Te,[n("span",je,i(e.$t("luma.name.loop")),1),t(r,{content:e.$t("luma.description.loop")},null,8,["content"])]),n("div",Ae,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Ge=b(Ie,[["render",Re]]),Pe=v({name:"EndImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ze={class:"relative"},De={class:"flex justify-between"},Fe={class:"flex justify-start items-center"},Me={class:"text-sm font-bold"};function Be(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",ze,[n("div",De,[n("div",Fe,[n("span",Me,i(e.$t("luma.name.endImageUrl")),1),t(r,{content:e.$t("luma.description.endImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.url&&l.percentage!==void 0?(a(),k(d,{key:0,url:l.url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadEndImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Oe=b(Pe,[["render",Be],["__scopeId","data-v-7ab78c3e"]]),Ne=v({name:"StartImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),qe={class:"relative"},He={class:"flex justify-between"},Ke={class:"flex justify-start items-center"},Je={class:"text-sm font-bold"};function Qe(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",qe,[n("div",He,[n("div",Ke,[n("span",Je,i(e.$t("luma.name.startImageUrl")),1),t(r,{content:e.$t("luma.description.startImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const We=b(Ne,[["render",Qe],["__scopeId","data-v-425a8cec"]]),Xe=v({name:"UploadVideo",components:{ElUpload:R,ElButton:I,InfoIcon:U,FilePreview:X,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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.luma?.config?.video_url},set(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||(this.value=void 0)},methods:{onExceed(){E.warning(this.$t("luma.message.uploadVideoExceed"))},onError(){E.error(this.$t("luma.message.uploadVideoError"))},beforeUpload(e){const o=e.type==="video/mp4",p=e.size/1024/1024<10;return o?p?!0:(E.error(this.$t("luma.message.uploadVideoSizeExceed")),!1):(E.error(this.$t("luma.message.uploadVideoTypeFailed")),!1)},onSetVideoUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e,action:"extend"})},async onSuccess(){this.onSetVideoUrl()}}}),Ye={class:"relative"},Ze={class:"flex justify-between"},xe={class:"flex justify-start items-center"},et={class:"text-sm font-bold"};function tt(e,o,p,h,w,y){const r=s("info-icon"),d=s("file-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",Ye,[n("div",Ze,[n("div",xe,[n("span",et,i(e.$t("luma.name.videoUrl")),1),t(r,{content:e.$t("luma.description.videoUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),accept:".mp4",name:"file",class:"value","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response?.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadVideoUrl")),1)]),_:1})]),_:1},8,["file-list","action","before-upload","on-exceed","on-error","on-success","headers"])])}const ot=b(Xe,[["render",tt],["__scopeId","data-v-74e51526"]]),st="",nt=v({name:"PromptInput",components:{ElInput:Y,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=st)}}),at={class:"field"},lt={class:"box"},it={class:"title font-bold"};function rt(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-input");return a(),m("div",at,[n("div",lt,[n("h2",it,i(e.$t("luma.name.prompt")),1),t(r,{content:e.$t("luma.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=c=>e.prompt=c),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("luma.placeholder.prompt"),maxlength:2e3,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ct=b(nt,[["render",rt],["__scopeId","data-v-e8284075"]]),mt=v({name:"ExtendFromInput",components:{VideoPlayer:M},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.luma?.config}}}),ut={class:"relative"},dt={class:"flex mb-2"},pt={class:"text-sm font-bold"};function ft(e,o,p,h,w,y){const r=s("video-player");return a(),m("div",ut,[n("div",dt,[n("span",pt,i(e.$t("luma.name.extend")),1)]),n("div",null,[e.config?.video_url?(a(),k(r,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const _t=b(mt,[["render",ft]]),ht=v({name:"ConfigPanel",components:{LoopSelector:Ge,StartImageInput:We,EndImageInput:Oe,EnhancementSelector:ve,ElButton:I,FontAwesomeIcon:S,PromptInput:ct,ExtendFromInput:_t,CustomSelector:Se,UploadVideo:ot,Consumption:Z},emits:["generate"],computed:{config(){return this.$store.state.luma?.config},consumption(){return te(this.config,this.service?.metadata?.price)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$t={class:"flex flex-col h-full"},gt={class:"flex-1 overflow-y-auto p-[15px]"},vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function bt(e,o,p,h,w,y){const r=s("extend-from-input"),d=s("prompt-input"),c=s("custom-selector"),_=s("upload-video"),$=s("start-image-input"),l=s("end-image-input"),V=s("enhancement-selector"),L=s("loop-selector"),B=s("consumption"),G=s("font-awesome-icon"),P=s("el-button");return a(),m("div",$t,[n("div",gt,[e.config?.video_id||e.config?.video_url?(a(),k(r,{key:0,class:"mb-4"})):f("",!0),t(d,{class:"mb-4"}),e.config?.video_id?f("",!0):(a(),k(c,{key:1,class:"mb-4"})),e.config?.custom?(a(),k(_,{key:2,class:"mb-4"})):f("",!0),!(e.config?.video_id||e.config?.video_url)&&!e.config?.custom?(a(),k($,{key:3,class:"mb-4"})):f("",!0),t(l,{class:"mb-4"}),t(V,{class:"mb-4"}),t(L,{class:"mb-4"})]),n("div",vt,[t(B,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(a(),k(P,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.extend")),1)]),_:1},8,["onClick"])):(a(),k(P,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.generate")),1)]),_:1},8,["onClick"]))])])}const wt=b(ht,[["render",bt]]),yt=v({name:"TaskPreview",components:{ElImage:ae,CopyToClipboard:oe,FontAwesomeIcon:S,ElAlert:ne,VideoPlayer:M,ElTooltip:se,ElButton:I},props:{modelValue:{type:Object,required:!0}},emits:["extend"],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{onExtend(e,o){console.debug("set config",o),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_id:o.video_id,prompt:o.prompt,action:"extend",thumbnail_url:o.thumbnail_url,video_url:o.video_url}),this.$emit("extend")},onDownload(e){window.open(e,"_blank")}}}),kt={class:"preview"},Et={class:"left"},Vt={class:"main"},Ut={class:"bot"},St={class:"datetime"},It={class:"info"},Lt={key:0,class:"prompt mt-2"},Ct={key:0},Tt={key:1},jt={key:0,class:C({content:!0,failed:!0})},At={key:0,class:"mb-4"},Rt={key:1,class:C({operations:!0,"mt-2":!0,"mb-4":!0})},Gt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Pt={key:1,class:C({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Dt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Mt={key:2,class:C({content:!0})},Bt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Ot(e,o,p,h,w,y){const r=s("el-image"),d=s("video-player"),c=s("el-button"),_=s("el-tooltip"),$=s("font-awesome-icon"),l=s("copy-to-clipboard"),V=s("el-alert");return a(),m("div",kt,[n("div",Et,[t(r,{src:"https://cdn.acedata.cloud/ahjfwi.png",class:"avatar"})]),n("div",Vt,[n("div",Ut,[g(i(e.$t("luma.name.lumaBot"))+" ",1),n("span",St,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),n("div",It,[e.modelValue?.request?.prompt?(a(),m("p",Lt,[g(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(a(),m("span",Ct," - ("+i(e.$t("luma.status.pending"))+") ",1)),e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("span",Tt," - ("+i(e.$t("luma.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0?(a(),m("div",jt,[e.modelValue.response.video_url?(a(),m("div",At,[t(d,{src:e.modelValue.response.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response&&!e.config?.custom?(a(),m("div",Rt,[t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.extendVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=z(L=>e.onExtend(L,e.modelValue?.response),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.extend")),1)]),_:1})]),_:1},8,["content"]),t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.downloadVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=z(L=>e.onDownload(e.modelValue?.response?.video_url),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.download")),1)]),_:1})]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[n("p",Gt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.state==="failed"||e.modelValue?.response?.success===!1?(a(),m("div",Pt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",zt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])]),n("p",Dt,[t($,{icon:"fa-solid fa-circle-info",class:"mr-1"}),g(" "+i(e.$t("luma.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(l,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),n("p",Ft,[t($,{icon:"fa-solid fa-hashtag",class:"mr-1"}),g(" "+i(e.$t("luma.name.traceId"))+": "+i(e.modelValue?.trace_id)+" ",1),t(l,{content:e.modelValue?.response?.trace_id},null,8,["content"])])]),_:1})])):f("",!0),!e.modelValue?.response||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("div",Mt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",Bt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0)])])}const Nt=b(yt,[["render",Ot],["__scopeId","data-v-1b4a59bc"]]),qt=v({name:"RecentPanel",components:{BotPlaceholder:ee,TaskPreview:Nt,NoTasks:x},emits:["reach-top","extend"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.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")}}}),Ht={key:0},Kt={key:1,class:"tasks w-full h-full overflow-y-auto"},Jt={key:2,class:"w-full h-full flex items-center justify-center"};function Qt(e,o,p,h,w,y){const r=s("bot-placeholder"),d=s("task-preview"),c=s("no-tasks");return a(),m(D,null,[e.tasks?.items===void 0?(a(),m("div",Ht,[t(r)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),m("div",Kt,[(a(!0),m(D,null,K(e.tasks?.items,_=>(a(),k(d,{key:_.id,"model-value":_,onExtend:o[0]||(o[0]=$=>e.$emit("extend"))},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(a(),m("div",Jt,[t(c)])):f("",!0)],64)}const Wt=b(qt,[["render",Qt]]),Xt="https://webhook.acedata.cloud/luma",Yt=v({name:"LumaIndex",components:{ConfigPanel:wt,Layout:ue,RecentPanel:Wt},inject:["initialized"],emits:["extend"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.luma?.status?.getApplications===W.Request},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("luma/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("luma/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){console.debug("scrolling down"),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:o=5,createdAtMin:p,createdAtMax:h}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",h),await this.$store.dispatch("luma/getTasks",{limit:o,createdAtMin:p,createdAtMax:h})},async onGenerate(){const e={...this.config,callback_url:Xt},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("luma.message.startingTask")),J.generate(e,{token:o}).then(()=>{E.success(this.$t("luma.message.startTaskSuccess"))}).catch(p=>{p?.response?.data?.error?.code===Q?E.error(this.$t("luma.message.usedUp")):E.error(this.$t("luma.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Zt(e,o,p,h,w,y){const r=s("config-panel"),d=s("recent-panel"),c=s("layout");return a(),k(c,null,{config:u(()=>[t(r,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop,onExtend:o[0]||(o[0]=_=>e.$emit("extend"))},null,8,["onReachTop"])]),_:1})}const Co=b(Yt,[["render",Zt]]);export{Co as default};
@@ -1 +1 @@
1
- import{d as g,L as A,S as v,h as k,i as f,j as i,k as s,y as _,l as t,D as $,x as p,t as o,o as r,R as O,eV as S,m as N,p as T,q as L,eW as D,c6 as R,b as h,f as U,F as P,v as B,n as V}from"./index-DlZrIwQl.js";import{F as w}from"./index.es-DMKC3kSl.js";import{E as q,a as F}from"./index-FG_9wygy.js";import{E as j}from"./index-Ci6MZJbr.js";import{E as b}from"./index-DQrPLSAi.js";import"./typescript-C7e2RhT_.js";import"./index-C-kuWklD.js";import"./index-Bes0kUIX.js";import"./index-r5W6hzzQ.js";import"./index-BApEDemr.js";import"./dropdown-fAdK4kJL.js";import"./debounce-LQ3BUvW2.js";import"./index-AzDMYUSd.js";const H=g({name:"HelpEntry",components:{ElImage:b,ElDialog:A,ElPopover:j,ElMenu:F,ElMenuItem:q,FontAwesomeIcon:w},props:{visible:{type:Boolean,default:!0}},emits:["close"],computed:{site(){return this.$store.state.site}},methods:{onJoin(){window.open(this.$store.state.site?.features?.support?.discord?.url,"_blank")},onProfit(){this.$router.push({name:v})}}}),M={class:"flex"},X={class:"flex-1 text-center"};function z(e,n,E,y,I,x){const c=t("font-awesome-icon"),l=t("el-menu-item"),d=t("el-image"),m=t("el-popover"),a=t("el-menu"),u=t("el-dialog");return r(),f(u,{"model-value":e.visible,width:200,class:"text-center",onClose:n[0]||(n[0]=C=>e.$emit("close"))},{default:i(()=>[s(a,{collapse:!1,class:"menu"},{default:i(()=>[e.site?.features?.support?.discord?.enabled?(r(),f(l,{key:0,index:"1",onClick:e.onJoin},{title:i(()=>[$(p(e.$t("common.message.joinDiscord")),1)]),default:i(()=>[s(c,{icon:"fa-brands fa-discord",class:"mr-2"})]),_:1},8,["onClick"])):_("",!0),s(m,{width:350,trigger:"hover"},{reference:i(()=>[e.site?.features?.support?.wechat?.enabled?(r(),f(l,{key:0,index:"2"},{title:i(()=>[$(p(e.$t("common.message.addWeChat")),1)]),default:i(()=>[s(c,{icon:"fa-brands fa-weixin",class:"mr-2"})]),_:1})):_("",!0)]),default:i(()=>[o("div",M,[o("div",X,[s(d,{src:e.site?.features?.support?.wechat?.qr},null,8,["src"])])])]),_:1})]),_:1})]),_:1},8,["model-value"])}const J=k(H,[["render",z],["__scopeId","data-v-0fce633f"]]),W=g({name:"ProfileIndex",components:{ElImage:b,HelpDialog:J,FontAwesomeIcon:w},data(){return{operating:{locale:!1,dark:!1,help:!1}}},computed:{user(){return this.$store.getters.user},showSupport(){return this.$store?.state?.site?.features?.support?.enabled&&(this.$store?.state?.site?.features?.support?.discord?.enabled||this.$store?.state?.site?.features?.support?.wechat?.enabled)},showSite(){return this.$store?.state?.site?.admins?.includes(this.$store.getters.user?.id)},links(){return[{key:"profile",text:this.$t("console.menu.userProfile"),href:`${S()}/user/profile`,icon:"fa-regular fa-user"},{key:"application-list",text:this.$t("console.menu.applicationList"),name:N,icon:"fa-solid fa-cube"},{key:"order-list",text:this.$t("console.menu.orderList"),name:T,icon:"fa-solid fa-store"},{key:"usage-list",text:this.$t("console.menu.usageList"),name:L,icon:"fa-solid fa-rotate-left"},{key:"distribution-index",text:this.$t("console.menu.distributionIndex"),name:v,icon:"fa-solid fa-coins"},...this.showSite?[{key:"site-index",text:this.$t("common.nav.site"),name:D,icon:"fa-solid fa-gear"}]:[],{key:"dark-setting",text:this.$t("common.nav.darkMode"),icon:"fa-solid fa-moon",callback:()=>{this.operating.dark=!0}},{key:"locale-setting",text:this.$t("common.nav.locale"),icon:"fa-solid fa-language",callback:()=>{this.operating.locale=!0}},{key:"developerPlatform",text:this.$t("console.menu.developerPlatform"),href:R(),icon:"fa-solid fa-laptop-code"},...this.showSupport?[{key:"support",text:this.$t("common.nav.support"),callback:()=>{this.operating.help=!0},icon:"fa-solid fa-question"}]:[],{key:"logout",text:this.$t("common.nav.logOut"),icon:"fa-solid fa-arrow-right-from-bracket",callback:async()=>{await this.$store.dispatch("resetAll"),await this.$store.dispatch("chat/resetAll"),await this.$store.dispatch("midjourney/resetAll"),await this.$store.dispatch("qrart/resetAll"),await this.$store.dispatch("flux/resetAll"),await this.$store.dispatch("hailuo/resetAll"),await this.$store.dispatch("headshots/resetAll"),await this.$store.dispatch("kling/resetAll"),await this.$store.dispatch("luma/resetAll"),await this.$store.dispatch("pika/resetAll"),await this.$store.dispatch("suno/resetAll"),await this.$store.dispatch("login")}}]}},methods:{onHome(){this.$router.push({name:O})},onNavigate(e){e.name?this.$router.push({name:e.name}):e.href?window.open(e.href,"_blank"):e.callback&&e.callback()}}}),G={class:"profile"},K={class:"info"},Q={class:"links"},Y=["onClick"],Z={class:"icon"},ee={class:"text"},te={class:"suffix"};function se(e,n,E,y,I,x){const c=t("el-image"),l=t("font-awesome-icon"),d=t("locale-selector"),m=t("help-dialog");return r(),h("div",G,[o("div",K,[s(c,{src:e.user.avatar,fit:"cover",class:"avatar"},null,8,["src"]),o("h2",null,p(e.user.username),1),o("div",{style:U({backgroundImage:"url("+e.user.avatar+")"}),class:"background"},null,4)]),o("div",Q,[(r(!0),h(P,null,B(e.links,(a,u)=>(r(),h("a",{key:u,class:V({link:!0,active:e.$route.name===a.name}),onClick:C=>e.onNavigate(a)},[o("span",Z,[s(l,{icon:a.icon,class:"text-sm"},null,8,["icon"])]),o("span",ee,p(a.text),1),o("span",te,[s(l,{icon:"fa-solid fa-chevron-right",class:"text-sm"})])],10,Y))),128))]),s(d,{visible:e.operating.locale==!0,onClose:n[0]||(n[0]=a=>e.operating.locale=!1)},null,8,["visible"]),s(m,{visible:e.operating.help==!0,onClose:n[1]||(n[1]=a=>e.operating.help=!1)},null,8,["visible"])])}const _e=k(W,[["render",se],["__scopeId","data-v-54290de4"]]);export{_e as default};
1
+ import{d as g,L as A,S as v,h as k,i as f,j as i,k as s,y as _,l as t,D as $,x as p,t as o,o as r,R as O,eX as S,m as N,p as T,q as L,eY as D,c6 as R,b as h,f as U,F as P,v as B,n as q}from"./index-Cgvi9qKr.js";import{F as w}from"./index.es-CIc56cl6.js";import{E as F,a as V}from"./index-CeFYRj3z.js";import{E as X}from"./index-C1ao7hiD.js";import{E as b}from"./index-VD3Emf8V.js";import"./typescript-BJQTyG9d.js";import"./index-Gj7AGill.js";import"./index-BTalZB4F.js";import"./index-r5W6hzzQ.js";import"./index-Bg5mlWRY.js";import"./dropdown-e5HICCuH.js";import"./debounce--4Ey-UiG.js";import"./index-BdcqrZwU.js";const j=g({name:"HelpEntry",components:{ElImage:b,ElDialog:A,ElPopover:X,ElMenu:V,ElMenuItem:F,FontAwesomeIcon:w},props:{visible:{type:Boolean,default:!0}},emits:["close"],computed:{site(){return this.$store.state.site}},methods:{onJoin(){window.open(this.$store.state.site?.features?.support?.discord?.url,"_blank")},onProfit(){this.$router.push({name:v})}}}),H={class:"flex"},M={class:"flex-1 text-center"};function z(e,n,E,y,I,x){const c=t("font-awesome-icon"),l=t("el-menu-item"),d=t("el-image"),m=t("el-popover"),a=t("el-menu"),u=t("el-dialog");return r(),f(u,{"model-value":e.visible,width:200,class:"text-center",onClose:n[0]||(n[0]=C=>e.$emit("close"))},{default:i(()=>[s(a,{collapse:!1,class:"menu"},{default:i(()=>[e.site?.features?.support?.discord?.enabled?(r(),f(l,{key:0,index:"1",onClick:e.onJoin},{title:i(()=>[$(p(e.$t("common.message.joinDiscord")),1)]),default:i(()=>[s(c,{icon:"fa-brands fa-discord",class:"mr-2"})]),_:1},8,["onClick"])):_("",!0),s(m,{width:350,trigger:"hover"},{reference:i(()=>[e.site?.features?.support?.wechat?.enabled?(r(),f(l,{key:0,index:"2"},{title:i(()=>[$(p(e.$t("common.message.addWeChat")),1)]),default:i(()=>[s(c,{icon:"fa-brands fa-weixin",class:"mr-2"})]),_:1})):_("",!0)]),default:i(()=>[o("div",H,[o("div",M,[s(d,{src:e.site?.features?.support?.wechat?.qr},null,8,["src"])])])]),_:1})]),_:1})]),_:1},8,["model-value"])}const J=k(j,[["render",z],["__scopeId","data-v-0fce633f"]]),G=g({name:"ProfileIndex",components:{ElImage:b,HelpDialog:J,FontAwesomeIcon:w},data(){return{operating:{locale:!1,dark:!1,help:!1}}},computed:{user(){return this.$store.getters.user},showSupport(){return this.$store?.state?.site?.features?.support?.enabled&&(this.$store?.state?.site?.features?.support?.discord?.enabled||this.$store?.state?.site?.features?.support?.wechat?.enabled)},showSite(){return this.$store?.state?.site?.admins?.includes(this.$store.getters.user?.id)},links(){return[{key:"profile",text:this.$t("console.menu.userProfile"),href:`${S()}/user/profile`,icon:"fa-regular fa-user"},{key:"application-list",text:this.$t("console.menu.applicationList"),name:N,icon:"fa-solid fa-cube"},{key:"order-list",text:this.$t("console.menu.orderList"),name:T,icon:"fa-solid fa-store"},{key:"usage-list",text:this.$t("console.menu.usageList"),name:L,icon:"fa-solid fa-rotate-left"},{key:"distribution-index",text:this.$t("console.menu.distributionIndex"),name:v,icon:"fa-solid fa-coins"},...this.showSite?[{key:"site-index",text:this.$t("common.nav.site"),name:D,icon:"fa-solid fa-gear"}]:[],{key:"dark-setting",text:this.$t("common.nav.darkMode"),icon:"fa-solid fa-moon",callback:()=>{this.operating.dark=!0}},{key:"locale-setting",text:this.$t("common.nav.locale"),icon:"fa-solid fa-language",callback:()=>{this.operating.locale=!0}},{key:"developerPlatform",text:this.$t("console.menu.developerPlatform"),href:R(),icon:"fa-solid fa-laptop-code"},...this.showSupport?[{key:"support",text:this.$t("common.nav.support"),callback:()=>{this.operating.help=!0},icon:"fa-solid fa-question"}]:[],{key:"logout",text:this.$t("common.nav.logOut"),icon:"fa-solid fa-arrow-right-from-bracket",callback:async()=>{await this.$store.dispatch("resetAll"),await this.$store.dispatch("chat/resetAll"),await this.$store.dispatch("midjourney/resetAll"),await this.$store.dispatch("qrart/resetAll"),await this.$store.dispatch("flux/resetAll"),await this.$store.dispatch("hailuo/resetAll"),await this.$store.dispatch("headshots/resetAll"),await this.$store.dispatch("kling/resetAll"),await this.$store.dispatch("luma/resetAll"),await this.$store.dispatch("pika/resetAll"),await this.$store.dispatch("suno/resetAll"),await this.$store.dispatch("login")}}]}},methods:{onHome(){this.$router.push({name:O})},onNavigate(e){e.name?this.$router.push({name:e.name}):e.href?window.open(e.href,"_blank"):e.callback&&e.callback()}}}),W={class:"profile"},Y={class:"info"},K={class:"links"},Q=["onClick"],Z={class:"icon"},ee={class:"text"},te={class:"suffix"};function se(e,n,E,y,I,x){const c=t("el-image"),l=t("font-awesome-icon"),d=t("locale-selector"),m=t("help-dialog");return r(),h("div",W,[o("div",Y,[s(c,{src:e.user.avatar,fit:"cover",class:"avatar"},null,8,["src"]),o("h2",null,p(e.user.username),1),o("div",{style:U({backgroundImage:"url("+e.user.avatar+")"}),class:"background"},null,4)]),o("div",K,[(r(!0),h(P,null,B(e.links,(a,u)=>(r(),h("a",{key:u,class:q({link:!0,active:e.$route.name===a.name}),onClick:C=>e.onNavigate(a)},[o("span",Z,[s(l,{icon:a.icon,class:"text-sm"},null,8,["icon"])]),o("span",ee,p(a.text),1),o("span",te,[s(l,{icon:"fa-solid fa-chevron-right",class:"text-sm"})])],10,Q))),128))]),s(d,{visible:e.operating.locale==!0,onClose:n[0]||(n[0]=a=>e.operating.locale=!1)},null,8,["visible"]),s(m,{visible:e.operating.help==!0,onClose:n[1]||(n[1]=a=>e.operating.help=!1)},null,8,["visible"])])}const _e=k(G,[["render",se],["__scopeId","data-v-54290de4"]]);export{_e as default};