@acedatacloud/nexior 3.10.1 → 3.10.2

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 (105) hide show
  1. package/dist/assets/{Auth-jSvMpjb4.js → Auth-BFhQFJ0A.js} +1 -1
  2. package/dist/assets/{Callback-CEVS2M8r.js → Callback-CGs7YRIv.js} +1 -1
  3. package/dist/assets/{Console-mr73zWNb.js → Console-CGBM7HO0.js} +1 -1
  4. package/dist/assets/{Conversation-CiaNo-9W.js → Conversation-Cdpk9JCk.js} +3 -3
  5. package/dist/assets/{Conversation-DAMlEK1a.css → Conversation-DMA4LVfL.css} +1 -1
  6. package/dist/assets/{CopyToClipboard-CbDGPk1W.js → CopyToClipboard-D2htyZNn.js} +1 -1
  7. package/dist/assets/{Detail-Ld4O7tNh.js → Detail-D9V8CgK3.js} +1 -1
  8. package/dist/assets/{EditArray-3ZEeavsD.js → EditArray-yPRBKjaY.js} +1 -1
  9. package/dist/assets/{Extra-CZfasXIe.js → Extra-DchkFT5e.js} +1 -1
  10. package/dist/assets/{FilePreview-vlq_XV-D.js → FilePreview-DYmuYtjj.js} +1 -1
  11. package/dist/assets/{History-BIb4UQJr.js → History-B6mQUbGT.js} +1 -1
  12. package/dist/assets/{ImagePreview-J5TFPHp0.js → ImagePreview-D1wjODml.js} +1 -1
  13. package/dist/assets/{ImageWrapper-BkAorMoJ.js → ImageWrapper-DsFMhPbK.js} +1 -1
  14. package/dist/assets/{Index-DNLgbtpd.js → Index-BB9yYOOw.js} +1 -1
  15. package/dist/assets/{Index-DTZGa6eI.js → Index-BEeqdg9t.js} +1 -1
  16. package/dist/assets/{Index-Cn75tB64.js → Index-BpepEatG.js} +1 -1
  17. package/dist/assets/{Index-Dq0DDsYo.js → Index-Bvf-ZOSx.js} +1 -1
  18. package/dist/assets/{Index-CyEaY5Yv.js → Index-C8RaeqOV.js} +1 -1
  19. package/dist/assets/{Index-BP0YZcHP.js → Index-CHP04IN_.js} +1 -1
  20. package/dist/assets/{Index-DkLwhQIE.js → Index-CpzzOm99.js} +1 -1
  21. package/dist/assets/{Index-HEie3fqX.js → Index-DHLTaJ0G.js} +1 -1
  22. package/dist/assets/{Index-CKCKfswj.js → Index-DOm0_eHY.js} +1 -1
  23. package/dist/assets/{Index-CCQQRrfE.js → Index-DvECUQtT.js} +1 -1
  24. package/dist/assets/{Index-DNPVxk5M.js → Index-RHyXcjRi.js} +1 -1
  25. package/dist/assets/{Index-CqwqY2XV.js → Index-rUg5CSmA.js} +1 -1
  26. package/dist/assets/{InfoIcon-Bp3PCa7q.js → InfoIcon-RKUiJEyU.js} +1 -1
  27. package/dist/assets/{Invitees-ckOnmKkS.js → Invitees-yZrm79z_.js} +1 -1
  28. package/dist/assets/{List-ezNtwMQV.js → List-8LdtJTAq.js} +1 -1
  29. package/dist/assets/{List-B6NZ2Eb1.js → List-BYlWdYW3.js} +1 -1
  30. package/dist/assets/{List-BE7bHQp8.js → List-PyVNo9f5.js} +1 -1
  31. package/dist/assets/{Login-DbarHLjM.js → Login-CDOMG84R.js} +1 -1
  32. package/dist/assets/{Main-CaxP2jXs.js → Main-C3NyW5dP.js} +1 -1
  33. package/dist/assets/{Navigator-CGUkmElH.css → Navigator-C6jSlmBW.css} +1 -1
  34. package/dist/assets/{Navigator-CdQ1TwDK.js → Navigator-rInCSECJ.js} +1 -1
  35. package/dist/assets/{NoTasks-DSwwn54t.js → NoTasks-BHwoRteC.js} +1 -1
  36. package/dist/assets/{Pagination-_-YS3xST.js → Pagination-BejLuTbA.js} +1 -1
  37. package/dist/assets/{Status-qLzhy6rb.js → Status-c2SMGUwV.js} +1 -1
  38. package/dist/assets/{Subscribe-BEaImdK4.js → Subscribe-D-DuwEFM.js} +1 -1
  39. package/dist/assets/{VideoPlayer-sYWUwi2-.js → VideoPlayer-B5ne2Js3.js} +1 -1
  40. package/dist/assets/{_Uint8Array-B4stHTfJ.js → _Uint8Array-Bc9h99Pp.js} +1 -1
  41. package/dist/assets/{_baseClone-DzST50VS.js → _baseClone-IKSd45xI.js} +1 -1
  42. package/dist/assets/{_baseIteratee-C69L38OU.js → _baseIteratee-DP487BGW.js} +1 -1
  43. package/dist/assets/{_initCloneObject-DAkYYxGi.js → _initCloneObject-BNx7BLk2.js} +1 -1
  44. package/dist/assets/ar-D1hnTQ2h.js +1 -0
  45. package/dist/assets/{castArray-GZv0dEZk.js → castArray-DzRTAvuA.js} +1 -1
  46. package/dist/assets/de-BZu7ZZ9y.js +1 -0
  47. package/dist/assets/{debounce-CBdhoBC5.js → debounce-D60ZmlOv.js} +1 -1
  48. package/dist/assets/{distribution-DyV_VBv3.js → distribution-3_lYXD6w.js} +1 -1
  49. package/dist/assets/{dropdown-BHBH108X.js → dropdown-bG3kzlx5.js} +1 -1
  50. package/dist/assets/el-DJ93mLwP.js +1 -0
  51. package/dist/assets/es-Idilhmtq.js +1 -0
  52. package/dist/assets/fi-BhhlDzr_.js +1 -0
  53. package/dist/assets/fr-fyTGkfid.js +1 -0
  54. package/dist/assets/{index-sDnliYJA.js → index-B5bgPNGo.js} +1 -1
  55. package/dist/assets/{index-XD2GuHYw.js → index-BBE-XQrc.js} +1 -1
  56. package/dist/assets/{index-DvIFURTz.js → index-BCwZ77Ag.js} +1 -1
  57. package/dist/assets/{index-kZb-v3Ld.js → index-BFb947sB.js} +1 -1
  58. package/dist/assets/{index-CR4mcIzC.js → index-BMge8mVL.js} +1 -1
  59. package/dist/assets/{index-CZhPWUg-.js → index-BQlwC9yd.js} +1 -1
  60. package/dist/assets/{index-Dqv6_CwO.js → index-BTTB5TWv.js} +1 -1
  61. package/dist/assets/{index-CyhkbQD0.js → index-BUHKRI0n.js} +1 -1
  62. package/dist/assets/{index-CTABT0Pn.js → index-BXdRkkk2.js} +1 -1
  63. package/dist/assets/{index-Dw2bNzdp.js → index-BhikXZPL.js} +1 -1
  64. package/dist/assets/{index-D6STV0o9.js → index-BzhGdquP.js} +1 -1
  65. package/dist/assets/{index-hBSCekXm.js → index-C5KJUudH.js} +1 -1
  66. package/dist/assets/{index-CRB4t7HO.js → index-CU1KMaQL.js} +1 -1
  67. package/dist/assets/{index-CfU3ZKsc.js → index-CUDVH29L.js} +1 -1
  68. package/dist/assets/{index-DfnhNu7H.js → index-CeK-RMgJ.js} +34 -34
  69. package/dist/assets/{index-DVqp4AQh.js → index-CeeVBAJH.js} +1 -1
  70. package/dist/assets/{index-_V2QC6SE.js → index-D43UJFcD.js} +1 -1
  71. package/dist/assets/{index-7GdPtq95.js → index-DP3_T-tn.js} +1 -1
  72. package/dist/assets/index-DPJPrEgh.css +1 -0
  73. package/dist/assets/{index-CwMSdp80.js → index-DbIT_r8h.js} +1 -1
  74. package/dist/assets/{index-Dnxi0FQr.js → index-Dj6ZfA7Z.js} +1 -1
  75. package/dist/assets/{index-CudAAZZP.js → index-DrgJLZYQ.js} +1 -1
  76. package/dist/assets/{index-B75qfh9m.js → index-Dsyl3ppZ.js} +1 -1
  77. package/dist/assets/{index-DI0p88qt.js → index-DvveT6b7.js} +1 -1
  78. package/dist/assets/{index-B_scRkOY.js → index-HoJAUmIW.js} +1 -1
  79. package/dist/assets/{index-BfUUmnQr.js → index-XGvrZ-mR.js} +1 -1
  80. package/dist/assets/{index-JJATUo4M.js → index-aZMupG3d.js} +1 -1
  81. package/dist/assets/{index-Cs8tZiAz.js → index-mkn_LdcV.js} +1 -1
  82. package/dist/assets/{index-B280-_DG.js → index-o2ViPdS5.js} +1 -1
  83. package/dist/assets/{index-CGm0EtIv.js → index-zOLiNtWU.js} +1 -1
  84. package/dist/assets/{index.es-DrP2fGVw.js → index.es-CwLjz3IM.js} +1 -1
  85. package/dist/assets/{isEqual-ChOSIBb4.js → isEqual-B8kV_aQO.js} +1 -1
  86. package/dist/assets/{isPlainObject-BIeuM4iJ.js → isPlainObject-gBUjyWLa.js} +1 -1
  87. package/dist/assets/it-CLf6lrMi.js +1 -0
  88. package/dist/assets/ja-DFyNu3tl.js +1 -0
  89. package/dist/assets/ko-DUrUYy0R.js +1 -0
  90. package/dist/assets/{order-0ifK58k-.js → order-8kTN-1H1.js} +1 -1
  91. package/dist/assets/pl-By8ttK5W.js +1 -0
  92. package/dist/assets/{price-r1S14aus.js → price-Dk3oYtWm.js} +1 -1
  93. package/dist/assets/pt-iBE8V_rF.js +1 -0
  94. package/dist/assets/ru-a9O4dLvt.js +1 -0
  95. package/dist/assets/sr-BuqPpavQ.js +1 -0
  96. package/dist/assets/{strings-DD9aE7dM.js → strings-QdrzPdzB.js} +1 -1
  97. package/dist/assets/sv-CiSSmJ4h.js +1 -0
  98. package/dist/assets/{typescript-Cjvo67Qo.js → typescript-DjSc1HJs.js} +1 -1
  99. package/dist/assets/uk-Ci2KIGcW.js +1 -0
  100. package/dist/assets/{use-form-item-oBt_u5uH.js → use-form-item-CGOsSRSZ.js} +1 -1
  101. package/dist/assets/zh-cn-CnyULPxw.js +1 -0
  102. package/dist/assets/zh-tw-ZQmLUxJy.js +1 -0
  103. package/dist/index.html +3 -2
  104. package/package.json +1 -1
  105. package/dist/assets/index-K3dvW6KA.css +0 -1
