@acedatacloud/nexior 3.18.7 → 3.18.8

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 (99) hide show
  1. package/dist/assets/{Auth-D0E88uU8.js → Auth-x0LPRjT3.js} +1 -1
  2. package/dist/assets/BotPlaceholder-ZNnLvGsO.js +1 -0
  3. package/dist/assets/{Callback-GZDJUsmS.js → Callback-iyOU7mLy.js} +1 -1
  4. package/dist/assets/Console-CUnaiCI3.js +1 -0
  5. package/dist/assets/Console-CtzDEiv9.css +1 -0
  6. package/dist/assets/{Conversation-BHdM-ZOP.js → Conversation-B-MwIySX.js} +2 -2
  7. package/dist/assets/{CopyToClipboard-Hav2hml4.js → CopyToClipboard-B5E56t6E.js} +1 -1
  8. package/dist/assets/{Detail-DPHGblvD.js → Detail-BFAg22Th.js} +1 -1
  9. package/dist/assets/{EditArray-DD0egPyS.js → EditArray-C1DhkV6Z.js} +1 -1
  10. package/dist/assets/{Extra-DvfnBzbb.js → Extra-DUs0-wyQ.js} +1 -1
  11. package/dist/assets/{FilePreview-BNX-xiRe.js → FilePreview-B_JJAafo.js} +1 -1
  12. package/dist/assets/{History-CKlg6xmW.js → History-znPrs9OT.js} +1 -1
  13. package/dist/assets/{ImagePreview-OUZSFqRe.js → ImagePreview-VkHqgeBl.js} +1 -1
  14. package/dist/assets/{ImageWrapper-Wrpw_5jV.js → ImageWrapper-Bo3sZeqj.js} +1 -1
  15. package/dist/assets/{Index-ZY5OJEVW.js → Index-B-GLACzj.js} +1 -1
  16. package/dist/assets/{Index-C1giqA6x.js → Index-B6FjK3RH.js} +1 -1
  17. package/dist/assets/Index-BAbYa-9q.js +1 -0
  18. package/dist/assets/{Index-BfFY_n6B.js → Index-BdHFoixh.js} +1 -1
  19. package/dist/assets/{Index-DEHJGQ55.js → Index-BerbcPfQ.js} +1 -1
  20. package/dist/assets/Index-D2mG27BX.js +1 -0
  21. package/dist/assets/Index-D57PHBig.js +1 -0
  22. package/dist/assets/Index-D_SHHH3Y.js +1 -0
  23. package/dist/assets/{Index-CUVYGOao.js → Index-D_etiNYK.js} +1 -1
  24. package/dist/assets/Index-DdXL9lGz.js +1 -0
  25. package/dist/assets/{Index-D2vsNaX3.js → Index-DdiaSB-L.js} +1 -1
  26. package/dist/assets/Index-DhnzVk8y.js +1 -0
  27. package/dist/assets/Index-Dmf60T6f.js +1 -0
  28. package/dist/assets/Index-DzN767yr.js +1 -0
  29. package/dist/assets/{InfoIcon-BwtK8GA6.js → InfoIcon-Cc4oAk_g.js} +1 -1
  30. package/dist/assets/{Invitees-Dky4G8TR.js → Invitees-C5ZIveI5.js} +1 -1
  31. package/dist/assets/{List-DcveDkM0.js → List-2hL985QH.js} +1 -1
  32. package/dist/assets/{List-D-qSxPyW.js → List-8SGdcXwp.js} +1 -1
  33. package/dist/assets/{List-D37NPQIb.js → List-BgtWz5zZ.js} +1 -1
  34. package/dist/assets/{Login-8Tt7aIF5.js → Login-DrJFBT9k.js} +1 -1
  35. package/dist/assets/{Main-B-eZyN3B.js → Main-lj-OaQMe.js} +1 -1
  36. package/dist/assets/{Navigator-DpgYZ96S.js → Navigator-CzsuZH4k.js} +1 -1
  37. package/dist/assets/NoTasks-2hz79Crs.js +1 -0
  38. package/dist/assets/{Pagination-BUqfeKxL.js → Pagination-BMfCjLbO.js} +1 -1
  39. package/dist/assets/{Status-BMWv2Lvq.js → Status-DglRlJGI.js} +1 -1
  40. package/dist/assets/{Subscribe-CvBDFTy5.js → Subscribe-BxUwDFhS.js} +1 -1
  41. package/dist/assets/{VideoPlayer-B2z-fteC.js → VideoPlayer-PJ-9LA2g.js} +1 -1
  42. package/dist/assets/{_baseClone-CJfrYffb.js → _baseClone-BUEYiiKE.js} +1 -1
  43. package/dist/assets/{_baseIteratee-CcPXMZX8.js → _baseIteratee-BxLTPJCW.js} +1 -1
  44. package/dist/assets/{_initCloneObject-1-Me7HD_.js → _initCloneObject-itvorlxB.js} +1 -1
  45. package/dist/assets/{castArray-BUMlMGlh.js → castArray-DTYSPAQ5.js} +1 -1
  46. package/dist/assets/{debounce-DECFekgp.js → debounce-BBWNLmow.js} +1 -1
  47. package/dist/assets/{distribution--a6ikL4D.js → distribution-D0b5Gqpo.js} +1 -1
  48. package/dist/assets/{dropdown-DAoWl2Zf.js → dropdown-DdliLGbX.js} +1 -1
  49. package/dist/assets/{index-Dg0VTGhm.js → index--dZny59W.js} +1 -1
  50. package/dist/assets/{index-kRFwCZww.css → index-3VK1-xNo.css} +1 -1
  51. package/dist/assets/{index-CYne5B4k.js → index-AkGhTpcD.js} +1 -1
  52. package/dist/assets/{index-DaoKJ7xF.js → index-B-x2lsnR.js} +1 -1
  53. package/dist/assets/{index-BPxi9ga3.js → index-B0x7ZUfV.js} +2 -2
  54. package/dist/assets/{index-BpxAMMhB.js → index-B8T6V5UZ.js} +1 -1
  55. package/dist/assets/{index-wVVoJUgj.js → index-BHZI17om.js} +1 -1
  56. package/dist/assets/{index-D4CU7VXM.js → index-BJ3fX-94.js} +1 -1
  57. package/dist/assets/{index-C_A5OyhT.js → index-BJlUTDGv.js} +1 -1
  58. package/dist/assets/{index-ZS6ZzoG6.js → index-BJoz6WwT.js} +1 -1
  59. package/dist/assets/{index-B279n2SU.js → index-BaXflaWS.js} +1 -1
  60. package/dist/assets/{index-D1RNQpBT.js → index-BnrZWi5Z.js} +1 -1
  61. package/dist/assets/{index-DdsTi3DP.js → index-BpNMB898.js} +1 -1
  62. package/dist/assets/{index-EaL01-bR.js → index-BwxADmjf.js} +1 -1
  63. package/dist/assets/{index-BdwM5BLe.js → index-C7--Z-bz.js} +1 -1
  64. package/dist/assets/{index-D-pDYa6O.js → index-C9WXD0qn.js} +1 -1
  65. package/dist/assets/{index-DiAQvbPQ.js → index-CBkO-wWf.js} +1 -1
  66. package/dist/assets/{index-D2XucFi1.js → index-CCyOxJsQ.js} +1 -1
  67. package/dist/assets/{index-DBGyP5fo.js → index-CEnjyOH4.js} +1 -1
  68. package/dist/assets/{index-BNR4FIDg.js → index-CJ1CxpcA.js} +1 -1
  69. package/dist/assets/{index-DcLgGPiX.js → index-CPnluZ8F.js} +1 -1
  70. package/dist/assets/{index-Byhqw1uO.js → index-CoCyT84a.js} +1 -1
  71. package/dist/assets/{index-CcHXhRSM.js → index-CvTtblB-.js} +1 -1
  72. package/dist/assets/{index-yDaLeZ9r.js → index-M8U-UVGz.js} +1 -1
  73. package/dist/assets/{index-C9xzV0Q7.js → index-TN3UJtGJ.js} +1 -1
  74. package/dist/assets/{index-Bm2EGIx2.js → index-TlBQdztR.js} +1 -1
  75. package/dist/assets/{index-BFUeirJF.js → index-aSzmSoRW.js} +1 -1
  76. package/dist/assets/{index-06ewE7Mw.js → index-bogLIQLo.js} +1 -1
  77. package/dist/assets/{index-nWt46AGY.js → index-k07W21gw.js} +1 -1
  78. package/dist/assets/{index-C0D1eZ2Z.js → index-vb7hs08t.js} +1 -1
  79. package/dist/assets/{index.es-DAxeCwmH.js → index.es-Du3tur1S.js} +1 -1
  80. package/dist/assets/{isEqual-DCq9iBB-.js → isEqual-Dx-vkFq-.js} +1 -1
  81. package/dist/assets/{isPlainObject-BcBVDz8v.js → isPlainObject-BYsfJaBJ.js} +1 -1
  82. package/dist/assets/{order-RHAZQZ2R.js → order-CI2fxXdo.js} +1 -1
  83. package/dist/assets/{price-cfV_g5sr.js → price-t8MOlEZl.js} +1 -1
  84. package/dist/assets/{strings-Dx5Ed-QV.js → strings-BeRSgJ_j.js} +1 -1
  85. package/dist/assets/{typescript--c8-UPe1.js → typescript-BulUHzox.js} +1 -1
  86. package/dist/assets/{use-form-item-Dix3-pV7.js → use-form-item-DQLXC7bB.js} +1 -1
  87. package/dist/index.html +2 -2
  88. package/package.json +1 -1
  89. package/dist/assets/Console-BAK6l-EJ.css +0 -1
  90. package/dist/assets/Console-BRhPcg2a.js +0 -1
  91. package/dist/assets/Index-6wdKBGrW.js +0 -1
  92. package/dist/assets/Index-B0gVKj-O.js +0 -1
  93. package/dist/assets/Index-B6OWUmGD.js +0 -1
  94. package/dist/assets/Index-CMQSpKVP.js +0 -1
  95. package/dist/assets/Index-DAQNVZGM.js +0 -1
  96. package/dist/assets/Index-DAiKDRxv.js +0 -1
  97. package/dist/assets/Index-hYsF9zUi.js +0 -1
  98. package/dist/assets/Index-tfCbAT4F.js +0 -1
  99. package/dist/assets/NoTasks-Cc0R3Fu6.js +0 -1
