@acedatacloud/nexior 3.8.1 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/assets/{Auth.817042f1.js → Auth.5f70d0fb.js} +1 -1
  2. package/dist/assets/{Callback.dac9499e.js → Callback.a5a28111.js} +1 -1
  3. package/dist/assets/{Console.e53c08f2.js → Console.25834b01.js} +1 -1
  4. package/dist/assets/Conversation.b89cf18b.js +1 -0
  5. package/dist/assets/{CopyToClipboard.9a7d0eb5.js → CopyToClipboard.ce08ef84.js} +1 -1
  6. package/dist/assets/{Detail.3ee22b15.js → Detail.c4f1cb7b.js} +1 -1
  7. package/dist/assets/{EditArray.dfdf77cd.js → EditArray.d3af1fd9.js} +1 -1
  8. package/dist/assets/Extra.995d4482.js +1 -0
  9. package/dist/assets/{FilePreview.1f9b8ddf.js → FilePreview.27b33413.js} +1 -1
  10. package/dist/assets/{History.d14dd7a7.js → History.a48da047.js} +1 -1
  11. package/dist/assets/{ImagePreview.3fb18fec.js → ImagePreview.0f3e285b.js} +1 -1
  12. package/dist/assets/{ImageWrapper.a98f8106.js → ImageWrapper.a9f80951.js} +1 -1
  13. package/dist/assets/{Index.c8c622e4.js → Index.0a5116c5.js} +1 -1
  14. package/dist/assets/{Index.2621752d.js → Index.11ff18b0.js} +1 -1
  15. package/dist/assets/{Index.ffd151d2.js → Index.29dce7ca.js} +1 -1
  16. package/dist/assets/{Index.ec2cfab9.js → Index.662accc7.js} +1 -1
  17. package/dist/assets/{Index.3357f539.js → Index.73ed3f5c.js} +2 -2
  18. package/dist/assets/{Index.223eceed.js → Index.77ee5ea4.js} +1 -1
  19. package/dist/assets/{Index.11f603c1.js → Index.83d1fc49.js} +1 -1
  20. package/dist/assets/{Index.dc37f422.js → Index.97f906e5.js} +1 -1
  21. package/dist/assets/{Index.c807458d.js → Index.9b2907d3.js} +1 -1
  22. package/dist/assets/Index.c3ff5d54.js +1 -0
  23. package/dist/assets/{Index.edc58803.js → Index.c64f7cce.js} +1 -1
  24. package/dist/assets/{Index.f89ce050.js → Index.eb472259.js} +1 -1
  25. package/dist/assets/{InfoIcon.2141f56b.js → InfoIcon.0f631732.js} +1 -1
  26. package/dist/assets/{Invitees.56d5594f.js → Invitees.cd5edbbd.js} +1 -1
  27. package/dist/assets/List.4f190a76.js +1 -0
  28. package/dist/assets/{List.6fb0becb.js → List.871e3346.js} +1 -1
  29. package/dist/assets/List.a0985939.js +1 -0
  30. package/dist/assets/{Login.a4150fc6.js → Login.cf1e2c9f.js} +1 -1
  31. package/dist/assets/Main.03bf3025.css +1 -0
  32. package/dist/assets/Main.769c1fba.js +1 -0
  33. package/dist/assets/{Navigator.421fc502.js → Navigator.7660cf6c.js} +1 -1
  34. package/dist/assets/{NoTasks.60547158.js → NoTasks.c2526f0d.js} +1 -1
  35. package/dist/assets/{Pagination.2c1efc73.js → Pagination.f081ac36.js} +1 -1
  36. package/dist/assets/Status.bdb63467.css +1 -0
  37. package/dist/assets/Status.fd3db68d.js +1 -0
  38. package/dist/assets/{Subscribe.0bc25580.js → Subscribe.084d37fc.js} +1 -1
  39. package/dist/assets/{VideoPlayer.64f0dce1.js → VideoPlayer.d6031edf.js} +1 -1
  40. package/dist/assets/application.43d051ef.js +1 -0
  41. package/dist/assets/common.a2831719.js +1 -0
  42. package/dist/assets/{distribution.1bd2a738.js → distribution.8d24ff47.js} +1 -1
  43. package/dist/assets/index.c37a6f29.js +2 -0
  44. package/dist/assets/luma.0b01cbf9.js +1 -0
  45. package/dist/assets/luma.1a9adde0.js +1 -0
  46. package/dist/assets/luma.1d3abb9d.js +1 -0
  47. package/dist/assets/luma.2751dee2.js +1 -0
  48. package/dist/assets/luma.2b9cbd4f.js +1 -0
  49. package/dist/assets/luma.4a07224e.js +1 -0
  50. package/dist/assets/luma.4f3580b7.js +1 -0
  51. package/dist/assets/luma.8c5e98c5.js +1 -0
  52. package/dist/assets/luma.8d6947cc.js +1 -0
  53. package/dist/assets/luma.9426ea53.js +1 -0
  54. package/dist/assets/luma.9e7986b1.js +1 -0
  55. package/dist/assets/luma.a2996d44.js +1 -0
  56. package/dist/assets/luma.be98df9a.js +1 -0
  57. package/dist/assets/luma.cffe7cb5.js +1 -0
  58. package/dist/assets/luma.ea6a9bf6.js +1 -0
  59. package/dist/assets/luma.eee80c1d.js +1 -0
  60. package/dist/assets/luma.fc0c5cbb.js +1 -0
  61. package/dist/assets/{order.6a6aeec2.js → order.4b244663.js} +1 -1
  62. package/dist/assets/{price.967f8780.js → price.c86f0258.js} +1 -1
  63. package/dist/assets/{vendor-@vue.77dbb81d.js → vendor-@vue.ddcf0365.js} +1 -1
  64. package/dist/assets/{vendor-element-plus.c621637c.js → vendor-element-plus.e3d8a038.js} +2 -2
  65. package/dist/assets/{vendor-fortawesome.69508e20.js → vendor-fortawesome.2b4acb38.js} +1 -1
  66. package/dist/assets/{vendor-markdown.80bdb044.js → vendor-markdown.0185da35.js} +1 -1
  67. package/dist/assets/{vendor-others.497786c5.js → vendor-others.c752dc81.js} +1 -1
  68. package/dist/assets/{vendor-qrcode.44a9e66b.js → vendor-qrcode.b1bdae55.js} +1 -1
  69. package/dist/index.html +7 -7
  70. package/package.json +1 -1
  71. package/dist/assets/Conversation.19c570dc.js +0 -1
  72. package/dist/assets/Extra.d2296085.js +0 -1
  73. package/dist/assets/Index.a8c855d6.js +0 -1
  74. package/dist/assets/List.ae695803.js +0 -1
  75. package/dist/assets/List.bc6a1a80.js +0 -1
  76. package/dist/assets/Main.1968e108.css +0 -1
  77. package/dist/assets/Main.baa43c5a.js +0 -1
  78. package/dist/assets/Status.4688cb27.css +0 -1
  79. package/dist/assets/Status.6c1095c5.js +0 -1
  80. package/dist/assets/application.018a63de.js +0 -1
  81. package/dist/assets/common.3fa9e2ae.js +0 -1
  82. package/dist/assets/index.57238893.js +0 -2
  83. package/dist/assets/luma.0a2d1bc5.js +0 -1
  84. package/dist/assets/luma.0e37bf0d.js +0 -1
  85. package/dist/assets/luma.18e6d08f.js +0 -1
  86. package/dist/assets/luma.31f6450b.js +0 -1
  87. package/dist/assets/luma.3d28b187.js +0 -1
  88. package/dist/assets/luma.4a08cf42.js +0 -1
  89. package/dist/assets/luma.52656c21.js +0 -1
  90. package/dist/assets/luma.68816b5a.js +0 -1
  91. package/dist/assets/luma.90f454c9.js +0 -1
  92. package/dist/assets/luma.992755c1.js +0 -1
  93. package/dist/assets/luma.a2c4798b.js +0 -1
  94. package/dist/assets/luma.baf56472.js +0 -1
  95. package/dist/assets/luma.ce424894.js +0 -1
  96. package/dist/assets/luma.d078b9c2.js +0 -1
  97. package/dist/assets/luma.e617a083.js +0 -1
  98. package/dist/assets/luma.e7b2fcf0.js +0 -1
  99. package/dist/assets/luma.eb9a8302.js +0 -1
