@acedatacloud/nexior 3.323.7 → 3.323.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/dist/assets/{ApiCodeButton-cix66dAy.js → ApiCodeButton-Di7D_xxs.js} +1 -1
  2. package/dist/assets/{Artifacts-KT8gZoAj.js → Artifacts-CSEdTwAk.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-BjS075BB.js → AskUserQuestionCard-DmX1-lKr.js} +1 -1
  4. package/dist/assets/{Auth-CVH87Wor.js → Auth-BtwZc9Vc.js} +1 -1
  5. package/dist/assets/{Bare-DnsA8m8l.js → Bare-ZGIblGHf.js} +1 -1
  6. package/dist/assets/{BotPlaceholder-DEmcgW2p.js → BotPlaceholder-_zgdRtjQ.js} +1 -1
  7. package/dist/assets/{BottomFooter-W10HAcQN.js → BottomFooter-CpVP89g4.js} +1 -1
  8. package/dist/assets/{Callback-CMCXc1l9.js → Callback-Ju8LF8S5.js} +1 -1
  9. package/dist/assets/{CodeSnippet-l-lWL85j.js → CodeSnippet-lTTF7xm-.js} +1 -1
  10. package/dist/assets/{Console-Qw8i_p_a.js → Console-3P42fy7i.js} +1 -1
  11. package/dist/assets/{Consumption-CT8Jjixf.js → Consumption-DknmQTaS.js} +1 -1
  12. package/dist/assets/{Conversation-DD4KVhzi.js → Conversation-BLXv-Rgd.js} +1 -1
  13. package/dist/assets/{Conversation-CrSVibpb.js → Conversation-DzCJLoT2.js} +1 -1
  14. package/dist/assets/{CopyToClipboard-BsP4OlMx.js → CopyToClipboard-BFD5MUwv.js} +1 -1
  15. package/dist/assets/{Detail-BVSNp_pn.js → Detail-Cir5NFiA.js} +2 -2
  16. package/dist/assets/{Extra-CAqwG5-o.js → Extra-BcgXqn3h.js} +1 -1
  17. package/dist/assets/{FilePreview-gPVBnj64.js → FilePreview-BO9Suzqu.js} +1 -1
  18. package/dist/assets/{Hailuo-C39aOety.js → Hailuo-U6nPYnCl.js} +1 -1
  19. package/dist/assets/{History-DgpdbuEP.js → History-Bdgqldb4.js} +1 -1
  20. package/dist/assets/{ImagePreview-oFylxFC_.js → ImagePreview-BjFaiTLm.js} +1 -1
  21. package/dist/assets/{ImageWrapper-D7lTaFDN.js → ImageWrapper-DCGNvxuj.js} +1 -1
  22. package/dist/assets/{Index-CmtCWS23.js → Index-15A7aZUt.js} +1 -1
  23. package/dist/assets/{Index-BIeOMOdW.js → Index-B0moJvRX.js} +1 -1
  24. package/dist/assets/{Index-9MUgVvuY.js → Index-BCkdZrpN.js} +1 -1
  25. package/dist/assets/{Index-KFyhsExI.js → Index-BHHpDWDQ.js} +1 -1
  26. package/dist/assets/{Index-CZ-bDxpR.js → Index-BIsdZw_D.js} +1 -1
  27. package/dist/assets/{Index-C07CCcI4.js → Index-BOVfT9uP.js} +1 -1
  28. package/dist/assets/{Index-Bb6RMKBF.js → Index-BQxqOSiB.js} +1 -1
  29. package/dist/assets/{Index-CAS7MHJA.js → Index-BSByDIFF.js} +1 -1
  30. package/dist/assets/{Index-G58eBeur.js → Index-BZs9U_Fv.js} +1 -1
  31. package/dist/assets/{Index-CpvUr__i.js → Index-B_p6Ytti.js} +1 -1
  32. package/dist/assets/{Index-DDdCcaj0.js → Index-BfgS7C_k.js} +1 -1
  33. package/dist/assets/{Index-D1zhOTIb.js → Index-BhJphC3t.js} +1 -1
  34. package/dist/assets/{Index-Dk143vEC.js → Index-BjP8GfOO.js} +1 -1
  35. package/dist/assets/{Index-ZrRA1MKo.js → Index-BqCrduap.js} +1 -1
  36. package/dist/assets/{Index-DgKYmW6M.js → Index-BzTo_jBd.js} +1 -1
  37. package/dist/assets/{Index-Dp1nC81x.js → Index-C-2AoTS5.js} +1 -1
  38. package/dist/assets/{Index-fJv4dsHL.js → Index-CAtwJAmt.js} +1 -1
  39. package/dist/assets/{Index-B-TUJK-B.js → Index-CVijn-Rd.js} +1 -1
  40. package/dist/assets/{Index-Dca78uc-.js → Index-CWc4clEk.js} +1 -1
  41. package/dist/assets/{Index-l624Yl2Z.css → Index-CjO-OEFC.css} +1 -1
  42. package/dist/assets/{Index-CjFQ6yKv.js → Index-DIZt9tUR.js} +1 -1
  43. package/dist/assets/{Index-DeM1cLEK.js → Index-DKhMCB7p.js} +1 -1
  44. package/dist/assets/{Index-eKA1DBEM.js → Index-DeGoAKq0.js} +1 -1
  45. package/dist/assets/{Index-Bn2GkDpz.js → Index-DhSC1rHN.js} +1 -1
  46. package/dist/assets/{Index-6dNrFIeX.js → Index-Ds9DQh0T.js} +1 -1
  47. package/dist/assets/{Index-ChWmLIQF.js → Index-I6PBxloH.js} +1 -1
  48. package/dist/assets/{Index-BCkX-hlx.js → Index-dLaqEtW5.js} +1 -1
  49. package/dist/assets/{Index-CVJaRAoW.js → Index-gVCkXkML.js} +1 -1
  50. package/dist/assets/{Index-D7O54ybv.js → Index-lrdT8iP1.js} +1 -1
  51. package/dist/assets/{Invitees-CwdqujAp.js → Invitees-DjcWsWUL.js} +1 -1
  52. package/dist/assets/{List-DlfiPXTx.js → List-Ads3a03m.js} +1 -1
  53. package/dist/assets/{List-B2kWZ2uI.js → List-CNwiUocJ.js} +1 -1
  54. package/dist/assets/{List-93sGPzi5.js → List-_zq_7Nt-.js} +1 -1
  55. package/dist/assets/{LocalTools-DyTelDhB.js → LocalTools-C8trvh3g.js} +1 -1
  56. package/dist/assets/{LocalTools-B3zmDr6f.js → LocalTools-DD-R2FD5.js} +1 -1
  57. package/dist/assets/{Main-CoDpii7s.js → Main-wHb1nSkm.js} +1 -1
  58. package/dist/assets/{Message-DKg3iZSE.js → Message-CeueHTQt.js} +1 -1
  59. package/dist/assets/{Model-BZtX5Fij.js → Model-CTyVJGVy.js} +1 -1
  60. package/dist/assets/{Navigator-BLfyREHx.js → Navigator-DHA6CdiY.js} +3 -3
  61. package/dist/assets/{NoTasks-DDv2Mkgv.js → NoTasks-CbsNUmYf.js} +1 -1
  62. package/dist/assets/{NotFound-DdunJ7B5.js → NotFound-DQDGiQXB.js} +1 -1
  63. package/dist/assets/{Pagination-xcD12KUI.js → Pagination-BEPTLq3j.js} +1 -1
  64. package/dist/assets/{Pay-AabvzdJt.js → Pay-qxItOdNB.js} +1 -1
  65. package/dist/assets/{Player-DA-O8COP.js → Player-BaoMs7v-.js} +1 -1
  66. package/dist/assets/{PromptTextarea-B4gddEM8.js → PromptTextarea-uxWEr-w3.js} +1 -1
  67. package/dist/assets/{RealtimeCall-B9BFWRCy.js → RealtimeCall-2ijS5S-K.js} +1 -1
  68. package/dist/assets/{ScheduledTasks-Cv7-tr5v.js → ScheduledTasks-BSIlGbhT.js} +1 -1
  69. package/dist/assets/{Status-D7kRRaZf.js → Status-CW5WJZyP.js} +1 -1
  70. package/dist/assets/{Subscribe-d1XZHpWx.js → Subscribe-DCK9sY-X.js} +1 -1
  71. package/dist/assets/{TabSwitcher-txcx1y-f.js → TabSwitcher-CvzOoHt5.js} +1 -1
  72. package/dist/assets/{Tts-CVOSwuRc.js → Tts-CPPwpfX_.js} +1 -1
  73. package/dist/assets/{VideoPlayer-DTw3XqQM.js → VideoPlayer-BcwCieEI.js} +1 -1
  74. package/dist/assets/{VideoPreview-CLx1AqjM.js → VideoPreview-CVNMNEzV.js} +1 -1
  75. package/dist/assets/{alert-CauWy1wR.js → alert-BHNa_9CQ.js} +1 -1
  76. package/dist/assets/{avatar-DCdEPSPH.js → avatar-B9PiqcdZ.js} +1 -1
  77. package/dist/assets/{basic-CcseDb44.js → basic-BDZ1c51l.js} +1 -1
  78. package/dist/assets/{chat-1RD59nDU.js → chat-Z6Vwsgt1.js} +1 -1
  79. package/dist/assets/{codingBridge-DiV-Sm2N.js → codingBridge-1rtRo5U1.js} +1 -1
  80. package/dist/assets/{codingBridgeNotify-CNR6Sdqr.js → codingBridgeNotify-CHCZEfYw.js} +2 -2
  81. package/dist/assets/{collapse-BiFqWHd-.js → collapse-DBM7nOqY.js} +1 -1
  82. package/dist/assets/{createTaskActions-BjxAzEWn.js → createTaskActions-BOq8LgHA.js} +1 -1
  83. package/dist/assets/{date-picker-Ce7NKdKq.js → date-picker-DYGF1hSX.js} +1 -1
  84. package/dist/assets/{digitalhuman-BIasFSFM.js → digitalhuman-CyVw01Hh.js} +1 -1
  85. package/dist/assets/{drawer-5IyzIse-.js → drawer-D7cJi5RQ.js} +1 -1
  86. package/dist/assets/{dropdown-DYjB0KYV.js → dropdown--UnaYHAn.js} +1 -1
  87. package/dist/assets/{dropdown-DUzX1W_k.js → dropdown-1yi-SK33.js} +1 -1
  88. package/dist/assets/{esm-GBSZ4UBF.js → esm-BBbh9CMC.js} +2 -2
  89. package/dist/assets/{esm-DP6n0UAZ.js → esm-BCZAD2ML.js} +3 -3
  90. package/dist/assets/esm-CXHSkxBw.js +1 -0
  91. package/dist/assets/{esm-CCkJTD4O.js → esm-Cu_nTE4X.js} +1 -1
  92. package/dist/assets/{esm-B4pxjEa1.js → esm-gIlc6Cc_.js} +1 -1
  93. package/dist/assets/{esm-Cp2brj6_.js → esm-lfRe2Rtw.js} +2 -2
  94. package/dist/assets/{esm-CRy6-lql.js → esm-wKDqTPOv.js} +1 -1
  95. package/dist/assets/{fish-BLbo522X.js → fish-DXSAcKAt.js} +1 -1
  96. package/dist/assets/{flux-C8Peuhn9.js → flux-DnGSXHNr.js} +1 -1
  97. package/dist/assets/{grokvideo-BddaHCWN.js → grokvideo-B3pTqPRN.js} +1 -1
  98. package/dist/assets/{hailuo-CMXmyKAh.js → hailuo-yLcThKE8.js} +1 -1
  99. package/dist/assets/{headshots-BTzusO3s.js → headshots-Bpy5ycy7.js} +1 -1
  100. package/dist/assets/{image-DCil-WkM.js → image-BdxD4NmE.js} +1 -1
  101. package/dist/assets/{index-1vpeSW7k.js → index-BBc6dqlf.js} +3 -3
  102. package/dist/assets/{index.browser.esm-FN1xyacM.js → index.browser.esm-qYH5YUqi.js} +1 -1
  103. package/dist/assets/{index.es-Bl6QYiX-.js → index.es-4wmHyz-M.js} +1 -1
  104. package/dist/assets/{input-number-CQJGerui.js → input-number-CP9TFetR.js} +1 -1
  105. package/dist/assets/{kling-D85xFY2F.js → kling-aOeezMZ8.js} +1 -1
  106. package/dist/assets/{luma-BdI3GOfQ.js → luma-BBIxuBOQ.js} +1 -1
  107. package/dist/assets/{maestro-jqWREyp0.js → maestro-CCPGg3LS.js} +1 -1
  108. package/dist/assets/{midjourney-BfV4vQIK.js → midjourney-DRSxvSrY.js} +1 -1
  109. package/dist/assets/{mobileLocalExec-BLSdfaxA.js → mobileLocalExec-BUUGVRPT.js} +2 -2
  110. package/dist/assets/{nanobanana-te5alPRg.js → nanobanana-D9D7wdUX.js} +1 -1
  111. package/dist/assets/{openaiimage-BnQjgKho.js → openaiimage-B7pphwIS.js} +1 -1
  112. package/dist/assets/{pagination-CiIUjyb0.js → pagination-rrv4XdjG.js} +1 -1
  113. package/dist/assets/{pika-DUONnuzI.js → pika-DBp2I3kQ.js} +1 -1
  114. package/dist/assets/{pixverse-BWuZAlb4.js → pixverse-M3QxDs6j.js} +1 -1
  115. package/dist/assets/{popover-C5nFBFM4.js → popover-Q20CA9DT.js} +1 -1
  116. package/dist/assets/{producer-D7_o-qCb.js → producer-BQRu5c64.js} +1 -1
  117. package/dist/assets/{qrart-BBrJ_EIQ.js → qrart-utx_be6l.js} +1 -1
  118. package/dist/assets/{realtime-DoxriZDf.js → realtime-BwD5iVIv.js} +1 -1
  119. package/dist/assets/{row-C7x_XYva.js → row-DlL-AytX.js} +1 -1
  120. package/dist/assets/{seedance-vf7LbJN8.js → seedance-JWG8nm_0.js} +1 -1
  121. package/dist/assets/{seedream-BJpYH_i-.js → seedream-D1Zcvz0g.js} +1 -1
  122. package/dist/assets/{select-SpoLHPtt.js → select-B8mKNpQs.js} +1 -1
  123. package/dist/assets/{serp-YnNvcLiC.js → serp-Dx7gts3P.js} +1 -1
  124. package/dist/assets/{slider-CGl4ysCi.js → slider-D2rnk3f4.js} +1 -1
  125. package/dist/assets/{solana-wallets-ghJXlXCJ.js → solana-wallets-B1ty0cwt.js} +2 -2
  126. package/dist/assets/{solana-wallets-vue-4RMQ7ZiU.js → solana-wallets-vue-TOwOaGpT.js} +1 -1
  127. package/dist/assets/{sora-LkQFddO3.js → sora-DTjMZ7Oe.js} +1 -1
  128. package/dist/assets/{suno-BEXGYoOu.js → suno-DwzWvitg.js} +1 -1
  129. package/dist/assets/{switch-B5g3reYm.js → switch-DIw3rsKp.js} +1 -1
  130. package/dist/assets/{table-D1uC_u3r.js → table-BShBBeZp.js} +1 -1
  131. package/dist/assets/{tabs-CUdIahbG.js → tabs-BHk8y5WV.js} +1 -1
  132. package/dist/assets/{time-picker-BZJ6Lz0K.js → time-picker-0pxQqiuo.js} +1 -1
  133. package/dist/assets/{tooltip-DvD9A154.js → tooltip-DSa1pG7G.js} +1 -1
  134. package/dist/assets/{upload-BqO4TRgo.js → upload-DQ2aahUp.js} +1 -1
  135. package/dist/assets/{veo-CvB7ibwu.js → veo-DZQb5oO8.js} +1 -1
  136. package/dist/assets/{wan-B3QpaGjj.js → wan-DN_1pMuN.js} +1 -1
  137. package/dist/assets/{web-ren2Zlrr.js → web-C8J78B6d.js} +1 -1
  138. package/dist/assets/{web-BcUyWxae.js → web-CT0JmJlw.js} +1 -1
  139. package/dist/assets/{web-DlfKKkbg.js → web-DV6iF71Q.js} +1 -1
  140. package/dist/assets/{web-C4dMD3uf.js → web-d_nfLaCJ.js} +1 -1
  141. package/dist/assets/{web-C5yVo9NH.js → web-kIxBMDrh.js} +1 -1
  142. package/dist/assets/{webextrator-CRtMZPQh.js → webextrator-DRiOfd4A.js} +1 -1
  143. package/dist/index.html +1 -1
  144. package/package.json +1 -1
  145. package/dist/assets/esm-EypM3sNt.js +0 -1
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,qt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-SpoLHPtt.js";import{t as b}from"./upload-BqO4TRgo.js";import{t as x}from"./tooltip-DvD9A154.js";import{t as S}from"./image-DCil-WkM.js";import{t as C}from"./alert-CauWy1wR.js";import{t as w}from"./drawer-5IyzIse-.js";import{Br as T,Hr as ee,Kr as E,Ur as D,Vr as O,Wr as k,qr as A,zr as j}from"./constants-BP-0lGQL.js";import{$t as te,A as M,Bt as N,Gt as P,Ht as F,Kr as I,Nn as L,Ur as R,Ut as z,Vt as B,mi as V,ri as H,rr as U}from"./index-1vpeSW7k.js";import{t as W}from"./index.es-Bl6QYiX-.js";import{t as G}from"./CopyToClipboard-BsP4OlMx.js";import{t as K}from"./ImagePreview-oFylxFC_.js";import{n as q}from"./taskDrawerMixin-DyAUhFEq.js";import{t as J}from"./Consumption-CT8Jjixf.js";import{i as Y,n as X,t as Z}from"./pagination-CiIUjyb0.js";import{t as Q}from"./VideoPlayer-DTw3XqQM.js";import{t as ne}from"./ApiCodeButton-cix66dAy.js";import{t as re}from"./BotPlaceholder-DEmcgW2p.js";import{t as ie}from"./NoTasks-DDv2Mkgv.js";import{t as ae}from"./PromptTextarea-B4gddEM8.js";var oe=_({name:`LayoutSora`,components:{ElDrawer:w,ElButton:V,FontAwesomeIcon:W},mixins:[q]}),se={class:`main flex flex-row flex-1`},ce={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},le={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ue(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,se,[e(`div`,ce,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,le,[u(t.$slots,`result`,{},void 0,!0)]),l(i(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var de=M(oe,[[`render`,ue],[`__scopeId`,`data-v-531ab990`]]),fe=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:A,label:`sora-2`},{value:E,label:`sora-2-pro`}]}},computed:{value:{get(){return this.$store.state.sora?.config?.model},set(e){let t=this.$store.state.sora?.config||{},n=j[e]||[10],r=t.duration,i=r&&n.includes(r)?r:n.includes(10)?10:n[0],a={...t,model:e,duration:i,size:t.size||`small`};this.$store.commit(`sora/setConfig`,a)}}},mounted(){this.value||=ee}}),pe={class:`field`},me={class:`title font-bold`};function he(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,pe,[e(`h2`,me,r(t.$t(`sora.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ge=M(fe,[[`render`,he],[`__scopeId`,`data-v-0cb7913d`]]),_e=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`sora.button.action1`)},{value:`image2video`,label:this.$t(`sora.button.action2`)}]},value:{get(){return this.$store.state.sora?.config?.action},set(e){this.$store.commit(`sora/setConfig`,{...this.$store.state.sora?.config,action:e})}}},mounted(){this.value||=O}}),ve={class:`field`},ye={class:`title font-bold`},be={class:`float-left`};function xe(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ve,[e(`h2`,ye,r(t.$t(`sora.name.action`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`),clearable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,t=>(h(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,be,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Se=M(_e,[[`render`,xe],[`__scopeId`,`data-v-7b82fa7f`]]),Ce=_({name:`DurationSelector`,components:{ElSelect:v,ElOption:y},computed:{model(){return this.$store.state.sora?.config?.model||`sora-2`},allowedDurations(){return j[this.model]||[10]},optionsForModel(){return this.allowedDurations.map(e=>({value:e,label:`${e}s`}))},value:{get(){return this.$store.state.sora?.config?.duration},set(e){let t=this.$store.state.sora?.config||{};this.$store.commit(`sora/setConfig`,{...t,duration:e})}}},watch:{allowedDurations(){let e=this.allowedDurations;if(!e.includes(this.value)){let t=e.includes(10)?10:e[0];this.value=t}}},mounted(){this.value||=10}}),we={class:`field`},Te={class:`control`},Ee={class:`title font-bold`};function De(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,we,[e(`div`,Te,[e(`h2`,Ee,r(t.$t(`sora.name.duration`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.optionsForModel,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])])}var Oe=M(Ce,[[`render`,De],[`__scopeId`,`data-v-c2934598`]]),ke=_({name:`OrientationSelector`,data(){return{options:[{value:`portrait`,labelKey:`sora.option.portrait`,width:13,height:25},{value:`landscape`,labelKey:`sora.option.landscape`,width:25,height:13}]}},computed:{active(){let e=this.options.findIndex(e=>e.value===this.value);return e>=0?e:0},value:{get(){return this.$store.state.sora?.config?.orientation},set(e){console.debug(`set orientation`,e),this.$store.commit(`sora/setConfig`,{...this.$store.state?.sora?.config,orientation:e})}}},mounted(){this.value||=D}}),Ae={class:`text-sm font-bold mb-2 block`},je={class:`items`},Me=[`onClick`],Ne={class:`name`};function Pe(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,Ae,r(n.$t(`sora.name.orientation`)),1),e(`div`,je,[(h(!0),o(s,null,m(n.options,(i,a)=>(h(),o(`div`,{key:a,class:t({active:n.active===a,item:!0}),onClick:e=>n.value=i.value},[e(`div`,{class:t([`preview`,i.value])},[e(`div`,{class:`rect`,style:p({width:i.width+`px`,height:i.height+`px`})},null,4)],2),e(`p`,Ne,r(n.$t(i.labelKey)),1)],10,Me))),128))])])}var Fe=M(ke,[[`render`,Pe],[`__scopeId`,`data-v-a20be6d9`]]),Ie=_({name:`StartEndImage`,components:{ElUpload:b,ElButton:V,InfoIcon:Y,FontAwesomeIcon:W,ImagePreview:K},mixins:[z,B],emits:[`change`],data(){return{fileList:[],uploadUrl:I()+`/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?.sora?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){H.warning(this.$t(`sora.message.uploadReferencesExceed`))},onError(){H.error(this.$t(`sora.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`sora/setConfig`,{...this.$store.state?.sora?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Le={class:`relative`},Re={class:`flex justify-between`},ze={class:`flex justify-start items-center`},Be={class:`text-sm font-bold`};function Ve(t,s,l,u,p,m){let g=c(`info-icon`),_=c(`image-preview`),v=c(`font-awesome-icon`),y=c(`el-button`),b=c(`el-upload`);return h(),o(`div`,Le,[e(`div`,Re,[e(`div`,ze,[e(`span`,Be,r(t.$t(`sora.name.startEndImage`)),1),i(g,{content:t.$t(`sora.description.uploadStartEndImage`)},null,8,[`content`])])]),i(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[e.url&&e.percentage!==void 0?(h(),d(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:f(()=>[i(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),n(` `+r(t.$t(`sora.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var He=M(Ie,[[`render`,Ve],[`__scopeId`,`data-v-4f7d9ba5`]]),Ue=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),We=_({name:`SizeSelector`,components:{ElSelect:v,ElOption:y},data(){return{options:T.map(e=>({value:e,label:Ue(e)}))}},computed:{value:{get(){return this.$store.state.sora?.config?.size},set(e){let t=this.$store.state.sora?.config||{};this.$store.commit(`sora/setConfig`,{...t,size:e})}}},mounted(){this.value||=k}}),Ge={class:`field`},Ke={class:`control`},qe={class:`title font-bold`};function Je(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,Ge,[e(`div`,Ke,[e(`h2`,qe,r(t.$t(`sora.name.size`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])])}var Ye=M(We,[[`render`,Je],[`__scopeId`,`data-v-8c485f0f`]]),Xe=_({name:`PromptInput`,components:{PromptTextarea:ae},computed:{prompt:{get(){return this.$store.state.sora?.config?.prompt},set(e){this.$store.commit(`sora/setConfig`,{...this.$store.state.sora?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ze(e,t,n,r,i,a){let o=c(`prompt-textarea`);return h(),d(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`sora.name.prompt`),info:e.$t(`sora.description.prompt`),placeholder:e.$t(`sora.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Qe=_({name:`ConfigPanel`,components:{ElButton:V,Consumption:J,FontAwesomeIcon:W,PromptInput:M(Xe,[[`render`,Ze]]),ModelSelector:ge,StartEndImage:He,SizeSelector:Ye,ActionSelector:Se,OrientationSelector:Fe,DurationSelector:Oe},emits:[`generate`],computed:{config(){return this.$store.state.sora?.config},consumption(){return P(this.config,this.service?.cost)},service(){return this.$store.state.sora?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),$e={class:`flex flex-col h-full`},et={class:`flex-1 overflow-y-auto p-5`},tt={class:`flex flex-col items-center justify-center px-5 pb-5`};function nt(t,a,s,u,d,p){let m=c(`model-selector`),_=c(`action-selector`),v=c(`duration-selector`),y=c(`size-selector`),b=c(`orientation-selector`),x=c(`prompt-input`),S=c(`start-end-image`),C=c(`consumption`),w=c(`font-awesome-icon`),T=c(`el-button`);return h(),o(`div`,$e,[e(`div`,et,[i(m,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),i(y,{class:`mb-4`}),i(b,{class:`mb-4`}),i(x,{class:`mb-4`}),l(i(S,{class:`mb-2`},null,512),[[g,t.config?.action===`image2video`]])]),e(`div`,tt,[i(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`sora.button.generate`)),1)]),_:1},8,[`onClick`])])])}var rt=M(Qe,[[`render`,nt]]),it=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:G,FontAwesomeIcon:W,ElAlert:C,VideoPlayer:Q,ElTooltip:x,ElButton:V,ApiCodeButton:ne},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.sora?.application},config(){return this.$store.state.sora?.config}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),at={class:`preview`},ot={class:`left`},st={class:`main`},ct={class:`bot`},lt={class:`datetime`},ut={class:`info`},dt={key:0,class:`prompt mt-2`},ft={key:0},pt={key:1},mt={key:0,class:t({content:!0,failed:!0})},ht={key:0,class:`mb-4`},gt={key:1,class:t({operations:!0,"mt-2":!0})},_t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:1,class:t({content:!0})},bt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},St={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ct={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},wt={key:2,class:t({content:!0})},Tt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Dt(t,s,l,u,p,m){let g=c(`el-image`),_=c(`video-player`),v=c(`el-button`),y=c(`el-tooltip`),b=c(`api-code-button`),x=c(`font-awesome-icon`),S=c(`copy-to-clipboard`),C=c(`el-alert`);return h(),o(`div`,at,[e(`div`,ot,[i(g,{src:`https://cdn.acedata.cloud/z5id1u.png`,class:`avatar`})]),e(`div`,st,[e(`div`,ct,[n(r(t.$t(`sora.name.soraBot`))+` `,1),e(`span`,lt,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,ut,[t.modelValue?.request?.prompt?(h(),o(`p`,dt,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,ft,` - (`+r(t.$t(`sora.status.pending`))+`) `,1)),Array.isArray(t.modelValue?.response?.data)&&t.modelValue?.response?.data[0]?.state===`pending`?(h(),o(`span`,pt,` - (`+r(t.$t(`sora.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,mt,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,ht,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,gt,[i(y,{class:`box-item`,effect:`dark`,content:t.$t(`sora.message.downloadVideo`),placement:`top-start`},{default:f(()=>[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`sora.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/sora/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,_t,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,vt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,yt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,$,[i(C,{closable:!1,class:`failure`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.failure`)),1)]),default:f(()=>[e(`p`,bt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,xt,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,St,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,Ct,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===void 0?(h(),o(`div`,wt,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.failure`)),1)]),default:f(()=>[e(`p`,Tt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(h(),o(`p`,Et,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0)])])}var Ot=_({name:`RecentPanel`,components:{TaskPreview:M(it,[[`render`,Dt],[`__scopeId`,`data-v-564d52e9`]]),NoTasks:ie,BotPlaceholder:re,ScrollList:X},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.sora?.tasks,items:this.$store.state.sora?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),kt={key:0},At={key:2,class:`w-full h-full flex items-center justify-center`};function jt(e,t,n,r,l,u){let p=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return h(),o(s,null,[e.tasks?.items===void 0?(h(),o(`div`,kt,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(h(!0),o(s,null,m(e.tasks?.items,(e,t)=>(h(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(h(),o(`div`,At,[i(v)])):a(``,!0)],64)}var Mt=_({name:`SoraIndex`,components:{ConfigPanel:rt,Layout:de,RecentPanel:M(Ot,[[`render`,jt]])},mixins:[F],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.sora?.status?.getApplications===R.Request},tasksLoading(){return this.$store.state.sora?.status?.getTasks===R.Request||this.fetchingTasks},credential(){return this.$store.state.sora.credential},config(){return this.$store.state.sora.config},tasks(){return this.$store.state.sora.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(`sora/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`sora/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(`sora/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!N(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let e={...this.config,async:!0};if(!te())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}H.info(this.$t(`sora.message.startingTask`)),U(`sora`,L.generate(e,{token:t})).then(()=>{H.success(this.$t(`sora.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?H.error(this.$t(`sora.message.usedUp`)):H.error(this.$t(`sora.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Nt(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return h(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Pt=M(Mt,[[`render`,Nt]]);export{Pt as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,qt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-B8mKNpQs.js";import{t as b}from"./upload-DQ2aahUp.js";import{t as x}from"./tooltip-DSa1pG7G.js";import{t as S}from"./image-BdxD4NmE.js";import{t as C}from"./alert-BHNa_9CQ.js";import{t as w}from"./drawer-D7cJi5RQ.js";import{Br as T,Hr as ee,Kr as E,Ur as D,Vr as O,Wr as k,qr as A,zr as j}from"./constants-BP-0lGQL.js";import{$t as te,A as M,Bt as N,Gt as P,Ht as F,Kr as I,Nn as L,Ur as R,Ut as z,Vt as B,mi as V,ri as H,rr as U}from"./index-BBc6dqlf.js";import{t as W}from"./index.es-4wmHyz-M.js";import{t as G}from"./CopyToClipboard-BFD5MUwv.js";import{t as K}from"./ImagePreview-BjFaiTLm.js";import{n as q}from"./taskDrawerMixin-DyAUhFEq.js";import{t as J}from"./Consumption-DknmQTaS.js";import{i as Y,n as X,t as Z}from"./pagination-rrv4XdjG.js";import{t as Q}from"./VideoPlayer-BcwCieEI.js";import{t as ne}from"./ApiCodeButton-Di7D_xxs.js";import{t as re}from"./BotPlaceholder-_zgdRtjQ.js";import{t as ie}from"./NoTasks-CbsNUmYf.js";import{t as ae}from"./PromptTextarea-uxWEr-w3.js";var oe=_({name:`LayoutSora`,components:{ElDrawer:w,ElButton:V,FontAwesomeIcon:W},mixins:[q]}),se={class:`main flex flex-row flex-1`},ce={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},le={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ue(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,se,[e(`div`,ce,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,le,[u(t.$slots,`result`,{},void 0,!0)]),l(i(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var de=M(oe,[[`render`,ue],[`__scopeId`,`data-v-531ab990`]]),fe=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:A,label:`sora-2`},{value:E,label:`sora-2-pro`}]}},computed:{value:{get(){return this.$store.state.sora?.config?.model},set(e){let t=this.$store.state.sora?.config||{},n=j[e]||[10],r=t.duration,i=r&&n.includes(r)?r:n.includes(10)?10:n[0],a={...t,model:e,duration:i,size:t.size||`small`};this.$store.commit(`sora/setConfig`,a)}}},mounted(){this.value||=ee}}),pe={class:`field`},me={class:`title font-bold`};function he(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,pe,[e(`h2`,me,r(t.$t(`sora.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ge=M(fe,[[`render`,he],[`__scopeId`,`data-v-0cb7913d`]]),_e=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`sora.button.action1`)},{value:`image2video`,label:this.$t(`sora.button.action2`)}]},value:{get(){return this.$store.state.sora?.config?.action},set(e){this.$store.commit(`sora/setConfig`,{...this.$store.state.sora?.config,action:e})}}},mounted(){this.value||=O}}),ve={class:`field`},ye={class:`title font-bold`},be={class:`float-left`};function xe(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ve,[e(`h2`,ye,r(t.$t(`sora.name.action`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`),clearable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,t=>(h(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,be,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Se=M(_e,[[`render`,xe],[`__scopeId`,`data-v-7b82fa7f`]]),Ce=_({name:`DurationSelector`,components:{ElSelect:v,ElOption:y},computed:{model(){return this.$store.state.sora?.config?.model||`sora-2`},allowedDurations(){return j[this.model]||[10]},optionsForModel(){return this.allowedDurations.map(e=>({value:e,label:`${e}s`}))},value:{get(){return this.$store.state.sora?.config?.duration},set(e){let t=this.$store.state.sora?.config||{};this.$store.commit(`sora/setConfig`,{...t,duration:e})}}},watch:{allowedDurations(){let e=this.allowedDurations;if(!e.includes(this.value)){let t=e.includes(10)?10:e[0];this.value=t}}},mounted(){this.value||=10}}),we={class:`field`},Te={class:`control`},Ee={class:`title font-bold`};function De(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,we,[e(`div`,Te,[e(`h2`,Ee,r(t.$t(`sora.name.duration`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.optionsForModel,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])])}var Oe=M(Ce,[[`render`,De],[`__scopeId`,`data-v-c2934598`]]),ke=_({name:`OrientationSelector`,data(){return{options:[{value:`portrait`,labelKey:`sora.option.portrait`,width:13,height:25},{value:`landscape`,labelKey:`sora.option.landscape`,width:25,height:13}]}},computed:{active(){let e=this.options.findIndex(e=>e.value===this.value);return e>=0?e:0},value:{get(){return this.$store.state.sora?.config?.orientation},set(e){console.debug(`set orientation`,e),this.$store.commit(`sora/setConfig`,{...this.$store.state?.sora?.config,orientation:e})}}},mounted(){this.value||=D}}),Ae={class:`text-sm font-bold mb-2 block`},je={class:`items`},Me=[`onClick`],Ne={class:`name`};function Pe(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,Ae,r(n.$t(`sora.name.orientation`)),1),e(`div`,je,[(h(!0),o(s,null,m(n.options,(i,a)=>(h(),o(`div`,{key:a,class:t({active:n.active===a,item:!0}),onClick:e=>n.value=i.value},[e(`div`,{class:t([`preview`,i.value])},[e(`div`,{class:`rect`,style:p({width:i.width+`px`,height:i.height+`px`})},null,4)],2),e(`p`,Ne,r(n.$t(i.labelKey)),1)],10,Me))),128))])])}var Fe=M(ke,[[`render`,Pe],[`__scopeId`,`data-v-a20be6d9`]]),Ie=_({name:`StartEndImage`,components:{ElUpload:b,ElButton:V,InfoIcon:Y,FontAwesomeIcon:W,ImagePreview:K},mixins:[z,B],emits:[`change`],data(){return{fileList:[],uploadUrl:I()+`/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?.sora?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){H.warning(this.$t(`sora.message.uploadReferencesExceed`))},onError(){H.error(this.$t(`sora.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`sora/setConfig`,{...this.$store.state?.sora?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Le={class:`relative`},Re={class:`flex justify-between`},ze={class:`flex justify-start items-center`},Be={class:`text-sm font-bold`};function Ve(t,s,l,u,p,m){let g=c(`info-icon`),_=c(`image-preview`),v=c(`font-awesome-icon`),y=c(`el-button`),b=c(`el-upload`);return h(),o(`div`,Le,[e(`div`,Re,[e(`div`,ze,[e(`span`,Be,r(t.$t(`sora.name.startEndImage`)),1),i(g,{content:t.$t(`sora.description.uploadStartEndImage`)},null,8,[`content`])])]),i(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[e.url&&e.percentage!==void 0?(h(),d(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:f(()=>[i(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),n(` `+r(t.$t(`sora.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var He=M(Ie,[[`render`,Ve],[`__scopeId`,`data-v-4f7d9ba5`]]),Ue=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),We=_({name:`SizeSelector`,components:{ElSelect:v,ElOption:y},data(){return{options:T.map(e=>({value:e,label:Ue(e)}))}},computed:{value:{get(){return this.$store.state.sora?.config?.size},set(e){let t=this.$store.state.sora?.config||{};this.$store.commit(`sora/setConfig`,{...t,size:e})}}},mounted(){this.value||=k}}),Ge={class:`field`},Ke={class:`control`},qe={class:`title font-bold`};function Je(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,Ge,[e(`div`,Ke,[e(`h2`,qe,r(t.$t(`sora.name.size`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])])}var Ye=M(We,[[`render`,Je],[`__scopeId`,`data-v-8c485f0f`]]),Xe=_({name:`PromptInput`,components:{PromptTextarea:ae},computed:{prompt:{get(){return this.$store.state.sora?.config?.prompt},set(e){this.$store.commit(`sora/setConfig`,{...this.$store.state.sora?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ze(e,t,n,r,i,a){let o=c(`prompt-textarea`);return h(),d(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`sora.name.prompt`),info:e.$t(`sora.description.prompt`),placeholder:e.$t(`sora.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Qe=_({name:`ConfigPanel`,components:{ElButton:V,Consumption:J,FontAwesomeIcon:W,PromptInput:M(Xe,[[`render`,Ze]]),ModelSelector:ge,StartEndImage:He,SizeSelector:Ye,ActionSelector:Se,OrientationSelector:Fe,DurationSelector:Oe},emits:[`generate`],computed:{config(){return this.$store.state.sora?.config},consumption(){return P(this.config,this.service?.cost)},service(){return this.$store.state.sora?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),$e={class:`flex flex-col h-full`},et={class:`flex-1 overflow-y-auto p-5`},tt={class:`flex flex-col items-center justify-center px-5 pb-5`};function nt(t,a,s,u,d,p){let m=c(`model-selector`),_=c(`action-selector`),v=c(`duration-selector`),y=c(`size-selector`),b=c(`orientation-selector`),x=c(`prompt-input`),S=c(`start-end-image`),C=c(`consumption`),w=c(`font-awesome-icon`),T=c(`el-button`);return h(),o(`div`,$e,[e(`div`,et,[i(m,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),i(y,{class:`mb-4`}),i(b,{class:`mb-4`}),i(x,{class:`mb-4`}),l(i(S,{class:`mb-2`},null,512),[[g,t.config?.action===`image2video`]])]),e(`div`,tt,[i(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`sora.button.generate`)),1)]),_:1},8,[`onClick`])])])}var rt=M(Qe,[[`render`,nt]]),it=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:G,FontAwesomeIcon:W,ElAlert:C,VideoPlayer:Q,ElTooltip:x,ElButton:V,ApiCodeButton:ne},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.sora?.application},config(){return this.$store.state.sora?.config}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),at={class:`preview`},ot={class:`left`},st={class:`main`},ct={class:`bot`},lt={class:`datetime`},ut={class:`info`},dt={key:0,class:`prompt mt-2`},ft={key:0},pt={key:1},mt={key:0,class:t({content:!0,failed:!0})},ht={key:0,class:`mb-4`},gt={key:1,class:t({operations:!0,"mt-2":!0})},_t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:1,class:t({content:!0})},bt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},St={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ct={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},wt={key:2,class:t({content:!0})},Tt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Dt(t,s,l,u,p,m){let g=c(`el-image`),_=c(`video-player`),v=c(`el-button`),y=c(`el-tooltip`),b=c(`api-code-button`),x=c(`font-awesome-icon`),S=c(`copy-to-clipboard`),C=c(`el-alert`);return h(),o(`div`,at,[e(`div`,ot,[i(g,{src:`https://cdn.acedata.cloud/z5id1u.png`,class:`avatar`})]),e(`div`,st,[e(`div`,ct,[n(r(t.$t(`sora.name.soraBot`))+` `,1),e(`span`,lt,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,ut,[t.modelValue?.request?.prompt?(h(),o(`p`,dt,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,ft,` - (`+r(t.$t(`sora.status.pending`))+`) `,1)),Array.isArray(t.modelValue?.response?.data)&&t.modelValue?.response?.data[0]?.state===`pending`?(h(),o(`span`,pt,` - (`+r(t.$t(`sora.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,mt,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,ht,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,gt,[i(y,{class:`box-item`,effect:`dark`,content:t.$t(`sora.message.downloadVideo`),placement:`top-start`},{default:f(()=>[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`sora.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/sora/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,_t,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,vt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,yt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,$,[i(C,{closable:!1,class:`failure`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.failure`)),1)]),default:f(()=>[e(`p`,bt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,xt,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,St,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,Ct,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===void 0?(h(),o(`div`,wt,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.failure`)),1)]),default:f(()=>[e(`p`,Tt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(h(),o(`p`,Et,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0)])])}var Ot=_({name:`RecentPanel`,components:{TaskPreview:M(it,[[`render`,Dt],[`__scopeId`,`data-v-564d52e9`]]),NoTasks:ie,BotPlaceholder:re,ScrollList:X},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.sora?.tasks,items:this.$store.state.sora?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),kt={key:0},At={key:2,class:`w-full h-full flex items-center justify-center`};function jt(e,t,n,r,l,u){let p=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return h(),o(s,null,[e.tasks?.items===void 0?(h(),o(`div`,kt,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(h(!0),o(s,null,m(e.tasks?.items,(e,t)=>(h(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(h(),o(`div`,At,[i(v)])):a(``,!0)],64)}var Mt=_({name:`SoraIndex`,components:{ConfigPanel:rt,Layout:de,RecentPanel:M(Ot,[[`render`,jt]])},mixins:[F],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.sora?.status?.getApplications===R.Request},tasksLoading(){return this.$store.state.sora?.status?.getTasks===R.Request||this.fetchingTasks},credential(){return this.$store.state.sora.credential},config(){return this.$store.state.sora.config},tasks(){return this.$store.state.sora.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(`sora/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`sora/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(`sora/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!N(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let e={...this.config,async:!0};if(!te())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}H.info(this.$t(`sora.message.startingTask`)),U(`sora`,L.generate(e,{token:t})).then(()=>{H.success(this.$t(`sora.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?H.error(this.$t(`sora.message.usedUp`)):H.error(this.$t(`sora.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Nt(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return h(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Pt=M(Mt,[[`render`,Nt]]);export{Pt as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,qt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-SpoLHPtt.js";import{t as b}from"./upload-BqO4TRgo.js";import{t as x}from"./tooltip-DvD9A154.js";import{t as S}from"./image-DCil-WkM.js";import{t as C}from"./alert-CauWy1wR.js";import{t as w}from"./drawer-5IyzIse-.js";import{t as T}from"./switch-B5g3reYm.js";import{$r as E,Qr as D,Xr as O,Yr as k,Zr as A,ai as j,ei as M,ri as N,ti as P}from"./constants-BP-0lGQL.js";import{$t as F,A as I,Bt as L,Ci as R,Gt as z,Ht as ee,Kr as te,Pn as ne,Ur as B,Ut as V,Vt as H,mi as U,ri as W,rr as G}from"./index-1vpeSW7k.js";import{t as K}from"./index.es-Bl6QYiX-.js";import{t as q}from"./CopyToClipboard-BsP4OlMx.js";import{t as J}from"./ImagePreview-oFylxFC_.js";import{n as Y}from"./taskDrawerMixin-DyAUhFEq.js";import{t as X}from"./Consumption-CT8Jjixf.js";import{i as Z,n as re,t as ie}from"./pagination-CiIUjyb0.js";import{t as Q}from"./VideoPlayer-DTw3XqQM.js";import{t as ae}from"./ApiCodeButton-cix66dAy.js";import{t as oe}from"./BotPlaceholder-DEmcgW2p.js";import{t as se}from"./NoTasks-DDv2Mkgv.js";import{t as ce}from"./PromptTextarea-B4gddEM8.js";var le=_({name:`LayoutVeo`,components:{ElDrawer:w,ElButton:U,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(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,ue,[e(`div`,de,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,fe,[u(t.$slots,`result`,{},void 0,!0)]),l(i(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var me=I(le,[[`render`,pe],[`__scopeId`,`data-v-12b82bc3`]]),he=_({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||=D}}),ge={class:`field`},_e={class:`title font-bold`};function ve(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ge,[e(`h2`,_e,r(t.$t(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ye=I(he,[[`render`,ve],[`__scopeId`,`data-v-a59d89c9`]]),be=_({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||=k}}),xe={class:`field`},Se={class:`title font-bold`},Ce={class:`float-left`};function we(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,xe,[e(`h2`,Se,r(t.$t(`veo.name.action`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),clearable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,t=>(h(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,Ce,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Te=I(be,[[`render`,we],[`__scopeId`,`data-v-f4d8785c`]]),Ee=_({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(t,n,a,s,l,u){let d=c(`info-icon`),f=c(`el-switch`);return h(),o(`div`,De,[e(`div`,Oe,[e(`div`,ke,[e(`span`,Ae,r(t.$t(`veo.name.translation`)),1),i(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,je,[i(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ne=I(Ee,[[`render`,Me]]),Pe=_({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||=O}}),Fe={class:`text-sm font-bold mb-2 block`},Ie={class:`items`},Le=[`onClick`],Re={class:`name`};function ze(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,Fe,r(n.$t(`veo.name.ratio`)),1),e(`div`,Ie,[(h(!0),o(s,null,m(n.options,(i,a)=>(h(),o(`div`,{key:a,class:t({active:n.active===a,item:!0}),onClick:e=>n.value=i.value},[e(`div`,{class:t([`preview`,i.label])},[e(`div`,{class:`rect`,style:p({width:i.width+`px`,height:i.height+`px`})},null,4)],2),e(`p`,Re,r(i.label),1)],10,Le))),128))])])}var Be=I(Pe,[[`render`,ze],[`__scopeId`,`data-v-28c472c4`]]),Ve=_({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(t,n,i,s,l,u){let f=c(`video-player`);return h(),o(`div`,He,[e(`div`,Ue,[e(`span`,We,r(t.$t(`veo.name.action3`)),1)]),e(`div`,null,[t.config?.video_url?(h(),d(f,{key:0,src:t.config?.video_url},null,8,[`src`])):a(``,!0)])])}var Ke=I(Ve,[[`render`,Ge]]),qe=_({name:`VideoIdInput`,components:{ElInput:R},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(t,n,a,s,l,u){let d=c(`el-input`);return h(),o(`div`,Je,[e(`h2`,Ye,r(t.$t(`veo.name.videoId`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,type:`text`,placeholder:t.$t(`veo.placeholder.videoId`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var Ze=I(qe,[[`render`,Xe],[`__scopeId`,`data-v-6eba4026`]]),Qe=_({name:`StartEndImage`,components:{ElUpload:b,ElButton:U,InfoIcon:Z,FontAwesomeIcon:K,ImagePreview:J},mixins:[V,H],emits:[`change`],data(){return{fileList:[],uploadUrl:te()+`/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(){W.warning(this.$t(`veo.message.uploadReferencesExceed`))},onError(){W.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(t,s,l,u,p,m){let g=c(`info-icon`),_=c(`image-preview`),v=c(`font-awesome-icon`),y=c(`el-button`),b=c(`el-upload`);return h(),o(`div`,$e,[e(`div`,et,[e(`div`,tt,[e(`span`,nt,r(t.$t(`veo.name.startEndImage`)),1),i(g,{content:t.$t(`veo.description.uploadStartEndImage`)},null,8,[`content`])])]),i(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[e.url&&e.percentage!==void 0?(h(),d(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:f(()=>[i(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),n(` `+r(t.$t(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var it=I(Qe,[[`render`,rt],[`__scopeId`,`data-v-f9a79b4a`]]),at=_({name:`UpsampleActionSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return j.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||=M}}),ot={class:`field`},st={class:`title font-bold`};function ct(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ot,[e(`h2`,st,r(t.$t(`veo.name.upsampleAction`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var lt=I(at,[[`render`,ct],[`__scopeId`,`data-v-8b74a7ae`]]),ut=_({name:`ExtendModelSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return P.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||!P.includes(this.value))&&(this.value=A)}}),dt={class:`field`},ft={class:`title font-bold`};function pt(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,dt,[e(`h2`,ft,r(t.$t(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var mt=I(ut,[[`render`,pt],[`__scopeId`,`data-v-cc3f9355`]]),ht=_({name:`MotionTypeSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return N.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(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,gt,[e(`h2`,_t,r(t.$t(`veo.name.motionType`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),filterable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var yt=I(ht,[[`render`,vt],[`__scopeId`,`data-v-3affff3c`]]),bt=_({name:`ImageMaskInput`,components:{ElInput:R},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(t,n,a,s,l,u){let d=c(`el-input`);return h(),o(`div`,xt,[e(`h2`,St,r(t.$t(`veo.name.imageMask`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,type:`text`,placeholder:t.$t(`veo.placeholder.imageMask`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var wt=I(bt,[[`render`,Ct],[`__scopeId`,`data-v-6cc27c68`]]),Tt=_({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,a){let o=c(`prompt-textarea`);return h(),d(o,{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=I(Tt,[[`render`,Et]]),Ot=[`upsample`,`extend`,`reshoot`,`object_insert`,`object_remove`,`get1080p`],kt=[`text2video`,`image2video`,`ingredients2video`],At=_({name:`ConfigPanel`,components:{ElButton:U,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 z(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(t,l,u,p,m,g){let _=c(`action-selector`),v=c(`video-from-input`),y=c(`video-id-input`),b=c(`upsample-action-selector`),x=c(`extend-model-selector`),S=c(`prompt-input`),C=c(`motion-type-selector`),w=c(`image-mask-input`),T=c(`translation-selector`),E=c(`aspect-ratio-selector`),D=c(`model-selector`),O=c(`start-end-image`),k=c(`consumption`),A=c(`font-awesome-icon`),j=c(`el-button`);return h(),o(`div`,jt,[e(`div`,Mt,[i(_,{class:`mb-4`}),t.isPostProcessing?(h(),o(s,{key:0},[t.config?.video_url?(h(),d(v,{key:0,class:`mb-4`})):a(``,!0),i(y,{class:`mb-4`})],64)):a(``,!0),t.config?.action===`upsample`?(h(),d(b,{key:1,class:`mb-4`})):a(``,!0),t.config?.action===`extend`?(h(),d(x,{key:2,class:`mb-4`})):a(``,!0),t.config?.action===`extend`?(h(),d(S,{key:3,class:`mb-4`})):a(``,!0),t.config?.action===`reshoot`?(h(),d(C,{key:4,class:`mb-4`})):a(``,!0),t.config?.action===`object_insert`?(h(),d(S,{key:5,class:`mb-4`})):a(``,!0),t.config?.action===`object_insert`||t.config?.action===`object_remove`?(h(),d(w,{key:6,class:`mb-4`})):a(``,!0),t.config?.action===`object_remove`?(h(),d(S,{key:7,class:`mb-4`})):a(``,!0),t.isGeneration?(h(),o(s,{key:8},[i(T,{class:`mb-4`}),i(E,{class:`mb-4`}),i(S,{class:`mb-4`}),t.config?.action===`ingredients2video`?a(``,!0):(h(),d(D,{key:0,class:`mb-4`})),t.config?.action===`image2video`||t.config?.action===`ingredients2video`?(h(),d(O,{key:1,class:`mb-2`})):a(``,!0)],64)):a(``,!0)]),e(`div`,Nt,[i(k,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(j,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ft=I(At,[[`render`,Pt]]),It=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:q,FontAwesomeIcon:K,ElAlert:C,VideoPlayer:Q,ElTooltip:x,ElButton:U,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:t({content:!0,failed:!0})},qt={key:0,class:`mb-4`},$={key:1,class:t({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:t({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:t({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(t,s,l,u,p,m){let g=c(`el-image`),_=c(`video-player`),v=c(`el-button`),y=c(`el-tooltip`),b=c(`api-code-button`),x=c(`font-awesome-icon`),S=c(`copy-to-clipboard`),C=c(`el-alert`);return h(),o(`div`,Lt,[e(`div`,Rt,[i(g,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),e(`div`,zt,[e(`div`,Bt,[n(r(t.$t(`veo.name.veoBot`))+` `,1),e(`span`,Vt,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Ht,[t.modelValue?.request?.prompt?(h(),o(`p`,Ut,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,Wt,` - (`+r(t.$t(`veo.status.pending`))+`) `,1)),Array.isArray(t.modelValue?.response?.data)&&t.modelValue?.response?.data[0]?.state===`running`?(h(),o(`span`,Gt,` - (`+r(t.$t(`veo.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,Kt,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,qt,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,$,[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`1080p`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsample1080p`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:1,type:`info`,size:`small`,class:`btn-action`,onClick:s[1]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`4k`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsample4k`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:2,type:`info`,size:`small`,class:`btn-action`,onClick:s[2]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`gif`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsampleGif`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:3,type:`info`,size:`small`,class:`btn-action`,onClick:s[3]||=e=>t.onPickAction(e,t.modelValue?.response,`extend`)},{default:f(()=>[n(r(t.$t(`veo.button.actionExtend`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:4,type:`info`,size:`small`,class:`btn-action`,onClick:s[4]||=e=>t.onPickAction(e,t.modelValue?.response,`reshoot`)},{default:f(()=>[n(r(t.$t(`veo.button.actionReshoot`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:5,type:`info`,size:`small`,class:`btn-action`,onClick:s[5]||=e=>t.onPickAction(e,t.modelValue?.response,`object_insert`)},{default:f(()=>[n(r(t.$t(`veo.button.actionObjectInsert`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:6,type:`info`,size:`small`,class:`btn-action`,onClick:s[6]||=e=>t.onPickAction(e,t.modelValue?.response,`object_remove`)},{default:f(()=>[n(r(t.$t(`veo.button.actionObjectRemove`)),1)]),_:1})):a(``,!0),i(y,{class:`box-item`,effect:`dark`,content:t.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:f(()=>[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[7]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`veo.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/veo/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,Jt,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,Yt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,Xt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,Zt,[i(C,{closable:!1,class:`failure`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,Qt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,$t,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,en,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,tn,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===void 0?(h(),o(`div`,nn,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,rn,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(h(),o(`p`,an,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0)])])}var sn=_({name:`RecentPanel`,components:{TaskPreview:I(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(e,t,n,r,l,u){let p=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return h(),o(s,null,[e.tasks?.items===void 0?(h(),o(`div`,cn,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(h(!0),o(s,null,m(e.tasks?.items,(e,t)=>(h(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(h(),o(`div`,ln,[i(v)])):a(``,!0)],64)}var dn=_({name:`VeoIndex`,components:{ConfigPanel:Ft,Layout:me,RecentPanel:I(sn,[[`render`,un]])},mixins:[ee],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===B.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===B.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(!L(this.uploadTracker,e=>this.$t(e),e=>W.warning(e)))return;let e={...this.config,async:!0};if(!F())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)){W.warning(this.$t(`veo.message.imageRequired`));return}(!e.image_urls||e.image_urls.length===0)&&delete e.image_urls,W.info(this.$t(`veo.message.startingTask`)),G(`veo`,ne.generate(e,{token:t})).then(()=>{W.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?W.error(this.$t(`veo.message.usedUp`)):W.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,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return h(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var pn=I(dn,[[`render`,fn]]);export{pn as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,qt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-B8mKNpQs.js";import{t as b}from"./upload-DQ2aahUp.js";import{t as x}from"./tooltip-DSa1pG7G.js";import{t as S}from"./image-BdxD4NmE.js";import{t as C}from"./alert-BHNa_9CQ.js";import{t as w}from"./drawer-D7cJi5RQ.js";import{t as T}from"./switch-DIw3rsKp.js";import{$r as E,Qr as D,Xr as O,Yr as k,Zr as A,ai as j,ei as M,ri as N,ti as P}from"./constants-BP-0lGQL.js";import{$t as F,A as I,Bt as L,Ci as R,Gt as z,Ht as ee,Kr as te,Pn as ne,Ur as B,Ut as V,Vt as H,mi as U,ri as W,rr as G}from"./index-BBc6dqlf.js";import{t as K}from"./index.es-4wmHyz-M.js";import{t as q}from"./CopyToClipboard-BFD5MUwv.js";import{t as J}from"./ImagePreview-BjFaiTLm.js";import{n as Y}from"./taskDrawerMixin-DyAUhFEq.js";import{t as X}from"./Consumption-DknmQTaS.js";import{i as Z,n as re,t as ie}from"./pagination-rrv4XdjG.js";import{t as Q}from"./VideoPlayer-BcwCieEI.js";import{t as ae}from"./ApiCodeButton-Di7D_xxs.js";import{t as oe}from"./BotPlaceholder-_zgdRtjQ.js";import{t as se}from"./NoTasks-CbsNUmYf.js";import{t as ce}from"./PromptTextarea-uxWEr-w3.js";var le=_({name:`LayoutVeo`,components:{ElDrawer:w,ElButton:U,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(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,ue,[e(`div`,de,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,fe,[u(t.$slots,`result`,{},void 0,!0)]),l(i(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var me=I(le,[[`render`,pe],[`__scopeId`,`data-v-12b82bc3`]]),he=_({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||=D}}),ge={class:`field`},_e={class:`title font-bold`};function ve(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ge,[e(`h2`,_e,r(t.$t(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ye=I(he,[[`render`,ve],[`__scopeId`,`data-v-a59d89c9`]]),be=_({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||=k}}),xe={class:`field`},Se={class:`title font-bold`},Ce={class:`float-left`};function we(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,xe,[e(`h2`,Se,r(t.$t(`veo.name.action`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),clearable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,t=>(h(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,Ce,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Te=I(be,[[`render`,we],[`__scopeId`,`data-v-f4d8785c`]]),Ee=_({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(t,n,a,s,l,u){let d=c(`info-icon`),f=c(`el-switch`);return h(),o(`div`,De,[e(`div`,Oe,[e(`div`,ke,[e(`span`,Ae,r(t.$t(`veo.name.translation`)),1),i(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,je,[i(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ne=I(Ee,[[`render`,Me]]),Pe=_({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||=O}}),Fe={class:`text-sm font-bold mb-2 block`},Ie={class:`items`},Le=[`onClick`],Re={class:`name`};function ze(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,Fe,r(n.$t(`veo.name.ratio`)),1),e(`div`,Ie,[(h(!0),o(s,null,m(n.options,(i,a)=>(h(),o(`div`,{key:a,class:t({active:n.active===a,item:!0}),onClick:e=>n.value=i.value},[e(`div`,{class:t([`preview`,i.label])},[e(`div`,{class:`rect`,style:p({width:i.width+`px`,height:i.height+`px`})},null,4)],2),e(`p`,Re,r(i.label),1)],10,Le))),128))])])}var Be=I(Pe,[[`render`,ze],[`__scopeId`,`data-v-28c472c4`]]),Ve=_({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(t,n,i,s,l,u){let f=c(`video-player`);return h(),o(`div`,He,[e(`div`,Ue,[e(`span`,We,r(t.$t(`veo.name.action3`)),1)]),e(`div`,null,[t.config?.video_url?(h(),d(f,{key:0,src:t.config?.video_url},null,8,[`src`])):a(``,!0)])])}var Ke=I(Ve,[[`render`,Ge]]),qe=_({name:`VideoIdInput`,components:{ElInput:R},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(t,n,a,s,l,u){let d=c(`el-input`);return h(),o(`div`,Je,[e(`h2`,Ye,r(t.$t(`veo.name.videoId`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,type:`text`,placeholder:t.$t(`veo.placeholder.videoId`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var Ze=I(qe,[[`render`,Xe],[`__scopeId`,`data-v-6eba4026`]]),Qe=_({name:`StartEndImage`,components:{ElUpload:b,ElButton:U,InfoIcon:Z,FontAwesomeIcon:K,ImagePreview:J},mixins:[V,H],emits:[`change`],data(){return{fileList:[],uploadUrl:te()+`/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(){W.warning(this.$t(`veo.message.uploadReferencesExceed`))},onError(){W.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(t,s,l,u,p,m){let g=c(`info-icon`),_=c(`image-preview`),v=c(`font-awesome-icon`),y=c(`el-button`),b=c(`el-upload`);return h(),o(`div`,$e,[e(`div`,et,[e(`div`,tt,[e(`span`,nt,r(t.$t(`veo.name.startEndImage`)),1),i(g,{content:t.$t(`veo.description.uploadStartEndImage`)},null,8,[`content`])])]),i(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[e.url&&e.percentage!==void 0?(h(),d(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:f(()=>[i(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),n(` `+r(t.$t(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var it=I(Qe,[[`render`,rt],[`__scopeId`,`data-v-f9a79b4a`]]),at=_({name:`UpsampleActionSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return j.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||=M}}),ot={class:`field`},st={class:`title font-bold`};function ct(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ot,[e(`h2`,st,r(t.$t(`veo.name.upsampleAction`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var lt=I(at,[[`render`,ct],[`__scopeId`,`data-v-8b74a7ae`]]),ut=_({name:`ExtendModelSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return P.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||!P.includes(this.value))&&(this.value=A)}}),dt={class:`field`},ft={class:`title font-bold`};function pt(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,dt,[e(`h2`,ft,r(t.$t(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var mt=I(ut,[[`render`,pt],[`__scopeId`,`data-v-cc3f9355`]]),ht=_({name:`MotionTypeSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return N.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(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,gt,[e(`h2`,_t,r(t.$t(`veo.name.motionType`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),filterable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var yt=I(ht,[[`render`,vt],[`__scopeId`,`data-v-3affff3c`]]),bt=_({name:`ImageMaskInput`,components:{ElInput:R},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(t,n,a,s,l,u){let d=c(`el-input`);return h(),o(`div`,xt,[e(`h2`,St,r(t.$t(`veo.name.imageMask`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,type:`text`,placeholder:t.$t(`veo.placeholder.imageMask`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var wt=I(bt,[[`render`,Ct],[`__scopeId`,`data-v-6cc27c68`]]),Tt=_({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,a){let o=c(`prompt-textarea`);return h(),d(o,{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=I(Tt,[[`render`,Et]]),Ot=[`upsample`,`extend`,`reshoot`,`object_insert`,`object_remove`,`get1080p`],kt=[`text2video`,`image2video`,`ingredients2video`],At=_({name:`ConfigPanel`,components:{ElButton:U,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 z(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(t,l,u,p,m,g){let _=c(`action-selector`),v=c(`video-from-input`),y=c(`video-id-input`),b=c(`upsample-action-selector`),x=c(`extend-model-selector`),S=c(`prompt-input`),C=c(`motion-type-selector`),w=c(`image-mask-input`),T=c(`translation-selector`),E=c(`aspect-ratio-selector`),D=c(`model-selector`),O=c(`start-end-image`),k=c(`consumption`),A=c(`font-awesome-icon`),j=c(`el-button`);return h(),o(`div`,jt,[e(`div`,Mt,[i(_,{class:`mb-4`}),t.isPostProcessing?(h(),o(s,{key:0},[t.config?.video_url?(h(),d(v,{key:0,class:`mb-4`})):a(``,!0),i(y,{class:`mb-4`})],64)):a(``,!0),t.config?.action===`upsample`?(h(),d(b,{key:1,class:`mb-4`})):a(``,!0),t.config?.action===`extend`?(h(),d(x,{key:2,class:`mb-4`})):a(``,!0),t.config?.action===`extend`?(h(),d(S,{key:3,class:`mb-4`})):a(``,!0),t.config?.action===`reshoot`?(h(),d(C,{key:4,class:`mb-4`})):a(``,!0),t.config?.action===`object_insert`?(h(),d(S,{key:5,class:`mb-4`})):a(``,!0),t.config?.action===`object_insert`||t.config?.action===`object_remove`?(h(),d(w,{key:6,class:`mb-4`})):a(``,!0),t.config?.action===`object_remove`?(h(),d(S,{key:7,class:`mb-4`})):a(``,!0),t.isGeneration?(h(),o(s,{key:8},[i(T,{class:`mb-4`}),i(E,{class:`mb-4`}),i(S,{class:`mb-4`}),t.config?.action===`ingredients2video`?a(``,!0):(h(),d(D,{key:0,class:`mb-4`})),t.config?.action===`image2video`||t.config?.action===`ingredients2video`?(h(),d(O,{key:1,class:`mb-2`})):a(``,!0)],64)):a(``,!0)]),e(`div`,Nt,[i(k,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(j,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ft=I(At,[[`render`,Pt]]),It=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:q,FontAwesomeIcon:K,ElAlert:C,VideoPlayer:Q,ElTooltip:x,ElButton:U,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:t({content:!0,failed:!0})},qt={key:0,class:`mb-4`},$={key:1,class:t({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:t({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:t({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(t,s,l,u,p,m){let g=c(`el-image`),_=c(`video-player`),v=c(`el-button`),y=c(`el-tooltip`),b=c(`api-code-button`),x=c(`font-awesome-icon`),S=c(`copy-to-clipboard`),C=c(`el-alert`);return h(),o(`div`,Lt,[e(`div`,Rt,[i(g,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),e(`div`,zt,[e(`div`,Bt,[n(r(t.$t(`veo.name.veoBot`))+` `,1),e(`span`,Vt,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Ht,[t.modelValue?.request?.prompt?(h(),o(`p`,Ut,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,Wt,` - (`+r(t.$t(`veo.status.pending`))+`) `,1)),Array.isArray(t.modelValue?.response?.data)&&t.modelValue?.response?.data[0]?.state===`running`?(h(),o(`span`,Gt,` - (`+r(t.$t(`veo.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,Kt,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,qt,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,$,[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`1080p`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsample1080p`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:1,type:`info`,size:`small`,class:`btn-action`,onClick:s[1]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`4k`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsample4k`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:2,type:`info`,size:`small`,class:`btn-action`,onClick:s[2]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`gif`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsampleGif`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:3,type:`info`,size:`small`,class:`btn-action`,onClick:s[3]||=e=>t.onPickAction(e,t.modelValue?.response,`extend`)},{default:f(()=>[n(r(t.$t(`veo.button.actionExtend`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:4,type:`info`,size:`small`,class:`btn-action`,onClick:s[4]||=e=>t.onPickAction(e,t.modelValue?.response,`reshoot`)},{default:f(()=>[n(r(t.$t(`veo.button.actionReshoot`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:5,type:`info`,size:`small`,class:`btn-action`,onClick:s[5]||=e=>t.onPickAction(e,t.modelValue?.response,`object_insert`)},{default:f(()=>[n(r(t.$t(`veo.button.actionObjectInsert`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:6,type:`info`,size:`small`,class:`btn-action`,onClick:s[6]||=e=>t.onPickAction(e,t.modelValue?.response,`object_remove`)},{default:f(()=>[n(r(t.$t(`veo.button.actionObjectRemove`)),1)]),_:1})):a(``,!0),i(y,{class:`box-item`,effect:`dark`,content:t.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:f(()=>[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[7]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`veo.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/veo/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,Jt,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,Yt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,Xt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,Zt,[i(C,{closable:!1,class:`failure`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,Qt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,$t,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,en,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,tn,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===void 0?(h(),o(`div`,nn,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,rn,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(h(),o(`p`,an,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0)])])}var sn=_({name:`RecentPanel`,components:{TaskPreview:I(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(e,t,n,r,l,u){let p=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return h(),o(s,null,[e.tasks?.items===void 0?(h(),o(`div`,cn,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(h(!0),o(s,null,m(e.tasks?.items,(e,t)=>(h(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(h(),o(`div`,ln,[i(v)])):a(``,!0)],64)}var dn=_({name:`VeoIndex`,components:{ConfigPanel:Ft,Layout:me,RecentPanel:I(sn,[[`render`,un]])},mixins:[ee],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===B.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===B.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(!L(this.uploadTracker,e=>this.$t(e),e=>W.warning(e)))return;let e={...this.config,async:!0};if(!F())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)){W.warning(this.$t(`veo.message.imageRequired`));return}(!e.image_urls||e.image_urls.length===0)&&delete e.image_urls,W.info(this.$t(`veo.message.startingTask`)),G(`veo`,ne.generate(e,{token:t})).then(()=>{W.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?W.error(this.$t(`veo.message.usedUp`)):W.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,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return h(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var pn=I(dn,[[`render`,fn]]);export{pn as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,S as c,T as l,at as u,ht as d,it as f,j as p,mt as m,qt as h,rt as g,tt as _,x as v,z as y}from"./vendor-chart-Dw-P17PN.js";import{r as b,t as x}from"./select-SpoLHPtt.js";import{t as S}from"./upload-BqO4TRgo.js";import{t as C}from"./tooltip-DvD9A154.js";import{t as w}from"./image-DCil-WkM.js";import{t as T}from"./alert-CauWy1wR.js";import{t as E}from"./drawer-5IyzIse-.js";import{Bn as D,In as O,Rn as k,Vn as A,zn as j}from"./constants-BP-0lGQL.js";import{$t as M,A as N,Bt as P,Gt as ee,Ht as te,Kr as F,Ur as I,Ut as L,Vt as R,mi as z,ri as B,rr as V,xn as H}from"./index-1vpeSW7k.js";import{t as U}from"./index.es-Bl6QYiX-.js";import{t as W}from"./CopyToClipboard-BsP4OlMx.js";import{t as G}from"./ImagePreview-oFylxFC_.js";import{n as K}from"./taskDrawerMixin-DyAUhFEq.js";import{t as q}from"./Consumption-CT8Jjixf.js";import{i as J,n as Y,t as X}from"./pagination-CiIUjyb0.js";import{t as Z}from"./ApiCodeButton-cix66dAy.js";import{t as Q}from"./BotPlaceholder-DEmcgW2p.js";import{t as ne}from"./NoTasks-DDv2Mkgv.js";import{t as re}from"./PromptTextarea-B4gddEM8.js";import{t as ie}from"./ImageWrapper-D7lTaFDN.js";var ae=y({name:`LayoutNanobanana`,components:{ElDrawer:E,ElButton:z,FontAwesomeIcon:U},mixins:[K]}),oe={class:`main flex flex-row flex-1`},se={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ce={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function le(t,n,r,i,o,c){let l=u(`font-awesome-icon`),p=u(`el-button`),h=u(`el-drawer`);return _(),s(`div`,oe,[e(`div`,se,[f(t.$slots,`config`,{},void 0,!0)]),e(`div`,ce,[f(t.$slots,`result`,{},void 0,!0)]),d(a(p,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[a(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[v,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:m(()=>[f(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ue=N(ae,[[`render`,le],[`__scopeId`,`data-v-d7e69eb2`]]),de=y({name:`PromptInput`,components:{PromptTextarea:re},computed:{prompt:{get(){return this.$store.state.nanobanana?.config?.prompt},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,prompt:e})}}},mounted(){this.prompt||=``}});function fe(e,t,n,r,i,a){let o=u(`prompt-textarea`);return _(),p(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`nanobanana.name.prompt`),info:e.$t(`nanobanana.description.prompt`),placeholder:e.$t(`nanobanana.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var pe=N(de,[[`render`,fe]]),me=y({name:`ImageUrlsInput`,components:{ElUpload:S,ElButton:z,InfoIcon:J,ImagePreview:G,FontAwesomeIcon:U},mixins:[L,R],data(){return{fileList:[],uploadUrl:F()+`/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.nanobanana?.config?.image_urls}},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}}},mounted(){},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.onSetImageUrls()},onExceed(){B.warning(this.$t(`nanobanana.message.uploadImageExceed`))},onError(){B.error(this.$t(`nanobanana.message.uploadImageError`))},onSetImageUrls(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,image_urls:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImageUrls()},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.onSetImageUrls()}}}),he={class:`field flex items-center justify-between`},ge={class:`title font-bold text-[14px] mb-[10px]`},_e={class:`upload-wrapper flex flex-col items-start gap-[8px]`},ve={class:`controls flex items-center`},ye={class:`file-list flex flex-wrap gap-[10px]`};function be(t,n,o,c,d,f){let h=u(`font-awesome-icon`),v=u(`el-button`),y=u(`el-upload`),b=u(`info-icon`),x=u(`image-preview`);return _(),s(l,null,[e(`div`,he,[e(`h2`,ge,i(t.$t(`nanobanana.name.imageUrls`)),1),e(`div`,_e,[e(`div`,ve,[a(y,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value`,limit:5,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:m(()=>[a(v,{size:`small`,type:`primary`,round:``},{default:m(()=>[a(h,{icon:`fa-solid fa-upload`,class:`mr-1`}),r(` `+i(t.$t(`nanobanana.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`]),a(b,{content:t.$t(`nanobanana.description.imageUrls`),class:`ml-2`},null,8,[`content`])])])]),e(`div`,ye,[(_(!0),s(l,null,g(t.fileList,(e,n)=>(_(),p(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])],64)}var xe=N(me,[[`render`,be]]),Se=y({name:`AspectRatioSelector`,components:{InfoIcon:J},data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`3:2`,label:`3:2`,width:27,height:18},{value:`2:3`,label:`2:3`,width:18,height:27},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25},{value:`4:3`,label:`4:3`,width:24,height:18},{value:`3:4`,label:`3:4`,width:18,height:24}]}},computed:{value(){return this.$store.state.nanobanana?.config?.aspect_ratio}},methods:{onSelect(e){let t=this.value===e?void 0:e,n={...this.$store.state.nanobanana?.config||{}};t?n.aspect_ratio=t:delete n.aspect_ratio,this.$store.commit(`nanobanana/setConfig`,n)}}}),Ce={class:`ratio`},we={class:`header`},Te={class:`title font-bold`},Ee=[`aria-label`],De=[`aria-checked`,`aria-label`,`onClick`,`onKeydown`],Oe={class:`preview`},ke={class:`name`};function Ae(r,o,d,f,p,m){let v=u(`info-icon`);return _(),s(`div`,Ce,[e(`div`,we,[e(`h2`,Te,i(r.$t(`nanobanana.name.aspectRatio`)),1),a(v,{content:r.$t(`nanobanana.description.aspectRatio`),class:`ml-1`},null,8,[`content`])]),e(`div`,{class:`items`,role:`radiogroup`,"aria-label":r.$t(`nanobanana.name.aspectRatio`)},[(_(!0),s(l,null,g(r.options,a=>(_(),s(`div`,{key:a.value,class:n([`item`,{active:r.value===a.value}]),role:`radio`,"aria-checked":r.value===a.value,"aria-label":a.label,tabindex:`0`,onClick:e=>r.onSelect(a.value),onKeydown:[c(t(e=>r.onSelect(a.value),[`prevent`]),[`enter`]),c(t(e=>r.onSelect(a.value),[`prevent`]),[`space`])]},[e(`div`,Oe,[e(`div`,{class:`rect`,style:h({width:a.width+`px`,height:a.height+`px`})},null,4)]),e(`p`,ke,i(a.label),1)],42,De))),128))],8,Ee)])}var je=N(Se,[[`render`,Ae],[`__scopeId`,`data-v-7131eb97`]]),Me=y({name:`NanobananaModelSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:J},data(){return{options:[{value:k,label:this.$t(`nanobanana.model.nanoBanana`)},{value:D,label:D},{value:A,label:this.$t(`nanobanana.model.nanoBananaPro`)},{value:j,label:this.$t(`nanobanana.model.nanoBanana2`)}]}},computed:{value:{get(){return this.$store.state.nanobanana?.config?.model},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,model:e})}},modelDescription(){return this.$t(`nanobanana.description.model`)}},mounted(){this.value||=O}}),Ne={class:`field`},Pe={class:`label`},Fe={class:`box`},Ie={class:`title font-bold`};function Le(t,n,r,o,c,d){let f=u(`info-icon`),h=u(`el-option`),v=u(`el-select`);return _(),s(`div`,Ne,[e(`div`,Pe,[e(`div`,Fe,[e(`h2`,Ie,i(t.$t(`nanobanana.name.model`)),1),a(f,{content:t.modelDescription,class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`nanobanana.placeholder.select`)},{default:m(()=>[(_(!0),s(l,null,g(t.options,e=>(_(),p(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Re=N(Me,[[`render`,Le],[`__scopeId`,`data-v-11cb675b`]]),ze=y({name:`NanobananaResolutionSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:J},data(){return{cachedResolution:`1K`,options:[{value:`1K`,label:`1K`},{value:`2K`,label:`2K`},{value:`4K`,label:`4K`}]}},computed:{value:{get(){return this.$store.state.nanobanana?.config?.resolution},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:e})}},supportsResolution(){let e=this.$store.state.nanobanana?.config?.model;return e===`nano-banana-2`||e===`nano-banana-pro`}},watch:{value(e){this.supportsResolution&&e&&(this.cachedResolution=e)},supportsResolution(e){e?this.value||=this.cachedResolution||`1K`:(this.value&&(this.cachedResolution=this.value),this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:void 0}))}},mounted(){this.supportsResolution&&!this.value&&(this.value=`1K`),!this.supportsResolution&&this.value&&(this.cachedResolution=this.value,this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:void 0}))}}),Be={class:`field`},Ve={class:`label`},He={class:`box`},Ue={class:`title font-bold`};function We(t,n,r,o,c,d){let f=u(`info-icon`),h=u(`el-option`),v=u(`el-select`);return _(),s(`div`,Be,[e(`div`,Ve,[e(`div`,He,[e(`h2`,Ue,i(t.$t(`nanobanana.name.resolution`)),1),a(f,{content:t.$t(`nanobanana.description.resolutionProOnly`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`nanobanana.placeholder.select`),disabled:!t.supportsResolution},{default:m(()=>[(_(!0),s(l,null,g(t.options,e=>(_(),p(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`])])}var Ge=y({name:`ConfigPanel`,components:{ElButton:z,FontAwesomeIcon:U,PromptInput:pe,Consumption:q,ImageUrlsInput:xe,AspectRatioSelector:je,ModelSelector:Re,ResolutionSelector:N(ze,[[`render`,We],[`__scopeId`,`data-v-7ab9d4d4`]])},emits:[`generate`],computed:{config(){return this.$store.state.nanobanana?.config},consumption(){let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;return ee({...e,action:t?`edit`:`generate`},this.service?.cost)},service(){return this.$store.state.nanobanana?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ke={class:`flex flex-col h-full`},qe={class:`flex-1 overflow-y-auto p-5`},Je={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ye(t,n,o,c,l,d){let f=u(`model-selector`),p=u(`resolution-selector`),h=u(`prompt-input`),g=u(`aspect-ratio-selector`),v=u(`image-urls-input`),y=u(`consumption`),b=u(`font-awesome-icon`),x=u(`el-button`);return _(),s(`div`,Ke,[e(`div`,qe,[a(f,{class:`mb-4`}),a(p,{class:`mb-4`}),a(h,{class:`mb-4`}),a(g,{class:`mb-4`}),a(v,{class:`mb-4`})]),e(`div`,Je,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:m(()=>[a(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`nanobanana.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Xe=N(Ge,[[`render`,Ye]]),Ze=y({name:`TaskPreview`,components:{ElImage:w,CopyToClipboard:W,FontAwesomeIcon:U,ElAlert:T,ImageWrapper:ie,ElButton:z,ElTooltip:C,ImagePreview:G,ApiCodeButton:Z},props:{modelValue:{type:Object,required:!0}},computed:{images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e},hasImages(){return this.images.some(e=>!!e?.image_url)},showResult(){let e=this.modelValue?.response;return e?e.success===!0?!0:this.hasImages&&e.success!==!1:!1}},methods:{onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.nanobanana?.config||{}};delete t.action,t.image_urls=[e],this.$store.commit(`nanobanana/setConfig`,t)}}}),Qe={class:`preview`},$e={class:`left`},et={class:`main`},tt={class:`bot`},nt={class:`datetime`},rt={class:`info`},it={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},at={key:1,class:`prompt mt-2`},ot={key:0},st={key:0,class:n({content:!0,failed:!0})},ct={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},lt={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},ut={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ft={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ht={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gt={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},_t={key:1,class:n({content:!0})},vt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},St={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ct={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},wt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tt={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Et={key:2,class:n({content:!0})},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},kt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},At={class:`text-[var(--el-text-color-regular)] text-xs mb-2`};function jt(n,c,d,f,h,v){let y=u(`el-image`),b=u(`image-preview`),x=u(`image-wrapper`),S=u(`el-button`),C=u(`el-tooltip`),w=u(`api-code-button`),T=u(`font-awesome-icon`),E=u(`copy-to-clipboard`),D=u(`el-alert`);return _(),s(`div`,Qe,[e(`div`,$e,[a(y,{src:`https://cdn.acedata.cloud/859plc.jpg`,class:`avatar`})]),e(`div`,et,[e(`div`,tt,[r(i(n.$t(`nanobanana.name.nanobananaBot`))+` `,1),e(`span`,nt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,rt,[n.modelValue?.request?.image_urls&&n.modelValue?.request?.image_urls.length>0?(_(),s(`div`,it,[(_(!0),s(l,null,g(n.modelValue?.request?.image_urls,(e,t)=>(_(),p(b,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(_(),s(`p`,at,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(_(),s(`span`,ot,` - (`+i(n.$t(`nanobanana.status.pending`))+`) `,1))])):o(``,!0)]),n.showResult?(_(),s(`div`,st,[e(`div`,ct,[(_(!0),s(l,null,g(n.images,(e,t)=>(_(),p(x,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,lt,[a(C,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:m(()=>[a(S,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:m(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(w,{path:`/nano-banana/images`,body:n.modelValue?.request},null,8,[`body`])]),a(D,{closable:!1,class:`mt-2 success`},{default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,ut,[a(T,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,dt,[a(T,{icon:`fa-solid fa-image`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,ft,[a(T,{icon:`fa-solid fa-up-right-from-square`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,pt,[a(T,{icon:`fa-solid fa-bolt`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,mt,[a(T,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(_(),s(`p`,ht,[a(T,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(_(),s(`p`,gt,[a(T,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(_(),s(`div`,_t,[a(D,{closable:!1,class:`failure`},{template:m(()=>[a(T,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.failure`)),1)]),default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,vt,[a(T,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,yt,[a(T,{icon:`fa-solid fa-image`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,bt,[a(T,{icon:`fa-solid fa-up-right-from-square`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,xt,[a(T,{icon:`fa-solid fa-bolt`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,St,[a(T,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,Ct,[a(T,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(E,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(_(),s(`p`,wt,[a(T,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(_(),s(`p`,Tt,[a(T,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?(_(),s(`div`,Et,[a(D,{closable:!1,class:`info`},{template:m(()=>[a(T,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.failure`)),1)]),default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,$,[a(T,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,Dt,[a(T,{icon:`fa-solid fa-image`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,Ot,[a(T,{icon:`fa-solid fa-up-right-from-square`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,kt,[a(T,{icon:`fa-solid fa-bolt`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,At,[a(T,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var Mt=y({name:`RecentPanel`,components:{TaskPreview:N(Ze,[[`render`,jt],[`__scopeId`,`data-v-03632767`]]),BotPlaceholder:Q,NoTasks:ne,ScrollList:Y},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.nanobanana?.tasks,items:this.$store.state.nanobanana?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Nt={key:0},Pt={key:2,class:`w-full h-full flex items-center justify-center`};function Ft(e,t,n,r,i,c){let d=u(`bot-placeholder`),f=u(`task-preview`),h=u(`scroll-list`),v=u(`no-tasks`);return _(),s(l,null,[e.tasks?.items===void 0?(_(),s(`div`,Nt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(_(),p(h,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:m(()=>[(_(!0),s(l,null,g(e.tasks?.items,e=>(_(),p(f,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(_(),s(`div`,Pt,[a(v)])):o(``,!0)],64)}var It=y({name:`NanobananaIndex`,components:{ConfigPanel:Xe,Layout:ue,RecentPanel:N(Mt,[[`render`,Ft]])},mixins:[te],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.nanobanana?.status?.getApplications===I.Request},tasksLoading(){return this.$store.state.nanobanana?.status?.getTasks===I.Request},credential(){return this.$store.state.nanobanana?.credential},config(){return this.$store.state.nanobanana?.config},application(){return this.$store.state.nanobanana?.application},tasks(){return this.$store.state.nanobanana?.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 X({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(`nanobanana/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`nanobanana/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(`nanobanana/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!P(this.uploadTracker,e=>this.$t(e),e=>B.warning(e)))return;let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;delete e.action,!t&&`image_urls`in e&&delete e.image_urls,e?.aspect_ratio||delete e.aspect_ratio;let n=e?.model===`nano-banana-2`||e?.model===`nano-banana-pro`;!n&&`resolution`in e&&delete e.resolution,n&&!e?.resolution&&(e.resolution=`1K`);let r={...e,action:t?`edit`:`generate`,async:!0};if(!M())return;let i=this.credential?.token;if(!i){console.error(`no token specified`);return}B.info(this.$t(`nanobanana.message.startingTask`)),V(`nanobanana`,H.generate(r,{token:i})).then(()=>{B.success(this.$t(`nanobanana.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?B.error(this.$t(`nanobanana.message.usedUp`)):B.error(this.$t(`nanobanana.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Lt(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`layout`);return _(),p(l,null,{config:m(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Rt=N(It,[[`render`,Lt]]);export{Rt as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,S as c,T as l,at as u,ht as d,it as f,j as p,mt as m,qt as h,rt as g,tt as _,x as v,z as y}from"./vendor-chart-Dw-P17PN.js";import{r as b,t as x}from"./select-B8mKNpQs.js";import{t as S}from"./upload-DQ2aahUp.js";import{t as C}from"./tooltip-DSa1pG7G.js";import{t as w}from"./image-BdxD4NmE.js";import{t as T}from"./alert-BHNa_9CQ.js";import{t as E}from"./drawer-D7cJi5RQ.js";import{Bn as D,In as O,Rn as k,Vn as A,zn as j}from"./constants-BP-0lGQL.js";import{$t as M,A as N,Bt as P,Gt as ee,Ht as te,Kr as F,Ur as I,Ut as L,Vt as R,mi as z,ri as B,rr as V,xn as H}from"./index-BBc6dqlf.js";import{t as U}from"./index.es-4wmHyz-M.js";import{t as W}from"./CopyToClipboard-BFD5MUwv.js";import{t as G}from"./ImagePreview-BjFaiTLm.js";import{n as K}from"./taskDrawerMixin-DyAUhFEq.js";import{t as q}from"./Consumption-DknmQTaS.js";import{i as J,n as Y,t as X}from"./pagination-rrv4XdjG.js";import{t as Z}from"./ApiCodeButton-Di7D_xxs.js";import{t as Q}from"./BotPlaceholder-_zgdRtjQ.js";import{t as ne}from"./NoTasks-CbsNUmYf.js";import{t as re}from"./PromptTextarea-uxWEr-w3.js";import{t as ie}from"./ImageWrapper-DCGNvxuj.js";var ae=y({name:`LayoutNanobanana`,components:{ElDrawer:E,ElButton:z,FontAwesomeIcon:U},mixins:[K]}),oe={class:`main flex flex-row flex-1`},se={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ce={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function le(t,n,r,i,o,c){let l=u(`font-awesome-icon`),p=u(`el-button`),h=u(`el-drawer`);return _(),s(`div`,oe,[e(`div`,se,[f(t.$slots,`config`,{},void 0,!0)]),e(`div`,ce,[f(t.$slots,`result`,{},void 0,!0)]),d(a(p,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[a(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[v,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:m(()=>[f(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ue=N(ae,[[`render`,le],[`__scopeId`,`data-v-d7e69eb2`]]),de=y({name:`PromptInput`,components:{PromptTextarea:re},computed:{prompt:{get(){return this.$store.state.nanobanana?.config?.prompt},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,prompt:e})}}},mounted(){this.prompt||=``}});function fe(e,t,n,r,i,a){let o=u(`prompt-textarea`);return _(),p(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`nanobanana.name.prompt`),info:e.$t(`nanobanana.description.prompt`),placeholder:e.$t(`nanobanana.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var pe=N(de,[[`render`,fe]]),me=y({name:`ImageUrlsInput`,components:{ElUpload:S,ElButton:z,InfoIcon:J,ImagePreview:G,FontAwesomeIcon:U},mixins:[L,R],data(){return{fileList:[],uploadUrl:F()+`/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.nanobanana?.config?.image_urls}},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}}},mounted(){},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.onSetImageUrls()},onExceed(){B.warning(this.$t(`nanobanana.message.uploadImageExceed`))},onError(){B.error(this.$t(`nanobanana.message.uploadImageError`))},onSetImageUrls(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,image_urls:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImageUrls()},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.onSetImageUrls()}}}),he={class:`field flex items-center justify-between`},ge={class:`title font-bold text-[14px] mb-[10px]`},_e={class:`upload-wrapper flex flex-col items-start gap-[8px]`},ve={class:`controls flex items-center`},ye={class:`file-list flex flex-wrap gap-[10px]`};function be(t,n,o,c,d,f){let h=u(`font-awesome-icon`),v=u(`el-button`),y=u(`el-upload`),b=u(`info-icon`),x=u(`image-preview`);return _(),s(l,null,[e(`div`,he,[e(`h2`,ge,i(t.$t(`nanobanana.name.imageUrls`)),1),e(`div`,_e,[e(`div`,ve,[a(y,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value`,limit:5,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:m(()=>[a(v,{size:`small`,type:`primary`,round:``},{default:m(()=>[a(h,{icon:`fa-solid fa-upload`,class:`mr-1`}),r(` `+i(t.$t(`nanobanana.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`]),a(b,{content:t.$t(`nanobanana.description.imageUrls`),class:`ml-2`},null,8,[`content`])])])]),e(`div`,ye,[(_(!0),s(l,null,g(t.fileList,(e,n)=>(_(),p(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])],64)}var xe=N(me,[[`render`,be]]),Se=y({name:`AspectRatioSelector`,components:{InfoIcon:J},data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`3:2`,label:`3:2`,width:27,height:18},{value:`2:3`,label:`2:3`,width:18,height:27},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25},{value:`4:3`,label:`4:3`,width:24,height:18},{value:`3:4`,label:`3:4`,width:18,height:24}]}},computed:{value(){return this.$store.state.nanobanana?.config?.aspect_ratio}},methods:{onSelect(e){let t=this.value===e?void 0:e,n={...this.$store.state.nanobanana?.config||{}};t?n.aspect_ratio=t:delete n.aspect_ratio,this.$store.commit(`nanobanana/setConfig`,n)}}}),Ce={class:`ratio`},we={class:`header`},Te={class:`title font-bold`},Ee=[`aria-label`],De=[`aria-checked`,`aria-label`,`onClick`,`onKeydown`],Oe={class:`preview`},ke={class:`name`};function Ae(r,o,d,f,p,m){let v=u(`info-icon`);return _(),s(`div`,Ce,[e(`div`,we,[e(`h2`,Te,i(r.$t(`nanobanana.name.aspectRatio`)),1),a(v,{content:r.$t(`nanobanana.description.aspectRatio`),class:`ml-1`},null,8,[`content`])]),e(`div`,{class:`items`,role:`radiogroup`,"aria-label":r.$t(`nanobanana.name.aspectRatio`)},[(_(!0),s(l,null,g(r.options,a=>(_(),s(`div`,{key:a.value,class:n([`item`,{active:r.value===a.value}]),role:`radio`,"aria-checked":r.value===a.value,"aria-label":a.label,tabindex:`0`,onClick:e=>r.onSelect(a.value),onKeydown:[c(t(e=>r.onSelect(a.value),[`prevent`]),[`enter`]),c(t(e=>r.onSelect(a.value),[`prevent`]),[`space`])]},[e(`div`,Oe,[e(`div`,{class:`rect`,style:h({width:a.width+`px`,height:a.height+`px`})},null,4)]),e(`p`,ke,i(a.label),1)],42,De))),128))],8,Ee)])}var je=N(Se,[[`render`,Ae],[`__scopeId`,`data-v-7131eb97`]]),Me=y({name:`NanobananaModelSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:J},data(){return{options:[{value:k,label:this.$t(`nanobanana.model.nanoBanana`)},{value:D,label:D},{value:A,label:this.$t(`nanobanana.model.nanoBananaPro`)},{value:j,label:this.$t(`nanobanana.model.nanoBanana2`)}]}},computed:{value:{get(){return this.$store.state.nanobanana?.config?.model},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,model:e})}},modelDescription(){return this.$t(`nanobanana.description.model`)}},mounted(){this.value||=O}}),Ne={class:`field`},Pe={class:`label`},Fe={class:`box`},Ie={class:`title font-bold`};function Le(t,n,r,o,c,d){let f=u(`info-icon`),h=u(`el-option`),v=u(`el-select`);return _(),s(`div`,Ne,[e(`div`,Pe,[e(`div`,Fe,[e(`h2`,Ie,i(t.$t(`nanobanana.name.model`)),1),a(f,{content:t.modelDescription,class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`nanobanana.placeholder.select`)},{default:m(()=>[(_(!0),s(l,null,g(t.options,e=>(_(),p(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Re=N(Me,[[`render`,Le],[`__scopeId`,`data-v-11cb675b`]]),ze=y({name:`NanobananaResolutionSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:J},data(){return{cachedResolution:`1K`,options:[{value:`1K`,label:`1K`},{value:`2K`,label:`2K`},{value:`4K`,label:`4K`}]}},computed:{value:{get(){return this.$store.state.nanobanana?.config?.resolution},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:e})}},supportsResolution(){let e=this.$store.state.nanobanana?.config?.model;return e===`nano-banana-2`||e===`nano-banana-pro`}},watch:{value(e){this.supportsResolution&&e&&(this.cachedResolution=e)},supportsResolution(e){e?this.value||=this.cachedResolution||`1K`:(this.value&&(this.cachedResolution=this.value),this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:void 0}))}},mounted(){this.supportsResolution&&!this.value&&(this.value=`1K`),!this.supportsResolution&&this.value&&(this.cachedResolution=this.value,this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:void 0}))}}),Be={class:`field`},Ve={class:`label`},He={class:`box`},Ue={class:`title font-bold`};function We(t,n,r,o,c,d){let f=u(`info-icon`),h=u(`el-option`),v=u(`el-select`);return _(),s(`div`,Be,[e(`div`,Ve,[e(`div`,He,[e(`h2`,Ue,i(t.$t(`nanobanana.name.resolution`)),1),a(f,{content:t.$t(`nanobanana.description.resolutionProOnly`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`nanobanana.placeholder.select`),disabled:!t.supportsResolution},{default:m(()=>[(_(!0),s(l,null,g(t.options,e=>(_(),p(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`])])}var Ge=y({name:`ConfigPanel`,components:{ElButton:z,FontAwesomeIcon:U,PromptInput:pe,Consumption:q,ImageUrlsInput:xe,AspectRatioSelector:je,ModelSelector:Re,ResolutionSelector:N(ze,[[`render`,We],[`__scopeId`,`data-v-7ab9d4d4`]])},emits:[`generate`],computed:{config(){return this.$store.state.nanobanana?.config},consumption(){let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;return ee({...e,action:t?`edit`:`generate`},this.service?.cost)},service(){return this.$store.state.nanobanana?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ke={class:`flex flex-col h-full`},qe={class:`flex-1 overflow-y-auto p-5`},Je={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ye(t,n,o,c,l,d){let f=u(`model-selector`),p=u(`resolution-selector`),h=u(`prompt-input`),g=u(`aspect-ratio-selector`),v=u(`image-urls-input`),y=u(`consumption`),b=u(`font-awesome-icon`),x=u(`el-button`);return _(),s(`div`,Ke,[e(`div`,qe,[a(f,{class:`mb-4`}),a(p,{class:`mb-4`}),a(h,{class:`mb-4`}),a(g,{class:`mb-4`}),a(v,{class:`mb-4`})]),e(`div`,Je,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:m(()=>[a(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`nanobanana.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Xe=N(Ge,[[`render`,Ye]]),Ze=y({name:`TaskPreview`,components:{ElImage:w,CopyToClipboard:W,FontAwesomeIcon:U,ElAlert:T,ImageWrapper:ie,ElButton:z,ElTooltip:C,ImagePreview:G,ApiCodeButton:Z},props:{modelValue:{type:Object,required:!0}},computed:{images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e},hasImages(){return this.images.some(e=>!!e?.image_url)},showResult(){let e=this.modelValue?.response;return e?e.success===!0?!0:this.hasImages&&e.success!==!1:!1}},methods:{onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.nanobanana?.config||{}};delete t.action,t.image_urls=[e],this.$store.commit(`nanobanana/setConfig`,t)}}}),Qe={class:`preview`},$e={class:`left`},et={class:`main`},tt={class:`bot`},nt={class:`datetime`},rt={class:`info`},it={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},at={key:1,class:`prompt mt-2`},ot={key:0},st={key:0,class:n({content:!0,failed:!0})},ct={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},lt={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},ut={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ft={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ht={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gt={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},_t={key:1,class:n({content:!0})},vt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},St={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ct={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},wt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tt={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Et={key:2,class:n({content:!0})},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},kt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},At={class:`text-[var(--el-text-color-regular)] text-xs mb-2`};function jt(n,c,d,f,h,v){let y=u(`el-image`),b=u(`image-preview`),x=u(`image-wrapper`),S=u(`el-button`),C=u(`el-tooltip`),w=u(`api-code-button`),T=u(`font-awesome-icon`),E=u(`copy-to-clipboard`),D=u(`el-alert`);return _(),s(`div`,Qe,[e(`div`,$e,[a(y,{src:`https://cdn.acedata.cloud/859plc.jpg`,class:`avatar`})]),e(`div`,et,[e(`div`,tt,[r(i(n.$t(`nanobanana.name.nanobananaBot`))+` `,1),e(`span`,nt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,rt,[n.modelValue?.request?.image_urls&&n.modelValue?.request?.image_urls.length>0?(_(),s(`div`,it,[(_(!0),s(l,null,g(n.modelValue?.request?.image_urls,(e,t)=>(_(),p(b,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(_(),s(`p`,at,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(_(),s(`span`,ot,` - (`+i(n.$t(`nanobanana.status.pending`))+`) `,1))])):o(``,!0)]),n.showResult?(_(),s(`div`,st,[e(`div`,ct,[(_(!0),s(l,null,g(n.images,(e,t)=>(_(),p(x,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,lt,[a(C,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:m(()=>[a(S,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:m(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(w,{path:`/nano-banana/images`,body:n.modelValue?.request},null,8,[`body`])]),a(D,{closable:!1,class:`mt-2 success`},{default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,ut,[a(T,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,dt,[a(T,{icon:`fa-solid fa-image`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,ft,[a(T,{icon:`fa-solid fa-up-right-from-square`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,pt,[a(T,{icon:`fa-solid fa-bolt`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,mt,[a(T,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(_(),s(`p`,ht,[a(T,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(_(),s(`p`,gt,[a(T,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(_(),s(`div`,_t,[a(D,{closable:!1,class:`failure`},{template:m(()=>[a(T,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.failure`)),1)]),default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,vt,[a(T,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,yt,[a(T,{icon:`fa-solid fa-image`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,bt,[a(T,{icon:`fa-solid fa-up-right-from-square`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,xt,[a(T,{icon:`fa-solid fa-bolt`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,St,[a(T,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,Ct,[a(T,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(E,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(_(),s(`p`,wt,[a(T,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(_(),s(`p`,Tt,[a(T,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?(_(),s(`div`,Et,[a(D,{closable:!1,class:`info`},{template:m(()=>[a(T,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.failure`)),1)]),default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,$,[a(T,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,Dt,[a(T,{icon:`fa-solid fa-image`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,Ot,[a(T,{icon:`fa-solid fa-up-right-from-square`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,kt,[a(T,{icon:`fa-solid fa-bolt`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,At,[a(T,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var Mt=y({name:`RecentPanel`,components:{TaskPreview:N(Ze,[[`render`,jt],[`__scopeId`,`data-v-03632767`]]),BotPlaceholder:Q,NoTasks:ne,ScrollList:Y},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.nanobanana?.tasks,items:this.$store.state.nanobanana?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Nt={key:0},Pt={key:2,class:`w-full h-full flex items-center justify-center`};function Ft(e,t,n,r,i,c){let d=u(`bot-placeholder`),f=u(`task-preview`),h=u(`scroll-list`),v=u(`no-tasks`);return _(),s(l,null,[e.tasks?.items===void 0?(_(),s(`div`,Nt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(_(),p(h,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:m(()=>[(_(!0),s(l,null,g(e.tasks?.items,e=>(_(),p(f,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(_(),s(`div`,Pt,[a(v)])):o(``,!0)],64)}var It=y({name:`NanobananaIndex`,components:{ConfigPanel:Xe,Layout:ue,RecentPanel:N(Mt,[[`render`,Ft]])},mixins:[te],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.nanobanana?.status?.getApplications===I.Request},tasksLoading(){return this.$store.state.nanobanana?.status?.getTasks===I.Request},credential(){return this.$store.state.nanobanana?.credential},config(){return this.$store.state.nanobanana?.config},application(){return this.$store.state.nanobanana?.application},tasks(){return this.$store.state.nanobanana?.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 X({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(`nanobanana/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`nanobanana/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(`nanobanana/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!P(this.uploadTracker,e=>this.$t(e),e=>B.warning(e)))return;let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;delete e.action,!t&&`image_urls`in e&&delete e.image_urls,e?.aspect_ratio||delete e.aspect_ratio;let n=e?.model===`nano-banana-2`||e?.model===`nano-banana-pro`;!n&&`resolution`in e&&delete e.resolution,n&&!e?.resolution&&(e.resolution=`1K`);let r={...e,action:t?`edit`:`generate`,async:!0};if(!M())return;let i=this.credential?.token;if(!i){console.error(`no token specified`);return}B.info(this.$t(`nanobanana.message.startingTask`)),V(`nanobanana`,H.generate(r,{token:i})).then(()=>{B.success(this.$t(`nanobanana.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?B.error(this.$t(`nanobanana.message.usedUp`)):B.error(this.$t(`nanobanana.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Lt(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`layout`);return _(),p(l,null,{config:m(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Rt=N(It,[[`render`,Lt]]);export{Rt as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{t as v}from"./upload-BqO4TRgo.js";import{t as y}from"./tooltip-DvD9A154.js";import{t as b}from"./image-DCil-WkM.js";import{t as x}from"./alert-CauWy1wR.js";import{t as S}from"./drawer-5IyzIse-.js";import{t as C}from"./switch-B5g3reYm.js";import"./constants-BP-0lGQL.js";import{$t as w,A as T,Bt as E,Gt as D,Ht as O,Kr as k,Ln as ee,Ur as A,Ut as j,Vt as M,mi as N,ri as P,rr as F}from"./index-1vpeSW7k.js";import{t as I}from"./index.es-Bl6QYiX-.js";import{t as te}from"./CopyToClipboard-BsP4OlMx.js";import{t as L}from"./FilePreview-gPVBnj64.js";import{t as R}from"./ImagePreview-oFylxFC_.js";import{n as z}from"./taskDrawerMixin-DyAUhFEq.js";import{t as B}from"./Consumption-CT8Jjixf.js";import{i as V,n as H,t as U}from"./pagination-CiIUjyb0.js";import{t as W}from"./VideoPlayer-DTw3XqQM.js";import{t as G}from"./ApiCodeButton-cix66dAy.js";import{t as K}from"./BotPlaceholder-DEmcgW2p.js";import{t as q}from"./NoTasks-DDv2Mkgv.js";import{t as J}from"./PromptTextarea-B4gddEM8.js";var Y=_({name:`LayoutLuma`,components:{ElDrawer:S,ElButton:N,FontAwesomeIcon:I},mixins:[z]}),X={class:`main flex flex-row flex-1`},Z={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Q={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ne(t,n,r,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,X,[e(`div`,Z,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Q,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`,class:`drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var re=T(Y,[[`render`,ne],[`__scopeId`,`data-v-da4bcd3a`]]),ie=_({name:`EnhancementSelector`,components:{ElSwitch:C,InfoIcon:V},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug(`set enhancement`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=!0)}}),ae={class:`relative`},oe={class:`flex justify-between`},se={class:`flex justify-start items-center`},ce={class:`text-sm font-bold`},le={class:`flex justify-end items-center`};function ue(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,ae,[e(`div`,oe,[e(`div`,se,[e(`span`,ce,i(t.$t(`luma.name.enhancement`)),1),a(d,{content:t.$t(`luma.description.enhancement`)},null,8,[`content`])]),e(`div`,le,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var de=T(ie,[[`render`,ue]]),fe=_({name:`CustomSelector`,components:{ElSwitch:C,InfoIcon:V},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug(`set custom`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),pe={class:`relative`},me={class:`flex justify-between`},he={class:`flex justify-start items-center`},ge={class:`text-sm font-bold`},_e={class:`flex justify-end items-center`};function ve(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,pe,[e(`div`,me,[e(`div`,he,[e(`span`,ge,i(t.$t(`luma.name.custom`)),1),a(d,{content:t.$t(`luma.description.custom`)},null,8,[`content`])]),e(`div`,_e,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var ye=T(fe,[[`render`,ve]]),be=_({name:`LoopSelector`,components:{ElSwitch:C,InfoIcon:V},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug(`set loop`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),xe={class:`relative`},Se={class:`flex justify-between`},Ce={class:`flex justify-start items-center`},we={class:`text-sm font-bold`},Te={class:`flex justify-end items-center`};function Ee(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,xe,[e(`div`,Se,[e(`div`,Ce,[e(`span`,we,i(t.$t(`luma.name.loop`)),1),a(d,{content:t.$t(`luma.description.loop`)},null,8,[`content`])]),e(`div`,Te,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var De=T(be,[[`render`,Ee]]),Oe=_({name:`EndImage`,components:{ElUpload:v,ElButton:N,ImagePreview:R,InfoIcon:V,FontAwesomeIcon:I},mixins:[j,M],data(){return{fileList:[],uploadUrl:k()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onExceed(){P.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){P.error(this.$t(`luma.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ke={class:`relative`},Ae={class:`flex justify-between`},je={class:`flex justify-start items-center`},Me={class:`text-sm font-bold`};function Ne(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,ke,[e(`div`,Ae,[e(`div`,je,[e(`span`,Me,i(t.$t(`luma.name.endImageUrl`)),1),a(g,{content:t.$t(`luma.description.endImageUrl`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:5,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(h(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`luma.button.uploadEndImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Pe=T(Oe,[[`render`,Ne],[`__scopeId`,`data-v-cd768b26`]]),Fe=_({name:`StartImage`,components:{ElUpload:v,ElButton:N,ImagePreview:R,InfoIcon:V,FontAwesomeIcon:I},mixins:[j,M],data(){return{fileList:[],uploadUrl:k()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){P.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){P.error(this.$t(`luma.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Ie={class:`relative`},Le={class:`flex justify-between`},Re={class:`flex justify-start items-center`},ze={class:`text-sm font-bold`};function Be(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Ie,[e(`div`,Le,[e(`div`,Re,[e(`span`,ze,i(t.$t(`luma.name.startImageUrl`)),1),a(g,{content:t.$t(`luma.description.startImageUrl`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:5,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`luma.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Ve=T(Fe,[[`render`,Be],[`__scopeId`,`data-v-4d03e978`]]),He=_({name:`UploadVideo`,components:{ElUpload:v,ElButton:N,InfoIcon:V,FilePreview:L,FontAwesomeIcon:I},mixins:[M],data(){return{fileList:[],uploadUrl:k()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.luma?.config?.video_url},set(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||=void 0},methods:{onExceed(){P.warning(this.$t(`luma.message.uploadVideoExceed`))},onError(){P.error(this.$t(`luma.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`,n=e.size/1024/1024<10;return t?n?!0:(P.error(this.$t(`luma.message.uploadVideoSizeExceed`)),!1):(P.error(this.$t(`luma.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e,action:`extend`})},async onSuccess(){this.onSetVideoUrl()}}}),Ue={class:`relative`},We={class:`flex justify-between`},Ge={class:`flex justify-start items-center`},Ke={class:`text-sm font-bold`};function qe(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`file-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Ue,[e(`div`,We,[e(`div`,Ge,[e(`span`,Ke,i(t.$t(`luma.name.videoUrl`)),1),a(g,{content:t.$t(`luma.description.videoUrl`)},null,8,[`content`])])]),a(b,{"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`luma.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Je=T(He,[[`render`,qe],[`__scopeId`,`data-v-b4c637fa`]]),Ye=_({name:`PromptInput`,components:{PromptTextarea:J},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Xe(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`luma.name.prompt`),info:e.$t(`luma.description.prompt`),placeholder:e.$t(`luma.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ze=T(Ye,[[`render`,Xe]]),Qe=_({name:`ExtendFromInput`,components:{VideoPlayer:W},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.luma?.config}}}),$e={class:`relative`},et={class:`flex mb-2`},tt={class:`text-sm font-bold`};function nt(t,n,r,a,c,u){let d=l(`video-player`);return h(),s(`div`,$e,[e(`div`,et,[e(`span`,tt,i(t.$t(`luma.name.extend`)),1)]),e(`div`,null,[t.config?.video_url?(h(),f(d,{key:0,src:t.config?.video_url},null,8,[`src`])):o(``,!0)])])}var rt=_({name:`ConfigPanel`,components:{LoopSelector:De,StartImageInput:Ve,EndImageInput:Pe,EnhancementSelector:de,ElButton:N,FontAwesomeIcon:I,PromptInput:Ze,ExtendFromInput:T(Qe,[[`render`,nt]]),CustomSelector:ye,UploadVideo:Je,Consumption:B},emits:[`generate`],computed:{config(){return this.$store.state.luma?.config},consumption(){return D(this.config,this.service?.cost)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),it={class:`flex flex-col h-full`},at={class:`flex-1 overflow-y-auto p-5`},ot={class:`flex flex-col items-center justify-center px-5 pb-5`};function st(t,n,c,u,d,m){let g=l(`extend-from-input`),_=l(`prompt-input`),v=l(`custom-selector`),y=l(`upload-video`),b=l(`start-image-input`),x=l(`end-image-input`),S=l(`enhancement-selector`),C=l(`loop-selector`),w=l(`consumption`),T=l(`font-awesome-icon`),E=l(`el-button`);return h(),s(`div`,it,[e(`div`,at,[t.config?.video_id||t.config?.video_url?(h(),f(g,{key:0,class:`mb-4`})):o(``,!0),a(_,{class:`mb-4`}),t.config?.video_id?o(``,!0):(h(),f(v,{key:1,class:`mb-4`})),t.config?.custom?(h(),f(y,{key:2,class:`mb-4`})):o(``,!0),!(t.config?.video_id||t.config?.video_url)&&!t.config?.custom?(h(),f(b,{key:3,class:`mb-4`})):o(``,!0),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`})]),e(`div`,ot,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(h(),f(E,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`luma.button.extend`)),1)]),_:1},8,[`onClick`])):(h(),f(E,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`luma.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var ct=T(rt,[[`render`,st]]),lt=_({name:`TaskPreview`,components:{ElImage:b,CopyToClipboard:te,FontAwesomeIcon:I,ElAlert:x,VideoPlayer:W,ElTooltip:y,ElButton:N,ApiCodeButton:G},props:{modelValue:{type:Object,required:!0}},emits:[`extend`],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{onExtend(e,t){console.debug(`set config`,t),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_id:t.video_id,prompt:t.prompt,action:`extend`,thumbnail_url:t.thumbnail_url,video_url:t.video_url}),this.$emit(`extend`)},onDownload(e){window.open(e,`_blank`)}}}),ut={class:`preview`},dt={class:`left`},ft={class:`main`},pt={class:`bot`},mt={class:`datetime`},ht={class:`info`},gt={key:0,class:`prompt mt-2`},_t={key:0},vt={key:1},yt={key:0,class:n({content:!0,failed:!0})},bt={key:0,class:`mb-4`},xt={key:1,class:n({operations:!0,"mt-2":!0,"mb-4":!0})},St={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ct={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},wt={key:1,class:n({content:!0})},Tt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ot={key:2,class:n({content:!0})},kt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function At(n,c,u,d,f,m){let g=l(`el-image`),_=l(`video-player`),v=l(`el-button`),y=l(`el-tooltip`),b=l(`api-code-button`),x=l(`font-awesome-icon`),S=l(`copy-to-clipboard`),C=l(`el-alert`);return h(),s(`div`,ut,[e(`div`,dt,[a(g,{src:`https://cdn.acedata.cloud/ahjfwi.png`,class:`avatar`})]),e(`div`,ft,[e(`div`,pt,[r(i(n.$t(`luma.name.lumaBot`))+` `,1),e(`span`,mt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,ht,[n.modelValue?.request?.prompt?(h(),s(`p`,gt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,_t,` - (`+i(n.$t(`luma.status.pending`))+`) `,1)),n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`span`,vt,` - (`+i(n.$t(`luma.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,yt,[n.modelValue.response.video_url?(h(),s(`div`,bt,[a(_,{src:n.modelValue.response.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response&&!n.config?.custom?(h(),s(`div`,xt,[a(y,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.extendVideo`),placement:`top-start`},{default:p(()=>[a(v,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=t(e=>n.onExtend(e,n.modelValue?.response),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.extend`)),1)]),_:1})]),_:1},8,[`content`]),a(y,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(v,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onDownload(n.modelValue?.response?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(b,{path:`/luma/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,St,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Ct,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.state===`failed`||n.modelValue?.response?.success===!1?(h(),s(`div`,wt,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.failure`)),1)]),default:p(()=>[e(`p`,Tt,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Et,[a(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(S,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,$,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,Dt,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.traceId`))+`: `+i(n.modelValue?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),!n.modelValue?.response||n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`div`,Ot,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.failure`)),1)]),default:p(()=>[e(`p`,kt,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var jt=_({name:`RecentPanel`,components:{BotPlaceholder:K,TaskPreview:T(lt,[[`render`,At],[`__scopeId`,`data-v-9c354ffe`]]),NoTasks:q,ScrollList:H},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`,`extend`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Mt={key:0},Nt={key:2,class:`w-full h-full flex items-center justify-center`};function Pt(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Mt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[1]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,n=>(h(),f(g,{key:n.id,"model-value":n,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Nt,[a(v)])):o(``,!0)],64)}var Ft=_({name:`LumaIndex`,components:{ConfigPanel:ct,Layout:re,RecentPanel:T(jt,[[`render`,Pt]])},mixins:[O],inject:[`initialized`],emits:[`extend`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.luma?.status?.getApplications===A.Request},tasksLoading(){return this.$store.state.luma?.status?.getTasks===A.Request||this.fetchingTasks},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,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 U({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(`luma/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`luma/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){console.debug(`scrolling down`),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(`luma/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!E(this.uploadTracker,e=>this.$t(e),e=>P.warning(e)))return;let e={...this.config,async:!0};if(!this.hasText(e.prompt)){P.error(this.$t(`luma.message.promptRequired`));return}if(e.prompt=e.prompt?.trim(),!w())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}P.info(this.$t(`luma.message.startingTask`)),F(`luma`,ee.generate(e,{token:t})).then(()=>{P.success(this.$t(`luma.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?P.error(this.$t(`luma.message.usedUp`)):P.error(this.$t(`luma.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0}}});function It(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`loading`,`onReachTop`])]),_:1})}var Lt=T(Ft,[[`render`,It]]);export{Lt as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{t as v}from"./upload-DQ2aahUp.js";import{t as y}from"./tooltip-DSa1pG7G.js";import{t as b}from"./image-BdxD4NmE.js";import{t as x}from"./alert-BHNa_9CQ.js";import{t as S}from"./drawer-D7cJi5RQ.js";import{t as C}from"./switch-DIw3rsKp.js";import"./constants-BP-0lGQL.js";import{$t as w,A as T,Bt as E,Gt as D,Ht as O,Kr as k,Ln as ee,Ur as A,Ut as j,Vt as M,mi as N,ri as P,rr as F}from"./index-BBc6dqlf.js";import{t as I}from"./index.es-4wmHyz-M.js";import{t as te}from"./CopyToClipboard-BFD5MUwv.js";import{t as L}from"./FilePreview-BO9Suzqu.js";import{t as R}from"./ImagePreview-BjFaiTLm.js";import{n as z}from"./taskDrawerMixin-DyAUhFEq.js";import{t as B}from"./Consumption-DknmQTaS.js";import{i as V,n as H,t as U}from"./pagination-rrv4XdjG.js";import{t as W}from"./VideoPlayer-BcwCieEI.js";import{t as G}from"./ApiCodeButton-Di7D_xxs.js";import{t as K}from"./BotPlaceholder-_zgdRtjQ.js";import{t as q}from"./NoTasks-CbsNUmYf.js";import{t as J}from"./PromptTextarea-uxWEr-w3.js";var Y=_({name:`LayoutLuma`,components:{ElDrawer:S,ElButton:N,FontAwesomeIcon:I},mixins:[z]}),X={class:`main flex flex-row flex-1`},Z={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Q={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ne(t,n,r,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,X,[e(`div`,Z,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Q,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`,class:`drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var re=T(Y,[[`render`,ne],[`__scopeId`,`data-v-da4bcd3a`]]),ie=_({name:`EnhancementSelector`,components:{ElSwitch:C,InfoIcon:V},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug(`set enhancement`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=!0)}}),ae={class:`relative`},oe={class:`flex justify-between`},se={class:`flex justify-start items-center`},ce={class:`text-sm font-bold`},le={class:`flex justify-end items-center`};function ue(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,ae,[e(`div`,oe,[e(`div`,se,[e(`span`,ce,i(t.$t(`luma.name.enhancement`)),1),a(d,{content:t.$t(`luma.description.enhancement`)},null,8,[`content`])]),e(`div`,le,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var de=T(ie,[[`render`,ue]]),fe=_({name:`CustomSelector`,components:{ElSwitch:C,InfoIcon:V},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug(`set custom`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),pe={class:`relative`},me={class:`flex justify-between`},he={class:`flex justify-start items-center`},ge={class:`text-sm font-bold`},_e={class:`flex justify-end items-center`};function ve(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,pe,[e(`div`,me,[e(`div`,he,[e(`span`,ge,i(t.$t(`luma.name.custom`)),1),a(d,{content:t.$t(`luma.description.custom`)},null,8,[`content`])]),e(`div`,_e,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var ye=T(fe,[[`render`,ve]]),be=_({name:`LoopSelector`,components:{ElSwitch:C,InfoIcon:V},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug(`set loop`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),xe={class:`relative`},Se={class:`flex justify-between`},Ce={class:`flex justify-start items-center`},we={class:`text-sm font-bold`},Te={class:`flex justify-end items-center`};function Ee(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,xe,[e(`div`,Se,[e(`div`,Ce,[e(`span`,we,i(t.$t(`luma.name.loop`)),1),a(d,{content:t.$t(`luma.description.loop`)},null,8,[`content`])]),e(`div`,Te,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var De=T(be,[[`render`,Ee]]),Oe=_({name:`EndImage`,components:{ElUpload:v,ElButton:N,ImagePreview:R,InfoIcon:V,FontAwesomeIcon:I},mixins:[j,M],data(){return{fileList:[],uploadUrl:k()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onExceed(){P.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){P.error(this.$t(`luma.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ke={class:`relative`},Ae={class:`flex justify-between`},je={class:`flex justify-start items-center`},Me={class:`text-sm font-bold`};function Ne(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,ke,[e(`div`,Ae,[e(`div`,je,[e(`span`,Me,i(t.$t(`luma.name.endImageUrl`)),1),a(g,{content:t.$t(`luma.description.endImageUrl`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:5,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(h(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`luma.button.uploadEndImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Pe=T(Oe,[[`render`,Ne],[`__scopeId`,`data-v-cd768b26`]]),Fe=_({name:`StartImage`,components:{ElUpload:v,ElButton:N,ImagePreview:R,InfoIcon:V,FontAwesomeIcon:I},mixins:[j,M],data(){return{fileList:[],uploadUrl:k()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){P.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){P.error(this.$t(`luma.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Ie={class:`relative`},Le={class:`flex justify-between`},Re={class:`flex justify-start items-center`},ze={class:`text-sm font-bold`};function Be(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Ie,[e(`div`,Le,[e(`div`,Re,[e(`span`,ze,i(t.$t(`luma.name.startImageUrl`)),1),a(g,{content:t.$t(`luma.description.startImageUrl`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:5,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`luma.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Ve=T(Fe,[[`render`,Be],[`__scopeId`,`data-v-4d03e978`]]),He=_({name:`UploadVideo`,components:{ElUpload:v,ElButton:N,InfoIcon:V,FilePreview:L,FontAwesomeIcon:I},mixins:[M],data(){return{fileList:[],uploadUrl:k()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.luma?.config?.video_url},set(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||=void 0},methods:{onExceed(){P.warning(this.$t(`luma.message.uploadVideoExceed`))},onError(){P.error(this.$t(`luma.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`,n=e.size/1024/1024<10;return t?n?!0:(P.error(this.$t(`luma.message.uploadVideoSizeExceed`)),!1):(P.error(this.$t(`luma.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e,action:`extend`})},async onSuccess(){this.onSetVideoUrl()}}}),Ue={class:`relative`},We={class:`flex justify-between`},Ge={class:`flex justify-start items-center`},Ke={class:`text-sm font-bold`};function qe(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`file-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Ue,[e(`div`,We,[e(`div`,Ge,[e(`span`,Ke,i(t.$t(`luma.name.videoUrl`)),1),a(g,{content:t.$t(`luma.description.videoUrl`)},null,8,[`content`])])]),a(b,{"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`luma.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Je=T(He,[[`render`,qe],[`__scopeId`,`data-v-b4c637fa`]]),Ye=_({name:`PromptInput`,components:{PromptTextarea:J},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Xe(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`luma.name.prompt`),info:e.$t(`luma.description.prompt`),placeholder:e.$t(`luma.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ze=T(Ye,[[`render`,Xe]]),Qe=_({name:`ExtendFromInput`,components:{VideoPlayer:W},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.luma?.config}}}),$e={class:`relative`},et={class:`flex mb-2`},tt={class:`text-sm font-bold`};function nt(t,n,r,a,c,u){let d=l(`video-player`);return h(),s(`div`,$e,[e(`div`,et,[e(`span`,tt,i(t.$t(`luma.name.extend`)),1)]),e(`div`,null,[t.config?.video_url?(h(),f(d,{key:0,src:t.config?.video_url},null,8,[`src`])):o(``,!0)])])}var rt=_({name:`ConfigPanel`,components:{LoopSelector:De,StartImageInput:Ve,EndImageInput:Pe,EnhancementSelector:de,ElButton:N,FontAwesomeIcon:I,PromptInput:Ze,ExtendFromInput:T(Qe,[[`render`,nt]]),CustomSelector:ye,UploadVideo:Je,Consumption:B},emits:[`generate`],computed:{config(){return this.$store.state.luma?.config},consumption(){return D(this.config,this.service?.cost)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),it={class:`flex flex-col h-full`},at={class:`flex-1 overflow-y-auto p-5`},ot={class:`flex flex-col items-center justify-center px-5 pb-5`};function st(t,n,c,u,d,m){let g=l(`extend-from-input`),_=l(`prompt-input`),v=l(`custom-selector`),y=l(`upload-video`),b=l(`start-image-input`),x=l(`end-image-input`),S=l(`enhancement-selector`),C=l(`loop-selector`),w=l(`consumption`),T=l(`font-awesome-icon`),E=l(`el-button`);return h(),s(`div`,it,[e(`div`,at,[t.config?.video_id||t.config?.video_url?(h(),f(g,{key:0,class:`mb-4`})):o(``,!0),a(_,{class:`mb-4`}),t.config?.video_id?o(``,!0):(h(),f(v,{key:1,class:`mb-4`})),t.config?.custom?(h(),f(y,{key:2,class:`mb-4`})):o(``,!0),!(t.config?.video_id||t.config?.video_url)&&!t.config?.custom?(h(),f(b,{key:3,class:`mb-4`})):o(``,!0),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`})]),e(`div`,ot,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(h(),f(E,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`luma.button.extend`)),1)]),_:1},8,[`onClick`])):(h(),f(E,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`luma.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var ct=T(rt,[[`render`,st]]),lt=_({name:`TaskPreview`,components:{ElImage:b,CopyToClipboard:te,FontAwesomeIcon:I,ElAlert:x,VideoPlayer:W,ElTooltip:y,ElButton:N,ApiCodeButton:G},props:{modelValue:{type:Object,required:!0}},emits:[`extend`],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{onExtend(e,t){console.debug(`set config`,t),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_id:t.video_id,prompt:t.prompt,action:`extend`,thumbnail_url:t.thumbnail_url,video_url:t.video_url}),this.$emit(`extend`)},onDownload(e){window.open(e,`_blank`)}}}),ut={class:`preview`},dt={class:`left`},ft={class:`main`},pt={class:`bot`},mt={class:`datetime`},ht={class:`info`},gt={key:0,class:`prompt mt-2`},_t={key:0},vt={key:1},yt={key:0,class:n({content:!0,failed:!0})},bt={key:0,class:`mb-4`},xt={key:1,class:n({operations:!0,"mt-2":!0,"mb-4":!0})},St={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ct={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},wt={key:1,class:n({content:!0})},Tt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ot={key:2,class:n({content:!0})},kt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function At(n,c,u,d,f,m){let g=l(`el-image`),_=l(`video-player`),v=l(`el-button`),y=l(`el-tooltip`),b=l(`api-code-button`),x=l(`font-awesome-icon`),S=l(`copy-to-clipboard`),C=l(`el-alert`);return h(),s(`div`,ut,[e(`div`,dt,[a(g,{src:`https://cdn.acedata.cloud/ahjfwi.png`,class:`avatar`})]),e(`div`,ft,[e(`div`,pt,[r(i(n.$t(`luma.name.lumaBot`))+` `,1),e(`span`,mt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,ht,[n.modelValue?.request?.prompt?(h(),s(`p`,gt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,_t,` - (`+i(n.$t(`luma.status.pending`))+`) `,1)),n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`span`,vt,` - (`+i(n.$t(`luma.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,yt,[n.modelValue.response.video_url?(h(),s(`div`,bt,[a(_,{src:n.modelValue.response.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response&&!n.config?.custom?(h(),s(`div`,xt,[a(y,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.extendVideo`),placement:`top-start`},{default:p(()=>[a(v,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=t(e=>n.onExtend(e,n.modelValue?.response),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.extend`)),1)]),_:1})]),_:1},8,[`content`]),a(y,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(v,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onDownload(n.modelValue?.response?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(b,{path:`/luma/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,St,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Ct,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.state===`failed`||n.modelValue?.response?.success===!1?(h(),s(`div`,wt,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.failure`)),1)]),default:p(()=>[e(`p`,Tt,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Et,[a(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(S,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,$,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,Dt,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.traceId`))+`: `+i(n.modelValue?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),!n.modelValue?.response||n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`div`,Ot,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.failure`)),1)]),default:p(()=>[e(`p`,kt,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var jt=_({name:`RecentPanel`,components:{BotPlaceholder:K,TaskPreview:T(lt,[[`render`,At],[`__scopeId`,`data-v-9c354ffe`]]),NoTasks:q,ScrollList:H},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`,`extend`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Mt={key:0},Nt={key:2,class:`w-full h-full flex items-center justify-center`};function Pt(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Mt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[1]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,n=>(h(),f(g,{key:n.id,"model-value":n,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Nt,[a(v)])):o(``,!0)],64)}var Ft=_({name:`LumaIndex`,components:{ConfigPanel:ct,Layout:re,RecentPanel:T(jt,[[`render`,Pt]])},mixins:[O],inject:[`initialized`],emits:[`extend`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.luma?.status?.getApplications===A.Request},tasksLoading(){return this.$store.state.luma?.status?.getTasks===A.Request||this.fetchingTasks},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,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 U({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(`luma/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`luma/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){console.debug(`scrolling down`),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(`luma/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!E(this.uploadTracker,e=>this.$t(e),e=>P.warning(e)))return;let e={...this.config,async:!0};if(!this.hasText(e.prompt)){P.error(this.$t(`luma.message.promptRequired`));return}if(e.prompt=e.prompt?.trim(),!w())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}P.info(this.$t(`luma.message.startingTask`)),F(`luma`,ee.generate(e,{token:t})).then(()=>{P.success(this.$t(`luma.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?P.error(this.$t(`luma.message.usedUp`)):P.error(this.$t(`luma.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0}}});function It(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`loading`,`onReachTop`])]),_:1})}var Lt=T(Ft,[[`render`,It]]);export{Lt as default};