@@ -0,0 +1 @@
1
+ import{F as K}from"./index.es-Du3tur1S.js";import{E as X}from"./index-BnrZWi5Z.js";import{E as de}from"./index-TN3UJtGJ.js";import{aj as pe,ap as me,bI as fe,ak as ae,c9 as he,_ as _e,d as b,a as $e,al as ge,c as F,bh as ve,bn as ke,aw as le,b as h,o as l,i as w,r as U,f as oe,e as V,j as $,b8 as re,E as D,n as ye,g as we,h as E,t as r,k as s,l as c,eR as se,x as g,F as z,v as q,eS as H,c6 as be,D as I,eT as Q,eU as x,y,J as Z,cN as ee,eV as B,bR as Ce,dm as W,ah as P,eW as G,an as Se,K as Ae,eX as Le,de as Ee,dl as Ve}from"./index-B0x7ZUfV.js";import{E as ce}from"./index-M8U-UVGz.js";import{E as je,a as Fe}from"./index-BJ3fX-94.js";import{I as M}from"./InfoIcon-Cc4oAk_g.js";import{E as Te}from"./index-C9WXD0qn.js";import{E as L}from"./index-AkGhTpcD.js";import{E as J}from"./index-CCyOxJsQ.js";import{E as Pe,a as ue}from"./index-bogLIQLo.js";import{E as Y}from"./index-k07W21gw.js";import{C as Ie,N as Ue}from"./NoTasks-2hz79Crs.js";import{a as ze}from"./price-t8MOlEZl.js";import{E as Re,a as De,b as Ge}from"./index-CBkO-wWf.js";import{E as Me}from"./index-CvTtblB-.js";import{E as Oe}from"./index-CPnluZ8F.js";import{E as Be,a as We}from"./index-BHZI17om.js";import"./use-form-item-DQLXC7bB.js";import"./index-r5W6hzzQ.js";import"./index-BpNMB898.js";import"./index-CEnjyOH4.js";import"./typescript-BulUHzox.js";import"./strings-BeRSgJ_j.js";import"./castArray-DTYSPAQ5.js";import"./isEqual-Dx-vkFq-.js";import"./_initCloneObject-itvorlxB.js";import"./debounce-BBWNLmow.js";import"./_baseIteratee-BxLTPJCW.js";import"./index-CJ1CxpcA.js";import"./index-B-x2lsnR.js";import"./_baseClone-BUEYiiKE.js";import"./index-BJoz6WwT.js";import"./dropdown-DdliLGbX.js";const Ne=pe({size:{type:[Number,String],values:he,default:"",validator:e=>ae(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:fe},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),qe={error:e=>e instanceof Event},He=b({name:"ElAvatar"}),Ke=b({...He,props:Ne,emits:qe,setup(e,{emit:t}){const i=e,o=$e("avatar"),a=ge(!1),u=F(()=>{const{size:n,icon:m,shape:k}=i,f=[o.b()];return ve(n)&&f.push(o.m(n)),m&&f.push(o.m("icon")),k&&f.push(o.m(k)),f}),d=F(()=>{const{size:n}=i;return ae(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=F(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function _(n){a.value=!0,t("error",n)}return(n,m)=>(l(),h("span",{class:ye(V(u)),style:oe(V(d))},[(n.src||n.srcSet)&&!a.value?(l(),h("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(V(p)),onError:_},null,44,["src","alt","srcset"])):n.icon?(l(),w(V(D),{key:1},{default:$(()=>[(l(),w(re(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Xe=_e(Ke,[["__file","avatar.vue"]]);const Ze=we(Xe),Je=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:X,FontAwesomeIcon:K},data(){return{drawer:!1,preview:!1}},computed:{}}),Ye={class:"main"},Qe={class:"config"},xe={class:"result"},et={class:"preview"};function tt(e,t,i,o,a,u){const d=c("font-awesome-icon"),p=c("el-button"),_=c("el-drawer");return l(),h("div",Ye,[r("div",Qe,[U(e.$slots,"config",{},void 0,!0)]),r("div",xe,[U(e.$slots,"result",{},void 0,!0)]),r("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(d,{icon:"fa-solid fa-magic"})]),_:1}),s(_,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ot=E(Je,[["render",tt],["__scopeId","data-v-c954d282"]]),st=b({name:"VersionSelector",components:{ElSelect:Fe,ElOption:je,ElSwitch:ce},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),nt={class:"field"},it={class:"title font-bold"};function at(e,t,i,o,a,u){const d=c("el-switch"),p=c("el-option"),_=c("el-select");return l(),h("div",nt,[r("h2",it,g(e.$t("suno.name.type")),1),s(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(_,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(l(!0),h(z,null,q(e.options,n=>(l(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=E(st,[["render",at],["__scopeId","data-v-5a66a01f"]]),rt=b({name:"UploadAudio",components:{ElUpload:Te,ElButton:X,InfoIcon:M,FontAwesomeIcon:K},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}L.info(this.$t("suno.message.startingUploadAudio")),H.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const a=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:a,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{L.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ct={class:"relative"},ut={class:"flex justify-between"},dt={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function mt(e,t,i,o,a,u){const d=c("info-icon"),p=c("font-awesome-icon"),_=c("el-button"),n=c("el-upload");return l(),h("div",ct,[r("div",ut,[r("div",dt,[r("span",pt,g(e.$t("suno.name.referenceAudios")),1),s(d,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:$(()=>[s(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+g(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ft=E(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ht="",_t=b({name:"PromptInput",components:{ElInput:J,ElSwitch:ce,InfoIcon:M},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ht)}}),$t={class:"field"},gt={class:"box"},vt={class:"title-info"},kt={class:"title font-bold"},yt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-switch"),_=c("el-input");return l(),h("div",$t,[r("div",gt,[r("div",vt,[r("h2",kt,g(e.$t("suno.name.prompt")),1),s(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",yt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),r("h2",wt,g(e.$t("suno.name.instrumental")),1)])]),s(_,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ct=E(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",At=b({name:"LyricInput",components:{ElInput:J,InfoIcon:M},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=St)}}),Lt={class:"field"},Et={class:"box"},Vt={class:"title font-bold"};function jt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Lt,[r("div",Et,[r("h2",Vt,g(e.$t("suno.name.lyrics")),1),s(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Ft=E(At,[["render",jt],["__scopeId","data-v-99dfded8"]]),Tt=b({name:"StyleInput",components:{ElInput:J,InfoIcon:M},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Pt={class:"field"},It={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Pt,[r("div",It,[r("h2",Ut,g(e.$t("suno.name.style")),1),s(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=_=>e.style=_),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Rt=E(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Dt=b({name:"TitleInput",components:{ElInput:J,InfoIcon:M},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Mt={class:"title-container"},Ot={class:"title font-bold"};function Bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Gt,[r("div",Mt,[r("h2",Ot,g(e.$t("suno.name.title")),1),s(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=_=>e.title=_),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Wt=E(Dt,[["render",Bt],["__scopeId","data-v-ce70fe34"]]);function R(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const Nt=b({name:"ExtendFromInput",components:{ElImage:Y,ElIcon:D,ElInputNumber:Pe,VideoPlay:x,VideoPause:Q},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:R,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),qt={class:"field"},Ht={class:"box"},Kt={class:"title font-bold"},Xt={class:"input-wrapper"},Zt={class:"task"},Jt={class:"left"},Yt={key:2,class:"duration"},Qt={class:"info"},xt={class:"title"},eo={class:"style"};function to(e,t,i,o,a,u){const d=c("el-input-number"),p=c("el-image"),_=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=ee("loading");return l(),h("div",qt,[r("div",Ht,[r("h2",Kt,g(e.$t("suno.name.extend")),1),r("div",Xt,[s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),r("div",Zt,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[3]||(t[3]=f=>e.onClick(e.audio))},[Z((l(),h("div",Jt,[s(p,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=f=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(_)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=f=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.duration?(l(),h("div",Yt,g(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),r("div",Qt,[r("h2",xt,g(e.audio?.title),1),r("p",eo,g(e.audio?.style),1)])])):y("",!0)])])}const oo=E(Nt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=b({name:"CoverFromInput",components:{ElImage:Y,ElIcon:D,VideoPlay:x,VideoPause:Q},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:R,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),no={class:"field"},io={class:"box"},ao={class:"title font-bold"},lo={class:"task"},ro={class:"left"},co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"};function fo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=ee("loading");return l(),h("div",no,[r("div",io,[r("h2",ao,g(e.$t("suno.name.cover")),1)]),r("div",lo,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((l(),h("div",ro,[s(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(_,null,{default:$(()=>[s(p)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(_,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(l(),h("div",co,g(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),r("div",uo,[r("h2",po,g(e.audio?.title),1),r("p",mo,g(e.audio?.style),1)])])):y("",!0)])])}const ho=E(so,[["render",fo],["__scopeId","data-v-06640216"]]),_o=b({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:Ft,StyleInput:Rt,TitleInput:Wt,ExtendFromInput:oo,CoverFromInput:ho,UploadAudio:ft,FontAwesomeIcon:K,ElButton:X,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return ze(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$o={class:"flex flex-col h-full"},go={class:"flex-1 overflow-y-auto p-[15px]"},vo={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ko(e,t,i,o,a,u){const d=c("type-selector"),p=c("upload-audio"),_=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),f=c("extend-from-input"),C=c("cover-from-input"),j=c("consumption"),T=c("font-awesome-icon"),A=c("el-button");return l(),h("div",$o,[r("div",go,[s(d,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?y("",!0):(l(),w(_,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(l(),w(m,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(l(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(l(),w(f,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):y("",!0)]),r("div",vo,[s(j,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+g(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+g(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const yo=E(_o,[["render",ko],["__scopeId","data-v-b9fab929"]]);var N={exports:{}},wo=N.exports,ne;function bo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(wo,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,k){var f=new XMLHttpRequest;f.open("GET",n),f.responseType="blob",f.onload=function(){_(f.response,m,k)},f.onerror=function(){console.error("could not download file")},f.send()}function a(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function u(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof B=="object"&&B.global===B?B:void 0,p=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),_=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var f=d.URL||d.webkitURL,C=document.createElement("a");m=m||n.name||"download",C.download=m,C.rel="noopener",typeof n=="string"?(C.href=n,C.origin===location.origin?u(C):a(C.href)?o(n,m,k):u(C,C.target="_blank")):(C.href=f.createObjectURL(n),setTimeout(function(){f.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,k){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),m);else if(a(n))o(n,m,k);else{var f=document.createElement("a");f.href=n,f.target="_blank",setTimeout(function(){u(f)})}}:function(n,m,k,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,k);var C=n.type==="application/octet-stream",j=/constructor/i.test(d.HTMLElement)||d.safari,T=/CriOS\/[\d]+/.test(navigator.userAgent);if((T||C&&j||p)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var S=A.result;S=T?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=S:location=S,f=null},A.readAsDataURL(n)}else{var O=d.URL||d.webkitURL,v=O.createObjectURL(n);f?f.location=v:location.href=v,f=null,setTimeout(function(){O.revokeObjectURL(v)},4e4)}});d.saveAs=_.saveAs=_,e.exports=_})}(N)),N.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Ao=b({name:"TaskPreview",components:{ElImage:Y,ElIcon:D,ElTooltip:Me,ElButton:X,FontAwesomeIcon:K,VideoPlay:x,VideoPause:Q,ElDropdown:Ge,ElDropdownMenu:De,ElDropdownItem:Re,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(i=>({...i,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:R,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{Co.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),L.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}H.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:So},o=this.credential?.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(i,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{L.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Lo={class:"task"},Eo=["onClick"],Vo={class:"left"},jo=["onClick"],Fo=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Io={class:"title"},Uo={class:"style"},zo={class:"right"},Ro={class:"el-dropdown-link"},Do={class:"flex items-center min-w-[120px]"},Go={class:"el-dropdown-link"};function Mo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=c("el-button"),k=c("font-awesome-icon"),f=c("el-tooltip"),C=c("Loading"),j=c("el-dropdown-item"),T=c("el-dropdown-menu"),A=c("el-dropdown"),O=ee("loading");return l(),h("div",Lo,[(l(!0),h(z,null,q(e.audios,v=>(l(),h("div",{key:v.id,class:"audio",onClick:P(S=>e.onClick(v),["stop"])},[Z((l(),h("div",Vo,[s(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(),h("div",{key:0,class:"overlay",onClick:P(S=>e.onPause(v),["stop"])},[s(_,null,{default:$(()=>[s(p)]),_:1})],8,jo)):y("",!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(),h("div",{key:1,class:"overlay",onClick:P(S=>e.onPlay(v),["stop"])},[s(_,null,{default:$(()=>[s(n)]),_:1})],8,Fo)):y("",!0),v?.duration?(l(),h("div",To,g(e.useFormatDuring(v?.duration)),1)):y("",!0)])),[[O,!v?.audio_url]]),r("div",Po,[r("h2",Io,g(v?.title),1),r("p",Uo,g(v?.style),1)]),r("div",zo,[v?.audio_url?(l(),w(m,{key:0,size:"small",round:"",onClick:P(S=>e.onExtend(S,v),["stop"])},{default:$(()=>[I(g(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[s(j,{disabled:e.isFetchingVideoUrl,onClick:S=>e.handleVideoDownload(v)},{default:$(()=>[r("div",Do,[e.isFetchingVideoUrl?(l(),w(_,{key:0,class:"is-loading mr-2"},{default:$(()=>[s(C)]),_:1})):y("",!0),r("span",null,g(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:$(()=>[I(g(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[r("span",Ro,[s(f,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[v?.audio_url||v?.video_url?(l(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[v.id?(l(),w(j,{key:0,onClick:P(S=>e.onGetStems(v.id),["stop"])},{default:$(()=>[I(g(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(j,{onClick:P(S=>e.onCover(v),["stop"])},{default:$(()=>[I(g(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:$(()=>[I(g(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[r("span",Go,[s(f,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[v?.audio_url||v?.video_url?(l(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Eo))),128))])}const Oo=E(Ao,[["render",Mo]]),Bo={class:"player-slider"},Wo=b({__name:"PlayerSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=F({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),a=()=>{},u=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,p)=>(l(),h("div",Bo,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=_=>i.value=_),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),No="/assets/disk-XFRmVAfp.png",qo={class:"flex player-song"},Ho=["src"],Ko={class:"ml-2 text-xs flex flex-col justify-between"},Xo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Zo={class:"flex"},Jo={class:"ml-2 text-dc"},Yo=b({__name:"PlayerSong",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),h("div",qo,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||V(No)},null,8,Ho),r("div",Ko,[r("div",Xo,[r("div",Zo,[r("span",null,g(i.value?.title||"Music"),1),r("span",Jo,"- "+g(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Qo={class:"flex justify-end items-center gap-x-2.5"},xo={class:"text-xs"},es=b({__name:"PlayerAction",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=F({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),h("div",Qo,[r("span",xo,g(V(R)(i.value))+" / "+g(V(R)(o.value)),1)]))}});var ts={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function os(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function ss(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:a,id:e}}var ns=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=os(),p=Se(ns,ts);return function(){var _=u.size,n=u.strokeWidth,m=u.strokeLinecap,k=u.strokeLinejoin,f=u.theme,C=u.fill,j=u.spin,T=ss(d,{size:_,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:f,fill:C},p),A=[p.prefix+"-icon"];return A.push(p.prefix+"-icon-"+e),t&&p.rtl&&A.push(p.prefix+"-icon-rtl"),j&&A.push(p.prefix+"-icon-spin"),s("span",{class:A.join(" ")},[i(T)])}}};return o}const is=te("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),as=te("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ls=te("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ie=b({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),w(re(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),rs={class:"player-volume flex flex-col items-center pt-2"},cs={class:"text-sm mt-3"},us=b({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=F({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),h("div",rs,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=p=>i.value=p),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",cs,g(i.value),1)]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=b({__name:"PlayerController",setup(e){const t=G(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=F(()=>t.state.suno.audio);return(a,u)=>(l(),h("div",ds,[s(ie,{icon:o.value?.state==="playing"?V(is):V(as),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),s(V(Oe),{placement:"top",width:"50px",trigger:"click"},{reference:$(()=>[s(ie,{icon:V(ls),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},fs={class:"flex grow px-5 items-center"},hs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},gs=b({__name:"Player",setup(e){return(t,i)=>(l(),h("div",ms,[s(Wo),r("div",fs,[r("div",hs,[s(Yo)]),r("div",_s,[s(ps)]),r("div",$s,[s(es)])])]))}}),vs=b({name:"RecentPanel",components:{ElSkeletonItem:We,ElSkeleton:Be,TaskPreview:Oo,Player:gs,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")}}}),ks={key:0,class:"tasks"},ys={class:"left w-[70px] p-[10px] flex items-center"},ws={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},bs={key:2,class:"w-full flex-1 flex items-center justify-center"},Cs={class:"h-20"};function Ss(e,t,i,o,a,u){const d=c("el-skeleton-item"),p=c("el-skeleton"),_=c("task-preview"),n=c("no-tasks"),m=c("player");return l(),h(z,null,[e.tasks?.items===void 0?(l(),h("div",ks,[(l(),h(z,null,q(3,k=>r("div",{key:k,class:"flex"},[r("div",ys,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),r("div",ws,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),s(d,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),h("div",{key:1,class:"flex-1 w-full overflow-y-auto tasks p-2",onScroll:t[0]||(t[0]=(...k)=>e.onHandleScroll&&e.onHandleScroll(...k))},[(l(!0),h(z,null,q(e.tasks?.items,(k,f)=>(l(),w(_,{key:f,"model-value":k,class:"preview"},null,8,["model-value"]))),128))],32)):y("",!0),e.tasks?.items?.length===0?(l(),h("div",bs,[s(n)])):y("",!0),Z(r("div",Cs,[s(m)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=E(vs,[["render",Ss]]),Ls=b({name:"TaskPreview",components:{IconPicture:Le,ElImage:Y,ElAvatar:Ze,ElIcon:D},computed:{audio(){return this.$store.state.suno?.audio}}}),Es={key:0,class:"size-full overflow-hidden"},Vs={class:"relative h-[300px]"},js={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Fs={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Ts={class:"p-4"},Ps={class:"flex items-center font-bold mb-2"},Is={class:"text-[var(--el-text-color-regular)] mb-2"},Us={class:"text-xs text-[var(--el-text-color-regular)]"},zs={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Rs={key:1,class:"w-full h-full"};function Ds(e,t,i,o,a,u){const d=c("icon-picture"),p=c("el-icon"),_=c("el-image"),n=c("el-avatar");return e.audio?.object?(l(),h("div",Es,[r("div",Vs,[s(_,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:$(()=>[r("div",js,[s(p,{class:"text-3xl"},{default:$(()=>[s(d)]),_:1})])]),_:1},8,["src"]),r("h2",Fs,g(e.audio?.title),1)]),r("div",Ts,[r("div",Ps,[s(n,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,g(e.audio?.title),1)]),r("p",Is,g(e.audio?.style),1),r("p",Us,g(e.$dayjs.format(e.audio?.created_at)),1),r("div",zs,[r("p",null,g(e.audio?.lyric),1)])])])):(l(),h("div",Rs))}const Gs=E(Ls,[["render",Ds]]),Ms="https://webhook.acedata.cloud/suno",Os=b({name:"SunoIndex",components:{Layout:ot,ConfigPanel:yo,RecentPanel:As,PreviewPanel:Gs},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===W.Request},needApply(){return this.$store.state.suno.status.getApplications===W.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ee.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ve&&L.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ms},t=this.credential?.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{L.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Bs(e,t,i,o,a,u){const d=c("config-panel"),p=c("recent-panel"),_=c("preview-panel"),n=c("layout");return l(),w(n,null,{config:$(()=>[s(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(_)]),_:1})}const Cn=E(Os,[["render",Bs],["__scopeId","data-v-f5721d95"]]);export{Cn as default};
@@ -0,0 +1 @@
1
+ import{F as G}from"./index.es-Du3tur1S.js";import{E as R}from"./index-BnrZWi5Z.js";import{E as z}from"./index-TN3UJtGJ.js";import{d as $,h as g,b as r,t as l,k as t,r as L,j as u,l as s,o as n,ey as M,x as a,F as A,v as U,i as y,ez as q,eA as N,eB as H,n as T,f as J,y as f,c6 as K,D as h,J as E,K as S,eC as Q,dr as W,dm as X}from"./index-B0x7ZUfV.js";import{E as D,a as O}from"./index-BJ3fX-94.js";import{I as j}from"./InfoIcon-Cc4oAk_g.js";import{E as Y}from"./index-M8U-UVGz.js";import{V as P}from"./VideoPlayer-PJ-9LA2g.js";import{I as Z}from"./ImagePreview-VkHqgeBl.js";import{E as x}from"./index-C9WXD0qn.js";import{E as I}from"./index-AkGhTpcD.js";import{C as ee,N as te}from"./NoTasks-2hz79Crs.js";import{E as oe}from"./index-CCyOxJsQ.js";import{a as se}from"./price-t8MOlEZl.js";import{C as ne}from"./CopyToClipboard-B5E56t6E.js";import{E as ae}from"./index-CvTtblB-.js";import{E as le}from"./index--dZny59W.js";import{E as ie}from"./index-k07W21gw.js";import{B as re}from"./BotPlaceholder-ZNnLvGsO.js";import"./use-form-item-DQLXC7bB.js";import"./index-r5W6hzzQ.js";import"./index-CEnjyOH4.js";import"./typescript-BulUHzox.js";import"./index-BpNMB898.js";import"./strings-BeRSgJ_j.js";import"./castArray-DTYSPAQ5.js";import"./isEqual-Dx-vkFq-.js";import"./_initCloneObject-itvorlxB.js";import"./debounce-BBWNLmow.js";import"./_baseIteratee-BxLTPJCW.js";import"./index-CJ1CxpcA.js";import"./vue-plyr-QZFBikSk.js";import"./index-B-x2lsnR.js";import"./_baseClone-BUEYiiKE.js";import"./index-BJoz6WwT.js";import"./index-BHZI17om.js";const ce=$({name:"LayoutVeo",components:{ElDrawer:z,ElButton:R,FontAwesomeIcon:G},data(){return{drawer:!1}}}),de={class:"main"},ue={class:"config"},pe={class:"result"};function me(e,o,m,v,b,k){const c=s("font-awesome-icon"),d=s("el-button"),i=s("el-drawer");return n(),r("div",de,[l("div",ue,[L(e.$slots,"config",{},void 0,!0)]),l("div",pe,[L(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=w=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=w=>e.drawer=w),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[L(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const fe=g(ce,[["render",me],["__scopeId","data-v-9ef3dd3f"]]),ve=$({name:"ModelSelector",components:{ElSelect:O,ElOption:D},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"veo2",label:"veo2"},{value:"veo2-fast",label:"veo2-fast"},{value:"veo3",label:"veo3"},{value:"veo3-fast",label:"veo3-fast"}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||(this.value=M)}}),_e={class:"field"},he={class:"title font-bold"};function $e(e,o,m,v,b,k){const c=s("el-option"),d=s("el-select");return n(),r("div",_e,[l("h2",he,a(e.$t("veo.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select")},{default:u(()=>[(n(!0),r(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ge=g(ve,[["render",$e],["__scopeId","data-v-ef445fc5"]]),be=$({name:"ActionSelector",components:{ElSelect:O,ElOption:D},data(){return{}},computed:{options(){return[{value:"text2video",label:this.$t("veo.button.action1")},{value:"image2video",label:this.$t("veo.button.action2")},{value:"get1080p",label:this.$t("veo.button.action3")}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||(this.value=q)}}),ke={class:"field"},we={class:"title font-bold"},ye={class:"float-left"};function Ve(e,o,m,v,b,k){const c=s("el-option"),d=s("el-select");return n(),r("div",ke,[l("h2",we,a(e.$t("veo.name.action")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select"),clearable:""},{default:u(()=>[(n(!0),r(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},{default:u(()=>[l("span",ye,a(i.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(be,[["render",Ve],["__scopeId","data-v-ba5abc8a"]]),Se=$({name:"TranslationSelector",components:{ElSwitch:Y,InfoIcon:j},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug("set translation",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=N)}}),Ie={class:"relative"},Te={class:"flex justify-between"},Ce={class:"flex justify-start items-center"},Ae={class:"text-sm font-bold"},Ge={class:"flex justify-end items-center"};function Re(e,o,m,v,b,k){const c=s("info-icon"),d=s("el-switch");return n(),r("div",Ie,[l("div",Te,[l("div",Ce,[l("span",Ae,a(e.$t("veo.name.translation")),1),t(c,{content:e.$t("veo.description.translation")},null,8,["content"])]),l("div",Ge,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value"},null,8,["modelValue"])])])])}const Ue=g(Se,[["render",Re]]),Le=$({name:"AspectRatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=H)}}),je={class:"text-sm font-bold mb-2 block"},De={class:"items"},Oe=["onClick"],Pe={class:"name"};function Fe(e,o,m,v,b,k){return n(),r("div",null,[l("span",je,a(e.$t("veo.name.ratio")),1),l("div",De,[(n(!0),r(A,null,U(e.options,(c,d)=>(n(),r("div",{key:d,class:T({active:e.active===d,item:!0}),onClick:i=>e.value=c.value},[l("div",{class:T(["preview",c.label])},[l("div",{class:"rect",style:J({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",Pe,a(c.label),1)],10,Oe))),128))])])}const Be=g(Le,[["render",Fe],["__scopeId","data-v-688d3e9d"]]),ze=$({name:"VideoFromInput",components:{VideoPlayer:P},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.veo?.config}}}),Me={class:"relative"},qe={class:"flex mb-2"},Ne={class:"text-sm font-bold"};function He(e,o,m,v,b,k){const c=s("video-player");return n(),r("div",Me,[l("div",qe,[l("span",Ne,a(e.$t("veo.name.action3")),1)]),l("div",null,[e.config?.video_url?(n(),y(c,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const Je=g(ze,[["render",He]]),Ke=$({name:"StartEndImage",components:{ElUpload:x,ElButton:R,InfoIcon:j,FontAwesomeIcon:G,ImagePreview:Z},emits:["change"],data(){return{fileList:[],uploadUrl:K()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartEndImageUrl()},methods:{onExceed(){I.warning(this.$t("veo.message.uploadReferencesExceed"))},onError(){I.error(this.$t("veo.message.uploadReferencesError"))},onSetStartEndImageUrl(){const e=this.urls;this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Qe={class:"relative"},We={class:"flex justify-between"},Xe={class:"flex justify-start items-center"},Ye={class:"text-sm font-bold"};function Ze(e,o,m,v,b,k){const c=s("info-icon"),d=s("image-preview"),i=s("font-awesome-icon"),w=s("el-button"),_=s("el-upload");return n(),r("div",Qe,[l("div",We,[l("div",Xe,[l("span",Ye,a(e.$t("veo.name.startEndImage")),1),t(c,{content:e.$t("veo.description.uploadStartEndImage")},null,8,["content"])])]),t(_,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:2,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(w,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(i,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+a(e.$t("veo.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const xe=g(Ke,[["render",Ze],["__scopeId","data-v-43d971b7"]]),et="",tt=$({name:"PromptInput",components:{ElInput:oe,InfoIcon:j},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=et)}}),ot={class:"field"},st={class:"box"},nt={class:"title font-bold"};function at(e,o,m,v,b,k){const c=s("info-icon"),d=s("el-input");return n(),r("div",ot,[l("div",st,[l("h2",nt,a(e.$t("veo.name.prompt")),1),t(c,{content:e.$t("veo.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=i=>e.prompt=i),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("veo.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const lt=g(tt,[["render",at],["__scopeId","data-v-9189572a"]]),it=$({name:"ConfigPanel",components:{ElButton:R,Consumption:ee,FontAwesomeIcon:G,PromptInput:lt,ModelSelector:ge,StartEndImage:xe,ActionSelector:Ee,VideoFromInput:Je,TranslationSelector:Ue,AspectRatioSelector:Be},emits:["generate"],computed:{config(){return this.$store.state.veo?.config},consumption(){return se(this.config,this.service?.metadata?.price)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),rt={class:"flex flex-col h-full"},ct={class:"flex-1 overflow-y-auto p-[15px]"},dt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ut(e,o,m,v,b,k){const c=s("video-from-input"),d=s("action-selector"),i=s("translation-selector"),w=s("aspect-ratio-selector"),_=s("prompt-input"),p=s("model-selector"),V=s("start-end-image"),C=s("consumption"),F=s("font-awesome-icon"),B=s("el-button");return n(),r("div",rt,[l("div",ct,[E(t(c,{class:"mb-4"},null,512),[[S,e.config?.action==="get1080p"]]),t(d,{class:"mb-4"}),E(t(i,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(w,{class:"mb-4"},null,512),[[S,e.config?.action==="image2video"]]),E(t(_,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(p,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(V,{class:"mb-2"},null,512),[[S,e.config?.action==="image2video"]])]),l("div",dt,[t(C,{value:e.consumption,service:e.service},null,8,["value","service"]),t(B,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(F,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+a(e.$t("veo.button.generate")),1)]),_:1},8,["onClick"])])])}const pt=g(it,[["render",ut]]),mt=$({name:"TaskPreview",components:{ElImage:ie,CopyToClipboard:ne,FontAwesomeIcon:G,ElAlert:le,VideoPlayer:P,ElTooltip:ae,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onGet1080p(e,o){console.debug("set config",o),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,video_id:o?.data?.[0]?.id,video_url:o?.data[0]?.video_url,action:"get1080p"})},onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),ft={class:"preview"},vt={class:"left"},_t={class:"main"},ht={class:"bot"},$t={class:"datetime"},gt={class:"info"},bt={key:0,class:"prompt mt-2"},kt={key:0},wt={key:1},yt={key:0,class:T({content:!0,failed:!0})},Vt={key:0,class:"mb-4"},Et={key:1,class:T({operations:!0,"mt-2":!0})},St={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},It={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Tt={key:1,class:T({content:!0})},Ct={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},At={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Gt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Rt={key:2,class:T({content:!0})},Ut={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Lt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function jt(e,o,m,v,b,k){const c=s("el-image"),d=s("video-player"),i=s("el-button"),w=s("el-tooltip"),_=s("font-awesome-icon"),p=s("copy-to-clipboard"),V=s("el-alert");return n(),r("div",ft,[l("div",vt,[t(c,{src:"https://cdn.acedata.cloud/8nxyy9.jpg",class:"avatar"})]),l("div",_t,[l("div",ht,[h(a(e.$t("veo.name.veoBot"))+" ",1),l("span",$t,a(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",gt,[e.modelValue?.request?.prompt?(n(),r("p",bt,[h(a(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(n(),r("span",kt," - ("+a(e.$t("veo.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="running"?(n(),r("span",wt," - ("+a(e.$t("veo.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),r("div",yt,[e.modelValue?.response?.data[0]?.video_url?(n(),r("div",Vt,[t(d,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response.success?(n(),r("div",Et,[t(w,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=C=>e.onGet1080p(C,e.modelValue?.response))},{default:u(()=>[h(a(e.$t("veo.button.action3")),1)]),_:1})):f("",!0)]),_:1},8,["content"]),t(w,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=C=>e.onDownload(C,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[h(a(e.$t("veo.button.download")),1)]),_:1})):f("",!0)]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",St,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.model"))+": "+a(e.modelValue?.request?.model),1)]),l("p",It,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Tt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Ct,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),l("p",At,[t(_,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+a(e.$t("veo.name.failureReason"))+": "+a(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",Gt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Rt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Ut,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Lt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0)])])}const Dt=g(mt,[["render",jt],["__scopeId","data-v-5372c9d1"]]),Ot=$({name:"RecentPanel",components:{TaskPreview:Dt,NoTasks:te,BotPlaceholder:re},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Pt={key:0},Ft={key:1,class:"tasks h-full w-full overflow-y-auto"},Bt={key:2,class:"w-full h-full flex items-center justify-center"};function zt(e,o,m,v,b,k){const c=s("bot-placeholder"),d=s("task-preview"),i=s("no-tasks");return n(),r(A,null,[e.tasks?.items===void 0?(n(),r("div",Pt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",Ft,[(n(!0),r(A,null,U(e.tasks?.items,(w,_)=>(n(),y(d,{key:_,"model-value":w},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(n(),r("div",Bt,[t(i)])):f("",!0)],64)}const Mt=g(Ot,[["render",zt]]),qt="https://webhook.acedata.cloud/veo",Nt=$({name:"VeoIndex",components:{ConfigPanel:pt,Layout:fe,RecentPanel:Mt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.veo?.status?.getApplications===X.Request},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,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("veo/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("veo/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:v}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",v),await this.$store.dispatch("veo/getTasks",{limit:o,createdAtMin:m,createdAtMax:v})},async onGenerate(){const e={...this.config,callback_url:qt},o=this.credential?.token;if(!o){console.error("no token specified");return}I.info(this.$t("veo.message.startingTask")),Q.generate(e,{token:o}).then(()=>{I.success(this.$t("veo.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===W?I.error(this.$t("veo.message.usedUp")):I.error(this.$t("veo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ht(e,o,m,v,b,k){const c=s("config-panel"),d=s("recent-panel"),i=s("layout");return n(),y(i,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Co=g(Nt,[["render",Ht]]);export{Co as default};
@@ -0,0 +1 @@
1
+ import{F as I}from"./index.es-Du3tur1S.js";import{E as S}from"./index-BnrZWi5Z.js";import{E as P}from"./index-TN3UJtGJ.js";import{d as $,h as g,b as i,t as a,k as t,r as U,j as f,l as s,o as l,eK as R,x as r,F as V,v as T,i as y,eL as D,eM as F,c6 as B,D as h,y as x,n as C,eN as M,dr as O,dm as N}from"./index-B0x7ZUfV.js";import{E as L,a as G}from"./index-BJ3fX-94.js";import{I as A}from"./InfoIcon-Cc4oAk_g.js";import{E as q,a as z}from"./index-bogLIQLo.js";import{I as X}from"./ImagePreview-VkHqgeBl.js";import{E as H}from"./index-C9WXD0qn.js";import{E as k}from"./index-AkGhTpcD.js";import{E as K}from"./index-CCyOxJsQ.js";import{C as W,N as J}from"./NoTasks-2hz79Crs.js";import{a as Q}from"./price-t8MOlEZl.js";import{C as Y}from"./CopyToClipboard-B5E56t6E.js";import{I as Z}from"./ImageWrapper-Bo3sZeqj.js";import{E as ee}from"./index--dZny59W.js";import{E as te}from"./index-k07W21gw.js";import{B as oe}from"./BotPlaceholder-ZNnLvGsO.js";import"./use-form-item-DQLXC7bB.js";import"./index-r5W6hzzQ.js";import"./index-CvTtblB-.js";import"./index-BpNMB898.js";import"./typescript-BulUHzox.js";import"./index-CEnjyOH4.js";import"./strings-BeRSgJ_j.js";import"./castArray-DTYSPAQ5.js";import"./isEqual-Dx-vkFq-.js";import"./_initCloneObject-itvorlxB.js";import"./debounce-BBWNLmow.js";import"./_baseIteratee-BxLTPJCW.js";import"./index-CJ1CxpcA.js";import"./index-B-x2lsnR.js";import"./_baseClone-BUEYiiKE.js";import"./index-BJoz6WwT.js";import"./index-BHZI17om.js";const se=$({name:"LayoutFlux",components:{ElDrawer:P,ElButton:S,FontAwesomeIcon:I},data(){return{drawer:!1}}}),ne={class:"main"},ae={class:"config"},le={class:"result"};function re(e,o,m,p,v,b){const c=s("font-awesome-icon"),u=s("el-button"),n=s("el-drawer");return l(),i("div",ne,[a("div",ae,[U(e.$slots,"config",{},void 0,!0)]),a("div",le,[U(e.$slots,"result",{},void 0,!0)]),t(u,{circle:"",class:"menu",onClick:o[0]||(o[0]=d=>e.drawer=!0)},{default:f(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=d=>e.drawer=d),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:f(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ie=g(se,[["render",re],["__scopeId","data-v-126e6454"]]),ce=$({name:"ModelSelector",components:{ElSelect:G,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"flux-schnell",label:"flux-schnell"},{value:"flux-dev",label:"flux-dev"},{value:"flux-pro",label:"flux-pro"},{value:"flux-pro-1.1",label:"flux-pro-1.1"},{value:"flux-pro-1.1-ultra",label:"flux-pro-1.1-ultra"},{value:"flux-kontext-pro",label:"flux-kontext-pro"},{value:"flux-kontext-max",label:"flux-kontext-max"}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||(this.value=R)}}),ue={class:"field"},de={class:"title font-bold"};function pe(e,o,m,p,v,b){const c=s("el-option"),u=s("el-select");return l(),i("div",ue,[a("h2",de,r(e.$t("flux.name.model")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(l(!0),i(V,null,T(e.options,n=>(l(),y(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const me=g(ce,[["render",pe],["__scopeId","data-v-2e94cca6"]]),fe=$({name:"CountSelector",components:{ElSlider:z,InfoIcon:A,ElInputNumber:q},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug("set count",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||(this.value=D)}}),_e={class:"flex justify-between"},he={class:"flex justify-start items-center"},$e={class:"text-sm font-bold"},ge={class:"flex justify-end items-center"},ve={class:"w-full"};function be(e,o,m,p,v,b){const c=s("info-icon"),u=s("el-input-number"),n=s("el-slider");return l(),i("div",null,[a("div",_e,[a("div",he,[a("span",$e,r(e.$t("flux.name.numbers")),1),t(c,{content:e.$t("flux.description.numbers")},null,8,["content"])]),a("div",ge,[t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=d=>e.value=d),"controls-position":"right"},null,8,["modelValue"])])]),a("div",ve,[t(n,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=d=>e.value=d),min:1,max:4,step:1},null,8,["modelValue"])])])}const xe=g(fe,[["render",be]]),we=$({name:"ActionSelector",components:{ElSelect:G,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"generate",label:this.$t("flux.name.generate")},{value:"edits",label:this.$t("flux.name.edits")}]}},computed:{value:{get(){return this.$store.state.flux?.config?.action},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,action:e})}}},mounted(){this.value||(this.value=F)}}),ke={class:"field"},ye={class:"title font-bold"};function Ve(e,o,m,p,v,b){const c=s("el-option"),u=s("el-select");return l(),i("div",ke,[a("h2",ye,r(e.$t("flux.name.task")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(l(!0),i(V,null,T(e.options,n=>(l(),y(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(we,[["render",Ve],["__scopeId","data-v-81fd05e5"]]),Ie=$({name:"ImageUrlInput",components:{ElUpload:H,ElButton:S,InfoIcon:A,FontAwesomeIcon:I,ImagePreview:X},emits:["change"],data(){return{fileList:[],uploadUrl:B()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{urls:{handler(e){console.debug("URLs changed:",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,image_url:e[0]})}}},methods:{onExceed(){k.warning(this.$t("flux.message.uploadStartImageExceed"))},onError(){k.error(this.$t("flux.message.uploadStartImageError"))}}}),Te={class:"relative"},Ue={class:"flex justify-between"},Se={class:"flex justify-start items-center"},Ce={class:"text-sm font-bold"};function Ae(e,o,m,p,v,b){const c=s("info-icon"),u=s("image-preview"),n=s("font-awesome-icon"),d=s("el-button"),w=s("el-upload");return l(),i("div",Te,[a("div",Ue,[a("div",Se,[a("span",Ce,r(e.$t("flux.name.imageUrl")),1),t(c,{content:e.$t("flux.description.imageUrl")},null,8,["content"])])]),t(w,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=_=>e.fileList=_),name:"file",limit:5,class:"upload-wrapper",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,headers:e.headers},{file:f(({file:_})=>[t(u,{url:_.url||_.response?.file_url,name:_.name,percentage:_.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])]),default:f(()=>[t(d,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:f(()=>[t(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+r(e.$t("flux.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","headers"])])}const Le=g(Ie,[["render",Ae],["__scopeId","data-v-04710032"]]),Ge="",je=$({name:"PromptInput",components:{ElInput:K,InfoIcon:A},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=Ge)}}),Pe={class:"field"},Re={class:"box"},De={class:"title font-bold"};function Fe(e,o,m,p,v,b){const c=s("info-icon"),u=s("el-input");return l(),i("div",Pe,[a("div",Re,[a("h2",De,r(e.$t("flux.name.prompt")),1),t(c,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(u,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Be=g(je,[["render",Fe],["__scopeId","data-v-4c101a17"]]),Me=$({name:"PresetPanel",components:{ElButton:S,FontAwesomeIcon:I,PromptInput:Be,ModelSelector:me,CountSelector:xe,Consumption:W,ActionSelector:Ee,ImageUrlInput:Le},emits:["generate"],computed:{config(){return this.$store.state.flux?.config},consumption(){return Q(this.config,this.service?.metadata?.price)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Oe={class:"flex flex-col h-full"},Ne={class:"flex-1 overflow-y-auto p-[15px]"},qe={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ze(e,o,m,p,v,b){const c=s("action-selector"),u=s("prompt-input"),n=s("image-url-input"),d=s("model-selector"),w=s("count-selector"),_=s("consumption"),E=s("font-awesome-icon"),j=s("el-button");return l(),i("div",Oe,[a("div",Ne,[t(c,{class:"mb-4"}),t(u,{class:"mb-4"}),e.config?.action==="edits"?(l(),y(n,{key:0,class:"mb-4"})):x("",!0),t(d,{class:"mb-4"}),t(w,{class:"mb-4"})]),a("div",qe,[t(_,{value:e.consumption,service:e.service},null,8,["value","service"]),t(j,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[t(E,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+r(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])}const Xe=g(Me,[["render",ze]]),He=$({name:"TaskPreview",components:{ElImage:te,CopyToClipboard:Y,FontAwesomeIcon:I,ElAlert:ee,ImageWrapper:Z},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(m=>{let p=m;o&&(p.action=o),e.push(p)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Ke={class:"preview"},We={class:"left"},Je={class:"main"},Qe={class:"bot"},Ye={class:"datetime"},Ze={class:"info"},et={key:0,class:"prompt mt-2"},tt={key:0},ot={key:0,class:C({content:!0,failed:!0})},st={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},nt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},at={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},lt={key:1,class:C({content:!0})},rt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},it={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ct={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ut={key:2,class:C({content:!0})},dt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function pt(e,o,m,p,v,b){const c=s("el-image"),u=s("image-wrapper"),n=s("font-awesome-icon"),d=s("copy-to-clipboard"),w=s("el-alert");return l(),i("div",Ke,[a("div",We,[t(c,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),a("div",Je,[a("div",Qe,[h(r(e.$t("flux.name.fluxBot"))+" ",1),a("span",Ye,r(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Ze,[e.modelValue?.request?.prompt?(l(),i("p",et,[h(r(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?x("",!0):(l(),i("span",tt," - ("+r(e.$t("flux.status.pending"))+") ",1))])):x("",!0)]),e.modelValue?.response?.success===!0?(l(),i("div",ot,[a("div",st,[(l(!0),i(V,null,T(e.images,(_,E)=>(l(),y(u,{key:E,src:_?.image_url,"raw-src":_?.image_url,"model-value":_},null,8,["src","raw-src","model-value"]))),128))]),t(w,{closable:!1,class:"mt-2 success"},{default:f(()=>[a("p",nt,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+r(e.$t("flux.name.model"))+": "+r(e.modelValue?.request?.model),1)]),a("p",at,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?.success===!1?(l(),i("div",lt,[t(w,{closable:!1,class:"failure"},{template:f(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+r(e.$t("flux.name.failure")),1)]),default:f(()=>[a("p",rt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),a("p",it,[t(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+r(e.$t("flux.name.failureReason"))+": "+r(e.modelValue?.response?.error?.message)+" ",1),t(d,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),a("p",ct,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+r(e.$t("flux.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),t(d,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?x("",!0):(l(),i("div",ut,[t(w,{closable:!1,class:"info"},{template:f(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+r(e.$t("flux.name.failure")),1)]),default:f(()=>[a("p",dt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const mt=g(He,[["render",pt],["__scopeId","data-v-fd5838a5"]]),ft=$({name:"RecentPanel",components:{TaskPreview:mt,BotPlaceholder:oe,NoTasks:J},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),_t={key:0},ht={key:1,class:"tasks h-full w-full overflow-y-auto"},$t={key:2,class:"w-full h-full flex items-center justify-center"};function gt(e,o,m,p,v,b){const c=s("bot-placeholder"),u=s("task-preview"),n=s("no-tasks");return l(),i(V,null,[e.tasks?.items===void 0?(l(),i("div",_t,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),i("div",ht,[(l(!0),i(V,null,T(e.tasks?.items,d=>(l(),y(u,{key:d.id,"model-value":d},null,8,["model-value"]))),128))])):x("",!0),e.tasks?.items?.length===0?(l(),i("div",$t,[t(n)])):x("",!0)],64)}const vt=g(ft,[["render",gt]]),bt="https://webhook.acedata.cloud/flux",xt=$({name:"FluxIndex",components:{ConfigPanel:Xe,Layout:ie,RecentPanel:vt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===N.Request},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("flux/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("flux/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:p}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",p),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:m,createdAtMax:p})},async onGenerate(){const e={...this.config,callback_url:bt},o=this.credential?.token;if(!o){console.error("no token specified");return}k.info(this.$t("flux.message.startingTask")),M.generate(e,{token:o}).then(()=>{k.success(this.$t("flux.message.startTaskSuccess"))}).catch(m=>{const p=m?.response?.data;p?.error?.code===O?k.error(this.$t("flux.message.usedUp")):k.error(this.$t("flux.message.startTaskFailed")+p?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function wt(e,o,m,p,v,b){const c=s("config-panel"),u=s("recent-panel"),n=s("layout");return l(),y(n,null,{config:f(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:f(()=>[t(u,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const no=g(xt,[["render",wt]]);export{no as default};
@@ -1 +1 @@
1
- import{F as A}from"./index.es-DAxeCwmH.js";import{E as G}from"./index-D1RNQpBT.js";import{E as P}from"./index-C9xzV0Q7.js";import{d as $,h as v,b as l,t as c,k as t,r as E,j as p,l as i,o,c6 as D,x as n,D as _,F as w,v as I,i as V,n as T,c as L,y as g,eQ as j,dr as z,de as O,dl as B,dm as C}from"./index-BPxi9ga3.js";import{I as M}from"./InfoIcon-BwtK8GA6.js";import{E as q}from"./index-D-pDYa6O.js";import{E as k}from"./index-CYne5B4k.js";import{a as F,E as N}from"./index-Bm2EGIx2.js";import{E as U}from"./index-nWt46AGY.js";import{E as H,a as Q}from"./index-BdwM5BLe.js";import{A as J}from"./Status-BMWv2Lvq.js";import{C as K}from"./CopyToClipboard-Hav2hml4.js";import{E as W}from"./index-Dg0VTGhm.js";import{a as X,E as Y}from"./index-wVVoJUgj.js";import"./use-form-item-Dix3-pV7.js";import"./index-r5W6hzzQ.js";import"./index-CcHXhRSM.js";import"./index-DdsTi3DP.js";import"./typescript--c8-UPe1.js";import"./index-DaoKJ7xF.js";import"./_baseClone-CJfrYffb.js";import"./_initCloneObject-1-Me7HD_.js";import"./isEqual-DCq9iBB-.js";import"./debounce-DECFekgp.js";import"./index-ZS6ZzoG6.js";import"./strings-Dx5Ed-QV.js";import"./isPlainObject-BcBVDz8v.js";const Z=$({name:"LayoutHeadshots",components:{ElDrawer:P,ElButton:G,FontAwesomeIcon:A},data(){return{drawer:!1}}}),x={class:"main"},ee={class:"config"},te={class:"result"};function se(e,s,m,u,b,y){const d=i("font-awesome-icon"),h=i("el-button"),a=i("el-drawer");return o(),l("div",x,[c("div",ee,[E(e.$slots,"config",{},void 0,!0)]),c("div",te,[E(e.$slots,"result",{},void 0,!0)]),t(h,{circle:"",class:"menu",onClick:s[0]||(s[0]=r=>e.drawer=!0)},{default:p(()=>[t(d,{icon:"fa-solid fa-gear"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=r=>e.drawer=r),"with-header":!1,size:"340px",class:"drawer"},{default:p(()=>[E(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const oe=v(Z,[["render",se],["__scopeId","data-v-14651d70"]]),ae=$({name:"ImageUrlsInput",components:{ElUpload:q,ElButton:G,InfoIcon:M},data(){return{fileList:[],uploadUrl:D()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){k.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){k.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),ne={class:"field"},ie={class:"title font-bold"},le={class:"upload-wrapper"};function re(e,s,m,u,b,y){const d=i("el-button"),h=i("el-upload"),a=i("info-icon");return o(),l("div",ne,[c("h2",ie,n(e.$t("headshots.name.endImageUrls")),1),c("div",le,[t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=r=>e.fileList=r),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:2,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:p(()=>[t(d,{size:"small",type:"primary",round:""},{default:p(()=>[_(n(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(a,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const ce=v(ae,[["render",re],["__scopeId","data-v-a6bd8c31"]]),de="fast",pe=$({name:"ModeSelector",components:{ElRadioButton:N,ElRadioGroup:F},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=de)}}),me={class:"field"},ue={class:"title font-bold"};function he(e,s,m,u,b,y){const d=i("el-radio-button"),h=i("el-radio-group");return o(),l("div",me,[c("h2",ue,n(e.$t("headshots.name.mode")),1),t(h,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),size:"small",class:"mode"},{default:p(()=>[(o(!0),l(w,null,I(e.options,a=>(o(),V(d,{key:a.value,label:a.value},{default:p(()=>[_(n(a.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const _e=v(pe,[["render",he],["__scopeId","data-v-a2a0d5fa"]]),fe=$({name:"StylizeSelector",components:{ElTabs:Q,ElTabPane:H,ElImage:U},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){console.debug("set template",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})}}}),ge={class:"field"},$e=["onClick"],ve={class:"name"};function be(e,s,m,u,b,y){const d=i("el-image"),h=i("el-tab-pane"),a=i("el-tabs");return o(),l("div",ge,[t(a,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=r=>e.tab=r)},{default:p(()=>[(o(!0),l(w,null,I(e.elements,(r,f)=>(o(),V(h,{key:f,label:r.displayName,name:f,class:"pane"},{default:p(()=>[(o(!0),l(w,null,I(r.items,(S,R)=>(o(),l("div",{key:R,class:T({item:!0,active:e.value===S.value}),onClick:ht=>e.onToggle(S.value)},[t(d,{src:S.image,fit:"fill",class:"preview"},null,8,["src"]),c("span",ve,n(S.label),1)],10,$e))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const ye=v(fe,[["render",be],["__scopeId","data-v-be4bd25d"]]),ke=$({name:"PresetPanel",components:{ModeSelector:_e,ImageUrlsInput:ce,ElButton:G,FontAwesomeIcon:A,ElementsSelector:ye},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),we={class:"panel"},Ie={class:"config"},Te={class:"actions"};function Se(e,s,m,u,b,y){const d=i("elements-selector"),h=i("mode-selector"),a=i("image-urls-input"),r=i("font-awesome-icon"),f=i("el-button");return o(),l("div",we,[c("div",Ie,[t(d,{class:"mb-4"}),t(h,{class:"mb-4"}),t(a,{class:"mb-4"}),c("div",Te,[t(f,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(r,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+n(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ve=v(ke,[["render",Se],["__scopeId","data-v-78172a54"]]),Ee=$({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:L(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:u=>{window.open(u,"_blank")}}}}),Ce={class:"image-gallery"},Ae=["src"],Ge=["onClick"];function Ue(e,s,m,u,b,y){return o(),l("div",Ce,[(o(!0),l(w,null,I(e.images,(d,h)=>(o(),l("div",{key:h,class:"image-container"},[c("img",{src:d.image_url,alt:"Image"},null,8,Ae),d.image_url?(o(),l("button",{key:0,class:"view-button",onClick:a=>e.viewImage(d.image_url)},n(e.$t("headshots.button.viewImage")),9,Ge)):g("",!0)]))),128))])}const Re=v(Ee,[["render",Ue],["__scopeId","data-v-03641510"]]),Pe=$({name:"TaskPreview",components:{ElImage:U,CopyToClipboard:K,FontAwesomeIcon:A,ElAlert:W,ImageGallery:Re},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,m=new URL(s.src),u=m.searchParams.get("retry");if(!u)m.searchParams.set("retry","1");else if(parseInt(u)<2)m.searchParams.set("retry",(parseInt(u)+1).toString());else return;s.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),De={class:"preview"},Le={class:"left"},je={class:"main"},ze={class:"bot"},Oe={class:"datetime"},Be={class:"info"},Me={key:0,class:"prompt mt-2"},qe={key:0},Fe={key:1},Ne={key:0,class:T({content:!0,failed:!0})},He={class:"image-wrapper"},Qe={class:"description"},Je={key:1,class:T({content:!0})},Ke={class:"description"},We={class:"description"},Xe={class:"description"},Ye={key:2,class:T({content:!0})},Ze={class:"description"},xe={key:3,class:T({content:!0})},et={class:"description"};function tt(e,s,m,u,b,y){const d=i("el-image"),h=i("image-gallery"),a=i("font-awesome-icon"),r=i("copy-to-clipboard"),f=i("el-alert");return o(),l("div",De,[c("div",Le,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),c("div",je,[c("div",ze,[_(n(e.$t("headshots.name.headshotsBot"))+" ",1),c("span",Oe,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",Be,[e.modelValue?.request?.template?(o(),l("p",Me,[_(n(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?g("",!0):(o(),l("span",qe," - ("+n(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(o(),l("span",Fe," - ("+n(e.$t("headshots.status.processing"))+") ",1)):g("",!0)])):g("",!0)]),e.modelValue?.response?.success===!0?(o(),l("div",Ne,[c("div",He,[t(h,{"model-value":e.modelValue},null,8,["model-value"])]),t(f,{closable:!1,class:"mt-2 success"},{default:p(()=>[c("p",Qe,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?.success===!1?(o(),l("div",Je,[t(f,{closable:!1,class:"failure"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Ke,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),c("p",We,[t(a,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t(r,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),c("p",Xe,[t(a,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("headshots.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t(r,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?g("",!0):(o(),l("div",Ye,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Ze,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(o(),l("div",xe,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",et,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0)])])}const st=v(Pe,[["render",tt],["__scopeId","data-v-77229910"]]),ot=$({name:"RecentPanel",components:{TaskPreview:st,ElSkeleton:Y,ElSkeletonItem:X},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),at={key:0,class:"tasks"},nt={class:"left"},it={class:"main"},lt={key:1,class:"tasks"},rt={key:2,class:"description"};function ct(e,s,m,u,b,y){const d=i("el-skeleton-item"),h=i("el-skeleton"),a=i("task-preview");return o(),l("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...r)=>e.onHandleScroll&&e.onHandleScroll(...r))},[e.tasks?.items===void 0?(o(),l("div",at,[(o(),l(w,null,I(3,r=>c("div",{key:r,class:"task placeholder"},[c("div",nt,[t(h,{animated:""},{template:p(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),c("div",it,[t(h,{animated:""},{template:p(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(o(),l("div",lt,[(o(!0),l(w,null,I(e.tasks?.items,(r,f)=>(o(),V(a,{key:f,"model-value":r,class:"preview"},null,8,["model-value"]))),128))])):g("",!0),e.tasks?.items?.length===0?(o(),l("p",rt,n(e.$t("headshots.message.noTasks")),1)):g("",!0)],544)}const dt=v(ot,[["render",ct],["__scopeId","data-v-d79bcb1f"]]),pt="https://webhook.acedata.cloud/headshots",mt=$({name:"HeadshotsIndex",components:{ConfigPanel:Ve,Layout:oe,ApplicationStatus:J,RecentPanel:dt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.headshots?.status?.getApplications===C.Request},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===C.Request},needApply(){return this.$store.state.headshots.status.getApplications===C.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){O.create({application:this.application}).then(({data:e})=>{this.application=e,k.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===B&&k.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:u}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",u),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:m,createdAtMax:u})},async onGeneratePicture(){const e={...this.config,callback_url:pt},s=this.credential?.token;if(!s){console.error("no token specified");return}k.info(this.$t("headshots.message.startingTask")),j.generate(e,{token:s}).then(()=>{k.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===z?k.error(this.$t("headshots.message.usedUp")):k.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ut(e,s,m,u,b,y){const d=i("config-panel"),h=i("application-status"),a=i("recent-panel"),r=i("layout");return o(),V(r,null,{config:p(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:p(()=>[t(h,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:s[0]||(s[0]=f=>e.$store.dispatch("headshots/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(a,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const qt=v(mt,[["render",ut],["__scopeId","data-v-19d3c623"]]);export{qt as default};
1
+ import{F as A}from"./index.es-Du3tur1S.js";import{E as G}from"./index-BnrZWi5Z.js";import{E as P}from"./index-TN3UJtGJ.js";import{d as $,h as v,b as l,t as c,k as t,r as E,j as p,l as i,o,c6 as D,x as n,D as _,F as w,v as I,i as V,n as T,c as L,y as g,eQ as j,dr as z,de as O,dl as B,dm as C}from"./index-B0x7ZUfV.js";import{I as M}from"./InfoIcon-Cc4oAk_g.js";import{E as q}from"./index-C9WXD0qn.js";import{E as k}from"./index-AkGhTpcD.js";import{a as F,E as N}from"./index-TlBQdztR.js";import{E as U}from"./index-k07W21gw.js";import{E as H,a as Q}from"./index-C7--Z-bz.js";import{A as J}from"./Status-DglRlJGI.js";import{C as K}from"./CopyToClipboard-B5E56t6E.js";import{E as W}from"./index--dZny59W.js";import{a as X,E as Y}from"./index-BHZI17om.js";import"./use-form-item-DQLXC7bB.js";import"./index-r5W6hzzQ.js";import"./index-CvTtblB-.js";import"./index-BpNMB898.js";import"./typescript-BulUHzox.js";import"./index-B-x2lsnR.js";import"./_baseClone-BUEYiiKE.js";import"./_initCloneObject-itvorlxB.js";import"./isEqual-Dx-vkFq-.js";import"./debounce-BBWNLmow.js";import"./index-BJoz6WwT.js";import"./strings-BeRSgJ_j.js";import"./isPlainObject-BYsfJaBJ.js";const Z=$({name:"LayoutHeadshots",components:{ElDrawer:P,ElButton:G,FontAwesomeIcon:A},data(){return{drawer:!1}}}),x={class:"main"},ee={class:"config"},te={class:"result"};function se(e,s,m,u,b,y){const d=i("font-awesome-icon"),h=i("el-button"),a=i("el-drawer");return o(),l("div",x,[c("div",ee,[E(e.$slots,"config",{},void 0,!0)]),c("div",te,[E(e.$slots,"result",{},void 0,!0)]),t(h,{circle:"",class:"menu",onClick:s[0]||(s[0]=r=>e.drawer=!0)},{default:p(()=>[t(d,{icon:"fa-solid fa-gear"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=r=>e.drawer=r),"with-header":!1,size:"340px",class:"drawer"},{default:p(()=>[E(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const oe=v(Z,[["render",se],["__scopeId","data-v-14651d70"]]),ae=$({name:"ImageUrlsInput",components:{ElUpload:q,ElButton:G,InfoIcon:M},data(){return{fileList:[],uploadUrl:D()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){k.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){k.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),ne={class:"field"},ie={class:"title font-bold"},le={class:"upload-wrapper"};function re(e,s,m,u,b,y){const d=i("el-button"),h=i("el-upload"),a=i("info-icon");return o(),l("div",ne,[c("h2",ie,n(e.$t("headshots.name.endImageUrls")),1),c("div",le,[t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=r=>e.fileList=r),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:2,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:p(()=>[t(d,{size:"small",type:"primary",round:""},{default:p(()=>[_(n(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(a,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const ce=v(ae,[["render",re],["__scopeId","data-v-a6bd8c31"]]),de="fast",pe=$({name:"ModeSelector",components:{ElRadioButton:N,ElRadioGroup:F},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=de)}}),me={class:"field"},ue={class:"title font-bold"};function he(e,s,m,u,b,y){const d=i("el-radio-button"),h=i("el-radio-group");return o(),l("div",me,[c("h2",ue,n(e.$t("headshots.name.mode")),1),t(h,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),size:"small",class:"mode"},{default:p(()=>[(o(!0),l(w,null,I(e.options,a=>(o(),V(d,{key:a.value,label:a.value},{default:p(()=>[_(n(a.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const _e=v(pe,[["render",he],["__scopeId","data-v-a2a0d5fa"]]),fe=$({name:"StylizeSelector",components:{ElTabs:Q,ElTabPane:H,ElImage:U},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){console.debug("set template",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})}}}),ge={class:"field"},$e=["onClick"],ve={class:"name"};function be(e,s,m,u,b,y){const d=i("el-image"),h=i("el-tab-pane"),a=i("el-tabs");return o(),l("div",ge,[t(a,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=r=>e.tab=r)},{default:p(()=>[(o(!0),l(w,null,I(e.elements,(r,f)=>(o(),V(h,{key:f,label:r.displayName,name:f,class:"pane"},{default:p(()=>[(o(!0),l(w,null,I(r.items,(S,R)=>(o(),l("div",{key:R,class:T({item:!0,active:e.value===S.value}),onClick:ht=>e.onToggle(S.value)},[t(d,{src:S.image,fit:"fill",class:"preview"},null,8,["src"]),c("span",ve,n(S.label),1)],10,$e))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const ye=v(fe,[["render",be],["__scopeId","data-v-be4bd25d"]]),ke=$({name:"PresetPanel",components:{ModeSelector:_e,ImageUrlsInput:ce,ElButton:G,FontAwesomeIcon:A,ElementsSelector:ye},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),we={class:"panel"},Ie={class:"config"},Te={class:"actions"};function Se(e,s,m,u,b,y){const d=i("elements-selector"),h=i("mode-selector"),a=i("image-urls-input"),r=i("font-awesome-icon"),f=i("el-button");return o(),l("div",we,[c("div",Ie,[t(d,{class:"mb-4"}),t(h,{class:"mb-4"}),t(a,{class:"mb-4"}),c("div",Te,[t(f,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(r,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+n(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ve=v(ke,[["render",Se],["__scopeId","data-v-78172a54"]]),Ee=$({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:L(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:u=>{window.open(u,"_blank")}}}}),Ce={class:"image-gallery"},Ae=["src"],Ge=["onClick"];function Ue(e,s,m,u,b,y){return o(),l("div",Ce,[(o(!0),l(w,null,I(e.images,(d,h)=>(o(),l("div",{key:h,class:"image-container"},[c("img",{src:d.image_url,alt:"Image"},null,8,Ae),d.image_url?(o(),l("button",{key:0,class:"view-button",onClick:a=>e.viewImage(d.image_url)},n(e.$t("headshots.button.viewImage")),9,Ge)):g("",!0)]))),128))])}const Re=v(Ee,[["render",Ue],["__scopeId","data-v-03641510"]]),Pe=$({name:"TaskPreview",components:{ElImage:U,CopyToClipboard:K,FontAwesomeIcon:A,ElAlert:W,ImageGallery:Re},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,m=new URL(s.src),u=m.searchParams.get("retry");if(!u)m.searchParams.set("retry","1");else if(parseInt(u)<2)m.searchParams.set("retry",(parseInt(u)+1).toString());else return;s.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),De={class:"preview"},Le={class:"left"},je={class:"main"},ze={class:"bot"},Oe={class:"datetime"},Be={class:"info"},Me={key:0,class:"prompt mt-2"},qe={key:0},Fe={key:1},Ne={key:0,class:T({content:!0,failed:!0})},He={class:"image-wrapper"},Qe={class:"description"},Je={key:1,class:T({content:!0})},Ke={class:"description"},We={class:"description"},Xe={class:"description"},Ye={key:2,class:T({content:!0})},Ze={class:"description"},xe={key:3,class:T({content:!0})},et={class:"description"};function tt(e,s,m,u,b,y){const d=i("el-image"),h=i("image-gallery"),a=i("font-awesome-icon"),r=i("copy-to-clipboard"),f=i("el-alert");return o(),l("div",De,[c("div",Le,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),c("div",je,[c("div",ze,[_(n(e.$t("headshots.name.headshotsBot"))+" ",1),c("span",Oe,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",Be,[e.modelValue?.request?.template?(o(),l("p",Me,[_(n(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?g("",!0):(o(),l("span",qe," - ("+n(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(o(),l("span",Fe," - ("+n(e.$t("headshots.status.processing"))+") ",1)):g("",!0)])):g("",!0)]),e.modelValue?.response?.success===!0?(o(),l("div",Ne,[c("div",He,[t(h,{"model-value":e.modelValue},null,8,["model-value"])]),t(f,{closable:!1,class:"mt-2 success"},{default:p(()=>[c("p",Qe,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?.success===!1?(o(),l("div",Je,[t(f,{closable:!1,class:"failure"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Ke,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),c("p",We,[t(a,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t(r,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),c("p",Xe,[t(a,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("headshots.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t(r,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?g("",!0):(o(),l("div",Ye,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Ze,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(o(),l("div",xe,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",et,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0)])])}const st=v(Pe,[["render",tt],["__scopeId","data-v-77229910"]]),ot=$({name:"RecentPanel",components:{TaskPreview:st,ElSkeleton:Y,ElSkeletonItem:X},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),at={key:0,class:"tasks"},nt={class:"left"},it={class:"main"},lt={key:1,class:"tasks"},rt={key:2,class:"description"};function ct(e,s,m,u,b,y){const d=i("el-skeleton-item"),h=i("el-skeleton"),a=i("task-preview");return o(),l("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...r)=>e.onHandleScroll&&e.onHandleScroll(...r))},[e.tasks?.items===void 0?(o(),l("div",at,[(o(),l(w,null,I(3,r=>c("div",{key:r,class:"task placeholder"},[c("div",nt,[t(h,{animated:""},{template:p(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),c("div",it,[t(h,{animated:""},{template:p(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(o(),l("div",lt,[(o(!0),l(w,null,I(e.tasks?.items,(r,f)=>(o(),V(a,{key:f,"model-value":r,class:"preview"},null,8,["model-value"]))),128))])):g("",!0),e.tasks?.items?.length===0?(o(),l("p",rt,n(e.$t("headshots.message.noTasks")),1)):g("",!0)],544)}const dt=v(ot,[["render",ct],["__scopeId","data-v-d79bcb1f"]]),pt="https://webhook.acedata.cloud/headshots",mt=$({name:"HeadshotsIndex",components:{ConfigPanel:Ve,Layout:oe,ApplicationStatus:J,RecentPanel:dt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.headshots?.status?.getApplications===C.Request},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===C.Request},needApply(){return this.$store.state.headshots.status.getApplications===C.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){O.create({application:this.application}).then(({data:e})=>{this.application=e,k.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===B&&k.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:u}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",u),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:m,createdAtMax:u})},async onGeneratePicture(){const e={...this.config,callback_url:pt},s=this.credential?.token;if(!s){console.error("no token specified");return}k.info(this.$t("headshots.message.startingTask")),j.generate(e,{token:s}).then(()=>{k.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===z?k.error(this.$t("headshots.message.usedUp")):k.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ut(e,s,m,u,b,y){const d=i("config-panel"),h=i("application-status"),a=i("recent-panel"),r=i("layout");return o(),V(r,null,{config:p(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:p(()=>[t(h,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:s[0]||(s[0]=f=>e.$store.dispatch("headshots/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(a,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const qt=v(mt,[["render",ut],["__scopeId","data-v-19d3c623"]]);export{qt as default};
@@ -0,0 +1 @@
1
+ import{F as U}from"./index.es-Du3tur1S.js";import{E as I}from"./index-BnrZWi5Z.js";import{E as L}from"./index-TN3UJtGJ.js";import{d as b,h as k,b as l,t as i,k as t,r as T,j as u,l as o,o as s,eO as P,x as n,F as C,v as G,i as v,c6 as R,D as p,y as h,n as E,ah as j,eP as D,dr as B,dm as M}from"./index-B0x7ZUfV.js";import{E as O,a as q}from"./index-BJ3fX-94.js";import{I as A}from"./InfoIcon-Cc4oAk_g.js";import{I as z}from"./ImagePreview-VkHqgeBl.js";import{E as F}from"./index-C9WXD0qn.js";import{E as V}from"./index-AkGhTpcD.js";import{E as N}from"./index-CCyOxJsQ.js";import{C as H,N as K}from"./NoTasks-2hz79Crs.js";import{a as J}from"./price-t8MOlEZl.js";import{C as Q}from"./CopyToClipboard-B5E56t6E.js";import{V as W}from"./VideoPlayer-PJ-9LA2g.js";import{E as X}from"./index-CvTtblB-.js";import{E as Y}from"./index--dZny59W.js";import{E as Z}from"./index-k07W21gw.js";import{B as x}from"./BotPlaceholder-ZNnLvGsO.js";import"./use-form-item-DQLXC7bB.js";import"./index-r5W6hzzQ.js";import"./index-CEnjyOH4.js";import"./typescript-BulUHzox.js";import"./index-BpNMB898.js";import"./strings-BeRSgJ_j.js";import"./castArray-DTYSPAQ5.js";import"./isEqual-Dx-vkFq-.js";import"./_initCloneObject-itvorlxB.js";import"./debounce-BBWNLmow.js";import"./_baseIteratee-BxLTPJCW.js";import"./index-CJ1CxpcA.js";import"./index-B-x2lsnR.js";import"./_baseClone-BUEYiiKE.js";import"./index-BJoz6WwT.js";import"./vue-plyr-QZFBikSk.js";import"./index-BHZI17om.js";const ee=b({name:"LayoutHailuo",components:{ElDrawer:L,ElButton:I,FontAwesomeIcon:U},data(){return{drawer:!1}}}),te={class:"main"},oe={class:"config"},se={class:"result"};function ae(e,a,f,_,y,w){const d=o("font-awesome-icon"),m=o("el-button"),r=o("el-drawer");return s(),l("div",te,[i("div",oe,[T(e.$slots,"config",{},void 0,!0)]),i("div",se,[T(e.$slots,"result",{},void 0,!0)]),t(m,{circle:"",class:"menu",onClick:a[0]||(a[0]=g=>e.drawer=!0)},{default:u(()=>[t(d,{icon:"fa-solid fa-magic"})]),_:1}),t(r,{modelValue:e.drawer,"onUpdate:modelValue":a[1]||(a[1]=g=>e.drawer=g),direction:"ltr","with-header":!1,size:"340px"},{default:u(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ne=k(ee,[["render",ae],["__scopeId","data-v-20539cd5"]]),le=b({name:"ModelSelector",components:{ElSelect:q,ElOption:O},data(){return{}},computed:{options(){return[{value:"minimax-t2v",label:this.$t("hailuo.button.model1")},{value:"minimax-i2v",label:this.$t("hailuo.button.model2")}]},value:{get(){return this.$store.state.hailuo?.config?.model},set(e){this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,model:e})}}},mounted(){this.value||(this.value=P)}}),ie={class:"field"},re={class:"title font-bold"},ce={class:"float-left"};function ue(e,a,f,_,y,w){const d=o("el-option"),m=o("el-select");return s(),l("div",ie,[i("h2",re,n(e.$t("hailuo.name.model")),1),t(m,{modelValue:e.value,"onUpdate:modelValue":a[0]||(a[0]=r=>e.value=r),class:"value",placeholder:e.$t("hailuo.placeholder.select"),clearable:""},{default:u(()=>[(s(!0),l(C,null,G(e.options,r=>(s(),v(d,{key:r.value,label:r.label,value:r.value},{default:u(()=>[i("span",ce,n(r.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const de=k(le,[["render",ue],["__scopeId","data-v-30ff1e69"]]),me=b({name:"StartImageUrlInput",components:{ElUpload:F,ElButton:I,InfoIcon:A,ImagePreview:z},data(){return{fileList:[],uploadUrl:R()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.hailuo?.config?.first_image_url},set(){const e=this.urls?.[0];this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("hailuo.message.uploadStartImageExceed"))},onError(){V.error(this.$t("hailuo.message.uploadStartImageError"))},async onRemove(){V.error(this.$t("hailuo.message.uploadStartImageError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),pe={class:"relative"},he={class:"flex justify-between"},fe={class:"flex justify-start items-center"},_e={class:"text-sm font-bold"};function ge(e,a,f,_,y,w){const d=o("info-icon"),m=o("image-preview"),r=o("el-button"),g=o("el-upload");return s(),l("div",pe,[i("div",he,[i("div",fe,[i("span",_e,n(e.$t("hailuo.name.startImageUrl")),1),t(d,{content:e.$t("hailuo.description.startImageUrl"),class:"info"},null,8,["content"])])]),t(g,{"file-list":e.fileList,"onUpdate:fileList":a[0]||(a[0]=c=>e.fileList=c),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file","show-file-list":!0,limit:1,multiple:!1,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:c})=>[c.url&&c.percentage!==void 0?(s(),v(m,{key:0,url:c.url,name:c.name,percentage:c.percentage,onRemove:$=>e.fileList.splice(e.fileList.indexOf(c),1)},null,8,["url","name","percentage","onRemove"])):h("",!0)]),default:u(()=>[t(r,{size:"small",type:"primary",class:"btn btn-upload",round:""},{default:u(()=>[p(n(e.$t("hailuo.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])])}const $e=k(me,[["render",ge],["__scopeId","data-v-a906df80"]]),ve="",be=b({name:"PromptInput",components:{ElInput:N,InfoIcon:A},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=ve)}}),ke={class:"field"},ye={class:"box"},we={class:"title font-bold"};function Ve(e,a,f,_,y,w){const d=o("info-icon"),m=o("el-input");return s(),l("div",ke,[i("div",ye,[i("h2",we,n(e.$t("hailuo.name.prompt")),1),t(d,{content:e.$t("hailuo.description.prompt"),class:"info"},null,8,["content"])]),t(m,{modelValue:e.prompt,"onUpdate:modelValue":a[0]||(a[0]=r=>e.prompt=r),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("hailuo.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ie=k(be,[["render",Ve],["__scopeId","data-v-d54ffa64"]]),Ee=b({name:"PresetPanel",components:{ElButton:I,FontAwesomeIcon:U,PromptInput:Ie,StartImageUrlInput:$e,ModelSelector:de,Consumption:H},emits:["generate"],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return J(this.config,this.service?.metadata?.price)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Se={class:"flex flex-col h-full"},Te={class:"flex-1 overflow-y-auto p-[15px]"},Ce={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Ue(e,a,f,_,y,w){const d=o("prompt-input"),m=o("model-selector"),r=o("start-image-url-input"),g=o("consumption"),c=o("font-awesome-icon"),$=o("el-button");return s(),l("div",Se,[i("div",Te,[t(d,{class:"mb-4"}),t(m,{class:"mb-4"}),e.config?.model==="minimax-i2v"?(s(),v(r,{key:0,class:"mb-2"})):h("",!0)]),i("div",Ce,[t(g,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(s(),v($,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(c,{icon:"fa-solid fa-magic",class:"mr-2"}),p(" "+n(e.$t("hailuo.button.extend")),1)]),_:1},8,["onClick"])):(s(),v($,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(c,{icon:"fa-solid fa-magic",class:"mr-2"}),p(" "+n(e.$t("hailuo.button.generate")),1)]),_:1},8,["onClick"]))])])}const Ge=k(Ee,[["render",Ue]]),Ae=b({name:"TaskPreview",components:{ElImage:Z,CopyToClipboard:Q,FontAwesomeIcon:U,ElAlert:Y,VideoPlayer:W,ElTooltip:X,ElButton:I},props:{modelValue:{type:Object,required:!0}},computed:{application(){return this.$store.state.hailuo?.application},config(){return this.$store.state.hailuo?.config},video(){return this.modelValue?.response?.data?.[0]}},methods:{onDownload(e){console.debug("on download hailuo video",e),window.open(e,"_blank")}}}),Le={class:"preview"},Pe={class:"left"},Re={class:"main"},je={class:"bot"},De={class:"datetime"},Be={class:"info"},Me={key:0,class:"prompt mt-2"},Oe={key:0},qe={key:1},ze={key:0,class:E({content:!0,failed:!0})},Fe={key:0,class:"mb-4"},Ne={key:1,class:E({operations:!0,"mt-2":!0})},He={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ke={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Je={key:1,class:E({content:!0})},Qe={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},We={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Xe={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ye={key:2,class:E({content:!0})},Ze={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function xe(e,a,f,_,y,w){const d=o("el-image"),m=o("video-player"),r=o("el-button"),g=o("el-tooltip"),c=o("font-awesome-icon"),$=o("copy-to-clipboard"),S=o("el-alert");return s(),l("div",Le,[i("div",Pe,[t(d,{src:"https://cdn.acedata.cloud/0qg4gp.png",class:"avatar"})]),i("div",Re,[i("div",je,[p(n(e.$t("hailuo.name.hailuoBot"))+" ",1),i("span",De,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),i("div",Be,[e.modelValue?.request?.prompt?(s(),l("p",Me,[p(n(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?h("",!0):(s(),l("span",Oe," - ("+n(e.$t("hailuo.status.pending"))+") ",1)),e.video?.state==="processing"||e.video?.state==="pending"||e.video?.state==="running"?(s(),l("span",qe," - ("+n(e.$t("hailuo.status.processing"))+") ",1)):h("",!0)])):h("",!0)]),e.modelValue?.response?.success===!0?(s(),l("div",ze,[e.video?.video_url?(s(),l("div",Fe,[t(m,{src:e.video?.video_url},null,8,["src"])])):h("",!0),e.video?(s(),l("div",Ne,[t(g,{class:"box-item",effect:"dark",content:e.$t("hailuo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.video?.video_url?(s(),v(r,{key:0,type:"info",size:"small",class:"mb-2",onClick:a[0]||(a[0]=j(ut=>e.onDownload(e.video?.video_url),["stop"]))},{default:u(()=>[p(n(e.$t("hailuo.button.download")),1)]),_:1})):h("",!0)]),_:1},8,["content"])])):h("",!0),t(S,{closable:!1,class:"mt-2 success"},{default:u(()=>[e.modelValue?.request?.model?(s(),l("p",He,[t(c,{icon:"fa-solid fa-hashtag",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.model"))+": "+n(e.modelValue?.request?.model)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])):h("",!0),i("p",Ke,[t(c,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===!1?(s(),l("div",Je,[t(S,{closable:!1,class:"failure"},{template:u(()=>[t(c,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failure")),1)]),default:u(()=>[i("p",Qe,[t(c,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])]),i("p",We,[t(c,{icon:"fa-solid fa-circle-info",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t($,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),i("p",Xe,[t(c,{icon:"fa-solid fa-hashtag",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t($,{content:e.modelValue?.response?.trace_id},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===void 0?(s(),l("div",Ye,[t(S,{closable:!1,class:"info"},{template:u(()=>[t(c,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failure")),1)]),default:u(()=>[i("p",Ze,[t(c,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):h("",!0)])])}const et=k(Ae,[["render",xe],["__scopeId","data-v-72acd507"]]),tt=b({name:"RecentPanel",components:{TaskPreview:et,BotPlaceholder:x,NoTasks:K},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.hailuo?.tasks,items:this.$store.state.hailuo?.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")}}}),ot={key:0},st={key:1,class:"tasks w-full h-full overflow-y-auto"},at={key:2,class:"w-full h-full flex items-center justify-center"};function nt(e,a,f,_,y,w){const d=o("bot-placeholder"),m=o("task-preview"),r=o("no-tasks");return s(),l(C,null,[e.tasks?.items===void 0?(s(),l("div",ot,[t(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(s(),l("div",st,[(s(!0),l(C,null,G(e.tasks?.items,g=>(s(),v(m,{key:g.id,"model-value":g},null,8,["model-value"]))),128))])):h("",!0),e.tasks?.items?.length===0?(s(),l("div",at,[t(r)])):h("",!0)],64)}const lt=k(tt,[["render",nt]]),it="https://webhook.acedata.cloud/hailuo",rt=b({name:"HailuoIndex",components:{ConfigPanel:Ge,Layout:ne,RecentPanel:lt},inject:["initialized"],data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.hailuo?.status?.getApplications===M.Request},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},application(){return this.$store.state.hailuo.application},tasks(){return this.$store.state.hailuo.tasks}},watch:{tasks:{handler(e,a){e?.items?.length>a?.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("hailuo/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("hailuo/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:a=5,createdAtMin:f,createdAtMax:_}=e||{};console.debug("limit",a,"createdAtMin",f,"createdAtMax",_),await this.$store.dispatch("hailuo/getTasks",{limit:a,createdAtMin:f,createdAtMax:_})},async onGenerate(){const e={...this.config,callback_url:it},a=this.credential?.token;if(!a){console.error("no token specified");return}V.info(this.$t("hailuo.message.startingTask")),D.generate(e,{token:a}).then(()=>{V.success(this.$t("hailuo.message.startTaskSuccess"))}).catch(f=>{f?.response?.data?.error?.code===B?V.error(this.$t("hailuo.message.usedUp")):V.error(this.$t("hailuo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ct(e,a,f,_,y,w){const d=o("config-panel"),m=o("recent-panel"),r=o("layout");return s(),v(r,null,{config:u(()=>[t(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(m,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Kt=k(rt,[["render",ct]]);export{Kt 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,eZ as S,m as N,p as T,q as L,e_ as D,c6 as R,b as h,f as U,F as P,v as B,n as q}from"./index-BPxi9ga3.js";import{F as w}from"./index.es-DAxeCwmH.js";import{E as F,a as V}from"./index-BpxAMMhB.js";import{E as j}from"./index-DcLgGPiX.js";import{E as b}from"./index-nWt46AGY.js";import"./typescript--c8-UPe1.js";import"./index-CcHXhRSM.js";import"./index-DdsTi3DP.js";import"./index-r5W6hzzQ.js";import"./index-BNR4FIDg.js";import"./dropdown-DAoWl2Zf.js";import"./debounce-DECFekgp.js";import"./index-ZS6ZzoG6.js";const H=g({name:"HelpEntry",components:{ElImage:b,ElDialog:A,ElPopover:j,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})}}}),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"]]),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"},Z={class:"info"},K={class:"links"},Q=["onClick"],Y={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",Z,[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",Y,[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};
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,eZ as S,m as N,p as T,q as L,e_ as D,c6 as R,b as h,f as U,F as P,v as B,n as q}from"./index-B0x7ZUfV.js";import{F as w}from"./index.es-Du3tur1S.js";import{E as F,a as V}from"./index-B8T6V5UZ.js";import{E as j}from"./index-CPnluZ8F.js";import{E as b}from"./index-k07W21gw.js";import"./typescript-BulUHzox.js";import"./index-CvTtblB-.js";import"./index-BpNMB898.js";import"./index-r5W6hzzQ.js";import"./index-CJ1CxpcA.js";import"./dropdown-DdliLGbX.js";import"./debounce-BBWNLmow.js";import"./index-BJoz6WwT.js";const H=g({name:"HelpEntry",components:{ElImage:b,ElDialog:A,ElPopover:j,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})}}}),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"]]),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"},Z={class:"info"},K={class:"links"},Q=["onClick"],Y={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",Z,[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",Y,[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};