@@ -1,3 +1,3 @@
1
- import{ao as ye,ap as Z,aq as ke,ar as ve,as as we,at as be}from"./vendor-others.497786c5.js";import{ar as ne}from"./vendor-fortawesome.69508e20.js";import{_ as k,aV as fe,D as Ce,aW as de,N as oe,J as Pe,O as Ae}from"./index.57238893.js";import{S as Se,u as ie,N as Ie,O as Ne,p as $e,x as Te,y as L,t as ae,m as le,k as re,V as Ee,Y as pe,Z as _e,s as Ve,h as Ue,i as De,j as Le,U as ge,_ as je,H as Fe,R as Ge,$ as Re,a0 as Me,a1 as qe}from"./vendor-element-plus.c621637c.js";import{H as w,al as u,o as c,e as _,R as $,f as l,I as te,V as a,M as h,T as f,U as J,ai as se,L as y,S as G,av as me,O as ce,m as Y,u as j,s as Oe,Q as ze,W as Be}from"./vendor-@vue.77dbb81d.js";import{I as X}from"./InfoIcon.2141f56b.js";import"./vendor-markdown.80bdb044.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.44a9e66b.js";const xe=w({name:"LayoutSuno",components:{ElDrawer:Se,ElButton:ie,FontAwesomeIcon:ne},data(){return{drawer:!1,preview:!1}},computed:{isPlaying(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.player)==null?void 0:t.isPlaying}}}),He={class:"main"},We={class:"config"},Ke={class:"result"},Ye={class:"preview"};function Je(e,t,n,o,r,d){const i=u("font-awesome-icon"),p=u("el-button"),m=u("el-drawer");return c(),_("div",He,[$(" \u6700\u5DE6\u4FA7\u914D\u7F6E\u680F "),l("div",We,[te(e.$slots,"config",{},void 0,!0)]),$(" \u4E2D\u95F4\u6B4C\u66F2\u5217\u8868\u680F "),l("div",Ke,[te(e.$slots,"result",{},void 0,!0)]),$(" \u6700\u53F3\u8FB9\u6B4C\u66F2\u9884\u89C8\u680F "),l("div",Ye,[te(e.$slots,"preview",{},void 0,!0)]),a(p,{round:"",class:"menu",onClick:t[0]||(t[0]=v=>e.drawer=!0)},{default:h(()=>[a(i,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),a(m,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=v=>e.drawer=v),"with-header":!1,size:"340px",class:"drawer"},{default:h(()=>[te(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"]),$(` <el-drawer v-model="isPlaying" :with-header="false" size="340px" class="preview_drawer">
1
+ import{ao as ye,ap as X,aq as ke,ar as ve,as as we,at as be}from"./vendor-others.c752dc81.js";import{ar as ne}from"./vendor-fortawesome.2b4acb38.js";import{_ as k,aV as fe,D as Ce,aW as de,O as oe,J as Pe,P as Ae}from"./index.c37a6f29.js";import{R as Se,u as ie,N as Ie,O as Te,p as $e,x as Ne,y as L,t as ae,m as le,k as re,U as Ee,Y as pe,Z as _e,s as Ve,h as Ue,i as De,j as Le,T as ge,_ as je,H as Fe,X as Ge,$ as Re,a0 as Me,a1 as qe}from"./vendor-element-plus.e3d8a038.js";import{H as w,al as u,o as c,e as _,R as $,f as l,I as te,V as a,M as h,T as f,U as J,ai as se,L as y,S as G,av as me,O as ce,m as Y,u as j,s as Oe,Q as ze,W as Be}from"./vendor-@vue.ddcf0365.js";import{I as Z}from"./InfoIcon.0f631732.js";import"./vendor-markdown.0185da35.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.b1bdae55.js";const xe=w({name:"LayoutSuno",components:{ElDrawer:Se,ElButton:ie,FontAwesomeIcon:ne},data(){return{drawer:!1,preview:!1}},computed:{isPlaying(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.player)==null?void 0:t.isPlaying}}}),He={class:"main"},We={class:"config"},Ke={class:"result"},Ye={class:"preview"};function Je(e,t,n,o,r,d){const i=u("font-awesome-icon"),p=u("el-button"),m=u("el-drawer");return c(),_("div",He,[$(" \u6700\u5DE6\u4FA7\u914D\u7F6E\u680F "),l("div",We,[te(e.$slots,"config",{},void 0,!0)]),$(" \u4E2D\u95F4\u6B4C\u66F2\u5217\u8868\u680F "),l("div",Ke,[te(e.$slots,"result",{},void 0,!0)]),$(" \u6700\u53F3\u8FB9\u6B4C\u66F2\u9884\u89C8\u680F "),l("div",Ye,[te(e.$slots,"preview",{},void 0,!0)]),a(p,{round:"",class:"menu",onClick:t[0]||(t[0]=v=>e.drawer=!0)},{default:h(()=>[a(i,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),a(m,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=v=>e.drawer=v),"with-header":!1,size:"340px",class:"drawer"},{default:h(()=>[te(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"]),$(` <el-drawer v-model="isPlaying" :with-header="false" size="340px" class="preview_drawer">
2
2
  <slot name="preview" />
3
- </el-drawer> `)])}var Qe=k(xe,[["render",Je],["__scopeId","data-v-0621513c"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Suno.vue"]]);const Ze=w({name:"VersionSelector",components:{ElSelect:Ie,ElOption:Ne,ElSwitch:$e},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(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.custom},set(e){var t;console.debug("set custom",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,custom:e})}},model:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.model},set(e){var t;console.debug("set model",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,model:e})}}},mounted(){this.model||(console.debug("set default type",fe),this.model=fe)}}),Xe={class:"field"},et={class:"title font-bold"};function tt(e,t,n,o,r,d){const i=u("el-switch"),p=u("el-option"),m=u("el-select");return c(),_("div",Xe,[l("h2",et,f(e.$t("suno.name.type")),1),a(i,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=v=>e.custom=v),class:"value"},null,8,["modelValue"]),a(m,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=v=>e.model=v),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:h(()=>[(c(!0),_(J,null,se(e.options,v=>(c(),y(p,{key:v.value,label:v.label,value:v.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var ot=k(Ze,[["render",tt],["__scopeId","data-v-6d5f21aa"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/TypeSelector.vue"]]);const st=w({name:"UploadAudio",components:{ElUpload:Te,ElButton:ie,InfoIcon:X,FontAwesomeIcon:ne},emits:["change"],data(){return{fileList:[],uploadUrl:Ce()+"/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=>{var t;return(t=e==null?void 0:e.response)==null?void 0:t.file_url})},value:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.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(){var t;const e=(t=this.urls)==null?void 0:t[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){var o;const t={audio_url:e},n=(o=this.credential)==null?void 0:o.token;if(!n){console.error("no token specified");return}L.info(this.$t("suno.message.startingUploadAudio")),de.upload(t,{token:n}).then(r=>{var i,p;console.debug("get upload music success",r.data);const d=(i=r.data)==null?void 0:i.data.audio_id;this.$store.commit("suno/setConfig",{...(p=this.$store.state.suno)==null?void 0:p.config,audio_id:d,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(r=>{var d,i,p;L.error(((p=(i=(d=r==null?void 0:r.response)==null?void 0:d.data)==null?void 0:i.error)==null?void 0:p.message)||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),nt={class:"relative"},it={class:"flex justify-between"},at={class:"flex justify-start items-center"},lt={class:"text-sm font-bold"};function rt(e,t,n,o,r,d){const i=u("info-icon"),p=u("font-awesome-icon"),m=u("el-button"),v=u("el-upload");return c(),_("div",nt,[l("div",it,[l("div",at,[l("span",lt,f(e.$t("suno.name.referenceAudios")),1),a(i,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),a(v,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=C=>e.fileList=C),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:h(()=>[a(m,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:h(()=>[a(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),G(" "+f(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}var ct=k(st,[["render",rt],["__scopeId","data-v-3fef3e18"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/UploadAudio.vue"]]);const ut="",dt=w({name:"PromptInput",components:{ElInput:ae,ElSwitch:$e,InfoIcon:X},data(){return{}},computed:{prompt:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.prompt},set(e){var t;console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,prompt:e})}},instrumental:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.instrumental},set(e){var t;console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,instrumental:e})}}},mounted(){this.value||(this.value=ut)}}),pt={class:"field"},_t={class:"box"},mt={class:"title-info"},ht={class:"title font-bold"},ft={class:"instrumental"},vt={class:"title inline-block"};function $t(e,t,n,o,r,d){const i=u("info-icon"),p=u("el-switch"),m=u("el-input");return c(),_("div",pt,[l("div",_t,[l("div",mt,[l("h2",ht,f(e.$t("suno.name.prompt")),1),a(i,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",ft,[a(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=v=>e.instrumental=v),class:"value mr-2"},null,8,["modelValue"]),l("h2",vt,f(e.$t("suno.name.instrumental")),1)])]),a(m,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=v=>e.prompt=v),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var gt=k(dt,[["render",$t],["__scopeId","data-v-11b65236"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/PromptInput.vue"]]);const yt="",kt=w({name:"LyricInput",components:{ElInput:ae,InfoIcon:X},data(){return{}},computed:{lyric:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.lyric},set(e){var t;console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,lyric:e})}},config(){var e;return(e=this.$store.state.suno)==null?void 0:e.config}},mounted(){this.value||(this.value=yt)}}),wt={class:"field"},bt={class:"box"},Ct={class:"title font-bold"};function Pt(e,t,n,o,r,d){var m;const i=u("info-icon"),p=u("el-input");return c(),_("div",wt,[l("div",bt,[l("h2",Ct,f(e.$t("suno.name.lyrics")),1),a(i,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),((m=e.config)==null?void 0:m.action)!=="extend"?(c(),y(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=v=>e.lyric=v),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(c(),y(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=v=>e.lyric=v),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}var At=k(kt,[["render",Pt],["__scopeId","data-v-b47f1748"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/LyricInput.vue"]]);const St=w({name:"StyleInput",components:{ElInput:ae,InfoIcon:X},data(){return{}},computed:{style:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.style},set(e){var t;console.debug("set style",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,style:e})}},config(){var e;return(e=this.$store.state.suno)==null?void 0:e.config}}}),It={class:"field"},Nt={class:"title-container"},Tt={class:"titlefont-bold"};function Et(e,t,n,o,r,d){const i=u("info-icon"),p=u("el-input");return c(),_("div",It,[l("div",Nt,[l("h2",Tt,f(e.$t("suno.name.style")),1),a(i,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),a(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=m=>e.style=m),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var Vt=k(St,[["render",Et],["__scopeId","data-v-075e574a"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/StyleInput.vue"]]);const Ut="",Dt=w({name:"TitleInput",components:{ElInput:ae,InfoIcon:X},data(){return{}},computed:{title:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.title},set(e){var t;console.debug("set title",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,title:e})}},instrumental:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.instrumental},set(e){var t;console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,instrumental:e})}}},mounted(){this.value||(this.value=Ut)}}),Lt={class:"field"},jt={class:"title-container"},Ft={class:"title font-bold"};function Gt(e,t,n,o,r,d){const i=u("info-icon"),p=u("el-input");return c(),_("div",Lt,[l("div",jt,[l("h2",Ft,f(e.$t("suno.name.title")),1),a(i,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),a(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=m=>e.title=m),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var Rt=k(Dt,[["render",Gt],["__scopeId","data-v-f9bac2fa"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/TitleInput.vue"]]);function Q(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const n=e%60,o=n<10?`0${n}`:n,r=t<10?`0${t}`:t;return o+":"+r}const Mt=w({name:"ExtendFromInput",components:{ElImage:le,ElIcon:re,ElInputNumber:Ee,VideoPlay:pe,VideoPause:_e},data(){return{}},computed:{audio(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.audio},value:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.continue_at},set(e){var t;console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){var t,n;e<0?this.value=0:e>((t=this.audio)==null?void 0:t.duration)?this.value=(n=this.audio)==null?void 0:n.duration:this.value=e},useFormatDuring:Q,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){var t,n,o;((o=(n=(t=this.$store.state)==null?void 0:t.suno)==null?void 0:n.audio)==null?void 0:o.id)!==e.id&&this.onPlay({...e,progress:0})}}}),qt={class:"field"},Ot={class:"box"},zt={class:"title font-bold"},Bt={class:"input-wrapper"},xt={class:"task"},Ht={class:"left"},Wt={key:2,class:"duration"},Kt={class:"info"},Yt={class:"title"},Jt={class:"style"};function Qt(e,t,n,o,r,d){var P,b,A,S,T,s,D,E,V,U,I,F,R,M,q,O,z,B,x,H,W,K,g,he;const i=u("el-input-number"),p=u("el-image"),m=u("video-pause"),v=u("el-icon"),C=u("video-play"),N=me("loading");return c(),_("div",qt,[l("div",Ot,[l("h2",zt,f(e.$t("suno.name.extend")),1),l("div",Bt,[a(i,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=ee=>e.value=ee),class:"value",min:0,max:(P=e.audio)==null?void 0:P.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),l("div",xt,[e.audio?(c(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=ee=>e.onClick(e.audio))},[ce((c(),_("div",Ht,[a(p,{src:(b=e.audio)==null?void 0:b.image_url,class:"cover",fit:"cover"},null,8,["src"]),((A=e.audio)==null?void 0:A.audio_url)&&((s=(T=(S=e.$store.state)==null?void 0:S.suno)==null?void 0:T.audio)==null?void 0:s.id)===e.audio.id&&((V=(E=(D=e.$store.state)==null?void 0:D.suno)==null?void 0:E.audio)==null?void 0:V.state)==="playing"?(c(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=ee=>e.onPause(e.audio))},[a(v,null,{default:h(()=>[a(m)]),_:1})])):$("v-if",!0),((U=e.audio)==null?void 0:U.audio_url)&&(((R=(F=(I=e.$store.state)==null?void 0:I.suno)==null?void 0:F.audio)==null?void 0:R.id)!==e.audio.id||((O=(q=(M=e.$store.state)==null?void 0:M.suno)==null?void 0:q.audio)==null?void 0:O.id)===e.audio.id&&((x=(B=(z=e.$store.state)==null?void 0:z.suno)==null?void 0:B.audio)==null?void 0:x.state)==="paused")?(c(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=ee=>e.onPlay(e.audio))},[a(v,null,{default:h(()=>[a(C)]),_:1})])):$("v-if",!0),(H=e.audio)!=null&&H.duration?(c(),_("div",Wt,f(e.useFormatDuring((W=e.audio)==null?void 0:W.duration)),1)):$("v-if",!0)])),[[N,!((K=e.audio)!=null&&K.audio_url)]]),l("div",Kt,[l("h2",Yt,f((g=e.audio)==null?void 0:g.title),1),l("p",Jt,f((he=e.audio)==null?void 0:he.style),1)])])):$("v-if",!0)])])}var Zt=k(Mt,[["render",Qt],["__scopeId","data-v-040b76e5"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/ExtendFromInput.vue"]]);const Xt=w({name:"CoverFromInput",components:{ElImage:le,ElIcon:re,VideoPlay:pe,VideoPause:_e},data(){return{}},computed:{audio(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.audio},value:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.continue_at},set(e){var t;console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){var t,n;e<0?this.value=0:e>((t=this.audio)==null?void 0:t.duration)?this.value=(n=this.audio)==null?void 0:n.duration:this.value=e},useFormatDuring:Q,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){var t,n,o;((o=(n=(t=this.$store.state)==null?void 0:t.suno)==null?void 0:n.audio)==null?void 0:o.id)!==e.id&&this.onPlay({...e,progress:0})}}}),eo={class:"field"},to={class:"box"},oo={class:"title font-bold"},so={class:"task"},no={class:"left"},io={key:2,class:"duration"},ao={class:"info"},lo={class:"title"},ro={class:"style"};function co(e,t,n,o,r,d){var N,P,b,A,S,T,s,D,E,V,U,I,F,R,M,q,O,z,B,x,H,W,K;const i=u("el-image"),p=u("video-pause"),m=u("el-icon"),v=u("video-play"),C=me("loading");return c(),_("div",eo,[l("div",to,[l("h2",oo,f(e.$t("suno.name.cover")),1)]),l("div",so,[e.audio?(c(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=g=>e.onClick(e.audio))},[ce((c(),_("div",no,[a(i,{src:(N=e.audio)==null?void 0:N.image_url,class:"cover",fit:"cover"},null,8,["src"]),((P=e.audio)==null?void 0:P.audio_url)&&((S=(A=(b=e.$store.state)==null?void 0:b.suno)==null?void 0:A.audio)==null?void 0:S.id)===e.audio.id&&((D=(s=(T=e.$store.state)==null?void 0:T.suno)==null?void 0:s.audio)==null?void 0:D.state)==="playing"?(c(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=g=>e.onPause(e.audio))},[a(m,null,{default:h(()=>[a(p)]),_:1})])):$("v-if",!0),((E=e.audio)==null?void 0:E.audio_url)&&(((I=(U=(V=e.$store.state)==null?void 0:V.suno)==null?void 0:U.audio)==null?void 0:I.id)!==e.audio.id||((M=(R=(F=e.$store.state)==null?void 0:F.suno)==null?void 0:R.audio)==null?void 0:M.id)===e.audio.id&&((z=(O=(q=e.$store.state)==null?void 0:q.suno)==null?void 0:O.audio)==null?void 0:z.state)==="paused")?(c(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=g=>e.onPlay(e.audio))},[a(m,null,{default:h(()=>[a(v)]),_:1})])):$("v-if",!0),(B=e.audio)!=null&&B.duration?(c(),_("div",io,f(e.useFormatDuring((x=e.audio)==null?void 0:x.duration)),1)):$("v-if",!0)])),[[C,!((H=e.audio)!=null&&H.audio_url)]]),l("div",ao,[l("h2",lo,f((W=e.audio)==null?void 0:W.title),1),l("p",ro,f((K=e.audio)==null?void 0:K.style),1)])])):$("v-if",!0)])])}var uo=k(Xt,[["render",co],["__scopeId","data-v-68ea6e7a"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/CoverFromInput.vue"]]);const po=w({name:"PresetPanel",components:{TypeSelector:ot,PromptInput:gt,LyricInput:At,StyleInput:Vt,TitleInput:Rt,ExtendFromInput:Zt,CoverFromInput:uo,UploadAudio:ct,FontAwesomeIcon:ne,ElButton:ie},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.suno)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),_o={class:"panel"},mo={class:"config"},ho={class:"actions"};function fo(e,t,n,o,r,d){var T,s,D,E,V,U,I;const i=u("type-selector"),p=u("upload-audio"),m=u("prompt-input"),v=u("lyric-input"),C=u("style-input"),N=u("title-input"),P=u("extend-from-input"),b=u("cover-from-input"),A=u("font-awesome-icon"),S=u("el-button");return c(),_("div",_o,[l("div",mo,[a(i,{class:"mb-4"}),a(p,{class:"mb-4"}),(T=e.config)!=null&&T.custom?$("v-if",!0):(c(),y(m,{key:0,class:"mb-4"})),((s=e.config)==null?void 0:s.custom)&&!e.config.instrumental?(c(),y(v,{key:1,class:"mb-4"})):$("v-if",!0),(D=e.config)!=null&&D.custom?(c(),y(C,{key:2,class:"mb-4"})):$("v-if",!0),(E=e.config)!=null&&E.custom?(c(),y(N,{key:3,class:"mb-4"})):$("v-if",!0),((V=e.config)==null?void 0:V.action)==="extend"?(c(),y(P,{key:4,class:"mb-4"})):$("v-if",!0),((U=e.config)==null?void 0:U.action)==="cover"?(c(),y(b,{key:5,class:"mb-4"})):$("v-if",!0),l("div",ho,[((I=e.config)==null?void 0:I.action)!=="extend"?(c(),y(S,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[a(A,{icon:"fa-solid fa-magic",class:"mr-2"}),G(" "+f(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(c(),y(S,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[a(A,{icon:"fa-solid fa-magic",class:"mr-2"}),G(" "+f(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])])}var vo=k(po,[["render",fo],["__scopeId","data-v-38bb3c66"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/ConfigPanel.vue"]]);const $o="https://webhook.acedata.cloud/suno",go=w({name:"TaskPreview",components:{ElImage:le,ElIcon:re,ElTooltip:Ve,ElButton:ie,FontAwesomeIcon:ne,VideoPlay:pe,VideoPause:_e,ElDropdown:Ue,ElDropdownMenu:De,ElDropdownItem:Le},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){var e,t;return((t=(e=this.$store.state.suno)==null?void 0:e.status)==null?void 0:t.getApplications)===oe.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){var e;return(e=this.$store.state.suno)==null?void 0:e.tasks},audios(){var n,o,r,d,i,p,m;let e=[];const t=(o=(n=this.modelValue)==null?void 0:n.request)==null?void 0:o.action;return Array.isArray((d=(r=this.modelValue)==null?void 0:r.response)==null?void 0:d.data)&&((m=(p=(i=this.modelValue)==null?void 0:i.response)==null?void 0:p.data)==null||m.forEach(v=>{let C=v;t&&(C.action=t),e.push(C)})),e},application(){var e;return(e=this.$store.state.suno)==null?void 0:e.application},active(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.tasks)==null?void 0:t.active}},methods:{useFormatDuring:Q,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){var t,n,o;((o=(n=(t=this.$store.state)==null?void 0:t.suno)==null?void 0:n.audio)==null?void 0:o.id)!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){var n;e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...(n=this.$store.state.suno)==null?void 0:n.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{ye.exports.saveAs(d,r)})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e,t){e.stopPropagation(),console.log("on get stems",t),await this.onGenerateAudioUrl("stems",t)},onCover(e,t){var n;e.stopPropagation(),console.log("on cover"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...(n=this.$store.state.suno)==null?void 0:n.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"cover",audio:t,audio_id:t.id})},async onConcatMusic(e,t){e.stopPropagation(),console.log("on get concat",t),await this.onGenerateAudioUrl("concat",t)},async onGenerateAudioUrl(e,t){var r;const n={action:e,audio_id:t,callback_url:$o},o=(r=this.credential)==null?void 0:r.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),de.audio(n,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(d=>{var i,p,m;L.error(((m=(p=(i=d==null?void 0:d.response)==null?void 0:i.data)==null?void 0:p.error)==null?void 0:m.message)||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),yo={class:"task"},ko=["onClick"],wo={class:"left"},bo=["onClick"],Co=["onClick"],Po={key:2,class:"duration"},Ao={class:"info"},So={class:"title"},Io={class:"style"},No={class:"right"},To={class:"el-dropdown-link"},Eo={class:"el-dropdown-link"};function Vo(e,t,n,o,r,d){const i=u("el-image"),p=u("video-pause"),m=u("el-icon"),v=u("video-play"),C=u("el-button"),N=u("font-awesome-icon"),P=u("el-tooltip"),b=u("el-dropdown-item"),A=u("el-dropdown-menu"),S=u("el-dropdown"),T=me("loading");return c(),_("div",yo,[(c(!0),_(J,null,se(e.audios,(s,D)=>{var E,V,U,I,F,R,M,q,O,z,B,x,H,W,K;return c(),_("div",{key:D,class:"audio",onClick:g=>e.onClick(s)},[ce((c(),_("div",wo,[a(i,{src:s==null?void 0:s.image_url,class:"cover",fit:"cover"},null,8,["src"]),(s==null?void 0:s.audio_url)&&((U=(V=(E=e.$store.state)==null?void 0:E.suno)==null?void 0:V.audio)==null?void 0:U.id)===s.id&&((R=(F=(I=e.$store.state)==null?void 0:I.suno)==null?void 0:F.audio)==null?void 0:R.state)==="playing"?(c(),_("div",{key:0,class:"overlay",onClick:g=>e.onPause(s)},[a(m,null,{default:h(()=>[a(p)]),_:1})],8,bo)):$("v-if",!0),(s==null?void 0:s.audio_url)&&(((O=(q=(M=e.$store.state)==null?void 0:M.suno)==null?void 0:q.audio)==null?void 0:O.id)!==s.id||((x=(B=(z=e.$store.state)==null?void 0:z.suno)==null?void 0:B.audio)==null?void 0:x.id)===s.id&&((K=(W=(H=e.$store.state)==null?void 0:H.suno)==null?void 0:W.audio)==null?void 0:K.state)==="paused")?(c(),_("div",{key:1,class:"overlay",onClick:g=>e.onPlay(s)},[a(m,null,{default:h(()=>[a(v)]),_:1})],8,Co)):$("v-if",!0),s!=null&&s.duration?(c(),_("div",Po,f(e.useFormatDuring(s==null?void 0:s.duration)),1)):$("v-if",!0)])),[[T,!(s!=null&&s.audio_url)]]),l("div",Ao,[l("h2",So,f(s==null?void 0:s.title),1),l("p",Io,f(s==null?void 0:s.style),1)]),l("div",No,[s!=null&&s.audio_url?(c(),y(C,{key:0,size:"small",round:"",onClick:g=>e.onExtend(g,s)},{default:h(()=>[G(f(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):$("v-if",!0),a(P,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:h(()=>[s!=null&&s.video_url?(c(),y(N,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:g=>e.onPreview(g,s==null?void 0:s.video_url)},null,8,["onClick"])):$("v-if",!0)]),_:2},1032,["content"]),a(S,null,{dropdown:h(()=>[a(A,null,{default:h(()=>[s!=null&&s.video_url?(c(),y(b,{key:0,onClick:g=>e.onDownload(g,s==null?void 0:s.video_url)},{default:h(()=>[G(f(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):$("v-if",!0),s!=null&&s.audio_url?(c(),y(b,{key:1,onClick:g=>e.onDownload(g,s==null?void 0:s.audio_url)},{default:h(()=>[G(f(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):$("v-if",!0)]),_:2},1024)]),default:h(()=>[l("span",To,[a(P,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:h(()=>[(s==null?void 0:s.audio_url)||(s==null?void 0:s.video_url)?(c(),y(N,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):$("v-if",!0)]),_:2},1032,["content"])])]),_:2},1024),a(S,null,{dropdown:h(()=>[a(A,null,{default:h(()=>[a(b,{onClick:g=>e.onGetStems(g,s==null?void 0:s.id)},{default:h(()=>[G(f(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"]),a(b,{onClick:g=>e.onCover(g,s)},{default:h(()=>[G(f(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),(s==null?void 0:s.action)==="extend"?(c(),y(b,{key:0,onClick:g=>e.onConcatMusic(g,s==null?void 0:s.id)},{default:h(()=>[G(f(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):$("v-if",!0)]),_:2},1024)]),default:h(()=>[l("span",Eo,[a(P,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:h(()=>[(s==null?void 0:s.audio_url)||(s==null?void 0:s.video_url)?(c(),y(N,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):$("v-if",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,ko)}),128))])}var Uo=k(go,[["render",Vo],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/task/Preview.vue"]]);const Do={class:"player-slider"},Lo=w({__name:"PlayerSlider",setup(e){const t=Z(),n=Y({get:()=>{var i,p;return(p=(i=t.state.suno)==null?void 0:i.audio)==null?void 0:p.progress},set:i=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:i})}),o=Y({get:()=>{var i,p;return(p=(i=t.state.suno)==null?void 0:i.audio)==null?void 0:p.duration},set:i=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:i})}),r=()=>{},d=i=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:i});return(i,p)=>(c(),_("div",Do,[a(j(ge),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}});var jo=k(Lo,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerSlider.vue"]]),Fo="/assets/disk.4907c891.png";const Go={class:"flex player-song"},Ro=["src"],Mo={class:"ml-2 text-xs flex flex-col justify-between"},qo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Oo={class:"flex"},zo={class:"ml-2 text-dc"},Bo=w({__name:"PlayerSong",setup(e){const t=Z(),n=Y({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return Oe(n,(o,r)=>{if((o==null?void 0:o.audio_url)!==(r==null?void 0:r.audio_url)){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if((o==null?void 0:o.progress)!==(r==null?void 0:r.progress)&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else(o==null?void 0:o.state)!==(r==null?void 0:r.state)&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));(o==null?void 0:o.volume)!==(r==null?void 0:r.volume)&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>{var d,i,p;return c(),_("div",Go,[l("img",{alt:"",class:"w-11 h-11 rounded",src:((d=n.value)==null?void 0:d.image_url)||j(Fo)},null,8,Ro),l("div",Mo,[l("div",qo,[l("div",Oo,[l("span",null,f(((i=n.value)==null?void 0:i.title)||"Music"),1),l("span",zo,"- "+f(((p=n.value)==null?void 0:p.style)||"SmallRuralDog"),1)])])])])}}});var xo=k(Bo,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerSong.vue"]]);const Ho={class:"flex justify-end items-center gap-x-2.5"},Wo={class:"text-xs"},Ko=w({__name:"PlayerAction",setup(e){const t=Z(),n=Y({get:()=>{var r,d;return(d=(r=t.state.suno)==null?void 0:r.audio)==null?void 0:d.progress},set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=Y({get:()=>{var r,d;return(d=(r=t.state.suno)==null?void 0:r.audio)==null?void 0:d.duration},set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(c(),_("div",Ho,[l("span",Wo,f(j(Q)(n.value))+" / "+f(j(Q)(o.value)),1)]))}});var Yo=k(Ko,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerAction.vue"]]);const Jo=w({__name:"IconPark",props:{icon:{type:null,required:!0},theme:{type:String,required:!1},size:{type:[Number,String],required:!1},spin:{type:Boolean,required:!1},fill:{type:[String,Array],required:!1},strokeLinecap:{type:String,required:!1},strokeLinejoin:{type:String,required:!1},strokeWidth:{type:Number,required:!1}},setup(e){return(t,n)=>(c(),y(ze(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"]))}});var ue=k(Jo,[["__file","/home/runner/work/Nexior/Nexior/src/components/common/IconPark.vue"]]);const Qo={class:"player-volume flex flex-col items-center pt-2"},Zo={class:"text-sm mt-3"},Xo={class:"mt-2"},es=w({__name:"PlayerVolumeSlider",setup(e){const t=Z(),n=Y({get:()=>{var i;return(i=t.state.suno.audio)==null?void 0:i.volume},set:i=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:i})}),o=Y({get:()=>{var i;return(i=t.state.suno.audio)==null?void 0:i.muted},set:i=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:i})}),r=()=>t.dispatch("suno/toggleMuted"),d=i=>t.dispatch("suno/setVolume",i);return(i,p)=>(c(),_("div",Qo,[l("div",null,[a(j(ge),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",Zo,f(n.value),1),l("div",Xo,[a(ue,{icon:o.value?j(ke):j(ve),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}});var ts=k(es,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerVolumeSlider.vue"]]);const os={class:"flex items-center justify-center gap-x-3"},ss=w({__name:"PlayerController",setup(e){const t=Z(),n=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=Y(()=>t.state.suno.audio);return(r,d)=>{var i;return c(),_("div",os,[a(ue,{icon:((i=o.value)==null?void 0:i.state)==="playing"?j(we):j(be),size:"45",theme:"filled",class:"control",onClick:n},null,8,["icon"]),a(j(je),{placement:"top",width:"50px"},{reference:h(()=>[a(ue,{icon:j(ve),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:h(()=>[a(ts)]),_:1})])}}});var ns=k(ss,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerController.vue"]]);const is={class:"flex flex-col items-stretch h-20"},as={class:"flex grow px-5 items-center"},ls={class:"flex-1"},rs={class:"flex-1"},cs={class:"flex-1"},us=w({__name:"Player",setup(e){return(t,n)=>(c(),_("div",is,[a(jo),l("div",as,[l("div",ls,[a(xo)]),l("div",rs,[a(ns)]),l("div",cs,[a(Yo)])])]))}});var ds=k(us,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/Player.vue"]]);const ps=w({name:"RecentPanel",components:{TaskPreview:Uo,ElSkeleton:Fe,ElSkeletonItem:Ge,Player:ds},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,t,n,o;return{...(e=this.$store.state.suno)==null?void 0:e.tasks,items:(o=(n=(t=this.$store.state.suno)==null?void 0:t.tasks)==null?void 0:n.items)==null?void 0:o.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),_s={key:0,class:"tasks"},ms={class:"left"},hs={class:"main"},fs={key:1,class:"tasks"},vs={key:2,class:"description"},$s={class:"flex-1 flex flex-col"},gs={class:"h-20"};function ys(e,t,n,o,r,d){var C,N,P,b,A,S,T,s,D,E,V,U;const i=u("el-skeleton-item"),p=u("el-skeleton"),m=u("task-preview"),v=u("player");return c(),_(J,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...I)=>e.onHandleScroll&&e.onHandleScroll(...I))},[((C=e.tasks)==null?void 0:C.items)===void 0?(c(),_("div",_s,[(c(),_(J,null,se(3,I=>l("div",{key:I,class:"task placeholder"},[l("div",ms,[a(p,{animated:""},{template:h(()=>[a(i,{variant:"image",class:"avatar"})]),_:1})]),l("div",hs,[a(p,{animated:""},{template:h(()=>[a(i,{variant:"p",class:"title"}),a(i,{variant:"text",style:{"margin-right":"16px"}}),a(i,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):((P=(N=e.tasks)==null?void 0:N.items)==null?void 0:P.length)&&((A=(b=e.tasks)==null?void 0:b.items)==null?void 0:A.length)>0?(c(),_("div",fs,[(c(!0),_(J,null,se((S=e.tasks)==null?void 0:S.items,(I,F)=>(c(),y(m,{key:F,"model-value":I,class:"preview"},null,8,["model-value"]))),128))])):$("v-if",!0),((s=(T=e.tasks)==null?void 0:T.items)==null?void 0:s.length)===0?(c(),_("p",vs,f(e.$t("suno.message.noTasks")),1)):$("v-if",!0)],544),ce(l("div",$s,[l("div",gs,[a(v)])],512),[[Be,!!((U=(V=(E=(D=e.$store)==null?void 0:D.state)==null?void 0:E.suno)==null?void 0:V.audio)!=null&&U.object)]])],64)}var ks=k(ps,[["render",ys],["__scopeId","data-v-9a683526"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/RecentPanel.vue"]]);const ws=w({name:"TaskPreview",components:{ElScrollbar:Re,IconPicture:Me,ElImage:le,ElAvatar:qe,ElIcon:re},data(){return{showCloseIcon:!0}},computed:{audio(){var e;return(e=this.$store.state.suno)==null?void 0:e.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),bs={key:0,class:"card"},Cs={class:"image-container"},Ps={class:"image-slot"},As={class:"title"},Ss={class:"content"},Is={class:"artist"},Ns={class:"style"},Ts={class:"time"},Es={class:"lyrics"},Vs={key:1,class:"gradient-background"};function Us(e,t,n,o,r,d){const i=u("icon-picture"),p=u("el-icon"),m=u("el-image"),v=u("el-avatar"),C=u("el-scrollbar");return c(),y(C,{class:"right-panel"},{default:h(()=>{var N,P,b,A,S,T,s;return[(N=e.audio)!=null&&N.object?(c(),_("div",bs,[l("div",Cs,[a(m,{src:e.audio.image_url,fit:"cover"},{error:h(()=>[l("div",Ps,[a(p,null,{default:h(()=>[a(i)]),_:1})])]),_:1},8,["src"]),l("h2",As,f((P=e.audio)==null?void 0:P.title),1)]),l("div",Ss,[l("div",Is,[a(v,{size:30,src:(b=e.audio)==null?void 0:b.image_url},null,8,["src"]),l("span",null,f((A=e.audio)==null?void 0:A.prompt),1)]),l("p",Ns,f((S=e.audio)==null?void 0:S.style),1),l("p",Ts,f(e.$dayjs.format((T=e.audio)==null?void 0:T.created_at)),1),l("div",Es,[l("p",null,f((s=e.audio)==null?void 0:s.lyric),1)])])])):(c(),_("div",Vs))]}),_:1})}var Ds=k(ws,[["render",Us],["__scopeId","data-v-19e67a48"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/PreviewPanel.vue"]]);const Ls="https://webhook.acedata.cloud/suno",js=w({name:"SunoIndex",components:{Layout:Qe,ConfigPanel:vo,RecentPanel:ks,PreviewPanel:Ds},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,t;return((t=(e=this.$store.state.suno)==null?void 0:e.status)==null?void 0:t.getApplications)===oe.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===oe.Request},needApply(){return this.$store.state.suno.status.getApplications===oe.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){var n,o;((n=e==null?void 0:e.items)==null?void 0:n.length)>((o=t==null?void 0:t.items)==null?void 0:o.length)&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){var e,t,n;console.debug("reached top"),await this.onGetTasks({createdAtMax:(n=(t=(e=this.tasks)==null?void 0:e.items)==null?void 0:t[0])==null?void 0:n.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(){Pe.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{var t,n;((n=(t=e==null?void 0:e.response)==null?void 0:t.data)==null?void 0:n.code)===Ae&&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:n,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",n,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:n,createdAtMax:o})},async onGenerateAudio(){var n;const e={...this.config,callback_url:Ls},t=(n=this.credential)==null?void 0:n.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),de.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(o=>{var r,d,i;L.error(((i=(d=(r=o==null?void 0:o.response)==null?void 0:r.data)==null?void 0:d.error)==null?void 0:i.message)||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Fs(e,t,n,o,r,d){const i=u("config-panel"),p=u("recent-panel"),m=u("preview-panel"),v=u("layout");return c(),y(v,null,{config:h(()=>[a(i,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:h(()=>[a(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:h(()=>[a(m)]),_:1})}var Ws=k(js,[["render",Fs],["__scopeId","data-v-11d62c6c"],["__file","/home/runner/work/Nexior/Nexior/src/pages/suno/Index.vue"]]);export{Ws as default};
3
+ </el-drawer> `)])}var Qe=k(xe,[["render",Je],["__scopeId","data-v-0621513c"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Suno.vue"]]);const Xe=w({name:"VersionSelector",components:{ElSelect:Ie,ElOption:Te,ElSwitch:$e},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(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.custom},set(e){var t;console.debug("set custom",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,custom:e})}},model:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.model},set(e){var t;console.debug("set model",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,model:e})}}},mounted(){this.model||(console.debug("set default type",fe),this.model=fe)}}),Ze={class:"field"},et={class:"title font-bold"};function tt(e,t,n,o,r,d){const i=u("el-switch"),p=u("el-option"),m=u("el-select");return c(),_("div",Ze,[l("h2",et,f(e.$t("suno.name.type")),1),a(i,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=v=>e.custom=v),class:"value"},null,8,["modelValue"]),a(m,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=v=>e.model=v),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:h(()=>[(c(!0),_(J,null,se(e.options,v=>(c(),y(p,{key:v.value,label:v.label,value:v.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var ot=k(Xe,[["render",tt],["__scopeId","data-v-6d5f21aa"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/TypeSelector.vue"]]);const st=w({name:"UploadAudio",components:{ElUpload:Ne,ElButton:ie,InfoIcon:Z,FontAwesomeIcon:ne},emits:["change"],data(){return{fileList:[],uploadUrl:Ce()+"/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=>{var t;return(t=e==null?void 0:e.response)==null?void 0:t.file_url})},value:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.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(){var t;const e=(t=this.urls)==null?void 0:t[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){var o;const t={audio_url:e},n=(o=this.credential)==null?void 0:o.token;if(!n){console.error("no token specified");return}L.info(this.$t("suno.message.startingUploadAudio")),de.upload(t,{token:n}).then(r=>{var i,p;console.debug("get upload music success",r.data);const d=(i=r.data)==null?void 0:i.data.audio_id;this.$store.commit("suno/setConfig",{...(p=this.$store.state.suno)==null?void 0:p.config,audio_id:d,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(r=>{var d,i,p;L.error(((p=(i=(d=r==null?void 0:r.response)==null?void 0:d.data)==null?void 0:i.error)==null?void 0:p.message)||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),nt={class:"relative"},it={class:"flex justify-between"},at={class:"flex justify-start items-center"},lt={class:"text-sm font-bold"};function rt(e,t,n,o,r,d){const i=u("info-icon"),p=u("font-awesome-icon"),m=u("el-button"),v=u("el-upload");return c(),_("div",nt,[l("div",it,[l("div",at,[l("span",lt,f(e.$t("suno.name.referenceAudios")),1),a(i,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),a(v,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=C=>e.fileList=C),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:h(()=>[a(m,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:h(()=>[a(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),G(" "+f(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}var ct=k(st,[["render",rt],["__scopeId","data-v-3fef3e18"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/UploadAudio.vue"]]);const ut="",dt=w({name:"PromptInput",components:{ElInput:ae,ElSwitch:$e,InfoIcon:Z},data(){return{}},computed:{prompt:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.prompt},set(e){var t;console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,prompt:e})}},instrumental:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.instrumental},set(e){var t;console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,instrumental:e})}}},mounted(){this.value||(this.value=ut)}}),pt={class:"field"},_t={class:"box"},mt={class:"title-info"},ht={class:"title font-bold"},ft={class:"instrumental"},vt={class:"title inline-block"};function $t(e,t,n,o,r,d){const i=u("info-icon"),p=u("el-switch"),m=u("el-input");return c(),_("div",pt,[l("div",_t,[l("div",mt,[l("h2",ht,f(e.$t("suno.name.prompt")),1),a(i,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",ft,[a(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=v=>e.instrumental=v),class:"value mr-2"},null,8,["modelValue"]),l("h2",vt,f(e.$t("suno.name.instrumental")),1)])]),a(m,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=v=>e.prompt=v),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var gt=k(dt,[["render",$t],["__scopeId","data-v-11b65236"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/PromptInput.vue"]]);const yt="",kt=w({name:"LyricInput",components:{ElInput:ae,InfoIcon:Z},data(){return{}},computed:{lyric:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.lyric},set(e){var t;console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,lyric:e})}},config(){var e;return(e=this.$store.state.suno)==null?void 0:e.config}},mounted(){this.value||(this.value=yt)}}),wt={class:"field"},bt={class:"box"},Ct={class:"title font-bold"};function Pt(e,t,n,o,r,d){var m;const i=u("info-icon"),p=u("el-input");return c(),_("div",wt,[l("div",bt,[l("h2",Ct,f(e.$t("suno.name.lyrics")),1),a(i,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),((m=e.config)==null?void 0:m.action)!=="extend"?(c(),y(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=v=>e.lyric=v),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(c(),y(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=v=>e.lyric=v),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}var At=k(kt,[["render",Pt],["__scopeId","data-v-b47f1748"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/LyricInput.vue"]]);const St=w({name:"StyleInput",components:{ElInput:ae,InfoIcon:Z},data(){return{}},computed:{style:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.style},set(e){var t;console.debug("set style",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,style:e})}},config(){var e;return(e=this.$store.state.suno)==null?void 0:e.config}}}),It={class:"field"},Tt={class:"title-container"},Nt={class:"titlefont-bold"};function Et(e,t,n,o,r,d){const i=u("info-icon"),p=u("el-input");return c(),_("div",It,[l("div",Tt,[l("h2",Nt,f(e.$t("suno.name.style")),1),a(i,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),a(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=m=>e.style=m),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var Vt=k(St,[["render",Et],["__scopeId","data-v-075e574a"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/StyleInput.vue"]]);const Ut="",Dt=w({name:"TitleInput",components:{ElInput:ae,InfoIcon:Z},data(){return{}},computed:{title:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.title},set(e){var t;console.debug("set title",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,title:e})}},instrumental:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.instrumental},set(e){var t;console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,instrumental:e})}}},mounted(){this.value||(this.value=Ut)}}),Lt={class:"field"},jt={class:"title-container"},Ft={class:"title font-bold"};function Gt(e,t,n,o,r,d){const i=u("info-icon"),p=u("el-input");return c(),_("div",Lt,[l("div",jt,[l("h2",Ft,f(e.$t("suno.name.title")),1),a(i,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),a(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=m=>e.title=m),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var Rt=k(Dt,[["render",Gt],["__scopeId","data-v-f9bac2fa"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/TitleInput.vue"]]);function Q(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const n=e%60,o=n<10?`0${n}`:n,r=t<10?`0${t}`:t;return o+":"+r}const Mt=w({name:"ExtendFromInput",components:{ElImage:le,ElIcon:re,ElInputNumber:Ee,VideoPlay:pe,VideoPause:_e},data(){return{}},computed:{audio(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.audio},value:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.continue_at},set(e){var t;console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){var t,n;e<0?this.value=0:e>((t=this.audio)==null?void 0:t.duration)?this.value=(n=this.audio)==null?void 0:n.duration:this.value=e},useFormatDuring:Q,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){var t,n,o;((o=(n=(t=this.$store.state)==null?void 0:t.suno)==null?void 0:n.audio)==null?void 0:o.id)!==e.id&&this.onPlay({...e,progress:0})}}}),qt={class:"field"},Ot={class:"box"},zt={class:"title font-bold"},Bt={class:"input-wrapper"},xt={class:"task"},Ht={class:"left"},Wt={key:2,class:"duration"},Kt={class:"info"},Yt={class:"title"},Jt={class:"style"};function Qt(e,t,n,o,r,d){var P,b,A,S,N,s,D,E,V,U,I,F,R,M,q,O,z,B,x,H,W,K,g,he;const i=u("el-input-number"),p=u("el-image"),m=u("video-pause"),v=u("el-icon"),C=u("video-play"),T=me("loading");return c(),_("div",qt,[l("div",Ot,[l("h2",zt,f(e.$t("suno.name.extend")),1),l("div",Bt,[a(i,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=ee=>e.value=ee),class:"value",min:0,max:(P=e.audio)==null?void 0:P.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),l("div",xt,[e.audio?(c(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=ee=>e.onClick(e.audio))},[ce((c(),_("div",Ht,[a(p,{src:(b=e.audio)==null?void 0:b.image_url,class:"cover",fit:"cover"},null,8,["src"]),((A=e.audio)==null?void 0:A.audio_url)&&((s=(N=(S=e.$store.state)==null?void 0:S.suno)==null?void 0:N.audio)==null?void 0:s.id)===e.audio.id&&((V=(E=(D=e.$store.state)==null?void 0:D.suno)==null?void 0:E.audio)==null?void 0:V.state)==="playing"?(c(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=ee=>e.onPause(e.audio))},[a(v,null,{default:h(()=>[a(m)]),_:1})])):$("v-if",!0),((U=e.audio)==null?void 0:U.audio_url)&&(((R=(F=(I=e.$store.state)==null?void 0:I.suno)==null?void 0:F.audio)==null?void 0:R.id)!==e.audio.id||((O=(q=(M=e.$store.state)==null?void 0:M.suno)==null?void 0:q.audio)==null?void 0:O.id)===e.audio.id&&((x=(B=(z=e.$store.state)==null?void 0:z.suno)==null?void 0:B.audio)==null?void 0:x.state)==="paused")?(c(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=ee=>e.onPlay(e.audio))},[a(v,null,{default:h(()=>[a(C)]),_:1})])):$("v-if",!0),(H=e.audio)!=null&&H.duration?(c(),_("div",Wt,f(e.useFormatDuring((W=e.audio)==null?void 0:W.duration)),1)):$("v-if",!0)])),[[T,!((K=e.audio)!=null&&K.audio_url)]]),l("div",Kt,[l("h2",Yt,f((g=e.audio)==null?void 0:g.title),1),l("p",Jt,f((he=e.audio)==null?void 0:he.style),1)])])):$("v-if",!0)])])}var Xt=k(Mt,[["render",Qt],["__scopeId","data-v-040b76e5"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/ExtendFromInput.vue"]]);const Zt=w({name:"CoverFromInput",components:{ElImage:le,ElIcon:re,VideoPlay:pe,VideoPause:_e},data(){return{}},computed:{audio(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.audio},value:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.continue_at},set(e){var t;console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){var t,n;e<0?this.value=0:e>((t=this.audio)==null?void 0:t.duration)?this.value=(n=this.audio)==null?void 0:n.duration:this.value=e},useFormatDuring:Q,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){var t,n,o;((o=(n=(t=this.$store.state)==null?void 0:t.suno)==null?void 0:n.audio)==null?void 0:o.id)!==e.id&&this.onPlay({...e,progress:0})}}}),eo={class:"field"},to={class:"box"},oo={class:"title font-bold"},so={class:"task"},no={class:"left"},io={key:2,class:"duration"},ao={class:"info"},lo={class:"title"},ro={class:"style"};function co(e,t,n,o,r,d){var T,P,b,A,S,N,s,D,E,V,U,I,F,R,M,q,O,z,B,x,H,W,K;const i=u("el-image"),p=u("video-pause"),m=u("el-icon"),v=u("video-play"),C=me("loading");return c(),_("div",eo,[l("div",to,[l("h2",oo,f(e.$t("suno.name.cover")),1)]),l("div",so,[e.audio?(c(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=g=>e.onClick(e.audio))},[ce((c(),_("div",no,[a(i,{src:(T=e.audio)==null?void 0:T.image_url,class:"cover",fit:"cover"},null,8,["src"]),((P=e.audio)==null?void 0:P.audio_url)&&((S=(A=(b=e.$store.state)==null?void 0:b.suno)==null?void 0:A.audio)==null?void 0:S.id)===e.audio.id&&((D=(s=(N=e.$store.state)==null?void 0:N.suno)==null?void 0:s.audio)==null?void 0:D.state)==="playing"?(c(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=g=>e.onPause(e.audio))},[a(m,null,{default:h(()=>[a(p)]),_:1})])):$("v-if",!0),((E=e.audio)==null?void 0:E.audio_url)&&(((I=(U=(V=e.$store.state)==null?void 0:V.suno)==null?void 0:U.audio)==null?void 0:I.id)!==e.audio.id||((M=(R=(F=e.$store.state)==null?void 0:F.suno)==null?void 0:R.audio)==null?void 0:M.id)===e.audio.id&&((z=(O=(q=e.$store.state)==null?void 0:q.suno)==null?void 0:O.audio)==null?void 0:z.state)==="paused")?(c(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=g=>e.onPlay(e.audio))},[a(m,null,{default:h(()=>[a(v)]),_:1})])):$("v-if",!0),(B=e.audio)!=null&&B.duration?(c(),_("div",io,f(e.useFormatDuring((x=e.audio)==null?void 0:x.duration)),1)):$("v-if",!0)])),[[C,!((H=e.audio)!=null&&H.audio_url)]]),l("div",ao,[l("h2",lo,f((W=e.audio)==null?void 0:W.title),1),l("p",ro,f((K=e.audio)==null?void 0:K.style),1)])])):$("v-if",!0)])])}var uo=k(Zt,[["render",co],["__scopeId","data-v-68ea6e7a"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/CoverFromInput.vue"]]);const po=w({name:"PresetPanel",components:{TypeSelector:ot,PromptInput:gt,LyricInput:At,StyleInput:Vt,TitleInput:Rt,ExtendFromInput:Xt,CoverFromInput:uo,UploadAudio:ct,FontAwesomeIcon:ne,ElButton:ie},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.suno)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),_o={class:"panel"},mo={class:"config"},ho={class:"actions"};function fo(e,t,n,o,r,d){var N,s,D,E,V,U,I;const i=u("type-selector"),p=u("upload-audio"),m=u("prompt-input"),v=u("lyric-input"),C=u("style-input"),T=u("title-input"),P=u("extend-from-input"),b=u("cover-from-input"),A=u("font-awesome-icon"),S=u("el-button");return c(),_("div",_o,[l("div",mo,[a(i,{class:"mb-4"}),a(p,{class:"mb-4"}),(N=e.config)!=null&&N.custom?$("v-if",!0):(c(),y(m,{key:0,class:"mb-4"})),((s=e.config)==null?void 0:s.custom)&&!e.config.instrumental?(c(),y(v,{key:1,class:"mb-4"})):$("v-if",!0),(D=e.config)!=null&&D.custom?(c(),y(C,{key:2,class:"mb-4"})):$("v-if",!0),(E=e.config)!=null&&E.custom?(c(),y(T,{key:3,class:"mb-4"})):$("v-if",!0),((V=e.config)==null?void 0:V.action)==="extend"?(c(),y(P,{key:4,class:"mb-4"})):$("v-if",!0),((U=e.config)==null?void 0:U.action)==="cover"?(c(),y(b,{key:5,class:"mb-4"})):$("v-if",!0),l("div",ho,[((I=e.config)==null?void 0:I.action)!=="extend"?(c(),y(S,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[a(A,{icon:"fa-solid fa-magic",class:"mr-2"}),G(" "+f(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(c(),y(S,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[a(A,{icon:"fa-solid fa-magic",class:"mr-2"}),G(" "+f(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])])}var vo=k(po,[["render",fo],["__scopeId","data-v-38bb3c66"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/ConfigPanel.vue"]]);const $o="https://webhook.acedata.cloud/suno",go=w({name:"TaskPreview",components:{ElImage:le,ElIcon:re,ElTooltip:Ve,ElButton:ie,FontAwesomeIcon:ne,VideoPlay:pe,VideoPause:_e,ElDropdown:Ue,ElDropdownMenu:De,ElDropdownItem:Le},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){var e,t;return((t=(e=this.$store.state.suno)==null?void 0:e.status)==null?void 0:t.getApplications)===oe.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){var e;return(e=this.$store.state.suno)==null?void 0:e.tasks},audios(){var n,o,r,d,i,p,m;let e=[];const t=(o=(n=this.modelValue)==null?void 0:n.request)==null?void 0:o.action;return Array.isArray((d=(r=this.modelValue)==null?void 0:r.response)==null?void 0:d.data)&&((m=(p=(i=this.modelValue)==null?void 0:i.response)==null?void 0:p.data)==null||m.forEach(v=>{let C=v;t&&(C.action=t),e.push(C)})),e},application(){var e;return(e=this.$store.state.suno)==null?void 0:e.application},active(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.tasks)==null?void 0:t.active}},methods:{useFormatDuring:Q,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){var t,n,o;((o=(n=(t=this.$store.state)==null?void 0:t.suno)==null?void 0:n.audio)==null?void 0:o.id)!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){var n;e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...(n=this.$store.state.suno)==null?void 0:n.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{ye.exports.saveAs(d,r)})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e,t){e.stopPropagation(),console.log("on get stems",t),await this.onGenerateAudioUrl("stems",t)},onCover(e,t){var n;e.stopPropagation(),console.log("on cover"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...(n=this.$store.state.suno)==null?void 0:n.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"cover",audio:t,audio_id:t.id})},async onConcatMusic(e,t){e.stopPropagation(),console.log("on get concat",t),await this.onGenerateAudioUrl("concat",t)},async onGenerateAudioUrl(e,t){var r;const n={action:e,audio_id:t,callback_url:$o},o=(r=this.credential)==null?void 0:r.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),de.audio(n,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(d=>{var i,p,m;L.error(((m=(p=(i=d==null?void 0:d.response)==null?void 0:i.data)==null?void 0:p.error)==null?void 0:m.message)||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),yo={class:"task"},ko=["onClick"],wo={class:"left"},bo=["onClick"],Co=["onClick"],Po={key:2,class:"duration"},Ao={class:"info"},So={class:"title"},Io={class:"style"},To={class:"right"},No={class:"el-dropdown-link"},Eo={class:"el-dropdown-link"};function Vo(e,t,n,o,r,d){const i=u("el-image"),p=u("video-pause"),m=u("el-icon"),v=u("video-play"),C=u("el-button"),T=u("font-awesome-icon"),P=u("el-tooltip"),b=u("el-dropdown-item"),A=u("el-dropdown-menu"),S=u("el-dropdown"),N=me("loading");return c(),_("div",yo,[(c(!0),_(J,null,se(e.audios,(s,D)=>{var E,V,U,I,F,R,M,q,O,z,B,x,H,W,K;return c(),_("div",{key:D,class:"audio",onClick:g=>e.onClick(s)},[ce((c(),_("div",wo,[a(i,{src:s==null?void 0:s.image_url,class:"cover",fit:"cover"},null,8,["src"]),(s==null?void 0:s.audio_url)&&((U=(V=(E=e.$store.state)==null?void 0:E.suno)==null?void 0:V.audio)==null?void 0:U.id)===s.id&&((R=(F=(I=e.$store.state)==null?void 0:I.suno)==null?void 0:F.audio)==null?void 0:R.state)==="playing"?(c(),_("div",{key:0,class:"overlay",onClick:g=>e.onPause(s)},[a(m,null,{default:h(()=>[a(p)]),_:1})],8,bo)):$("v-if",!0),(s==null?void 0:s.audio_url)&&(((O=(q=(M=e.$store.state)==null?void 0:M.suno)==null?void 0:q.audio)==null?void 0:O.id)!==s.id||((x=(B=(z=e.$store.state)==null?void 0:z.suno)==null?void 0:B.audio)==null?void 0:x.id)===s.id&&((K=(W=(H=e.$store.state)==null?void 0:H.suno)==null?void 0:W.audio)==null?void 0:K.state)==="paused")?(c(),_("div",{key:1,class:"overlay",onClick:g=>e.onPlay(s)},[a(m,null,{default:h(()=>[a(v)]),_:1})],8,Co)):$("v-if",!0),s!=null&&s.duration?(c(),_("div",Po,f(e.useFormatDuring(s==null?void 0:s.duration)),1)):$("v-if",!0)])),[[N,!(s!=null&&s.audio_url)]]),l("div",Ao,[l("h2",So,f(s==null?void 0:s.title),1),l("p",Io,f(s==null?void 0:s.style),1)]),l("div",To,[s!=null&&s.audio_url?(c(),y(C,{key:0,size:"small",round:"",onClick:g=>e.onExtend(g,s)},{default:h(()=>[G(f(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):$("v-if",!0),a(P,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:h(()=>[s!=null&&s.video_url?(c(),y(T,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:g=>e.onPreview(g,s==null?void 0:s.video_url)},null,8,["onClick"])):$("v-if",!0)]),_:2},1032,["content"]),a(S,null,{dropdown:h(()=>[a(A,null,{default:h(()=>[s!=null&&s.video_url?(c(),y(b,{key:0,onClick:g=>e.onDownload(g,s==null?void 0:s.video_url)},{default:h(()=>[G(f(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):$("v-if",!0),s!=null&&s.audio_url?(c(),y(b,{key:1,onClick:g=>e.onDownload(g,s==null?void 0:s.audio_url)},{default:h(()=>[G(f(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):$("v-if",!0)]),_:2},1024)]),default:h(()=>[l("span",No,[a(P,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:h(()=>[(s==null?void 0:s.audio_url)||(s==null?void 0:s.video_url)?(c(),y(T,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):$("v-if",!0)]),_:2},1032,["content"])])]),_:2},1024),a(S,null,{dropdown:h(()=>[a(A,null,{default:h(()=>[a(b,{onClick:g=>e.onGetStems(g,s==null?void 0:s.id)},{default:h(()=>[G(f(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"]),a(b,{onClick:g=>e.onCover(g,s)},{default:h(()=>[G(f(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),(s==null?void 0:s.action)==="extend"?(c(),y(b,{key:0,onClick:g=>e.onConcatMusic(g,s==null?void 0:s.id)},{default:h(()=>[G(f(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):$("v-if",!0)]),_:2},1024)]),default:h(()=>[l("span",Eo,[a(P,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:h(()=>[(s==null?void 0:s.audio_url)||(s==null?void 0:s.video_url)?(c(),y(T,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):$("v-if",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,ko)}),128))])}var Uo=k(go,[["render",Vo],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/task/Preview.vue"]]);const Do={class:"player-slider"},Lo=w({__name:"PlayerSlider",setup(e){const t=X(),n=Y({get:()=>{var i,p;return(p=(i=t.state.suno)==null?void 0:i.audio)==null?void 0:p.progress},set:i=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:i})}),o=Y({get:()=>{var i,p;return(p=(i=t.state.suno)==null?void 0:i.audio)==null?void 0:p.duration},set:i=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:i})}),r=()=>{},d=i=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:i});return(i,p)=>(c(),_("div",Do,[a(j(ge),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}});var jo=k(Lo,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerSlider.vue"]]),Fo="/assets/disk.4907c891.png";const Go={class:"flex player-song"},Ro=["src"],Mo={class:"ml-2 text-xs flex flex-col justify-between"},qo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Oo={class:"flex"},zo={class:"ml-2 text-dc"},Bo=w({__name:"PlayerSong",setup(e){const t=X(),n=Y({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return Oe(n,(o,r)=>{if((o==null?void 0:o.audio_url)!==(r==null?void 0:r.audio_url)){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if((o==null?void 0:o.progress)!==(r==null?void 0:r.progress)&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else(o==null?void 0:o.state)!==(r==null?void 0:r.state)&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));(o==null?void 0:o.volume)!==(r==null?void 0:r.volume)&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>{var d,i,p;return c(),_("div",Go,[l("img",{alt:"",class:"w-11 h-11 rounded",src:((d=n.value)==null?void 0:d.image_url)||j(Fo)},null,8,Ro),l("div",Mo,[l("div",qo,[l("div",Oo,[l("span",null,f(((i=n.value)==null?void 0:i.title)||"Music"),1),l("span",zo,"- "+f(((p=n.value)==null?void 0:p.style)||"SmallRuralDog"),1)])])])])}}});var xo=k(Bo,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerSong.vue"]]);const Ho={class:"flex justify-end items-center gap-x-2.5"},Wo={class:"text-xs"},Ko=w({__name:"PlayerAction",setup(e){const t=X(),n=Y({get:()=>{var r,d;return(d=(r=t.state.suno)==null?void 0:r.audio)==null?void 0:d.progress},set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=Y({get:()=>{var r,d;return(d=(r=t.state.suno)==null?void 0:r.audio)==null?void 0:d.duration},set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(c(),_("div",Ho,[l("span",Wo,f(j(Q)(n.value))+" / "+f(j(Q)(o.value)),1)]))}});var Yo=k(Ko,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerAction.vue"]]);const Jo=w({__name:"IconPark",props:{icon:{type:null,required:!0},theme:{type:String,required:!1},size:{type:[Number,String],required:!1},spin:{type:Boolean,required:!1},fill:{type:[String,Array],required:!1},strokeLinecap:{type:String,required:!1},strokeLinejoin:{type:String,required:!1},strokeWidth:{type:Number,required:!1}},setup(e){return(t,n)=>(c(),y(ze(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"]))}});var ue=k(Jo,[["__file","/home/runner/work/Nexior/Nexior/src/components/common/IconPark.vue"]]);const Qo={class:"player-volume flex flex-col items-center pt-2"},Xo={class:"text-sm mt-3"},Zo={class:"mt-2"},es=w({__name:"PlayerVolumeSlider",setup(e){const t=X(),n=Y({get:()=>{var i;return(i=t.state.suno.audio)==null?void 0:i.volume},set:i=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:i})}),o=Y({get:()=>{var i;return(i=t.state.suno.audio)==null?void 0:i.muted},set:i=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:i})}),r=()=>t.dispatch("suno/toggleMuted"),d=i=>t.dispatch("suno/setVolume",i);return(i,p)=>(c(),_("div",Qo,[l("div",null,[a(j(ge),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",Xo,f(n.value),1),l("div",Zo,[a(ue,{icon:o.value?j(ke):j(ve),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}});var ts=k(es,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerVolumeSlider.vue"]]);const os={class:"flex items-center justify-center gap-x-3"},ss=w({__name:"PlayerController",setup(e){const t=X(),n=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=Y(()=>t.state.suno.audio);return(r,d)=>{var i;return c(),_("div",os,[a(ue,{icon:((i=o.value)==null?void 0:i.state)==="playing"?j(we):j(be),size:"45",theme:"filled",class:"control",onClick:n},null,8,["icon"]),a(j(je),{placement:"top",width:"50px"},{reference:h(()=>[a(ue,{icon:j(ve),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:h(()=>[a(ts)]),_:1})])}}});var ns=k(ss,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerController.vue"]]);const is={class:"flex flex-col items-stretch h-20"},as={class:"flex grow px-5 items-center"},ls={class:"flex-1"},rs={class:"flex-1"},cs={class:"flex-1"},us=w({__name:"Player",setup(e){return(t,n)=>(c(),_("div",is,[a(jo),l("div",as,[l("div",ls,[a(xo)]),l("div",rs,[a(ns)]),l("div",cs,[a(Yo)])])]))}});var ds=k(us,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/Player.vue"]]);const ps=w({name:"RecentPanel",components:{TaskPreview:Uo,ElSkeleton:Fe,ElSkeletonItem:Ge,Player:ds},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,t,n,o;return{...(e=this.$store.state.suno)==null?void 0:e.tasks,items:(o=(n=(t=this.$store.state.suno)==null?void 0:t.tasks)==null?void 0:n.items)==null?void 0:o.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),_s={key:0,class:"tasks"},ms={class:"left"},hs={class:"main"},fs={key:1,class:"tasks"},vs={key:2,class:"description"},$s={class:"flex-1 flex flex-col"},gs={class:"h-20"};function ys(e,t,n,o,r,d){var C,T,P,b,A,S,N,s,D,E,V,U;const i=u("el-skeleton-item"),p=u("el-skeleton"),m=u("task-preview"),v=u("player");return c(),_(J,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...I)=>e.onHandleScroll&&e.onHandleScroll(...I))},[((C=e.tasks)==null?void 0:C.items)===void 0?(c(),_("div",_s,[(c(),_(J,null,se(3,I=>l("div",{key:I,class:"task placeholder"},[l("div",ms,[a(p,{animated:""},{template:h(()=>[a(i,{variant:"image",class:"avatar"})]),_:1})]),l("div",hs,[a(p,{animated:""},{template:h(()=>[a(i,{variant:"p",class:"title"}),a(i,{variant:"text",style:{"margin-right":"16px"}}),a(i,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):((P=(T=e.tasks)==null?void 0:T.items)==null?void 0:P.length)&&((A=(b=e.tasks)==null?void 0:b.items)==null?void 0:A.length)>0?(c(),_("div",fs,[(c(!0),_(J,null,se((S=e.tasks)==null?void 0:S.items,(I,F)=>(c(),y(m,{key:F,"model-value":I,class:"preview"},null,8,["model-value"]))),128))])):$("v-if",!0),((s=(N=e.tasks)==null?void 0:N.items)==null?void 0:s.length)===0?(c(),_("p",vs,f(e.$t("suno.message.noTasks")),1)):$("v-if",!0)],544),ce(l("div",$s,[l("div",gs,[a(v)])],512),[[Be,!!((U=(V=(E=(D=e.$store)==null?void 0:D.state)==null?void 0:E.suno)==null?void 0:V.audio)!=null&&U.object)]])],64)}var ks=k(ps,[["render",ys],["__scopeId","data-v-9a683526"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/RecentPanel.vue"]]);const ws=w({name:"TaskPreview",components:{ElScrollbar:Re,IconPicture:Me,ElImage:le,ElAvatar:qe,ElIcon:re},data(){return{showCloseIcon:!0}},computed:{audio(){var e;return(e=this.$store.state.suno)==null?void 0:e.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),bs={key:0,class:"card"},Cs={class:"image-container"},Ps={class:"image-slot"},As={class:"title"},Ss={class:"content"},Is={class:"artist"},Ts={class:"style"},Ns={class:"time"},Es={class:"lyrics"},Vs={key:1,class:"gradient-background"};function Us(e,t,n,o,r,d){const i=u("icon-picture"),p=u("el-icon"),m=u("el-image"),v=u("el-avatar"),C=u("el-scrollbar");return c(),y(C,{class:"right-panel"},{default:h(()=>{var T,P,b,A,S,N,s;return[(T=e.audio)!=null&&T.object?(c(),_("div",bs,[l("div",Cs,[a(m,{src:e.audio.image_url,fit:"cover"},{error:h(()=>[l("div",Ps,[a(p,null,{default:h(()=>[a(i)]),_:1})])]),_:1},8,["src"]),l("h2",As,f((P=e.audio)==null?void 0:P.title),1)]),l("div",Ss,[l("div",Is,[a(v,{size:30,src:(b=e.audio)==null?void 0:b.image_url},null,8,["src"]),l("span",null,f((A=e.audio)==null?void 0:A.prompt),1)]),l("p",Ts,f((S=e.audio)==null?void 0:S.style),1),l("p",Ns,f(e.$dayjs.format((N=e.audio)==null?void 0:N.created_at)),1),l("div",Es,[l("p",null,f((s=e.audio)==null?void 0:s.lyric),1)])])])):(c(),_("div",Vs))]}),_:1})}var Ds=k(ws,[["render",Us],["__scopeId","data-v-19e67a48"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/PreviewPanel.vue"]]);const Ls="https://webhook.acedata.cloud/suno",js=w({name:"SunoIndex",components:{Layout:Qe,ConfigPanel:vo,RecentPanel:ks,PreviewPanel:Ds},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,t;return((t=(e=this.$store.state.suno)==null?void 0:e.status)==null?void 0:t.getApplications)===oe.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===oe.Request},needApply(){return this.$store.state.suno.status.getApplications===oe.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){var n,o;((n=e==null?void 0:e.items)==null?void 0:n.length)>((o=t==null?void 0:t.items)==null?void 0:o.length)&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){var e,t,n;console.debug("reached top"),await this.onGetTasks({createdAtMax:(n=(t=(e=this.tasks)==null?void 0:e.items)==null?void 0:t[0])==null?void 0:n.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(){Pe.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{var t,n;((n=(t=e==null?void 0:e.response)==null?void 0:t.data)==null?void 0:n.code)===Ae&&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:n,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",n,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:n,createdAtMax:o})},async onGenerateAudio(){var n;const e={...this.config,callback_url:Ls},t=(n=this.credential)==null?void 0:n.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),de.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(o=>{var r,d,i;L.error(((i=(d=(r=o==null?void 0:o.response)==null?void 0:r.data)==null?void 0:d.error)==null?void 0:i.message)||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Fs(e,t,n,o,r,d){const i=u("config-panel"),p=u("recent-panel"),m=u("preview-panel"),v=u("layout");return c(),y(v,null,{config:h(()=>[a(i,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:h(()=>[a(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:h(()=>[a(m)]),_:1})}var Ws=k(js,[["render",Fs],["__scopeId","data-v-11d62c6c"],["__file","/home/runner/work/Nexior/Nexior/src/pages/suno/Index.vue"]]);export{Ws as default};
@@ -1 +1 @@
1
- import"./vendor-others.497786c5.js";import{ar as H}from"./vendor-fortawesome.69508e20.js";import{_ as V,aS as re,D as ce,N as ue,aT as de,a1 as me}from"./index.57238893.js";import{S as pe,u as B,N as _e,O as he,x as fe,y as U,t as ve,m as ge,I as $e,s as ke}from"./vendor-element-plus.c621637c.js";import{H as T,al as a,o as n,e as r,f as c,I as O,V as t,M as p,T as i,U as q,ai as ie,L as C,S as v,R as _,$ as be,P as j}from"./vendor-@vue.77dbb81d.js";import{I as le}from"./InfoIcon.2141f56b.js";import{I as we}from"./ImagePreview.3fb18fec.js";import{C as ye}from"./CopyToClipboard.9a7d0eb5.js";import{V as Ie}from"./VideoPlayer.64f0dce1.js";import{B as Se,N as Ve}from"./NoTasks.60547158.js";import"./vendor-markdown.80bdb044.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.44a9e66b.js";const Te=T({name:"LayoutHailuo",components:{ElDrawer:pe,ElButton:B,FontAwesomeIcon:H},data(){return{drawer:!1}}}),Ue={class:"main"},Ce={class:"config"},Ee={class:"result"};function Ne(e,o,s,u,$,b){const m=a("font-awesome-icon"),h=a("el-button"),d=a("el-drawer");return n(),r("div",Ue,[c("div",Ce,[O(e.$slots,"config",{},void 0,!0)]),c("div",Ee,[O(e.$slots,"result",{},void 0,!0)]),t(h,{round:"",class:"menu",onClick:o[0]||(o[0]=g=>e.drawer=!0)},{default:p(()=>[t(m,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(d,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=g=>e.drawer=g),"with-header":!1,size:"340px",class:"drawer"},{default:p(()=>[O(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Pe=V(Te,[["render",Ne],["__scopeId","data-v-3c8363f5"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Hailuo.vue"]]);const Ge=T({name:"ModelSelector",components:{ElSelect:_e,ElOption:he},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(){var e,o;return(o=(e=this.$store.state.hailuo)==null?void 0:e.config)==null?void 0:o.model},set(e){var o;this.$store.commit("hailuo/setConfig",{...(o=this.$store.state.hailuo)==null?void 0:o.config,model:e})}}},mounted(){this.value||(this.value=re)}}),Ae={class:"field"},Re={class:"title font-bold"},De={class:"float-left"};function Le(e,o,s,u,$,b){const m=a("el-option"),h=a("el-select");return n(),r("div",Ae,[c("h2",Re,i(e.$t("hailuo.name.model")),1),t(h,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=d=>e.value=d),class:"value",placeholder:e.$t("hailuo.placeholder.select"),clearable:""},{default:p(()=>[(n(!0),r(q,null,ie(e.options,d=>(n(),C(m,{key:d.value,label:d.label,value:d.value},{default:p(()=>[c("span",De,i(d.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var Me=V(Ge,[["render",Le],["__scopeId","data-v-62190314"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/config/ModelSelector.vue"]]);const Be=T({name:"StartImageUrlInput",components:{ElUpload:fe,ElButton:B,InfoIcon:le,ImagePreview:we},data(){return{fileList:[],uploadUrl:ce()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>{var o;return(o=e==null?void 0:e.response)==null?void 0:o.file_url})},value:{get(){var e,o;return(o=(e=this.$store.state.hailuo)==null?void 0:e.config)==null?void 0:o.first_image_url},set(){var o,s;const e=(o=this.urls)==null?void 0:o[0];this.$store.commit("hailuo/setConfig",{...(s=this.$store.state.hailuo)==null?void 0:s.config,first_image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){U.warning(this.$t("hailuo.message.uploadStartImageExceed"))},onError(){U.error(this.$t("hailuo.message.uploadStartImageError"))},async onRemove(){U.error(this.$t("hailuo.message.uploadStartImageError"))},onSetStartImageUrl(){var o,s;const e=(o=this.urls)==null?void 0:o[0];this.$store.commit("hailuo/setConfig",{...(s=this.$store.state.hailuo)==null?void 0:s.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),je={class:"relative"},Oe={class:"flex justify-between"},qe={class:"flex justify-start items-center"},He={class:"text-sm font-bold"};function Fe(e,o,s,u,$,b){const m=a("info-icon"),h=a("image-preview"),d=a("el-button"),g=a("el-upload");return n(),r("div",je,[c("div",Oe,[c("div",qe,[c("span",He,i(e.$t("hailuo.name.startImageUrl")),1),t(m,{content:e.$t("hailuo.description.startImageUrl"),class:"info"},null,8,["content"])])]),t(g,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),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:p(({file:l})=>{var f;return[t(h,{url:l.url||((f=l.response)==null?void 0:f.file_url),name:l.name,percentage:l.percentage,onRemove:w=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])]}),default:p(()=>[t(d,{size:"small",type:"primary",class:"btn btn-upload",round:""},{default:p(()=>[v(i(e.$t("hailuo.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])])}var ze=V(Be,[["render",Fe],["__scopeId","data-v-6c6b80d0"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/config/StartImageUrlInput.vue"]]);const Ke="",Je=T({name:"PromptInput",components:{ElInput:ve,InfoIcon:le},computed:{prompt:{get(){var e,o;return(o=(e=this.$store.state.hailuo)==null?void 0:e.config)==null?void 0:o.prompt},set(e){var o;console.debug("set prompt",e),this.$store.commit("hailuo/setConfig",{...(o=this.$store.state.hailuo)==null?void 0:o.config,prompt:e})}}},mounted(){this.value||(this.value=Ke)}}),Qe={class:"field"},We={class:"box"},Xe={class:"title font-bold"};function Ye(e,o,s,u,$,b){const m=a("info-icon"),h=a("el-input");return n(),r("div",Qe,[c("div",We,[c("h2",Xe,i(e.$t("hailuo.name.prompt")),1),t(m,{content:e.$t("hailuo.description.prompt"),class:"info"},null,8,["content"])]),t(h,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=d=>e.prompt=d),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("hailuo.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var Ze=V(Je,[["render",Ye],["__scopeId","data-v-d785889c"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/config/PromptInput.vue"]]);const xe=T({name:"PresetPanel",components:{ElButton:B,FontAwesomeIcon:H,PromptInput:Ze,StartImageUrlInput:ze,ModelSelector:Me},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.hailuo)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),eo={class:"panel"},oo={class:"config"},to={class:"actions"};function so(e,o,s,u,$,b){var f,w,I;const m=a("prompt-input"),h=a("model-selector"),d=a("start-image-url-input"),g=a("font-awesome-icon"),l=a("el-button");return n(),r("div",eo,[c("div",oo,[t(m,{class:"mb-4"}),t(h,{class:"mb-4"}),((f=e.config)==null?void 0:f.model)==="minimax-i2v"?(n(),C(d,{key:0,class:"mb-2"})):_("v-if",!0),c("div",to,[((w=e.config)==null?void 0:w.video_url)!==void 0||((I=e.config)==null?void 0:I.custom)?(n(),C(l,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(g,{icon:"fa-solid fa-magic",class:"mr-2"}),v(" "+i(e.$t("hailuo.button.extend")),1)]),_:1},8,["onClick"])):(n(),C(l,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(g,{icon:"fa-solid fa-magic",class:"mr-2"}),v(" "+i(e.$t("hailuo.button.generate")),1)]),_:1},8,["onClick"]))])])])}var ao=V(xe,[["render",so],["__scopeId","data-v-01eef439"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/ConfigPanel.vue"]]);const no=T({name:"TaskPreview",components:{ElImage:ge,CopyToClipboard:ye,FontAwesomeIcon:H,ElAlert:$e,VideoPlayer:Ie,ElTooltip:ke,ElButton:B},props:{modelValue:{type:Object,required:!0}},computed:{application(){var e;return(e=this.$store.state.hailuo)==null?void 0:e.application},config(){var e;return(e=this.$store.state.hailuo)==null?void 0:e.config},video(){var e,o,s;return(s=(o=(e=this.modelValue)==null?void 0:e.response)==null?void 0:o.data)==null?void 0:s[0]}},methods:{onDownload(e,o){console.debug("on download hailuo video",o),window.open(o,"_blank")}}}),io={class:"preview"},lo={class:"left"},ro={class:"main"},co={class:"bot"},uo={class:"datetime"},mo={class:"info"},po={key:0,class:"prompt mt-2"},_o={key:0},ho={key:1},fo={key:0,class:j({content:!0,failed:!0})},vo={key:0,class:"mb-4"},go={key:1,class:j({operations:!0,"mt-2":!0})},$o={key:0,class:"mb-2"},ko={class:"mb-2"},bo={key:1,class:j({content:!0})},wo={class:"mb-2"},yo={class:"mb-2"},Io={class:"mb-2"},So={key:2,class:j({content:!0})},Vo={class:"mb-2"};function To(e,o,s,u,$,b){var I,E,N,P,L,M,F,z,K,J,Q,W,X,Y,Z,x,ee;const m=a("el-image"),h=a("video-player"),d=a("el-button"),g=a("el-tooltip"),l=a("font-awesome-icon"),f=a("copy-to-clipboard"),w=a("el-alert");return n(),r("div",io,[c("div",lo,[t(m,{src:"https://cdn.acedata.cloud/0qg4gp.png",class:"avatar"})]),c("div",ro,[c("div",co,[v(i(e.$t("hailuo.name.hailuoBot"))+" ",1),c("span",uo,i(e.$dayjs.format(""+new Date(parseFloat((((I=e.modelValue)==null?void 0:I.created_at)||"").toString())*1e3))),1)]),c("div",mo,[(N=(E=e.modelValue)==null?void 0:E.request)!=null&&N.prompt?(n(),r("p",po,[v(i((L=(P=e.modelValue)==null?void 0:P.request)==null?void 0:L.prompt)+" ",1),(M=e.modelValue)!=null&&M.response?_("v-if",!0):(n(),r("span",_o," - ("+i(e.$t("hailuo.status.pending"))+") ",1)),((F=e.video)==null?void 0:F.state)==="processing"||((z=e.video)==null?void 0:z.state)==="pending"||((K=e.video)==null?void 0:K.state)==="running"?(n(),r("span",ho," - ("+i(e.$t("hailuo.status.processing"))+") ",1)):_("v-if",!0)])):_("v-if",!0)]),_(" Display success message "),((Q=(J=e.modelValue)==null?void 0:J.response)==null?void 0:Q.success)===!0?(n(),r("div",fo,[(W=e.video)!=null&&W.video_url?(n(),r("div",vo,[t(h,{src:(X=e.video)==null?void 0:X.video_url},null,8,["src"])])):_("v-if",!0),e.video?(n(),r("div",go,[t(g,{class:"box-item",effect:"dark",content:e.$t("hailuo.message.downloadVideo"),placement:"top-start"},{default:p(()=>{var k;return[(k=e.video)!=null&&k.video_url?(n(),C(d,{key:0,type:"info",size:"small",class:"mb-2",onClick:o[0]||(o[0]=be(y=>{var S;return e.onDownload(y,(S=e.video)==null?void 0:S.video_url)},["stop"]))},{default:p(()=>[v(i(e.$t("hailuo.button.download")),1)]),_:1})):_("v-if",!0)]}),_:1},8,["content"])])):_("v-if",!0),t(w,{closable:!1,class:"mt-2 success"},{default:p(()=>{var k,y,S,G,A,R,D;return[(y=(k=e.modelValue)==null?void 0:k.request)!=null&&y.model?(n(),r("p",$o,[t(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.model"))+": "+i((G=(S=e.modelValue)==null?void 0:S.request)==null?void 0:G.model)+" ",1),t(f,{content:(A=e.modelValue)==null?void 0:A.id},null,8,["content"])])):_("v-if",!0),c("p",ko,[t(l,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.taskId"))+": "+i((R=e.modelValue)==null?void 0:R.id)+" ",1),t(f,{content:(D=e.modelValue)==null?void 0:D.id},null,8,["content"])])]}),_:1})])):_("v-if",!0),_(" Display error message "),((Z=(Y=e.modelValue)==null?void 0:Y.response)==null?void 0:Z.success)===!1?(n(),r("div",bo,[t(w,{closable:!1,class:"failure"},{template:p(()=>[t(l,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.failure")),1)]),default:p(()=>{var k,y,S,G,A,R,D,oe,te,se,ae,ne;return[c("p",wo,[t(l,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.taskId"))+": "+i((k=e.modelValue)==null?void 0:k.id)+" ",1),t(f,{content:(y=e.modelValue)==null?void 0:y.id},null,8,["content"])]),c("p",yo,[t(l,{icon:"fa-solid fa-circle-info",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.failureReason"))+": "+i((A=(G=(S=e.modelValue)==null?void 0:S.response)==null?void 0:G.error)==null?void 0:A.message)+" ",1),t(f,{content:(oe=(D=(R=e.modelValue)==null?void 0:R.response)==null?void 0:D.error)==null?void 0:oe.message},null,8,["content"])]),c("p",Io,[t(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.traceId"))+": "+i((se=(te=e.modelValue)==null?void 0:te.response)==null?void 0:se.trace_id)+" ",1),t(f,{content:(ne=(ae=e.modelValue)==null?void 0:ae.response)==null?void 0:ne.trace_id},null,8,["content"])])]}),_:1})])):_("v-if",!0),_(" Display error message "),((ee=(x=e.modelValue)==null?void 0:x.response)==null?void 0:ee.success)===void 0?(n(),r("div",So,[t(w,{closable:!1,class:"info"},{template:p(()=>[t(l,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.failure")),1)]),default:p(()=>{var k,y;return[c("p",Vo,[t(l,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.taskId"))+": "+i((k=e.modelValue)==null?void 0:k.id)+" ",1),t(f,{content:(y=e.modelValue)==null?void 0:y.id},null,8,["content"])])]}),_:1})])):_("v-if",!0)])])}var Uo=V(no,[["render",To],["__scopeId","data-v-3f5aedb7"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/task/Preview.vue"]]);const Co=T({name:"RecentPanel",components:{TaskPreview:Uo,BotPlaceholder:Se,NoTasks:Ve},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,o,s,u;return{...(e=this.$store.state.hailuo)==null?void 0:e.tasks,items:(u=(s=(o=this.$store.state.hailuo)==null?void 0:o.tasks)==null?void 0:s.items)==null?void 0:u.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Eo={key:0},No={key:1,class:"tasks w-full h-full overflow-y-auto"},Po={key:2};function Go(e,o,s,u,$,b){var g,l,f,w,I,E,N,P;const m=a("bot-placeholder"),h=a("task-preview"),d=a("no-tasks");return n(),r(q,null,[((g=e.tasks)==null?void 0:g.items)===void 0?(n(),r("div",Eo,[t(m)])):((f=(l=e.tasks)==null?void 0:l.items)==null?void 0:f.length)&&((I=(w=e.tasks)==null?void 0:w.items)==null?void 0:I.length)>0?(n(),r("div",No,[(n(!0),r(q,null,ie((E=e.tasks)==null?void 0:E.items,(L,M)=>(n(),C(h,{key:M,"model-value":L},null,8,["model-value"]))),128))])):_("v-if",!0),((P=(N=e.tasks)==null?void 0:N.items)==null?void 0:P.length)===0?(n(),r("div",Po,[t(d)])):_("v-if",!0)],64)}var Ao=V(Co,[["render",Go],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/RecentPanel.vue"]]);const Ro="https://webhook.acedata.cloud/hailuo",Do=T({name:"HailuoIndex",components:{ConfigPanel:ao,Layout:Pe,RecentPanel:Ao},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,o;return((o=(e=this.$store.state.hailuo)==null?void 0:e.status)==null?void 0:o.getApplications)===ue.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,o){var s,u;((s=e==null?void 0:e.items)==null?void 0:s.length)>((u=o==null?void 0:o.items)==null?void 0:u.length)&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){var e,o,s;console.debug("reached top"),await this.onGetTasks({createdAtMax:(s=(o=(e=this.tasks)==null?void 0:e.items)==null?void 0:o[0])==null?void 0:s.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:o=5,createdAtMin:s,createdAtMax:u}=e||{};console.debug("limit",o,"createdAtMin",s,"createdAtMax",u),await this.$store.dispatch("hailuo/getTasks",{limit:o,createdAtMin:s,createdAtMax:u})},async onGenerate(){var s;const e={...this.config,callback_url:Ro},o=(s=this.credential)==null?void 0:s.token;if(!o){console.error("no token specified");return}U.info(this.$t("hailuo.message.startingTask")),de.generate(e,{token:o}).then(()=>{U.success(this.$t("hailuo.message.startTaskSuccess"))}).catch(u=>{var b,m;const $=(b=u==null?void 0:u.response)==null?void 0:b.data;((m=$==null?void 0:$.error)==null?void 0:m.code)===me?U.error(this.$t("hailuo.message.usedUp")):U.error(this.$t("hailuo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Lo(e,o,s,u,$,b){const m=a("config-panel"),h=a("recent-panel"),d=a("layout");return n(),C(d,null,{config:p(()=>[t(m,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:p(()=>[t(h,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}var Yo=V(Do,[["render",Lo],["__file","/home/runner/work/Nexior/Nexior/src/pages/hailuo/Index.vue"]]);export{Yo as default};
1
+ import"./vendor-others.c752dc81.js";import{ar as H}from"./vendor-fortawesome.2b4acb38.js";import{_ as V,aS as re,D as ce,O as ue,aT as de,a1 as me}from"./index.c37a6f29.js";import{R as pe,u as B,N as _e,O as he,x as fe,y as U,t as ve,m as ge,I as $e,s as ke}from"./vendor-element-plus.e3d8a038.js";import{H as T,al as a,o as n,e as r,f as c,I as j,V as t,M as p,T as i,U as q,ai as ie,L as C,S as v,R as _,$ as be,P as O}from"./vendor-@vue.ddcf0365.js";import{I as le}from"./InfoIcon.0f631732.js";import{I as we}from"./ImagePreview.0f3e285b.js";import{C as ye}from"./CopyToClipboard.ce08ef84.js";import{V as Ie}from"./VideoPlayer.d6031edf.js";import{B as Se,N as Ve}from"./NoTasks.c2526f0d.js";import"./vendor-markdown.0185da35.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.b1bdae55.js";const Te=T({name:"LayoutHailuo",components:{ElDrawer:pe,ElButton:B,FontAwesomeIcon:H},data(){return{drawer:!1}}}),Ue={class:"main"},Ce={class:"config"},Ee={class:"result"};function Pe(e,o,s,u,$,b){const m=a("font-awesome-icon"),h=a("el-button"),d=a("el-drawer");return n(),r("div",Ue,[c("div",Ce,[j(e.$slots,"config",{},void 0,!0)]),c("div",Ee,[j(e.$slots,"result",{},void 0,!0)]),t(h,{round:"",class:"menu",onClick:o[0]||(o[0]=g=>e.drawer=!0)},{default:p(()=>[t(m,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(d,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=g=>e.drawer=g),"with-header":!1,size:"340px",class:"drawer"},{default:p(()=>[j(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Ne=V(Te,[["render",Pe],["__scopeId","data-v-3c8363f5"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Hailuo.vue"]]);const Ge=T({name:"ModelSelector",components:{ElSelect:_e,ElOption:he},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(){var e,o;return(o=(e=this.$store.state.hailuo)==null?void 0:e.config)==null?void 0:o.model},set(e){var o;this.$store.commit("hailuo/setConfig",{...(o=this.$store.state.hailuo)==null?void 0:o.config,model:e})}}},mounted(){this.value||(this.value=re)}}),Re={class:"field"},Ae={class:"title font-bold"},De={class:"float-left"};function Le(e,o,s,u,$,b){const m=a("el-option"),h=a("el-select");return n(),r("div",Re,[c("h2",Ae,i(e.$t("hailuo.name.model")),1),t(h,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=d=>e.value=d),class:"value",placeholder:e.$t("hailuo.placeholder.select"),clearable:""},{default:p(()=>[(n(!0),r(q,null,ie(e.options,d=>(n(),C(m,{key:d.value,label:d.label,value:d.value},{default:p(()=>[c("span",De,i(d.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var Me=V(Ge,[["render",Le],["__scopeId","data-v-62190314"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/config/ModelSelector.vue"]]);const Be=T({name:"StartImageUrlInput",components:{ElUpload:fe,ElButton:B,InfoIcon:le,ImagePreview:we},data(){return{fileList:[],uploadUrl:ce()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>{var o;return(o=e==null?void 0:e.response)==null?void 0:o.file_url})},value:{get(){var e,o;return(o=(e=this.$store.state.hailuo)==null?void 0:e.config)==null?void 0:o.first_image_url},set(){var o,s;const e=(o=this.urls)==null?void 0:o[0];this.$store.commit("hailuo/setConfig",{...(s=this.$store.state.hailuo)==null?void 0:s.config,first_image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){U.warning(this.$t("hailuo.message.uploadStartImageExceed"))},onError(){U.error(this.$t("hailuo.message.uploadStartImageError"))},async onRemove(){U.error(this.$t("hailuo.message.uploadStartImageError"))},onSetStartImageUrl(){var o,s;const e=(o=this.urls)==null?void 0:o[0];this.$store.commit("hailuo/setConfig",{...(s=this.$store.state.hailuo)==null?void 0:s.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Oe={class:"relative"},je={class:"flex justify-between"},qe={class:"flex justify-start items-center"},He={class:"text-sm font-bold"};function Fe(e,o,s,u,$,b){const m=a("info-icon"),h=a("image-preview"),d=a("el-button"),g=a("el-upload");return n(),r("div",Oe,[c("div",je,[c("div",qe,[c("span",He,i(e.$t("hailuo.name.startImageUrl")),1),t(m,{content:e.$t("hailuo.description.startImageUrl"),class:"info"},null,8,["content"])])]),t(g,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),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:p(({file:l})=>{var f;return[t(h,{url:l.url||((f=l.response)==null?void 0:f.file_url),name:l.name,percentage:l.percentage,onRemove:w=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])]}),default:p(()=>[t(d,{size:"small",type:"primary",class:"btn btn-upload",round:""},{default:p(()=>[v(i(e.$t("hailuo.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])])}var ze=V(Be,[["render",Fe],["__scopeId","data-v-6c6b80d0"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/config/StartImageUrlInput.vue"]]);const Ke="",Je=T({name:"PromptInput",components:{ElInput:ve,InfoIcon:le},computed:{prompt:{get(){var e,o;return(o=(e=this.$store.state.hailuo)==null?void 0:e.config)==null?void 0:o.prompt},set(e){var o;console.debug("set prompt",e),this.$store.commit("hailuo/setConfig",{...(o=this.$store.state.hailuo)==null?void 0:o.config,prompt:e})}}},mounted(){this.value||(this.value=Ke)}}),Qe={class:"field"},We={class:"box"},Xe={class:"title font-bold"};function Ye(e,o,s,u,$,b){const m=a("info-icon"),h=a("el-input");return n(),r("div",Qe,[c("div",We,[c("h2",Xe,i(e.$t("hailuo.name.prompt")),1),t(m,{content:e.$t("hailuo.description.prompt"),class:"info"},null,8,["content"])]),t(h,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=d=>e.prompt=d),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("hailuo.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var Ze=V(Je,[["render",Ye],["__scopeId","data-v-d785889c"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/config/PromptInput.vue"]]);const xe=T({name:"PresetPanel",components:{ElButton:B,FontAwesomeIcon:H,PromptInput:Ze,StartImageUrlInput:ze,ModelSelector:Me},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.hailuo)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),eo={class:"panel"},oo={class:"config"},to={class:"actions"};function so(e,o,s,u,$,b){var f,w,I;const m=a("prompt-input"),h=a("model-selector"),d=a("start-image-url-input"),g=a("font-awesome-icon"),l=a("el-button");return n(),r("div",eo,[c("div",oo,[t(m,{class:"mb-4"}),t(h,{class:"mb-4"}),((f=e.config)==null?void 0:f.model)==="minimax-i2v"?(n(),C(d,{key:0,class:"mb-2"})):_("v-if",!0),c("div",to,[((w=e.config)==null?void 0:w.video_url)!==void 0||((I=e.config)==null?void 0:I.custom)?(n(),C(l,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(g,{icon:"fa-solid fa-magic",class:"mr-2"}),v(" "+i(e.$t("hailuo.button.extend")),1)]),_:1},8,["onClick"])):(n(),C(l,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(g,{icon:"fa-solid fa-magic",class:"mr-2"}),v(" "+i(e.$t("hailuo.button.generate")),1)]),_:1},8,["onClick"]))])])])}var ao=V(xe,[["render",so],["__scopeId","data-v-01eef439"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/ConfigPanel.vue"]]);const no=T({name:"TaskPreview",components:{ElImage:ge,CopyToClipboard:ye,FontAwesomeIcon:H,ElAlert:$e,VideoPlayer:Ie,ElTooltip:ke,ElButton:B},props:{modelValue:{type:Object,required:!0}},computed:{application(){var e;return(e=this.$store.state.hailuo)==null?void 0:e.application},config(){var e;return(e=this.$store.state.hailuo)==null?void 0:e.config},video(){var e,o,s;return(s=(o=(e=this.modelValue)==null?void 0:e.response)==null?void 0:o.data)==null?void 0:s[0]}},methods:{onDownload(e,o){console.debug("on download hailuo video",o),window.open(o,"_blank")}}}),io={class:"preview"},lo={class:"left"},ro={class:"main"},co={class:"bot"},uo={class:"datetime"},mo={class:"info"},po={key:0,class:"prompt mt-2"},_o={key:0},ho={key:1},fo={key:0,class:O({content:!0,failed:!0})},vo={key:0,class:"mb-4"},go={key:1,class:O({operations:!0,"mt-2":!0})},$o={key:0,class:"mb-2"},ko={class:"mb-2"},bo={key:1,class:O({content:!0})},wo={class:"mb-2"},yo={class:"mb-2"},Io={class:"mb-2"},So={key:2,class:O({content:!0})},Vo={class:"mb-2"};function To(e,o,s,u,$,b){var I,E,P,N,L,M,F,z,K,J,Q,W,X,Y,Z,x,ee;const m=a("el-image"),h=a("video-player"),d=a("el-button"),g=a("el-tooltip"),l=a("font-awesome-icon"),f=a("copy-to-clipboard"),w=a("el-alert");return n(),r("div",io,[c("div",lo,[t(m,{src:"https://cdn.acedata.cloud/0qg4gp.png",class:"avatar"})]),c("div",ro,[c("div",co,[v(i(e.$t("hailuo.name.hailuoBot"))+" ",1),c("span",uo,i(e.$dayjs.format(""+new Date(parseFloat((((I=e.modelValue)==null?void 0:I.created_at)||"").toString())*1e3))),1)]),c("div",mo,[(P=(E=e.modelValue)==null?void 0:E.request)!=null&&P.prompt?(n(),r("p",po,[v(i((L=(N=e.modelValue)==null?void 0:N.request)==null?void 0:L.prompt)+" ",1),(M=e.modelValue)!=null&&M.response?_("v-if",!0):(n(),r("span",_o," - ("+i(e.$t("hailuo.status.pending"))+") ",1)),((F=e.video)==null?void 0:F.state)==="processing"||((z=e.video)==null?void 0:z.state)==="pending"||((K=e.video)==null?void 0:K.state)==="running"?(n(),r("span",ho," - ("+i(e.$t("hailuo.status.processing"))+") ",1)):_("v-if",!0)])):_("v-if",!0)]),_(" Display success message "),((Q=(J=e.modelValue)==null?void 0:J.response)==null?void 0:Q.success)===!0?(n(),r("div",fo,[(W=e.video)!=null&&W.video_url?(n(),r("div",vo,[t(h,{src:(X=e.video)==null?void 0:X.video_url},null,8,["src"])])):_("v-if",!0),e.video?(n(),r("div",go,[t(g,{class:"box-item",effect:"dark",content:e.$t("hailuo.message.downloadVideo"),placement:"top-start"},{default:p(()=>{var k;return[(k=e.video)!=null&&k.video_url?(n(),C(d,{key:0,type:"info",size:"small",class:"mb-2",onClick:o[0]||(o[0]=be(y=>{var S;return e.onDownload(y,(S=e.video)==null?void 0:S.video_url)},["stop"]))},{default:p(()=>[v(i(e.$t("hailuo.button.download")),1)]),_:1})):_("v-if",!0)]}),_:1},8,["content"])])):_("v-if",!0),t(w,{closable:!1,class:"mt-2 success"},{default:p(()=>{var k,y,S,G,R,A,D;return[(y=(k=e.modelValue)==null?void 0:k.request)!=null&&y.model?(n(),r("p",$o,[t(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.model"))+": "+i((G=(S=e.modelValue)==null?void 0:S.request)==null?void 0:G.model)+" ",1),t(f,{content:(R=e.modelValue)==null?void 0:R.id},null,8,["content"])])):_("v-if",!0),c("p",ko,[t(l,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.taskId"))+": "+i((A=e.modelValue)==null?void 0:A.id)+" ",1),t(f,{content:(D=e.modelValue)==null?void 0:D.id},null,8,["content"])])]}),_:1})])):_("v-if",!0),_(" Display error message "),((Z=(Y=e.modelValue)==null?void 0:Y.response)==null?void 0:Z.success)===!1?(n(),r("div",bo,[t(w,{closable:!1,class:"failure"},{template:p(()=>[t(l,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.failure")),1)]),default:p(()=>{var k,y,S,G,R,A,D,oe,te,se,ae,ne;return[c("p",wo,[t(l,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.taskId"))+": "+i((k=e.modelValue)==null?void 0:k.id)+" ",1),t(f,{content:(y=e.modelValue)==null?void 0:y.id},null,8,["content"])]),c("p",yo,[t(l,{icon:"fa-solid fa-circle-info",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.failureReason"))+": "+i((R=(G=(S=e.modelValue)==null?void 0:S.response)==null?void 0:G.error)==null?void 0:R.message)+" ",1),t(f,{content:(oe=(D=(A=e.modelValue)==null?void 0:A.response)==null?void 0:D.error)==null?void 0:oe.message},null,8,["content"])]),c("p",Io,[t(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.traceId"))+": "+i((se=(te=e.modelValue)==null?void 0:te.response)==null?void 0:se.trace_id)+" ",1),t(f,{content:(ne=(ae=e.modelValue)==null?void 0:ae.response)==null?void 0:ne.trace_id},null,8,["content"])])]}),_:1})])):_("v-if",!0),_(" Display error message "),((ee=(x=e.modelValue)==null?void 0:x.response)==null?void 0:ee.success)===void 0?(n(),r("div",So,[t(w,{closable:!1,class:"info"},{template:p(()=>[t(l,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.failure")),1)]),default:p(()=>{var k,y;return[c("p",Vo,[t(l,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+i(e.$t("hailuo.name.taskId"))+": "+i((k=e.modelValue)==null?void 0:k.id)+" ",1),t(f,{content:(y=e.modelValue)==null?void 0:y.id},null,8,["content"])])]}),_:1})])):_("v-if",!0)])])}var Uo=V(no,[["render",To],["__scopeId","data-v-3f5aedb7"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/task/Preview.vue"]]);const Co=T({name:"RecentPanel",components:{TaskPreview:Uo,BotPlaceholder:Se,NoTasks:Ve},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,o,s,u;return{...(e=this.$store.state.hailuo)==null?void 0:e.tasks,items:(u=(s=(o=this.$store.state.hailuo)==null?void 0:o.tasks)==null?void 0:s.items)==null?void 0:u.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Eo={key:0},Po={key:1,class:"tasks w-full h-full overflow-y-auto"},No={key:2};function Go(e,o,s,u,$,b){var g,l,f,w,I,E,P,N;const m=a("bot-placeholder"),h=a("task-preview"),d=a("no-tasks");return n(),r(q,null,[((g=e.tasks)==null?void 0:g.items)===void 0?(n(),r("div",Eo,[t(m)])):((f=(l=e.tasks)==null?void 0:l.items)==null?void 0:f.length)&&((I=(w=e.tasks)==null?void 0:w.items)==null?void 0:I.length)>0?(n(),r("div",Po,[(n(!0),r(q,null,ie((E=e.tasks)==null?void 0:E.items,(L,M)=>(n(),C(h,{key:M,"model-value":L},null,8,["model-value"]))),128))])):_("v-if",!0),((N=(P=e.tasks)==null?void 0:P.items)==null?void 0:N.length)===0?(n(),r("div",No,[t(d)])):_("v-if",!0)],64)}var Ro=V(Co,[["render",Go],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/RecentPanel.vue"]]);const Ao="https://webhook.acedata.cloud/hailuo",Do=T({name:"HailuoIndex",components:{ConfigPanel:ao,Layout:Ne,RecentPanel:Ro},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,o;return((o=(e=this.$store.state.hailuo)==null?void 0:e.status)==null?void 0:o.getApplications)===ue.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,o){var s,u;((s=e==null?void 0:e.items)==null?void 0:s.length)>((u=o==null?void 0:o.items)==null?void 0:u.length)&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){var e,o,s;console.debug("reached top"),await this.onGetTasks({createdAtMax:(s=(o=(e=this.tasks)==null?void 0:e.items)==null?void 0:o[0])==null?void 0:s.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:o=5,createdAtMin:s,createdAtMax:u}=e||{};console.debug("limit",o,"createdAtMin",s,"createdAtMax",u),await this.$store.dispatch("hailuo/getTasks",{limit:o,createdAtMin:s,createdAtMax:u})},async onGenerate(){var s;const e={...this.config,callback_url:Ao},o=(s=this.credential)==null?void 0:s.token;if(!o){console.error("no token specified");return}U.info(this.$t("hailuo.message.startingTask")),de.generate(e,{token:o}).then(()=>{U.success(this.$t("hailuo.message.startTaskSuccess"))}).catch(u=>{var b,m;const $=(b=u==null?void 0:u.response)==null?void 0:b.data;((m=$==null?void 0:$.error)==null?void 0:m.code)===me?U.error(this.$t("hailuo.message.usedUp")):U.error(this.$t("hailuo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Lo(e,o,s,u,$,b){const m=a("config-panel"),h=a("recent-panel"),d=a("layout");return n(),C(d,null,{config:p(()=>[t(m,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:p(()=>[t(h,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}var Yo=V(Do,[["render",Lo],["__file","/home/runner/work/Nexior/Nexior/src/pages/hailuo/Index.vue"]]);export{Yo as default};
@@ -1 +1 @@
1
- import{ah as B}from"./vendor-others.497786c5.js";import{S as V,s as q,g as H,_ as C,f as A,aX as M,R as X,a as j,b as z,aY as F,D as J,c as G}from"./index.57238893.js";import{ar as T}from"./vendor-fortawesome.69508e20.js";import{E as D,N as W,O as Y,m as U,_ as K,q as Q,r as Z}from"./vendor-element-plus.c621637c.js";import{H as L,al as s,o as p,L as x,M as c,V as i,e as I,ai as P,U as R,S as N,T as S,R as O,f as d,a0 as ee,P as te}from"./vendor-@vue.77dbb81d.js";import"./vendor-markdown.80bdb044.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.44a9e66b.js";const oe=L({name:"LocaleSelector",components:{ElDialog:D,ElSelect:W,ElOption:Y},props:{visible:{type:Boolean,default:!1}},emits:["close"],data(){return{value:this.$i18n.locale,locales:V}},methods:{async onSelectLocale(e){this.$router.push({query:{...this.$route.query,locale:void 0}}),await q(e),this.setCookie(e),window.location.reload()},setCookie(e){B("LOCALE",e,{path:"/",domain:H()})}}});function se(e,t,l,n,m,$){const u=s("el-option"),r=s("el-select"),_=s("el-dialog");return p(),x(_,{"model-value":e.visible,width:300,class:"text-center",onClose:t[1]||(t[1]=a=>e.$emit("close"))},{default:c(()=>[i(r,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),onChange:e.onSelectLocale},{default:c(()=>[(p(!0),I(R,null,P(e.locales,(a,o)=>(p(),x(u,{key:o,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1},8,["model-value"])}var ae=C(oe,[["render",se],["__scopeId","data-v-32a102bd"],["__file","/home/runner/work/Nexior/Nexior/src/components/common/LocaleSelector.vue"]]);const le=L({name:"HelpEntry",components:{ElImage:U,ElDialog:D,ElPopover:K,ElMenu:Q,ElMenuItem:Z,FontAwesomeIcon:T},props:{visible:{type:Boolean,default:!0}},emits:["close"],computed:{site(){return this.$store.state.site}},methods:{onJoin(){var e,t,l,n;window.open((n=(l=(t=(e=this.$store.state.site)==null?void 0:e.features)==null?void 0:t.support)==null?void 0:l.discord)==null?void 0:n.url,"_blank")},onProfit(){this.$router.push({name:A})}}}),ne={class:"flex"},ie={class:"flex-1 text-center"};function re(e,t,l,n,m,$){const u=s("font-awesome-icon"),r=s("el-menu-item"),_=s("el-image"),a=s("el-popover"),o=s("el-menu"),v=s("el-dialog");return p(),x(v,{"model-value":e.visible,width:200,class:"text-center",onClose:t[0]||(t[0]=h=>e.$emit("close"))},{default:c(()=>[i(o,{collapse:!1,class:"menu"},{default:c(()=>{var h,g,k,w;return[(w=(k=(g=(h=e.site)==null?void 0:h.features)==null?void 0:g.support)==null?void 0:k.discord)!=null&&w.enabled?(p(),x(r,{key:0,index:"1",onClick:e.onJoin},{title:c(()=>[N(S(e.$t("common.message.joinDiscord")),1)]),default:c(()=>[i(u,{icon:"fa-brands fa-discord",class:"mr-2"})]),_:1},8,["onClick"])):O("v-if",!0),i(a,{width:350,trigger:"hover"},{reference:c(()=>{var f,b,y,E;return[(E=(y=(b=(f=e.site)==null?void 0:f.features)==null?void 0:b.support)==null?void 0:y.wechat)!=null&&E.enabled?(p(),x(r,{key:0,index:"2"},{title:c(()=>[N(S(e.$t("common.message.addWeChat")),1)]),default:c(()=>[i(u,{icon:"fa-brands fa-weixin",class:"mr-2"})]),_:1})):O("v-if",!0)]}),default:c(()=>{var f,b,y,E;return[d("div",ne,[d("div",ie,[i(_,{src:(E=(y=(b=(f=e.site)==null?void 0:f.features)==null?void 0:b.support)==null?void 0:y.wechat)==null?void 0:E.qr},null,8,["src"])])])]}),_:1})]}),_:1})]),_:1},8,["model-value"])}var ce=C(le,[["render",re],["__scopeId","data-v-2800d84d"],["__file","/home/runner/work/Nexior/Nexior/src/components/common/HelpDialog.vue"]]);const ue=L({name:"ProfileIndex",components:{ElImage:U,HelpDialog:ce,FontAwesomeIcon:T,LocaleSelector:ae},data(){return{operating:{locale:!1,dark:!1,help:!1}}},computed:{user(){return this.$store.getters.user},showSupport(){var e,t,l,n,m,$,u,r,_,a,o,v,h,g,k,w,f;return((m=(n=(l=(t=(e=this.$store)==null?void 0:e.state)==null?void 0:t.site)==null?void 0:l.features)==null?void 0:n.support)==null?void 0:m.enabled)&&(((o=(a=(_=(r=(u=($=this.$store)==null?void 0:$.state)==null?void 0:u.site)==null?void 0:r.features)==null?void 0:_.support)==null?void 0:a.discord)==null?void 0:o.enabled)||((f=(w=(k=(g=(h=(v=this.$store)==null?void 0:v.state)==null?void 0:h.site)==null?void 0:g.features)==null?void 0:k.support)==null?void 0:w.wechat)==null?void 0:f.enabled))},showSite(){var e,t,l,n,m;return(m=(l=(t=(e=this.$store)==null?void 0:e.state)==null?void 0:t.site)==null?void 0:l.admins)==null?void 0:m.includes((n=this.$store.getters.user)==null?void 0:n.id)},links(){return[{key:"profile",text:this.$t("console.menu.userProfile"),href:`${M()}/user/profile`,icon:"fa-regular fa-user"},{key:"application-list",text:this.$t("console.menu.applicationList"),name:X,icon:"fa-solid fa-cube"},{key:"order-list",text:this.$t("console.menu.orderList"),name:j,icon:"fa-solid fa-store"},{key:"usage-list",text:this.$t("console.menu.usageList"),name:z,icon:"fa-solid fa-rotate-left"},{key:"distribution-index",text:this.$t("console.menu.distributionIndex"),name:A,icon:"fa-solid fa-coins"},...this.showSite?[{key:"site-index",text:this.$t("common.nav.site"),name:F,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:J(),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:G})},onNavigate(e){e.name?this.$router.push({name:e.name}):e.href?window.open(e.href,"_blank"):e.callback&&e.callback()}}}),de={class:"profile"},pe={class:"info"},me={class:"links"},_e=["onClick"],fe={class:"icon"},he={class:"text"},ve={class:"suffix"};function $e(e,t,l,n,m,$){const u=s("el-image"),r=s("font-awesome-icon"),_=s("locale-selector"),a=s("help-dialog");return p(),I("div",de,[d("div",pe,[i(u,{src:e.user.avatar,fit:"cover",class:"avatar"},null,8,["src"]),d("h2",null,S(e.user.username),1),d("div",{style:ee({backgroundImage:"url("+e.user.avatar+")"}),class:"background"},null,4)]),d("div",me,[(p(!0),I(R,null,P(e.links,(o,v)=>(p(),I("a",{key:v,class:te({link:!0,active:e.$route.name===o.name}),onClick:h=>e.onNavigate(o)},[d("span",fe,[i(r,{icon:o.icon,class:"text-sm"},null,8,["icon"])]),d("span",he,S(o.text),1),d("span",ve,[i(r,{icon:"fa-solid fa-chevron-right",class:"text-sm"})])],10,_e))),128))]),i(_,{visible:e.operating.locale==!0,onClose:t[0]||(t[0]=o=>e.operating.locale=!1)},null,8,["visible"]),i(a,{visible:e.operating.help==!0,onClose:t[1]||(t[1]=o=>e.operating.help=!1)},null,8,["visible"])])}var Se=C(ue,[["render",$e],["__scopeId","data-v-0a2212f8"],["__file","/home/runner/work/Nexior/Nexior/src/pages/profile/Index.vue"]]);export{Se as default};
1
+ import{ah as B}from"./vendor-others.c752dc81.js";import{S as V,s as q,g as H,_ as C,f as A,aX as M,R as X,a as j,b as z,aY as F,D as J,c as G}from"./index.c37a6f29.js";import{ar as T}from"./vendor-fortawesome.2b4acb38.js";import{E as D,N as W,O as Y,m as U,_ as K,q as Q,r as Z}from"./vendor-element-plus.e3d8a038.js";import{H as L,al as s,o as p,L as x,M as c,V as i,e as I,ai as P,U as R,S as N,T as S,R as O,f as d,a0 as ee,P as te}from"./vendor-@vue.ddcf0365.js";import"./vendor-markdown.0185da35.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.b1bdae55.js";const oe=L({name:"LocaleSelector",components:{ElDialog:D,ElSelect:W,ElOption:Y},props:{visible:{type:Boolean,default:!1}},emits:["close"],data(){return{value:this.$i18n.locale,locales:V}},methods:{async onSelectLocale(e){this.$router.push({query:{...this.$route.query,locale:void 0}}),await q(e),this.setCookie(e),window.location.reload()},setCookie(e){B("LOCALE",e,{path:"/",domain:H()})}}});function se(e,t,l,n,m,$){const u=s("el-option"),r=s("el-select"),_=s("el-dialog");return p(),x(_,{"model-value":e.visible,width:300,class:"text-center",onClose:t[1]||(t[1]=a=>e.$emit("close"))},{default:c(()=>[i(r,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),onChange:e.onSelectLocale},{default:c(()=>[(p(!0),I(R,null,P(e.locales,(a,o)=>(p(),x(u,{key:o,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1},8,["model-value"])}var ae=C(oe,[["render",se],["__scopeId","data-v-32a102bd"],["__file","/home/runner/work/Nexior/Nexior/src/components/common/LocaleSelector.vue"]]);const le=L({name:"HelpEntry",components:{ElImage:U,ElDialog:D,ElPopover:K,ElMenu:Q,ElMenuItem:Z,FontAwesomeIcon:T},props:{visible:{type:Boolean,default:!0}},emits:["close"],computed:{site(){return this.$store.state.site}},methods:{onJoin(){var e,t,l,n;window.open((n=(l=(t=(e=this.$store.state.site)==null?void 0:e.features)==null?void 0:t.support)==null?void 0:l.discord)==null?void 0:n.url,"_blank")},onProfit(){this.$router.push({name:A})}}}),ne={class:"flex"},ie={class:"flex-1 text-center"};function re(e,t,l,n,m,$){const u=s("font-awesome-icon"),r=s("el-menu-item"),_=s("el-image"),a=s("el-popover"),o=s("el-menu"),v=s("el-dialog");return p(),x(v,{"model-value":e.visible,width:200,class:"text-center",onClose:t[0]||(t[0]=h=>e.$emit("close"))},{default:c(()=>[i(o,{collapse:!1,class:"menu"},{default:c(()=>{var h,g,k,w;return[(w=(k=(g=(h=e.site)==null?void 0:h.features)==null?void 0:g.support)==null?void 0:k.discord)!=null&&w.enabled?(p(),x(r,{key:0,index:"1",onClick:e.onJoin},{title:c(()=>[N(S(e.$t("common.message.joinDiscord")),1)]),default:c(()=>[i(u,{icon:"fa-brands fa-discord",class:"mr-2"})]),_:1},8,["onClick"])):O("v-if",!0),i(a,{width:350,trigger:"hover"},{reference:c(()=>{var f,b,y,E;return[(E=(y=(b=(f=e.site)==null?void 0:f.features)==null?void 0:b.support)==null?void 0:y.wechat)!=null&&E.enabled?(p(),x(r,{key:0,index:"2"},{title:c(()=>[N(S(e.$t("common.message.addWeChat")),1)]),default:c(()=>[i(u,{icon:"fa-brands fa-weixin",class:"mr-2"})]),_:1})):O("v-if",!0)]}),default:c(()=>{var f,b,y,E;return[d("div",ne,[d("div",ie,[i(_,{src:(E=(y=(b=(f=e.site)==null?void 0:f.features)==null?void 0:b.support)==null?void 0:y.wechat)==null?void 0:E.qr},null,8,["src"])])])]}),_:1})]}),_:1})]),_:1},8,["model-value"])}var ce=C(le,[["render",re],["__scopeId","data-v-2800d84d"],["__file","/home/runner/work/Nexior/Nexior/src/components/common/HelpDialog.vue"]]);const ue=L({name:"ProfileIndex",components:{ElImage:U,HelpDialog:ce,FontAwesomeIcon:T,LocaleSelector:ae},data(){return{operating:{locale:!1,dark:!1,help:!1}}},computed:{user(){return this.$store.getters.user},showSupport(){var e,t,l,n,m,$,u,r,_,a,o,v,h,g,k,w,f;return((m=(n=(l=(t=(e=this.$store)==null?void 0:e.state)==null?void 0:t.site)==null?void 0:l.features)==null?void 0:n.support)==null?void 0:m.enabled)&&(((o=(a=(_=(r=(u=($=this.$store)==null?void 0:$.state)==null?void 0:u.site)==null?void 0:r.features)==null?void 0:_.support)==null?void 0:a.discord)==null?void 0:o.enabled)||((f=(w=(k=(g=(h=(v=this.$store)==null?void 0:v.state)==null?void 0:h.site)==null?void 0:g.features)==null?void 0:k.support)==null?void 0:w.wechat)==null?void 0:f.enabled))},showSite(){var e,t,l,n,m;return(m=(l=(t=(e=this.$store)==null?void 0:e.state)==null?void 0:t.site)==null?void 0:l.admins)==null?void 0:m.includes((n=this.$store.getters.user)==null?void 0:n.id)},links(){return[{key:"profile",text:this.$t("console.menu.userProfile"),href:`${M()}/user/profile`,icon:"fa-regular fa-user"},{key:"application-list",text:this.$t("console.menu.applicationList"),name:X,icon:"fa-solid fa-cube"},{key:"order-list",text:this.$t("console.menu.orderList"),name:j,icon:"fa-solid fa-store"},{key:"usage-list",text:this.$t("console.menu.usageList"),name:z,icon:"fa-solid fa-rotate-left"},{key:"distribution-index",text:this.$t("console.menu.distributionIndex"),name:A,icon:"fa-solid fa-coins"},...this.showSite?[{key:"site-index",text:this.$t("common.nav.site"),name:F,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:J(),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:G})},onNavigate(e){e.name?this.$router.push({name:e.name}):e.href?window.open(e.href,"_blank"):e.callback&&e.callback()}}}),de={class:"profile"},pe={class:"info"},me={class:"links"},_e=["onClick"],fe={class:"icon"},he={class:"text"},ve={class:"suffix"};function $e(e,t,l,n,m,$){const u=s("el-image"),r=s("font-awesome-icon"),_=s("locale-selector"),a=s("help-dialog");return p(),I("div",de,[d("div",pe,[i(u,{src:e.user.avatar,fit:"cover",class:"avatar"},null,8,["src"]),d("h2",null,S(e.user.username),1),d("div",{style:ee({backgroundImage:"url("+e.user.avatar+")"}),class:"background"},null,4)]),d("div",me,[(p(!0),I(R,null,P(e.links,(o,v)=>(p(),I("a",{key:v,class:te({link:!0,active:e.$route.name===o.name}),onClick:h=>e.onNavigate(o)},[d("span",fe,[i(r,{icon:o.icon,class:"text-sm"},null,8,["icon"])]),d("span",he,S(o.text),1),d("span",ve,[i(r,{icon:"fa-solid fa-chevron-right",class:"text-sm"})])],10,_e))),128))]),i(_,{visible:e.operating.locale==!0,onClose:t[0]||(t[0]=o=>e.operating.locale=!1)},null,8,["visible"]),i(a,{visible:e.operating.help==!0,onClose:t[1]||(t[1]=o=>e.operating.help=!1)},null,8,["visible"])])}var Se=C(ue,[["render",$e],["__scopeId","data-v-0a2212f8"],["__file","/home/runner/work/Nexior/Nexior/src/pages/profile/Index.vue"]]);export{Se as default};
@@ -1 +1 @@
1
- import"./vendor-others.497786c5.js";import{ar as O}from"./vendor-fortawesome.69508e20.js";import{_ as w,D as ne,N as L,J as ie,O as le,aU as re,a1 as ce}from"./index.57238893.js";import{S as de,u as j,x as pe,y as T,M as me,L as ue,W as he,X as _e,m as oe,I as ge,H as fe,R as ve}from"./vendor-element-plus.c621637c.js";import{H as I,al as r,o,e as c,f as p,I as M,V as t,M as u,T as l,S as $,U as E,ai as P,L as D,R as g,P as N,m as $e}from"./vendor-@vue.77dbb81d.js";import{I as ye}from"./InfoIcon.2141f56b.js";import{A as be}from"./Status.6c1095c5.js";import{C as ke}from"./CopyToClipboard.9a7d0eb5.js";import"./vendor-markdown.80bdb044.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.44a9e66b.js";const we=I({name:"LayoutHeadshots",components:{ElDrawer:de,ElButton:j,FontAwesomeIcon:O},data(){return{drawer:!1}}}),Ie={class:"main"},Se={class:"config"},Te={class:"result"};function Ve(e,s,a,n,_,f){const d=r("font-awesome-icon"),h=r("el-button"),i=r("el-drawer");return o(),c("div",Ie,[p("div",Se,[M(e.$slots,"config",{},void 0,!0)]),p("div",Te,[M(e.$slots,"result",{},void 0,!0)]),t(h,{round:"",class:"menu",onClick:s[0]||(s[0]=m=>e.drawer=!0)},{default:u(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=m=>e.drawer=m),"with-header":!1,size:"340px",class:"drawer"},{default:u(()=>[M(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Ce=w(we,[["render",Ve],["__scopeId","data-v-3e896eaa"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Headshots.vue"]]);const Ee=I({name:"ImageUrlsInput",components:{ElUpload:pe,ElButton:j,InfoIcon:ye},data(){return{fileList:[],uploadUrl:ne()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>{var s;return(s=e==null?void 0:e.response)==null?void 0:s.file_url})},value:{get(){var e,s;return(s=(e=this.$store.state.headshots)==null?void 0:e.config)==null?void 0:s.image_urls},set(e){var a;const s=this.urls;this.$store.commit("headshots/setConfig",{...(a=this.$store.state.headshots)==null?void 0:a.config,image_urls:s})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){T.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){T.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){var s;const e=this.urls;this.$store.commit("headshots/setConfig",{...(s=this.$store.state.headshots)==null?void 0:s.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),Pe={class:"field"},Ae={class:"title font-bold"},Ge={class:"upload-wrapper"};function Ue(e,s,a,n,_,f){const d=r("el-button"),h=r("el-upload"),i=r("info-icon");return o(),c("div",Pe,[p("h2",Ae,l(e.$t("headshots.name.endImageUrls")),1),p("div",Ge,[t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=m=>e.fileList=m),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:u(()=>[t(d,{size:"small",type:"primary",round:""},{default:u(()=>[$(l(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(i,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}var Ne=w(Ee,[["render",Ue],["__scopeId","data-v-69ae8722"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/config/ImageUrlsInput.vue"]]);const Re="fast",De=I({name:"ModeSelector",components:{ElRadioButton:me,ElRadioGroup:ue},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){var e;return(e=this.$store.state.headshots.config)==null?void 0:e.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=Re)}}),Le={class:"field"},Me={class:"title font-bold"};function Oe(e,s,a,n,_,f){const d=r("el-radio-button"),h=r("el-radio-group");return o(),c("div",Le,[p("h2",Me,l(e.$t("headshots.name.mode")),1),t(h,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=i=>e.value=i),size:"small",class:"mode"},{default:u(()=>[(o(!0),c(E,null,P(e.options,i=>(o(),D(d,{key:i.value,label:i.value},{default:u(()=>[$(l(i.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}var je=w(De,[["render",Oe],["__scopeId","data-v-5ec8e3d9"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/config/ModeSelector.vue"]]);const ze=I({name:"StylizeSelector",components:{ElTabs:he,ElTabPane:_e,ElImage:oe},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){var s;console.debug("set template",e),this.$store.commit("headshots/setConfig",{...(s=this.$store.state.headshots)==null?void 0:s.config,template:e})}},mounted(){var e;this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...(e=this.$store.state.headshots)==null?void 0:e.config,template:this.value})},methods:{onToggle(e){var s;this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...(s=this.$store.state.headshots)==null?void 0:s.config,template:this.value})}}}),Be={class:"field"},He=["onClick"],qe={class:"name"};function Fe(e,s,a,n,_,f){const d=r("el-image"),h=r("el-tab-pane"),i=r("el-tabs");return o(),c("div",Be,[g(` <h2 class="title">{{ $t('headshots.field.elements') }}</h2> `),t(i,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=m=>e.tab=m)},{default:u(()=>[(o(!0),c(E,null,P(e.elements,(m,v)=>(o(),D(h,{key:v,label:m.displayName,name:v,class:"pane"},{default:u(()=>[(o(!0),c(E,null,P(m.items,(k,V)=>(o(),c("div",{key:V,class:N({item:!0,active:e.value===k.value}),onClick:C=>e.onToggle(k.value)},[t(d,{src:k.image,fit:"fill",class:"preview"},null,8,["src"]),p("span",qe,l(k.label),1)],10,He))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}var Je=w(ze,[["render",Fe],["__scopeId","data-v-7e0125ad"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/config/ElementsSelector.vue"]]);const We=I({name:"PresetPanel",components:{ModeSelector:je,ImageUrlsInput:Ne,ElButton:j,FontAwesomeIcon:O,ElementsSelector:Je},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.headshots)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),Xe={class:"panel"},Ke={class:"config"},Qe={class:"actions"};function Ye(e,s,a,n,_,f){const d=r("elements-selector"),h=r("mode-selector"),i=r("image-urls-input"),m=r("font-awesome-icon"),v=r("el-button");return o(),c("div",Xe,[p("div",Ke,[t(d,{class:"mb-4"}),t(h,{class:"mb-4"}),t(i,{class:"mb-4"}),p("div",Qe,[t(v,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(m,{icon:"fa-solid fa-magic",class:"mr-2"}),$(" "+l(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}var Ze=w(We,[["render",Ye],["__scopeId","data-v-6a264fac"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/ConfigPanel.vue"]]);const xe=I({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:$e(()=>{var n,_,f;return((f=(_=(n=e.modelValue)==null?void 0:n.response)==null?void 0:_.data)==null?void 0:f.slice(0,2))||[]}),viewImage:n=>{window.open(n,"_blank")}}}}),es={class:"image-gallery"},ss=["src"],ts=["onClick"];function as(e,s,a,n,_,f){return o(),c("div",es,[(o(!0),c(E,null,P(e.images,(d,h)=>(o(),c("div",{key:h,class:"image-container"},[p("img",{src:d.image_url,alt:"Image"},null,8,ss),d.image_url?(o(),c("button",{key:0,class:"view-button",onClick:i=>e.viewImage(d.image_url)},l(e.$t("headshots.button.viewImage")),9,ts)):g("v-if",!0)]))),128))])}var os=w(xe,[["render",as],["__scopeId","data-v-0187109d"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/ImageGallery.vue"]]);const ns=I({name:"TaskPreview",components:{ElImage:oe,CopyToClipboard:ke,FontAwesomeIcon:O,ElAlert:ge,ImageGallery:os},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){var e;return(e=this.$store.state.headshots)==null?void 0:e.application},config(){var e;return(e=this.$store.state.headshots)==null?void 0:e.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,a=new URL(s.src),n=a.searchParams.get("retry");if(!n)a.searchParams.set("retry","1");else if(parseInt(n)<2)a.searchParams.set("retry",(parseInt(n)+1).toString());else return;s.src=a.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),is={class:"preview"},ls={class:"left"},rs={class:"main"},cs={class:"bot"},ds={class:"datetime"},ps={class:"info"},ms={key:0,class:"prompt mt-2"},us={key:0},hs={key:1},_s={key:0,class:N({content:!0,failed:!0})},gs={class:"image-wrapper"},fs={class:"description"},vs={key:1,class:N({content:!0})},$s={class:"description"},ys={class:"description"},bs={class:"description"},ks={key:2,class:N({content:!0})},ws={class:"description"},Is={key:3,class:N({content:!0})},Ss={class:"description"};function Ts(e,s,a,n,_,f){var k,V,C,A,G,U,S,R,z,B,H,q,F,J,W;const d=r("el-image"),h=r("image-gallery"),i=r("font-awesome-icon"),m=r("copy-to-clipboard"),v=r("el-alert");return o(),c("div",is,[p("div",ls,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),p("div",rs,[p("div",cs,[$(l(e.$t("headshots.name.headshotsBot"))+" ",1),p("span",ds,l(e.$dayjs.format(""+new Date(parseFloat(((k=e.modelValue)==null?void 0:k.created_at)||"")*1e3))),1)]),p("div",ps,[(C=(V=e.modelValue)==null?void 0:V.request)!=null&&C.template?(o(),c("p",ms,[$(l((G=(A=e.modelValue)==null?void 0:A.request)==null?void 0:G.template)+" ",1),(U=e.modelValue)!=null&&U.response?g("v-if",!0):(o(),c("span",us," - ("+l(e.$t("headshots.status.pending"))+") ",1)),((R=(S=e.modelValue)==null?void 0:S.response)==null?void 0:R.status)==="unknown"?(o(),c("span",hs," - ("+l(e.$t("headshots.status.processing"))+") ",1)):g("v-if",!0)])):g("v-if",!0)]),g(" Display success message "),((B=(z=e.modelValue)==null?void 0:z.response)==null?void 0:B.success)===!0?(o(),c("div",_s,[p("div",gs,[t(h,{"model-value":e.modelValue},null,8,["model-value"])]),t(v,{closable:!1,class:"mt-2 success"},{default:u(()=>{var y,b;return[p("p",fs,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0),g(" Display error message "),((q=(H=e.modelValue)==null?void 0:H.response)==null?void 0:q.success)===!1?(o(),c("div",vs,[t(v,{closable:!1,class:"failure"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b,X,K,Q,Y,Z,x,ee,se,te,ae;return[p("p",$s,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])]),p("p",ys,[t(i,{icon:"fa-solid fa-circle-info",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failureReason"))+": "+l((Q=(K=(X=e.modelValue)==null?void 0:X.response)==null?void 0:K.error)==null?void 0:Q.message)+" ",1),t(m,{content:(x=(Z=(Y=e.modelValue)==null?void 0:Y.response)==null?void 0:Z.error)==null?void 0:x.message,class:"btn-copy"},null,8,["content"])]),p("p",bs,[t(i,{icon:"fa-solid fa-hashtag",class:"mr-1"}),$(" "+l(e.$t("headshots.name.traceId"))+": "+l((se=(ee=e.modelValue)==null?void 0:ee.response)==null?void 0:se.trace_id)+" ",1),t(m,{content:(ae=(te=e.modelValue)==null?void 0:te.response)==null?void 0:ae.trace_id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0),g(" Display error message "),(F=e.modelValue)!=null&&F.response?g("v-if",!0):(o(),c("div",ks,[t(v,{closable:!1,class:"info"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b;return[p("p",ws,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])),((W=(J=e.modelValue)==null?void 0:J.response)==null?void 0:W.status)==="unknown"?(o(),c("div",Is,[t(v,{closable:!1,class:"info"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b;return[p("p",Ss,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0)])])}var Vs=w(ns,[["render",Ts],["__scopeId","data-v-43e1feb8"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/task/Preview.vue"]]);const Cs=I({name:"RecentPanel",components:{TaskPreview:Vs,ElSkeleton:fe,ElSkeletonItem:ve},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,s,a,n;return{...(e=this.$store.state.headshots)==null?void 0:e.tasks,items:(n=(a=(s=this.$store.state.headshots)==null?void 0:s.tasks)==null?void 0:a.items)==null?void 0:n.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Es={key:0,class:"tasks"},Ps={class:"left"},As={class:"main"},Gs={key:1,class:"tasks"},Us={key:2,class:"description"};function Ns(e,s,a,n,_,f){var m,v,k,V,C,A,G,U;const d=r("el-skeleton-item"),h=r("el-skeleton"),i=r("task-preview");return o(),c("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...S)=>e.onHandleScroll&&e.onHandleScroll(...S))},[((m=e.tasks)==null?void 0:m.items)===void 0?(o(),c("div",Es,[(o(),c(E,null,P(3,S=>p("div",{key:S,class:"task placeholder"},[p("div",Ps,[t(h,{animated:""},{template:u(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),p("div",As,[t(h,{animated:""},{template:u(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):((k=(v=e.tasks)==null?void 0:v.items)==null?void 0:k.length)&&((C=(V=e.tasks)==null?void 0:V.items)==null?void 0:C.length)>0?(o(),c("div",Gs,[(o(!0),c(E,null,P((A=e.tasks)==null?void 0:A.items,(S,R)=>(o(),D(i,{key:R,"model-value":S,class:"preview"},null,8,["model-value"]))),128))])):g("v-if",!0),((U=(G=e.tasks)==null?void 0:G.items)==null?void 0:U.length)===0?(o(),c("p",Us,l(e.$t("headshots.message.noTasks")),1)):g("v-if",!0)],544)}var Rs=w(Cs,[["render",Ns],["__scopeId","data-v-37920e9a"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/RecentPanel.vue"]]);const Ds="https://webhook.acedata.cloud/headshots",Ls=I({name:"HeadshotsIndex",components:{ConfigPanel:Ze,Layout:Ce,ApplicationStatus:be,RecentPanel:Rs},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,s;return((s=(e=this.$store.state.headshots)==null?void 0:e.status)==null?void 0:s.getApplications)===L.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===L.Request},needApply(){return this.$store.state.headshots.status.getApplications===L.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){var a,n;((a=e==null?void 0:e.items)==null?void 0:a.length)>((n=s==null?void 0:s.items)==null?void 0:n.length)&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){var e,s,a;console.debug("reached top"),await this.onGetTasks({createdAtMax:(a=(s=(e=this.tasks)==null?void 0:e.items)==null?void 0:s[0])==null?void 0:a.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(){ie.create({application:this.application}).then(({data:e})=>{this.application=e,T.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{var s,a;((a=(s=e==null?void 0:e.response)==null?void 0:s.data)==null?void 0:a.code)===le&&T.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:a,createdAtMax:n}=e||{};console.debug("limit",s,"createdAtMin",a,"createdAtMax",n),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:a,createdAtMax:n})},async onGeneratePicture(){var a;const e={...this.config,callback_url:Ds},s=(a=this.credential)==null?void 0:a.token;if(!s){console.error("no token specified");return}T.info(this.$t("headshots.message.startingTask")),re.generate(e,{token:s}).then(()=>{T.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(n=>{var f,d;const _=(f=n==null?void 0:n.response)==null?void 0:f.data;((d=_==null?void 0:_.error)==null?void 0:d.code)===ce?T.error(this.$t("headshots.message.usedUp")):T.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ms(e,s,a,n,_,f){const d=r("config-panel"),h=r("application-status"),i=r("recent-panel"),m=r("layout");return o(),D(m,null,{config:u(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:u(()=>[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]=v=>e.$store.dispatch("headshots/setApplication",v))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(i,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"]),g(' <operation-panel class="panel operation" @generate="onGenerate" /> ')]),_:1})}var Qs=w(Ls,[["render",Ms],["__scopeId","data-v-62da1b28"],["__file","/home/runner/work/Nexior/Nexior/src/pages/headshots/Index.vue"]]);export{Qs as default};
1
+ import"./vendor-others.c752dc81.js";import{ar as O}from"./vendor-fortawesome.2b4acb38.js";import{_ as w,D as ne,O as L,J as ie,P as le,aU as re,a1 as ce}from"./index.c37a6f29.js";import{R as de,u as j,x as pe,y as T,M as me,L as ue,V as he,W as _e,m as oe,I as ge,H as fe,X as ve}from"./vendor-element-plus.e3d8a038.js";import{H as I,al as r,o,e as c,f as p,I as M,V as t,M as u,T as l,S as $,U as P,ai as E,L as D,R as g,P as R,m as $e}from"./vendor-@vue.ddcf0365.js";import{I as ye}from"./InfoIcon.0f631732.js";import{A as be}from"./Status.fd3db68d.js";import{C as ke}from"./CopyToClipboard.ce08ef84.js";import"./vendor-markdown.0185da35.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.b1bdae55.js";const we=I({name:"LayoutHeadshots",components:{ElDrawer:de,ElButton:j,FontAwesomeIcon:O},data(){return{drawer:!1}}}),Ie={class:"main"},Se={class:"config"},Te={class:"result"};function Ve(e,s,a,n,_,f){const d=r("font-awesome-icon"),h=r("el-button"),i=r("el-drawer");return o(),c("div",Ie,[p("div",Se,[M(e.$slots,"config",{},void 0,!0)]),p("div",Te,[M(e.$slots,"result",{},void 0,!0)]),t(h,{round:"",class:"menu",onClick:s[0]||(s[0]=m=>e.drawer=!0)},{default:u(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=m=>e.drawer=m),"with-header":!1,size:"340px",class:"drawer"},{default:u(()=>[M(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Ce=w(we,[["render",Ve],["__scopeId","data-v-3e896eaa"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Headshots.vue"]]);const Pe=I({name:"ImageUrlsInput",components:{ElUpload:pe,ElButton:j,InfoIcon:ye},data(){return{fileList:[],uploadUrl:ne()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>{var s;return(s=e==null?void 0:e.response)==null?void 0:s.file_url})},value:{get(){var e,s;return(s=(e=this.$store.state.headshots)==null?void 0:e.config)==null?void 0:s.image_urls},set(e){var a;const s=this.urls;this.$store.commit("headshots/setConfig",{...(a=this.$store.state.headshots)==null?void 0:a.config,image_urls:s})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){T.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){T.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){var s;const e=this.urls;this.$store.commit("headshots/setConfig",{...(s=this.$store.state.headshots)==null?void 0:s.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),Ee={class:"field"},Ae={class:"title font-bold"},Ge={class:"upload-wrapper"};function Ue(e,s,a,n,_,f){const d=r("el-button"),h=r("el-upload"),i=r("info-icon");return o(),c("div",Ee,[p("h2",Ae,l(e.$t("headshots.name.endImageUrls")),1),p("div",Ge,[t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=m=>e.fileList=m),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:u(()=>[t(d,{size:"small",type:"primary",round:""},{default:u(()=>[$(l(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(i,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}var Re=w(Pe,[["render",Ue],["__scopeId","data-v-69ae8722"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/config/ImageUrlsInput.vue"]]);const Ne="fast",De=I({name:"ModeSelector",components:{ElRadioButton:me,ElRadioGroup:ue},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){var e;return(e=this.$store.state.headshots.config)==null?void 0:e.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=Ne)}}),Le={class:"field"},Me={class:"title font-bold"};function Oe(e,s,a,n,_,f){const d=r("el-radio-button"),h=r("el-radio-group");return o(),c("div",Le,[p("h2",Me,l(e.$t("headshots.name.mode")),1),t(h,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=i=>e.value=i),size:"small",class:"mode"},{default:u(()=>[(o(!0),c(P,null,E(e.options,i=>(o(),D(d,{key:i.value,label:i.value},{default:u(()=>[$(l(i.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}var je=w(De,[["render",Oe],["__scopeId","data-v-5ec8e3d9"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/config/ModeSelector.vue"]]);const ze=I({name:"StylizeSelector",components:{ElTabs:he,ElTabPane:_e,ElImage:oe},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){var s;console.debug("set template",e),this.$store.commit("headshots/setConfig",{...(s=this.$store.state.headshots)==null?void 0:s.config,template:e})}},mounted(){var e;this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...(e=this.$store.state.headshots)==null?void 0:e.config,template:this.value})},methods:{onToggle(e){var s;this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...(s=this.$store.state.headshots)==null?void 0:s.config,template:this.value})}}}),Be={class:"field"},He=["onClick"],qe={class:"name"};function Fe(e,s,a,n,_,f){const d=r("el-image"),h=r("el-tab-pane"),i=r("el-tabs");return o(),c("div",Be,[g(` <h2 class="title">{{ $t('headshots.field.elements') }}</h2> `),t(i,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=m=>e.tab=m)},{default:u(()=>[(o(!0),c(P,null,E(e.elements,(m,v)=>(o(),D(h,{key:v,label:m.displayName,name:v,class:"pane"},{default:u(()=>[(o(!0),c(P,null,E(m.items,(k,V)=>(o(),c("div",{key:V,class:R({item:!0,active:e.value===k.value}),onClick:C=>e.onToggle(k.value)},[t(d,{src:k.image,fit:"fill",class:"preview"},null,8,["src"]),p("span",qe,l(k.label),1)],10,He))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}var Je=w(ze,[["render",Fe],["__scopeId","data-v-7e0125ad"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/config/ElementsSelector.vue"]]);const We=I({name:"PresetPanel",components:{ModeSelector:je,ImageUrlsInput:Re,ElButton:j,FontAwesomeIcon:O,ElementsSelector:Je},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.headshots)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),Xe={class:"panel"},Ke={class:"config"},Qe={class:"actions"};function Ye(e,s,a,n,_,f){const d=r("elements-selector"),h=r("mode-selector"),i=r("image-urls-input"),m=r("font-awesome-icon"),v=r("el-button");return o(),c("div",Xe,[p("div",Ke,[t(d,{class:"mb-4"}),t(h,{class:"mb-4"}),t(i,{class:"mb-4"}),p("div",Qe,[t(v,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(m,{icon:"fa-solid fa-magic",class:"mr-2"}),$(" "+l(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}var Ze=w(We,[["render",Ye],["__scopeId","data-v-6a264fac"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/ConfigPanel.vue"]]);const xe=I({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:$e(()=>{var n,_,f;return((f=(_=(n=e.modelValue)==null?void 0:n.response)==null?void 0:_.data)==null?void 0:f.slice(0,2))||[]}),viewImage:n=>{window.open(n,"_blank")}}}}),es={class:"image-gallery"},ss=["src"],ts=["onClick"];function as(e,s,a,n,_,f){return o(),c("div",es,[(o(!0),c(P,null,E(e.images,(d,h)=>(o(),c("div",{key:h,class:"image-container"},[p("img",{src:d.image_url,alt:"Image"},null,8,ss),d.image_url?(o(),c("button",{key:0,class:"view-button",onClick:i=>e.viewImage(d.image_url)},l(e.$t("headshots.button.viewImage")),9,ts)):g("v-if",!0)]))),128))])}var os=w(xe,[["render",as],["__scopeId","data-v-0187109d"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/ImageGallery.vue"]]);const ns=I({name:"TaskPreview",components:{ElImage:oe,CopyToClipboard:ke,FontAwesomeIcon:O,ElAlert:ge,ImageGallery:os},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){var e;return(e=this.$store.state.headshots)==null?void 0:e.application},config(){var e;return(e=this.$store.state.headshots)==null?void 0:e.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,a=new URL(s.src),n=a.searchParams.get("retry");if(!n)a.searchParams.set("retry","1");else if(parseInt(n)<2)a.searchParams.set("retry",(parseInt(n)+1).toString());else return;s.src=a.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),is={class:"preview"},ls={class:"left"},rs={class:"main"},cs={class:"bot"},ds={class:"datetime"},ps={class:"info"},ms={key:0,class:"prompt mt-2"},us={key:0},hs={key:1},_s={key:0,class:R({content:!0,failed:!0})},gs={class:"image-wrapper"},fs={class:"description"},vs={key:1,class:R({content:!0})},$s={class:"description"},ys={class:"description"},bs={class:"description"},ks={key:2,class:R({content:!0})},ws={class:"description"},Is={key:3,class:R({content:!0})},Ss={class:"description"};function Ts(e,s,a,n,_,f){var k,V,C,A,G,U,S,N,z,B,H,q,F,J,W;const d=r("el-image"),h=r("image-gallery"),i=r("font-awesome-icon"),m=r("copy-to-clipboard"),v=r("el-alert");return o(),c("div",is,[p("div",ls,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),p("div",rs,[p("div",cs,[$(l(e.$t("headshots.name.headshotsBot"))+" ",1),p("span",ds,l(e.$dayjs.format(""+new Date(parseFloat(((k=e.modelValue)==null?void 0:k.created_at)||"")*1e3))),1)]),p("div",ps,[(C=(V=e.modelValue)==null?void 0:V.request)!=null&&C.template?(o(),c("p",ms,[$(l((G=(A=e.modelValue)==null?void 0:A.request)==null?void 0:G.template)+" ",1),(U=e.modelValue)!=null&&U.response?g("v-if",!0):(o(),c("span",us," - ("+l(e.$t("headshots.status.pending"))+") ",1)),((N=(S=e.modelValue)==null?void 0:S.response)==null?void 0:N.status)==="unknown"?(o(),c("span",hs," - ("+l(e.$t("headshots.status.processing"))+") ",1)):g("v-if",!0)])):g("v-if",!0)]),g(" Display success message "),((B=(z=e.modelValue)==null?void 0:z.response)==null?void 0:B.success)===!0?(o(),c("div",_s,[p("div",gs,[t(h,{"model-value":e.modelValue},null,8,["model-value"])]),t(v,{closable:!1,class:"mt-2 success"},{default:u(()=>{var y,b;return[p("p",fs,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0),g(" Display error message "),((q=(H=e.modelValue)==null?void 0:H.response)==null?void 0:q.success)===!1?(o(),c("div",vs,[t(v,{closable:!1,class:"failure"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b,X,K,Q,Y,Z,x,ee,se,te,ae;return[p("p",$s,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])]),p("p",ys,[t(i,{icon:"fa-solid fa-circle-info",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failureReason"))+": "+l((Q=(K=(X=e.modelValue)==null?void 0:X.response)==null?void 0:K.error)==null?void 0:Q.message)+" ",1),t(m,{content:(x=(Z=(Y=e.modelValue)==null?void 0:Y.response)==null?void 0:Z.error)==null?void 0:x.message,class:"btn-copy"},null,8,["content"])]),p("p",bs,[t(i,{icon:"fa-solid fa-hashtag",class:"mr-1"}),$(" "+l(e.$t("headshots.name.traceId"))+": "+l((se=(ee=e.modelValue)==null?void 0:ee.response)==null?void 0:se.trace_id)+" ",1),t(m,{content:(ae=(te=e.modelValue)==null?void 0:te.response)==null?void 0:ae.trace_id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0),g(" Display error message "),(F=e.modelValue)!=null&&F.response?g("v-if",!0):(o(),c("div",ks,[t(v,{closable:!1,class:"info"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b;return[p("p",ws,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])),((W=(J=e.modelValue)==null?void 0:J.response)==null?void 0:W.status)==="unknown"?(o(),c("div",Is,[t(v,{closable:!1,class:"info"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b;return[p("p",Ss,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0)])])}var Vs=w(ns,[["render",Ts],["__scopeId","data-v-43e1feb8"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/task/Preview.vue"]]);const Cs=I({name:"RecentPanel",components:{TaskPreview:Vs,ElSkeleton:fe,ElSkeletonItem:ve},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,s,a,n;return{...(e=this.$store.state.headshots)==null?void 0:e.tasks,items:(n=(a=(s=this.$store.state.headshots)==null?void 0:s.tasks)==null?void 0:a.items)==null?void 0:n.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Ps={key:0,class:"tasks"},Es={class:"left"},As={class:"main"},Gs={key:1,class:"tasks"},Us={key:2,class:"description"};function Rs(e,s,a,n,_,f){var m,v,k,V,C,A,G,U;const d=r("el-skeleton-item"),h=r("el-skeleton"),i=r("task-preview");return o(),c("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...S)=>e.onHandleScroll&&e.onHandleScroll(...S))},[((m=e.tasks)==null?void 0:m.items)===void 0?(o(),c("div",Ps,[(o(),c(P,null,E(3,S=>p("div",{key:S,class:"task placeholder"},[p("div",Es,[t(h,{animated:""},{template:u(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),p("div",As,[t(h,{animated:""},{template:u(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):((k=(v=e.tasks)==null?void 0:v.items)==null?void 0:k.length)&&((C=(V=e.tasks)==null?void 0:V.items)==null?void 0:C.length)>0?(o(),c("div",Gs,[(o(!0),c(P,null,E((A=e.tasks)==null?void 0:A.items,(S,N)=>(o(),D(i,{key:N,"model-value":S,class:"preview"},null,8,["model-value"]))),128))])):g("v-if",!0),((U=(G=e.tasks)==null?void 0:G.items)==null?void 0:U.length)===0?(o(),c("p",Us,l(e.$t("headshots.message.noTasks")),1)):g("v-if",!0)],544)}var Ns=w(Cs,[["render",Rs],["__scopeId","data-v-37920e9a"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/RecentPanel.vue"]]);const Ds="https://webhook.acedata.cloud/headshots",Ls=I({name:"HeadshotsIndex",components:{ConfigPanel:Ze,Layout:Ce,ApplicationStatus:be,RecentPanel:Ns},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,s;return((s=(e=this.$store.state.headshots)==null?void 0:e.status)==null?void 0:s.getApplications)===L.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===L.Request},needApply(){return this.$store.state.headshots.status.getApplications===L.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){var a,n;((a=e==null?void 0:e.items)==null?void 0:a.length)>((n=s==null?void 0:s.items)==null?void 0:n.length)&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){var e,s,a;console.debug("reached top"),await this.onGetTasks({createdAtMax:(a=(s=(e=this.tasks)==null?void 0:e.items)==null?void 0:s[0])==null?void 0:a.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(){ie.create({application:this.application}).then(({data:e})=>{this.application=e,T.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{var s,a;((a=(s=e==null?void 0:e.response)==null?void 0:s.data)==null?void 0:a.code)===le&&T.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:a,createdAtMax:n}=e||{};console.debug("limit",s,"createdAtMin",a,"createdAtMax",n),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:a,createdAtMax:n})},async onGeneratePicture(){var a;const e={...this.config,callback_url:Ds},s=(a=this.credential)==null?void 0:a.token;if(!s){console.error("no token specified");return}T.info(this.$t("headshots.message.startingTask")),re.generate(e,{token:s}).then(()=>{T.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(n=>{var f,d;const _=(f=n==null?void 0:n.response)==null?void 0:f.data;((d=_==null?void 0:_.error)==null?void 0:d.code)===ce?T.error(this.$t("headshots.message.usedUp")):T.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ms(e,s,a,n,_,f){const d=r("config-panel"),h=r("application-status"),i=r("recent-panel"),m=r("layout");return o(),D(m,null,{config:u(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:u(()=>[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]=v=>e.$store.dispatch("headshots/setApplication",v))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(i,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"]),g(' <operation-panel class="panel operation" @generate="onGenerate" /> ')]),_:1})}var Qs=w(Ls,[["render",Ms],["__scopeId","data-v-62da1b28"],["__file","/home/runner/work/Nexior/Nexior/src/pages/headshots/Index.vue"]]);export{Qs as default};