@acedatacloud/nexior 3.313.15 → 3.313.16

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 (140) hide show
  1. package/dist/assets/{ApiCodeButton-DVDvpF39.js → ApiCodeButton-BNuNdq4D.js} +1 -1
  2. package/dist/assets/{Artifacts-M5OArCSb.js → Artifacts-Cu8J_ym-.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-nmrdtzKz.js → AskUserQuestionCard-C-7j_69V.js} +1 -1
  4. package/dist/assets/{Auth-DgHyE6Ud.js → Auth-BsMh8nPz.js} +1 -1
  5. package/dist/assets/{Bare-tAqXVynZ.js → Bare-B4K-drxI.js} +1 -1
  6. package/dist/assets/{BotPlaceholder-DKqHzqLl.js → BotPlaceholder-CsEE_kEM.js} +1 -1
  7. package/dist/assets/{BottomFooter-C-92hvDp.js → BottomFooter-BWY4XYkB.js} +1 -1
  8. package/dist/assets/{Callback-BF1L2ptF.js → Callback-98Ze-y0l.js} +1 -1
  9. package/dist/assets/{CodeSnippet-C40Ezou7.js → CodeSnippet-DdZyxmOZ.js} +1 -1
  10. package/dist/assets/{Console-60rd2R1Z.js → Console-BnU3i9hG.js} +1 -1
  11. package/dist/assets/{Consumption-DBJ6FvEI.js → Consumption-yJBcaOnM.js} +1 -1
  12. package/dist/assets/{Conversation-EQOqVjyg.css → Conversation-D9eP5uPS.css} +1 -1
  13. package/dist/assets/{Conversation-BgS8W3yy.js → Conversation-ORSPUDLB.js} +2 -2
  14. package/dist/assets/{CopyToClipboard-DaB2iAye.js → CopyToClipboard-DOIyE45l.js} +1 -1
  15. package/dist/assets/{Detail-Baw48us2.js → Detail-l3fU1ZPm.js} +2 -2
  16. package/dist/assets/{Extra-CNiQQ5nF.js → Extra-BTKN0F9p.js} +1 -1
  17. package/dist/assets/{FilePreview-C8wbPdBU.js → FilePreview-C29FCGxZ.js} +1 -1
  18. package/dist/assets/{Hailuo-agXgxdZB.js → Hailuo-uqAp7975.js} +1 -1
  19. package/dist/assets/{History-DAaoA4Ao.js → History-DdzVdywu.js} +1 -1
  20. package/dist/assets/{ImagePreview-CbEvXym3.js → ImagePreview-h9Y8nGAq.js} +1 -1
  21. package/dist/assets/{ImageWrapper-C_Q6zeaX.js → ImageWrapper-CWfsDw_F.js} +1 -1
  22. package/dist/assets/{Index-Dmog6HAs.js → Index-6uYec__S.js} +1 -1
  23. package/dist/assets/{Index-DgOD3mOQ.js → Index-8PIa2ZEZ.js} +1 -1
  24. package/dist/assets/{Index-D2y2Dvl8.js → Index-8bUal1de.js} +1 -1
  25. package/dist/assets/{Index-D-WGlQpp.js → Index-B3Cf5DjZ.js} +1 -1
  26. package/dist/assets/{Index-oI95pVvT.js → Index-BHg2tHaX.js} +1 -1
  27. package/dist/assets/{Index-C4dV7X7Y.js → Index-BNNC2vqq.js} +1 -1
  28. package/dist/assets/{Index-Dh7b6ZCC.js → Index-BRvO6G5G.js} +1 -1
  29. package/dist/assets/{Index-CjEOcGOf.js → Index-BUYbpNUM.js} +1 -1
  30. package/dist/assets/{Index-DnmXpxUi.js → Index-BVDIphzJ.js} +1 -1
  31. package/dist/assets/{Index-ZA0PCj-h.js → Index-BdOfmdpQ.js} +1 -1
  32. package/dist/assets/{Index-DN9heAk5.js → Index-BqOhFQia.js} +1 -1
  33. package/dist/assets/{Index-DJix3V-B.js → Index-Btzciiu4.js} +1 -1
  34. package/dist/assets/{Index-D3MyI1HU.js → Index-CCh3JNPO.js} +1 -1
  35. package/dist/assets/{Index-BbTpW8s-.js → Index-CiS_MFri.js} +1 -1
  36. package/dist/assets/{Index-CbI0Mb6Z.js → Index-CsU6Et92.js} +1 -1
  37. package/dist/assets/{Index-DkF05Wap.js → Index-D8Pm4v-f.js} +1 -1
  38. package/dist/assets/{Index-XfV_lfyJ.js → Index-DBhw0GYv.js} +1 -1
  39. package/dist/assets/{Index-BjmE8-B4.js → Index-DLZDcQfT.js} +1 -1
  40. package/dist/assets/{Index-Bjt_ckDr.js → Index-DObKDn28.js} +1 -1
  41. package/dist/assets/{Index-BpVvfBcS.js → Index-DeMKNePv.js} +1 -1
  42. package/dist/assets/{Index-B_xEEn_I.js → Index-Dotn0CKH.js} +1 -1
  43. package/dist/assets/{Index-B0CPJxJM.js → Index-DsqyDhHS.js} +1 -1
  44. package/dist/assets/{Index-Blir2ySw.js → Index-HLDko3G7.js} +1 -1
  45. package/dist/assets/{Index-CPWroR1T.js → Index-NASG_kZ3.js} +1 -1
  46. package/dist/assets/{Index-DDQ5nZQu.js → Index-f5aHVbwJ.js} +1 -1
  47. package/dist/assets/{Index-CTX8Q7g2.js → Index-faVZ2-y2.js} +1 -1
  48. package/dist/assets/{Index-CW02zIJg.js → Index-kABBSDOR.js} +1 -1
  49. package/dist/assets/{Index-BKsnhvjy.js → Index-oJf-GbDs.js} +1 -1
  50. package/dist/assets/{Invitees-D43oqEyJ.js → Invitees-CeH6KlPh.js} +1 -1
  51. package/dist/assets/{List-CFhnaLNe.js → List-COj-eZDR.js} +1 -1
  52. package/dist/assets/{List-DKHa_4_D.js → List-D7Rfeq8x.js} +1 -1
  53. package/dist/assets/{List-BZQbuz7x.js → List-xF7Vqjma.js} +1 -1
  54. package/dist/assets/{LocalTools-WsZU8eFb.js → LocalTools-Cd-Ge-0F.js} +1 -1
  55. package/dist/assets/{LocalTools-DxmXAQ3B.js → LocalTools-_5OF4YKx.js} +1 -1
  56. package/dist/assets/{Main-CYQImFMt.js → Main-B8zeNtY2.js} +1 -1
  57. package/dist/assets/{Model-EHaEPK11.js → Model-DlFhXCTJ.js} +1 -1
  58. package/dist/assets/{Navigator-OysOh2LR.js → Navigator-Ba-wWPeu.js} +1 -1
  59. package/dist/assets/{NoTasks-CLNtgfi4.js → NoTasks-QEMQL-Gn.js} +1 -1
  60. package/dist/assets/{NotFound-DfzoA7AW.js → NotFound-BQDWofmO.js} +1 -1
  61. package/dist/assets/{Pagination-QBsiSfVw.js → Pagination-sTH1Ajmw.js} +1 -1
  62. package/dist/assets/{Pay-DlFNkt1c.js → Pay-BEmhFI2x.js} +1 -1
  63. package/dist/assets/{Player-Dre3BrAq.js → Player-DR2sgYUD.js} +1 -1
  64. package/dist/assets/{PromptTextarea-FYbsElB4.js → PromptTextarea-DDKIJKMv.js} +1 -1
  65. package/dist/assets/{RealtimeCall-DVFKVdr_.js → RealtimeCall-BC9sHgjJ.js} +1 -1
  66. package/dist/assets/{ScheduledTasks-3FfwaxhJ.js → ScheduledTasks-D9Zcec25.js} +1 -1
  67. package/dist/assets/{Status-yKio3dZr.js → Status-SCg4FdbJ.js} +1 -1
  68. package/dist/assets/{Subscribe-DQXGZis5.js → Subscribe-BFqDxu5g.js} +1 -1
  69. package/dist/assets/{TabSwitcher-BAsH4d5v.js → TabSwitcher-CDKDFD5X.js} +1 -1
  70. package/dist/assets/{Tts-_z-nRunG.js → Tts-CsrF9QiA.js} +1 -1
  71. package/dist/assets/{VideoPlayer-CoSwPTjv.js → VideoPlayer-DWEb8C-E.js} +1 -1
  72. package/dist/assets/{alert-BSWfT6uK.js → alert-BMYM_Vr-.js} +1 -1
  73. package/dist/assets/{avatar-D9zmh5Yi.js → avatar-WiwYwC9z.js} +1 -1
  74. package/dist/assets/{basic-D32F0p0i.js → basic-Cop9iaQl.js} +1 -1
  75. package/dist/assets/{chat-BBZaE17u.js → chat-CfX6SAdB.js} +1 -1
  76. package/dist/assets/{codingBridge-CF1093Z5.js → codingBridge-BMwCKVTo.js} +1 -1
  77. package/dist/assets/{codingBridgeNotify-BTyNuDv-.js → codingBridgeNotify-DsP5Gu6M.js} +2 -2
  78. package/dist/assets/{collapse-DF8ctLLC.js → collapse-LS8nzqBf.js} +1 -1
  79. package/dist/assets/{createTaskActions-B4rU0Kdl.js → createTaskActions--71QEYuA.js} +1 -1
  80. package/dist/assets/{date-picker-Dkt160xN.js → date-picker-Ds7MpYv6.js} +1 -1
  81. package/dist/assets/{digitalhuman-CS9yr4VH.js → digitalhuman-Bjy6eoFs.js} +1 -1
  82. package/dist/assets/{drawer-Cu02szmr.js → drawer-yIAwJ7En.js} +1 -1
  83. package/dist/assets/{dropdown-DQ8-ulvw.js → dropdown-DqeFUBvf.js} +1 -1
  84. package/dist/assets/{esm-2FwMVIor.js → esm-BiqAZ-AN.js} +2 -2
  85. package/dist/assets/{esm-5ZePxiYO.js → esm-BlUm513U.js} +1 -1
  86. package/dist/assets/{esm-BD3Ig8U2.js → esm-CQ8ubGDj.js} +3 -3
  87. package/dist/assets/{esm-DHsgus6M.js → esm-CyOIO06W.js} +2 -2
  88. package/dist/assets/esm-D-mOlbmJ.js +1 -0
  89. package/dist/assets/{esm-99FtjMLA.js → esm-Dvr_WSOi.js} +1 -1
  90. package/dist/assets/{esm-_r829ZP4.js → esm-mudylPo1.js} +1 -1
  91. package/dist/assets/{fish-Bvj7p5KT.js → fish-t81jFXeQ.js} +1 -1
  92. package/dist/assets/{flux-B_Xe-_fx.js → flux-uqMCji7C.js} +1 -1
  93. package/dist/assets/{grokvideo-Dctzc0tT.js → grokvideo-CM06_I6G.js} +1 -1
  94. package/dist/assets/{hailuo-BowkuGur.js → hailuo-BfclHQfA.js} +1 -1
  95. package/dist/assets/{headshots-7JWXrYqA.js → headshots-KLu8-gFH.js} +1 -1
  96. package/dist/assets/{image-Dr945ixQ.js → image-BTRKceWr.js} +1 -1
  97. package/dist/assets/{index-DrTotskf.js → index-C8ufQprS.js} +3 -3
  98. package/dist/assets/{index.browser.esm-wp5BNQDF.js → index.browser.esm-XdJsb1y2.js} +1 -1
  99. package/dist/assets/{index.es-C5Wm6FW7.js → index.es-D_ksxY2f.js} +1 -1
  100. package/dist/assets/{input-number-s6gXNw-j.js → input-number-Cg10sUMa.js} +1 -1
  101. package/dist/assets/{kling-B1DzNMnR.js → kling-DNPTXtdi.js} +1 -1
  102. package/dist/assets/{luma-CAZCDwZz.js → luma-CzCH_web.js} +1 -1
  103. package/dist/assets/{maestro-CYUTwkUZ.js → maestro-Br5pO7Jt.js} +1 -1
  104. package/dist/assets/{midjourney-Btyn_73P.js → midjourney-BCPN04D1.js} +1 -1
  105. package/dist/assets/{nanobanana-D_HoO5l-.js → nanobanana-Di-C1JIx.js} +1 -1
  106. package/dist/assets/{openaiimage-DRoA7mwg.js → openaiimage-DANcLuMm.js} +1 -1
  107. package/dist/assets/{pagination-ELGdaz7j.js → pagination-CEQQXX-i.js} +1 -1
  108. package/dist/assets/{pika-BAF6l290.js → pika-Bzkzkp_t.js} +1 -1
  109. package/dist/assets/{pixverse-BJvFBrxz.js → pixverse-B5bQRn77.js} +1 -1
  110. package/dist/assets/{popover-16RkdVJi.js → popover-Bepu0e_o.js} +1 -1
  111. package/dist/assets/{producer-CxO7cscK.js → producer-B_iWDSbj.js} +1 -1
  112. package/dist/assets/{qrart-0WA9rpIb.js → qrart-DKA_PLc0.js} +1 -1
  113. package/dist/assets/{realtime-CoA2jDea.js → realtime-D81YC2D9.js} +1 -1
  114. package/dist/assets/{row-CRSy6S6W.js → row-D7vv7DbD.js} +1 -1
  115. package/dist/assets/{seedance-BRns8oDe.js → seedance-Ctzbu76W.js} +1 -1
  116. package/dist/assets/{seedream-Cllu5lDC.js → seedream-CAszFcbp.js} +1 -1
  117. package/dist/assets/{select-C2lJsi1U.js → select-D1ecEVE2.js} +1 -1
  118. package/dist/assets/{serp-DlqrKTVv.js → serp-YeY7AwmD.js} +1 -1
  119. package/dist/assets/{slider-CJtlhVDv.js → slider-CnDUd5RD.js} +1 -1
  120. package/dist/assets/{solana-wallets-BJA3K50q.js → solana-wallets-Cgb31hGQ.js} +2 -2
  121. package/dist/assets/{solana-wallets-vue-CHM_FpgM.js → solana-wallets-vue-DP5882Md.js} +1 -1
  122. package/dist/assets/{sora-S4nnbv_N.js → sora-754Kj-Da.js} +1 -1
  123. package/dist/assets/{suno-Bm8b-qth.js → suno-CLD297Jq.js} +1 -1
  124. package/dist/assets/{switch-CajEVBL2.js → switch-AThus4zo.js} +1 -1
  125. package/dist/assets/{table-D52zahYJ.js → table-CIaHohEm.js} +1 -1
  126. package/dist/assets/{tabs-C1TlJELz.js → tabs-DOsgpnut.js} +1 -1
  127. package/dist/assets/{time-picker-CXlauI95.js → time-picker-DJtowCma.js} +1 -1
  128. package/dist/assets/{tooltip-BkUon2pU.js → tooltip-Bjypgs-B.js} +1 -1
  129. package/dist/assets/{upload-B1tP035s.js → upload-ClcuhdFZ.js} +1 -1
  130. package/dist/assets/{veo-c1QZgdv1.js → veo-BrapfU46.js} +1 -1
  131. package/dist/assets/{wan-D0PJDMNh.js → wan-NkMTvOZS.js} +1 -1
  132. package/dist/assets/{web-LqpzqkEy.js → web-8C0zPIoI.js} +1 -1
  133. package/dist/assets/{web-Cg7whtod.js → web-CN3kNCkN.js} +1 -1
  134. package/dist/assets/{web-ONirGE-P.js → web-CgFd_9kT.js} +1 -1
  135. package/dist/assets/{web-BykgVqQu.js → web-CxEfpw8Q.js} +1 -1
  136. package/dist/assets/{web-VYfY_jJM.js → web-bVmdIBUX.js} +1 -1
  137. package/dist/assets/{webextrator-HiW-X73y.js → webextrator-5yS8lt3q.js} +1 -1
  138. package/dist/index.html +1 -1
  139. package/package.json +1 -1
  140. package/dist/assets/esm-Ca6heW9L.js +0 -1
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Ut as c,Vt as l,Wt as u,Z as d,b as f,dt as p,et as m,k as h,tt as g,ut as _,v}from"./vendor-chart-BJCvKk8-.js";import{r as y,t as b}from"./select-C2lJsi1U.js";import{t as x}from"./upload-B1tP035s.js";import{t as S}from"./tooltip-BkUon2pU.js";import{t as C}from"./image-Dr945ixQ.js";import{t as w}from"./alert-BSWfT6uK.js";import{t as T}from"./drawer-Cu02szmr.js";import{t as E}from"./input-number-s6gXNw-j.js";import{t as D}from"./switch-CajEVBL2.js";import{$t as O,Bt as k,Ft as A,Gt as j,Ht as ee,Jt as te,Kt as ne,Lt as re,Pt as ie,Qt as M,Rt as ae,Ut as oe,Vt as se,Wt as ce,Xt as le,Yt as ue,Zt as de,en as N,in as P,nn as fe,qt as pe,rn as F,zt as I}from"./constants-CG3Vqtr2.js";import{$t as L,Bt as R,Gt as z,Ht as B,Ir as V,Qr as H,Ut as U,Vr as W,Vt as G,Wr as me,Xn as he,fn as ge,k as K,zr as q}from"./index-DrTotskf.js";import{t as J}from"./index.es-C5Wm6FW7.js";import{t as _e}from"./CopyToClipboard-DaB2iAye.js";import{t as Y}from"./ImagePreview-CbEvXym3.js";import{n as ve}from"./taskDrawerMixin-DEgO_R5H.js";import{t as ye}from"./Consumption-DBJ6FvEI.js";import{i as X,n as be,t as xe}from"./pagination-ELGdaz7j.js";import{t as Z}from"./VideoPlayer-CoSwPTjv.js";import{t as Se}from"./ApiCodeButton-DVDvpF39.js";import{t as Ce}from"./BotPlaceholder-DKqHzqLl.js";import{t as we}from"./NoTasks-CLNtgfi4.js";import{t as Te}from"./PromptTextarea-FYbsElB4.js";import{t as Ee}from"./ImageWrapper-C_Q6zeaX.js";var De=r({name:`LayoutSeedance`,components:{ElDrawer:T,ElButton:H,FontAwesomeIcon:J},mixins:[ve]}),Oe={class:`main flex flex-row flex-1`},ke={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function je(e,r,i,a,s,c){let l=g(`font-awesome-icon`),u=g(`el-button`),f=g(`el-drawer`);return d(),t(`div`,Oe,[n(`div`,ke,[m(e.$slots,`config`,{},void 0,!0)]),n(`div`,Ae,[m(e.$slots,`result`,{},void 0,!0)]),p(o(u,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:_(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[v,!e.tasksEmpty]]),o(f,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`350px`},{default:_(()=>[m(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Me=K(De,[[`render`,je],[`__scopeId`,`data-v-ec312952`]]),Ne=r({name:`SeedancePromptInput`,components:{PromptTextarea:Te},computed:{prompt:{get(){return this.$store.state.seedance?.config?.prompt},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Pe(e,t,n,r,i,o){let s=g(`prompt-textarea`);return d(),a(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedance.name.prompt`),info:e.$t(`seedance.description.prompt`),placeholder:e.$t(`seedance.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Fe=K(Ne,[[`render`,Pe]]),Ie=r({name:`SeedanceModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},data(){return{options:[{value:ce,label:this.$t(`seedance.model.seedance20`)},{value:j,label:this.$t(`seedance.model.seedance20Fast`)},{value:ne,label:this.$t(`seedance.model.seedance20Mini`)},{value:oe,label:this.$t(`seedance.model.seedance15pro`)},{value:se,label:this.$t(`seedance.model.seedance10pro`)},{value:ee,label:this.$t(`seedance.model.seedance10proFast`)},{value:k,label:this.$t(`seedance.model.seedance10liteT2v`)},{value:I,label:this.$t(`seedance.model.seedance10liteI2v`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.model},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,model:e})}}},mounted(){this.value||=ie}}),Le={class:`field`},Re={class:`label`},ze={class:`box`},Be={class:`title font-bold`};function Ve(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,Le,[n(`div`,Re,[n(`div`,ze,[n(`h2`,Be,u(r.$t(`seedance.name.model`)),1),o(m,{content:r.$t(`seedance.description.model`),class:`info`},null,8,[`content`])])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedance.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var He=K(Ie,[[`render`,Ve],[`__scopeId`,`data-v-deb4c429`]]),Ue=r({name:`SeedanceDurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},options(){let e=[];for(let t=this.capability.minDuration;t<=this.capability.maxDuration;t++)e.push({value:t,label:`${t}s`});return e},value:{get(){return this.$store.state.seedance?.config?.duration},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,duration:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=5},methods:{clampValue(){let e=this.value;e!==void 0&&(e<this.capability.minDuration||e>this.capability.maxDuration)&&(this.value=5)}}}),We={class:`field`},Ge={class:`label`},Ke={class:`box`},qe={class:`title font-bold`};function Je(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,We,[n(`div`,Ge,[n(`div`,Ke,[n(`h2`,qe,u(r.$t(`seedance.name.duration`)),1),o(m,{content:r.$t(`seedance.description.duration`),class:`info`},null,8,[`content`])])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedance.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ye=K(Ue,[[`render`,Je],[`__scopeId`,`data-v-216def8f`]]),Q={[O]:0,[N]:1,[M]:2,"4k":3},Xe=r({name:`SeedanceResolutionSelector`,components:{InfoIcon:X,ElTooltip:S},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},options(){let e=[{value:O,label:`480p`},{value:N,label:`720p`},{value:M,label:`1080p`},{value:`4k`,label:`4k`}],t=Q[this.capability.maxResolution]??Q[`1080p`];return e.map(e=>({...e,disabled:Q[e.value]>t}))},value:{get(){return this.$store.state.seedance?.config?.resolution},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,resolution:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=this.capability.defaultResolution||`720p`},methods:{onSelect(e){e.disabled||(this.value=e.value)},clampValue(){let e=this.value,t=this.options.find(t=>t.value===e);(!e||t&&t.disabled)&&(this.value=this.capability.defaultResolution||`720p`)}}}),Ze={class:`resolution`},Qe={class:`header`},$e={class:`title font-bold`},et={class:`items`},tt=[`onClick`];function nt(r,i,c,f,p,m){let h=g(`info-icon`),v=g(`el-tooltip`);return d(),t(`div`,Ze,[n(`div`,Qe,[n(`h2`,$e,u(r.$t(`seedance.name.resolution`)),1),o(h,{content:r.$t(`seedance.description.resolution`),class:`info`},null,8,[`content`])]),n(`div`,et,[(d(!0),t(s,null,e(r.options,e=>(d(),a(v,{key:e.value,content:r.$t(`seedance.message.resolutionNotSupported`),disabled:!e.disabled,placement:`top`},{default:_(()=>[n(`div`,{class:l([`item`,{active:r.value===e.value,disabled:e.disabled}]),onClick:t=>r.onSelect(e)},u(e.label),11,tt)]),_:2},1032,[`content`,`disabled`]))),128))])])}var rt=K(Xe,[[`render`,nt],[`__scopeId`,`data-v-db7e8aff`]]),it=r({name:`SeedanceRatioSelector`,components:{InfoIcon:X},computed:{options(){return[{value:te,label:`16:9`,w:32,h:18},{value:le,label:`9:16`,w:18,h:32},{value:`4:3`,label:`4:3`,w:28,h:21},{value:`3:4`,label:`3:4`,w:21,h:28},{value:`1:1`,label:`1:1`,w:24,h:24},{value:ue,label:`21:9`,w:34,h:14},{value:de,label:this.$t(`seedance.ratio.adaptive`),w:0,h:0}]},value:{get(){return this.$store.state.seedance?.config?.ratio},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,ratio:e})}}},mounted(){this.value||=A}}),at={class:`ratio`},ot={class:`header`},st={class:`title font-bold`},ct={class:`items`},lt=[`onClick`],ut={class:`preview`},dt={key:1,class:`rect rect-auto`},ft={class:`name`};function pt(r,i,a,f,p,m){let h=g(`info-icon`);return d(),t(`div`,at,[n(`div`,ot,[n(`h2`,st,u(r.$t(`seedance.name.ratio`)),1),o(h,{content:r.$t(`seedance.description.ratio`),class:`info`},null,8,[`content`])]),n(`div`,ct,[(d(!0),t(s,null,e(r.options,e=>(d(),t(`div`,{key:e.value,class:l([`item`,{active:r.value===e.value}]),onClick:t=>r.value=e.value},[n(`div`,ut,[e.w&&e.h?(d(),t(`div`,{key:0,class:`rect`,style:c({width:e.w+`px`,height:e.h+`px`})},null,4)):(d(),t(`div`,dt,`A`))]),n(`div`,ft,u(e.label),1)],10,lt))),128))])])}var mt=K(it,[[`render`,pt],[`__scopeId`,`data-v-8ddec2dd`]]),ht=r({name:`SeedanceGenerateAudioSwitch`,components:{ElSwitch:D,InfoIcon:X},computed:{isSupported(){let e=this.$store.state.seedance?.config?.model;return P(e).acceptsAudio},value:{get(){return this.$store.state.seedance?.config?.generate_audio??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,generate_audio:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),gt={key:0,class:`field`},_t={class:`label`},vt={class:`box`},yt={class:`title font-bold`},bt={class:`value`};function xt(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return e.isSupported?(d(),t(`div`,gt,[n(`div`,_t,[n(`div`,vt,[n(`h2`,yt,u(e.$t(`seedance.name.generateAudio`)),1),o(l,{content:e.$t(`seedance.description.generateAudio`),class:`info`},null,8,[`content`])])]),n(`div`,bt,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"inline-prompt":``,"active-text":e.$t(`seedance.button.on`),"inactive-text":e.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):h(``,!0)}var St=K(ht,[[`render`,xt],[`__scopeId`,`data-v-df51dfbd`]]),Ct=r({name:`SeedanceCameraFixedSwitch`,components:{ElSwitch:D,InfoIcon:X},computed:{value:{get(){return this.$store.state.seedance?.config?.camerafixed??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,camerafixed:e})}}},mounted(){this.$store.state.seedance?.config?.camerafixed===void 0&&(this.value=!1)}}),wt={class:`field`},Tt={class:`label`},Et={class:`box`},Dt={class:`title font-bold`},Ot={class:`value`};function kt(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return d(),t(`div`,wt,[n(`div`,Tt,[n(`div`,Et,[n(`h2`,Dt,u(e.$t(`seedance.name.cameraFixed`)),1),o(l,{content:e.$t(`seedance.description.cameraFixed`),class:`info`},null,8,[`content`])])]),n(`div`,Ot,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"inline-prompt":``,"active-text":e.$t(`seedance.button.on`),"inactive-text":e.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])}var At=K(Ct,[[`render`,kt],[`__scopeId`,`data-v-ae777d61`]]),jt=r({name:`SeedanceFirstFrameImage`,components:{ElUpload:x,ElButton:H,InfoIcon:X,FontAwesomeIcon:J,ImagePreview:Y},mixins:[U,G],data(){return{fileList:[],uploadUrl:q()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsImage"(e){e||(this.fileList=[],this.onSetFirstFrameUrl())}},methods:{onExceed(){W.warning(this.$t(`seedance.message.uploadExceed`))},onError(){W.error(this.$t(`seedance.message.uploadError`))},onSetFirstFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`first_frame`);e&&t.push({url:e,role:`first_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetFirstFrameUrl()},async onRemove(){this.onSetFirstFrameUrl()}}}),Mt={key:0,class:`relative`},Nt={class:`flex justify-between`},Pt={class:`flex justify-start items-center`},Ft={class:`text-sm font-bold`},It={key:0,class:`required-badge`};function Lt(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return e.capability.acceptsImage?(d(),t(`div`,Mt,[n(`div`,Nt,[n(`div`,Pt,[n(`span`,Ft,u(e.$t(`seedance.name.firstFrame`)),1),e.capability.requiresImage?(d(),t(`span`,It,u(e.$t(`seedance.name.required`)),1)):h(``,!0),o(p,{content:e.$t(`seedance.description.firstFrame`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var Rt=K(jt,[[`render`,Lt],[`__scopeId`,`data-v-e2597f23`]]),zt=r({name:`SeedanceLastFrameImage`,components:{ElUpload:x,ElButton:H,ImagePreview:Y,InfoIcon:X,FontAwesomeIcon:J},mixins:[U,G],data(){return{fileList:[],uploadUrl:q()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsLastFrame"(e){e||(this.fileList=[],this.onSetLastFrameUrl())}},methods:{onExceed(){W.warning(this.$t(`seedance.message.uploadExceed`))},onError(){W.error(this.$t(`seedance.message.uploadError`))},onSetLastFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`last_frame`);e&&t.push({url:e,role:`last_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetLastFrameUrl()},async onRemove(){this.onSetLastFrameUrl()}}}),Bt={key:0,class:`relative`},Vt={class:`flex justify-between`},Ht={class:`flex justify-start items-center`},Ut={class:`text-sm font-bold`};function Wt(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return e.capability.acceptsLastFrame?(d(),t(`div`,Bt,[n(`div`,Vt,[n(`div`,Ht,[n(`span`,Ut,u(e.$t(`seedance.name.lastFrame`)),1),o(p,{content:e.$t(`seedance.description.lastFrame`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var Gt=K(zt,[[`render`,Wt],[`__scopeId`,`data-v-3a191e51`]]),Kt=r({name:`SeedanceReferenceImage`,components:{ElUpload:x,ElButton:H,InfoIcon:X,FontAwesomeIcon:J,ImagePreview:Y},mixins:[U,G],data(){return{fileList:[],uploadUrl:q()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceImage"(e){e||(this.fileList=[],this.onSetReferenceImageUrls())}},methods:{onExceed(){W.warning(this.$t(`seedance.message.uploadExceed`))},onError(){W.error(this.$t(`seedance.message.uploadError`))},onSetReferenceImageUrls(){let e=(this.urls||[]).filter(Boolean),t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`reference_image`);e.forEach(e=>t.push({url:e,role:`reference_image`})),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetReferenceImageUrls()},async onRemove(){this.onSetReferenceImageUrls()}}}),qt={key:0,class:`relative`},Jt={class:`flex justify-between`},Yt={class:`flex justify-start items-center`},Xt={class:`text-sm font-bold`};function Zt(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return e.capability.acceptsReferenceImage?(d(),t(`div`,qt,[n(`div`,Jt,[n(`div`,Yt,[n(`span`,Xt,u(e.$t(`seedance.name.referenceImage`)),1),o(p,{content:e.$t(`seedance.description.referenceImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var Qt=K(Kt,[[`render`,Zt],[`__scopeId`,`data-v-230a67f6`]]),$t=r({name:`SeedanceReferenceAudio`,components:{ElUpload:x,ElButton:H,InfoIcon:X,FontAwesomeIcon:J},mixins:[G],data(){return{fileList:[],uploadUrl:q()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceAudio"(e){e||(this.fileList=[],this.onSetReferenceAudios())}},methods:{onExceed(){W.warning(this.$t(`seedance.message.uploadExceed`))},onError(){W.error(this.$t(`seedance.message.uploadError`))},onSetReferenceAudios(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,audios:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceAudios()},async onRemove(){this.onSetReferenceAudios()}}}),en={key:0,class:`relative`},tn={class:`flex justify-between`},nn={class:`flex justify-start items-center`},rn={class:`text-sm font-bold`};function an(e,r,a,s,c,l){let f=g(`info-icon`),p=g(`font-awesome-icon`),m=g(`el-button`),v=g(`el-upload`);return e.capability.acceptsReferenceAudio?(d(),t(`div`,en,[n(`div`,tn,[n(`div`,nn,[n(`span`,rn,u(e.$t(`seedance.name.referenceAudio`)),1),o(f,{content:e.$t(`seedance.description.referenceAudio`)},null,8,[`content`])])]),o(v,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.mp3,.wav,.m4a,.aac,.ogg,.flac`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`text`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{default:_(()=>[o(m,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(p,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var on=K($t,[[`render`,an],[`__scopeId`,`data-v-49515675`]]),sn=r({name:`SeedanceReferenceVideo`,components:{ElUpload:x,ElButton:H,InfoIcon:X,FontAwesomeIcon:J},mixins:[G],data(){return{fileList:[],uploadUrl:q()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceVideo"(e){e||(this.fileList=[],this.onSetReferenceVideos())}},methods:{onExceed(){W.warning(this.$t(`seedance.message.uploadExceed`))},onError(){W.error(this.$t(`seedance.message.uploadError`))},onSetReferenceVideos(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,videos:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceVideos()},async onRemove(){this.onSetReferenceVideos()}}}),cn={key:0,class:`relative`},ln={class:`flex justify-between`},un={class:`flex justify-start items-center`},dn={class:`text-sm font-bold`};function fn(e,r,a,s,c,l){let f=g(`info-icon`),p=g(`font-awesome-icon`),m=g(`el-button`),v=g(`el-upload`);return e.capability.acceptsReferenceVideo?(d(),t(`div`,cn,[n(`div`,ln,[n(`div`,un,[n(`span`,dn,u(e.$t(`seedance.name.referenceVideo`)),1),o(f,{content:e.$t(`seedance.description.referenceVideo`)},null,8,[`content`])])]),o(v,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.mp4,.mov,.webm,.mkv,.avi`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`text`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{default:_(()=>[o(m,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(p,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var pn=K(sn,[[`render`,fn],[`__scopeId`,`data-v-b212c474`]]),mn=r({name:`SeedanceServiceTierSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},data(){return{options:[{value:fe,label:this.$t(`seedance.serviceTier.default`)},{value:F,label:this.$t(`seedance.serviceTier.flex`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.service_tier},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,service_tier:e})}}},mounted(){this.value||=re}}),hn={class:`field`},gn={class:`label`},_n={class:`box`},vn={class:`title font-bold`};function yn(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,hn,[n(`div`,gn,[n(`div`,_n,[n(`h2`,vn,u(r.$t(`seedance.name.serviceTier`)),1),o(m,{content:r.$t(`seedance.description.serviceTier`),class:`info`},null,8,[`content`])])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedance.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var bn=K(mn,[[`render`,yn],[`__scopeId`,`data-v-cc938de2`]]),xn=r({name:`SeedanceReturnLastFrameSwitch`,components:{ElSwitch:D,InfoIcon:X},computed:{model(){return this.$store.state.seedance?.config?.model},isSupported(){return P(this.model).acceptsReturnLastFrame},value:{get(){return this.$store.state.seedance?.config?.return_last_frame},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,return_last_frame:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),Sn={key:0,class:`field`},Cn={class:`label`},wn={class:`box`},Tn={class:`title font-bold`},En={class:`value`};function Dn(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return e.isSupported?(d(),t(`div`,Sn,[n(`div`,Cn,[n(`div`,wn,[n(`h2`,Tn,u(e.$t(`seedance.name.returnLastFrame`)),1),o(l,{content:e.$t(`seedance.description.returnLastFrame`),class:`info`},null,8,[`content`])])]),n(`div`,En,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"inline-prompt":``,"active-text":e.$t(`seedance.button.on`),"inactive-text":e.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):h(``,!0)}var On=K(xn,[[`render`,Dn],[`__scopeId`,`data-v-edea5451`]]),kn=r({name:`SeedanceSeedInput`,components:{ElInputNumber:E,InfoIcon:X},computed:{value:{get(){let e=this.$store.state.seedance?.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.$store.state.seedance?.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedance/setConfig`,t)}}}}),An={class:`field`},jn={class:`label`},Mn={class:`box`},Nn={class:`title font-bold`},Pn={class:`value`};function Fn(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-input-number`);return d(),t(`div`,An,[n(`div`,jn,[n(`div`,Mn,[n(`h2`,Nn,u(e.$t(`seedance.name.seed`)),1),o(l,{content:e.$t(`seedance.description.seed`),class:`info`},null,8,[`content`])])]),n(`div`,Pn,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])}var In=r({name:`SeedanceConfigPanel`,components:{ElButton:H,FontAwesomeIcon:J,PromptInput:Fe,ModelSelector:He,DurationSelector:Ye,ResolutionSelector:rt,RatioSelector:mt,GenerateAudioSwitch:St,CameraFixedSwitch:At,ServiceTierSelector:bn,ReturnLastFrameSwitch:On,SeedInput:K(kn,[[`render`,Fn],[`__scopeId`,`data-v-685a9869`]]),FirstFrameImage:Rt,LastFrameImage:Gt,ReferenceImage:Qt,ReferenceAudio:on,ReferenceVideo:pn,Consumption:ye},emits:[`generate`],computed:{config(){return this.$store.state.seedance?.config},consumption(){return z(this.config,this.service?.cost)},service(){return this.$store.state.seedance?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ln={class:`flex flex-col h-full`},Rn={class:`flex-1 overflow-y-auto p-5`},zn={class:`flex flex-col items-center justify-center px-5 pb-5`};function Bn(e,r,a,s,c,l){let f=g(`prompt-input`),p=g(`model-selector`),m=g(`ratio-selector`),h=g(`resolution-selector`),v=g(`duration-selector`),y=g(`service-tier-selector`),b=g(`generate-audio-switch`),x=g(`camera-fixed-switch`),S=g(`return-last-frame-switch`),C=g(`seed-input`),w=g(`first-frame-image`),T=g(`last-frame-image`),E=g(`reference-image`),D=g(`reference-audio`),O=g(`reference-video`),k=g(`consumption`),A=g(`font-awesome-icon`),j=g(`el-button`);return d(),t(`div`,Ln,[n(`div`,Rn,[o(f,{class:`mb-4`}),o(p,{class:`mb-4`}),o(m,{class:`mb-4`}),o(h,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`}),o(b,{class:`mb-4`}),o(x,{class:`mb-4`}),o(S,{class:`mb-4`}),o(C,{class:`mb-4`}),o(w,{class:`mb-2`}),o(T,{class:`mb-2`}),o(E,{class:`mb-2`}),o(D,{class:`mb-2`}),o(O,{class:`mb-2`})]),n(`div`,zn,[o(k,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(j,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:_(()=>[o(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`seedance.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Vn=K(In,[[`render`,Bn]]),Hn=r({name:`AudioPreview`,components:{FontAwesomeIcon:J},props:{url:{type:String,required:!0},name:{type:String,required:!1,default:`audio`}},data(){return{playing:!1}},methods:{onToggle(){let e=this.$refs.audio;e&&(e.paused?e.play().catch(()=>{this.playing=!1}):e.pause())}}}),Un=[`title`],Wn=[`src`];function Gn(e,r,i,a,s,c){let l=g(`font-awesome-icon`);return d(),t(`div`,{class:`audio-preview w-[50px] h-[50px] relative rounded-[var(--el-border-radius-base)] overflow-hidden shadow-sm cursor-pointer flex items-center justify-center`,title:e.name,onClick:r[3]||=f((...t)=>e.onToggle&&e.onToggle(...t),[`stop`])},[o(l,{icon:e.playing?`fa-solid fa-pause`:`fa-solid fa-music`,class:`icon text-white text-[16px]`},null,8,[`icon`]),n(`audio`,{ref:`audio`,src:e.url,preload:`none`,onPlay:r[0]||=t=>e.playing=!0,onPause:r[1]||=t=>e.playing=!1,onEnded:r[2]||=t=>e.playing=!1},null,40,Wn)],8,Un)}var Kn=K(Hn,[[`render`,Gn],[`__scopeId`,`data-v-66cf67f6`]]),qn=r({name:`VideoPreview`,components:{ElDialog:me,FontAwesomeIcon:J,VideoPlayer:Z},props:{url:{type:String,required:!0},name:{type:String,required:!1,default:`video`}},data(){return{open:!1}}}),Jn=[`title`],Yn=[`src`],Xn={class:`overlay absolute inset-0 flex items-center justify-center bg-[rgba(0,0,0,0.25)]`};function Zn(e,r,i,a,s,c){let l=g(`font-awesome-icon`),u=g(`video-player`),p=g(`el-dialog`);return d(),t(`div`,{class:`video-preview w-[50px] h-[50px] relative rounded-[var(--el-border-radius-base)] overflow-hidden shadow-sm cursor-pointer bg-[var(--el-fill-color-darker)]`,title:e.name,onClick:r[2]||=f(t=>e.open=!0,[`stop`])},[n(`video`,{class:`w-full h-full object-cover`,src:`${e.url}#t=0.1`,muted:``,preload:`metadata`,playsinline:``},null,8,Yn),n(`div`,Xn,[o(l,{icon:`fa-solid fa-play`,class:`text-white text-[14px]`})]),o(p,{modelValue:e.open,"onUpdate:modelValue":r[0]||=t=>e.open=t,width:`640`,"align-center":``,"append-to-body":``,"destroy-on-close":``,class:`video-preview-dialog`,onClick:r[1]||=f(()=>{},[`stop`])},{default:_(()=>[o(u,{src:e.url},null,8,[`src`])]),_:1},8,[`modelValue`])],8,Jn)}var Qn=r({name:`SeedanceTaskPreview`,components:{ElImage:C,CopyToClipboard:_e,FontAwesomeIcon:J,ElAlert:w,VideoPlayer:Z,ElTooltip:S,ElButton:H,ImageWrapper:Ee,ImagePreview:Y,AudioPreview:Kn,VideoPreview:K(qn,[[`render`,Zn],[`__scopeId`,`data-v-d4752590`]]),ApiCodeButton:Se},props:{modelValue:{type:Object,required:!0}},data(){return{seedanceLogo:ae}},computed:{video(){return this.modelValue?.response?.data},promptText(){let e=this.modelValue?.request;if(e?.prompt)return e.prompt;let t=e?.content?.find(e=>e?.type===`text`&&e?.text);return t?.text?t.text:this.video?.prompt},referenceImages(){let e=this.collectImages();if(e.length===0)return[];let t=[],n=e.find(e=>e?.role===`first_frame`);n?.url&&t.push({url:n.url,name:`first-frame`});let r=e.find(e=>e?.role===`last_frame`);return r?.url&&t.push({url:r.url,name:`last-frame`}),e.forEach((e,n)=>{e?.url&&e.role!==`first_frame`&&e.role!==`last_frame`&&t.push({url:e.url,name:e.role||`image-${n}`})}),t},referenceAudios(){let e=this.modelValue?.request,t=(e?.audios??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`audio_url`&&e?.audio_url?.url&&t.push(e.audio_url.url)}),t},referenceVideos(){let e=this.modelValue?.request,t=(e?.videos??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`video_url`&&e?.video_url?.url&&t.push(e.video_url.url)}),t}},methods:{collectImages(){let e=this.modelValue?.request,t=Array.isArray(e?.images)?[...e.images]:[];return(e?.content??[]).forEach(e=>{e?.type===`image_url`&&e?.image_url?.url&&t.push({url:e.image_url.url,role:e.role})}),t},onDownload(e){window.open(e,`_blank`)}}}),$n={class:`preview`},er={class:`left`},tr={class:`main`},nr={class:`bot`},rr={class:`datetime`},ir={class:`info`},ar={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},or={key:1,class:`prompt mt-2`},sr={key:0},cr={key:1},lr={key:0,class:l({content:!0})},ur={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},dr={key:1,class:l({content:!0})},fr={key:0,class:`mb-4`},pr={key:1,class:`mb-4`},mr={key:2,class:l({operations:!0,"mt-2":!0,"mb-2":!0})},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gr={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_r={key:0},vr={key:1},yr={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},br={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xr={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Sr={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Cr={key:2,class:l({content:!0})},wr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Er={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dr={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Or={key:3,class:l({content:!0})},kr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ar={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function jr(r,c,l,p,m,v){let y=g(`el-image`),b=g(`image-preview`),x=g(`audio-preview`),S=g(`video-preview`),C=g(`font-awesome-icon`),w=g(`copy-to-clipboard`),T=g(`el-alert`),E=g(`video-player`),D=g(`image-wrapper`),O=g(`el-button`),k=g(`el-tooltip`),A=g(`api-code-button`);return d(),t(`div`,$n,[n(`div`,er,[o(y,{src:r.seedanceLogo,class:`avatar`},null,8,[`src`])]),n(`div`,tr,[n(`div`,nr,[i(u(r.$t(`seedance.name.seedanceBot`))+` `,1),n(`span`,rr,u(r.$dayjs.format(``+new Date(parseFloat((r.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,ir,[r.referenceImages.length>0||r.referenceAudios.length>0||r.referenceVideos.length>0?(d(),t(`div`,ar,[(d(!0),t(s,null,e(r.referenceImages,(e,t)=>(d(),a(b,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(d(!0),t(s,null,e(r.referenceAudios,(e,t)=>(d(),a(x,{key:`audio-${t}`,url:e,name:`audio-${t+1}`},null,8,[`url`,`name`]))),128)),(d(!0),t(s,null,e(r.referenceVideos,(e,t)=>(d(),a(S,{key:`video-${t}`,url:e,name:`video-${t+1}`},null,8,[`url`,`name`]))),128))])):h(``,!0),r.promptText?(d(),t(`p`,or,[i(u(r.promptText)+` `,1),r.modelValue?.response?r.video?.status===`processing`||r.video?.status===`pending`?(d(),t(`span`,cr,` - (`+u(r.$t(`seedance.status.processing`))+`) `,1)):h(``,!0):(d(),t(`span`,sr,` - (`+u(r.$t(`seedance.status.pending`))+`) `,1))])):h(``,!0)]),r.modelValue?.response?r.modelValue?.response?.success===!0?(d(),t(`div`,dr,[r.video?.video_url?(d(),t(`div`,fr,[o(E,{src:r.video?.video_url},null,8,[`src`])])):h(``,!0),r.video?.last_frame_url?(d(),t(`div`,pr,[o(D,{src:r.video?.last_frame_url,"raw-src":r.video?.last_frame_url},null,8,[`src`,`raw-src`])])):h(``,!0),r.video?.video_url?(d(),t(`div`,mr,[o(k,{class:`box-item`,effect:`dark`,content:r.$t(`seedance.message.downloadVideo`),placement:`top-start`},{default:_(()=>[o(O,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=f(e=>r.onDownload(r.video?.video_url),[`stop`])},{default:_(()=>[i(u(r.$t(`seedance.button.download`)),1)]),_:1})]),_:1},8,[`content`]),o(A,{path:`/seedance/videos`,body:r.modelValue?.request},null,8,[`body`])])):h(``,!0),o(T,{closable:!1,class:`mt-2 success`},{default:_(()=>[r.modelValue?.request?.model?(d(),t(`p`,$,[o(C,{icon:`fa-solid fa-cube`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.model`))+`: `+u(r.modelValue?.request?.model),1)])):h(``,!0),r.video?.duration?(d(),t(`p`,hr,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.duration`))+`: `+u(r.video?.duration)+`s `,1)])):h(``,!0),r.video?.resolution?(d(),t(`p`,gr,[o(C,{icon:`fa-solid fa-expand`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.resolution`))+`: `+u(r.video?.resolution)+` `,1),r.video?.ratio?(d(),t(`span`,_r,` · `+u(r.video?.ratio),1)):h(``,!0),r.video?.framespersecond?(d(),t(`span`,vr,` · `+u(r.video?.framespersecond)+`fps`,1)):h(``,!0)])):h(``,!0),r.modelValue?.request?.generate_audio?(d(),t(`p`,yr,[o(C,{icon:`fa-solid fa-volume-up`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.generateAudio`))+`: `+u(r.$t(`seedance.button.on`)),1)])):h(``,!0),n(`p`,br,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.elapsed?(d(),t(`p`,xr,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0),r.modelValue?.response?.trace_id?(d(),t(`p`,Sr,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(w,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0)]),_:1})])):r.modelValue?.response?.success===!1?(d(),t(`div`,Cr,[o(T,{closable:!1,class:`failure`},{template:_(()=>[o(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.failure`)),1)]),default:_(()=>[n(`p`,wr,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.response?.error?.message?(d(),t(`p`,Tr,[o(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.failureReason`))+`: `+u(r.modelValue?.response?.error?.message)+` `,1),o(w,{content:r.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0),r.modelValue?.elapsed?(d(),t(`p`,Er,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0),r.modelValue?.response?.trace_id?(d(),t(`p`,Dr,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(w,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0)]),_:1})])):(d(),t(`div`,Or,[o(T,{closable:!1,class:`info`},{template:_(()=>[o(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.status`)),1)]),default:_(()=>[n(`p`,kr,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.response?.trace_id?(d(),t(`p`,Ar,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(w,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0)]),_:1})])):(d(),t(`div`,lr,[o(T,{closable:!1,class:`info`},{template:_(()=>[o(C,{icon:`fa-regular fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.status.pending`)),1)]),default:_(()=>[n(`p`,ur,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var Mr=r({name:`SeedanceRecentPanel`,components:{TaskPreview:K(Qn,[[`render`,jr],[`__scopeId`,`data-v-be65e8a9`]]),BotPlaceholder:Ce,NoTasks:we,ScrollList:be},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedance?.tasks,items:this.$store.state.seedance?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Nr={key:0},Pr={key:2,class:`w-full h-full flex items-center justify-center`};function Fr(n,r,i,c,l,u){let f=g(`bot-placeholder`),p=g(`task-preview`),m=g(`scroll-list`),v=g(`no-tasks`);return d(),t(s,null,[n.tasks?.items===void 0?(d(),t(`div`,Nr,[o(f)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(d(),a(m,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:_(()=>[(d(!0),t(s,null,e(n.tasks?.items,e=>(d(),a(p,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):h(``,!0),n.tasks?.items?.length===0?(d(),t(`div`,Pr,[o(v)])):h(``,!0)],64)}var Ir=r({name:`SeedanceIndex`,components:{ConfigPanel:Vn,Layout:Me,RecentPanel:K(Mr,[[`render`,Fr]])},mixins:[B],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.seedance?.status?.getApplications===V.Request},tasksLoading(){return this.$store.state.seedance?.status?.getTasks===V.Request||this.fetchingTasks},credential(){return this.$store.state.seedance?.credential},config(){return this.$store.state.seedance?.config},tasks(){return this.$store.state.seedance?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await xe({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`seedance/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`seedance/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!R(this.uploadTracker,e=>this.$t(e),e=>W.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.images)){e.images=e.images.filter(e=>!!e?.url);let t=e.images.some(e=>e?.role===`first_frame`),n=e.images.some(e=>e?.role===`last_frame`);!t&&n&&(e.images=e.images.map(e=>e?.role===`last_frame`?{...e,role:`first_frame`}:e))}let t=Array.isArray(e?.images)&&e.images.length>0;if(!t&&`images`in e&&delete e.images,e?.model&&!pe[e.model]){W.warning(this.$t(`seedance.message.modelUnsupported`));return}let n=P(e?.model);if(n.requiresImage&&!t){W.warning(this.$t(`seedance.message.modelRequiresImage`));return}if(!n.acceptsImage&&t){W.warning(this.$t(`seedance.message.modelRejectsImage`));return}if(!n.acceptsText&&!t){W.warning(this.$t(`seedance.message.modelRequiresImage`));return}!n.acceptsAudio&&e.generate_audio&&(e.generate_audio=!1),!n.acceptsReturnLastFrame&&e.return_last_frame&&(e.return_last_frame=!1),!n.acceptsLastFrame&&t&&(e.images=e.images.filter(e=>e?.role!==`last_frame`)),n.acceptsReferenceAudio&&Array.isArray(e?.audios)&&(e.audios=e.audios.filter(e=>e?.url)),(!n.acceptsReferenceAudio||!Array.isArray(e?.audios)||e.audios.length===0)&&delete e.audios,n.acceptsReferenceVideo&&Array.isArray(e?.videos)&&(e.videos=e.videos.filter(e=>e?.url)),(!n.acceptsReferenceVideo||!Array.isArray(e?.videos)||e.videos.length===0)&&delete e.videos,!n.acceptsReferenceImage&&Array.isArray(e?.images)&&(e.images=e.images.filter(e=>e?.role!==`reference_image`),e.images.length===0&&delete e.images);let r=Array.isArray(e?.images)&&e.images.some(e=>e?.role===`reference_image`);if(Array.isArray(e?.audios)&&e.audios.length>0&&!r){W.warning(this.$t(`seedance.message.audioRequiresReferenceImage`));return}let i={...e,async:!0};if(!L())return;let a=this.credential?.token;if(!a){console.error(`no token specified`);return}W.info(this.$t(`seedance.message.startingTask`)),he(`seedance`,ge.generate(i,{token:a})).then(()=>{W.success(this.$t(`seedance.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?W.error(this.$t(`seedance.message.usedUp`)):W.error(this.$t(`seedance.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Lr(e,t,n,r,i,s){let c=g(`config-panel`),l=g(`recent-panel`),u=g(`layout`);return d(),a(u,null,{config:_(()=>[o(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:_(()=>[o(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Rr=K(Ir,[[`render`,Lr]]);export{Rr as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Ut as c,Vt as l,Wt as u,Z as d,b as f,dt as p,et as m,k as h,tt as g,ut as _,v}from"./vendor-chart-BJCvKk8-.js";import{r as y,t as b}from"./select-D1ecEVE2.js";import{t as x}from"./upload-ClcuhdFZ.js";import{t as S}from"./tooltip-Bjypgs-B.js";import{t as C}from"./image-BTRKceWr.js";import{t as w}from"./alert-BMYM_Vr-.js";import{t as T}from"./drawer-yIAwJ7En.js";import{t as E}from"./input-number-Cg10sUMa.js";import{t as D}from"./switch-AThus4zo.js";import{$t as O,Bt as k,Ft as A,Gt as j,Ht as ee,Jt as te,Kt as ne,Lt as re,Pt as ie,Qt as M,Rt as ae,Ut as oe,Vt as se,Wt as ce,Xt as le,Yt as ue,Zt as de,en as N,in as P,nn as fe,qt as pe,rn as F,zt as I}from"./constants-CG3Vqtr2.js";import{$t as L,Bt as R,Gt as z,Ht as B,Ir as V,Qr as H,Ut as U,Vr as W,Vt as G,Wr as me,Xn as he,fn as ge,k as K,zr as q}from"./index-C8ufQprS.js";import{t as J}from"./index.es-D_ksxY2f.js";import{t as _e}from"./CopyToClipboard-DOIyE45l.js";import{t as Y}from"./ImagePreview-h9Y8nGAq.js";import{n as ve}from"./taskDrawerMixin-DEgO_R5H.js";import{t as ye}from"./Consumption-yJBcaOnM.js";import{i as X,n as be,t as xe}from"./pagination-CEQQXX-i.js";import{t as Z}from"./VideoPlayer-DWEb8C-E.js";import{t as Se}from"./ApiCodeButton-BNuNdq4D.js";import{t as Ce}from"./BotPlaceholder-CsEE_kEM.js";import{t as we}from"./NoTasks-QEMQL-Gn.js";import{t as Te}from"./PromptTextarea-DDKIJKMv.js";import{t as Ee}from"./ImageWrapper-CWfsDw_F.js";var De=r({name:`LayoutSeedance`,components:{ElDrawer:T,ElButton:H,FontAwesomeIcon:J},mixins:[ve]}),Oe={class:`main flex flex-row flex-1`},ke={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function je(e,r,i,a,s,c){let l=g(`font-awesome-icon`),u=g(`el-button`),f=g(`el-drawer`);return d(),t(`div`,Oe,[n(`div`,ke,[m(e.$slots,`config`,{},void 0,!0)]),n(`div`,Ae,[m(e.$slots,`result`,{},void 0,!0)]),p(o(u,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:_(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[v,!e.tasksEmpty]]),o(f,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`350px`},{default:_(()=>[m(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Me=K(De,[[`render`,je],[`__scopeId`,`data-v-ec312952`]]),Ne=r({name:`SeedancePromptInput`,components:{PromptTextarea:Te},computed:{prompt:{get(){return this.$store.state.seedance?.config?.prompt},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Pe(e,t,n,r,i,o){let s=g(`prompt-textarea`);return d(),a(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedance.name.prompt`),info:e.$t(`seedance.description.prompt`),placeholder:e.$t(`seedance.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Fe=K(Ne,[[`render`,Pe]]),Ie=r({name:`SeedanceModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},data(){return{options:[{value:ce,label:this.$t(`seedance.model.seedance20`)},{value:j,label:this.$t(`seedance.model.seedance20Fast`)},{value:ne,label:this.$t(`seedance.model.seedance20Mini`)},{value:oe,label:this.$t(`seedance.model.seedance15pro`)},{value:se,label:this.$t(`seedance.model.seedance10pro`)},{value:ee,label:this.$t(`seedance.model.seedance10proFast`)},{value:k,label:this.$t(`seedance.model.seedance10liteT2v`)},{value:I,label:this.$t(`seedance.model.seedance10liteI2v`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.model},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,model:e})}}},mounted(){this.value||=ie}}),Le={class:`field`},Re={class:`label`},ze={class:`box`},Be={class:`title font-bold`};function Ve(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,Le,[n(`div`,Re,[n(`div`,ze,[n(`h2`,Be,u(r.$t(`seedance.name.model`)),1),o(m,{content:r.$t(`seedance.description.model`),class:`info`},null,8,[`content`])])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedance.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var He=K(Ie,[[`render`,Ve],[`__scopeId`,`data-v-deb4c429`]]),Ue=r({name:`SeedanceDurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},options(){let e=[];for(let t=this.capability.minDuration;t<=this.capability.maxDuration;t++)e.push({value:t,label:`${t}s`});return e},value:{get(){return this.$store.state.seedance?.config?.duration},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,duration:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=5},methods:{clampValue(){let e=this.value;e!==void 0&&(e<this.capability.minDuration||e>this.capability.maxDuration)&&(this.value=5)}}}),We={class:`field`},Ge={class:`label`},Ke={class:`box`},qe={class:`title font-bold`};function Je(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,We,[n(`div`,Ge,[n(`div`,Ke,[n(`h2`,qe,u(r.$t(`seedance.name.duration`)),1),o(m,{content:r.$t(`seedance.description.duration`),class:`info`},null,8,[`content`])])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedance.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ye=K(Ue,[[`render`,Je],[`__scopeId`,`data-v-216def8f`]]),Q={[O]:0,[N]:1,[M]:2,"4k":3},Xe=r({name:`SeedanceResolutionSelector`,components:{InfoIcon:X,ElTooltip:S},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},options(){let e=[{value:O,label:`480p`},{value:N,label:`720p`},{value:M,label:`1080p`},{value:`4k`,label:`4k`}],t=Q[this.capability.maxResolution]??Q[`1080p`];return e.map(e=>({...e,disabled:Q[e.value]>t}))},value:{get(){return this.$store.state.seedance?.config?.resolution},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,resolution:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=this.capability.defaultResolution||`720p`},methods:{onSelect(e){e.disabled||(this.value=e.value)},clampValue(){let e=this.value,t=this.options.find(t=>t.value===e);(!e||t&&t.disabled)&&(this.value=this.capability.defaultResolution||`720p`)}}}),Ze={class:`resolution`},Qe={class:`header`},$e={class:`title font-bold`},et={class:`items`},tt=[`onClick`];function nt(r,i,c,f,p,m){let h=g(`info-icon`),v=g(`el-tooltip`);return d(),t(`div`,Ze,[n(`div`,Qe,[n(`h2`,$e,u(r.$t(`seedance.name.resolution`)),1),o(h,{content:r.$t(`seedance.description.resolution`),class:`info`},null,8,[`content`])]),n(`div`,et,[(d(!0),t(s,null,e(r.options,e=>(d(),a(v,{key:e.value,content:r.$t(`seedance.message.resolutionNotSupported`),disabled:!e.disabled,placement:`top`},{default:_(()=>[n(`div`,{class:l([`item`,{active:r.value===e.value,disabled:e.disabled}]),onClick:t=>r.onSelect(e)},u(e.label),11,tt)]),_:2},1032,[`content`,`disabled`]))),128))])])}var rt=K(Xe,[[`render`,nt],[`__scopeId`,`data-v-db7e8aff`]]),it=r({name:`SeedanceRatioSelector`,components:{InfoIcon:X},computed:{options(){return[{value:te,label:`16:9`,w:32,h:18},{value:le,label:`9:16`,w:18,h:32},{value:`4:3`,label:`4:3`,w:28,h:21},{value:`3:4`,label:`3:4`,w:21,h:28},{value:`1:1`,label:`1:1`,w:24,h:24},{value:ue,label:`21:9`,w:34,h:14},{value:de,label:this.$t(`seedance.ratio.adaptive`),w:0,h:0}]},value:{get(){return this.$store.state.seedance?.config?.ratio},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,ratio:e})}}},mounted(){this.value||=A}}),at={class:`ratio`},ot={class:`header`},st={class:`title font-bold`},ct={class:`items`},lt=[`onClick`],ut={class:`preview`},dt={key:1,class:`rect rect-auto`},ft={class:`name`};function pt(r,i,a,f,p,m){let h=g(`info-icon`);return d(),t(`div`,at,[n(`div`,ot,[n(`h2`,st,u(r.$t(`seedance.name.ratio`)),1),o(h,{content:r.$t(`seedance.description.ratio`),class:`info`},null,8,[`content`])]),n(`div`,ct,[(d(!0),t(s,null,e(r.options,e=>(d(),t(`div`,{key:e.value,class:l([`item`,{active:r.value===e.value}]),onClick:t=>r.value=e.value},[n(`div`,ut,[e.w&&e.h?(d(),t(`div`,{key:0,class:`rect`,style:c({width:e.w+`px`,height:e.h+`px`})},null,4)):(d(),t(`div`,dt,`A`))]),n(`div`,ft,u(e.label),1)],10,lt))),128))])])}var mt=K(it,[[`render`,pt],[`__scopeId`,`data-v-8ddec2dd`]]),ht=r({name:`SeedanceGenerateAudioSwitch`,components:{ElSwitch:D,InfoIcon:X},computed:{isSupported(){let e=this.$store.state.seedance?.config?.model;return P(e).acceptsAudio},value:{get(){return this.$store.state.seedance?.config?.generate_audio??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,generate_audio:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),gt={key:0,class:`field`},_t={class:`label`},vt={class:`box`},yt={class:`title font-bold`},bt={class:`value`};function xt(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return e.isSupported?(d(),t(`div`,gt,[n(`div`,_t,[n(`div`,vt,[n(`h2`,yt,u(e.$t(`seedance.name.generateAudio`)),1),o(l,{content:e.$t(`seedance.description.generateAudio`),class:`info`},null,8,[`content`])])]),n(`div`,bt,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"inline-prompt":``,"active-text":e.$t(`seedance.button.on`),"inactive-text":e.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):h(``,!0)}var St=K(ht,[[`render`,xt],[`__scopeId`,`data-v-df51dfbd`]]),Ct=r({name:`SeedanceCameraFixedSwitch`,components:{ElSwitch:D,InfoIcon:X},computed:{value:{get(){return this.$store.state.seedance?.config?.camerafixed??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,camerafixed:e})}}},mounted(){this.$store.state.seedance?.config?.camerafixed===void 0&&(this.value=!1)}}),wt={class:`field`},Tt={class:`label`},Et={class:`box`},Dt={class:`title font-bold`},Ot={class:`value`};function kt(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return d(),t(`div`,wt,[n(`div`,Tt,[n(`div`,Et,[n(`h2`,Dt,u(e.$t(`seedance.name.cameraFixed`)),1),o(l,{content:e.$t(`seedance.description.cameraFixed`),class:`info`},null,8,[`content`])])]),n(`div`,Ot,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"inline-prompt":``,"active-text":e.$t(`seedance.button.on`),"inactive-text":e.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])}var At=K(Ct,[[`render`,kt],[`__scopeId`,`data-v-ae777d61`]]),jt=r({name:`SeedanceFirstFrameImage`,components:{ElUpload:x,ElButton:H,InfoIcon:X,FontAwesomeIcon:J,ImagePreview:Y},mixins:[U,G],data(){return{fileList:[],uploadUrl:q()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsImage"(e){e||(this.fileList=[],this.onSetFirstFrameUrl())}},methods:{onExceed(){W.warning(this.$t(`seedance.message.uploadExceed`))},onError(){W.error(this.$t(`seedance.message.uploadError`))},onSetFirstFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`first_frame`);e&&t.push({url:e,role:`first_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetFirstFrameUrl()},async onRemove(){this.onSetFirstFrameUrl()}}}),Mt={key:0,class:`relative`},Nt={class:`flex justify-between`},Pt={class:`flex justify-start items-center`},Ft={class:`text-sm font-bold`},It={key:0,class:`required-badge`};function Lt(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return e.capability.acceptsImage?(d(),t(`div`,Mt,[n(`div`,Nt,[n(`div`,Pt,[n(`span`,Ft,u(e.$t(`seedance.name.firstFrame`)),1),e.capability.requiresImage?(d(),t(`span`,It,u(e.$t(`seedance.name.required`)),1)):h(``,!0),o(p,{content:e.$t(`seedance.description.firstFrame`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var Rt=K(jt,[[`render`,Lt],[`__scopeId`,`data-v-e2597f23`]]),zt=r({name:`SeedanceLastFrameImage`,components:{ElUpload:x,ElButton:H,ImagePreview:Y,InfoIcon:X,FontAwesomeIcon:J},mixins:[U,G],data(){return{fileList:[],uploadUrl:q()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsLastFrame"(e){e||(this.fileList=[],this.onSetLastFrameUrl())}},methods:{onExceed(){W.warning(this.$t(`seedance.message.uploadExceed`))},onError(){W.error(this.$t(`seedance.message.uploadError`))},onSetLastFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`last_frame`);e&&t.push({url:e,role:`last_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetLastFrameUrl()},async onRemove(){this.onSetLastFrameUrl()}}}),Bt={key:0,class:`relative`},Vt={class:`flex justify-between`},Ht={class:`flex justify-start items-center`},Ut={class:`text-sm font-bold`};function Wt(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return e.capability.acceptsLastFrame?(d(),t(`div`,Bt,[n(`div`,Vt,[n(`div`,Ht,[n(`span`,Ut,u(e.$t(`seedance.name.lastFrame`)),1),o(p,{content:e.$t(`seedance.description.lastFrame`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var Gt=K(zt,[[`render`,Wt],[`__scopeId`,`data-v-3a191e51`]]),Kt=r({name:`SeedanceReferenceImage`,components:{ElUpload:x,ElButton:H,InfoIcon:X,FontAwesomeIcon:J,ImagePreview:Y},mixins:[U,G],data(){return{fileList:[],uploadUrl:q()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceImage"(e){e||(this.fileList=[],this.onSetReferenceImageUrls())}},methods:{onExceed(){W.warning(this.$t(`seedance.message.uploadExceed`))},onError(){W.error(this.$t(`seedance.message.uploadError`))},onSetReferenceImageUrls(){let e=(this.urls||[]).filter(Boolean),t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`reference_image`);e.forEach(e=>t.push({url:e,role:`reference_image`})),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetReferenceImageUrls()},async onRemove(){this.onSetReferenceImageUrls()}}}),qt={key:0,class:`relative`},Jt={class:`flex justify-between`},Yt={class:`flex justify-start items-center`},Xt={class:`text-sm font-bold`};function Zt(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return e.capability.acceptsReferenceImage?(d(),t(`div`,qt,[n(`div`,Jt,[n(`div`,Yt,[n(`span`,Xt,u(e.$t(`seedance.name.referenceImage`)),1),o(p,{content:e.$t(`seedance.description.referenceImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var Qt=K(Kt,[[`render`,Zt],[`__scopeId`,`data-v-230a67f6`]]),$t=r({name:`SeedanceReferenceAudio`,components:{ElUpload:x,ElButton:H,InfoIcon:X,FontAwesomeIcon:J},mixins:[G],data(){return{fileList:[],uploadUrl:q()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceAudio"(e){e||(this.fileList=[],this.onSetReferenceAudios())}},methods:{onExceed(){W.warning(this.$t(`seedance.message.uploadExceed`))},onError(){W.error(this.$t(`seedance.message.uploadError`))},onSetReferenceAudios(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,audios:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceAudios()},async onRemove(){this.onSetReferenceAudios()}}}),en={key:0,class:`relative`},tn={class:`flex justify-between`},nn={class:`flex justify-start items-center`},rn={class:`text-sm font-bold`};function an(e,r,a,s,c,l){let f=g(`info-icon`),p=g(`font-awesome-icon`),m=g(`el-button`),v=g(`el-upload`);return e.capability.acceptsReferenceAudio?(d(),t(`div`,en,[n(`div`,tn,[n(`div`,nn,[n(`span`,rn,u(e.$t(`seedance.name.referenceAudio`)),1),o(f,{content:e.$t(`seedance.description.referenceAudio`)},null,8,[`content`])])]),o(v,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.mp3,.wav,.m4a,.aac,.ogg,.flac`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`text`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{default:_(()=>[o(m,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(p,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var on=K($t,[[`render`,an],[`__scopeId`,`data-v-49515675`]]),sn=r({name:`SeedanceReferenceVideo`,components:{ElUpload:x,ElButton:H,InfoIcon:X,FontAwesomeIcon:J},mixins:[G],data(){return{fileList:[],uploadUrl:q()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return P(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceVideo"(e){e||(this.fileList=[],this.onSetReferenceVideos())}},methods:{onExceed(){W.warning(this.$t(`seedance.message.uploadExceed`))},onError(){W.error(this.$t(`seedance.message.uploadError`))},onSetReferenceVideos(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,videos:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceVideos()},async onRemove(){this.onSetReferenceVideos()}}}),cn={key:0,class:`relative`},ln={class:`flex justify-between`},un={class:`flex justify-start items-center`},dn={class:`text-sm font-bold`};function fn(e,r,a,s,c,l){let f=g(`info-icon`),p=g(`font-awesome-icon`),m=g(`el-button`),v=g(`el-upload`);return e.capability.acceptsReferenceVideo?(d(),t(`div`,cn,[n(`div`,ln,[n(`div`,un,[n(`span`,dn,u(e.$t(`seedance.name.referenceVideo`)),1),o(f,{content:e.$t(`seedance.description.referenceVideo`)},null,8,[`content`])])]),o(v,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.mp4,.mov,.webm,.mkv,.avi`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`text`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{default:_(()=>[o(m,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(p,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var pn=K(sn,[[`render`,fn],[`__scopeId`,`data-v-b212c474`]]),mn=r({name:`SeedanceServiceTierSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},data(){return{options:[{value:fe,label:this.$t(`seedance.serviceTier.default`)},{value:F,label:this.$t(`seedance.serviceTier.flex`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.service_tier},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,service_tier:e})}}},mounted(){this.value||=re}}),hn={class:`field`},gn={class:`label`},_n={class:`box`},vn={class:`title font-bold`};function yn(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,hn,[n(`div`,gn,[n(`div`,_n,[n(`h2`,vn,u(r.$t(`seedance.name.serviceTier`)),1),o(m,{content:r.$t(`seedance.description.serviceTier`),class:`info`},null,8,[`content`])])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedance.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var bn=K(mn,[[`render`,yn],[`__scopeId`,`data-v-cc938de2`]]),xn=r({name:`SeedanceReturnLastFrameSwitch`,components:{ElSwitch:D,InfoIcon:X},computed:{model(){return this.$store.state.seedance?.config?.model},isSupported(){return P(this.model).acceptsReturnLastFrame},value:{get(){return this.$store.state.seedance?.config?.return_last_frame},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,return_last_frame:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),Sn={key:0,class:`field`},Cn={class:`label`},wn={class:`box`},Tn={class:`title font-bold`},En={class:`value`};function Dn(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return e.isSupported?(d(),t(`div`,Sn,[n(`div`,Cn,[n(`div`,wn,[n(`h2`,Tn,u(e.$t(`seedance.name.returnLastFrame`)),1),o(l,{content:e.$t(`seedance.description.returnLastFrame`),class:`info`},null,8,[`content`])])]),n(`div`,En,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"inline-prompt":``,"active-text":e.$t(`seedance.button.on`),"inactive-text":e.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):h(``,!0)}var On=K(xn,[[`render`,Dn],[`__scopeId`,`data-v-edea5451`]]),kn=r({name:`SeedanceSeedInput`,components:{ElInputNumber:E,InfoIcon:X},computed:{value:{get(){let e=this.$store.state.seedance?.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.$store.state.seedance?.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedance/setConfig`,t)}}}}),An={class:`field`},jn={class:`label`},Mn={class:`box`},Nn={class:`title font-bold`},Pn={class:`value`};function Fn(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-input-number`);return d(),t(`div`,An,[n(`div`,jn,[n(`div`,Mn,[n(`h2`,Nn,u(e.$t(`seedance.name.seed`)),1),o(l,{content:e.$t(`seedance.description.seed`),class:`info`},null,8,[`content`])])]),n(`div`,Pn,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])}var In=r({name:`SeedanceConfigPanel`,components:{ElButton:H,FontAwesomeIcon:J,PromptInput:Fe,ModelSelector:He,DurationSelector:Ye,ResolutionSelector:rt,RatioSelector:mt,GenerateAudioSwitch:St,CameraFixedSwitch:At,ServiceTierSelector:bn,ReturnLastFrameSwitch:On,SeedInput:K(kn,[[`render`,Fn],[`__scopeId`,`data-v-685a9869`]]),FirstFrameImage:Rt,LastFrameImage:Gt,ReferenceImage:Qt,ReferenceAudio:on,ReferenceVideo:pn,Consumption:ye},emits:[`generate`],computed:{config(){return this.$store.state.seedance?.config},consumption(){return z(this.config,this.service?.cost)},service(){return this.$store.state.seedance?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ln={class:`flex flex-col h-full`},Rn={class:`flex-1 overflow-y-auto p-5`},zn={class:`flex flex-col items-center justify-center px-5 pb-5`};function Bn(e,r,a,s,c,l){let f=g(`prompt-input`),p=g(`model-selector`),m=g(`ratio-selector`),h=g(`resolution-selector`),v=g(`duration-selector`),y=g(`service-tier-selector`),b=g(`generate-audio-switch`),x=g(`camera-fixed-switch`),S=g(`return-last-frame-switch`),C=g(`seed-input`),w=g(`first-frame-image`),T=g(`last-frame-image`),E=g(`reference-image`),D=g(`reference-audio`),O=g(`reference-video`),k=g(`consumption`),A=g(`font-awesome-icon`),j=g(`el-button`);return d(),t(`div`,Ln,[n(`div`,Rn,[o(f,{class:`mb-4`}),o(p,{class:`mb-4`}),o(m,{class:`mb-4`}),o(h,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`}),o(b,{class:`mb-4`}),o(x,{class:`mb-4`}),o(S,{class:`mb-4`}),o(C,{class:`mb-4`}),o(w,{class:`mb-2`}),o(T,{class:`mb-2`}),o(E,{class:`mb-2`}),o(D,{class:`mb-2`}),o(O,{class:`mb-2`})]),n(`div`,zn,[o(k,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(j,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:_(()=>[o(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`seedance.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Vn=K(In,[[`render`,Bn]]),Hn=r({name:`AudioPreview`,components:{FontAwesomeIcon:J},props:{url:{type:String,required:!0},name:{type:String,required:!1,default:`audio`}},data(){return{playing:!1}},methods:{onToggle(){let e=this.$refs.audio;e&&(e.paused?e.play().catch(()=>{this.playing=!1}):e.pause())}}}),Un=[`title`],Wn=[`src`];function Gn(e,r,i,a,s,c){let l=g(`font-awesome-icon`);return d(),t(`div`,{class:`audio-preview w-[50px] h-[50px] relative rounded-[var(--el-border-radius-base)] overflow-hidden shadow-sm cursor-pointer flex items-center justify-center`,title:e.name,onClick:r[3]||=f((...t)=>e.onToggle&&e.onToggle(...t),[`stop`])},[o(l,{icon:e.playing?`fa-solid fa-pause`:`fa-solid fa-music`,class:`icon text-white text-[16px]`},null,8,[`icon`]),n(`audio`,{ref:`audio`,src:e.url,preload:`none`,onPlay:r[0]||=t=>e.playing=!0,onPause:r[1]||=t=>e.playing=!1,onEnded:r[2]||=t=>e.playing=!1},null,40,Wn)],8,Un)}var Kn=K(Hn,[[`render`,Gn],[`__scopeId`,`data-v-66cf67f6`]]),qn=r({name:`VideoPreview`,components:{ElDialog:me,FontAwesomeIcon:J,VideoPlayer:Z},props:{url:{type:String,required:!0},name:{type:String,required:!1,default:`video`}},data(){return{open:!1}}}),Jn=[`title`],Yn=[`src`],Xn={class:`overlay absolute inset-0 flex items-center justify-center bg-[rgba(0,0,0,0.25)]`};function Zn(e,r,i,a,s,c){let l=g(`font-awesome-icon`),u=g(`video-player`),p=g(`el-dialog`);return d(),t(`div`,{class:`video-preview w-[50px] h-[50px] relative rounded-[var(--el-border-radius-base)] overflow-hidden shadow-sm cursor-pointer bg-[var(--el-fill-color-darker)]`,title:e.name,onClick:r[2]||=f(t=>e.open=!0,[`stop`])},[n(`video`,{class:`w-full h-full object-cover`,src:`${e.url}#t=0.1`,muted:``,preload:`metadata`,playsinline:``},null,8,Yn),n(`div`,Xn,[o(l,{icon:`fa-solid fa-play`,class:`text-white text-[14px]`})]),o(p,{modelValue:e.open,"onUpdate:modelValue":r[0]||=t=>e.open=t,width:`640`,"align-center":``,"append-to-body":``,"destroy-on-close":``,class:`video-preview-dialog`,onClick:r[1]||=f(()=>{},[`stop`])},{default:_(()=>[o(u,{src:e.url},null,8,[`src`])]),_:1},8,[`modelValue`])],8,Jn)}var Qn=r({name:`SeedanceTaskPreview`,components:{ElImage:C,CopyToClipboard:_e,FontAwesomeIcon:J,ElAlert:w,VideoPlayer:Z,ElTooltip:S,ElButton:H,ImageWrapper:Ee,ImagePreview:Y,AudioPreview:Kn,VideoPreview:K(qn,[[`render`,Zn],[`__scopeId`,`data-v-d4752590`]]),ApiCodeButton:Se},props:{modelValue:{type:Object,required:!0}},data(){return{seedanceLogo:ae}},computed:{video(){return this.modelValue?.response?.data},promptText(){let e=this.modelValue?.request;if(e?.prompt)return e.prompt;let t=e?.content?.find(e=>e?.type===`text`&&e?.text);return t?.text?t.text:this.video?.prompt},referenceImages(){let e=this.collectImages();if(e.length===0)return[];let t=[],n=e.find(e=>e?.role===`first_frame`);n?.url&&t.push({url:n.url,name:`first-frame`});let r=e.find(e=>e?.role===`last_frame`);return r?.url&&t.push({url:r.url,name:`last-frame`}),e.forEach((e,n)=>{e?.url&&e.role!==`first_frame`&&e.role!==`last_frame`&&t.push({url:e.url,name:e.role||`image-${n}`})}),t},referenceAudios(){let e=this.modelValue?.request,t=(e?.audios??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`audio_url`&&e?.audio_url?.url&&t.push(e.audio_url.url)}),t},referenceVideos(){let e=this.modelValue?.request,t=(e?.videos??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`video_url`&&e?.video_url?.url&&t.push(e.video_url.url)}),t}},methods:{collectImages(){let e=this.modelValue?.request,t=Array.isArray(e?.images)?[...e.images]:[];return(e?.content??[]).forEach(e=>{e?.type===`image_url`&&e?.image_url?.url&&t.push({url:e.image_url.url,role:e.role})}),t},onDownload(e){window.open(e,`_blank`)}}}),$n={class:`preview`},er={class:`left`},tr={class:`main`},nr={class:`bot`},rr={class:`datetime`},ir={class:`info`},ar={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},or={key:1,class:`prompt mt-2`},sr={key:0},cr={key:1},lr={key:0,class:l({content:!0})},ur={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},dr={key:1,class:l({content:!0})},fr={key:0,class:`mb-4`},pr={key:1,class:`mb-4`},mr={key:2,class:l({operations:!0,"mt-2":!0,"mb-2":!0})},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gr={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_r={key:0},vr={key:1},yr={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},br={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xr={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Sr={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Cr={key:2,class:l({content:!0})},wr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Er={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dr={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Or={key:3,class:l({content:!0})},kr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ar={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function jr(r,c,l,p,m,v){let y=g(`el-image`),b=g(`image-preview`),x=g(`audio-preview`),S=g(`video-preview`),C=g(`font-awesome-icon`),w=g(`copy-to-clipboard`),T=g(`el-alert`),E=g(`video-player`),D=g(`image-wrapper`),O=g(`el-button`),k=g(`el-tooltip`),A=g(`api-code-button`);return d(),t(`div`,$n,[n(`div`,er,[o(y,{src:r.seedanceLogo,class:`avatar`},null,8,[`src`])]),n(`div`,tr,[n(`div`,nr,[i(u(r.$t(`seedance.name.seedanceBot`))+` `,1),n(`span`,rr,u(r.$dayjs.format(``+new Date(parseFloat((r.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,ir,[r.referenceImages.length>0||r.referenceAudios.length>0||r.referenceVideos.length>0?(d(),t(`div`,ar,[(d(!0),t(s,null,e(r.referenceImages,(e,t)=>(d(),a(b,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(d(!0),t(s,null,e(r.referenceAudios,(e,t)=>(d(),a(x,{key:`audio-${t}`,url:e,name:`audio-${t+1}`},null,8,[`url`,`name`]))),128)),(d(!0),t(s,null,e(r.referenceVideos,(e,t)=>(d(),a(S,{key:`video-${t}`,url:e,name:`video-${t+1}`},null,8,[`url`,`name`]))),128))])):h(``,!0),r.promptText?(d(),t(`p`,or,[i(u(r.promptText)+` `,1),r.modelValue?.response?r.video?.status===`processing`||r.video?.status===`pending`?(d(),t(`span`,cr,` - (`+u(r.$t(`seedance.status.processing`))+`) `,1)):h(``,!0):(d(),t(`span`,sr,` - (`+u(r.$t(`seedance.status.pending`))+`) `,1))])):h(``,!0)]),r.modelValue?.response?r.modelValue?.response?.success===!0?(d(),t(`div`,dr,[r.video?.video_url?(d(),t(`div`,fr,[o(E,{src:r.video?.video_url},null,8,[`src`])])):h(``,!0),r.video?.last_frame_url?(d(),t(`div`,pr,[o(D,{src:r.video?.last_frame_url,"raw-src":r.video?.last_frame_url},null,8,[`src`,`raw-src`])])):h(``,!0),r.video?.video_url?(d(),t(`div`,mr,[o(k,{class:`box-item`,effect:`dark`,content:r.$t(`seedance.message.downloadVideo`),placement:`top-start`},{default:_(()=>[o(O,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=f(e=>r.onDownload(r.video?.video_url),[`stop`])},{default:_(()=>[i(u(r.$t(`seedance.button.download`)),1)]),_:1})]),_:1},8,[`content`]),o(A,{path:`/seedance/videos`,body:r.modelValue?.request},null,8,[`body`])])):h(``,!0),o(T,{closable:!1,class:`mt-2 success`},{default:_(()=>[r.modelValue?.request?.model?(d(),t(`p`,$,[o(C,{icon:`fa-solid fa-cube`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.model`))+`: `+u(r.modelValue?.request?.model),1)])):h(``,!0),r.video?.duration?(d(),t(`p`,hr,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.duration`))+`: `+u(r.video?.duration)+`s `,1)])):h(``,!0),r.video?.resolution?(d(),t(`p`,gr,[o(C,{icon:`fa-solid fa-expand`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.resolution`))+`: `+u(r.video?.resolution)+` `,1),r.video?.ratio?(d(),t(`span`,_r,` · `+u(r.video?.ratio),1)):h(``,!0),r.video?.framespersecond?(d(),t(`span`,vr,` · `+u(r.video?.framespersecond)+`fps`,1)):h(``,!0)])):h(``,!0),r.modelValue?.request?.generate_audio?(d(),t(`p`,yr,[o(C,{icon:`fa-solid fa-volume-up`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.generateAudio`))+`: `+u(r.$t(`seedance.button.on`)),1)])):h(``,!0),n(`p`,br,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.elapsed?(d(),t(`p`,xr,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0),r.modelValue?.response?.trace_id?(d(),t(`p`,Sr,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(w,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0)]),_:1})])):r.modelValue?.response?.success===!1?(d(),t(`div`,Cr,[o(T,{closable:!1,class:`failure`},{template:_(()=>[o(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.failure`)),1)]),default:_(()=>[n(`p`,wr,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.response?.error?.message?(d(),t(`p`,Tr,[o(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.failureReason`))+`: `+u(r.modelValue?.response?.error?.message)+` `,1),o(w,{content:r.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0),r.modelValue?.elapsed?(d(),t(`p`,Er,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0),r.modelValue?.response?.trace_id?(d(),t(`p`,Dr,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(w,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0)]),_:1})])):(d(),t(`div`,Or,[o(T,{closable:!1,class:`info`},{template:_(()=>[o(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.status`)),1)]),default:_(()=>[n(`p`,kr,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.response?.trace_id?(d(),t(`p`,Ar,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(w,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0)]),_:1})])):(d(),t(`div`,lr,[o(T,{closable:!1,class:`info`},{template:_(()=>[o(C,{icon:`fa-regular fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.status.pending`)),1)]),default:_(()=>[n(`p`,ur,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var Mr=r({name:`SeedanceRecentPanel`,components:{TaskPreview:K(Qn,[[`render`,jr],[`__scopeId`,`data-v-be65e8a9`]]),BotPlaceholder:Ce,NoTasks:we,ScrollList:be},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedance?.tasks,items:this.$store.state.seedance?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Nr={key:0},Pr={key:2,class:`w-full h-full flex items-center justify-center`};function Fr(n,r,i,c,l,u){let f=g(`bot-placeholder`),p=g(`task-preview`),m=g(`scroll-list`),v=g(`no-tasks`);return d(),t(s,null,[n.tasks?.items===void 0?(d(),t(`div`,Nr,[o(f)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(d(),a(m,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:_(()=>[(d(!0),t(s,null,e(n.tasks?.items,e=>(d(),a(p,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):h(``,!0),n.tasks?.items?.length===0?(d(),t(`div`,Pr,[o(v)])):h(``,!0)],64)}var Ir=r({name:`SeedanceIndex`,components:{ConfigPanel:Vn,Layout:Me,RecentPanel:K(Mr,[[`render`,Fr]])},mixins:[B],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.seedance?.status?.getApplications===V.Request},tasksLoading(){return this.$store.state.seedance?.status?.getTasks===V.Request||this.fetchingTasks},credential(){return this.$store.state.seedance?.credential},config(){return this.$store.state.seedance?.config},tasks(){return this.$store.state.seedance?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await xe({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`seedance/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`seedance/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!R(this.uploadTracker,e=>this.$t(e),e=>W.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.images)){e.images=e.images.filter(e=>!!e?.url);let t=e.images.some(e=>e?.role===`first_frame`),n=e.images.some(e=>e?.role===`last_frame`);!t&&n&&(e.images=e.images.map(e=>e?.role===`last_frame`?{...e,role:`first_frame`}:e))}let t=Array.isArray(e?.images)&&e.images.length>0;if(!t&&`images`in e&&delete e.images,e?.model&&!pe[e.model]){W.warning(this.$t(`seedance.message.modelUnsupported`));return}let n=P(e?.model);if(n.requiresImage&&!t){W.warning(this.$t(`seedance.message.modelRequiresImage`));return}if(!n.acceptsImage&&t){W.warning(this.$t(`seedance.message.modelRejectsImage`));return}if(!n.acceptsText&&!t){W.warning(this.$t(`seedance.message.modelRequiresImage`));return}!n.acceptsAudio&&e.generate_audio&&(e.generate_audio=!1),!n.acceptsReturnLastFrame&&e.return_last_frame&&(e.return_last_frame=!1),!n.acceptsLastFrame&&t&&(e.images=e.images.filter(e=>e?.role!==`last_frame`)),n.acceptsReferenceAudio&&Array.isArray(e?.audios)&&(e.audios=e.audios.filter(e=>e?.url)),(!n.acceptsReferenceAudio||!Array.isArray(e?.audios)||e.audios.length===0)&&delete e.audios,n.acceptsReferenceVideo&&Array.isArray(e?.videos)&&(e.videos=e.videos.filter(e=>e?.url)),(!n.acceptsReferenceVideo||!Array.isArray(e?.videos)||e.videos.length===0)&&delete e.videos,!n.acceptsReferenceImage&&Array.isArray(e?.images)&&(e.images=e.images.filter(e=>e?.role!==`reference_image`),e.images.length===0&&delete e.images);let r=Array.isArray(e?.images)&&e.images.some(e=>e?.role===`reference_image`);if(Array.isArray(e?.audios)&&e.audios.length>0&&!r){W.warning(this.$t(`seedance.message.audioRequiresReferenceImage`));return}let i={...e,async:!0};if(!L())return;let a=this.credential?.token;if(!a){console.error(`no token specified`);return}W.info(this.$t(`seedance.message.startingTask`)),he(`seedance`,ge.generate(i,{token:a})).then(()=>{W.success(this.$t(`seedance.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?W.error(this.$t(`seedance.message.usedUp`)):W.error(this.$t(`seedance.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Lr(e,t,n,r,i,s){let c=g(`config-panel`),l=g(`recent-panel`),u=g(`layout`);return d(),a(u,null,{config:_(()=>[o(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:_(()=>[o(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Rr=K(Ir,[[`render`,Lr]]);export{Rr as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Vt as c,Wt as l,Z as u,b as d,k as f,tt as p,ut as m}from"./vendor-chart-BJCvKk8-.js";import{r as h,t as g}from"./select-C2lJsi1U.js";import{t as _}from"./upload-B1tP035s.js";import{t as v}from"./tooltip-BkUon2pU.js";import{t as y}from"./image-Dr945ixQ.js";import{t as b}from"./alert-BSWfT6uK.js";import{Wn as x}from"./constants-CG3Vqtr2.js";import{$t as S,Bt as C,Gt as w,Ht as ee,Ir as T,Qr as E,Sn as D,Ut as O,Vr as k,Vt as te,Xn as A,k as j,zr as M}from"./index-DrTotskf.js";import{t as N}from"./index.es-C5Wm6FW7.js";import{t as P}from"./CopyToClipboard-DaB2iAye.js";import{t as F}from"./ImagePreview-CbEvXym3.js";import{t as I}from"./Consumption-DBJ6FvEI.js";import{i as L,n as R,t as z}from"./pagination-ELGdaz7j.js";import{t as B}from"./VideoPlayer-CoSwPTjv.js";import{t as V}from"./ApiCodeButton-DVDvpF39.js";import{t as H}from"./BotPlaceholder-DKqHzqLl.js";import{t as U}from"./NoTasks-CLNtgfi4.js";import{t as W}from"./Hailuo-agXgxdZB.js";import{t as G}from"./PromptTextarea-FYbsElB4.js";var K=r({name:`ModelSelector`,components:{ElSelect:h,ElOption:g},data(){return{}},computed:{options(){return[{value:`minimax-t2v`,label:this.$t(`hailuo.button.model1`)},{value:`minimax-i2v`,label:this.$t(`hailuo.button.model2`)},{value:`minimax-i2v-director`,label:this.$t(`hailuo.button.model3`)}]},value:{get(){return this.$store.state.hailuo?.config?.model},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,model:e})}}},mounted(){this.value||=x}}),q={class:`field`},J={class:`title font-bold`},Y={class:`float-left`};function X(r,i,c,d,f,h){let g=p(`el-option`),_=p(`el-select`);return u(),t(`div`,q,[n(`h2`,J,l(r.$t(`hailuo.name.model`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`hailuo.placeholder.select`),clearable:``},{default:m(()=>[(u(!0),t(s,null,e(r.options,e=>(u(),a(g,{key:e.value,label:e.label,value:e.value},{default:m(()=>[n(`span`,Y,l(e.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Z=j(K,[[`render`,X],[`__scopeId`,`data-v-a768fbd9`]]),Q=r({name:`StartImageUrlInput`,components:{ElUpload:_,ElButton:E,InfoIcon:L,ImagePreview:F},mixins:[O,te],data(){return{fileList:[],uploadUrl:M()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.hailuo?.config?.first_image_url},set(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){k.warning(this.$t(`hailuo.message.uploadStartImageExceed`))},onError(){k.error(this.$t(`hailuo.message.uploadStartImageError`))},async onRemove(){k.error(this.$t(`hailuo.message.uploadStartImageError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),ne={class:`relative`},re={class:`flex justify-between`},ie={class:`flex justify-start items-center`},ae={class:`text-sm font-bold`};function oe(e,r,s,c,d,h){let g=p(`info-icon`),_=p(`image-preview`),v=p(`el-button`),y=p(`el-upload`);return u(),t(`div`,ne,[n(`div`,re,[n(`div`,ie,[n(`span`,ae,l(e.$t(`hailuo.name.startImageUrl`)),1),o(g,{content:e.$t(`hailuo.description.startImageUrl`),class:`info`},null,8,[`content`])])]),o(y,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,"show-file-list":!0,limit:1,multiple:!1,"list-type":`picture`,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:t})=>[t.url&&t.percentage!==void 0?(u(),a(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):f(``,!0)]),default:m(()=>[o(v,{size:`small`,type:`primary`,class:`btn btn-upload`,round:``},{default:m(()=>[i(l(e.$t(`hailuo.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])])}var se=j(Q,[[`render`,oe],[`__scopeId`,`data-v-fbf49b06`]]),ce=r({name:`PromptInput`,components:{PromptTextarea:G},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function le(e,t,n,r,i,o){let s=p(`prompt-textarea`);return u(),a(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`hailuo.name.prompt`),info:e.$t(`hailuo.description.prompt`),placeholder:e.$t(`hailuo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ue=r({name:`PresetPanel`,components:{ElButton:E,FontAwesomeIcon:N,PromptInput:j(ce,[[`render`,le]]),StartImageUrlInput:se,ModelSelector:Z,Consumption:I},emits:[`generate`],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return w(this.config,this.service?.cost)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),de={class:`flex flex-col h-full`},fe={class:`flex-1 overflow-y-auto p-5`},pe={class:`flex flex-col items-center justify-center px-5 pb-5`};function me(e,r,s,c,d,h){let g=p(`prompt-input`),_=p(`model-selector`),v=p(`start-image-url-input`),y=p(`consumption`),b=p(`font-awesome-icon`),x=p(`el-button`);return u(),t(`div`,de,[n(`div`,fe,[o(g,{class:`mb-4`}),o(_,{class:`mb-4`}),e.config?.model===`minimax-i2v`?(u(),a(v,{key:0,class:`mb-2`})):f(``,!0)]),n(`div`,pe,[o(y,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),e.config?.video_url!==void 0||e.config?.custom?(u(),a(x,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:m(()=>[o(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.$t(`hailuo.button.extend`)),1)]),_:1},8,[`onClick`])):(u(),a(x,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:m(()=>[o(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.$t(`hailuo.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var he=j(ue,[[`render`,me]]),ge=r({name:`TaskPreview`,components:{ElImage:y,CopyToClipboard:P,FontAwesomeIcon:N,ElAlert:b,VideoPlayer:B,ElTooltip:v,ElButton:E,ApiCodeButton:V},props:{modelValue:{type:Object,required:!0}},computed:{application(){return this.$store.state.hailuo?.application},config(){return this.$store.state.hailuo?.config},video(){return this.modelValue?.response?.data?.[0]}},methods:{onDownload(e){console.debug(`on download hailuo video`,e),window.open(e,`_blank`)}}}),_e={class:`preview`},ve={class:`left`},ye={class:`main`},be={class:`bot`},xe={class:`datetime`},Se={class:`info`},Ce={key:0,class:`prompt mt-2`},we={key:0},Te={key:1},Ee={key:0,class:c({content:!0,failed:!0})},De={key:0,class:`mb-4`},Oe={key:1,class:c({operations:!0,"mt-2":!0})},ke={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ae={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},je={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Me={key:1,class:c({content:!0})},Ne={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pe={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Fe={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ie={key:2,class:c({content:!0})},Le={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Re(e,r,s,c,h,g){let _=p(`el-image`),v=p(`video-player`),y=p(`el-button`),b=p(`el-tooltip`),x=p(`api-code-button`),S=p(`font-awesome-icon`),C=p(`copy-to-clipboard`),w=p(`el-alert`);return u(),t(`div`,_e,[n(`div`,ve,[o(_,{src:`https://cdn.acedata.cloud/0qg4gp.png`,class:`avatar`})]),n(`div`,ye,[n(`div`,be,[i(l(e.$t(`hailuo.name.hailuoBot`))+` `,1),n(`span`,xe,l(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,Se,[e.modelValue?.request?.prompt?(u(),t(`p`,Ce,[i(l(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?f(``,!0):(u(),t(`span`,we,` - (`+l(e.$t(`hailuo.status.pending`))+`) `,1)),e.video?.state===`processing`||e.video?.state===`pending`||e.video?.state===`running`?(u(),t(`span`,Te,` - (`+l(e.$t(`hailuo.status.processing`))+`) `,1)):f(``,!0)])):f(``,!0)]),e.modelValue?.response?.success===!0?(u(),t(`div`,Ee,[e.video?.video_url?(u(),t(`div`,De,[o(v,{src:e.video?.video_url},null,8,[`src`])])):f(``,!0),e.video?(u(),t(`div`,Oe,[o(b,{class:`box-item`,effect:`dark`,content:e.$t(`hailuo.message.downloadVideo`),placement:`top-start`},{default:m(()=>[e.video?.video_url?(u(),a(y,{key:0,type:`info`,size:`small`,class:`mb-2`,onClick:r[0]||=d(t=>e.onDownload(e.video?.video_url),[`stop`])},{default:m(()=>[i(l(e.$t(`hailuo.button.download`)),1)]),_:1})):f(``,!0)]),_:1},8,[`content`]),o(x,{path:`/hailuo/videos`,body:e.modelValue?.request},null,8,[`body`])])):f(``,!0),o(w,{closable:!1,class:`mt-2 success`},{default:m(()=>[e.modelValue?.request?.model?(u(),t(`p`,ke,[o(S,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.model`))+`: `+l(e.modelValue?.request?.model)+` `,1),o(C,{content:e.modelValue?.id},null,8,[`content`])])):f(``,!0),n(`p`,Ae,[o(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),o(C,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.elapsed?(u(),t(`p`,je,[o(S,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.elapsed`))+`: `+l(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):f(``,!0)]),_:1})])):f(``,!0),e.modelValue?.response?.success===!1?(u(),t(`div`,Me,[o(w,{closable:!1,class:`failure`},{template:m(()=>[o(S,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.failure`)),1)]),default:m(()=>[n(`p`,Ne,[o(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),o(C,{content:e.modelValue?.id},null,8,[`content`])]),n(`p`,Pe,[o(S,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.failureReason`))+`: `+l(e.modelValue?.response?.error?.message)+` `,1),o(C,{content:e.modelValue?.response?.error?.message},null,8,[`content`])]),e.modelValue?.elapsed?(u(),t(`p`,$,[o(S,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.elapsed`))+`: `+l(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):f(``,!0),n(`p`,Fe,[o(S,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.traceId`))+`: `+l(e.modelValue?.response?.trace_id)+` `,1),o(C,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):f(``,!0),e.modelValue?.response?.success===void 0?(u(),t(`div`,Ie,[o(w,{closable:!1,class:`info`},{template:m(()=>[o(S,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.failure`)),1)]),default:m(()=>[n(`p`,Le,[o(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),o(C,{content:e.modelValue?.id},null,8,[`content`])])]),_:1})])):f(``,!0)])])}var ze=r({name:`RecentPanel`,components:{TaskPreview:j(ge,[[`render`,Re],[`__scopeId`,`data-v-53d13da4`]]),BotPlaceholder:H,NoTasks:U,ScrollList:R},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.hailuo?.tasks,items:this.$store.state.hailuo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Be={key:0},Ve={key:2,class:`w-full h-full flex items-center justify-center`};function He(n,r,i,c,l,d){let h=p(`bot-placeholder`),g=p(`task-preview`),_=p(`scroll-list`),v=p(`no-tasks`);return u(),t(s,null,[n.tasks?.items===void 0?(u(),t(`div`,Be,[o(h)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(u(),a(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:m(()=>[(u(!0),t(s,null,e(n.tasks?.items,e=>(u(),a(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):f(``,!0),n.tasks?.items?.length===0?(u(),t(`div`,Ve,[o(v)])):f(``,!0)],64)}var Ue=r({name:`HailuoIndex`,components:{ConfigPanel:he,Layout:W,RecentPanel:j(ze,[[`render`,He]])},mixins:[ee],inject:[`initialized`],data(){return{task:void 0,job:0,timer:void 0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.hailuo?.status?.getApplications===T.Request},tasksLoading(){return this.$store.state.hailuo?.status?.getTasks===T.Request||this.fetchingTasks},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},application(){return this.$store.state.hailuo.application},tasks(){return this.$store.state.hailuo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await z({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`hailuo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`hailuo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`hailuo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!C(this.uploadTracker,e=>this.$t(e),e=>k.warning(e)))return;let e={...this.config,async:!0};if(!S())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}k.info(this.$t(`hailuo.message.startingTask`)),A(`hailuo`,D.generate(e,{token:t})).then(()=>{k.success(this.$t(`hailuo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?k.error(this.$t(`hailuo.message.usedUp`)):k.error(this.$t(`hailuo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function We(e,t,n,r,i,s){let c=p(`config-panel`),l=p(`recent-panel`),d=p(`layout`);return u(),a(d,null,{config:m(()=>[o(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[o(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Ge=j(Ue,[[`render`,We]]);export{Ge as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Vt as c,Wt as l,Z as u,b as d,k as f,tt as p,ut as m}from"./vendor-chart-BJCvKk8-.js";import{r as h,t as g}from"./select-D1ecEVE2.js";import{t as _}from"./upload-ClcuhdFZ.js";import{t as v}from"./tooltip-Bjypgs-B.js";import{t as y}from"./image-BTRKceWr.js";import{t as b}from"./alert-BMYM_Vr-.js";import{Wn as x}from"./constants-CG3Vqtr2.js";import{$t as S,Bt as C,Gt as w,Ht as ee,Ir as T,Qr as E,Sn as D,Ut as O,Vr as k,Vt as te,Xn as A,k as j,zr as M}from"./index-C8ufQprS.js";import{t as N}from"./index.es-D_ksxY2f.js";import{t as P}from"./CopyToClipboard-DOIyE45l.js";import{t as F}from"./ImagePreview-h9Y8nGAq.js";import{t as I}from"./Consumption-yJBcaOnM.js";import{i as L,n as R,t as z}from"./pagination-CEQQXX-i.js";import{t as B}from"./VideoPlayer-DWEb8C-E.js";import{t as V}from"./ApiCodeButton-BNuNdq4D.js";import{t as H}from"./BotPlaceholder-CsEE_kEM.js";import{t as U}from"./NoTasks-QEMQL-Gn.js";import{t as W}from"./Hailuo-uqAp7975.js";import{t as G}from"./PromptTextarea-DDKIJKMv.js";var K=r({name:`ModelSelector`,components:{ElSelect:h,ElOption:g},data(){return{}},computed:{options(){return[{value:`minimax-t2v`,label:this.$t(`hailuo.button.model1`)},{value:`minimax-i2v`,label:this.$t(`hailuo.button.model2`)},{value:`minimax-i2v-director`,label:this.$t(`hailuo.button.model3`)}]},value:{get(){return this.$store.state.hailuo?.config?.model},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,model:e})}}},mounted(){this.value||=x}}),q={class:`field`},J={class:`title font-bold`},Y={class:`float-left`};function X(r,i,c,d,f,h){let g=p(`el-option`),_=p(`el-select`);return u(),t(`div`,q,[n(`h2`,J,l(r.$t(`hailuo.name.model`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`hailuo.placeholder.select`),clearable:``},{default:m(()=>[(u(!0),t(s,null,e(r.options,e=>(u(),a(g,{key:e.value,label:e.label,value:e.value},{default:m(()=>[n(`span`,Y,l(e.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Z=j(K,[[`render`,X],[`__scopeId`,`data-v-a768fbd9`]]),Q=r({name:`StartImageUrlInput`,components:{ElUpload:_,ElButton:E,InfoIcon:L,ImagePreview:F},mixins:[O,te],data(){return{fileList:[],uploadUrl:M()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.hailuo?.config?.first_image_url},set(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){k.warning(this.$t(`hailuo.message.uploadStartImageExceed`))},onError(){k.error(this.$t(`hailuo.message.uploadStartImageError`))},async onRemove(){k.error(this.$t(`hailuo.message.uploadStartImageError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),ne={class:`relative`},re={class:`flex justify-between`},ie={class:`flex justify-start items-center`},ae={class:`text-sm font-bold`};function oe(e,r,s,c,d,h){let g=p(`info-icon`),_=p(`image-preview`),v=p(`el-button`),y=p(`el-upload`);return u(),t(`div`,ne,[n(`div`,re,[n(`div`,ie,[n(`span`,ae,l(e.$t(`hailuo.name.startImageUrl`)),1),o(g,{content:e.$t(`hailuo.description.startImageUrl`),class:`info`},null,8,[`content`])])]),o(y,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,"show-file-list":!0,limit:1,multiple:!1,"list-type":`picture`,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:t})=>[t.url&&t.percentage!==void 0?(u(),a(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):f(``,!0)]),default:m(()=>[o(v,{size:`small`,type:`primary`,class:`btn btn-upload`,round:``},{default:m(()=>[i(l(e.$t(`hailuo.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])])}var se=j(Q,[[`render`,oe],[`__scopeId`,`data-v-fbf49b06`]]),ce=r({name:`PromptInput`,components:{PromptTextarea:G},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function le(e,t,n,r,i,o){let s=p(`prompt-textarea`);return u(),a(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`hailuo.name.prompt`),info:e.$t(`hailuo.description.prompt`),placeholder:e.$t(`hailuo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ue=r({name:`PresetPanel`,components:{ElButton:E,FontAwesomeIcon:N,PromptInput:j(ce,[[`render`,le]]),StartImageUrlInput:se,ModelSelector:Z,Consumption:I},emits:[`generate`],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return w(this.config,this.service?.cost)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),de={class:`flex flex-col h-full`},fe={class:`flex-1 overflow-y-auto p-5`},pe={class:`flex flex-col items-center justify-center px-5 pb-5`};function me(e,r,s,c,d,h){let g=p(`prompt-input`),_=p(`model-selector`),v=p(`start-image-url-input`),y=p(`consumption`),b=p(`font-awesome-icon`),x=p(`el-button`);return u(),t(`div`,de,[n(`div`,fe,[o(g,{class:`mb-4`}),o(_,{class:`mb-4`}),e.config?.model===`minimax-i2v`?(u(),a(v,{key:0,class:`mb-2`})):f(``,!0)]),n(`div`,pe,[o(y,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),e.config?.video_url!==void 0||e.config?.custom?(u(),a(x,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:m(()=>[o(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.$t(`hailuo.button.extend`)),1)]),_:1},8,[`onClick`])):(u(),a(x,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:m(()=>[o(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.$t(`hailuo.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var he=j(ue,[[`render`,me]]),ge=r({name:`TaskPreview`,components:{ElImage:y,CopyToClipboard:P,FontAwesomeIcon:N,ElAlert:b,VideoPlayer:B,ElTooltip:v,ElButton:E,ApiCodeButton:V},props:{modelValue:{type:Object,required:!0}},computed:{application(){return this.$store.state.hailuo?.application},config(){return this.$store.state.hailuo?.config},video(){return this.modelValue?.response?.data?.[0]}},methods:{onDownload(e){console.debug(`on download hailuo video`,e),window.open(e,`_blank`)}}}),_e={class:`preview`},ve={class:`left`},ye={class:`main`},be={class:`bot`},xe={class:`datetime`},Se={class:`info`},Ce={key:0,class:`prompt mt-2`},we={key:0},Te={key:1},Ee={key:0,class:c({content:!0,failed:!0})},De={key:0,class:`mb-4`},Oe={key:1,class:c({operations:!0,"mt-2":!0})},ke={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ae={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},je={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Me={key:1,class:c({content:!0})},Ne={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pe={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Fe={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ie={key:2,class:c({content:!0})},Le={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Re(e,r,s,c,h,g){let _=p(`el-image`),v=p(`video-player`),y=p(`el-button`),b=p(`el-tooltip`),x=p(`api-code-button`),S=p(`font-awesome-icon`),C=p(`copy-to-clipboard`),w=p(`el-alert`);return u(),t(`div`,_e,[n(`div`,ve,[o(_,{src:`https://cdn.acedata.cloud/0qg4gp.png`,class:`avatar`})]),n(`div`,ye,[n(`div`,be,[i(l(e.$t(`hailuo.name.hailuoBot`))+` `,1),n(`span`,xe,l(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,Se,[e.modelValue?.request?.prompt?(u(),t(`p`,Ce,[i(l(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?f(``,!0):(u(),t(`span`,we,` - (`+l(e.$t(`hailuo.status.pending`))+`) `,1)),e.video?.state===`processing`||e.video?.state===`pending`||e.video?.state===`running`?(u(),t(`span`,Te,` - (`+l(e.$t(`hailuo.status.processing`))+`) `,1)):f(``,!0)])):f(``,!0)]),e.modelValue?.response?.success===!0?(u(),t(`div`,Ee,[e.video?.video_url?(u(),t(`div`,De,[o(v,{src:e.video?.video_url},null,8,[`src`])])):f(``,!0),e.video?(u(),t(`div`,Oe,[o(b,{class:`box-item`,effect:`dark`,content:e.$t(`hailuo.message.downloadVideo`),placement:`top-start`},{default:m(()=>[e.video?.video_url?(u(),a(y,{key:0,type:`info`,size:`small`,class:`mb-2`,onClick:r[0]||=d(t=>e.onDownload(e.video?.video_url),[`stop`])},{default:m(()=>[i(l(e.$t(`hailuo.button.download`)),1)]),_:1})):f(``,!0)]),_:1},8,[`content`]),o(x,{path:`/hailuo/videos`,body:e.modelValue?.request},null,8,[`body`])])):f(``,!0),o(w,{closable:!1,class:`mt-2 success`},{default:m(()=>[e.modelValue?.request?.model?(u(),t(`p`,ke,[o(S,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.model`))+`: `+l(e.modelValue?.request?.model)+` `,1),o(C,{content:e.modelValue?.id},null,8,[`content`])])):f(``,!0),n(`p`,Ae,[o(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),o(C,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.elapsed?(u(),t(`p`,je,[o(S,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.elapsed`))+`: `+l(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):f(``,!0)]),_:1})])):f(``,!0),e.modelValue?.response?.success===!1?(u(),t(`div`,Me,[o(w,{closable:!1,class:`failure`},{template:m(()=>[o(S,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.failure`)),1)]),default:m(()=>[n(`p`,Ne,[o(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),o(C,{content:e.modelValue?.id},null,8,[`content`])]),n(`p`,Pe,[o(S,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.failureReason`))+`: `+l(e.modelValue?.response?.error?.message)+` `,1),o(C,{content:e.modelValue?.response?.error?.message},null,8,[`content`])]),e.modelValue?.elapsed?(u(),t(`p`,$,[o(S,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.elapsed`))+`: `+l(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):f(``,!0),n(`p`,Fe,[o(S,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.traceId`))+`: `+l(e.modelValue?.response?.trace_id)+` `,1),o(C,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):f(``,!0),e.modelValue?.response?.success===void 0?(u(),t(`div`,Ie,[o(w,{closable:!1,class:`info`},{template:m(()=>[o(S,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.failure`)),1)]),default:m(()=>[n(`p`,Le,[o(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),o(C,{content:e.modelValue?.id},null,8,[`content`])])]),_:1})])):f(``,!0)])])}var ze=r({name:`RecentPanel`,components:{TaskPreview:j(ge,[[`render`,Re],[`__scopeId`,`data-v-53d13da4`]]),BotPlaceholder:H,NoTasks:U,ScrollList:R},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.hailuo?.tasks,items:this.$store.state.hailuo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Be={key:0},Ve={key:2,class:`w-full h-full flex items-center justify-center`};function He(n,r,i,c,l,d){let h=p(`bot-placeholder`),g=p(`task-preview`),_=p(`scroll-list`),v=p(`no-tasks`);return u(),t(s,null,[n.tasks?.items===void 0?(u(),t(`div`,Be,[o(h)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(u(),a(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:m(()=>[(u(!0),t(s,null,e(n.tasks?.items,e=>(u(),a(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):f(``,!0),n.tasks?.items?.length===0?(u(),t(`div`,Ve,[o(v)])):f(``,!0)],64)}var Ue=r({name:`HailuoIndex`,components:{ConfigPanel:he,Layout:W,RecentPanel:j(ze,[[`render`,He]])},mixins:[ee],inject:[`initialized`],data(){return{task:void 0,job:0,timer:void 0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.hailuo?.status?.getApplications===T.Request},tasksLoading(){return this.$store.state.hailuo?.status?.getTasks===T.Request||this.fetchingTasks},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},application(){return this.$store.state.hailuo.application},tasks(){return this.$store.state.hailuo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await z({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`hailuo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`hailuo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`hailuo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!C(this.uploadTracker,e=>this.$t(e),e=>k.warning(e)))return;let e={...this.config,async:!0};if(!S())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}k.info(this.$t(`hailuo.message.startingTask`)),A(`hailuo`,D.generate(e,{token:t})).then(()=>{k.success(this.$t(`hailuo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?k.error(this.$t(`hailuo.message.usedUp`)):k.error(this.$t(`hailuo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function We(e,t,n,r,i,s){let c=p(`config-panel`),l=p(`recent-panel`),d=p(`layout`);return u(),a(d,null,{config:m(()=>[o(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[o(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Ge=j(Ue,[[`render`,We]]);export{Ge as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Ut as c,Vt as l,Wt as u,Z as d,dt as f,et as p,k as m,tt as h,ut as g,v as _}from"./vendor-chart-BJCvKk8-.js";import{r as v,t as y}from"./select-C2lJsi1U.js";import{t as b}from"./upload-B1tP035s.js";import{t as x}from"./tooltip-BkUon2pU.js";import{t as S}from"./image-Dr945ixQ.js";import{t as C}from"./alert-BSWfT6uK.js";import{t as w}from"./drawer-Cu02szmr.js";import{t as T}from"./switch-CajEVBL2.js";import{Br as E,Hr as D,Ir as O,Kr as k,Lr as A,Rr as j,Vr as ee,Wr as te,zr as M}from"./constants-CG3Vqtr2.js";import{$t as N,Bt as P,Gt as F,Ht as I,Ir as L,On as ne,Qr as R,Ut as z,Vr as B,Vt as V,Xn as H,k as U,si as W,zr as G}from"./index-DrTotskf.js";import{t as K}from"./index.es-C5Wm6FW7.js";import{t as q}from"./CopyToClipboard-DaB2iAye.js";import{t as J}from"./ImagePreview-CbEvXym3.js";import{n as Y}from"./taskDrawerMixin-DEgO_R5H.js";import{t as X}from"./Consumption-DBJ6FvEI.js";import{i as Z,n as re,t as ie}from"./pagination-ELGdaz7j.js";import{t as Q}from"./VideoPlayer-CoSwPTjv.js";import{t as ae}from"./ApiCodeButton-DVDvpF39.js";import{t as oe}from"./BotPlaceholder-DKqHzqLl.js";import{t as se}from"./NoTasks-CLNtgfi4.js";import{t as ce}from"./PromptTextarea-FYbsElB4.js";var le=r({name:`LayoutVeo`,components:{ElDrawer:w,ElButton:R,FontAwesomeIcon:K},mixins:[Y]}),ue={class:`main flex flex-row flex-1`},de={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},fe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function pe(e,r,i,a,s,c){let l=h(`font-awesome-icon`),u=h(`el-button`),m=h(`el-drawer`);return d(),t(`div`,ue,[n(`div`,de,[p(e.$slots,`config`,{},void 0,!0)]),n(`div`,fe,[p(e.$slots,`result`,{},void 0,!0)]),f(o(u,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:g(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[_,!e.tasksEmpty]]),o(m,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`350px`},{default:g(()=>[p(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var me=U(le,[[`render`,pe],[`__scopeId`,`data-v-12b82bc3`]]),he=r({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`veo2`,label:`veo2`},{value:`veo2-fast`,label:`veo2-fast`},{value:`veo3`,label:`veo3`},{value:`veo3-fast`,label:`veo3-fast`},{value:`veo31-fast`,label:`veo31-fast`},{value:`veo31`,label:`veo31`},{value:`veo31-fast-ingredients`,label:`veo31-fast-ingredients`}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=M}}),ge={class:`field`},_e={class:`title font-bold`};function ve(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,ge,[n(`h2`,_e,u(r.$t(`veo.name.model`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`)},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ye=U(he,[[`render`,ve],[`__scopeId`,`data-v-a59d89c9`]]),be=r({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)},{value:`upsample`,label:this.$t(`veo.button.actionUpsample`)},{value:`extend`,label:this.$t(`veo.button.actionExtend`)},{value:`reshoot`,label:this.$t(`veo.button.actionReshoot`)},{value:`object_insert`,label:this.$t(`veo.button.actionObjectInsert`)},{value:`object_remove`,label:this.$t(`veo.button.actionObjectRemove`)}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||=O}}),xe={class:`field`},Se={class:`title font-bold`},Ce={class:`float-left`};function we(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,xe,[n(`h2`,Se,u(r.$t(`veo.name.action`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`),clearable:``},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},{default:g(()=>[n(`span`,Ce,u(e.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Te=U(be,[[`render`,we],[`__scopeId`,`data-v-f4d8785c`]]),Ee=r({name:`TranslationSelector`,components:{ElSwitch:T,InfoIcon:Z},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),De={class:`relative`},Oe={class:`flex justify-between`},ke={class:`flex justify-start items-center`},Ae={class:`text-sm font-bold`},je={class:`flex justify-end items-center`};function Me(e,r,i,a,s,c){let l=h(`info-icon`),f=h(`el-switch`);return d(),t(`div`,De,[n(`div`,Oe,[n(`div`,ke,[n(`span`,Ae,u(e.$t(`veo.name.translation`)),1),o(l,{content:e.$t(`veo.description.translation`)},null,8,[`content`])]),n(`div`,je,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`},null,8,[`modelValue`])])])])}var Ne=U(Ee,[[`render`,Me]]),Pe=r({name:`AspectRatioSelector`,data(){return{options:[{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=A}}),Fe={class:`text-sm font-bold mb-2 block`},Ie={class:`items`},Le=[`onClick`],Re={class:`name`};function ze(r,i,a,o,f,p){return d(),t(`div`,null,[n(`span`,Fe,u(r.$t(`veo.name.ratio`)),1),n(`div`,Ie,[(d(!0),t(s,null,e(r.options,(e,i)=>(d(),t(`div`,{key:i,class:l({active:r.active===i,item:!0}),onClick:t=>r.value=e.value},[n(`div`,{class:l([`preview`,e.label])},[n(`div`,{class:`rect`,style:c({width:e.width+`px`,height:e.height+`px`})},null,4)],2),n(`p`,Re,u(e.label),1)],10,Le))),128))])])}var Be=U(Pe,[[`render`,ze],[`__scopeId`,`data-v-28c472c4`]]),Ve=r({name:`VideoFromInput`,components:{VideoPlayer:Q},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.veo?.config}}}),He={class:`relative`},Ue={class:`flex mb-2`},We={class:`text-sm font-bold`};function Ge(e,r,i,o,s,c){let l=h(`video-player`);return d(),t(`div`,He,[n(`div`,Ue,[n(`span`,We,u(e.$t(`veo.name.action3`)),1)]),n(`div`,null,[e.config?.video_url?(d(),a(l,{key:0,src:e.config?.video_url},null,8,[`src`])):m(``,!0)])])}var Ke=U(Ve,[[`render`,Ge]]),qe=r({name:`VideoIdInput`,components:{ElInput:W},computed:{value:{get(){return this.$store.state.veo?.config?.video_id},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,video_id:e})}}}}),Je={class:`field`},Ye={class:`title font-bold`};function Xe(e,r,i,a,s,c){let l=h(`el-input`);return d(),t(`div`,Je,[n(`h2`,Ye,u(e.$t(`veo.name.videoId`)),1),o(l,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`,type:`text`,placeholder:e.$t(`veo.placeholder.videoId`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var Ze=U(qe,[[`render`,Xe],[`__scopeId`,`data-v-6eba4026`]]),Qe=r({name:`StartEndImage`,components:{ElUpload:b,ElButton:R,InfoIcon:Z,FontAwesomeIcon:K,ImagePreview:J},mixins:[z,V],emits:[`change`],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){B.warning(this.$t(`veo.message.uploadReferencesExceed`))},onError(){B.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),$e={class:`relative`},et={class:`flex justify-between`},tt={class:`flex justify-start items-center`},nt={class:`text-sm font-bold`};function rt(e,r,s,c,l,f){let p=h(`info-icon`),_=h(`image-preview`),v=h(`font-awesome-icon`),y=h(`el-button`),b=h(`el-upload`);return d(),t(`div`,$e,[n(`div`,et,[n(`div`,tt,[n(`span`,nt,u(e.$t(`veo.name.startEndImage`)),1),o(p,{content:e.$t(`veo.description.uploadStartEndImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:g(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):m(``,!0)]),default:g(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:g(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var it=U(Qe,[[`render`,rt],[`__scopeId`,`data-v-f9a79b4a`]]),at=r({name:`UpsampleActionSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return k.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.upsample_action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,upsample_action:e})}}},mounted(){this.value||=ee}}),ot={class:`field`},st={class:`title font-bold`};function ct(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,ot,[n(`h2`,st,u(r.$t(`veo.name.upsampleAction`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`)},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var lt=U(at,[[`render`,ct],[`__scopeId`,`data-v-8b74a7ae`]]),ut=r({name:`ExtendModelSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return D.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){(!this.value||!D.includes(this.value))&&(this.value=j)}}),dt={class:`field`},ft={class:`title font-bold`};function pt(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,dt,[n(`h2`,ft,u(r.$t(`veo.name.model`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`)},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var mt=U(ut,[[`render`,pt],[`__scopeId`,`data-v-cc3f9355`]]),ht=r({name:`MotionTypeSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return te.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.motion_type},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,motion_type:e})}}},mounted(){this.value||=E}}),gt={class:`field`},_t={class:`title font-bold`};function vt(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,gt,[n(`h2`,_t,u(r.$t(`veo.name.motionType`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`),filterable:``},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var yt=U(ht,[[`render`,vt],[`__scopeId`,`data-v-3affff3c`]]),bt=r({name:`ImageMaskInput`,components:{ElInput:W},computed:{value:{get(){return this.$store.state.veo?.config?.image_mask},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,image_mask:e})}}}}),xt={class:`field`},St={class:`title font-bold`};function Ct(e,r,i,a,s,c){let l=h(`el-input`);return d(),t(`div`,xt,[n(`h2`,St,u(e.$t(`veo.name.imageMask`)),1),o(l,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`,type:`text`,placeholder:e.$t(`veo.placeholder.imageMask`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var wt=U(bt,[[`render`,Ct],[`__scopeId`,`data-v-6cc27c68`]]),Tt=r({name:`PromptInput`,components:{PromptTextarea:ce},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Et(e,t,n,r,i,o){let s=h(`prompt-textarea`);return d(),a(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Dt=U(Tt,[[`render`,Et]]),Ot=[`upsample`,`extend`,`reshoot`,`object_insert`,`object_remove`,`get1080p`],kt=[`text2video`,`image2video`,`ingredients2video`],At=r({name:`ConfigPanel`,components:{ElButton:R,Consumption:X,FontAwesomeIcon:K,PromptInput:Dt,ModelSelector:ye,StartEndImage:it,ActionSelector:Te,VideoFromInput:Ke,VideoIdInput:Ze,UpsampleActionSelector:lt,ExtendModelSelector:mt,MotionTypeSelector:yt,ImageMaskInput:wt,TranslationSelector:Ne,AspectRatioSelector:Be},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},consumption(){return F(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service},isPostProcessing(){return Ot.includes(this.config?.action??``)},isGeneration(){return kt.includes(this.config?.action??``)}},methods:{onGenerate(){this.$emit(`generate`)}}}),jt={class:`flex flex-col h-full`},Mt={class:`flex-1 overflow-y-auto p-5`},Nt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Pt(e,r,c,l,f,p){let _=h(`action-selector`),v=h(`video-from-input`),y=h(`video-id-input`),b=h(`upsample-action-selector`),x=h(`extend-model-selector`),S=h(`prompt-input`),C=h(`motion-type-selector`),w=h(`image-mask-input`),T=h(`translation-selector`),E=h(`aspect-ratio-selector`),D=h(`model-selector`),O=h(`start-end-image`),k=h(`consumption`),A=h(`font-awesome-icon`),j=h(`el-button`);return d(),t(`div`,jt,[n(`div`,Mt,[o(_,{class:`mb-4`}),e.isPostProcessing?(d(),t(s,{key:0},[e.config?.video_url?(d(),a(v,{key:0,class:`mb-4`})):m(``,!0),o(y,{class:`mb-4`})],64)):m(``,!0),e.config?.action===`upsample`?(d(),a(b,{key:1,class:`mb-4`})):m(``,!0),e.config?.action===`extend`?(d(),a(x,{key:2,class:`mb-4`})):m(``,!0),e.config?.action===`extend`?(d(),a(S,{key:3,class:`mb-4`})):m(``,!0),e.config?.action===`reshoot`?(d(),a(C,{key:4,class:`mb-4`})):m(``,!0),e.config?.action===`object_insert`?(d(),a(S,{key:5,class:`mb-4`})):m(``,!0),e.config?.action===`object_insert`||e.config?.action===`object_remove`?(d(),a(w,{key:6,class:`mb-4`})):m(``,!0),e.config?.action===`object_remove`?(d(),a(S,{key:7,class:`mb-4`})):m(``,!0),e.isGeneration?(d(),t(s,{key:8},[o(T,{class:`mb-4`}),o(E,{class:`mb-4`}),o(S,{class:`mb-4`}),e.config?.action===`ingredients2video`?m(``,!0):(d(),a(D,{key:0,class:`mb-4`})),e.config?.action===`image2video`||e.config?.action===`ingredients2video`?(d(),a(O,{key:1,class:`mb-2`})):m(``,!0)],64)):m(``,!0)]),n(`div`,Nt,[o(k,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(j,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:g(()=>[o(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ft=U(At,[[`render`,Pt]]),It=r({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:q,FontAwesomeIcon:K,ElAlert:C,VideoPlayer:Q,ElTooltip:x,ElButton:R,ApiCodeButton:ae},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onPickAction(e,t,n,r){console.debug(`seed config from preview`,{action:n,upsampleAction:r,response:t}),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:n,video_id:t?.data?.[0]?.id,video_url:t?.data?.[0]?.video_url,...r?{upsample_action:r}:{}})},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Lt={class:`preview`},Rt={class:`left`},zt={class:`main`},Bt={class:`bot`},Vt={class:`datetime`},Ht={class:`info`},Ut={key:0,class:`prompt mt-2`},Wt={key:0},Gt={key:1},Kt={key:0,class:l({content:!0,failed:!0})},qt={key:0,class:`mb-4`},$={key:1,class:l({operations:!0,"mt-2":!0})},Jt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Xt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Zt={key:1,class:l({content:!0})},Qt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},en={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},nn={key:2,class:l({content:!0})},rn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function on(e,r,s,c,l,f){let p=h(`el-image`),_=h(`video-player`),v=h(`el-button`),y=h(`el-tooltip`),b=h(`api-code-button`),x=h(`font-awesome-icon`),S=h(`copy-to-clipboard`),C=h(`el-alert`);return d(),t(`div`,Lt,[n(`div`,Rt,[o(p,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),n(`div`,zt,[n(`div`,Bt,[i(u(e.$t(`veo.name.veoBot`))+` `,1),n(`span`,Vt,u(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,Ht,[e.modelValue?.request?.prompt?(d(),t(`p`,Ut,[i(u(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?m(``,!0):(d(),t(`span`,Wt,` - (`+u(e.$t(`veo.status.pending`))+`) `,1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state===`running`?(d(),t(`span`,Gt,` - (`+u(e.$t(`veo.status.processing`))+`) `,1)):m(``,!0)])):m(``,!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(d(),t(`div`,Kt,[e.modelValue?.response?.data[0]?.video_url?(d(),t(`div`,qt,[o(_,{src:e.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):m(``,!0),e.modelValue?.response.success?(d(),t(`div`,$,[e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:r[0]||=t=>e.onPickAction(t,e.modelValue?.response,`upsample`,`1080p`)},{default:g(()=>[i(u(e.$t(`veo.button.actionUpsample1080p`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:1,type:`info`,size:`small`,class:`btn-action`,onClick:r[1]||=t=>e.onPickAction(t,e.modelValue?.response,`upsample`,`4k`)},{default:g(()=>[i(u(e.$t(`veo.button.actionUpsample4k`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:2,type:`info`,size:`small`,class:`btn-action`,onClick:r[2]||=t=>e.onPickAction(t,e.modelValue?.response,`upsample`,`gif`)},{default:g(()=>[i(u(e.$t(`veo.button.actionUpsampleGif`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:3,type:`info`,size:`small`,class:`btn-action`,onClick:r[3]||=t=>e.onPickAction(t,e.modelValue?.response,`extend`)},{default:g(()=>[i(u(e.$t(`veo.button.actionExtend`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:4,type:`info`,size:`small`,class:`btn-action`,onClick:r[4]||=t=>e.onPickAction(t,e.modelValue?.response,`reshoot`)},{default:g(()=>[i(u(e.$t(`veo.button.actionReshoot`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:5,type:`info`,size:`small`,class:`btn-action`,onClick:r[5]||=t=>e.onPickAction(t,e.modelValue?.response,`object_insert`)},{default:g(()=>[i(u(e.$t(`veo.button.actionObjectInsert`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:6,type:`info`,size:`small`,class:`btn-action`,onClick:r[6]||=t=>e.onPickAction(t,e.modelValue?.response,`object_remove`)},{default:g(()=>[i(u(e.$t(`veo.button.actionObjectRemove`)),1)]),_:1})):m(``,!0),o(y,{class:`box-item`,effect:`dark`,content:e.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:g(()=>[e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:r[7]||=t=>e.onDownload(t,e.modelValue?.response?.data[0]?.video_url)},{default:g(()=>[i(u(e.$t(`veo.button.download`)),1)]),_:1})):m(``,!0)]),_:1},8,[`content`]),o(b,{path:`/veo/videos`,body:e.modelValue?.request},null,8,[`body`])])):m(``,!0),o(C,{closable:!1,class:`mt-2 success`},{default:g(()=>[n(`p`,Jt,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.model`))+`: `+u(e.modelValue?.request?.model),1)]),n(`p`,Yt,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(S,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.elapsed?(d(),t(`p`,Xt,[o(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):m(``,!0)]),_:1})])):m(``,!0),e.modelValue?.response?.success===!1?(d(),t(`div`,Zt,[o(C,{closable:!1,class:`failure`},{template:g(()=>[o(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.failure`)),1)]),default:g(()=>[n(`p`,Qt,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(S,{content:e.modelValue?.id},null,8,[`content`])]),n(`p`,$t,[o(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.failureReason`))+`: `+u(e.modelValue?.response?.error?.message)+` `,1),o(S,{content:e.modelValue?.response?.error?.message},null,8,[`content`])]),e.modelValue?.elapsed?(d(),t(`p`,en,[o(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):m(``,!0),e.modelValue?.response?.trace_id?(d(),t(`p`,tn,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(S,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):m(``,!0)]),_:1})])):m(``,!0),e.modelValue?.response?.success===void 0?(d(),t(`div`,nn,[o(C,{closable:!1,class:`info`},{template:g(()=>[o(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.failure`)),1)]),default:g(()=>[n(`p`,rn,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(S,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.response?.trace_id?(d(),t(`p`,an,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(S,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):m(``,!0)]),_:1})])):m(``,!0)])])}var sn=r({name:`RecentPanel`,components:{TaskPreview:U(It,[[`render`,on],[`__scopeId`,`data-v-9698fe5f`]]),NoTasks:se,BotPlaceholder:oe,ScrollList:re},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),cn={key:0},ln={key:2,class:`w-full h-full flex items-center justify-center`};function un(n,r,i,c,l,u){let f=h(`bot-placeholder`),p=h(`task-preview`),_=h(`scroll-list`),v=h(`no-tasks`);return d(),t(s,null,[n.tasks?.items===void 0?(d(),t(`div`,cn,[o(f)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(d(),a(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:g(()=>[(d(!0),t(s,null,e(n.tasks?.items,(e,t)=>(d(),a(p,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):m(``,!0),n.tasks?.items?.length===0?(d(),t(`div`,ln,[o(v)])):m(``,!0)],64)}var dn=r({name:`VeoIndex`,components:{ConfigPanel:Ft,Layout:me,RecentPanel:U(sn,[[`render`,un]])},mixins:[I],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===L.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===L.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ie({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!P(this.uploadTracker,e=>this.$t(e),e=>B.warning(e)))return;let e={...this.config,async:!0};if(!N())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if(e.action===`image2video`&&!(e.image_urls&&e.image_urls.length>0)){B.warning(this.$t(`veo.message.imageRequired`));return}(!e.image_urls||e.image_urls.length===0)&&delete e.image_urls,B.info(this.$t(`veo.message.startingTask`)),H(`veo`,ne.generate(e,{token:t})).then(()=>{B.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?B.error(this.$t(`veo.message.usedUp`)):B.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function fn(e,t,n,r,i,s){let c=h(`config-panel`),l=h(`recent-panel`),u=h(`layout`);return d(),a(u,null,{config:g(()=>[o(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:g(()=>[o(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var pn=U(dn,[[`render`,fn]]);export{pn as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Ut as c,Vt as l,Wt as u,Z as d,dt as f,et as p,k as m,tt as h,ut as g,v as _}from"./vendor-chart-BJCvKk8-.js";import{r as v,t as y}from"./select-D1ecEVE2.js";import{t as b}from"./upload-ClcuhdFZ.js";import{t as x}from"./tooltip-Bjypgs-B.js";import{t as S}from"./image-BTRKceWr.js";import{t as C}from"./alert-BMYM_Vr-.js";import{t as w}from"./drawer-yIAwJ7En.js";import{t as T}from"./switch-AThus4zo.js";import{Br as E,Hr as D,Ir as O,Kr as k,Lr as A,Rr as j,Vr as ee,Wr as te,zr as M}from"./constants-CG3Vqtr2.js";import{$t as N,Bt as P,Gt as F,Ht as I,Ir as L,On as ne,Qr as R,Ut as z,Vr as B,Vt as V,Xn as H,k as U,si as W,zr as G}from"./index-C8ufQprS.js";import{t as K}from"./index.es-D_ksxY2f.js";import{t as q}from"./CopyToClipboard-DOIyE45l.js";import{t as J}from"./ImagePreview-h9Y8nGAq.js";import{n as Y}from"./taskDrawerMixin-DEgO_R5H.js";import{t as X}from"./Consumption-yJBcaOnM.js";import{i as Z,n as re,t as ie}from"./pagination-CEQQXX-i.js";import{t as Q}from"./VideoPlayer-DWEb8C-E.js";import{t as ae}from"./ApiCodeButton-BNuNdq4D.js";import{t as oe}from"./BotPlaceholder-CsEE_kEM.js";import{t as se}from"./NoTasks-QEMQL-Gn.js";import{t as ce}from"./PromptTextarea-DDKIJKMv.js";var le=r({name:`LayoutVeo`,components:{ElDrawer:w,ElButton:R,FontAwesomeIcon:K},mixins:[Y]}),ue={class:`main flex flex-row flex-1`},de={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},fe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function pe(e,r,i,a,s,c){let l=h(`font-awesome-icon`),u=h(`el-button`),m=h(`el-drawer`);return d(),t(`div`,ue,[n(`div`,de,[p(e.$slots,`config`,{},void 0,!0)]),n(`div`,fe,[p(e.$slots,`result`,{},void 0,!0)]),f(o(u,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:g(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[_,!e.tasksEmpty]]),o(m,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`350px`},{default:g(()=>[p(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var me=U(le,[[`render`,pe],[`__scopeId`,`data-v-12b82bc3`]]),he=r({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`veo2`,label:`veo2`},{value:`veo2-fast`,label:`veo2-fast`},{value:`veo3`,label:`veo3`},{value:`veo3-fast`,label:`veo3-fast`},{value:`veo31-fast`,label:`veo31-fast`},{value:`veo31`,label:`veo31`},{value:`veo31-fast-ingredients`,label:`veo31-fast-ingredients`}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=M}}),ge={class:`field`},_e={class:`title font-bold`};function ve(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,ge,[n(`h2`,_e,u(r.$t(`veo.name.model`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`)},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ye=U(he,[[`render`,ve],[`__scopeId`,`data-v-a59d89c9`]]),be=r({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)},{value:`upsample`,label:this.$t(`veo.button.actionUpsample`)},{value:`extend`,label:this.$t(`veo.button.actionExtend`)},{value:`reshoot`,label:this.$t(`veo.button.actionReshoot`)},{value:`object_insert`,label:this.$t(`veo.button.actionObjectInsert`)},{value:`object_remove`,label:this.$t(`veo.button.actionObjectRemove`)}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||=O}}),xe={class:`field`},Se={class:`title font-bold`},Ce={class:`float-left`};function we(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,xe,[n(`h2`,Se,u(r.$t(`veo.name.action`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`),clearable:``},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},{default:g(()=>[n(`span`,Ce,u(e.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Te=U(be,[[`render`,we],[`__scopeId`,`data-v-f4d8785c`]]),Ee=r({name:`TranslationSelector`,components:{ElSwitch:T,InfoIcon:Z},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),De={class:`relative`},Oe={class:`flex justify-between`},ke={class:`flex justify-start items-center`},Ae={class:`text-sm font-bold`},je={class:`flex justify-end items-center`};function Me(e,r,i,a,s,c){let l=h(`info-icon`),f=h(`el-switch`);return d(),t(`div`,De,[n(`div`,Oe,[n(`div`,ke,[n(`span`,Ae,u(e.$t(`veo.name.translation`)),1),o(l,{content:e.$t(`veo.description.translation`)},null,8,[`content`])]),n(`div`,je,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`},null,8,[`modelValue`])])])])}var Ne=U(Ee,[[`render`,Me]]),Pe=r({name:`AspectRatioSelector`,data(){return{options:[{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=A}}),Fe={class:`text-sm font-bold mb-2 block`},Ie={class:`items`},Le=[`onClick`],Re={class:`name`};function ze(r,i,a,o,f,p){return d(),t(`div`,null,[n(`span`,Fe,u(r.$t(`veo.name.ratio`)),1),n(`div`,Ie,[(d(!0),t(s,null,e(r.options,(e,i)=>(d(),t(`div`,{key:i,class:l({active:r.active===i,item:!0}),onClick:t=>r.value=e.value},[n(`div`,{class:l([`preview`,e.label])},[n(`div`,{class:`rect`,style:c({width:e.width+`px`,height:e.height+`px`})},null,4)],2),n(`p`,Re,u(e.label),1)],10,Le))),128))])])}var Be=U(Pe,[[`render`,ze],[`__scopeId`,`data-v-28c472c4`]]),Ve=r({name:`VideoFromInput`,components:{VideoPlayer:Q},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.veo?.config}}}),He={class:`relative`},Ue={class:`flex mb-2`},We={class:`text-sm font-bold`};function Ge(e,r,i,o,s,c){let l=h(`video-player`);return d(),t(`div`,He,[n(`div`,Ue,[n(`span`,We,u(e.$t(`veo.name.action3`)),1)]),n(`div`,null,[e.config?.video_url?(d(),a(l,{key:0,src:e.config?.video_url},null,8,[`src`])):m(``,!0)])])}var Ke=U(Ve,[[`render`,Ge]]),qe=r({name:`VideoIdInput`,components:{ElInput:W},computed:{value:{get(){return this.$store.state.veo?.config?.video_id},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,video_id:e})}}}}),Je={class:`field`},Ye={class:`title font-bold`};function Xe(e,r,i,a,s,c){let l=h(`el-input`);return d(),t(`div`,Je,[n(`h2`,Ye,u(e.$t(`veo.name.videoId`)),1),o(l,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`,type:`text`,placeholder:e.$t(`veo.placeholder.videoId`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var Ze=U(qe,[[`render`,Xe],[`__scopeId`,`data-v-6eba4026`]]),Qe=r({name:`StartEndImage`,components:{ElUpload:b,ElButton:R,InfoIcon:Z,FontAwesomeIcon:K,ImagePreview:J},mixins:[z,V],emits:[`change`],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){B.warning(this.$t(`veo.message.uploadReferencesExceed`))},onError(){B.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),$e={class:`relative`},et={class:`flex justify-between`},tt={class:`flex justify-start items-center`},nt={class:`text-sm font-bold`};function rt(e,r,s,c,l,f){let p=h(`info-icon`),_=h(`image-preview`),v=h(`font-awesome-icon`),y=h(`el-button`),b=h(`el-upload`);return d(),t(`div`,$e,[n(`div`,et,[n(`div`,tt,[n(`span`,nt,u(e.$t(`veo.name.startEndImage`)),1),o(p,{content:e.$t(`veo.description.uploadStartEndImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:g(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):m(``,!0)]),default:g(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:g(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var it=U(Qe,[[`render`,rt],[`__scopeId`,`data-v-f9a79b4a`]]),at=r({name:`UpsampleActionSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return k.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.upsample_action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,upsample_action:e})}}},mounted(){this.value||=ee}}),ot={class:`field`},st={class:`title font-bold`};function ct(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,ot,[n(`h2`,st,u(r.$t(`veo.name.upsampleAction`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`)},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var lt=U(at,[[`render`,ct],[`__scopeId`,`data-v-8b74a7ae`]]),ut=r({name:`ExtendModelSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return D.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){(!this.value||!D.includes(this.value))&&(this.value=j)}}),dt={class:`field`},ft={class:`title font-bold`};function pt(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,dt,[n(`h2`,ft,u(r.$t(`veo.name.model`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`)},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var mt=U(ut,[[`render`,pt],[`__scopeId`,`data-v-cc3f9355`]]),ht=r({name:`MotionTypeSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return te.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.motion_type},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,motion_type:e})}}},mounted(){this.value||=E}}),gt={class:`field`},_t={class:`title font-bold`};function vt(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,gt,[n(`h2`,_t,u(r.$t(`veo.name.motionType`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`),filterable:``},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var yt=U(ht,[[`render`,vt],[`__scopeId`,`data-v-3affff3c`]]),bt=r({name:`ImageMaskInput`,components:{ElInput:W},computed:{value:{get(){return this.$store.state.veo?.config?.image_mask},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,image_mask:e})}}}}),xt={class:`field`},St={class:`title font-bold`};function Ct(e,r,i,a,s,c){let l=h(`el-input`);return d(),t(`div`,xt,[n(`h2`,St,u(e.$t(`veo.name.imageMask`)),1),o(l,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`,type:`text`,placeholder:e.$t(`veo.placeholder.imageMask`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var wt=U(bt,[[`render`,Ct],[`__scopeId`,`data-v-6cc27c68`]]),Tt=r({name:`PromptInput`,components:{PromptTextarea:ce},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Et(e,t,n,r,i,o){let s=h(`prompt-textarea`);return d(),a(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Dt=U(Tt,[[`render`,Et]]),Ot=[`upsample`,`extend`,`reshoot`,`object_insert`,`object_remove`,`get1080p`],kt=[`text2video`,`image2video`,`ingredients2video`],At=r({name:`ConfigPanel`,components:{ElButton:R,Consumption:X,FontAwesomeIcon:K,PromptInput:Dt,ModelSelector:ye,StartEndImage:it,ActionSelector:Te,VideoFromInput:Ke,VideoIdInput:Ze,UpsampleActionSelector:lt,ExtendModelSelector:mt,MotionTypeSelector:yt,ImageMaskInput:wt,TranslationSelector:Ne,AspectRatioSelector:Be},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},consumption(){return F(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service},isPostProcessing(){return Ot.includes(this.config?.action??``)},isGeneration(){return kt.includes(this.config?.action??``)}},methods:{onGenerate(){this.$emit(`generate`)}}}),jt={class:`flex flex-col h-full`},Mt={class:`flex-1 overflow-y-auto p-5`},Nt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Pt(e,r,c,l,f,p){let _=h(`action-selector`),v=h(`video-from-input`),y=h(`video-id-input`),b=h(`upsample-action-selector`),x=h(`extend-model-selector`),S=h(`prompt-input`),C=h(`motion-type-selector`),w=h(`image-mask-input`),T=h(`translation-selector`),E=h(`aspect-ratio-selector`),D=h(`model-selector`),O=h(`start-end-image`),k=h(`consumption`),A=h(`font-awesome-icon`),j=h(`el-button`);return d(),t(`div`,jt,[n(`div`,Mt,[o(_,{class:`mb-4`}),e.isPostProcessing?(d(),t(s,{key:0},[e.config?.video_url?(d(),a(v,{key:0,class:`mb-4`})):m(``,!0),o(y,{class:`mb-4`})],64)):m(``,!0),e.config?.action===`upsample`?(d(),a(b,{key:1,class:`mb-4`})):m(``,!0),e.config?.action===`extend`?(d(),a(x,{key:2,class:`mb-4`})):m(``,!0),e.config?.action===`extend`?(d(),a(S,{key:3,class:`mb-4`})):m(``,!0),e.config?.action===`reshoot`?(d(),a(C,{key:4,class:`mb-4`})):m(``,!0),e.config?.action===`object_insert`?(d(),a(S,{key:5,class:`mb-4`})):m(``,!0),e.config?.action===`object_insert`||e.config?.action===`object_remove`?(d(),a(w,{key:6,class:`mb-4`})):m(``,!0),e.config?.action===`object_remove`?(d(),a(S,{key:7,class:`mb-4`})):m(``,!0),e.isGeneration?(d(),t(s,{key:8},[o(T,{class:`mb-4`}),o(E,{class:`mb-4`}),o(S,{class:`mb-4`}),e.config?.action===`ingredients2video`?m(``,!0):(d(),a(D,{key:0,class:`mb-4`})),e.config?.action===`image2video`||e.config?.action===`ingredients2video`?(d(),a(O,{key:1,class:`mb-2`})):m(``,!0)],64)):m(``,!0)]),n(`div`,Nt,[o(k,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(j,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:g(()=>[o(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ft=U(At,[[`render`,Pt]]),It=r({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:q,FontAwesomeIcon:K,ElAlert:C,VideoPlayer:Q,ElTooltip:x,ElButton:R,ApiCodeButton:ae},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onPickAction(e,t,n,r){console.debug(`seed config from preview`,{action:n,upsampleAction:r,response:t}),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:n,video_id:t?.data?.[0]?.id,video_url:t?.data?.[0]?.video_url,...r?{upsample_action:r}:{}})},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Lt={class:`preview`},Rt={class:`left`},zt={class:`main`},Bt={class:`bot`},Vt={class:`datetime`},Ht={class:`info`},Ut={key:0,class:`prompt mt-2`},Wt={key:0},Gt={key:1},Kt={key:0,class:l({content:!0,failed:!0})},qt={key:0,class:`mb-4`},$={key:1,class:l({operations:!0,"mt-2":!0})},Jt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Xt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Zt={key:1,class:l({content:!0})},Qt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},en={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},nn={key:2,class:l({content:!0})},rn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function on(e,r,s,c,l,f){let p=h(`el-image`),_=h(`video-player`),v=h(`el-button`),y=h(`el-tooltip`),b=h(`api-code-button`),x=h(`font-awesome-icon`),S=h(`copy-to-clipboard`),C=h(`el-alert`);return d(),t(`div`,Lt,[n(`div`,Rt,[o(p,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),n(`div`,zt,[n(`div`,Bt,[i(u(e.$t(`veo.name.veoBot`))+` `,1),n(`span`,Vt,u(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,Ht,[e.modelValue?.request?.prompt?(d(),t(`p`,Ut,[i(u(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?m(``,!0):(d(),t(`span`,Wt,` - (`+u(e.$t(`veo.status.pending`))+`) `,1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state===`running`?(d(),t(`span`,Gt,` - (`+u(e.$t(`veo.status.processing`))+`) `,1)):m(``,!0)])):m(``,!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(d(),t(`div`,Kt,[e.modelValue?.response?.data[0]?.video_url?(d(),t(`div`,qt,[o(_,{src:e.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):m(``,!0),e.modelValue?.response.success?(d(),t(`div`,$,[e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:r[0]||=t=>e.onPickAction(t,e.modelValue?.response,`upsample`,`1080p`)},{default:g(()=>[i(u(e.$t(`veo.button.actionUpsample1080p`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:1,type:`info`,size:`small`,class:`btn-action`,onClick:r[1]||=t=>e.onPickAction(t,e.modelValue?.response,`upsample`,`4k`)},{default:g(()=>[i(u(e.$t(`veo.button.actionUpsample4k`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:2,type:`info`,size:`small`,class:`btn-action`,onClick:r[2]||=t=>e.onPickAction(t,e.modelValue?.response,`upsample`,`gif`)},{default:g(()=>[i(u(e.$t(`veo.button.actionUpsampleGif`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:3,type:`info`,size:`small`,class:`btn-action`,onClick:r[3]||=t=>e.onPickAction(t,e.modelValue?.response,`extend`)},{default:g(()=>[i(u(e.$t(`veo.button.actionExtend`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:4,type:`info`,size:`small`,class:`btn-action`,onClick:r[4]||=t=>e.onPickAction(t,e.modelValue?.response,`reshoot`)},{default:g(()=>[i(u(e.$t(`veo.button.actionReshoot`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:5,type:`info`,size:`small`,class:`btn-action`,onClick:r[5]||=t=>e.onPickAction(t,e.modelValue?.response,`object_insert`)},{default:g(()=>[i(u(e.$t(`veo.button.actionObjectInsert`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:6,type:`info`,size:`small`,class:`btn-action`,onClick:r[6]||=t=>e.onPickAction(t,e.modelValue?.response,`object_remove`)},{default:g(()=>[i(u(e.$t(`veo.button.actionObjectRemove`)),1)]),_:1})):m(``,!0),o(y,{class:`box-item`,effect:`dark`,content:e.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:g(()=>[e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:r[7]||=t=>e.onDownload(t,e.modelValue?.response?.data[0]?.video_url)},{default:g(()=>[i(u(e.$t(`veo.button.download`)),1)]),_:1})):m(``,!0)]),_:1},8,[`content`]),o(b,{path:`/veo/videos`,body:e.modelValue?.request},null,8,[`body`])])):m(``,!0),o(C,{closable:!1,class:`mt-2 success`},{default:g(()=>[n(`p`,Jt,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.model`))+`: `+u(e.modelValue?.request?.model),1)]),n(`p`,Yt,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(S,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.elapsed?(d(),t(`p`,Xt,[o(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):m(``,!0)]),_:1})])):m(``,!0),e.modelValue?.response?.success===!1?(d(),t(`div`,Zt,[o(C,{closable:!1,class:`failure`},{template:g(()=>[o(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.failure`)),1)]),default:g(()=>[n(`p`,Qt,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(S,{content:e.modelValue?.id},null,8,[`content`])]),n(`p`,$t,[o(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.failureReason`))+`: `+u(e.modelValue?.response?.error?.message)+` `,1),o(S,{content:e.modelValue?.response?.error?.message},null,8,[`content`])]),e.modelValue?.elapsed?(d(),t(`p`,en,[o(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):m(``,!0),e.modelValue?.response?.trace_id?(d(),t(`p`,tn,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(S,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):m(``,!0)]),_:1})])):m(``,!0),e.modelValue?.response?.success===void 0?(d(),t(`div`,nn,[o(C,{closable:!1,class:`info`},{template:g(()=>[o(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.failure`)),1)]),default:g(()=>[n(`p`,rn,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(S,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.response?.trace_id?(d(),t(`p`,an,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(S,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):m(``,!0)]),_:1})])):m(``,!0)])])}var sn=r({name:`RecentPanel`,components:{TaskPreview:U(It,[[`render`,on],[`__scopeId`,`data-v-9698fe5f`]]),NoTasks:se,BotPlaceholder:oe,ScrollList:re},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),cn={key:0},ln={key:2,class:`w-full h-full flex items-center justify-center`};function un(n,r,i,c,l,u){let f=h(`bot-placeholder`),p=h(`task-preview`),_=h(`scroll-list`),v=h(`no-tasks`);return d(),t(s,null,[n.tasks?.items===void 0?(d(),t(`div`,cn,[o(f)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(d(),a(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:g(()=>[(d(!0),t(s,null,e(n.tasks?.items,(e,t)=>(d(),a(p,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):m(``,!0),n.tasks?.items?.length===0?(d(),t(`div`,ln,[o(v)])):m(``,!0)],64)}var dn=r({name:`VeoIndex`,components:{ConfigPanel:Ft,Layout:me,RecentPanel:U(sn,[[`render`,un]])},mixins:[I],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===L.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===L.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ie({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!P(this.uploadTracker,e=>this.$t(e),e=>B.warning(e)))return;let e={...this.config,async:!0};if(!N())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if(e.action===`image2video`&&!(e.image_urls&&e.image_urls.length>0)){B.warning(this.$t(`veo.message.imageRequired`));return}(!e.image_urls||e.image_urls.length===0)&&delete e.image_urls,B.info(this.$t(`veo.message.startingTask`)),H(`veo`,ne.generate(e,{token:t})).then(()=>{B.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?B.error(this.$t(`veo.message.usedUp`)):B.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function fn(e,t,n,r,i,s){let c=h(`config-panel`),l=h(`recent-panel`),u=h(`layout`);return d(),a(u,null,{config:g(()=>[o(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:g(()=>[o(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var pn=U(dn,[[`render`,fn]]);export{pn as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Vt as c,Wt as l,Z as u,b as d,dt as f,et as p,k as m,tt as h,ut as g,v as _}from"./vendor-chart-BJCvKk8-.js";import{n as v,r as y,t as b}from"./select-C2lJsi1U.js";import{t as x}from"./upload-B1tP035s.js";import{t as S}from"./tooltip-BkUon2pU.js";import{t as C}from"./image-Dr945ixQ.js";import{t as w}from"./alert-BSWfT6uK.js";import{t as T}from"./drawer-Cu02szmr.js";import{t as E}from"./input-number-s6gXNw-j.js";import{t as D}from"./switch-CajEVBL2.js";import{_n as O,an as k,cn as A,dn as j,fn as M,gn as N,ln as P,mn as ee,on as F,pn as I,un as L}from"./constants-CG3Vqtr2.js";import{$t as R,Br as te,Bt as ne,Gt as re,Ht as ie,Ir as z,Qr as B,Ut as V,Vr as H,Vt as U,Xn as W,k as G,pn as K,zr as q}from"./index-DrTotskf.js";import{t as J}from"./index.es-C5Wm6FW7.js";import{t as Y}from"./CopyToClipboard-DaB2iAye.js";import{t as X}from"./ImagePreview-CbEvXym3.js";import{n as ae}from"./taskDrawerMixin-DEgO_R5H.js";import{t as oe}from"./Consumption-DBJ6FvEI.js";import{i as Z,n as se,t as ce}from"./pagination-ELGdaz7j.js";import{t as le}from"./ApiCodeButton-DVDvpF39.js";import{t as ue}from"./BotPlaceholder-DKqHzqLl.js";import{t as de}from"./NoTasks-CLNtgfi4.js";import{t as fe}from"./PromptTextarea-FYbsElB4.js";import{t as pe}from"./ImageWrapper-C_Q6zeaX.js";var me=r({name:`LayoutSeedream`,components:{ElDrawer:T,ElButton:B,FontAwesomeIcon:J},mixins:[ae]}),he={class:`main flex flex-row flex-1`},ge={class:`config w-[320px] h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},_e={class:`result h-full p-6 flex-1 flex flex-col bg-[var(--app-content-bg)]`};function ve(e,r,i,a,s,c){let l=h(`font-awesome-icon`),d=h(`el-button`),m=h(`el-drawer`);return u(),t(`div`,he,[n(`div`,ge,[p(e.$slots,`config`,{},void 0,!0)]),n(`div`,_e,[p(e.$slots,`result`,{},void 0,!0)]),f(o(d,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:g(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[_,!e.tasksEmpty]]),o(m,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:g(()=>[p(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ye=G(me,[[`render`,ve],[`__scopeId`,`data-v-2a1715d6`]]),be=r({name:`SeedreamPromptInput`,components:{PromptTextarea:fe},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function xe(e,t,n,r,i,o){let s=h(`prompt-textarea`);return u(),a(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Se=G(be,[[`render`,xe]]),Ce={image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};function Q(e){switch(e){case j:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case L:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case P:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case A:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:F[A],outputFormat:!1,tools:!1};case M:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:F[M],outputFormat:!1,tools:!1};default:return Ce}}var we=[`1K`,`2K`,`3K`,`4K`];function Te(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Q(n),i=[];Array.isArray(e.image)&&e.image.length>0&&!r.image&&i.push({field:`image`,i18nLabel:`seedream.name.imageUrls`});let a=typeof e.size==`string`?e.size:void 0;if(a){let e=a.toUpperCase();(we.includes(e)&&!r.sizeTiers.includes(e)||a===`adaptive`&&!r.sizeAdaptive)&&i.push({field:`size`,i18nLabel:`seedream.name.size`})}return e.sequential_image_generation===`auto`&&!r.groupGeneration&&i.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&e.seed!==null&&!r.seed&&i.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&e.guidance_scale!==null&&!r.guidanceScale&&i.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!r.outputFormat&&i.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),Array.isArray(e.tools)&&e.tools.length>0&&!r.tools&&i.push({field:`tools`,i18nLabel:`seedream.name.tools`}),i}function Ee(e,t,n){let r={...e},i=Q(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var De=r({name:`SeedreamImageInput`,components:{ElUpload:x,ElButton:B,InfoIcon:Z,ImagePreview:X,FontAwesomeIcon:J},mixins:[V,U],data(){return{fileList:[],uploadUrl:q()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.seedream?.config?.image},model(){return this.$store.state.seedream?.config?.model},supported(){return Q(this.model).image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){H.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){H.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),Oe={key:0},ke={class:`field`},Ae={class:`label`},je={class:`box`},Me={class:`title font-bold`},Ne={class:`value`},Pe={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Fe(r,c,d,f,p,_){let v=h(`info-icon`),y=h(`font-awesome-icon`),b=h(`el-button`),x=h(`el-upload`),S=h(`image-preview`);return r.supported?(u(),t(`div`,Oe,[n(`div`,ke,[n(`div`,Ae,[n(`div`,je,[n(`h2`,Me,l(r.$t(`seedream.name.imageUrls`)),1),o(v,{content:r.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),n(`div`,Ne,[o(x,{ref:`uploader`,"file-list":r.fileList,"onUpdate:fileList":c[0]||=e=>r.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:r.uploadUrl,"on-exceed":r.onExceed,"on-error":r.onError,"on-success":r.onSuccess,"on-change":r.onChange,"on-remove":r.onRemove,headers:r.headers},{default:g(()=>[o(b,{size:`small`,type:`primary`,round:``},{default:g(()=>[o(y,{icon:`fa-solid fa-upload`,class:`mr-1`}),i(` `+l(r.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),n(`div`,Pe,[(u(!0),t(s,null,e(r.fileList,(e,t)=>(u(),a(S,{key:e.uid||e?.response?.file_url||e.url||t,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>r.onRemovePreview(t,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):m(``,!0)}var Ie=G(De,[[`render`,Fe],[`__scopeId`,`data-v-6ef4c2e4`]]),Le=r({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{revertKey:0,options:[{value:j,label:this.$t(`seedream.model.seedream50`)},{value:L,label:this.$t(`seedream.model.seedream45`)},{value:P,label:this.$t(`seedream.model.seedream40`)},{value:A,label:this.$t(`seedream.model.seedream30t2i`)},{value:M,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(k)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Te(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await te.confirm(this.$t(`seedream.message.featureNotSupportedBody`,{fields:r}),this.$t(`seedream.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`seedream.button.confirmContinue`),cancelButtonText:this.$t(`seedream.button.cancelSwitch`),type:`warning`});let i=Ee({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),H.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),Re={class:`field`},ze={class:`label`},Be={class:`box`},Ve={class:`title font-bold`};function He(r,i,c,d,f,p){let m=h(`info-icon`),_=h(`el-option`),v=h(`el-select`);return u(),t(`div`,Re,[n(`div`,ze,[n(`div`,Be,[n(`h2`,Ve,l(r.$t(`seedream.name.model`)),1),o(m,{content:r.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(u(),a(v,{key:r.revertKey,"model-value":r.value,class:`value`,placeholder:r.$t(`seedream.placeholder.select`),onChange:r.onChange},{default:g(()=>[(u(!0),t(s,null,e(r.options,e=>(u(),a(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Ue=G(Le,[[`render`,He],[`__scopeId`,`data-v-8892a12c`]]),We=r({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:Z},data(){return{SEEDREAM_SIZE_ADAPTIVE:N,pixelOptions:ee}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Q(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),Ge={class:`field`},Ke={class:`label`},qe={class:`box`},Je={class:`title font-bold`};function Ye(r,i,c,d,f,p){let _=h(`info-icon`),v=h(`el-option`),y=h(`el-option-group`),b=h(`el-select`);return u(),t(`div`,Ge,[n(`div`,Ke,[n(`div`,qe,[n(`h2`,Je,l(r.$t(`seedream.name.size`)),1),o(_,{content:r.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),o(b,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:g(()=>[r.capabilities.sizeTiers.length?(u(),a(y,{key:0,label:r.$t(`seedream.size.group.tier`)},{default:g(()=>[(u(!0),t(s,null,e(r.capabilities.sizeTiers,e=>(u(),a(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):m(``,!0),r.capabilities.sizeAdaptive?(u(),a(y,{key:1,label:r.$t(`seedream.size.group.adaptive`)},{default:g(()=>[(u(),a(v,{key:r.SEEDREAM_SIZE_ADAPTIVE,label:r.$t(`seedream.size.adaptive`),value:r.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):m(``,!0),o(y,{label:r.$t(`seedream.size.group.pixel`)},{default:g(()=>[(u(!0),t(s,null,e(r.pixelOptions,e=>(u(),a(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var Xe=G(We,[[`render`,Ye],[`__scopeId`,`data-v-dd7bd021`]]),Ze=r({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),Qe={key:0,class:`field`},$e={class:`label`},et={class:`box`},tt={class:`title font-bold`},nt={class:`value`};function rt(e,r,i,a,s,c){let d=h(`info-icon`),f=h(`el-input-number`);return e.supported?(u(),t(`div`,Qe,[n(`div`,$e,[n(`div`,et,[n(`h2`,tt,l(e.$t(`seedream.name.maxImages`)),1),o(d,{content:e.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),n(`div`,nt,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,min:1,max:e.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):m(``,!0)}var it=G(Ze,[[`render`,rt],[`__scopeId`,`data-v-f079fd20`]]),at=r({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[...I]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),ot={key:0,class:`field`},st={class:`label`},ct={class:`box`},lt={class:`title font-bold`};function ut(r,i,c,d,f,p){let _=h(`info-icon`),v=h(`el-option`),y=h(`el-select`);return r.supported?(u(),t(`div`,ot,[n(`div`,st,[n(`div`,ct,[n(`h2`,lt,l(r.$t(`seedream.name.outputFormat`)),1),o(_,{content:r.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),o(y,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedream.placeholder.select`)},{default:g(()=>[(u(!0),t(s,null,e(r.options,e=>(u(),a(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):m(``,!0)}var dt=G(at,[[`render`,ut],[`__scopeId`,`data-v-69ea4c07`]]),ft=r({name:`SeedreamSeedInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),pt={key:0,class:`field`},mt={class:`label`},ht={class:`box`},gt={class:`title font-bold`},_t={class:`value`};function vt(e,r,i,a,s,c){let d=h(`info-icon`),f=h(`el-input-number`);return e.supported?(u(),t(`div`,pt,[n(`div`,mt,[n(`div`,ht,[n(`h2`,gt,l(e.$t(`seedream.name.seed`)),1),o(d,{content:e.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),n(`div`,_t,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):m(``,!0)}var yt=G(ft,[[`render`,vt],[`__scopeId`,`data-v-10cdc1e0`]]),bt=r({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).guidanceScale},defaultValue(){return Q(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),xt={key:0,class:`field`},St={class:`label`},Ct={class:`box`},wt={class:`title font-bold`},Tt={class:`value`};function Et(e,r,i,a,s,c){let d=h(`info-icon`),f=h(`el-input-number`);return e.supported?(u(),t(`div`,xt,[n(`div`,St,[n(`div`,Ct,[n(`h2`,wt,l(e.$t(`seedream.name.guidanceScale`)),1),o(d,{content:e.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),n(`div`,Tt,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):m(``,!0)}var Dt=G(bt,[[`render`,Et],[`__scopeId`,`data-v-7386f064`]]),Ot=r({name:`SeedreamWatermarkSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{value:{get(){let e=this.$store.state.seedream?.config?.watermark;return e===void 0?!1:!!e},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,watermark:e})}}}}),kt={class:`field`},At={class:`label`},jt={class:`box`},Mt={class:`title font-bold`},Nt={class:`value`};function Pt(e,r,i,a,s,c){let d=h(`info-icon`),f=h(`el-switch`);return u(),t(`div`,kt,[n(`div`,At,[n(`div`,jt,[n(`h2`,Mt,l(e.$t(`seedream.name.watermark`)),1),o(d,{content:e.$t(`seedream.description.watermark`),class:`info`},null,8,[`content`])])]),n(`div`,Nt,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t},null,8,[`modelValue`])])])}var Ft=r({name:`SeedreamConfigPanel`,components:{ElButton:B,FontAwesomeIcon:J,PromptInput:Se,Consumption:oe,ImageInput:Ie,ModelSelector:Ue,SizeSelector:Xe,MaxImagesSelector:it,OutputFormatSelector:dt,SeedInput:yt,GuidanceScaleInput:Dt,WatermarkSwitch:G(Ot,[[`render`,Pt],[`__scopeId`,`data-v-9e2abf0f`]])},emits:[`generate`],computed:{config(){return this.$store.state.seedream?.config},consumption(){let e={...this.config||{}},t=Array.isArray(e?.image)&&e.image.length>0,n=e?.sequential_image_generation===`auto`?Math.max(1,Math.floor(e?.sequential_image_generation_options?.max_images||1)):1;return re({...e,action:t?`edit`:`generate`,model:O(e?.model),count:n},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),It={class:`flex flex-col h-full`},Lt={class:`flex-1 overflow-y-auto p-5`},Rt={class:`flex flex-col items-center justify-center px-5 pb-5`};function zt(e,r,a,s,c,d){let f=h(`model-selector`),p=h(`size-selector`),m=h(`max-images-selector`),_=h(`output-format-selector`),v=h(`seed-input`),y=h(`guidance-scale-input`),b=h(`watermark-switch`),x=h(`prompt-input`),S=h(`image-input`),C=h(`consumption`),w=h(`font-awesome-icon`),T=h(`el-button`);return u(),t(`div`,It,[n(`div`,Lt,[o(f,{class:`mb-4`}),o(p,{class:`mb-4`}),o(m,{class:`mb-4`}),o(_,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`}),o(b,{class:`mb-4`}),o(x,{class:`mb-4`}),o(S,{class:`mb-4`})]),n(`div`,Rt,[o(C,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(T,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:g(()=>[o(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Bt=G(Ft,[[`render`,zt]]),Vt=r({name:`SeedreamTaskPreview`,components:{ElImage:C,CopyToClipboard:Y,FontAwesomeIcon:J,ElAlert:w,ImageWrapper:pe,ElButton:B,ElTooltip:S,ImagePreview:X,ApiCodeButton:le},props:{modelValue:{type:Object,required:!0}},computed:{isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{shortModel(e){return O(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Ht={class:`preview`},Ut={class:`left`},Wt={class:`main`},Gt={class:`bot`},Kt={class:`datetime`},qt={class:`info`},Jt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Yt={key:1,class:`prompt mt-2`},Xt={key:0},Zt={key:0,class:c({content:!0})},Qt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$t={key:1,class:c({content:!0,failed:!0})},en={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},tn={class:c({operations:!0,"mt-2":!0,"mb-2":!0})},nn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},rn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:2,class:c({content:!0})},ln={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},un={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},gn={key:3,class:c({content:!0})},_n={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function yn(r,c,f,p,_,v){let y=h(`el-image`),b=h(`image-preview`),x=h(`font-awesome-icon`),S=h(`copy-to-clipboard`),C=h(`el-alert`),w=h(`image-wrapper`),T=h(`el-button`),E=h(`el-tooltip`),D=h(`api-code-button`);return u(),t(`div`,Ht,[n(`div`,Ut,[o(y,{src:`https://cdn.acedata.cloud/9egrbn.png`,class:`avatar`})]),n(`div`,Wt,[n(`div`,Gt,[i(l(r.$t(`seedream.name.seedreamBot`))+` `,1),n(`span`,Kt,l(r.$dayjs.format(``+new Date(parseFloat((r.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,qt,[Array.isArray(r.modelValue?.request?.image)&&r.modelValue?.request?.image.length>0?(u(),t(`div`,Jt,[(u(!0),t(s,null,e(r.modelValue?.request?.image,(e,t)=>(u(),a(b,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):m(``,!0),r.modelValue?.request?.prompt?(u(),t(`p`,Yt,[i(l(r.modelValue?.request?.prompt)+` `,1),r.modelValue?.response?m(``,!0):(u(),t(`span`,Xt,` - (`+l(r.$t(`seedream.status.pending`))+`) `,1))])):m(``,!0)]),r.modelValue?.response?r.modelValue?.response?.success===!0?(u(),t(`div`,$t,[n(`div`,en,[(u(!0),t(s,null,e(r.images,(e,t)=>(u(),a(w,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),n(`div`,tn,[o(E,{class:`box-item`,effect:`dark`,content:r.$t(`common.button.edit`),placement:`top-start`},{default:g(()=>[o(T,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=d(e=>r.onEdit(r.images?.[0]?.image_url),[`stop`])},{default:g(()=>[i(l(r.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),o(D,{path:`/seedream/images`,body:r.modelValue?.request},null,8,[`body`])]),o(C,{closable:!1,class:`mt-2 success`},{default:g(()=>[r.modelValue?.request?.model?(u(),t(`p`,nn,[o(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.model`))+`: `+l(r.shortModel(r.modelValue?.request?.model)),1)])):m(``,!0),r.modelValue?.request?.size?(u(),t(`p`,rn,[o(x,{icon:`fa-solid fa-image`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.size`))+`: `+l(r.modelValue?.request?.size),1)])):m(``,!0),n(`p`,an,[o(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.task`))+`: `+l(r.isEdit?r.$t(`seedream.name.edits`):r.$t(`seedream.name.generate`)),1)]),n(`p`,on,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.taskId`))+`: `+l(r.modelValue?.id)+` `,1),o(S,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.elapsed?(u(),t(`p`,sn,[o(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.elapsed`))+`: `+l(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):m(``,!0),r.modelValue?.response?.trace_id?(u(),t(`p`,cn,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.traceId`))+`: `+l(r.modelValue?.response?.trace_id)+` `,1),o(S,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):m(``,!0)]),_:1})])):r.modelValue?.response?.success===!1?(u(),t(`div`,$,[o(C,{closable:!1,class:`failure`},{template:g(()=>[o(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.failure`)),1)]),default:g(()=>[r.modelValue?.request?.model?(u(),t(`p`,ln,[o(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.model`))+`: `+l(r.shortModel(r.modelValue?.request?.model)),1)])):m(``,!0),r.modelValue?.request?.size?(u(),t(`p`,un,[o(x,{icon:`fa-solid fa-image`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.size`))+`: `+l(r.modelValue?.request?.size),1)])):m(``,!0),n(`p`,dn,[o(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.task`))+`: `+l(r.isEdit?r.$t(`seedream.name.edits`):r.$t(`seedream.name.generate`)),1)]),n(`p`,fn,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.taskId`))+`: `+l(r.modelValue?.id)+` `,1),o(S,{content:r.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),r.modelValue?.response?.error?.message?(u(),t(`p`,pn,[o(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.failureReason`))+`: `+l(r.modelValue?.response?.error?.message)+` `,1),o(S,{content:r.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):m(``,!0),r.modelValue?.elapsed?(u(),t(`p`,mn,[o(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.elapsed`))+`: `+l(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):m(``,!0),r.modelValue?.response?.trace_id?(u(),t(`p`,hn,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.traceId`))+`: `+l(r.modelValue?.response?.trace_id)+` `,1),o(S,{content:r.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):m(``,!0)]),_:1})])):(u(),t(`div`,gn,[o(C,{closable:!1,class:`info`},{template:g(()=>[o(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.status`)),1)]),default:g(()=>[n(`p`,_n,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.taskId`))+`: `+l(r.modelValue?.id)+` `,1),o(S,{content:r.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),r.modelValue?.response?.trace_id?(u(),t(`p`,vn,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.traceId`))+`: `+l(r.modelValue?.response?.trace_id)+` `,1),o(S,{content:r.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):m(``,!0)]),_:1})])):(u(),t(`div`,Zt,[o(C,{closable:!1,class:`info`},{template:g(()=>[o(x,{icon:`fa-regular fa-clock`,class:`mr-1`}),i(` `+l(r.$t(`seedream.status.pending`)),1)]),default:g(()=>[n(`p`,Qt,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.taskId`))+`: `+l(r.modelValue?.id)+` `,1),o(S,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var bn=r({name:`SeedreamRecentPanel`,components:{TaskPreview:G(Vt,[[`render`,yn],[`__scopeId`,`data-v-1b4654bc`]]),BotPlaceholder:ue,NoTasks:de,ScrollList:se},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),xn={key:0},Sn={key:2,class:`w-full h-full flex items-center justify-center`};function Cn(n,r,i,c,l,d){let f=h(`bot-placeholder`),p=h(`task-preview`),_=h(`scroll-list`),v=h(`no-tasks`);return u(),t(s,null,[n.tasks?.items===void 0?(u(),t(`div`,xn,[o(f)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(u(),a(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:g(()=>[(u(!0),t(s,null,e(n.tasks?.items,e=>(u(),a(p,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):m(``,!0),n.tasks?.items?.length===0?(u(),t(`div`,Sn,[o(v)])):m(``,!0)],64)}var wn=r({name:`SeedreamIndex`,components:{ConfigPanel:Bt,Layout:ye,RecentPanel:G(bn,[[`render`,Cn]])},mixins:[ie],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===z.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===z.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ce({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!ne(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let e={...this.config||{}};!(Array.isArray(e?.image)&&e.image.length>0)&&`image`in e&&delete e.image,e?.size||delete e.size;let t={...e,async:!0};if(!R())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}H.info(this.$t(`seedream.message.startingTask`)),W(`seedream`,K.generate(t,{token:n})).then(()=>{H.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?H.error(this.$t(`seedream.message.usedUp`)):H.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Tn(e,t,n,r,i,s){let c=h(`config-panel`),l=h(`recent-panel`),d=h(`layout`);return u(),a(d,null,{config:g(()=>[o(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:g(()=>[o(l,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var En=G(wn,[[`render`,Tn]]);export{En as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Vt as c,Wt as l,Z as u,b as d,dt as f,et as p,k as m,tt as h,ut as g,v as _}from"./vendor-chart-BJCvKk8-.js";import{n as v,r as y,t as b}from"./select-D1ecEVE2.js";import{t as x}from"./upload-ClcuhdFZ.js";import{t as S}from"./tooltip-Bjypgs-B.js";import{t as C}from"./image-BTRKceWr.js";import{t as w}from"./alert-BMYM_Vr-.js";import{t as T}from"./drawer-yIAwJ7En.js";import{t as E}from"./input-number-Cg10sUMa.js";import{t as D}from"./switch-AThus4zo.js";import{_n as O,an as k,cn as A,dn as j,fn as M,gn as N,ln as P,mn as ee,on as F,pn as I,un as L}from"./constants-CG3Vqtr2.js";import{$t as R,Br as te,Bt as ne,Gt as re,Ht as ie,Ir as z,Qr as B,Ut as V,Vr as H,Vt as U,Xn as W,k as G,pn as K,zr as q}from"./index-C8ufQprS.js";import{t as J}from"./index.es-D_ksxY2f.js";import{t as Y}from"./CopyToClipboard-DOIyE45l.js";import{t as X}from"./ImagePreview-h9Y8nGAq.js";import{n as ae}from"./taskDrawerMixin-DEgO_R5H.js";import{t as oe}from"./Consumption-yJBcaOnM.js";import{i as Z,n as se,t as ce}from"./pagination-CEQQXX-i.js";import{t as le}from"./ApiCodeButton-BNuNdq4D.js";import{t as ue}from"./BotPlaceholder-CsEE_kEM.js";import{t as de}from"./NoTasks-QEMQL-Gn.js";import{t as fe}from"./PromptTextarea-DDKIJKMv.js";import{t as pe}from"./ImageWrapper-CWfsDw_F.js";var me=r({name:`LayoutSeedream`,components:{ElDrawer:T,ElButton:B,FontAwesomeIcon:J},mixins:[ae]}),he={class:`main flex flex-row flex-1`},ge={class:`config w-[320px] h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},_e={class:`result h-full p-6 flex-1 flex flex-col bg-[var(--app-content-bg)]`};function ve(e,r,i,a,s,c){let l=h(`font-awesome-icon`),d=h(`el-button`),m=h(`el-drawer`);return u(),t(`div`,he,[n(`div`,ge,[p(e.$slots,`config`,{},void 0,!0)]),n(`div`,_e,[p(e.$slots,`result`,{},void 0,!0)]),f(o(d,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:g(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[_,!e.tasksEmpty]]),o(m,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:g(()=>[p(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ye=G(me,[[`render`,ve],[`__scopeId`,`data-v-2a1715d6`]]),be=r({name:`SeedreamPromptInput`,components:{PromptTextarea:fe},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function xe(e,t,n,r,i,o){let s=h(`prompt-textarea`);return u(),a(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Se=G(be,[[`render`,xe]]),Ce={image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};function Q(e){switch(e){case j:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case L:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case P:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case A:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:F[A],outputFormat:!1,tools:!1};case M:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:F[M],outputFormat:!1,tools:!1};default:return Ce}}var we=[`1K`,`2K`,`3K`,`4K`];function Te(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Q(n),i=[];Array.isArray(e.image)&&e.image.length>0&&!r.image&&i.push({field:`image`,i18nLabel:`seedream.name.imageUrls`});let a=typeof e.size==`string`?e.size:void 0;if(a){let e=a.toUpperCase();(we.includes(e)&&!r.sizeTiers.includes(e)||a===`adaptive`&&!r.sizeAdaptive)&&i.push({field:`size`,i18nLabel:`seedream.name.size`})}return e.sequential_image_generation===`auto`&&!r.groupGeneration&&i.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&e.seed!==null&&!r.seed&&i.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&e.guidance_scale!==null&&!r.guidanceScale&&i.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!r.outputFormat&&i.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),Array.isArray(e.tools)&&e.tools.length>0&&!r.tools&&i.push({field:`tools`,i18nLabel:`seedream.name.tools`}),i}function Ee(e,t,n){let r={...e},i=Q(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var De=r({name:`SeedreamImageInput`,components:{ElUpload:x,ElButton:B,InfoIcon:Z,ImagePreview:X,FontAwesomeIcon:J},mixins:[V,U],data(){return{fileList:[],uploadUrl:q()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.seedream?.config?.image},model(){return this.$store.state.seedream?.config?.model},supported(){return Q(this.model).image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){H.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){H.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),Oe={key:0},ke={class:`field`},Ae={class:`label`},je={class:`box`},Me={class:`title font-bold`},Ne={class:`value`},Pe={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Fe(r,c,d,f,p,_){let v=h(`info-icon`),y=h(`font-awesome-icon`),b=h(`el-button`),x=h(`el-upload`),S=h(`image-preview`);return r.supported?(u(),t(`div`,Oe,[n(`div`,ke,[n(`div`,Ae,[n(`div`,je,[n(`h2`,Me,l(r.$t(`seedream.name.imageUrls`)),1),o(v,{content:r.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),n(`div`,Ne,[o(x,{ref:`uploader`,"file-list":r.fileList,"onUpdate:fileList":c[0]||=e=>r.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:r.uploadUrl,"on-exceed":r.onExceed,"on-error":r.onError,"on-success":r.onSuccess,"on-change":r.onChange,"on-remove":r.onRemove,headers:r.headers},{default:g(()=>[o(b,{size:`small`,type:`primary`,round:``},{default:g(()=>[o(y,{icon:`fa-solid fa-upload`,class:`mr-1`}),i(` `+l(r.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),n(`div`,Pe,[(u(!0),t(s,null,e(r.fileList,(e,t)=>(u(),a(S,{key:e.uid||e?.response?.file_url||e.url||t,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>r.onRemovePreview(t,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):m(``,!0)}var Ie=G(De,[[`render`,Fe],[`__scopeId`,`data-v-6ef4c2e4`]]),Le=r({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{revertKey:0,options:[{value:j,label:this.$t(`seedream.model.seedream50`)},{value:L,label:this.$t(`seedream.model.seedream45`)},{value:P,label:this.$t(`seedream.model.seedream40`)},{value:A,label:this.$t(`seedream.model.seedream30t2i`)},{value:M,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(k)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Te(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await te.confirm(this.$t(`seedream.message.featureNotSupportedBody`,{fields:r}),this.$t(`seedream.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`seedream.button.confirmContinue`),cancelButtonText:this.$t(`seedream.button.cancelSwitch`),type:`warning`});let i=Ee({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),H.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),Re={class:`field`},ze={class:`label`},Be={class:`box`},Ve={class:`title font-bold`};function He(r,i,c,d,f,p){let m=h(`info-icon`),_=h(`el-option`),v=h(`el-select`);return u(),t(`div`,Re,[n(`div`,ze,[n(`div`,Be,[n(`h2`,Ve,l(r.$t(`seedream.name.model`)),1),o(m,{content:r.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(u(),a(v,{key:r.revertKey,"model-value":r.value,class:`value`,placeholder:r.$t(`seedream.placeholder.select`),onChange:r.onChange},{default:g(()=>[(u(!0),t(s,null,e(r.options,e=>(u(),a(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Ue=G(Le,[[`render`,He],[`__scopeId`,`data-v-8892a12c`]]),We=r({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:Z},data(){return{SEEDREAM_SIZE_ADAPTIVE:N,pixelOptions:ee}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Q(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),Ge={class:`field`},Ke={class:`label`},qe={class:`box`},Je={class:`title font-bold`};function Ye(r,i,c,d,f,p){let _=h(`info-icon`),v=h(`el-option`),y=h(`el-option-group`),b=h(`el-select`);return u(),t(`div`,Ge,[n(`div`,Ke,[n(`div`,qe,[n(`h2`,Je,l(r.$t(`seedream.name.size`)),1),o(_,{content:r.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),o(b,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:g(()=>[r.capabilities.sizeTiers.length?(u(),a(y,{key:0,label:r.$t(`seedream.size.group.tier`)},{default:g(()=>[(u(!0),t(s,null,e(r.capabilities.sizeTiers,e=>(u(),a(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):m(``,!0),r.capabilities.sizeAdaptive?(u(),a(y,{key:1,label:r.$t(`seedream.size.group.adaptive`)},{default:g(()=>[(u(),a(v,{key:r.SEEDREAM_SIZE_ADAPTIVE,label:r.$t(`seedream.size.adaptive`),value:r.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):m(``,!0),o(y,{label:r.$t(`seedream.size.group.pixel`)},{default:g(()=>[(u(!0),t(s,null,e(r.pixelOptions,e=>(u(),a(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var Xe=G(We,[[`render`,Ye],[`__scopeId`,`data-v-dd7bd021`]]),Ze=r({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),Qe={key:0,class:`field`},$e={class:`label`},et={class:`box`},tt={class:`title font-bold`},nt={class:`value`};function rt(e,r,i,a,s,c){let d=h(`info-icon`),f=h(`el-input-number`);return e.supported?(u(),t(`div`,Qe,[n(`div`,$e,[n(`div`,et,[n(`h2`,tt,l(e.$t(`seedream.name.maxImages`)),1),o(d,{content:e.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),n(`div`,nt,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,min:1,max:e.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):m(``,!0)}var it=G(Ze,[[`render`,rt],[`__scopeId`,`data-v-f079fd20`]]),at=r({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[...I]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),ot={key:0,class:`field`},st={class:`label`},ct={class:`box`},lt={class:`title font-bold`};function ut(r,i,c,d,f,p){let _=h(`info-icon`),v=h(`el-option`),y=h(`el-select`);return r.supported?(u(),t(`div`,ot,[n(`div`,st,[n(`div`,ct,[n(`h2`,lt,l(r.$t(`seedream.name.outputFormat`)),1),o(_,{content:r.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),o(y,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedream.placeholder.select`)},{default:g(()=>[(u(!0),t(s,null,e(r.options,e=>(u(),a(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):m(``,!0)}var dt=G(at,[[`render`,ut],[`__scopeId`,`data-v-69ea4c07`]]),ft=r({name:`SeedreamSeedInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),pt={key:0,class:`field`},mt={class:`label`},ht={class:`box`},gt={class:`title font-bold`},_t={class:`value`};function vt(e,r,i,a,s,c){let d=h(`info-icon`),f=h(`el-input-number`);return e.supported?(u(),t(`div`,pt,[n(`div`,mt,[n(`div`,ht,[n(`h2`,gt,l(e.$t(`seedream.name.seed`)),1),o(d,{content:e.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),n(`div`,_t,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):m(``,!0)}var yt=G(ft,[[`render`,vt],[`__scopeId`,`data-v-10cdc1e0`]]),bt=r({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).guidanceScale},defaultValue(){return Q(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),xt={key:0,class:`field`},St={class:`label`},Ct={class:`box`},wt={class:`title font-bold`},Tt={class:`value`};function Et(e,r,i,a,s,c){let d=h(`info-icon`),f=h(`el-input-number`);return e.supported?(u(),t(`div`,xt,[n(`div`,St,[n(`div`,Ct,[n(`h2`,wt,l(e.$t(`seedream.name.guidanceScale`)),1),o(d,{content:e.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),n(`div`,Tt,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):m(``,!0)}var Dt=G(bt,[[`render`,Et],[`__scopeId`,`data-v-7386f064`]]),Ot=r({name:`SeedreamWatermarkSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{value:{get(){let e=this.$store.state.seedream?.config?.watermark;return e===void 0?!1:!!e},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,watermark:e})}}}}),kt={class:`field`},At={class:`label`},jt={class:`box`},Mt={class:`title font-bold`},Nt={class:`value`};function Pt(e,r,i,a,s,c){let d=h(`info-icon`),f=h(`el-switch`);return u(),t(`div`,kt,[n(`div`,At,[n(`div`,jt,[n(`h2`,Mt,l(e.$t(`seedream.name.watermark`)),1),o(d,{content:e.$t(`seedream.description.watermark`),class:`info`},null,8,[`content`])])]),n(`div`,Nt,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t},null,8,[`modelValue`])])])}var Ft=r({name:`SeedreamConfigPanel`,components:{ElButton:B,FontAwesomeIcon:J,PromptInput:Se,Consumption:oe,ImageInput:Ie,ModelSelector:Ue,SizeSelector:Xe,MaxImagesSelector:it,OutputFormatSelector:dt,SeedInput:yt,GuidanceScaleInput:Dt,WatermarkSwitch:G(Ot,[[`render`,Pt],[`__scopeId`,`data-v-9e2abf0f`]])},emits:[`generate`],computed:{config(){return this.$store.state.seedream?.config},consumption(){let e={...this.config||{}},t=Array.isArray(e?.image)&&e.image.length>0,n=e?.sequential_image_generation===`auto`?Math.max(1,Math.floor(e?.sequential_image_generation_options?.max_images||1)):1;return re({...e,action:t?`edit`:`generate`,model:O(e?.model),count:n},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),It={class:`flex flex-col h-full`},Lt={class:`flex-1 overflow-y-auto p-5`},Rt={class:`flex flex-col items-center justify-center px-5 pb-5`};function zt(e,r,a,s,c,d){let f=h(`model-selector`),p=h(`size-selector`),m=h(`max-images-selector`),_=h(`output-format-selector`),v=h(`seed-input`),y=h(`guidance-scale-input`),b=h(`watermark-switch`),x=h(`prompt-input`),S=h(`image-input`),C=h(`consumption`),w=h(`font-awesome-icon`),T=h(`el-button`);return u(),t(`div`,It,[n(`div`,Lt,[o(f,{class:`mb-4`}),o(p,{class:`mb-4`}),o(m,{class:`mb-4`}),o(_,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`}),o(b,{class:`mb-4`}),o(x,{class:`mb-4`}),o(S,{class:`mb-4`})]),n(`div`,Rt,[o(C,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(T,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:g(()=>[o(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Bt=G(Ft,[[`render`,zt]]),Vt=r({name:`SeedreamTaskPreview`,components:{ElImage:C,CopyToClipboard:Y,FontAwesomeIcon:J,ElAlert:w,ImageWrapper:pe,ElButton:B,ElTooltip:S,ImagePreview:X,ApiCodeButton:le},props:{modelValue:{type:Object,required:!0}},computed:{isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{shortModel(e){return O(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Ht={class:`preview`},Ut={class:`left`},Wt={class:`main`},Gt={class:`bot`},Kt={class:`datetime`},qt={class:`info`},Jt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Yt={key:1,class:`prompt mt-2`},Xt={key:0},Zt={key:0,class:c({content:!0})},Qt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$t={key:1,class:c({content:!0,failed:!0})},en={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},tn={class:c({operations:!0,"mt-2":!0,"mb-2":!0})},nn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},rn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:2,class:c({content:!0})},ln={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},un={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},gn={key:3,class:c({content:!0})},_n={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function yn(r,c,f,p,_,v){let y=h(`el-image`),b=h(`image-preview`),x=h(`font-awesome-icon`),S=h(`copy-to-clipboard`),C=h(`el-alert`),w=h(`image-wrapper`),T=h(`el-button`),E=h(`el-tooltip`),D=h(`api-code-button`);return u(),t(`div`,Ht,[n(`div`,Ut,[o(y,{src:`https://cdn.acedata.cloud/9egrbn.png`,class:`avatar`})]),n(`div`,Wt,[n(`div`,Gt,[i(l(r.$t(`seedream.name.seedreamBot`))+` `,1),n(`span`,Kt,l(r.$dayjs.format(``+new Date(parseFloat((r.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,qt,[Array.isArray(r.modelValue?.request?.image)&&r.modelValue?.request?.image.length>0?(u(),t(`div`,Jt,[(u(!0),t(s,null,e(r.modelValue?.request?.image,(e,t)=>(u(),a(b,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):m(``,!0),r.modelValue?.request?.prompt?(u(),t(`p`,Yt,[i(l(r.modelValue?.request?.prompt)+` `,1),r.modelValue?.response?m(``,!0):(u(),t(`span`,Xt,` - (`+l(r.$t(`seedream.status.pending`))+`) `,1))])):m(``,!0)]),r.modelValue?.response?r.modelValue?.response?.success===!0?(u(),t(`div`,$t,[n(`div`,en,[(u(!0),t(s,null,e(r.images,(e,t)=>(u(),a(w,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),n(`div`,tn,[o(E,{class:`box-item`,effect:`dark`,content:r.$t(`common.button.edit`),placement:`top-start`},{default:g(()=>[o(T,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=d(e=>r.onEdit(r.images?.[0]?.image_url),[`stop`])},{default:g(()=>[i(l(r.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),o(D,{path:`/seedream/images`,body:r.modelValue?.request},null,8,[`body`])]),o(C,{closable:!1,class:`mt-2 success`},{default:g(()=>[r.modelValue?.request?.model?(u(),t(`p`,nn,[o(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.model`))+`: `+l(r.shortModel(r.modelValue?.request?.model)),1)])):m(``,!0),r.modelValue?.request?.size?(u(),t(`p`,rn,[o(x,{icon:`fa-solid fa-image`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.size`))+`: `+l(r.modelValue?.request?.size),1)])):m(``,!0),n(`p`,an,[o(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.task`))+`: `+l(r.isEdit?r.$t(`seedream.name.edits`):r.$t(`seedream.name.generate`)),1)]),n(`p`,on,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.taskId`))+`: `+l(r.modelValue?.id)+` `,1),o(S,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.elapsed?(u(),t(`p`,sn,[o(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.elapsed`))+`: `+l(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):m(``,!0),r.modelValue?.response?.trace_id?(u(),t(`p`,cn,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.traceId`))+`: `+l(r.modelValue?.response?.trace_id)+` `,1),o(S,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):m(``,!0)]),_:1})])):r.modelValue?.response?.success===!1?(u(),t(`div`,$,[o(C,{closable:!1,class:`failure`},{template:g(()=>[o(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.failure`)),1)]),default:g(()=>[r.modelValue?.request?.model?(u(),t(`p`,ln,[o(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.model`))+`: `+l(r.shortModel(r.modelValue?.request?.model)),1)])):m(``,!0),r.modelValue?.request?.size?(u(),t(`p`,un,[o(x,{icon:`fa-solid fa-image`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.size`))+`: `+l(r.modelValue?.request?.size),1)])):m(``,!0),n(`p`,dn,[o(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.task`))+`: `+l(r.isEdit?r.$t(`seedream.name.edits`):r.$t(`seedream.name.generate`)),1)]),n(`p`,fn,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.taskId`))+`: `+l(r.modelValue?.id)+` `,1),o(S,{content:r.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),r.modelValue?.response?.error?.message?(u(),t(`p`,pn,[o(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.failureReason`))+`: `+l(r.modelValue?.response?.error?.message)+` `,1),o(S,{content:r.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):m(``,!0),r.modelValue?.elapsed?(u(),t(`p`,mn,[o(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.elapsed`))+`: `+l(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):m(``,!0),r.modelValue?.response?.trace_id?(u(),t(`p`,hn,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.traceId`))+`: `+l(r.modelValue?.response?.trace_id)+` `,1),o(S,{content:r.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):m(``,!0)]),_:1})])):(u(),t(`div`,gn,[o(C,{closable:!1,class:`info`},{template:g(()=>[o(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.status`)),1)]),default:g(()=>[n(`p`,_n,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.taskId`))+`: `+l(r.modelValue?.id)+` `,1),o(S,{content:r.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),r.modelValue?.response?.trace_id?(u(),t(`p`,vn,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.traceId`))+`: `+l(r.modelValue?.response?.trace_id)+` `,1),o(S,{content:r.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):m(``,!0)]),_:1})])):(u(),t(`div`,Zt,[o(C,{closable:!1,class:`info`},{template:g(()=>[o(x,{icon:`fa-regular fa-clock`,class:`mr-1`}),i(` `+l(r.$t(`seedream.status.pending`)),1)]),default:g(()=>[n(`p`,Qt,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(r.$t(`seedream.name.taskId`))+`: `+l(r.modelValue?.id)+` `,1),o(S,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var bn=r({name:`SeedreamRecentPanel`,components:{TaskPreview:G(Vt,[[`render`,yn],[`__scopeId`,`data-v-1b4654bc`]]),BotPlaceholder:ue,NoTasks:de,ScrollList:se},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),xn={key:0},Sn={key:2,class:`w-full h-full flex items-center justify-center`};function Cn(n,r,i,c,l,d){let f=h(`bot-placeholder`),p=h(`task-preview`),_=h(`scroll-list`),v=h(`no-tasks`);return u(),t(s,null,[n.tasks?.items===void 0?(u(),t(`div`,xn,[o(f)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(u(),a(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:g(()=>[(u(!0),t(s,null,e(n.tasks?.items,e=>(u(),a(p,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):m(``,!0),n.tasks?.items?.length===0?(u(),t(`div`,Sn,[o(v)])):m(``,!0)],64)}var wn=r({name:`SeedreamIndex`,components:{ConfigPanel:Bt,Layout:ye,RecentPanel:G(bn,[[`render`,Cn]])},mixins:[ie],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===z.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===z.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ce({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!ne(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let e={...this.config||{}};!(Array.isArray(e?.image)&&e.image.length>0)&&`image`in e&&delete e.image,e?.size||delete e.size;let t={...e,async:!0};if(!R())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}H.info(this.$t(`seedream.message.startingTask`)),W(`seedream`,K.generate(t,{token:n})).then(()=>{H.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?H.error(this.$t(`seedream.message.usedUp`)):H.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Tn(e,t,n,r,i,s){let c=h(`config-panel`),l=h(`recent-panel`),d=h(`layout`);return u(),a(d,null,{config:g(()=>[o(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:g(()=>[o(l,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var En=G(wn,[[`render`,Tn]]);export{En as default};