@@ -1 +1 @@
1
- import{F as E}from"./index.es-DrP2fGVw.js";import{E as C}from"./index-CZhPWUg-.js";import{E as D}from"./index-B_scRkOY.js";import{d as h,h as $,b as i,t as a,k as t,r as T,j as _,l as n,o as r,ep as U,x as l,F as y,v as I,i as V,eq as P,D as f,y as k,n as S,er as F,dl as R,dh as L}from"./index-DfnhNu7H.js";import{E as j,a as M}from"./index-DvIFURTz.js";import{I as G}from"./InfoIcon-Bp3PCa7q.js";import{E as q,a as B}from"./index-CR4mcIzC.js";import{E as O}from"./index-CwMSdp80.js";import{C as N}from"./CopyToClipboard-CbDGPk1W.js";import{I as z}from"./ImageWrapper-BkAorMoJ.js";import{E as H}from"./index-DI0p88qt.js";import{E as X}from"./index-BfUUmnQr.js";import{N as K,B as W}from"./NoTasks-DSwwn54t.js";import{E as w}from"./index-sDnliYJA.js";import"./use-form-item-oBt_u5uH.js";import"./index-r5W6hzzQ.js";import"./index-B75qfh9m.js";import"./index-kZb-v3Ld.js";import"./typescript-Cjvo67Qo.js";import"./index-hBSCekXm.js";import"./strings-DD9aE7dM.js";import"./castArray-GZv0dEZk.js";import"./isEqual-ChOSIBb4.js";import"./_Uint8Array-B4stHTfJ.js";import"./debounce-CBdhoBC5.js";import"./_baseIteratee-C69L38OU.js";import"./index-Cs8tZiAz.js";import"./index-Dqv6_CwO.js";import"./index-XD2GuHYw.js";const J=h({name:"LayoutFlux",components:{ElDrawer:D,ElButton:C,FontAwesomeIcon:E},data(){return{drawer:!1}}}),Q={class:"main"},Y={class:"config"},Z={class:"result"};function ee(e,o,m,c,g,v){const d=n("font-awesome-icon"),p=n("el-button"),s=n("el-drawer");return r(),i("div",Q,[a("div",Y,[T(e.$slots,"config",{},void 0,!0)]),a("div",Z,[T(e.$slots,"result",{},void 0,!0)]),t(p,{round:"",class:"menu",onClick:o[0]||(o[0]=u=>e.drawer=!0)},{default:_(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(s,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=u=>e.drawer=u),"with-header":!1,size:"340px",class:"drawer"},{default:_(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const te=$(J,[["render",ee],["__scopeId","data-v-76342769"]]),oe=h({name:"ModelSelector",components:{ElSelect:M,ElOption:j},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"flux-schnell",label:"flux-schnell"},{value:"flux-dev",label:"flux-dev"},{value:"flux-pro",label:"flux-pro"},{value:"flux-pro-1.1",label:"flux-pro-1.1"},{value:"flux-pro-1.1-ultra",label:"flux-pro-1.1-ultra"},{value:"flux-kontext-pro",label:"flux-kontext-pro"},{value:"flux-kontext-max",label:"flux-kontext-max"}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||(this.value=U)}}),se={class:"field"},ne={class:"title font-bold"};function ae(e,o,m,c,g,v){const d=n("el-option"),p=n("el-select");return r(),i("div",se,[a("h2",ne,l(e.$t("flux.name.model")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=s=>e.value=s),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:_(()=>[(r(!0),i(y,null,I(e.options,s=>(r(),V(d,{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const le=$(oe,[["render",ae],["__scopeId","data-v-2e94cca6"]]),re=h({name:"CountSelector",components:{ElSlider:B,InfoIcon:G,ElInputNumber:q},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug("set count",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||(this.value=P)}}),ie={class:"flex justify-between"},ce={class:"flex justify-start items-center"},ue={class:"text-sm font-bold"},de={class:"flex justify-end items-center"},pe={class:"w-full"};function me(e,o,m,c,g,v){const d=n("info-icon"),p=n("el-input-number"),s=n("el-slider");return r(),i("div",null,[a("div",ie,[a("div",ce,[a("span",ue,l(e.$t("flux.name.numbers")),1),t(d,{content:e.$t("flux.description.numbers")},null,8,["content"])]),a("div",de,[t(p,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=u=>e.value=u),"controls-position":"right"},null,8,["modelValue"])])]),a("div",pe,[t(s,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=u=>e.value=u),min:1,max:4,step:1},null,8,["modelValue"])])])}const fe=$(re,[["render",me]]),_e="",he=h({name:"PromptInput",components:{ElInput:O,InfoIcon:G},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=_e)}}),$e={class:"field"},ge={class:"box"},ve={class:"title font-bold"};function be(e,o,m,c,g,v){const d=n("info-icon"),p=n("el-input");return r(),i("div",$e,[a("div",ge,[a("h2",ve,l(e.$t("flux.name.prompt")),1),t(d,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(p,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=s=>e.prompt=s),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ke=$(he,[["render",be],["__scopeId","data-v-4c101a17"]]),we=h({name:"PresetPanel",components:{ElButton:C,FontAwesomeIcon:E,PromptInput:ke,ModelSelector:le,CountSelector:fe},emits:["generate"],computed:{config(){return this.$store.state.flux?.config}},methods:{onGenerate(){this.$emit("generate")}}}),ye={class:"panel"},Ve={class:"config"},xe={class:"actions"};function Te(e,o,m,c,g,v){const d=n("prompt-input"),p=n("model-selector"),s=n("count-selector"),u=n("font-awesome-icon"),b=n("el-button");return r(),i("div",ye,[a("div",Ve,[t(d,{class:"mb-4"}),t(p,{class:"mb-4"}),t(s,{class:"mb-4"}),a("div",xe,[t(b,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:_(()=>[t(u,{icon:"fa-solid fa-magic",class:"mr-2"}),f(" "+l(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ee=$(we,[["render",Te],["__scopeId","data-v-534faaf3"]]),Ie=h({name:"TaskPreview",components:{ElImage:X,CopyToClipboard:N,FontAwesomeIcon:E,ElAlert:H,ImageWrapper:z},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(m=>{let c=m;o&&(c.action=o),e.push(c)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Se={class:"preview"},Ce={class:"left"},Ge={class:"main"},Ae={class:"bot"},De={class:"datetime"},Ue={class:"info"},Pe={key:0,class:"prompt mt-2"},Fe={key:0},Re={key:0,class:S({content:!0,failed:!0})},Le={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},je={class:"mb-2"},Me={class:"mb-2"},qe={key:1,class:S({content:!0})},Be={class:"mb-2"},Oe={class:"mb-4"},Ne={class:"mb-2"},ze={key:2,class:S({content:!0})},He={class:"mb-2"};function Xe(e,o,m,c,g,v){const d=n("el-image"),p=n("image-wrapper"),s=n("font-awesome-icon"),u=n("copy-to-clipboard"),b=n("el-alert");return r(),i("div",Se,[a("div",Ce,[t(d,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),a("div",Ge,[a("div",Ae,[f(l(e.$t("flux.name.fluxBot"))+" ",1),a("span",De,l(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Ue,[e.modelValue?.request?.prompt?(r(),i("p",Pe,[f(l(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?k("",!0):(r(),i("span",Fe," - ("+l(e.$t("flux.status.pending"))+") ",1))])):k("",!0)]),e.modelValue?.response?.success===!0?(r(),i("div",Re,[a("div",Le,[(r(!0),i(y,null,I(e.images,(x,A)=>(r(),V(p,{key:A,src:x?.image_url,"raw-src":x?.image_url,"model-value":x},null,8,["src","raw-src","model-value"]))),128))]),t(b,{closable:!1,class:"mt-2 success"},{default:_(()=>[a("p",je,[t(s,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.model"))+": "+l(e.modelValue?.request?.model),1)]),a("p",Me,[t(s,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):k("",!0),e.modelValue?.response?.success===!1?(r(),i("div",qe,[t(b,{closable:!1,class:"failure"},{template:_(()=>[t(s,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",Be,[t(s,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),a("p",Oe,[t(s,{icon:"fa-solid fa-circle-info",class:"mr-1"}),f(" "+l(e.$t("flux.name.failureReason"))+": "+l(e.modelValue?.response?.error?.message)+" ",1),t(u,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),a("p",Ne,[t(s,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.traceId"))+": "+l(e.modelValue?.response?.trace_id)+" ",1),t(u,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):k("",!0),e.modelValue?.response?k("",!0):(r(),i("div",ze,[t(b,{closable:!1,class:"info"},{template:_(()=>[t(s,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",He,[t(s,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const Ke=$(Ie,[["render",Xe],["__scopeId","data-v-8ed69b00"]]),We=h({name:"RecentPanel",components:{TaskPreview:Ke,BotPlaceholder:W,NoTasks:K},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Je={key:0},Qe={key:1,class:"tasks h-full w-full overflow-y-auto"},Ye={key:2};function Ze(e,o,m,c,g,v){const d=n("bot-placeholder"),p=n("task-preview"),s=n("no-tasks");return r(),i(y,null,[e.tasks?.items===void 0?(r(),i("div",Je,[t(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(r(),i("div",Qe,[(r(!0),i(y,null,I(e.tasks?.items,(u,b)=>(r(),V(p,{key:b,"model-value":u},null,8,["model-value"]))),128))])):k("",!0),e.tasks?.items?.length===0?(r(),i("div",Ye,[t(s)])):k("",!0)],64)}const et=$(We,[["render",Ze]]),tt="https://webhook.acedata.cloud/flux",ot=h({name:"FluxIndex",components:{ConfigPanel:Ee,Layout:te,RecentPanel:et},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===L.Request},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0}},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(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("flux/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("flux/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:c}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",c),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:m,createdAtMax:c})},async onGenerate(){const e={...this.config,callback_url:tt},o=this.credential?.token;if(!o){console.error("no token specified");return}w.info(this.$t("flux.message.startingTask")),F.generate(e,{token:o}).then(()=>{w.success(this.$t("flux.message.startTaskSuccess"))}).catch(m=>{const c=m?.response?.data;c?.error?.code===R?w.error(this.$t("flux.message.usedUp")):w.error(this.$t("flux.message.startTaskFailed")+c?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function st(e,o,m,c,g,v){const d=n("config-panel"),p=n("recent-panel"),s=n("layout");return r(),V(s,null,{config:_(()=>[t(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:_(()=>[t(p,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Dt=$(ot,[["render",st]]);export{Dt as default};
1
+ import{F as E}from"./index.es-CwLjz3IM.js";import{E as C}from"./index-BQlwC9yd.js";import{E as D}from"./index-HoJAUmIW.js";import{d as h,h as $,b as i,t as a,k as t,r as T,j as _,l as n,o as r,ep as U,x as l,F as y,v as I,i as V,eq as P,D as f,y as k,n as S,er as F,dl as R,dh as L}from"./index-CeK-RMgJ.js";import{E as j,a as M}from"./index-BCwZ77Ag.js";import{I as G}from"./InfoIcon-RKUiJEyU.js";import{E as q,a as B}from"./index-BMge8mVL.js";import{E as O}from"./index-DbIT_r8h.js";import{C as N}from"./CopyToClipboard-D2htyZNn.js";import{I as z}from"./ImageWrapper-DsFMhPbK.js";import{E as H}from"./index-DvveT6b7.js";import{E as X}from"./index-XGvrZ-mR.js";import{N as K,B as W}from"./NoTasks-BHwoRteC.js";import{E as w}from"./index-B5bgPNGo.js";import"./use-form-item-CGOsSRSZ.js";import"./index-r5W6hzzQ.js";import"./index-Dsyl3ppZ.js";import"./index-BFb947sB.js";import"./typescript-DjSc1HJs.js";import"./index-C5KJUudH.js";import"./strings-QdrzPdzB.js";import"./castArray-DzRTAvuA.js";import"./isEqual-B8kV_aQO.js";import"./_Uint8Array-Bc9h99Pp.js";import"./debounce-D60ZmlOv.js";import"./_baseIteratee-DP487BGW.js";import"./index-mkn_LdcV.js";import"./index-BTTB5TWv.js";import"./index-BBE-XQrc.js";const J=h({name:"LayoutFlux",components:{ElDrawer:D,ElButton:C,FontAwesomeIcon:E},data(){return{drawer:!1}}}),Q={class:"main"},Y={class:"config"},Z={class:"result"};function ee(e,o,m,c,g,v){const d=n("font-awesome-icon"),p=n("el-button"),s=n("el-drawer");return r(),i("div",Q,[a("div",Y,[T(e.$slots,"config",{},void 0,!0)]),a("div",Z,[T(e.$slots,"result",{},void 0,!0)]),t(p,{round:"",class:"menu",onClick:o[0]||(o[0]=u=>e.drawer=!0)},{default:_(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(s,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=u=>e.drawer=u),"with-header":!1,size:"340px",class:"drawer"},{default:_(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const te=$(J,[["render",ee],["__scopeId","data-v-76342769"]]),oe=h({name:"ModelSelector",components:{ElSelect:M,ElOption:j},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"flux-schnell",label:"flux-schnell"},{value:"flux-dev",label:"flux-dev"},{value:"flux-pro",label:"flux-pro"},{value:"flux-pro-1.1",label:"flux-pro-1.1"},{value:"flux-pro-1.1-ultra",label:"flux-pro-1.1-ultra"},{value:"flux-kontext-pro",label:"flux-kontext-pro"},{value:"flux-kontext-max",label:"flux-kontext-max"}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||(this.value=U)}}),se={class:"field"},ne={class:"title font-bold"};function ae(e,o,m,c,g,v){const d=n("el-option"),p=n("el-select");return r(),i("div",se,[a("h2",ne,l(e.$t("flux.name.model")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=s=>e.value=s),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:_(()=>[(r(!0),i(y,null,I(e.options,s=>(r(),V(d,{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const le=$(oe,[["render",ae],["__scopeId","data-v-2e94cca6"]]),re=h({name:"CountSelector",components:{ElSlider:B,InfoIcon:G,ElInputNumber:q},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug("set count",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||(this.value=P)}}),ie={class:"flex justify-between"},ce={class:"flex justify-start items-center"},ue={class:"text-sm font-bold"},de={class:"flex justify-end items-center"},pe={class:"w-full"};function me(e,o,m,c,g,v){const d=n("info-icon"),p=n("el-input-number"),s=n("el-slider");return r(),i("div",null,[a("div",ie,[a("div",ce,[a("span",ue,l(e.$t("flux.name.numbers")),1),t(d,{content:e.$t("flux.description.numbers")},null,8,["content"])]),a("div",de,[t(p,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=u=>e.value=u),"controls-position":"right"},null,8,["modelValue"])])]),a("div",pe,[t(s,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=u=>e.value=u),min:1,max:4,step:1},null,8,["modelValue"])])])}const fe=$(re,[["render",me]]),_e="",he=h({name:"PromptInput",components:{ElInput:O,InfoIcon:G},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=_e)}}),$e={class:"field"},ge={class:"box"},ve={class:"title font-bold"};function be(e,o,m,c,g,v){const d=n("info-icon"),p=n("el-input");return r(),i("div",$e,[a("div",ge,[a("h2",ve,l(e.$t("flux.name.prompt")),1),t(d,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(p,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=s=>e.prompt=s),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ke=$(he,[["render",be],["__scopeId","data-v-4c101a17"]]),we=h({name:"PresetPanel",components:{ElButton:C,FontAwesomeIcon:E,PromptInput:ke,ModelSelector:le,CountSelector:fe},emits:["generate"],computed:{config(){return this.$store.state.flux?.config}},methods:{onGenerate(){this.$emit("generate")}}}),ye={class:"panel"},Ve={class:"config"},xe={class:"actions"};function Te(e,o,m,c,g,v){const d=n("prompt-input"),p=n("model-selector"),s=n("count-selector"),u=n("font-awesome-icon"),b=n("el-button");return r(),i("div",ye,[a("div",Ve,[t(d,{class:"mb-4"}),t(p,{class:"mb-4"}),t(s,{class:"mb-4"}),a("div",xe,[t(b,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:_(()=>[t(u,{icon:"fa-solid fa-magic",class:"mr-2"}),f(" "+l(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ee=$(we,[["render",Te],["__scopeId","data-v-534faaf3"]]),Ie=h({name:"TaskPreview",components:{ElImage:X,CopyToClipboard:N,FontAwesomeIcon:E,ElAlert:H,ImageWrapper:z},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(m=>{let c=m;o&&(c.action=o),e.push(c)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Se={class:"preview"},Ce={class:"left"},Ge={class:"main"},Ae={class:"bot"},De={class:"datetime"},Ue={class:"info"},Pe={key:0,class:"prompt mt-2"},Fe={key:0},Re={key:0,class:S({content:!0,failed:!0})},Le={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},je={class:"mb-2"},Me={class:"mb-2"},qe={key:1,class:S({content:!0})},Be={class:"mb-2"},Oe={class:"mb-4"},Ne={class:"mb-2"},ze={key:2,class:S({content:!0})},He={class:"mb-2"};function Xe(e,o,m,c,g,v){const d=n("el-image"),p=n("image-wrapper"),s=n("font-awesome-icon"),u=n("copy-to-clipboard"),b=n("el-alert");return r(),i("div",Se,[a("div",Ce,[t(d,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),a("div",Ge,[a("div",Ae,[f(l(e.$t("flux.name.fluxBot"))+" ",1),a("span",De,l(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Ue,[e.modelValue?.request?.prompt?(r(),i("p",Pe,[f(l(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?k("",!0):(r(),i("span",Fe," - ("+l(e.$t("flux.status.pending"))+") ",1))])):k("",!0)]),e.modelValue?.response?.success===!0?(r(),i("div",Re,[a("div",Le,[(r(!0),i(y,null,I(e.images,(x,A)=>(r(),V(p,{key:A,src:x?.image_url,"raw-src":x?.image_url,"model-value":x},null,8,["src","raw-src","model-value"]))),128))]),t(b,{closable:!1,class:"mt-2 success"},{default:_(()=>[a("p",je,[t(s,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.model"))+": "+l(e.modelValue?.request?.model),1)]),a("p",Me,[t(s,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):k("",!0),e.modelValue?.response?.success===!1?(r(),i("div",qe,[t(b,{closable:!1,class:"failure"},{template:_(()=>[t(s,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",Be,[t(s,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),a("p",Oe,[t(s,{icon:"fa-solid fa-circle-info",class:"mr-1"}),f(" "+l(e.$t("flux.name.failureReason"))+": "+l(e.modelValue?.response?.error?.message)+" ",1),t(u,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),a("p",Ne,[t(s,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.traceId"))+": "+l(e.modelValue?.response?.trace_id)+" ",1),t(u,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):k("",!0),e.modelValue?.response?k("",!0):(r(),i("div",ze,[t(b,{closable:!1,class:"info"},{template:_(()=>[t(s,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",He,[t(s,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const Ke=$(Ie,[["render",Xe],["__scopeId","data-v-8ed69b00"]]),We=h({name:"RecentPanel",components:{TaskPreview:Ke,BotPlaceholder:W,NoTasks:K},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Je={key:0},Qe={key:1,class:"tasks h-full w-full overflow-y-auto"},Ye={key:2};function Ze(e,o,m,c,g,v){const d=n("bot-placeholder"),p=n("task-preview"),s=n("no-tasks");return r(),i(y,null,[e.tasks?.items===void 0?(r(),i("div",Je,[t(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(r(),i("div",Qe,[(r(!0),i(y,null,I(e.tasks?.items,(u,b)=>(r(),V(p,{key:b,"model-value":u},null,8,["model-value"]))),128))])):k("",!0),e.tasks?.items?.length===0?(r(),i("div",Ye,[t(s)])):k("",!0)],64)}const et=$(We,[["render",Ze]]),tt="https://webhook.acedata.cloud/flux",ot=h({name:"FluxIndex",components:{ConfigPanel:Ee,Layout:te,RecentPanel:et},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===L.Request},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0}},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(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("flux/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("flux/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:c}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",c),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:m,createdAtMax:c})},async onGenerate(){const e={...this.config,callback_url:tt},o=this.credential?.token;if(!o){console.error("no token specified");return}w.info(this.$t("flux.message.startingTask")),F.generate(e,{token:o}).then(()=>{w.success(this.$t("flux.message.startTaskSuccess"))}).catch(m=>{const c=m?.response?.data;c?.error?.code===R?w.error(this.$t("flux.message.usedUp")):w.error(this.$t("flux.message.startTaskFailed")+c?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function st(e,o,m,c,g,v){const d=n("config-panel"),p=n("recent-panel"),s=n("layout");return r(),V(s,null,{config:_(()=>[t(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:_(()=>[t(p,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Dt=$(ot,[["render",st]]);export{Dt as default};
@@ -1 +1 @@
1
- import{F as A}from"./index.es-DrP2fGVw.js";import{E as G}from"./index-CZhPWUg-.js";import{E as P}from"./index-B_scRkOY.js";import{d as $,h as v,b as l,t as c,k as t,r as E,j as p,l as i,o,c2 as D,x as n,D as _,F as w,v as I,i as V,n as T,c as L,y as g,eu as j,dl as O,d9 as z,dg as B,dh as C}from"./index-DfnhNu7H.js";import{I as M}from"./InfoIcon-Bp3PCa7q.js";import{E as q}from"./index-Dnxi0FQr.js";import{E as y}from"./index-sDnliYJA.js";import{a as F,E as N}from"./index-_V2QC6SE.js";import{E as U}from"./index-BfUUmnQr.js";import{E as H,a as J}from"./index-CyhkbQD0.js";import{A as K}from"./Status-qLzhy6rb.js";import{C as Q}from"./CopyToClipboard-CbDGPk1W.js";import{E as W}from"./index-DI0p88qt.js";import{a as X,E as Y}from"./index-XD2GuHYw.js";import"./use-form-item-oBt_u5uH.js";import"./index-r5W6hzzQ.js";import"./index-B75qfh9m.js";import"./index-kZb-v3Ld.js";import"./typescript-Cjvo67Qo.js";import"./index-D6STV0o9.js";import"./_baseClone-DzST50VS.js";import"./_Uint8Array-B4stHTfJ.js";import"./_initCloneObject-DAkYYxGi.js";import"./isEqual-ChOSIBb4.js";import"./debounce-CBdhoBC5.js";import"./index-Dqv6_CwO.js";import"./strings-DD9aE7dM.js";import"./isPlainObject-BIeuM4iJ.js";const Z=$({name:"LayoutHeadshots",components:{ElDrawer:P,ElButton:G,FontAwesomeIcon:A},data(){return{drawer:!1}}}),x={class:"main"},ee={class:"config"},te={class:"result"};function se(e,s,m,h,b,k){const d=i("font-awesome-icon"),u=i("el-button"),a=i("el-drawer");return o(),l("div",x,[c("div",ee,[E(e.$slots,"config",{},void 0,!0)]),c("div",te,[E(e.$slots,"result",{},void 0,!0)]),t(u,{round:"",class:"menu",onClick:s[0]||(s[0]=r=>e.drawer=!0)},{default:p(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=r=>e.drawer=r),"with-header":!1,size:"340px",class:"drawer"},{default:p(()=>[E(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const oe=v(Z,[["render",se],["__scopeId","data-v-38abce67"]]),ae=$({name:"ImageUrlsInput",components:{ElUpload:q,ElButton:G,InfoIcon:M},data(){return{fileList:[],uploadUrl:D()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){y.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){y.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),ne={class:"field"},ie={class:"title font-bold"},le={class:"upload-wrapper"};function re(e,s,m,h,b,k){const d=i("el-button"),u=i("el-upload"),a=i("info-icon");return o(),l("div",ne,[c("h2",ie,n(e.$t("headshots.name.endImageUrls")),1),c("div",le,[t(u,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=r=>e.fileList=r),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:2,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:p(()=>[t(d,{size:"small",type:"primary",round:""},{default:p(()=>[_(n(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(a,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const ce=v(ae,[["render",re],["__scopeId","data-v-a6bd8c31"]]),de="fast",pe=$({name:"ModeSelector",components:{ElRadioButton:N,ElRadioGroup:F},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=de)}}),me={class:"field"},he={class:"title font-bold"};function ue(e,s,m,h,b,k){const d=i("el-radio-button"),u=i("el-radio-group");return o(),l("div",me,[c("h2",he,n(e.$t("headshots.name.mode")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),size:"small",class:"mode"},{default:p(()=>[(o(!0),l(w,null,I(e.options,a=>(o(),V(d,{key:a.value,label:a.value},{default:p(()=>[_(n(a.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const _e=v(pe,[["render",ue],["__scopeId","data-v-a2a0d5fa"]]),fe=$({name:"StylizeSelector",components:{ElTabs:J,ElTabPane:H,ElImage:U},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){console.debug("set template",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})}}}),ge={class:"field"},$e=["onClick"],ve={class:"name"};function be(e,s,m,h,b,k){const d=i("el-image"),u=i("el-tab-pane"),a=i("el-tabs");return o(),l("div",ge,[t(a,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=r=>e.tab=r)},{default:p(()=>[(o(!0),l(w,null,I(e.elements,(r,f)=>(o(),V(u,{key:f,label:r.displayName,name:f,class:"pane"},{default:p(()=>[(o(!0),l(w,null,I(r.items,(S,R)=>(o(),l("div",{key:R,class:T({item:!0,active:e.value===S.value}),onClick:ut=>e.onToggle(S.value)},[t(d,{src:S.image,fit:"fill",class:"preview"},null,8,["src"]),c("span",ve,n(S.label),1)],10,$e))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const ke=v(fe,[["render",be],["__scopeId","data-v-be4bd25d"]]),ye=$({name:"PresetPanel",components:{ModeSelector:_e,ImageUrlsInput:ce,ElButton:G,FontAwesomeIcon:A,ElementsSelector:ke},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),we={class:"panel"},Ie={class:"config"},Te={class:"actions"};function Se(e,s,m,h,b,k){const d=i("elements-selector"),u=i("mode-selector"),a=i("image-urls-input"),r=i("font-awesome-icon"),f=i("el-button");return o(),l("div",we,[c("div",Ie,[t(d,{class:"mb-4"}),t(u,{class:"mb-4"}),t(a,{class:"mb-4"}),c("div",Te,[t(f,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(r,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+n(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ve=v(ye,[["render",Se],["__scopeId","data-v-78172a54"]]),Ee=$({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:L(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:h=>{window.open(h,"_blank")}}}}),Ce={class:"image-gallery"},Ae=["src"],Ge=["onClick"];function Ue(e,s,m,h,b,k){return o(),l("div",Ce,[(o(!0),l(w,null,I(e.images,(d,u)=>(o(),l("div",{key:u,class:"image-container"},[c("img",{src:d.image_url,alt:"Image"},null,8,Ae),d.image_url?(o(),l("button",{key:0,class:"view-button",onClick:a=>e.viewImage(d.image_url)},n(e.$t("headshots.button.viewImage")),9,Ge)):g("",!0)]))),128))])}const Re=v(Ee,[["render",Ue],["__scopeId","data-v-03641510"]]),Pe=$({name:"TaskPreview",components:{ElImage:U,CopyToClipboard:Q,FontAwesomeIcon:A,ElAlert:W,ImageGallery:Re},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,m=new URL(s.src),h=m.searchParams.get("retry");if(!h)m.searchParams.set("retry","1");else if(parseInt(h)<2)m.searchParams.set("retry",(parseInt(h)+1).toString());else return;s.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),De={class:"preview"},Le={class:"left"},je={class:"main"},Oe={class:"bot"},ze={class:"datetime"},Be={class:"info"},Me={key:0,class:"prompt mt-2"},qe={key:0},Fe={key:1},Ne={key:0,class:T({content:!0,failed:!0})},He={class:"image-wrapper"},Je={class:"description"},Ke={key:1,class:T({content:!0})},Qe={class:"description"},We={class:"description"},Xe={class:"description"},Ye={key:2,class:T({content:!0})},Ze={class:"description"},xe={key:3,class:T({content:!0})},et={class:"description"};function tt(e,s,m,h,b,k){const d=i("el-image"),u=i("image-gallery"),a=i("font-awesome-icon"),r=i("copy-to-clipboard"),f=i("el-alert");return o(),l("div",De,[c("div",Le,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),c("div",je,[c("div",Oe,[_(n(e.$t("headshots.name.headshotsBot"))+" ",1),c("span",ze,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",Be,[e.modelValue?.request?.template?(o(),l("p",Me,[_(n(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?g("",!0):(o(),l("span",qe," - ("+n(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(o(),l("span",Fe," - ("+n(e.$t("headshots.status.processing"))+") ",1)):g("",!0)])):g("",!0)]),e.modelValue?.response?.success===!0?(o(),l("div",Ne,[c("div",He,[t(u,{"model-value":e.modelValue},null,8,["model-value"])]),t(f,{closable:!1,class:"mt-2 success"},{default:p(()=>[c("p",Je,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?.success===!1?(o(),l("div",Ke,[t(f,{closable:!1,class:"failure"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Qe,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),c("p",We,[t(a,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t(r,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),c("p",Xe,[t(a,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("headshots.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t(r,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?g("",!0):(o(),l("div",Ye,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Ze,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(o(),l("div",xe,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",et,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0)])])}const st=v(Pe,[["render",tt],["__scopeId","data-v-8eb9dee0"]]),ot=$({name:"RecentPanel",components:{TaskPreview:st,ElSkeleton:Y,ElSkeletonItem:X},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),at={key:0,class:"tasks"},nt={class:"left"},it={class:"main"},lt={key:1,class:"tasks"},rt={key:2,class:"description"};function ct(e,s,m,h,b,k){const d=i("el-skeleton-item"),u=i("el-skeleton"),a=i("task-preview");return o(),l("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...r)=>e.onHandleScroll&&e.onHandleScroll(...r))},[e.tasks?.items===void 0?(o(),l("div",at,[(o(),l(w,null,I(3,r=>c("div",{key:r,class:"task placeholder"},[c("div",nt,[t(u,{animated:""},{template:p(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),c("div",it,[t(u,{animated:""},{template:p(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(o(),l("div",lt,[(o(!0),l(w,null,I(e.tasks?.items,(r,f)=>(o(),V(a,{key:f,"model-value":r,class:"preview"},null,8,["model-value"]))),128))])):g("",!0),e.tasks?.items?.length===0?(o(),l("p",rt,n(e.$t("headshots.message.noTasks")),1)):g("",!0)],544)}const dt=v(ot,[["render",ct],["__scopeId","data-v-d79bcb1f"]]),pt="https://webhook.acedata.cloud/headshots",mt=$({name:"HeadshotsIndex",components:{ConfigPanel:Ve,Layout:oe,ApplicationStatus:K,RecentPanel:dt},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.headshots?.status?.getApplications===C.Request},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===C.Request},needApply(){return this.$store.state.headshots.status.getApplications===C.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){z.create({application:this.application}).then(({data:e})=>{this.application=e,y.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===B&&y.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:h}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",h),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:m,createdAtMax:h})},async onGeneratePicture(){const e={...this.config,callback_url:pt},s=this.credential?.token;if(!s){console.error("no token specified");return}y.info(this.$t("headshots.message.startingTask")),j.generate(e,{token:s}).then(()=>{y.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===O?y.error(this.$t("headshots.message.usedUp")):y.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ht(e,s,m,h,b,k){const d=i("config-panel"),u=i("application-status"),a=i("recent-panel"),r=i("layout");return o(),V(r,null,{config:p(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:p(()=>[t(u,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:s[0]||(s[0]=f=>e.$store.dispatch("headshots/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(a,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Ft=v(mt,[["render",ht],["__scopeId","data-v-7db61db3"]]);export{Ft as default};
1
+ import{F as A}from"./index.es-CwLjz3IM.js";import{E as G}from"./index-BQlwC9yd.js";import{E as P}from"./index-HoJAUmIW.js";import{d as $,h as v,b as l,t as c,k as t,r as E,j as p,l as i,o,c2 as D,x as n,D as _,F as w,v as I,i as V,n as T,c as L,y as g,eu as j,dl as O,d9 as z,dg as B,dh as C}from"./index-CeK-RMgJ.js";import{I as M}from"./InfoIcon-RKUiJEyU.js";import{E as q}from"./index-Dj6ZfA7Z.js";import{E as y}from"./index-B5bgPNGo.js";import{a as F,E as N}from"./index-D43UJFcD.js";import{E as U}from"./index-XGvrZ-mR.js";import{E as H,a as J}from"./index-BUHKRI0n.js";import{A as K}from"./Status-c2SMGUwV.js";import{C as Q}from"./CopyToClipboard-D2htyZNn.js";import{E as W}from"./index-DvveT6b7.js";import{a as X,E as Y}from"./index-BBE-XQrc.js";import"./use-form-item-CGOsSRSZ.js";import"./index-r5W6hzzQ.js";import"./index-Dsyl3ppZ.js";import"./index-BFb947sB.js";import"./typescript-DjSc1HJs.js";import"./index-BzhGdquP.js";import"./_baseClone-IKSd45xI.js";import"./_Uint8Array-Bc9h99Pp.js";import"./_initCloneObject-BNx7BLk2.js";import"./isEqual-B8kV_aQO.js";import"./debounce-D60ZmlOv.js";import"./index-BTTB5TWv.js";import"./strings-QdrzPdzB.js";import"./isPlainObject-gBUjyWLa.js";const Z=$({name:"LayoutHeadshots",components:{ElDrawer:P,ElButton:G,FontAwesomeIcon:A},data(){return{drawer:!1}}}),x={class:"main"},ee={class:"config"},te={class:"result"};function se(e,s,m,h,b,k){const d=i("font-awesome-icon"),u=i("el-button"),a=i("el-drawer");return o(),l("div",x,[c("div",ee,[E(e.$slots,"config",{},void 0,!0)]),c("div",te,[E(e.$slots,"result",{},void 0,!0)]),t(u,{round:"",class:"menu",onClick:s[0]||(s[0]=r=>e.drawer=!0)},{default:p(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=r=>e.drawer=r),"with-header":!1,size:"340px",class:"drawer"},{default:p(()=>[E(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const oe=v(Z,[["render",se],["__scopeId","data-v-38abce67"]]),ae=$({name:"ImageUrlsInput",components:{ElUpload:q,ElButton:G,InfoIcon:M},data(){return{fileList:[],uploadUrl:D()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){y.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){y.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),ne={class:"field"},ie={class:"title font-bold"},le={class:"upload-wrapper"};function re(e,s,m,h,b,k){const d=i("el-button"),u=i("el-upload"),a=i("info-icon");return o(),l("div",ne,[c("h2",ie,n(e.$t("headshots.name.endImageUrls")),1),c("div",le,[t(u,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=r=>e.fileList=r),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:2,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:p(()=>[t(d,{size:"small",type:"primary",round:""},{default:p(()=>[_(n(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(a,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const ce=v(ae,[["render",re],["__scopeId","data-v-a6bd8c31"]]),de="fast",pe=$({name:"ModeSelector",components:{ElRadioButton:N,ElRadioGroup:F},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=de)}}),me={class:"field"},he={class:"title font-bold"};function ue(e,s,m,h,b,k){const d=i("el-radio-button"),u=i("el-radio-group");return o(),l("div",me,[c("h2",he,n(e.$t("headshots.name.mode")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),size:"small",class:"mode"},{default:p(()=>[(o(!0),l(w,null,I(e.options,a=>(o(),V(d,{key:a.value,label:a.value},{default:p(()=>[_(n(a.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const _e=v(pe,[["render",ue],["__scopeId","data-v-a2a0d5fa"]]),fe=$({name:"StylizeSelector",components:{ElTabs:J,ElTabPane:H,ElImage:U},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){console.debug("set template",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})}}}),ge={class:"field"},$e=["onClick"],ve={class:"name"};function be(e,s,m,h,b,k){const d=i("el-image"),u=i("el-tab-pane"),a=i("el-tabs");return o(),l("div",ge,[t(a,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=r=>e.tab=r)},{default:p(()=>[(o(!0),l(w,null,I(e.elements,(r,f)=>(o(),V(u,{key:f,label:r.displayName,name:f,class:"pane"},{default:p(()=>[(o(!0),l(w,null,I(r.items,(S,R)=>(o(),l("div",{key:R,class:T({item:!0,active:e.value===S.value}),onClick:ut=>e.onToggle(S.value)},[t(d,{src:S.image,fit:"fill",class:"preview"},null,8,["src"]),c("span",ve,n(S.label),1)],10,$e))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const ke=v(fe,[["render",be],["__scopeId","data-v-be4bd25d"]]),ye=$({name:"PresetPanel",components:{ModeSelector:_e,ImageUrlsInput:ce,ElButton:G,FontAwesomeIcon:A,ElementsSelector:ke},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),we={class:"panel"},Ie={class:"config"},Te={class:"actions"};function Se(e,s,m,h,b,k){const d=i("elements-selector"),u=i("mode-selector"),a=i("image-urls-input"),r=i("font-awesome-icon"),f=i("el-button");return o(),l("div",we,[c("div",Ie,[t(d,{class:"mb-4"}),t(u,{class:"mb-4"}),t(a,{class:"mb-4"}),c("div",Te,[t(f,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(r,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+n(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ve=v(ye,[["render",Se],["__scopeId","data-v-78172a54"]]),Ee=$({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:L(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:h=>{window.open(h,"_blank")}}}}),Ce={class:"image-gallery"},Ae=["src"],Ge=["onClick"];function Ue(e,s,m,h,b,k){return o(),l("div",Ce,[(o(!0),l(w,null,I(e.images,(d,u)=>(o(),l("div",{key:u,class:"image-container"},[c("img",{src:d.image_url,alt:"Image"},null,8,Ae),d.image_url?(o(),l("button",{key:0,class:"view-button",onClick:a=>e.viewImage(d.image_url)},n(e.$t("headshots.button.viewImage")),9,Ge)):g("",!0)]))),128))])}const Re=v(Ee,[["render",Ue],["__scopeId","data-v-03641510"]]),Pe=$({name:"TaskPreview",components:{ElImage:U,CopyToClipboard:Q,FontAwesomeIcon:A,ElAlert:W,ImageGallery:Re},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,m=new URL(s.src),h=m.searchParams.get("retry");if(!h)m.searchParams.set("retry","1");else if(parseInt(h)<2)m.searchParams.set("retry",(parseInt(h)+1).toString());else return;s.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),De={class:"preview"},Le={class:"left"},je={class:"main"},Oe={class:"bot"},ze={class:"datetime"},Be={class:"info"},Me={key:0,class:"prompt mt-2"},qe={key:0},Fe={key:1},Ne={key:0,class:T({content:!0,failed:!0})},He={class:"image-wrapper"},Je={class:"description"},Ke={key:1,class:T({content:!0})},Qe={class:"description"},We={class:"description"},Xe={class:"description"},Ye={key:2,class:T({content:!0})},Ze={class:"description"},xe={key:3,class:T({content:!0})},et={class:"description"};function tt(e,s,m,h,b,k){const d=i("el-image"),u=i("image-gallery"),a=i("font-awesome-icon"),r=i("copy-to-clipboard"),f=i("el-alert");return o(),l("div",De,[c("div",Le,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),c("div",je,[c("div",Oe,[_(n(e.$t("headshots.name.headshotsBot"))+" ",1),c("span",ze,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",Be,[e.modelValue?.request?.template?(o(),l("p",Me,[_(n(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?g("",!0):(o(),l("span",qe," - ("+n(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(o(),l("span",Fe," - ("+n(e.$t("headshots.status.processing"))+") ",1)):g("",!0)])):g("",!0)]),e.modelValue?.response?.success===!0?(o(),l("div",Ne,[c("div",He,[t(u,{"model-value":e.modelValue},null,8,["model-value"])]),t(f,{closable:!1,class:"mt-2 success"},{default:p(()=>[c("p",Je,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?.success===!1?(o(),l("div",Ke,[t(f,{closable:!1,class:"failure"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Qe,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),c("p",We,[t(a,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t(r,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),c("p",Xe,[t(a,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("headshots.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t(r,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?g("",!0):(o(),l("div",Ye,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Ze,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(o(),l("div",xe,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",et,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0)])])}const st=v(Pe,[["render",tt],["__scopeId","data-v-8eb9dee0"]]),ot=$({name:"RecentPanel",components:{TaskPreview:st,ElSkeleton:Y,ElSkeletonItem:X},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),at={key:0,class:"tasks"},nt={class:"left"},it={class:"main"},lt={key:1,class:"tasks"},rt={key:2,class:"description"};function ct(e,s,m,h,b,k){const d=i("el-skeleton-item"),u=i("el-skeleton"),a=i("task-preview");return o(),l("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...r)=>e.onHandleScroll&&e.onHandleScroll(...r))},[e.tasks?.items===void 0?(o(),l("div",at,[(o(),l(w,null,I(3,r=>c("div",{key:r,class:"task placeholder"},[c("div",nt,[t(u,{animated:""},{template:p(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),c("div",it,[t(u,{animated:""},{template:p(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(o(),l("div",lt,[(o(!0),l(w,null,I(e.tasks?.items,(r,f)=>(o(),V(a,{key:f,"model-value":r,class:"preview"},null,8,["model-value"]))),128))])):g("",!0),e.tasks?.items?.length===0?(o(),l("p",rt,n(e.$t("headshots.message.noTasks")),1)):g("",!0)],544)}const dt=v(ot,[["render",ct],["__scopeId","data-v-d79bcb1f"]]),pt="https://webhook.acedata.cloud/headshots",mt=$({name:"HeadshotsIndex",components:{ConfigPanel:Ve,Layout:oe,ApplicationStatus:K,RecentPanel:dt},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.headshots?.status?.getApplications===C.Request},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===C.Request},needApply(){return this.$store.state.headshots.status.getApplications===C.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){z.create({application:this.application}).then(({data:e})=>{this.application=e,y.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===B&&y.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:h}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",h),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:m,createdAtMax:h})},async onGeneratePicture(){const e={...this.config,callback_url:pt},s=this.credential?.token;if(!s){console.error("no token specified");return}y.info(this.$t("headshots.message.startingTask")),j.generate(e,{token:s}).then(()=>{y.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===O?y.error(this.$t("headshots.message.usedUp")):y.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ht(e,s,m,h,b,k){const d=i("config-panel"),u=i("application-status"),a=i("recent-panel"),r=i("layout");return o(),V(r,null,{config:p(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:p(()=>[t(u,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:s[0]||(s[0]=f=>e.$store.dispatch("headshots/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(a,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Ft=v(mt,[["render",ht],["__scopeId","data-v-7db61db3"]]);export{Ft as default};
@@ -1 +1 @@
1
- import{d as g,L as A,S as v,h as k,i as f,j as i,k as s,y as _,l as t,D as $,x as p,t as o,o as r,R as O,eD as S,m as N,p as T,q as L,eE as D,c2 as R,b as h,f as U,F as P,v as B,n as q}from"./index-DfnhNu7H.js";import{F as w}from"./index.es-DrP2fGVw.js";import{E as F,a as V}from"./index-7GdPtq95.js";import{E as j}from"./index-B280-_DG.js";import{E as b}from"./index-BfUUmnQr.js";import"./typescript-Cjvo67Qo.js";import"./index-B75qfh9m.js";import"./index-kZb-v3Ld.js";import"./index-r5W6hzzQ.js";import"./index-Cs8tZiAz.js";import"./dropdown-BHBH108X.js";import"./debounce-CBdhoBC5.js";import"./index-Dqv6_CwO.js";const H=g({name:"HelpEntry",components:{ElImage:b,ElDialog:A,ElPopover:j,ElMenu:V,ElMenuItem:F,FontAwesomeIcon:w},props:{visible:{type:Boolean,default:!0}},emits:["close"],computed:{site(){return this.$store.state.site}},methods:{onJoin(){window.open(this.$store.state.site?.features?.support?.discord?.url,"_blank")},onProfit(){this.$router.push({name:v})}}}),M={class:"flex"},X={class:"flex-1 text-center"};function z(e,n,E,y,I,x){const c=t("font-awesome-icon"),l=t("el-menu-item"),d=t("el-image"),m=t("el-popover"),a=t("el-menu"),u=t("el-dialog");return r(),f(u,{"model-value":e.visible,width:200,class:"text-center",onClose:n[0]||(n[0]=C=>e.$emit("close"))},{default:i(()=>[s(a,{collapse:!1,class:"menu"},{default:i(()=>[e.site?.features?.support?.discord?.enabled?(r(),f(l,{key:0,index:"1",onClick:e.onJoin},{title:i(()=>[$(p(e.$t("common.message.joinDiscord")),1)]),default:i(()=>[s(c,{icon:"fa-brands fa-discord",class:"mr-2"})]),_:1},8,["onClick"])):_("",!0),s(m,{width:350,trigger:"hover"},{reference:i(()=>[e.site?.features?.support?.wechat?.enabled?(r(),f(l,{key:0,index:"2"},{title:i(()=>[$(p(e.$t("common.message.addWeChat")),1)]),default:i(()=>[s(c,{icon:"fa-brands fa-weixin",class:"mr-2"})]),_:1})):_("",!0)]),default:i(()=>[o("div",M,[o("div",X,[s(d,{src:e.site?.features?.support?.wechat?.qr},null,8,["src"])])])]),_:1})]),_:1})]),_:1},8,["model-value"])}const J=k(H,[["render",z],["__scopeId","data-v-0fce633f"]]),G=g({name:"ProfileIndex",components:{ElImage:b,HelpDialog:J,FontAwesomeIcon:w},data(){return{operating:{locale:!1,dark:!1,help:!1}}},computed:{user(){return this.$store.getters.user},showSupport(){return this.$store?.state?.site?.features?.support?.enabled&&(this.$store?.state?.site?.features?.support?.discord?.enabled||this.$store?.state?.site?.features?.support?.wechat?.enabled)},showSite(){return this.$store?.state?.site?.admins?.includes(this.$store.getters.user?.id)},links(){return[{key:"profile",text:this.$t("console.menu.userProfile"),href:`${S()}/user/profile`,icon:"fa-regular fa-user"},{key:"application-list",text:this.$t("console.menu.applicationList"),name:N,icon:"fa-solid fa-cube"},{key:"order-list",text:this.$t("console.menu.orderList"),name:T,icon:"fa-solid fa-store"},{key:"usage-list",text:this.$t("console.menu.usageList"),name:L,icon:"fa-solid fa-rotate-left"},{key:"distribution-index",text:this.$t("console.menu.distributionIndex"),name:v,icon:"fa-solid fa-coins"},...this.showSite?[{key:"site-index",text:this.$t("common.nav.site"),name:D,icon:"fa-solid fa-gear"}]:[],{key:"dark-setting",text:this.$t("common.nav.darkMode"),icon:"fa-solid fa-moon",callback:()=>{this.operating.dark=!0}},{key:"locale-setting",text:this.$t("common.nav.locale"),icon:"fa-solid fa-language",callback:()=>{this.operating.locale=!0}},{key:"developerPlatform",text:this.$t("console.menu.developerPlatform"),href:R(),icon:"fa-solid fa-laptop-code"},...this.showSupport?[{key:"support",text:this.$t("common.nav.support"),callback:()=>{this.operating.help=!0},icon:"fa-solid fa-question"}]:[],{key:"logout",text:this.$t("common.nav.logOut"),icon:"fa-solid fa-arrow-right-from-bracket",callback:async()=>{await this.$store.dispatch("resetAll"),await this.$store.dispatch("chat/resetAll"),await this.$store.dispatch("midjourney/resetAll"),await this.$store.dispatch("qrart/resetAll"),await this.$store.dispatch("flux/resetAll"),await this.$store.dispatch("hailuo/resetAll"),await this.$store.dispatch("headshots/resetAll"),await this.$store.dispatch("kling/resetAll"),await this.$store.dispatch("luma/resetAll"),await this.$store.dispatch("pika/resetAll"),await this.$store.dispatch("suno/resetAll"),await this.$store.dispatch("login")}}]}},methods:{onHome(){this.$router.push({name:O})},onNavigate(e){e.name?this.$router.push({name:e.name}):e.href?window.open(e.href,"_blank"):e.callback&&e.callback()}}}),W={class:"profile"},K={class:"info"},Q={class:"links"},Y=["onClick"],Z={class:"icon"},ee={class:"text"},te={class:"suffix"};function se(e,n,E,y,I,x){const c=t("el-image"),l=t("font-awesome-icon"),d=t("locale-selector"),m=t("help-dialog");return r(),h("div",W,[o("div",K,[s(c,{src:e.user.avatar,fit:"cover",class:"avatar"},null,8,["src"]),o("h2",null,p(e.user.username),1),o("div",{style:U({backgroundImage:"url("+e.user.avatar+")"}),class:"background"},null,4)]),o("div",Q,[(r(!0),h(P,null,B(e.links,(a,u)=>(r(),h("a",{key:u,class:q({link:!0,active:e.$route.name===a.name}),onClick:C=>e.onNavigate(a)},[o("span",Z,[s(l,{icon:a.icon,class:"text-sm"},null,8,["icon"])]),o("span",ee,p(a.text),1),o("span",te,[s(l,{icon:"fa-solid fa-chevron-right",class:"text-sm"})])],10,Y))),128))]),s(d,{visible:e.operating.locale==!0,onClose:n[0]||(n[0]=a=>e.operating.locale=!1)},null,8,["visible"]),s(m,{visible:e.operating.help==!0,onClose:n[1]||(n[1]=a=>e.operating.help=!1)},null,8,["visible"])])}const _e=k(G,[["render",se],["__scopeId","data-v-54290de4"]]);export{_e as default};
1
+ import{d as g,L as A,S as v,h as k,i as f,j as i,k as s,y as _,l as t,D as $,x as p,t as o,o as r,R as O,eD as S,m as N,p as T,q as L,eE as D,c2 as R,b as h,f as U,F as P,v as B,n as q}from"./index-CeK-RMgJ.js";import{F as w}from"./index.es-CwLjz3IM.js";import{E as F,a as V}from"./index-DP3_T-tn.js";import{E as j}from"./index-o2ViPdS5.js";import{E as b}from"./index-XGvrZ-mR.js";import"./typescript-DjSc1HJs.js";import"./index-Dsyl3ppZ.js";import"./index-BFb947sB.js";import"./index-r5W6hzzQ.js";import"./index-mkn_LdcV.js";import"./dropdown-bG3kzlx5.js";import"./debounce-D60ZmlOv.js";import"./index-BTTB5TWv.js";const H=g({name:"HelpEntry",components:{ElImage:b,ElDialog:A,ElPopover:j,ElMenu:V,ElMenuItem:F,FontAwesomeIcon:w},props:{visible:{type:Boolean,default:!0}},emits:["close"],computed:{site(){return this.$store.state.site}},methods:{onJoin(){window.open(this.$store.state.site?.features?.support?.discord?.url,"_blank")},onProfit(){this.$router.push({name:v})}}}),M={class:"flex"},X={class:"flex-1 text-center"};function z(e,n,E,y,I,x){const c=t("font-awesome-icon"),l=t("el-menu-item"),d=t("el-image"),m=t("el-popover"),a=t("el-menu"),u=t("el-dialog");return r(),f(u,{"model-value":e.visible,width:200,class:"text-center",onClose:n[0]||(n[0]=C=>e.$emit("close"))},{default:i(()=>[s(a,{collapse:!1,class:"menu"},{default:i(()=>[e.site?.features?.support?.discord?.enabled?(r(),f(l,{key:0,index:"1",onClick:e.onJoin},{title:i(()=>[$(p(e.$t("common.message.joinDiscord")),1)]),default:i(()=>[s(c,{icon:"fa-brands fa-discord",class:"mr-2"})]),_:1},8,["onClick"])):_("",!0),s(m,{width:350,trigger:"hover"},{reference:i(()=>[e.site?.features?.support?.wechat?.enabled?(r(),f(l,{key:0,index:"2"},{title:i(()=>[$(p(e.$t("common.message.addWeChat")),1)]),default:i(()=>[s(c,{icon:"fa-brands fa-weixin",class:"mr-2"})]),_:1})):_("",!0)]),default:i(()=>[o("div",M,[o("div",X,[s(d,{src:e.site?.features?.support?.wechat?.qr},null,8,["src"])])])]),_:1})]),_:1})]),_:1},8,["model-value"])}const J=k(H,[["render",z],["__scopeId","data-v-0fce633f"]]),G=g({name:"ProfileIndex",components:{ElImage:b,HelpDialog:J,FontAwesomeIcon:w},data(){return{operating:{locale:!1,dark:!1,help:!1}}},computed:{user(){return this.$store.getters.user},showSupport(){return this.$store?.state?.site?.features?.support?.enabled&&(this.$store?.state?.site?.features?.support?.discord?.enabled||this.$store?.state?.site?.features?.support?.wechat?.enabled)},showSite(){return this.$store?.state?.site?.admins?.includes(this.$store.getters.user?.id)},links(){return[{key:"profile",text:this.$t("console.menu.userProfile"),href:`${S()}/user/profile`,icon:"fa-regular fa-user"},{key:"application-list",text:this.$t("console.menu.applicationList"),name:N,icon:"fa-solid fa-cube"},{key:"order-list",text:this.$t("console.menu.orderList"),name:T,icon:"fa-solid fa-store"},{key:"usage-list",text:this.$t("console.menu.usageList"),name:L,icon:"fa-solid fa-rotate-left"},{key:"distribution-index",text:this.$t("console.menu.distributionIndex"),name:v,icon:"fa-solid fa-coins"},...this.showSite?[{key:"site-index",text:this.$t("common.nav.site"),name:D,icon:"fa-solid fa-gear"}]:[],{key:"dark-setting",text:this.$t("common.nav.darkMode"),icon:"fa-solid fa-moon",callback:()=>{this.operating.dark=!0}},{key:"locale-setting",text:this.$t("common.nav.locale"),icon:"fa-solid fa-language",callback:()=>{this.operating.locale=!0}},{key:"developerPlatform",text:this.$t("console.menu.developerPlatform"),href:R(),icon:"fa-solid fa-laptop-code"},...this.showSupport?[{key:"support",text:this.$t("common.nav.support"),callback:()=>{this.operating.help=!0},icon:"fa-solid fa-question"}]:[],{key:"logout",text:this.$t("common.nav.logOut"),icon:"fa-solid fa-arrow-right-from-bracket",callback:async()=>{await this.$store.dispatch("resetAll"),await this.$store.dispatch("chat/resetAll"),await this.$store.dispatch("midjourney/resetAll"),await this.$store.dispatch("qrart/resetAll"),await this.$store.dispatch("flux/resetAll"),await this.$store.dispatch("hailuo/resetAll"),await this.$store.dispatch("headshots/resetAll"),await this.$store.dispatch("kling/resetAll"),await this.$store.dispatch("luma/resetAll"),await this.$store.dispatch("pika/resetAll"),await this.$store.dispatch("suno/resetAll"),await this.$store.dispatch("login")}}]}},methods:{onHome(){this.$router.push({name:O})},onNavigate(e){e.name?this.$router.push({name:e.name}):e.href?window.open(e.href,"_blank"):e.callback&&e.callback()}}}),W={class:"profile"},K={class:"info"},Q={class:"links"},Y=["onClick"],Z={class:"icon"},ee={class:"text"},te={class:"suffix"};function se(e,n,E,y,I,x){const c=t("el-image"),l=t("font-awesome-icon"),d=t("locale-selector"),m=t("help-dialog");return r(),h("div",W,[o("div",K,[s(c,{src:e.user.avatar,fit:"cover",class:"avatar"},null,8,["src"]),o("h2",null,p(e.user.username),1),o("div",{style:U({backgroundImage:"url("+e.user.avatar+")"}),class:"background"},null,4)]),o("div",Q,[(r(!0),h(P,null,B(e.links,(a,u)=>(r(),h("a",{key:u,class:q({link:!0,active:e.$route.name===a.name}),onClick:C=>e.onNavigate(a)},[o("span",Z,[s(l,{icon:a.icon,class:"text-sm"},null,8,["icon"])]),o("span",ee,p(a.text),1),o("span",te,[s(l,{icon:"fa-solid fa-chevron-right",class:"text-sm"})])],10,Y))),128))]),s(d,{visible:e.operating.locale==!0,onClose:n[0]||(n[0]=a=>e.operating.locale=!1)},null,8,["visible"]),s(m,{visible:e.operating.help==!0,onClose:n[1]||(n[1]=a=>e.operating.help=!1)},null,8,["visible"])])}const _e=k(G,[["render",se],["__scopeId","data-v-54290de4"]]);export{_e as default};
@@ -1 +1 @@
1
- import{F as H}from"./index.es-DrP2fGVw.js";import{E as N}from"./index-CZhPWUg-.js";import{E as de}from"./index-B_scRkOY.js";import{af as pe,al as me,bE as he,ag as ie,c5 as fe,_ as _e,d as C,a as $e,ah as ve,c as j,bd as ge,bj as ke,as as ae,b as f,o as a,i as w,r as U,f as oe,e as A,j as $,b4 as le,E as G,n as ye,g as we,h as L,t as l,k as s,l as c,ev as se,x as v,F as z,v as q,ew as Q,c2 as be,D as P,ex as x,ey as ee,y,J as Z,cJ as te,ez as O,dh as B,eA as R,aj as Ce,K as Se,eB as Ae,d9 as Le,dg as Ee}from"./index-DfnhNu7H.js";import{E as re}from"./index-CGm0EtIv.js";import{E as je,a as Ve}from"./index-DvIFURTz.js";import{I as D}from"./InfoIcon-Bp3PCa7q.js";import{E as Ie}from"./index-Dnxi0FQr.js";import{E}from"./index-sDnliYJA.js";import{E as K}from"./index-CwMSdp80.js";import{E as Te,a as ce}from"./index-CR4mcIzC.js";import{E as X}from"./index-BfUUmnQr.js";import{E as Pe,a as Fe,b as Ue}from"./index-JJATUo4M.js";import{E as ze}from"./index-B75qfh9m.js";import{E as Me}from"./index-B280-_DG.js";import{a as Ge,E as Re}from"./index-XD2GuHYw.js";import{E as De}from"./index-hBSCekXm.js";import"./use-form-item-oBt_u5uH.js";import"./index-r5W6hzzQ.js";import"./index-kZb-v3Ld.js";import"./strings-DD9aE7dM.js";import"./castArray-GZv0dEZk.js";import"./isEqual-ChOSIBb4.js";import"./_Uint8Array-B4stHTfJ.js";import"./typescript-Cjvo67Qo.js";import"./debounce-CBdhoBC5.js";import"./_baseIteratee-C69L38OU.js";import"./index-Cs8tZiAz.js";import"./index-D6STV0o9.js";import"./_baseClone-DzST50VS.js";import"./_initCloneObject-DAkYYxGi.js";import"./index-Dqv6_CwO.js";import"./dropdown-BHBH108X.js";const Oe=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ie(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:he},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Be={error:e=>e instanceof Event},We=C({name:"ElAvatar"}),qe=C({...We,props:Oe,emits:Be,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=j(()=>{const{size:n,icon:p,shape:k}=i,_=[o.b()];return ge(n)&&_.push(o.m(n)),p&&_.push(o.m("icon")),k&&_.push(o.m(k)),_}),u=j(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),m=j(()=>({objectFit:i.fit}));ae(()=>i.src,()=>r.value=!1);function h(n){r.value=!0,t("error",n)}return(n,p)=>(a(),f("span",{class:ye(A(d)),style:oe(A(u))},[(n.src||n.srcSet)&&!r.value?(a(),f("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(A(m)),onError:h},null,44,["src","alt","srcset"])):n.icon?(a(),w(A(G),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var He=_e(qe,[["__file","avatar.vue"]]);const Ne=we(He),Ze=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:N,FontAwesomeIcon:H},data(){return{drawer:!1,preview:!1}},computed:{}}),Ke={class:"main"},Xe={class:"config"},Je={class:"result"},Ye={class:"preview"};function Qe(e,t,i,o,r,d){const u=c("font-awesome-icon"),m=c("el-button"),h=c("el-drawer");return a(),f("div",Ke,[l("div",Xe,[U(e.$slots,"config",{},void 0,!0)]),l("div",Je,[U(e.$slots,"result",{},void 0,!0)]),l("div",Ye,[U(e.$slots,"preview",{},void 0,!0)]),s(m,{round:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(h,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),"with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const xe=L(Ze,[["render",Qe],["__scopeId","data-v-230fd591"]]),et=C({name:"VersionSelector",components:{ElSelect:Ve,ElOption:je,ElSwitch:re},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),tt={class:"field"},ot={class:"title font-bold"};function st(e,t,i,o,r,d){const u=c("el-switch"),m=c("el-option"),h=c("el-select");return a(),f("div",tt,[l("h2",ot,v(e.$t("suno.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(h,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(a(!0),f(z,null,q(e.options,n=>(a(),w(m,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const nt=L(et,[["render",st],["__scopeId","data-v-5a66a01f"]]),it=C({name:"UploadAudio",components:{ElUpload:Ie,ElButton:N,InfoIcon:D,FontAwesomeIcon:H},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),Q.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const r=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:r,action:"upload_extend"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),at={class:"relative"},lt={class:"flex justify-between"},rt={class:"flex justify-start items-center"},ct={class:"text-sm font-bold"};function ut(e,t,i,o,r,d){const u=c("info-icon"),m=c("font-awesome-icon"),h=c("el-button"),n=c("el-upload");return a(),f("div",at,[l("div",lt,[l("div",rt,[l("span",ct,v(e.$t("suno.name.referenceAudios")),1),s(u,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=p=>e.fileList=p),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:$(()=>[s(h,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(m,{icon:"fa-solid fa-upload",class:"icon mr-1"}),P(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const dt=L(it,[["render",ut],["__scopeId","data-v-6236152c"]]),pt="",mt=C({name:"PromptInput",components:{ElInput:K,ElSwitch:re,InfoIcon:D},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=pt)}}),ht={class:"field"},ft={class:"box"},_t={class:"title-info"},$t={class:"title font-bold"},vt={class:"instrumental"},gt={class:"title inline-block"};function kt(e,t,i,o,r,d){const u=c("info-icon"),m=c("el-switch"),h=c("el-input");return a(),f("div",ht,[l("div",ft,[l("div",_t,[l("h2",$t,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",vt,[s(m,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",gt,v(e.$t("suno.name.instrumental")),1)])]),s(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const yt=L(mt,[["render",kt],["__scopeId","data-v-d7004a7c"]]),wt="",bt=C({name:"LyricInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=wt)}}),Ct={class:"field"},St={class:"box"},At={class:"title font-bold"};function Lt(e,t,i,o,r,d){const u=c("info-icon"),m=c("el-input");return a(),f("div",Ct,[l("div",St,[l("h2",At,v(e.$t("suno.name.lyrics")),1),s(u,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(a(),w(m,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(a(),w(m,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Et=L(bt,[["render",Lt],["__scopeId","data-v-99dfded8"]]),jt=C({name:"StyleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Vt={class:"field"},It={class:"title-container"},Tt={class:"titlefont-bold"};function Pt(e,t,i,o,r,d){const u=c("info-icon"),m=c("el-input");return a(),f("div",Vt,[l("div",It,[l("h2",Tt,v(e.$t("suno.name.style")),1),s(u,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(m,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=h=>e.style=h),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ft=L(jt,[["render",Pt],["__scopeId","data-v-85bbfcaa"]]),Ut=C({name:"TitleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),zt={class:"field"},Mt={class:"title-container"},Gt={class:"title font-bold"};function Rt(e,t,i,o,r,d){const u=c("info-icon"),m=c("el-input");return a(),f("div",zt,[l("div",Mt,[l("h2",Gt,v(e.$t("suno.name.title")),1),s(u,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(m,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=h=>e.title=h),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Dt=L(Ut,[["render",Rt],["__scopeId","data-v-ce70fe34"]]);function M(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,r=t<10?`0${t}`:t;return o+":"+r}const Ot=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:G,ElInputNumber:Te,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Bt={class:"field"},Wt={class:"box"},qt={class:"title font-bold"},Ht={class:"input-wrapper"},Nt={class:"task"},Zt={class:"left"},Kt={key:2,class:"duration"},Xt={class:"info"},Jt={class:"title"},Yt={class:"style"};function Qt(e,t,i,o,r,d){const u=c("el-input-number"),m=c("el-image"),h=c("video-pause"),n=c("el-icon"),p=c("video-play"),k=te("loading");return a(),f("div",Bt,[l("div",Wt,[l("h2",qt,v(e.$t("suno.name.extend")),1),l("div",Ht,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=_=>e.value=_),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),l("div",Nt,[e.audio?(a(),f("div",{key:0,class:"audio",onClick:t[3]||(t[3]=_=>e.onClick(e.audio))},[Z((a(),f("div",Zt,[s(m,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),f("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=_=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(h)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),f("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=_=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(p)]),_:1})])):y("",!0),e.audio?.duration?(a(),f("div",Kt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Xt,[l("h2",Jt,v(e.audio?.title),1),l("p",Yt,v(e.audio?.style),1)])])):y("",!0)])])}const xt=L(Ot,[["render",Qt],["__scopeId","data-v-bcce4821"]]),eo=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:G,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),to={class:"field"},oo={class:"box"},so={class:"title font-bold"},no={class:"task"},io={class:"left"},ao={key:2,class:"duration"},lo={class:"info"},ro={class:"title"},co={class:"style"};function uo(e,t,i,o,r,d){const u=c("el-image"),m=c("video-pause"),h=c("el-icon"),n=c("video-play"),p=te("loading");return a(),f("div",to,[l("div",oo,[l("h2",so,v(e.$t("suno.name.cover")),1)]),l("div",no,[e.audio?(a(),f("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),f("div",io,[s(u,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),f("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(h,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),f("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(h,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(a(),f("div",ao,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[p,!e.audio?.audio_url]]),l("div",lo,[l("h2",ro,v(e.audio?.title),1),l("p",co,v(e.audio?.style),1)])])):y("",!0)])])}const po=L(eo,[["render",uo],["__scopeId","data-v-06640216"]]),mo=C({name:"PresetPanel",components:{TypeSelector:nt,PromptInput:yt,LyricInput:Et,StyleInput:Ft,TitleInput:Dt,ExtendFromInput:xt,CoverFromInput:po,UploadAudio:dt,FontAwesomeIcon:H,ElButton:N},emits:["generate"],computed:{config(){return this.$store.state.suno?.config}},methods:{onGenerate(){this.$emit("generate")}}}),ho={class:"panel"},fo={class:"config"},_o={class:"actions"};function $o(e,t,i,o,r,d){const u=c("type-selector"),m=c("upload-audio"),h=c("prompt-input"),n=c("lyric-input"),p=c("style-input"),k=c("title-input"),_=c("extend-from-input"),b=c("cover-from-input"),T=c("font-awesome-icon"),V=c("el-button");return a(),f("div",ho,[l("div",fo,[s(u,{class:"mb-4"}),s(m,{class:"mb-4"}),e.config?.custom?y("",!0):(a(),w(h,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(a(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(p,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(a(),w(_,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(a(),w(b,{key:5,class:"mb-4"})):y("",!0),l("div",_o,[e.config?.action!=="extend"?(a(),w(V,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(V,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])])}const vo=L(mo,[["render",$o],["__scopeId","data-v-dc0dc608"]]);var W={exports:{}},go=W.exports,ne;function ko(){return ne||(ne=1,function(e,t){(function(i,o){o()})(go,function(){function i(n,p){return typeof p>"u"?p={autoBom:!1}:typeof p!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),p={autoBom:!p}),p.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,p,k){var _=new XMLHttpRequest;_.open("GET",n),_.responseType="blob",_.onload=function(){h(_.response,p,k)},_.onerror=function(){console.error("could not download file")},_.send()}function r(n){var p=new XMLHttpRequest;p.open("HEAD",n,!1);try{p.send()}catch{}return 200<=p.status&&299>=p.status}function d(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var p=document.createEvent("MouseEvents");p.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(p)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,m=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),h=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!m?function(n,p,k){var _=u.URL||u.webkitURL,b=document.createElement("a");p=p||n.name||"download",b.download=p,b.rel="noopener",typeof n=="string"?(b.href=n,b.origin===location.origin?d(b):r(b.href)?o(n,p,k):d(b,b.target="_blank")):(b.href=_.createObjectURL(n),setTimeout(function(){_.revokeObjectURL(b.href)},4e4),setTimeout(function(){d(b)},0))}:"msSaveOrOpenBlob"in navigator?function(n,p,k){if(p=p||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),p);else if(r(n))o(n,p,k);else{var _=document.createElement("a");_.href=n,_.target="_blank",setTimeout(function(){d(_)})}}:function(n,p,k,_){if(_=_||open("","_blank"),_&&(_.document.title=_.document.body.innerText="downloading..."),typeof n=="string")return o(n,p,k);var b=n.type==="application/octet-stream",T=/constructor/i.test(u.HTMLElement)||u.safari,V=/CriOS\/[\d]+/.test(navigator.userAgent);if((V||b&&T||m)&&typeof FileReader<"u"){var I=new FileReader;I.onloadend=function(){var S=I.result;S=V?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),_?_.location.href=S:location=S,_=null},I.readAsDataURL(n)}else{var g=u.URL||u.webkitURL,F=g.createObjectURL(n);_?_.location=F:location.href=F,_=null,setTimeout(function(){g.revokeObjectURL(F)},4e4)}});u.saveAs=h.saveAs=h,e.exports=h})}(W)),W.exports}var yo=ko();const wo="https://webhook.acedata.cloud/suno",bo=C({name:"TaskPreview",components:{ElImage:X,ElIcon:G,ElTooltip:ze,ElButton:N,FontAwesomeIcon:H,VideoPlay:ee,VideoPause:x,ElDropdown:Ue,ElDropdownMenu:Fe,ElDropdownItem:Pe},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=[];const t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(i=>{let o=i;t&&(o.action=t),e.push(o)}),e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{yo.saveAs(d,r)})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:wo},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{E.error(r?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Co={class:"task"},So=["onClick"],Ao={class:"left"},Lo=["onClick"],Eo=["onClick"],jo={key:2,class:"duration"},Vo={class:"info"},Io={class:"title"},To={class:"style"},Po={class:"right"},Fo={class:"el-dropdown-link"},Uo={class:"el-dropdown-link"};function zo(e,t,i,o,r,d){const u=c("el-image"),m=c("video-pause"),h=c("el-icon"),n=c("video-play"),p=c("el-button"),k=c("font-awesome-icon"),_=c("el-tooltip"),b=c("el-dropdown-item"),T=c("el-dropdown-menu"),V=c("el-dropdown"),I=te("loading");return a(),f("div",Co,[(a(!0),f(z,null,q(e.audios,(g,F)=>(a(),f("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),f("div",Ao,[s(u,{src:g?.image_url,class:"cover",fit:"cover"},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),f("div",{key:0,class:"overlay",onClick:S=>e.onPause(g)},[s(h,null,{default:$(()=>[s(m)]),_:1})],8,Lo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),f("div",{key:1,class:"overlay",onClick:S=>e.onPlay(g)},[s(h,null,{default:$(()=>[s(n)]),_:1})],8,Eo)):y("",!0),g?.duration?(a(),f("div",jo,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[I,!g?.audio_url]]),l("div",Vo,[l("h2",Io,v(g?.title),1),l("p",To,v(g?.style),1)]),l("div",Po,[g?.audio_url?(a(),w(p,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[P(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(_,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:$(()=>[g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:S=>e.onPreview(S,g?.video_url)},null,8,["onClick"])):y("",!0)]),_:2},1032,["content"]),s(V,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[P(v(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):y("",!0),g?.audio_url?(a(),w(b,{key:1,onClick:S=>e.onDownload(S,g?.audio_url)},{default:$(()=>[P(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Fo,[s(_,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(V,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[P(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[P(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(a(),w(b,{key:1,onClick:S=>e.onConcatMusic(g?.id)},{default:$(()=>[P(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Uo,[s(_,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,So))),128))])}const Mo=L(bo,[["render",zo]]),Go={class:"player-slider"},Ro=C({__name:"PlayerSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=j({get:()=>t.state.suno?.audio?.duration,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:u})}),r=()=>{},d=u=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:u});return(u,m)=>(a(),f("div",Go,[s(A(ce),{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=h=>i.value=h),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}}),Do="/assets/disk-XFRmVAfp.png",Oo={class:"flex player-song"},Bo=["src"],Wo={class:"ml-2 text-xs flex flex-col justify-between"},qo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ho={class:"flex"},No={class:"ml-2 text-dc"},Zo=C({__name:"PlayerSong",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return ae(i,(o,r)=>{if(o?.audio_url!==r?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if(o?.progress!==r?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else o?.state!==r?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==r?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>(a(),f("div",Oo,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||A(Do)},null,8,Bo),l("div",Wo,[l("div",qo,[l("div",Ho,[l("span",null,v(i.value?.title||"Music"),1),l("span",No,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Ko={class:"flex justify-end items-center gap-x-2.5"},Xo={class:"text-xs"},Jo=C({__name:"PlayerAction",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=j({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),f("div",Ko,[l("span",Xo,v(A(M)(i.value))+" / "+v(A(M)(o.value)),1)]))}});var Yo={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function Qo(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function xo(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],r=[],d=t.theme||i.theme;switch(d){case"outline":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none");break;case"filled":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("#FFF"),r.push("#FFF");break;case"two-tone":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),r.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),r.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:r,id:e}}var es=Symbol("icon-context");function J(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(d){var u=Qo(),m=Ce(es,Yo);return function(){var h=d.size,n=d.strokeWidth,p=d.strokeLinecap,k=d.strokeLinejoin,_=d.theme,b=d.fill,T=d.spin,V=xo(u,{size:h,strokeWidth:n,strokeLinecap:p,strokeLinejoin:k,theme:_,fill:b},m),I=[m.prefix+"-icon"];return I.push(m.prefix+"-icon-"+e),t&&m.rtl&&I.push(m.prefix+"-icon-rtl"),T&&I.push(m.prefix+"-icon-spin"),s("span",{class:I.join(" ")},[i(V)])}}};return o}const ts=J("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),os=J("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ss=J("volume-mute",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("rect",{opacity:"0.01",x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null),s("mask",{id:e.id+"603476ab",maskUnits:"userSpaceOnUse",x:"30",y:"18",width:"13",height:"13",style:{maskType:"alpha"}},[s("rect",{x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null)]),s("g",{mask:"url(#"+e.id+"603476ab)"},[s("path",{d:"M40.7348 20.2858L32.2495 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32.2496 20.2858L40.7349 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)]),s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ue=J("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Y=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(a(),w(le(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),ns={class:"player-volume flex flex-col items-center pt-2"},is={class:"text-sm mt-3"},as={class:"mt-2"},ls=C({__name:"PlayerVolumeSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=j({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),r=()=>t.dispatch("suno/toggleMuted"),d=u=>t.dispatch("suno/setVolume",u);return(u,m)=>(a(),f("div",ns,[l("div",null,[s(A(ce),{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=h=>i.value=h),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",is,v(i.value),1),l("div",as,[s(Y,{icon:o.value?A(ss):A(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),rs={class:"flex items-center justify-center gap-x-3"},cs=C({__name:"PlayerController",setup(e){const t=R(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=j(()=>t.state.suno.audio);return(r,d)=>(a(),f("div",rs,[s(Y,{icon:o.value?.state==="playing"?A(ts):A(os),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(A(Me),{placement:"top",width:"50px"},{reference:$(()=>[s(Y,{icon:A(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(ls)]),_:1})]))}}),us={class:"flex flex-col items-stretch h-20"},ds={class:"flex grow px-5 items-center"},ps={class:"flex-1"},ms={class:"flex-1"},hs={class:"flex-1"},fs=C({__name:"Player",setup(e){return(t,i)=>(a(),f("div",us,[s(Ro),l("div",ds,[l("div",ps,[s(Zo)]),l("div",ms,[s(cs)]),l("div",hs,[s(Jo)])])]))}}),_s=C({name:"RecentPanel",components:{TaskPreview:Mo,ElSkeleton:Re,ElSkeletonItem:Ge,Player:fs},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),$s={key:0,class:"tasks"},vs={class:"left"},gs={class:"main"},ks={key:1,class:"tasks"},ys={key:2,class:"description"},ws={class:"flex-1 flex flex-col"},bs={class:"h-20"};function Cs(e,t,i,o,r,d){const u=c("el-skeleton-item"),m=c("el-skeleton"),h=c("task-preview"),n=c("player");return a(),f(z,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...p)=>e.onHandleScroll&&e.onHandleScroll(...p))},[e.tasks?.items===void 0?(a(),f("div",$s,[(a(),f(z,null,q(3,p=>l("div",{key:p,class:"task placeholder"},[l("div",vs,[s(m,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",gs,[s(m,{animated:""},{template:$(()=>[s(u,{variant:"p",class:"title"}),s(u,{variant:"text",style:{"margin-right":"16px"}}),s(u,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),f("div",ks,[(a(!0),f(z,null,q(e.tasks?.items,(p,k)=>(a(),w(h,{key:k,"model-value":p,class:"preview"},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),f("p",ys,v(e.$t("suno.message.noTasks")),1)):y("",!0)],544),Z(l("div",ws,[l("div",bs,[s(n)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const Ss=L(_s,[["render",Cs],["__scopeId","data-v-13445e67"]]),As=C({name:"TaskPreview",components:{ElScrollbar:De,IconPicture:Ae,ElImage:X,ElAvatar:Ne,ElIcon:G},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Ls={key:0,class:"card"},Es={class:"image-container"},js={class:"image-slot"},Vs={class:"title"},Is={class:"content"},Ts={class:"artist"},Ps={class:"style"},Fs={class:"time"},Us={class:"lyrics"},zs={key:1,class:"gradient-background"};function Ms(e,t,i,o,r,d){const u=c("icon-picture"),m=c("el-icon"),h=c("el-image"),n=c("el-avatar"),p=c("el-scrollbar");return a(),w(p,{class:"right-panel"},{default:$(()=>[e.audio?.object?(a(),f("div",Ls,[l("div",Es,[s(h,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",js,[s(m,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Vs,v(e.audio?.title),1)]),l("div",Is,[l("div",Ts,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",Ps,v(e.audio?.style),1),l("p",Fs,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",Us,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),f("div",zs))]),_:1})}const Gs=L(As,[["render",Ms],["__scopeId","data-v-9b29e9f9"]]),Rs="https://webhook.acedata.cloud/suno",Ds=C({name:"SunoIndex",components:{Layout:xe,ConfigPanel:vo,RecentPanel:Ss,PreviewPanel:Gs},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===B.Request},needApply(){return this.$store.state.suno.status.getApplications===B.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Le.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ee&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Rs},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Os(e,t,i,o,r,d){const u=c("config-panel"),m=c("recent-panel"),h=c("preview-panel"),n=c("layout");return a(),w(n,null,{config:$(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(m,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(h)]),_:1})}const wn=L(Ds,[["render",Os],["__scopeId","data-v-69332928"]]);export{wn as default};
1
+ import{F as H}from"./index.es-CwLjz3IM.js";import{E as N}from"./index-BQlwC9yd.js";import{E as de}from"./index-HoJAUmIW.js";import{af as pe,al as me,bE as he,ag as ie,c5 as fe,_ as _e,d as C,a as $e,ah as ve,c as j,bd as ge,bj as ke,as as ae,b as f,o as a,i as w,r as U,f as oe,e as A,j as $,b4 as le,E as G,n as ye,g as we,h as L,t as l,k as s,l as c,ev as se,x as v,F as z,v as q,ew as Q,c2 as be,D as P,ex as x,ey as ee,y,J as Z,cJ as te,ez as O,dh as B,eA as R,aj as Ce,K as Se,eB as Ae,d9 as Le,dg as Ee}from"./index-CeK-RMgJ.js";import{E as re}from"./index-zOLiNtWU.js";import{E as je,a as Ve}from"./index-BCwZ77Ag.js";import{I as D}from"./InfoIcon-RKUiJEyU.js";import{E as Ie}from"./index-Dj6ZfA7Z.js";import{E}from"./index-B5bgPNGo.js";import{E as K}from"./index-DbIT_r8h.js";import{E as Te,a as ce}from"./index-BMge8mVL.js";import{E as X}from"./index-XGvrZ-mR.js";import{E as Pe,a as Fe,b as Ue}from"./index-aZMupG3d.js";import{E as ze}from"./index-Dsyl3ppZ.js";import{E as Me}from"./index-o2ViPdS5.js";import{a as Ge,E as Re}from"./index-BBE-XQrc.js";import{E as De}from"./index-C5KJUudH.js";import"./use-form-item-CGOsSRSZ.js";import"./index-r5W6hzzQ.js";import"./index-BFb947sB.js";import"./strings-QdrzPdzB.js";import"./castArray-DzRTAvuA.js";import"./isEqual-B8kV_aQO.js";import"./_Uint8Array-Bc9h99Pp.js";import"./typescript-DjSc1HJs.js";import"./debounce-D60ZmlOv.js";import"./_baseIteratee-DP487BGW.js";import"./index-mkn_LdcV.js";import"./index-BzhGdquP.js";import"./_baseClone-IKSd45xI.js";import"./_initCloneObject-BNx7BLk2.js";import"./index-BTTB5TWv.js";import"./dropdown-bG3kzlx5.js";const Oe=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ie(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:he},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Be={error:e=>e instanceof Event},We=C({name:"ElAvatar"}),qe=C({...We,props:Oe,emits:Be,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=j(()=>{const{size:n,icon:p,shape:k}=i,_=[o.b()];return ge(n)&&_.push(o.m(n)),p&&_.push(o.m("icon")),k&&_.push(o.m(k)),_}),u=j(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),m=j(()=>({objectFit:i.fit}));ae(()=>i.src,()=>r.value=!1);function h(n){r.value=!0,t("error",n)}return(n,p)=>(a(),f("span",{class:ye(A(d)),style:oe(A(u))},[(n.src||n.srcSet)&&!r.value?(a(),f("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(A(m)),onError:h},null,44,["src","alt","srcset"])):n.icon?(a(),w(A(G),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var He=_e(qe,[["__file","avatar.vue"]]);const Ne=we(He),Ze=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:N,FontAwesomeIcon:H},data(){return{drawer:!1,preview:!1}},computed:{}}),Ke={class:"main"},Xe={class:"config"},Je={class:"result"},Ye={class:"preview"};function Qe(e,t,i,o,r,d){const u=c("font-awesome-icon"),m=c("el-button"),h=c("el-drawer");return a(),f("div",Ke,[l("div",Xe,[U(e.$slots,"config",{},void 0,!0)]),l("div",Je,[U(e.$slots,"result",{},void 0,!0)]),l("div",Ye,[U(e.$slots,"preview",{},void 0,!0)]),s(m,{round:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(h,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),"with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const xe=L(Ze,[["render",Qe],["__scopeId","data-v-230fd591"]]),et=C({name:"VersionSelector",components:{ElSelect:Ve,ElOption:je,ElSwitch:re},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),tt={class:"field"},ot={class:"title font-bold"};function st(e,t,i,o,r,d){const u=c("el-switch"),m=c("el-option"),h=c("el-select");return a(),f("div",tt,[l("h2",ot,v(e.$t("suno.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(h,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(a(!0),f(z,null,q(e.options,n=>(a(),w(m,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const nt=L(et,[["render",st],["__scopeId","data-v-5a66a01f"]]),it=C({name:"UploadAudio",components:{ElUpload:Ie,ElButton:N,InfoIcon:D,FontAwesomeIcon:H},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),Q.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const r=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:r,action:"upload_extend"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),at={class:"relative"},lt={class:"flex justify-between"},rt={class:"flex justify-start items-center"},ct={class:"text-sm font-bold"};function ut(e,t,i,o,r,d){const u=c("info-icon"),m=c("font-awesome-icon"),h=c("el-button"),n=c("el-upload");return a(),f("div",at,[l("div",lt,[l("div",rt,[l("span",ct,v(e.$t("suno.name.referenceAudios")),1),s(u,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=p=>e.fileList=p),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:$(()=>[s(h,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(m,{icon:"fa-solid fa-upload",class:"icon mr-1"}),P(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const dt=L(it,[["render",ut],["__scopeId","data-v-6236152c"]]),pt="",mt=C({name:"PromptInput",components:{ElInput:K,ElSwitch:re,InfoIcon:D},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=pt)}}),ht={class:"field"},ft={class:"box"},_t={class:"title-info"},$t={class:"title font-bold"},vt={class:"instrumental"},gt={class:"title inline-block"};function kt(e,t,i,o,r,d){const u=c("info-icon"),m=c("el-switch"),h=c("el-input");return a(),f("div",ht,[l("div",ft,[l("div",_t,[l("h2",$t,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",vt,[s(m,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",gt,v(e.$t("suno.name.instrumental")),1)])]),s(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const yt=L(mt,[["render",kt],["__scopeId","data-v-d7004a7c"]]),wt="",bt=C({name:"LyricInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=wt)}}),Ct={class:"field"},St={class:"box"},At={class:"title font-bold"};function Lt(e,t,i,o,r,d){const u=c("info-icon"),m=c("el-input");return a(),f("div",Ct,[l("div",St,[l("h2",At,v(e.$t("suno.name.lyrics")),1),s(u,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(a(),w(m,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(a(),w(m,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Et=L(bt,[["render",Lt],["__scopeId","data-v-99dfded8"]]),jt=C({name:"StyleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Vt={class:"field"},It={class:"title-container"},Tt={class:"titlefont-bold"};function Pt(e,t,i,o,r,d){const u=c("info-icon"),m=c("el-input");return a(),f("div",Vt,[l("div",It,[l("h2",Tt,v(e.$t("suno.name.style")),1),s(u,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(m,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=h=>e.style=h),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ft=L(jt,[["render",Pt],["__scopeId","data-v-85bbfcaa"]]),Ut=C({name:"TitleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),zt={class:"field"},Mt={class:"title-container"},Gt={class:"title font-bold"};function Rt(e,t,i,o,r,d){const u=c("info-icon"),m=c("el-input");return a(),f("div",zt,[l("div",Mt,[l("h2",Gt,v(e.$t("suno.name.title")),1),s(u,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(m,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=h=>e.title=h),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Dt=L(Ut,[["render",Rt],["__scopeId","data-v-ce70fe34"]]);function M(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,r=t<10?`0${t}`:t;return o+":"+r}const Ot=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:G,ElInputNumber:Te,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Bt={class:"field"},Wt={class:"box"},qt={class:"title font-bold"},Ht={class:"input-wrapper"},Nt={class:"task"},Zt={class:"left"},Kt={key:2,class:"duration"},Xt={class:"info"},Jt={class:"title"},Yt={class:"style"};function Qt(e,t,i,o,r,d){const u=c("el-input-number"),m=c("el-image"),h=c("video-pause"),n=c("el-icon"),p=c("video-play"),k=te("loading");return a(),f("div",Bt,[l("div",Wt,[l("h2",qt,v(e.$t("suno.name.extend")),1),l("div",Ht,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=_=>e.value=_),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),l("div",Nt,[e.audio?(a(),f("div",{key:0,class:"audio",onClick:t[3]||(t[3]=_=>e.onClick(e.audio))},[Z((a(),f("div",Zt,[s(m,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),f("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=_=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(h)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),f("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=_=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(p)]),_:1})])):y("",!0),e.audio?.duration?(a(),f("div",Kt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Xt,[l("h2",Jt,v(e.audio?.title),1),l("p",Yt,v(e.audio?.style),1)])])):y("",!0)])])}const xt=L(Ot,[["render",Qt],["__scopeId","data-v-bcce4821"]]),eo=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:G,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),to={class:"field"},oo={class:"box"},so={class:"title font-bold"},no={class:"task"},io={class:"left"},ao={key:2,class:"duration"},lo={class:"info"},ro={class:"title"},co={class:"style"};function uo(e,t,i,o,r,d){const u=c("el-image"),m=c("video-pause"),h=c("el-icon"),n=c("video-play"),p=te("loading");return a(),f("div",to,[l("div",oo,[l("h2",so,v(e.$t("suno.name.cover")),1)]),l("div",no,[e.audio?(a(),f("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),f("div",io,[s(u,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),f("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(h,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),f("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(h,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(a(),f("div",ao,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[p,!e.audio?.audio_url]]),l("div",lo,[l("h2",ro,v(e.audio?.title),1),l("p",co,v(e.audio?.style),1)])])):y("",!0)])])}const po=L(eo,[["render",uo],["__scopeId","data-v-06640216"]]),mo=C({name:"PresetPanel",components:{TypeSelector:nt,PromptInput:yt,LyricInput:Et,StyleInput:Ft,TitleInput:Dt,ExtendFromInput:xt,CoverFromInput:po,UploadAudio:dt,FontAwesomeIcon:H,ElButton:N},emits:["generate"],computed:{config(){return this.$store.state.suno?.config}},methods:{onGenerate(){this.$emit("generate")}}}),ho={class:"panel"},fo={class:"config"},_o={class:"actions"};function $o(e,t,i,o,r,d){const u=c("type-selector"),m=c("upload-audio"),h=c("prompt-input"),n=c("lyric-input"),p=c("style-input"),k=c("title-input"),_=c("extend-from-input"),b=c("cover-from-input"),T=c("font-awesome-icon"),V=c("el-button");return a(),f("div",ho,[l("div",fo,[s(u,{class:"mb-4"}),s(m,{class:"mb-4"}),e.config?.custom?y("",!0):(a(),w(h,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(a(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(p,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(a(),w(_,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(a(),w(b,{key:5,class:"mb-4"})):y("",!0),l("div",_o,[e.config?.action!=="extend"?(a(),w(V,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(V,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])])}const vo=L(mo,[["render",$o],["__scopeId","data-v-dc0dc608"]]);var W={exports:{}},go=W.exports,ne;function ko(){return ne||(ne=1,function(e,t){(function(i,o){o()})(go,function(){function i(n,p){return typeof p>"u"?p={autoBom:!1}:typeof p!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),p={autoBom:!p}),p.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,p,k){var _=new XMLHttpRequest;_.open("GET",n),_.responseType="blob",_.onload=function(){h(_.response,p,k)},_.onerror=function(){console.error("could not download file")},_.send()}function r(n){var p=new XMLHttpRequest;p.open("HEAD",n,!1);try{p.send()}catch{}return 200<=p.status&&299>=p.status}function d(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var p=document.createEvent("MouseEvents");p.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(p)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,m=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),h=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!m?function(n,p,k){var _=u.URL||u.webkitURL,b=document.createElement("a");p=p||n.name||"download",b.download=p,b.rel="noopener",typeof n=="string"?(b.href=n,b.origin===location.origin?d(b):r(b.href)?o(n,p,k):d(b,b.target="_blank")):(b.href=_.createObjectURL(n),setTimeout(function(){_.revokeObjectURL(b.href)},4e4),setTimeout(function(){d(b)},0))}:"msSaveOrOpenBlob"in navigator?function(n,p,k){if(p=p||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),p);else if(r(n))o(n,p,k);else{var _=document.createElement("a");_.href=n,_.target="_blank",setTimeout(function(){d(_)})}}:function(n,p,k,_){if(_=_||open("","_blank"),_&&(_.document.title=_.document.body.innerText="downloading..."),typeof n=="string")return o(n,p,k);var b=n.type==="application/octet-stream",T=/constructor/i.test(u.HTMLElement)||u.safari,V=/CriOS\/[\d]+/.test(navigator.userAgent);if((V||b&&T||m)&&typeof FileReader<"u"){var I=new FileReader;I.onloadend=function(){var S=I.result;S=V?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),_?_.location.href=S:location=S,_=null},I.readAsDataURL(n)}else{var g=u.URL||u.webkitURL,F=g.createObjectURL(n);_?_.location=F:location.href=F,_=null,setTimeout(function(){g.revokeObjectURL(F)},4e4)}});u.saveAs=h.saveAs=h,e.exports=h})}(W)),W.exports}var yo=ko();const wo="https://webhook.acedata.cloud/suno",bo=C({name:"TaskPreview",components:{ElImage:X,ElIcon:G,ElTooltip:ze,ElButton:N,FontAwesomeIcon:H,VideoPlay:ee,VideoPause:x,ElDropdown:Ue,ElDropdownMenu:Fe,ElDropdownItem:Pe},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=[];const t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(i=>{let o=i;t&&(o.action=t),e.push(o)}),e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{yo.saveAs(d,r)})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:wo},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{E.error(r?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Co={class:"task"},So=["onClick"],Ao={class:"left"},Lo=["onClick"],Eo=["onClick"],jo={key:2,class:"duration"},Vo={class:"info"},Io={class:"title"},To={class:"style"},Po={class:"right"},Fo={class:"el-dropdown-link"},Uo={class:"el-dropdown-link"};function zo(e,t,i,o,r,d){const u=c("el-image"),m=c("video-pause"),h=c("el-icon"),n=c("video-play"),p=c("el-button"),k=c("font-awesome-icon"),_=c("el-tooltip"),b=c("el-dropdown-item"),T=c("el-dropdown-menu"),V=c("el-dropdown"),I=te("loading");return a(),f("div",Co,[(a(!0),f(z,null,q(e.audios,(g,F)=>(a(),f("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),f("div",Ao,[s(u,{src:g?.image_url,class:"cover",fit:"cover"},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),f("div",{key:0,class:"overlay",onClick:S=>e.onPause(g)},[s(h,null,{default:$(()=>[s(m)]),_:1})],8,Lo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),f("div",{key:1,class:"overlay",onClick:S=>e.onPlay(g)},[s(h,null,{default:$(()=>[s(n)]),_:1})],8,Eo)):y("",!0),g?.duration?(a(),f("div",jo,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[I,!g?.audio_url]]),l("div",Vo,[l("h2",Io,v(g?.title),1),l("p",To,v(g?.style),1)]),l("div",Po,[g?.audio_url?(a(),w(p,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[P(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(_,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:$(()=>[g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:S=>e.onPreview(S,g?.video_url)},null,8,["onClick"])):y("",!0)]),_:2},1032,["content"]),s(V,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[P(v(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):y("",!0),g?.audio_url?(a(),w(b,{key:1,onClick:S=>e.onDownload(S,g?.audio_url)},{default:$(()=>[P(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Fo,[s(_,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(V,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[P(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[P(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(a(),w(b,{key:1,onClick:S=>e.onConcatMusic(g?.id)},{default:$(()=>[P(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Uo,[s(_,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,So))),128))])}const Mo=L(bo,[["render",zo]]),Go={class:"player-slider"},Ro=C({__name:"PlayerSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=j({get:()=>t.state.suno?.audio?.duration,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:u})}),r=()=>{},d=u=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:u});return(u,m)=>(a(),f("div",Go,[s(A(ce),{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=h=>i.value=h),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}}),Do="/assets/disk-XFRmVAfp.png",Oo={class:"flex player-song"},Bo=["src"],Wo={class:"ml-2 text-xs flex flex-col justify-between"},qo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ho={class:"flex"},No={class:"ml-2 text-dc"},Zo=C({__name:"PlayerSong",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return ae(i,(o,r)=>{if(o?.audio_url!==r?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if(o?.progress!==r?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else o?.state!==r?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==r?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>(a(),f("div",Oo,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||A(Do)},null,8,Bo),l("div",Wo,[l("div",qo,[l("div",Ho,[l("span",null,v(i.value?.title||"Music"),1),l("span",No,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Ko={class:"flex justify-end items-center gap-x-2.5"},Xo={class:"text-xs"},Jo=C({__name:"PlayerAction",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=j({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),f("div",Ko,[l("span",Xo,v(A(M)(i.value))+" / "+v(A(M)(o.value)),1)]))}});var Yo={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function Qo(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function xo(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],r=[],d=t.theme||i.theme;switch(d){case"outline":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none");break;case"filled":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("#FFF"),r.push("#FFF");break;case"two-tone":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),r.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),r.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:r,id:e}}var es=Symbol("icon-context");function J(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(d){var u=Qo(),m=Ce(es,Yo);return function(){var h=d.size,n=d.strokeWidth,p=d.strokeLinecap,k=d.strokeLinejoin,_=d.theme,b=d.fill,T=d.spin,V=xo(u,{size:h,strokeWidth:n,strokeLinecap:p,strokeLinejoin:k,theme:_,fill:b},m),I=[m.prefix+"-icon"];return I.push(m.prefix+"-icon-"+e),t&&m.rtl&&I.push(m.prefix+"-icon-rtl"),T&&I.push(m.prefix+"-icon-spin"),s("span",{class:I.join(" ")},[i(V)])}}};return o}const ts=J("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),os=J("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ss=J("volume-mute",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("rect",{opacity:"0.01",x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null),s("mask",{id:e.id+"603476ab",maskUnits:"userSpaceOnUse",x:"30",y:"18",width:"13",height:"13",style:{maskType:"alpha"}},[s("rect",{x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null)]),s("g",{mask:"url(#"+e.id+"603476ab)"},[s("path",{d:"M40.7348 20.2858L32.2495 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32.2496 20.2858L40.7349 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)]),s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ue=J("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Y=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(a(),w(le(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),ns={class:"player-volume flex flex-col items-center pt-2"},is={class:"text-sm mt-3"},as={class:"mt-2"},ls=C({__name:"PlayerVolumeSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=j({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),r=()=>t.dispatch("suno/toggleMuted"),d=u=>t.dispatch("suno/setVolume",u);return(u,m)=>(a(),f("div",ns,[l("div",null,[s(A(ce),{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=h=>i.value=h),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",is,v(i.value),1),l("div",as,[s(Y,{icon:o.value?A(ss):A(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),rs={class:"flex items-center justify-center gap-x-3"},cs=C({__name:"PlayerController",setup(e){const t=R(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=j(()=>t.state.suno.audio);return(r,d)=>(a(),f("div",rs,[s(Y,{icon:o.value?.state==="playing"?A(ts):A(os),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(A(Me),{placement:"top",width:"50px"},{reference:$(()=>[s(Y,{icon:A(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(ls)]),_:1})]))}}),us={class:"flex flex-col items-stretch h-20"},ds={class:"flex grow px-5 items-center"},ps={class:"flex-1"},ms={class:"flex-1"},hs={class:"flex-1"},fs=C({__name:"Player",setup(e){return(t,i)=>(a(),f("div",us,[s(Ro),l("div",ds,[l("div",ps,[s(Zo)]),l("div",ms,[s(cs)]),l("div",hs,[s(Jo)])])]))}}),_s=C({name:"RecentPanel",components:{TaskPreview:Mo,ElSkeleton:Re,ElSkeletonItem:Ge,Player:fs},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),$s={key:0,class:"tasks"},vs={class:"left"},gs={class:"main"},ks={key:1,class:"tasks"},ys={key:2,class:"description"},ws={class:"flex-1 flex flex-col"},bs={class:"h-20"};function Cs(e,t,i,o,r,d){const u=c("el-skeleton-item"),m=c("el-skeleton"),h=c("task-preview"),n=c("player");return a(),f(z,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...p)=>e.onHandleScroll&&e.onHandleScroll(...p))},[e.tasks?.items===void 0?(a(),f("div",$s,[(a(),f(z,null,q(3,p=>l("div",{key:p,class:"task placeholder"},[l("div",vs,[s(m,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",gs,[s(m,{animated:""},{template:$(()=>[s(u,{variant:"p",class:"title"}),s(u,{variant:"text",style:{"margin-right":"16px"}}),s(u,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),f("div",ks,[(a(!0),f(z,null,q(e.tasks?.items,(p,k)=>(a(),w(h,{key:k,"model-value":p,class:"preview"},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),f("p",ys,v(e.$t("suno.message.noTasks")),1)):y("",!0)],544),Z(l("div",ws,[l("div",bs,[s(n)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const Ss=L(_s,[["render",Cs],["__scopeId","data-v-13445e67"]]),As=C({name:"TaskPreview",components:{ElScrollbar:De,IconPicture:Ae,ElImage:X,ElAvatar:Ne,ElIcon:G},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Ls={key:0,class:"card"},Es={class:"image-container"},js={class:"image-slot"},Vs={class:"title"},Is={class:"content"},Ts={class:"artist"},Ps={class:"style"},Fs={class:"time"},Us={class:"lyrics"},zs={key:1,class:"gradient-background"};function Ms(e,t,i,o,r,d){const u=c("icon-picture"),m=c("el-icon"),h=c("el-image"),n=c("el-avatar"),p=c("el-scrollbar");return a(),w(p,{class:"right-panel"},{default:$(()=>[e.audio?.object?(a(),f("div",Ls,[l("div",Es,[s(h,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",js,[s(m,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Vs,v(e.audio?.title),1)]),l("div",Is,[l("div",Ts,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",Ps,v(e.audio?.style),1),l("p",Fs,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",Us,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),f("div",zs))]),_:1})}const Gs=L(As,[["render",Ms],["__scopeId","data-v-9b29e9f9"]]),Rs="https://webhook.acedata.cloud/suno",Ds=C({name:"SunoIndex",components:{Layout:xe,ConfigPanel:vo,RecentPanel:Ss,PreviewPanel:Gs},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===B.Request},needApply(){return this.$store.state.suno.status.getApplications===B.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Le.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ee&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Rs},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Os(e,t,i,o,r,d){const u=c("config-panel"),m=c("recent-panel"),h=c("preview-panel"),n=c("layout");return a(),w(n,null,{config:$(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(m,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(h)]),_:1})}const wn=L(Ds,[["render",Os],["__scopeId","data-v-69332928"]]);export{wn as default};
@@ -1 +1 @@
1
- import{C}from"./CopyToClipboard-CbDGPk1W.js";import{d as I,d6 as F,dV as T,dW as N,dX as P,h as B,i as r,j as o,k as i,l,t as e,x as s,b as p,D as m,y as k,o as n}from"./index-DfnhNu7H.js";import{d as O,a as w,s as M}from"./distribution-DyV_VBv3.js";import{g as q}from"./price-r1S14aus.js";import{F as R}from"./index.es-DrP2fGVw.js";import{E as V}from"./index-XD2GuHYw.js";import{E as z,a as U}from"./index-DVqp4AQh.js";import{E as A}from"./index-B75qfh9m.js";import{E as H,a as G,b as Q}from"./index-CfU3ZKsc.js";import{E as W}from"./index-CudAAZZP.js";import{E as j}from"./index-CZhPWUg-.js";import{E as X}from"./index-D6STV0o9.js";import"./index-hBSCekXm.js";import"./typescript-Cjvo67Qo.js";import"./index-kZb-v3Ld.js";import"./_Uint8Array-B4stHTfJ.js";import"./_initCloneObject-DAkYYxGi.js";import"./isPlainObject-BIeuM4iJ.js";import"./_baseIteratee-C69L38OU.js";import"./isEqual-ChOSIBb4.js";import"./castArray-GZv0dEZk.js";import"./debounce-CBdhoBC5.js";import"./index-Dw2bNzdp.js";import"./use-form-item-oBt_u5uH.js";import"./index-Cs8tZiAz.js";import"./index-r5W6hzzQ.js";const Y=I({name:"ConsoleDistributionList",components:{CopyToClipboard:C,FontAwesomeIcon:R,QrCode:F,ElProgress:X,ElRow:Q,ElCol:G,ElButton:j,ElDivider:W,ElCard:H,ElTooltip:A,ElTable:U,ElTableColumn:z,ElSkeleton:V},data(){return{invitees:[],inviteesCount:void 0,distributionLevels:[],distributionLink:void 0,distributionStatus:void 0,loading:!1}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||"1")},distributionLevelMap(){let t={};return this.distributionLevels.forEach(a=>{t[a.level]=a}),t}},watch:{page:{handler(){this.onFetchData()}}},async mounted(){this.onFetchData(),this.onGenerateDistributionLink()},methods:{getPriceString:q,goHistory(){this.$router.push({name:P})},goInvitees(){this.$router.push({name:N})},onPageChange(t){this.$router.push({name:this.$route.name?.toString(),query:{page:t}})},getPercentageForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level]?.threshold,a=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor((this.distributionStatus?.price-t)/(a-t)*100)},getDeltaForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor(t-this.distributionStatus?.price)},async onFetchData(){this.loading=!0,await w.initialize(),Promise.all([this.onFetchDistributionStatus(),this.onFetchDistributionLevels(),this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onGenerateDistributionLink(){const a=`${window.location.origin}?inviter_id=${this.$store.getters.user.id}`;try{const v=(await M.create(a))?.data?.data?.url;this.distributionLink=(v||a).replace("surl.id","share.acedata.cloud")}catch{this.distributionLink=a}},async onFetchDistributionStatus(){const{data:t}=await w.getAll({user_id:this.$store.getters.user.id});t.items&&t.items.length>0&&(this.distributionStatus=t.items[0])},async onFetchDistributionLevels(){const{data:t}=await O.getAll({limit:20,user_id:this.$store.getters.user.id});this.distributionLevels=t.items},async onFetchInvitees(){const{data:t}=await T.getInvitees({});this.invitees=t.items,this.inviteesCount=t.count}}}),J={class:"title"},K={key:1},Z={class:"icon-wrapper"},x={class:"text-left"},tt={class:"description"},et={class:"value"},it={key:1},st={class:"icon-wrapper"},ot={class:"text-left"},nt={class:"description"},lt={class:"value"},at={key:1},rt={class:"icon-wrapper"},dt={class:"text-left"},ct={class:"description"},ut={class:"value"},pt={key:1},ht={class:"icon-wrapper"},mt={class:"text-left"},_t={class:"description"},bt={class:"value"},vt={key:1},ft={class:"title"},gt={class:"clear-both overflow-hidden"},kt={class:"float-left description"},yt={class:"float-right description"},$t={class:"description"},wt={class:"level"},Lt={class:"level"},St={class:"level"},Et={key:1},Dt={class:"title"},Ct={class:"link-wrapper text-center"},It=["href"],Ft={class:"qr-wrapper ml-auto mr-auto"},Tt={class:"mt-0"},Nt={class:"description"},Pt={class:"more"};function Bt(t,a,v,Ot,Mt,qt){const d=l("el-col"),_=l("el-row"),c=l("el-skeleton"),b=l("font-awesome-icon"),f=l("el-button"),u=l("el-card"),y=l("el-tooltip"),L=l("el-progress"),$=l("el-divider"),g=l("el-table-column"),S=l("el-table"),E=l("copy-to-clipboard"),D=l("qr-code");return n(),r(_,{class:"panel"},{default:o(()=>[i(d,{span:24},{default:o(()=>[i(_,null,{default:o(()=>[i(d,{span:24},{default:o(()=>[e("h2",J,s(t.$t("common.title.distribution")),1)]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",K,[e("div",Z,[i(b,{icon:"fa-solid fa-wallet",class:"icon"})]),e("div",x,[e("p",tt,s(t.$t("distribution.title.price")),1),e("p",et,s(t.getPriceString({value:t.distributionStatus?.price})),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goHistory},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",it,[e("div",st,[i(b,{icon:"fa-solid fa-coins",class:"icon"})]),e("div",ot,[e("p",nt,s(t.$t("distribution.title.reward")),1),e("p",lt,s(t.getPriceString({value:t.distributionStatus?.reward})),1)]),i(y,{effect:"dark",content:t.$t("distribution.message.developingWithDrawal"),placement:"top"},{default:o(()=>[i(f,{type:"primary",round:"",size:"small",class:"btn"},{default:o(()=>[m(s(t.$t("distribution.button.withdrawal")),1)]),_:1})]),_:1},8,["content"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",at,[e("div",rt,[i(b,{icon:"fa-solid fa-percent",class:"icon"})]),e("div",dt,[e("p",ct,s(t.$t("distribution.title.percentage")),1),e("p",ut,s(t.distributionStatus?.level?.percentage)+"%",1)])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",pt,[e("div",ht,[i(b,{icon:"fa-regular fa-user",class:"icon"})]),e("div",mt,[e("p",_t,s(t.$t("distribution.title.inviteesCount")),1),e("p",bt,s(t.inviteesCount),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goInvitees},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"level-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",vt,[e("h4",ft,s(t.$t("distribution.title.levelInfo")),1),e("div",gt,[e("div",kt,[e("p",null,s(t.$t("distribution.title.currentLevel"))+": L"+s(t.distributionStatus?.level?.level),1),e("p",null,s(t.$t("distribution.title.currentPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level]?.percentage)+"% ",1)]),e("div",yt,[e("p",null,s(t.$t("distribution.title.nextLevel"))+": L"+s(t.distributionStatus?.level?.level+1),1),e("p",null,s(t.$t("distribution.title.nextPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level+1]?.percentage)+"% ",1)])]),i(L,{"text-inside":!0,"stroke-width":20,percentage:t.getPercentageForNextLevel(),class:"mb-2"},null,8,["percentage"]),e("p",$t,s(t.$t("distribution.message.deltaPriceForNextLevel"))+": $"+s(t.getDeltaForNextLevel()),1),i($),t.distributionLevels?(n(),r(S,{key:0,data:t.distributionLevels,stripe:""},{default:o(()=>[i(g,{label:t.$t("distribution.field.level")},{default:o(h=>[e("span",wt,"L"+s(h.row?.level),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.threshold")},{default:o(h=>[e("span",Lt,"$"+s(h.row?.threshold),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.percentage")},{default:o(h=>[e("span",St,s(h.row?.percentage)+"%",1)]),_:1},8,["label"])]),_:1},8,["data"])):k("",!0)]))]),_:1})]),_:1}),i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"distribution-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",Et,[e("h4",Dt,s(t.$t("distribution.title.distributionLink")),1),i($),e("div",Ct,[k("",!0),e("a",{href:t.distributionLink,class:"link"},s(t.distributionLink),9,It),i(E,{content:t.distributionLink},null,8,["content"])]),e("div",Ft,[t.distributionLink?(n(),r(D,{key:0,value:t.distributionLink,size:180,margin:2,class:"block mb-2 ml-auto mr-auto",type:"image/png",color:{dark:"#000000",light:"#ffffff"}},null,8,["value"])):k("",!0),e("p",Tt,s(t.$t("distribution.message.distributionQrDescription")),1)]),e("p",Nt,[m(s(t.$t("distribution.message.distributionLinkDescription"))+" ",1),e("span",Pt,[i(y,{effect:"dark",content:t.$t("distribution.message.distributionLinkDescription2"),placement:"top"},{default:o(()=>[m(s(t.$t("distribution.message.technicalDetail")),1)]),_:1},8,["content"])])])]))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}const ce=B(Y,[["render",Bt],["__scopeId","data-v-a8befdf2"]]);export{ce as default};
1
+ import{C}from"./CopyToClipboard-D2htyZNn.js";import{d as I,d6 as F,dV as T,dW as N,dX as P,h as B,i as r,j as o,k as i,l,t as e,x as s,b as p,D as m,y as k,o as n}from"./index-CeK-RMgJ.js";import{d as O,a as w,s as M}from"./distribution-3_lYXD6w.js";import{g as q}from"./price-Dk3oYtWm.js";import{F as R}from"./index.es-CwLjz3IM.js";import{E as V}from"./index-BBE-XQrc.js";import{E as z,a as U}from"./index-CeeVBAJH.js";import{E as A}from"./index-Dsyl3ppZ.js";import{E as H,a as G,b as Q}from"./index-CUDVH29L.js";import{E as W}from"./index-DrgJLZYQ.js";import{E as j}from"./index-BQlwC9yd.js";import{E as X}from"./index-BzhGdquP.js";import"./index-C5KJUudH.js";import"./typescript-DjSc1HJs.js";import"./index-BFb947sB.js";import"./_Uint8Array-Bc9h99Pp.js";import"./_initCloneObject-BNx7BLk2.js";import"./isPlainObject-gBUjyWLa.js";import"./_baseIteratee-DP487BGW.js";import"./isEqual-B8kV_aQO.js";import"./castArray-DzRTAvuA.js";import"./debounce-D60ZmlOv.js";import"./index-BhikXZPL.js";import"./use-form-item-CGOsSRSZ.js";import"./index-mkn_LdcV.js";import"./index-r5W6hzzQ.js";const Y=I({name:"ConsoleDistributionList",components:{CopyToClipboard:C,FontAwesomeIcon:R,QrCode:F,ElProgress:X,ElRow:Q,ElCol:G,ElButton:j,ElDivider:W,ElCard:H,ElTooltip:A,ElTable:U,ElTableColumn:z,ElSkeleton:V},data(){return{invitees:[],inviteesCount:void 0,distributionLevels:[],distributionLink:void 0,distributionStatus:void 0,loading:!1}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||"1")},distributionLevelMap(){let t={};return this.distributionLevels.forEach(a=>{t[a.level]=a}),t}},watch:{page:{handler(){this.onFetchData()}}},async mounted(){this.onFetchData(),this.onGenerateDistributionLink()},methods:{getPriceString:q,goHistory(){this.$router.push({name:P})},goInvitees(){this.$router.push({name:N})},onPageChange(t){this.$router.push({name:this.$route.name?.toString(),query:{page:t}})},getPercentageForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level]?.threshold,a=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor((this.distributionStatus?.price-t)/(a-t)*100)},getDeltaForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor(t-this.distributionStatus?.price)},async onFetchData(){this.loading=!0,await w.initialize(),Promise.all([this.onFetchDistributionStatus(),this.onFetchDistributionLevels(),this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onGenerateDistributionLink(){const a=`${window.location.origin}?inviter_id=${this.$store.getters.user.id}`;try{const v=(await M.create(a))?.data?.data?.url;this.distributionLink=(v||a).replace("surl.id","share.acedata.cloud")}catch{this.distributionLink=a}},async onFetchDistributionStatus(){const{data:t}=await w.getAll({user_id:this.$store.getters.user.id});t.items&&t.items.length>0&&(this.distributionStatus=t.items[0])},async onFetchDistributionLevels(){const{data:t}=await O.getAll({limit:20,user_id:this.$store.getters.user.id});this.distributionLevels=t.items},async onFetchInvitees(){const{data:t}=await T.getInvitees({});this.invitees=t.items,this.inviteesCount=t.count}}}),J={class:"title"},K={key:1},Z={class:"icon-wrapper"},x={class:"text-left"},tt={class:"description"},et={class:"value"},it={key:1},st={class:"icon-wrapper"},ot={class:"text-left"},nt={class:"description"},lt={class:"value"},at={key:1},rt={class:"icon-wrapper"},dt={class:"text-left"},ct={class:"description"},ut={class:"value"},pt={key:1},ht={class:"icon-wrapper"},mt={class:"text-left"},_t={class:"description"},bt={class:"value"},vt={key:1},ft={class:"title"},gt={class:"clear-both overflow-hidden"},kt={class:"float-left description"},yt={class:"float-right description"},$t={class:"description"},wt={class:"level"},Lt={class:"level"},St={class:"level"},Et={key:1},Dt={class:"title"},Ct={class:"link-wrapper text-center"},It=["href"],Ft={class:"qr-wrapper ml-auto mr-auto"},Tt={class:"mt-0"},Nt={class:"description"},Pt={class:"more"};function Bt(t,a,v,Ot,Mt,qt){const d=l("el-col"),_=l("el-row"),c=l("el-skeleton"),b=l("font-awesome-icon"),f=l("el-button"),u=l("el-card"),y=l("el-tooltip"),L=l("el-progress"),$=l("el-divider"),g=l("el-table-column"),S=l("el-table"),E=l("copy-to-clipboard"),D=l("qr-code");return n(),r(_,{class:"panel"},{default:o(()=>[i(d,{span:24},{default:o(()=>[i(_,null,{default:o(()=>[i(d,{span:24},{default:o(()=>[e("h2",J,s(t.$t("common.title.distribution")),1)]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",K,[e("div",Z,[i(b,{icon:"fa-solid fa-wallet",class:"icon"})]),e("div",x,[e("p",tt,s(t.$t("distribution.title.price")),1),e("p",et,s(t.getPriceString({value:t.distributionStatus?.price})),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goHistory},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",it,[e("div",st,[i(b,{icon:"fa-solid fa-coins",class:"icon"})]),e("div",ot,[e("p",nt,s(t.$t("distribution.title.reward")),1),e("p",lt,s(t.getPriceString({value:t.distributionStatus?.reward})),1)]),i(y,{effect:"dark",content:t.$t("distribution.message.developingWithDrawal"),placement:"top"},{default:o(()=>[i(f,{type:"primary",round:"",size:"small",class:"btn"},{default:o(()=>[m(s(t.$t("distribution.button.withdrawal")),1)]),_:1})]),_:1},8,["content"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",at,[e("div",rt,[i(b,{icon:"fa-solid fa-percent",class:"icon"})]),e("div",dt,[e("p",ct,s(t.$t("distribution.title.percentage")),1),e("p",ut,s(t.distributionStatus?.level?.percentage)+"%",1)])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",pt,[e("div",ht,[i(b,{icon:"fa-regular fa-user",class:"icon"})]),e("div",mt,[e("p",_t,s(t.$t("distribution.title.inviteesCount")),1),e("p",bt,s(t.inviteesCount),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goInvitees},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"level-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",vt,[e("h4",ft,s(t.$t("distribution.title.levelInfo")),1),e("div",gt,[e("div",kt,[e("p",null,s(t.$t("distribution.title.currentLevel"))+": L"+s(t.distributionStatus?.level?.level),1),e("p",null,s(t.$t("distribution.title.currentPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level]?.percentage)+"% ",1)]),e("div",yt,[e("p",null,s(t.$t("distribution.title.nextLevel"))+": L"+s(t.distributionStatus?.level?.level+1),1),e("p",null,s(t.$t("distribution.title.nextPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level+1]?.percentage)+"% ",1)])]),i(L,{"text-inside":!0,"stroke-width":20,percentage:t.getPercentageForNextLevel(),class:"mb-2"},null,8,["percentage"]),e("p",$t,s(t.$t("distribution.message.deltaPriceForNextLevel"))+": $"+s(t.getDeltaForNextLevel()),1),i($),t.distributionLevels?(n(),r(S,{key:0,data:t.distributionLevels,stripe:""},{default:o(()=>[i(g,{label:t.$t("distribution.field.level")},{default:o(h=>[e("span",wt,"L"+s(h.row?.level),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.threshold")},{default:o(h=>[e("span",Lt,"$"+s(h.row?.threshold),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.percentage")},{default:o(h=>[e("span",St,s(h.row?.percentage)+"%",1)]),_:1},8,["label"])]),_:1},8,["data"])):k("",!0)]))]),_:1})]),_:1}),i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"distribution-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",Et,[e("h4",Dt,s(t.$t("distribution.title.distributionLink")),1),i($),e("div",Ct,[k("",!0),e("a",{href:t.distributionLink,class:"link"},s(t.distributionLink),9,It),i(E,{content:t.distributionLink},null,8,["content"])]),e("div",Ft,[t.distributionLink?(n(),r(D,{key:0,value:t.distributionLink,size:180,margin:2,class:"block mb-2 ml-auto mr-auto",type:"image/png",color:{dark:"#000000",light:"#ffffff"}},null,8,["value"])):k("",!0),e("p",Tt,s(t.$t("distribution.message.distributionQrDescription")),1)]),e("p",Nt,[m(s(t.$t("distribution.message.distributionLinkDescription"))+" ",1),e("span",Pt,[i(y,{effect:"dark",content:t.$t("distribution.message.distributionLinkDescription2"),placement:"top"},{default:o(()=>[m(s(t.$t("distribution.message.technicalDetail")),1)]),_:1},8,["content"])])])]))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}const ce=B(Y,[["render",Bt],["__scopeId","data-v-a8befdf2"]]);export{ce as default};