@acedatacloud/nexior 3.313.0 → 3.313.1

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 (135) hide show
  1. package/dist/assets/{ApiCodeButton-w2H75bSh.js → ApiCodeButton-CEvOQHRz.js} +1 -1
  2. package/dist/assets/{AskUserQuestionCard-Dnc7kPo1.js → AskUserQuestionCard-BxvFdVSB.js} +1 -1
  3. package/dist/assets/{Auth-CUbHs_MB.js → Auth-BRa3_Ndw.js} +1 -1
  4. package/dist/assets/{Bare-BNBKb21h.js → Bare-CDJwDpyj.js} +1 -1
  5. package/dist/assets/{BotPlaceholder-CxKG8Hym.js → BotPlaceholder-CueTGOF1.js} +1 -1
  6. package/dist/assets/{BottomFooter-ZNndGH3q.js → BottomFooter-D0N_yZOc.js} +1 -1
  7. package/dist/assets/{Callback-Ds6a8Llb.js → Callback-CxWep0Pj.js} +1 -1
  8. package/dist/assets/{CodeSnippet-9mq0FF0l.js → CodeSnippet-C_wxCqnR.js} +1 -1
  9. package/dist/assets/{Console-P2UoG0ix.js → Console-DOGC4exX.js} +1 -1
  10. package/dist/assets/{Consumption-mzszOU5D.js → Consumption-C9jb4ANC.js} +1 -1
  11. package/dist/assets/{Conversation-C3UEE77Q.js → Conversation-BmtMW9eb.js} +1 -1
  12. package/dist/assets/{CopyToClipboard--2jgu_fL.js → CopyToClipboard-DFQ4IOLO.js} +1 -1
  13. package/dist/assets/{Detail-CLch9bp7.js → Detail-Bhstbq2O.js} +2 -2
  14. package/dist/assets/{Extra-ClTjqaA6.js → Extra-Cwn1wFSK.js} +1 -1
  15. package/dist/assets/{FilePreview-dJvwmz61.js → FilePreview-DqQ_7x8i.js} +1 -1
  16. package/dist/assets/{Hailuo-C_c0dmdS.js → Hailuo-DJn5sNFj.js} +1 -1
  17. package/dist/assets/{History-D7VPiq5E.js → History-B8CstfSz.js} +1 -1
  18. package/dist/assets/{ImagePreview-zuMlHykT.js → ImagePreview-w1XgTsO0.js} +1 -1
  19. package/dist/assets/{ImageWrapper-mOGvz7wJ.js → ImageWrapper-CkAQcRG3.js} +1 -1
  20. package/dist/assets/{Index-TnZPuoqO.js → Index-BChOhIaH.js} +1 -1
  21. package/dist/assets/{Index-CxbAak1V.js → Index-BEvvaStY.js} +1 -1
  22. package/dist/assets/{Index-l-4U1SVT.js → Index-BFSZofI0.js} +1 -1
  23. package/dist/assets/{Index-ROJ66tLY.js → Index-BFv5bkgw.js} +1 -1
  24. package/dist/assets/{Index-0Wn6W0uM.js → Index-BGKoIT_N.js} +1 -1
  25. package/dist/assets/{Index-CNW9VfjZ.js → Index-BHuDmvJP.js} +1 -1
  26. package/dist/assets/{Index-DtqPELGk.js → Index-BqvWnuD7.js} +1 -1
  27. package/dist/assets/{Index-DNARTjh6.js → Index-BxSFMSkV.js} +1 -1
  28. package/dist/assets/{Index-BazN_E5b.js → Index-C6uVkVgl.js} +1 -1
  29. package/dist/assets/{Index-S2995lif.js → Index-CJVpYRtI.js} +1 -1
  30. package/dist/assets/{Index-BZjqGrfk.js → Index-CMWh86tb.js} +1 -1
  31. package/dist/assets/{Index-Cnwe05jC.js → Index-Csdi9MWD.js} +1 -1
  32. package/dist/assets/{Index-CuyfbJ8j.js → Index-D-CXE2JI.js} +1 -1
  33. package/dist/assets/{Index-DvVdVGpY.js → Index-DDNnjve1.js} +1 -1
  34. package/dist/assets/{Index-BPIv4QL8.js → Index-DDh4P0hu.js} +1 -1
  35. package/dist/assets/{Index-DhJM5ySV.js → Index-DH7aubPC.js} +1 -1
  36. package/dist/assets/{Index-D_9MMZRr.js → Index-DKKr2G2K.js} +1 -1
  37. package/dist/assets/{Index-B09VLOhI.js → Index-DV1qzkDU.js} +1 -1
  38. package/dist/assets/{Index-C6tDXz4f.js → Index-DX-lokWk.js} +1 -1
  39. package/dist/assets/{Index-DTD76wP9.js → Index-DY5kmWcT.js} +1 -1
  40. package/dist/assets/{Index-DVRE51e6.js → Index-DxGRjDmp.js} +1 -1
  41. package/dist/assets/{Index-BU8pBpAF.js → Index-JDoAV7wM.js} +1 -1
  42. package/dist/assets/{Index-C9I32hby.js → Index-WPUwDvyn.js} +1 -1
  43. package/dist/assets/{Index-C3iKtVpJ.js → Index-XnfkGNiv.js} +1 -1
  44. package/dist/assets/{Index-B-2RzsaX.js → Index-Zo1cOM3j.js} +1 -1
  45. package/dist/assets/{Index-Fzsy7QQI.js → Index-ac-iq0lM.js} +1 -1
  46. package/dist/assets/{Index-D_WS0PPX.js → Index-iH5rZ7cg.js} +1 -1
  47. package/dist/assets/{Index-DnYjAVUl.js → Index-z-5fzqdW.js} +1 -1
  48. package/dist/assets/{Invitees-BlDmXJDW.js → Invitees-Q2Okncil.js} +1 -1
  49. package/dist/assets/{List-Bnb1W2FW.js → List-B8Ywypg_.js} +1 -1
  50. package/dist/assets/{List-B41GYa24.js → List-DOP3Ye_j.js} +1 -1
  51. package/dist/assets/{List-BboeE4h1.js → List-DtE5e4mS.js} +1 -1
  52. package/dist/assets/{LocalTools-DjhJmJtS.js → LocalTools-DuoRqbBP.js} +1 -1
  53. package/dist/assets/{LocalTools-DvfFfCUY.js → LocalTools-mGrnqaTl.js} +1 -1
  54. package/dist/assets/{Main-T_C05vcR.js → Main-KhcvZDzn.js} +1 -1
  55. package/dist/assets/{Model-C0LFUFRS.js → Model-Dofi_qI7.js} +1 -1
  56. package/dist/assets/{Navigator-BHWYqhxz.js → Navigator-BQUbRnUn.js} +2 -2
  57. package/dist/assets/{Navigator-D1SCrf5n.css → Navigator-C3TfsB53.css} +1 -1
  58. package/dist/assets/{NoTasks-DWF77Bjw.js → NoTasks-BLkIrpVk.js} +1 -1
  59. package/dist/assets/{NotFound--tM_3F9Q.js → NotFound-CZPNb-Rn.js} +1 -1
  60. package/dist/assets/{Pagination-B_hKCtLs.js → Pagination-D4ah8KTk.js} +1 -1
  61. package/dist/assets/{Pay-DMFP23cz.js → Pay-DmmE_AUz.js} +1 -1
  62. package/dist/assets/{Player-UA87GBZN.js → Player-DtD0zzj9.js} +1 -1
  63. package/dist/assets/{PromptTextarea-C_g1pSMP.js → PromptTextarea-DfG4xE4f.js} +1 -1
  64. package/dist/assets/{RealtimeCall-D4YYQpaY.js → RealtimeCall-5Xeh91pf.js} +1 -1
  65. package/dist/assets/{ScheduledTasks-CJqZEPGT.js → ScheduledTasks-qPoYpFA9.js} +1 -1
  66. package/dist/assets/{Status-B4cXfVjU.js → Status-CYJT4HgG.js} +1 -1
  67. package/dist/assets/{Subscribe-BwhiIDW9.js → Subscribe-CuLpSStU.js} +1 -1
  68. package/dist/assets/{TabSwitcher-BfceQJnt.js → TabSwitcher-BuwIJ1Nn.js} +1 -1
  69. package/dist/assets/{Tts-_7e4Ip6z.js → Tts-B8XidMnu.js} +1 -1
  70. package/dist/assets/{VideoPlayer-BowJFnOh.js → VideoPlayer-CtxypgMD.js} +1 -1
  71. package/dist/assets/{avatar-CKf1v6Ou.js → avatar-gzGrySh5.js} +1 -1
  72. package/dist/assets/{basic-D9W_bk0a.js → basic-D665Q-Gy.js} +1 -1
  73. package/dist/assets/{chat-DyfoSEk1.js → chat-DTpJs5ed.js} +1 -1
  74. package/dist/assets/{codingBridge-BpWB11rv.js → codingBridge-lqnxD50z.js} +1 -1
  75. package/dist/assets/{codingBridgeNotify-E9x7R9-r.js → codingBridgeNotify-DZo-jMnY.js} +2 -2
  76. package/dist/assets/{collapse-BDN9vBce.js → collapse-B2Fz2b5O.js} +1 -1
  77. package/dist/assets/{createTaskActions--uI9aray.js → createTaskActions-PY8zizvc.js} +1 -1
  78. package/dist/assets/{date-picker-BB05x7os.js → date-picker-DBPTKu3y.js} +1 -1
  79. package/dist/assets/{digitalhuman-7a6OAxhs.js → digitalhuman-BucOjmu9.js} +1 -1
  80. package/dist/assets/{dropdown-eQccMeSr.js → dropdown-B2u9D46C.js} +1 -1
  81. package/dist/assets/{esm-s-r4o8dI.js → esm-CZczpmQe.js} +2 -2
  82. package/dist/assets/{esm-Bbe0IPpD.js → esm-Ci4Q2SqN.js} +2 -2
  83. package/dist/assets/{esm-Bqape_pJ.js → esm-CpnzQK_s.js} +1 -1
  84. package/dist/assets/{esm-B2Ps-Rdy.js → esm-D01tIOQY.js} +1 -1
  85. package/dist/assets/{esm-w-J7UtOH.js → esm-DFO9EBA0.js} +1 -1
  86. package/dist/assets/{esm-B0cqCRhq.js → esm-Dv-DfVZ6.js} +3 -3
  87. package/dist/assets/esm-siwicaMB.js +1 -0
  88. package/dist/assets/{fish-SCUoTPLr.js → fish-CZRn2ZeS.js} +1 -1
  89. package/dist/assets/{flux-CCqcJrr8.js → flux-9wgjjYmQ.js} +1 -1
  90. package/dist/assets/{grokvideo-B8z7YDjM.js → grokvideo-5yJ01cRe.js} +1 -1
  91. package/dist/assets/{hailuo-OlPFUuzF.js → hailuo-BBMgurzN.js} +1 -1
  92. package/dist/assets/{headshots-BfIo2G9s.js → headshots-DiyT4ABu.js} +1 -1
  93. package/dist/assets/{image-DwKDUrzV.js → image-98SuLK5-.js} +1 -1
  94. package/dist/assets/{index-DlJr9VYp.js → index-BRkE9zIu.js} +3 -3
  95. package/dist/assets/{index.browser.esm-BbZ4faFO.js → index.browser.esm-nNPVxpKu.js} +1 -1
  96. package/dist/assets/{index.es-BHvvolz-.js → index.es-Dw0M6NcN.js} +1 -1
  97. package/dist/assets/{input-number-DDAxxsV9.js → input-number-B6BEZroj.js} +1 -1
  98. package/dist/assets/{kling-BQEX-z47.js → kling-B2UPKJRT.js} +1 -1
  99. package/dist/assets/{luma-DvAaWuVv.js → luma-C1nfY31E.js} +1 -1
  100. package/dist/assets/{maestro-DM0x64F0.js → maestro-CE99fPd6.js} +1 -1
  101. package/dist/assets/{midjourney-DG6Ix5Rq.js → midjourney-BEV_ALiB.js} +1 -1
  102. package/dist/assets/{nanobanana-DamPXFkC.js → nanobanana-CT8saHNk.js} +1 -1
  103. package/dist/assets/{openaiimage-QqvfLPCW.js → openaiimage-BMKHDGCd.js} +1 -1
  104. package/dist/assets/{pagination-h9rCWZht.js → pagination-B_40M0as.js} +1 -1
  105. package/dist/assets/{pika-DDqwHjZN.js → pika-B0tWhW4z.js} +1 -1
  106. package/dist/assets/{pixverse-BNhC3502.js → pixverse-BhV5GD1D.js} +1 -1
  107. package/dist/assets/{popover-B_CvW-p3.js → popover-BlzhA1VF.js} +1 -1
  108. package/dist/assets/{producer-BkUxZKXD.js → producer-DL3XVEV-.js} +1 -1
  109. package/dist/assets/{qrart-CF5XIp9U.js → qrart-Div2AiaA.js} +1 -1
  110. package/dist/assets/{realtime-4CjdOWk5.js → realtime-DiS-xQeP.js} +1 -1
  111. package/dist/assets/{row-CuqrRPyi.js → row-CCJteoSt.js} +1 -1
  112. package/dist/assets/{seedance-KBEMXhlz.js → seedance-BxcA2f-M.js} +1 -1
  113. package/dist/assets/{seedream-CIbV_CuW.js → seedream-Dt0Wx8ht.js} +1 -1
  114. package/dist/assets/{select-CTGAdTl9.js → select-D3xXGtAg.js} +1 -1
  115. package/dist/assets/{serp-gfhnDEyg.js → serp-ByOfLcMN.js} +1 -1
  116. package/dist/assets/{slider-m4bBej6R.js → slider-5CrpaEzT.js} +1 -1
  117. package/dist/assets/{solana-wallets-HE4-v6AP.js → solana-wallets-Cx2quCoU.js} +2 -2
  118. package/dist/assets/{solana-wallets-vue-0m1O_RGO.js → solana-wallets-vue--bf0uOPz.js} +1 -1
  119. package/dist/assets/{sora-D6y_5Wn4.js → sora-Dko4b_sU.js} +1 -1
  120. package/dist/assets/{suno-DoSGAMQ8.js → suno-BMufH5NY.js} +1 -1
  121. package/dist/assets/{switch-C7bMRiui.js → switch-BKuYGnPZ.js} +1 -1
  122. package/dist/assets/{tabs-BoOz64uZ.js → tabs-CEBj_wbA.js} +1 -1
  123. package/dist/assets/{time-picker--8djDRT4.js → time-picker-AcysMiLn.js} +1 -1
  124. package/dist/assets/{upload-CRcRB-U7.js → upload-izq5b45N.js} +1 -1
  125. package/dist/assets/{veo-B_Kd3MJV.js → veo-CHzp-X_S.js} +1 -1
  126. package/dist/assets/{wan-Dpc-VA18.js → wan-ClDR7EGp.js} +1 -1
  127. package/dist/assets/{web-DdXVXKOX.js → web-BFunJxNw.js} +1 -1
  128. package/dist/assets/{web-BEcpzfG5.js → web-BNpqdAeV.js} +1 -1
  129. package/dist/assets/{web-CW4fH3P_.js → web-BbF5rPKO.js} +1 -1
  130. package/dist/assets/{web-dBKWh966.js → web-CZPpr5bV.js} +1 -1
  131. package/dist/assets/{web-xGjtoIAR.js → web-KWfGXG39.js} +1 -1
  132. package/dist/assets/{webextrator-C19hR4r3.js → webextrator-ukRP9ntW.js} +1 -1
  133. package/dist/index.html +1 -1
  134. package/package.json +1 -1
  135. package/dist/assets/esm-CBAjRqyO.js +0 -1
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Ut as c,Vt as l,Wt as u,Z as d,b as f,dt as p,et as m,k as h,tt as g,ut as _,v}from"./vendor-chart-BJCvKk8-.js";import{t as y}from"./button-BydTr5nV.js";import{E as b}from"./use-deprecated-B-NFNg3W.js";import{r as x,t as S}from"./select-CTGAdTl9.js";import{n as C,t as w}from"./tabs-BoOz64uZ.js";import{t as T}from"./upload-CRcRB-U7.js";import{t as E}from"./tooltip-ivBOvVK_.js";import{t as ee}from"./image-DwKDUrzV.js";import{t as D}from"./alert-C51owb6L.js";import{n as O,r as te}from"./radio-3Hz7h3DR.js";import{t as k}from"./drawer-Aw9IMZFK.js";import{t as A}from"./input-number-DDAxxsV9.js";import{t as j}from"./slider-m4bBej6R.js";import{t as ne}from"./switch-C7bMRiui.js";import{Zr as re,ei as ie,ni as M,ti as ae}from"./constants-D5XSekB2.js";import{Bt as oe,Dn as N,Jn as P,Kr as F,Lr as I,O as L,Pr as se,Rr as R,Rt as z,Ut as B,Vt as V,Wr as ce,Zt as H,zr as U,zt as W}from"./index-DlJr9VYp.js";import{t as G}from"./index.es-BHvvolz-.js";import{t as le}from"./CopyToClipboard--2jgu_fL.js";import{t as ue}from"./FilePreview-dJvwmz61.js";import{t as K}from"./ImagePreview-zuMlHykT.js";import{n as de}from"./taskDrawerMixin-DEgO_R5H.js";import{t as q}from"./Consumption-mzszOU5D.js";import{i as J,n as fe,t as pe}from"./pagination-h9rCWZht.js";import{t as me}from"./VideoPlayer-BowJFnOh.js";import{t as he}from"./ApiCodeButton-w2H75bSh.js";import{t as ge}from"./BotPlaceholder-CxKG8Hym.js";import{t as _e}from"./NoTasks-DWF77Bjw.js";import{t as ve}from"./PromptTextarea-C_g1pSMP.js";var ye=r({name:`LayoutKling`,components:{ElDrawer:k,ElButton:y,FontAwesomeIcon:G},mixins:[de]}),be={class:`main flex flex-row flex-1 min-h-0`},xe={class:`config w-[320px] flex-none h-full flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Se={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Ce(e,r,i,a,s,c){let l=g(`font-awesome-icon`),u=g(`el-button`),f=g(`el-drawer`);return d(),t(`div`,be,[n(`div`,xe,[m(e.$slots,`config`,{},void 0,!0)]),n(`div`,Se,[m(e.$slots,`result`,{},void 0,!0)]),p(o(u,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:_(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[v,!e.tasksEmpty]]),o(f,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`350px`},{default:_(()=>[m(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var we=L(ye,[[`render`,Ce],[`__scopeId`,`data-v-b87958dc`]]),Te={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};function Y(e,t,n){let r=t||`std`,i=n??5;switch(e){case`kling-v1`:return{text2video:!0,image2video:!0,endImage:i===5,audio:!1,motionControl:i===5};case`kling-v1-6`:case`kling-v2-5-turbo`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:!1,motionControl:!1};case`kling-v2-6`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:r===`pro`,motionControl:!1};case`kling-v2-master`:case`kling-v2-1-master`:return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};case`kling-v3`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:r!==`4k`};case`kling-v3-omni`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1};case`kling-video-o1`:return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1};default:return Te}}function X(e,t){if(!e)return[];let n=t.model??e.model,r=t.mode??e.mode,i=t.duration??e.duration;if(!n)return[];let a=Y(n,r,i),o=[];return e.end_image_url&&!a.endImage&&o.push({field:`end_image_url`,i18nLabel:`kling.name.endImage`}),e.generate_audio&&!a.audio&&o.push({field:`generate_audio`,i18nLabel:`kling.name.generateAudio`}),e.camera_control?.type&&(!a.motionControl||e.start_image_url)&&o.push({field:`camera_control`,i18nLabel:`kling.name.cameraControl`}),o}function Z(e,t){let n={...e};for(let e of t)e.field===`end_image_url`&&(n.end_image_url=void 0),e.field===`generate_audio`&&(n.generate_audio=!1),e.field===`camera_control`&&(n.camera_control=void 0);return n}var Ee=r({name:`ModelSelector`,components:{ElSelect:x,ElOption:S},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{revertKey:0,options:[{value:`kling-v3`,label:`v3`},{value:`kling-v3-omni`,label:`v3-Omni`},{value:`kling-v2-6`,label:`v2.6`},{value:`kling-v2-5-turbo`,label:`v2.5-Turbo`},{value:`kling-v2-1-master`,label:`v2.1-Master`},{value:`kling-v2-master`,label:`v2-Master`},{value:`kling-v1-6`,label:`v1.6`},{value:`kling-v1`,label:`v1`},{value:`kling-video-o1`,label:`Video-o1`}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(re)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await R.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,model:e},n);this.$store.commit(`kling/setConfig`,i),U.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,model:e})}}}),De={class:`field`},Oe={class:`title font-bold`};function ke(r,i,o,c,l,f){let p=g(`el-option`),m=g(`el-select`);return d(),t(`div`,De,[n(`h2`,Oe,u(r.$t(`pika.name.model`)),1),(d(),a(m,{key:r.revertKey,"model-value":r.value,class:`value`,placeholder:r.$t(`pika.placeholder.select`),onChange:r.onChange},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(p,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Ae=L(Ee,[[`render`,ke],[`__scopeId`,`data-v-04059875`]]),je=r({name:`ModeSelector`,components:{ElSelect:x,ElOption:S,InfoIcon:J},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},cameraControlSet(){return!!this.$store.state.kling?.config?.camera_control?.type},fourKReason(){return M.includes(this.selectedModel)?this.cameraControlSet?this.$t(`kling.description.mode4kIncompatibleCamera`):``:this.$t(`kling.description.mode4kRequiresV3`)},options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`),disabled:!1,disabledReason:``},{value:`pro`,label:this.$t(`kling.name.modePro`),disabled:!1,disabledReason:``},{value:`4k`,label:this.$t(`kling.name.mode4k`),disabled:!!this.fourKReason,disabledReason:this.fourKReason}]},value(){return this.$store.state.kling?.config?.mode}},watch:{fourKReason(e){e&&this.value===`4k`&&this.applyMode(`std`)}},mounted(){this.value||this.applyMode(`std`)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{mode:e});if(n.length===0){this.applyMode(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await R.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,mode:e},n);this.$store.commit(`kling/setConfig`,i),U.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyMode(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,mode:e})}}}),Me={class:`field`},Ne={class:`header`},Pe={class:`title font-bold`},Fe={key:0,class:`opt-tip`};function Ie(r,i,c,f,p,m){let v=g(`info-icon`),y=g(`el-option`),b=g(`el-select`);return d(),t(`div`,Me,[n(`div`,Ne,[n(`h2`,Pe,u(r.$t(`kling.name.mode`)),1),o(v,{content:r.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(d(),a(b,{key:r.revertKey,"model-value":r.value,class:`value`,placeholder:r.$t(`kling.placeholder.select`),clearable:!0,onChange:r.onChange},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(y,{key:e.value,label:e.label,value:e.value,disabled:e.disabled},{default:_(()=>[n(`span`,{class:l({"opt-disabled":e.disabled})},u(e.label),3),e.disabled&&e.disabledReason?(d(),t(`span`,Fe,u(e.disabledReason),1)):h(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Le=L(je,[[`render`,Ie],[`__scopeId`,`data-v-9a8fa3c5`]]),Re=[3,5,8,10,12,15],ze=[5,10],Be=r({name:`DurationSelector`,components:{ElSelect:x,ElOption:S,InfoIcon:J},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return M.includes(this.selectedModel)},allowedDurations(){return this.isV3Model?Re:ze},value(){return this.$store.state.kling?.config?.duration??5},selectValue(){let e=this.allowedDurations;return e.includes(this.value)?this.value:e.includes(5)?5:e[0]}},watch:{isV3Model(){this.allowedDurations.includes(this.value)||this.applyDuration(5)}},mounted(){this.$store.state.kling?.config?.duration||this.applyDuration(5)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{duration:e});if(n.length===0){this.applyDuration(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await R.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,duration:e},n);this.$store.commit(`kling/setConfig`,i),U.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyDuration(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,duration:e})}}}),Ve={class:`field`},He={class:`control`},Ue={class:`label`},We={class:`title font-bold`};function Ge(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,Ve,[n(`div`,He,[n(`div`,Ue,[n(`h2`,We,u(r.$t(`kling.name.duration`)),1),o(m,{content:r.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(d(),a(v,{key:r.revertKey,"model-value":r.selectValue,class:`value`,placeholder:r.$t(`kling.placeholder.select`),onChange:r.onChange},{default:_(()=>[(d(!0),t(s,null,e(r.allowedDurations,e=>(d(),a(h,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var Ke=L(Be,[[`render`,Ge],[`__scopeId`,`data-v-5ae55e28`]]),qe=r({name:`RatioSelector`,data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug(`set ratio`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||=`1:1`}}),Je={class:`text-sm font-bold mb-2 block`},Ye={class:`items`},Xe=[`onClick`],Ze={class:`name`};function Qe(r,i,a,o,f,p){return d(),t(`div`,null,[n(`span`,Je,u(r.$t(`kling.name.ratio`)),1),n(`div`,Ye,[(d(!0),t(s,null,e(r.options,(e,i)=>(d(),t(`div`,{key:i,class:l({active:r.active===i,item:!0}),onClick:t=>r.value=e.value},[n(`div`,{class:l([`preview`,e.label])},[n(`div`,{class:`rect`,style:c({width:e.width+`px`,height:e.height+`px`})},null,4)],2),n(`p`,Ze,u(e.label),1)],10,Xe))),128))])])}var $e=L(qe,[[`render`,Qe],[`__scopeId`,`data-v-cdb14b2f`]]),et=r({name:`StartImage`,components:{ElUpload:T,ElButton:y,ElTooltip:E,InfoIcon:J,FontAwesomeIcon:G,ImagePreview:K},mixins:[V,W],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)},reachedLimit(){return(this.fileList?.length||0)>=1},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){U.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){U.error(this.$t(`kling.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),tt={class:`relative`},nt={class:`flex justify-between`},rt={class:`flex justify-start items-center`},it={class:`text-sm font-bold`};function at(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-tooltip`),x=g(`el-upload`);return d(),t(`div`,tt,[n(`div`,nt,[n(`div`,rt,[n(`span`,it,u(e.$t(`kling.name.startImage`)),1),o(p,{content:e.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.reachedLimit,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(b,{content:e.$t(`kling.message.uploadReferencesExceed`),disabled:!e.reachedLimit,placement:`top`},{default:_(()=>[n(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.reachedLimit},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var ot=L(et,[[`render`,at],[`__scopeId`,`data-v-756dc269`]]),st=r({name:`EndImage`,components:{ElUpload:T,ElButton:y,ElTooltip:E,ImagePreview:K,InfoIcon:J,FontAwesomeIcon:G},mixins:[V,W],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)},reachedLimit(){return(this.fileList?.length||0)>=1},klingConfig(){return this.$store.state?.kling?.config||{}},endImageSupported(){return Y(this.klingConfig.model,this.klingConfig.mode,this.klingConfig.duration).endImage},hasStartImage(){return!!this.klingConfig.start_image_url},uploadDisabled(){return this.reachedLimit||!this.endImageSupported||!this.hasStartImage},uploadTooltip(){return this.endImageSupported?this.hasStartImage?this.reachedLimit?this.$t(`kling.message.uploadReferencesExceed`):``:this.$t(`kling.message.endImageRequiresStart`):this.$t(`kling.message.endImageNotSupported`)},storeValue(){return this.klingConfig.end_image_url},value:{get(){return this.storeValue},set(){}}},watch:{storeValue(e){!e&&this.fileList.length>0&&(this.fileList=[])},hasStartImage(e){!e&&this.storeValue&&(this.fileList=[],this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:void 0}))}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onBeforeUpload(){return this.endImageSupported?this.hasStartImage?!0:(U.warning(this.$t(`kling.message.endImageRequiresStart`)),!1):(U.warning(this.$t(`kling.message.endImageNotSupported`)),!1)},onExceed(){U.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){U.error(this.$t(`kling.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ct={class:`relative`},lt={class:`flex justify-between`},ut={class:`flex justify-start items-center`},dt={class:`text-sm font-bold`};function ft(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-tooltip`),x=g(`el-upload`);return d(),t(`div`,ct,[n(`div`,lt,[n(`div`,ut,[n(`span`,dt,u(e.$t(`kling.name.endImage`)),1),o(p,{content:e.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"before-upload":e.onBeforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(b,{content:e.uploadTooltip,disabled:!e.uploadDisabled,placement:`top`},{default:_(()=>[n(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.uploadDisabled},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var pt=L(st,[[`render`,ft],[`__scopeId`,`data-v-c1b257e5`]]),mt=r({name:`CfgScaleSelector`,components:{ElSlider:j,InfoIcon:J,ElInputNumber:A},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug(`set cfg_scale`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||=0}}),ht={class:`flex justify-between`},gt={class:`flex justify-start items-center`},_t={class:`text-sm font-bold`},vt={class:`flex justify-end items-center`},yt={class:`w-full`};function bt(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-input-number`),p=g(`el-slider`);return d(),t(`div`,null,[n(`div`,ht,[n(`div`,gt,[n(`span`,_t,u(e.$t(`kling.name.cfgScale`)),1),o(l,{content:e.$t(`kling.description.cfgScale`)},null,8,[`content`])]),n(`div`,vt,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"controls-position":`right`},null,8,[`modelValue`])])]),n(`div`,yt,[o(p,{modelValue:e.value,"onUpdate:modelValue":r[1]||=t=>e.value=t,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var xt=L(mt,[[`render`,bt]]),St=r({name:`GenerateAudioSelector`,components:{ElSwitch:ne,InfoIcon:J},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},supported(){return!!(M.includes(this.selectedModel)||this.selectedModel===`kling-v2-6`&&this.selectedMode===`pro`)},tooltipContent(){return this.supported?this.$t(`kling.description.generateAudio`):this.$t(`kling.description.generateAudioUnsupported`)},value:{get(){return this.supported?this.$store.state.kling?.config?.generate_audio??!1:!1},set(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,generate_audio:e})}}},watch:{supported(e){!e&&this.$store.state.kling?.config?.generate_audio&&this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,generate_audio:!1})}}}),Ct={class:`relative`},wt={class:`flex justify-between items-center`},Tt={class:`flex justify-start items-center`},Et={class:`text-sm font-bold`};function Dt(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return d(),t(`div`,Ct,[n(`div`,wt,[n(`div`,Tt,[n(`span`,Et,u(e.$t(`kling.name.generateAudio`)),1),o(l,{content:e.tooltipContent},null,8,[`content`])]),o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`,disabled:!e.supported},null,8,[`modelValue`,`disabled`])])])}var Ot=L(St,[[`render`,Dt]]),kt=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],At=r({name:`CameraControlSelector`,components:{ElSelect:x,ElOption:S,ElSlider:j,ElInputNumber:A,InfoIcon:J},data(){return{configKeys:kt}},computed:{typeOptions(){return[{value:``,label:this.$t(`kling.name.cameraTypeNone`)},{value:`simple`,label:this.$t(`kling.name.cameraTypeSimple`)},{value:`down_back`,label:this.$t(`kling.name.cameraTypeDownBack`)},{value:`forward_up`,label:this.$t(`kling.name.cameraTypeForwardUp`)},{value:`left_turn_forward`,label:this.$t(`kling.name.cameraTypeLeftTurnForward`)},{value:`right_turn_forward`,label:this.$t(`kling.name.cameraTypeRightTurnForward`)}]},selectedMode(){return this.$store.state.kling?.config?.mode||``},selectedModel(){return this.$store.state.kling?.config?.model||``},selectedDuration(){return this.$store.state.kling?.config?.duration},motionControlSupported(){return Y(this.selectedModel,this.selectedMode,this.selectedDuration).motionControl},hasStartImage(){return!!this.$store.state.kling?.config?.start_image_url},disabled(){return!this.motionControlSupported||this.hasStartImage},tooltipContent(){return this.motionControlSupported?this.hasStartImage?this.$t(`kling.description.cameraControlDisabledImage2Video`):this.$t(`kling.description.cameraControl`):this.$t(`kling.description.cameraControlNotSupported`)},selectedType(){return this.$store.state.kling?.config?.camera_control?.type},selectedTypeRaw:{get(){return this.selectedType??``},set(e){let t=this.$store.state.kling?.config||{};if(!e){let e={...t};delete e.camera_control,this.$store.commit(`kling/setConfig`,e);return}let n=e;this.$store.commit(`kling/setConfig`,{...t,camera_control:{type:n,config:n===`simple`?t.camera_control?.config||{}:void 0}})}},configValues(){return this.$store.state.kling?.config?.camera_control?.config||{}}},watch:{disabled(e){e&&this.selectedType!==void 0&&(this.selectedTypeRaw=``)}},methods:{writeConfig(e,t){let n=this.$store.state.kling?.config||{},r=n.camera_control||{type:`simple`},i={...r.config||{}};t==null?delete i[e]:i[e]=t,this.$store.commit(`kling/setConfig`,{...n,camera_control:{...r,type:`simple`,config:i}})},onSliderChange(e,t){this.writeConfig(e,t)},onNumberChange(e,t){this.writeConfig(e,t)}}}),jt={class:`field`},Mt={class:`header`},Nt={class:`text-sm font-bold`},Pt={key:0,class:`config-grid`},Ft={class:`cfg-row-head`},It={class:`cfg-name`};function Lt(r,i,c,l,f,p){let m=g(`info-icon`),v=g(`el-option`),y=g(`el-select`),b=g(`el-input-number`),x=g(`el-slider`);return d(),t(`div`,jt,[n(`div`,Mt,[n(`span`,Nt,u(r.$t(`kling.name.cameraControl`)),1),o(m,{content:r.tooltipContent},null,8,[`content`])]),o(y,{modelValue:r.selectedTypeRaw,"onUpdate:modelValue":i[0]||=e=>r.selectedTypeRaw=e,class:`value`,placeholder:r.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:r.disabled},{default:_(()=>[(d(!0),t(s,null,e(r.typeOptions,e=>(d(),a(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),r.selectedType===`simple`&&!r.disabled?(d(),t(`div`,Pt,[(d(!0),t(s,null,e(r.configKeys,e=>(d(),t(`div`,{key:e,class:`cfg-row`},[n(`div`,Ft,[n(`span`,It,u(r.$t(`kling.name.cc_${e}`)),1),o(b,{modelValue:r.configValues[e],"onUpdate:modelValue":t=>r.configValues[e]=t,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:t=>r.onNumberChange(e,t)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),o(x,{"model-value":r.configValues[e]??0,min:-1,max:1,step:.1,onInput:t=>r.onSliderChange(e,t)},null,8,[`model-value`,`onInput`])]))),128))])):h(``,!0)])}var Rt=L(At,[[`render`,Lt],[`__scopeId`,`data-v-cd896060`]]),zt=[{groupKey:`cameraMovements`,chipKeys:[`rotateAround`,`stationary`,`handheld`,`zoomOut`,`zoomIn`,`follow`,`panRight`,`tiltUp`,`tiltDown`,`orbit`]},{groupKey:`cameraSpeed`,chipKeys:[`speedSlow`,`speedMedium`,`speedFast`]},{groupKey:`shotType`,chipKeys:[`shotClose`,`shotMedium`,`shotLong`,`shotLowAngle`,`shotHighAngle`,`shotShallowDof`,`shotFront`,`shotProfile`,`shotCloseUp`,`shotDrone`]},{groupKey:`light`,chipKeys:[`lightSunlight`,`lightSoft`,`lightNeon`,`lightWarm`,`lightNature`,`lightCandle`,`lightCityNight`]},{groupKey:`frame`,chipKeys:[`frameRichDetails`,`frameSimpleBg`]},{groupKey:`atmosphere`,chipKeys:[`atmosphereMysterious`,`atmospherePeaceful`,`atmosphereHeartwarming`,`atmosphereVivid`,`atmosphereColorful`]}],Q=`, `;function Bt(e,t){let n=(e||``).trim();return n?n.includes(t)?n:`${n}${Q}${t}`:t}function $(e,t){if(!e||!t)return e||``;let n=[`${t}${Q}`,`${Q}${t}`,t],r=e;for(let e of n)if(r.includes(e)){r=r.replace(e,``);break}return r.replace(/(?:,\s*)+$/,``).replace(/^(?:,\s*)+/,``)}var Vt=r({name:`InspirationPills`,components:{FontAwesomeIcon:G},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return zt.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selected(){let e=this.prompt;if(!e)return[];let t=[];for(let n of this.allChipTexts){let r=e.indexOf(n);r!==-1&&t.push({text:n,idx:r})}return t.sort((e,t)=>e.idx-t.idx).map(e=>e.text)}},methods:{onRemove(e){let t=$(this.prompt,e);this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:t})}}}),Ht={key:0,class:`pills`,role:`list`},Ut={class:`pill-text`},Wt=[`aria-label`,`onClick`];function Gt(r,i,a,c,l,p){let m=g(`font-awesome-icon`);return r.selected.length>0?(d(),t(`div`,Ht,[(d(!0),t(s,null,e(r.selected,e=>(d(),t(`div`,{key:e,class:`pill`,role:`listitem`},[n(`span`,Ut,u(e),1),n(`button`,{type:`button`,class:`pill-remove`,"aria-label":r.$t(`kling.inspiration.removeChip`),onClick:f(t=>r.onRemove(e),[`stop`])},[o(m,{icon:`fa-solid fa-xmark`})],8,Wt)]))),128))])):h(``,!0)}var Kt=r({name:`PromptInput`,components:{ElButton:y,FontAwesomeIcon:G,PromptTextarea:ve,InspirationPills:L(Vt,[[`render`,Gt],[`__scopeId`,`data-v-5fc4fa65`]])},emits:[`open-inspiration`],computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||=``}});function qt(e,t,n,r,s,c){let l=g(`font-awesome-icon`),f=g(`el-button`),p=g(`inspiration-pills`),m=g(`prompt-textarea`);return d(),a(m,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`kling.name.prompt`),info:e.$t(`kling.description.prompt`),placeholder:e.$t(`kling.placeholder.prompt`)},{actions:_(()=>[o(f,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:_(()=>[o(l,{icon:`fa-regular fa-lightbulb`,class:`mr-1`}),i(` `+u(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:_(()=>[o(p)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var Jt=L(Kt,[[`render`,qt],[`__scopeId`,`data-v-c01fc1a6`]]),Yt=r({name:`NegativePromptInput`,components:{ElInput:F,InfoIcon:J},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug(`set prompt`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||=``}}),Xt={class:`field`},Zt={class:`box`},Qt={class:`title font-bold`};function $t(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-input`);return d(),t(`div`,Xt,[n(`div`,Zt,[n(`h2`,Qt,u(e.$t(`kling.name.negativePrompt`)),1),o(l,{content:e.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),o(f,{modelValue:e.prompt,"onUpdate:modelValue":r[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var en=L(Yt,[[`render`,$t],[`__scopeId`,`data-v-de98cf01`]]),tn=r({name:`InspirationDrawer`,components:{ElDrawer:k,ElButton:y,FontAwesomeIcon:G},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:zt,Close:b}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit(`update:modelValue`,e)}},drawerSize(){return window.innerWidth<768?`100%`:`380px`},prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return this.groups.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selectedCount(){return this.allChipTexts.filter(e=>this.isSelected(e)).length}},methods:{chipText(e){return this.$t(`kling.inspiration.chip.${e}`)},isSelected(e){return e?this.prompt.includes(e):!1},setPrompt(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})},onToggle(e){e&&(this.isSelected(e)?this.setPrompt($(this.prompt,e)):this.setPrompt(Bt(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=$(e,t);this.setPrompt(e)}}}),nn={class:`drawer-content`},rn={class:`drawer-header`},an={class:`title-row`},on={class:`title`},sn={class:`hint`},cn={key:0,class:`selected-bar`},ln={class:`selected-text`},un={class:`groups`},dn={class:`group-title`},fn={class:`chip-grid`},pn=[`onClick`];function mn(r,c,f,p,m,v){let y=g(`font-awesome-icon`),b=g(`el-button`),x=g(`el-drawer`);return d(),a(x,{modelValue:r.visible,"onUpdate:modelValue":c[1]||=e=>r.visible=e,direction:`rtl`,"with-header":!1,size:r.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:_(()=>[n(`div`,nn,[n(`div`,rn,[n(`div`,an,[o(y,{icon:`fa-regular fa-lightbulb`,class:`mr-2`}),n(`span`,on,u(r.$t(`kling.inspiration.title`)),1)]),o(b,{text:``,icon:r.Close,class:`close-btn`,onClick:c[0]||=e=>r.visible=!1},null,8,[`icon`])]),n(`div`,sn,u(r.$t(`kling.inspiration.hint`)),1),r.selectedCount>0?(d(),t(`div`,cn,[n(`span`,ln,u(r.$t(`kling.inspiration.selectedSummary`,{count:r.selectedCount})),1),o(b,{text:``,size:`small`,class:`clear-btn`,onClick:r.onClearSelected},{default:_(()=>[i(u(r.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):h(``,!0),n(`div`,un,[(d(!0),t(s,null,e(r.groups,i=>(d(),t(`div`,{key:i.groupKey,class:`group`},[n(`div`,dn,u(r.$t(`kling.inspiration.group.${i.groupKey}`)),1),n(`div`,fn,[(d(!0),t(s,null,e(i.chipKeys,e=>(d(),t(`button`,{key:e,type:`button`,class:l({chip:!0,active:r.isSelected(r.chipText(e))}),onClick:t=>r.onToggle(r.chipText(e))},u(r.chipText(e)),11,pn))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var hn=L(tn,[[`render`,mn],[`__scopeId`,`data-v-7d457a69`]]),gn={"kling-v3":`v3`,"kling-v3-omni":`v3-Omni`,"kling-v2-6":`v2.6`,"kling-v2-5-turbo":`v2.5-Turbo`,"kling-v2-1-master":`v2.1-Master`,"kling-v2-master":`v2-Master`,"kling-v1-6":`v1.6`,"kling-v1":`v1`,"kling-video-o1":`Video-o1`},_n={std:`720p`,pro:`1080p`,"4k":`4K`},vn=r({name:`SummaryChip`,components:{FontAwesomeIcon:G},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return gn[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return _n[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),yn={class:`summary-chip`},bn=[`title`],xn=[`title`],Sn=[`title`],Cn=[`title`],wn=[`title`];function Tn(e,r,i,a,s,c){let l=g(`font-awesome-icon`);return d(),t(`div`,yn,[n(`span`,{class:`part`,title:e.$t(`kling.name.model`)},u(e.modelLabel),9,bn),r[0]||=n(`span`,{class:`dot`},`·`,-1),n(`span`,{class:`part`,title:e.$t(`kling.name.duration`)},u(e.durationLabel),9,xn),r[1]||=n(`span`,{class:`dot`},`·`,-1),n(`span`,{class:`part`,title:e.$t(`kling.name.ratio`)},u(e.aspectRatio||`16:9`),9,Sn),r[2]||=n(`span`,{class:`dot`},`·`,-1),n(`span`,{class:`part`,title:e.$t(`kling.name.mode`)},u(e.modeLabel),9,Cn),e.generateAudio?(d(),t(`span`,{key:0,class:`audio`,title:e.$t(`kling.name.generateAudio`)},[o(l,{icon:`fa-solid fa-headphones`})],8,wn)):h(``,!0)])}var En=r({name:`ConfigPanel`,components:{ElButton:y,Consumption:q,FontAwesomeIcon:G,PromptInput:Jt,NegativePromptInput:en,ModelSelector:Ae,ModeSelector:Le,DurationSelector:Ke,RatioSelector:$e,StartImage:ot,CfgScaleSelector:xt,GenerateAudioSelector:Ot,CameraControlSelector:Rt,InspirationDrawer:hn,SummaryChip:L(vn,[[`render`,Tn],[`__scopeId`,`data-v-418a6733`]]),EndImage:pt},emits:[`generate`],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},consumption(){return B(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Dn={class:`flex flex-col h-full`},On={class:`flex-1 overflow-y-auto p-5`},kn={class:`flex flex-col items-center justify-center px-5 pb-5`};function An(e,r,s,c,l,f){let p=g(`prompt-input`),m=g(`model-selector`),h=g(`ratio-selector`),v=g(`start-image`),y=g(`end-image`),b=g(`duration-selector`),x=g(`mode-selector`),S=g(`generate-audio-selector`),C=g(`camera-control-selector`),w=g(`cfg-scale-selector`),T=g(`negative-prompt-input`),E=g(`summary-chip`),ee=g(`consumption`),D=g(`font-awesome-icon`),O=g(`el-button`),te=g(`inspiration-drawer`);return d(),t(`div`,Dn,[n(`div`,On,[o(p,{class:`mb-4`,onOpenInspiration:r[0]||=t=>e.inspirationOpen=!0}),o(m,{class:`mb-4`}),o(h,{class:`mb-4`}),o(v,{class:`mb-2`}),o(y,{class:`mb-2`}),o(b,{class:`mb-4`}),o(x,{class:`mb-4`}),o(S,{class:`mb-4`}),o(C,{class:`mb-4`}),o(w,{class:`mb-4`}),o(T,{class:`mb-4`})]),n(`div`,kn,[o(E),o(ee,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),e.config?.video_url!==void 0||e.config?.custom?(d(),a(O,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:_(()=>[o(D,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`kling.button.extend`)),1)]),_:1},8,[`onClick`])):(d(),a(O,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:_(()=>[o(D,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`kling.button.generate`)),1)]),_:1},8,[`onClick`]))]),o(te,{modelValue:e.inspirationOpen,"onUpdate:modelValue":r[1]||=t=>e.inspirationOpen=t},null,8,[`modelValue`])])}var jn=L(En,[[`render`,An]]),Mn=r({name:`MotionImage`,components:{ElUpload:T,ElButton:y,InfoIcon:J,FontAwesomeIcon:G,ImagePreview:K},mixins:[V,W],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)}},mounted(){this.onSetImageUrl()},methods:{onExceed(){U.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){U.error(this.$t(`kling.message.uploadReferencesError`))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,image_url:void 0})},onSetImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,image_url:e})},async onSuccess(){this.onSetImageUrl()}}}),Nn={class:`relative`},Pn={class:`flex justify-between`},Fn={class:`flex justify-start items-center`},In={class:`text-sm font-bold`};function Ln(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return d(),t(`div`,Nn,[n(`div`,Pn,[n(`div`,Fn,[n(`span`,In,u(e.$t(`kling.name.motionImage`)),1),o(p,{content:e.$t(`kling.description.motionImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Rn=L(Mn,[[`render`,Ln],[`__scopeId`,`data-v-e52eaf2f`]]),zn=r({name:`MotionVideo`,components:{ElUpload:T,ElButton:y,InfoIcon:J,FilePreview:ue,FontAwesomeIcon:G},mixins:[W],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)}},mounted(){this.onSetVideoUrl()},methods:{onExceed(){U.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){U.error(this.$t(`kling.message.uploadVideoError`))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,video_url:void 0})},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<100;return t?n?!0:(U.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(U.error(this.$t(`kling.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,video_url:e})},async onSuccess(){this.onSetVideoUrl()}}}),Bn={class:`relative`},Vn={class:`flex justify-between`},Hn={class:`flex justify-start items-center`},Un={class:`text-sm font-bold`};function Wn(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`file-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return d(),t(`div`,Bn,[n(`div`,Vn,[n(`div`,Hn,[n(`span`,Un,u(e.$t(`kling.name.motionVideo`)),1),o(p,{content:e.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),o(b,{"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:_(({file:t})=>[t.percentage===void 0?h(``,!0):(d(),a(m,{key:0,url:t.url||t.response?.file_url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Gn=L(zn,[[`render`,Wn],[`__scopeId`,`data-v-7019a8d2`]]),Kn=r({name:`MotionPromptInput`,components:{ElInput:F,InfoIcon:J},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||``},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),qn={class:`field`},Jn={class:`box`},Yn={class:`title font-bold`};function Xn(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-input`);return d(),t(`div`,qn,[n(`div`,Jn,[n(`h2`,Yn,u(e.$t(`kling.name.motionPrompt`)),1),o(l,{content:e.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),o(f,{modelValue:e.prompt,"onUpdate:modelValue":r[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Zn=L(Kn,[[`render`,Xn],[`__scopeId`,`data-v-ca9fdbe5`]]),Qn=`video`,$n=r({name:`CharacterOrientationSelector`,components:{ElRadioGroup:te,ElRadioButton:O,InfoIcon:J},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||Qn},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,character_orientation:e})}}},mounted(){this.$store.state.kling?.motionConfig?.character_orientation||(this.value=Qn)}}),er={class:`field`},tr={class:`header`},nr={class:`text-sm font-bold`};function rr(e,r,a,s,c,l){let f=g(`info-icon`),p=g(`el-radio-button`),m=g(`el-radio-group`);return d(),t(`div`,er,[n(`div`,tr,[n(`span`,nr,u(e.$t(`kling.name.characterOrientation`)),1),o(f,{content:e.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),o(m,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,size:`small`,class:`value`},{default:_(()=>[o(p,{label:`image`},{default:_(()=>[i(u(e.$t(`kling.name.orientationImage`)),1)]),_:1}),o(p,{label:`video`},{default:_(()=>[i(u(e.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var ir=L($n,[[`render`,rr],[`__scopeId`,`data-v-7a91195b`]]),ar=`std`,or=r({name:`MotionModeSelector`,components:{ElSelect:x,ElOption:S,InfoIcon:J},computed:{options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`)},{value:`pro`,label:this.$t(`kling.name.modePro`)}]},value:{get(){return this.$store.state.kling?.motionConfig?.mode||ar},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=ar)}}),sr={class:`field`},cr={class:`header`},lr={class:`title font-bold`};function ur(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,sr,[n(`div`,cr,[n(`h2`,lr,u(r.$t(`kling.name.mode`)),1),o(m,{content:r.$t(`kling.description.motionMode`)},null,8,[`content`])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`kling.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var dr=L(or,[[`render`,ur],[`__scopeId`,`data-v-1295688c`]]),fr=r({name:`KeepOriginalSoundSelector`,components:{ElSwitch:ne,InfoIcon:J},computed:{value:{get(){return(this.$store.state.kling?.motionConfig?.keep_original_sound??`yes`)===`yes`},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,keep_original_sound:e?`yes`:`no`})}}}}),pr={class:`relative`},mr={class:`flex justify-between items-center`},hr={class:`flex justify-start items-center`},gr={class:`text-sm font-bold`};function _r(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return d(),t(`div`,pr,[n(`div`,mr,[n(`div`,hr,[n(`span`,gr,u(e.$t(`kling.name.keepOriginalSound`)),1),o(l,{content:e.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t},null,8,[`modelValue`])])])}var vr=r({name:`MotionPanel`,components:{ElButton:y,FontAwesomeIcon:G,Consumption:q,MotionImage:Rn,MotionVideo:Gn,MotionPromptInput:Zn,CharacterOrientationSelector:ir,MotionModeSelector:dr,KeepOriginalSoundSelector:L(fr,[[`render`,_r]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return B(this.motionConfig,this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){let e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit(`generate`)}}}),yr={class:`flex flex-col h-full`},br={class:`flex-1 overflow-y-auto p-5`},xr={class:`flex flex-col items-center justify-center px-5 pb-5`};function Sr(e,r,a,s,c,l){let f=g(`motion-image`),p=g(`motion-video`),m=g(`motion-prompt-input`),h=g(`character-orientation-selector`),v=g(`motion-mode-selector`),y=g(`keep-original-sound-selector`),b=g(`consumption`),x=g(`font-awesome-icon`),S=g(`el-button`);return d(),t(`div`,yr,[n(`div`,br,[o(f,{class:`mb-3`}),o(p,{class:`mb-3`}),o(m,{class:`mb-4`}),o(h,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`})]),n(`div`,xr,[o(b,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(S,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canGenerate,onClick:e.onGenerate},{default:_(()=>[o(x,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Cr=L(vr,[[`render`,Sr]]),wr=r({name:`KlingTabSwitcher`,components:{ElTabs:C,ElTabPane:w,ElTag:ce},props:{modelValue:{type:String,default:`videos`}},emits:[`update:modelValue`],computed:{tabs(){return[{value:`videos`,label:this.$t(`kling.tab.videoGeneration`)},{value:`motion`,label:this.$t(`kling.tab.motionControl`)},{value:`talking-photo`,label:this.$t(`kling.tab.talkingPhoto`)}]}},methods:{onUpdate(e){this.$emit(`update:modelValue`,e)}}}),Tr=[`title`],Er={class:`text`};function Dr(r,o,c,l,f,p){let m=g(`el-tag`),v=g(`el-tab-pane`),y=g(`el-tabs`);return d(),a(y,{"model-value":r.modelValue,class:`kling-tabs`,stretch:``,"onUpdate:modelValue":r.onUpdate},{default:_(()=>[(d(!0),t(s,null,e(r.tabs,e=>(d(),a(v,{key:e.value,name:e.value,disabled:e.disabled},{label:_(()=>[n(`span`,{class:`tab-label`,title:e.disabled?e.disabledReason:void 0},[n(`span`,Er,u(e.label),1),e.badge?(d(),a(m,{key:0,size:`small`,type:`warning`,class:`badge`},{default:_(()=>[i(u(e.badge),1)]),_:2},1024)):h(``,!0)],8,Tr)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Or=L(wr,[[`render`,Dr],[`__scopeId`,`data-v-fda33e4c`]]),kr={"kling-v2-6":`v2.6`,"kling-v2-5-turbo":`v2.5-Turbo`,"kling-v2-1-master":`v2.1-Master`,"kling-v2-master":`v2-Master`,"kling-v1-6":`v1.6`,"kling-v1":`v1`},Ar=r({name:`TalkingPhotoModelSelector`,components:{ElSelect:x,ElOption:S},data(){return{options:ae.map(e=>({value:e,label:kr[e]||e}))}},computed:{value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.model||`kling-v2-1-master`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,model:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.model||(this.value=ie)}}),jr={class:`field`},Mr={class:`title font-bold`};function Nr(r,i,c,l,f,p){let m=g(`el-option`),h=g(`el-select`);return d(),t(`div`,jr,[n(`h2`,Mr,u(r.$t(`kling.name.model`)),1),o(h,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`kling.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Pr=L(Ar,[[`render`,Nr],[`__scopeId`,`data-v-cbc83d11`]]),Fr=r({name:`TalkingPhotoModeSelector`,components:{ElSelect:x,ElOption:S},computed:{options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`)},{value:`pro`,label:this.$t(`kling.name.modePro`)}]},value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.mode||`pro`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,mode:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.mode||(this.value=`pro`)}}),Ir={class:`field`},Lr={class:`title font-bold`};function Rr(r,i,c,l,f,p){let m=g(`el-option`),h=g(`el-select`);return d(),t(`div`,Ir,[n(`h2`,Lr,u(r.$t(`kling.name.mode`)),1),o(h,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`kling.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var zr=r({name:`TalkingPhotoPanel`,components:{ElUpload:T,ElButton:y,ElInput:F,FontAwesomeIcon:G,Consumption:q,InfoIcon:J,ImagePreview:K,ModelSelector:Pr,ModeSelector:L(Fr,[[`render`,Rr],[`__scopeId`,`data-v-92525a1d`]])},mixins:[W],emits:[`generate`],data(){return{imageFiles:[],audioFiles:[],uploadUrl:I()+`/api/v1/files/`}},computed:{config(){return this.$store.state.kling?.talkingPhotoConfig||{}},audioUrl(){return this.config.audio_url},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},service(){return this.$store.state.kling?.service},consumption(){return B({...this.config,action:`talking-photo`},this.service?.cost)},canGenerate(){return!!(this.config.image_url&&this.config.audio_url)}},methods:{commit(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.config,...e})},onPromptChange(e){this.commit({prompt:e})},onImageExceed(){U.warning(this.$t(`kling.message.uploadReferencesExceed`))},onImageError(){U.error(this.$t(`kling.message.uploadReferencesError`))},onImageSuccess(e){this.commit({image_url:e?.file_url})},onImageRemove(e){this.imageFiles.splice(this.imageFiles.indexOf(e),1),this.commit({image_url:void 0})},onAudioExceed(){U.warning(this.$t(`kling.message.uploadAudioExceed`))},onAudioError(){U.error(this.$t(`kling.message.uploadAudioError`))},onAudioSuccess(e){this.commit({audio_url:e?.file_url})},onAudioRemove(){this.commit({audio_url:void 0})},onGenerate(){this.$emit(`generate`)}}}),Br={class:`flex flex-col h-full`},Vr={class:`flex-1 overflow-y-auto p-5`},Hr={class:`relative mb-4`},Ur={class:`flex justify-start items-center`},Wr={class:`text-sm font-bold`},Gr={class:`relative mb-4`},Kr={class:`flex justify-start items-center`},qr={class:`text-sm font-bold`},Jr=[`src`],Yr={class:`mb-4`},Xr={class:`flex justify-start items-center`},Zr={class:`text-sm font-bold`},Qr={class:`flex flex-col items-center justify-center px-5 pb-5`};function $r(e,r,s,c,l,f){let p=g(`model-selector`),m=g(`mode-selector`),v=g(`info-icon`),y=g(`image-preview`),b=g(`font-awesome-icon`),x=g(`el-button`),S=g(`el-upload`),C=g(`el-input`),w=g(`consumption`);return d(),t(`div`,Br,[n(`div`,Vr,[o(p,{class:`mb-4`}),o(m,{class:`mb-4`}),n(`div`,Hr,[n(`div`,Ur,[n(`span`,Wr,u(e.$t(`kling.name.talkingPhotoImage`)),1),o(v,{content:e.$t(`kling.description.talkingPhotoImage`)},null,8,[`content`])]),o(S,{ref:`imageUploader`,"file-list":e.imageFiles,"onUpdate:fileList":r[0]||=t=>e.imageFiles=t,name:`file`,accept:`.png,.jpg,.jpeg,.webp,.bmp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,headers:e.headers,"on-exceed":e.onImageExceed,"on-error":e.onImageError,"on-success":e.onImageSuccess},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(y,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.onImageRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(x,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(b,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`])]),n(`div`,Gr,[n(`div`,Kr,[n(`span`,qr,u(e.$t(`kling.name.talkingPhotoAudio`)),1),o(v,{content:e.$t(`kling.description.talkingPhotoAudio`)},null,8,[`content`])]),o(S,{ref:`audioUploader`,"file-list":e.audioFiles,"onUpdate:fileList":r[1]||=t=>e.audioFiles=t,name:`file`,accept:`.mp3,.wav,.m4a,.aac`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,headers:e.headers,"on-exceed":e.onAudioExceed,"on-error":e.onAudioError,"on-success":e.onAudioSuccess,"on-remove":e.onAudioRemove},{default:_(()=>[o(x,{round:``,type:`primary`,size:`small`,class:`btn`},{default:_(()=>[o(b,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadAudio`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`]),e.audioUrl?(d(),t(`audio`,{key:0,src:e.audioUrl,controls:``,class:`w-full mt-2`},null,8,Jr)):h(``,!0)]),n(`div`,Yr,[n(`div`,Xr,[n(`span`,Zr,u(e.$t(`kling.name.talkingPhotoPrompt`)),1),o(v,{content:e.$t(`kling.description.talkingPhotoPrompt`)},null,8,[`content`])]),o(C,{"model-value":e.config.prompt,type:`textarea`,rows:2,placeholder:e.$t(`kling.placeholder.talkingPhotoPrompt`),class:`mt-1`,"onUpdate:modelValue":e.onPromptChange},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])])]),n(`div`,Qr,[o(w,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(x,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canGenerate,onClick:e.onGenerate},{default:_(()=>[o(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`kling.button.generateTalkingPhoto`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var ei=L(zr,[[`render`,$r],[`__scopeId`,`data-v-27261e35`]]),ti=r({name:`TaskPreview`,components:{ElImage:ee,CopyToClipboard:le,FontAwesomeIcon:G,ElAlert:D,VideoPlayer:me,ElTooltip:E,ElButton:y,ImagePreview:K,ApiCodeButton:he},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config},referenceImages(){let e=[],t=this.modelValue?.request?.start_image_url,n=this.modelValue?.request?.end_image_url;return t&&e.push({url:t,name:`start-image`}),n&&e.push({url:n,name:`end-image`}),e}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),ni={class:`preview`},ri={class:`left`},ii={class:`main`},ai={class:`bot`},oi={class:`datetime`},si={class:`info`},ci={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},li={key:1,class:`prompt mt-2`},ui={key:0},di={key:1},fi={key:0,class:l({content:!0,failed:!0})},pi={key:0,class:`mb-4`},mi={key:1,class:l({operations:!0,"mt-2":!0})},hi={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gi={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_i={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},vi={key:1,class:l({content:!0})},yi={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bi={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xi={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Si={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ci={key:2,class:l({content:!0})},wi={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ti={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Ei(r,c,l,f,p,m){let v=g(`el-image`),y=g(`image-preview`),b=g(`video-player`),x=g(`el-button`),S=g(`el-tooltip`),C=g(`api-code-button`),w=g(`font-awesome-icon`),T=g(`copy-to-clipboard`),E=g(`el-alert`);return d(),t(`div`,ni,[n(`div`,ri,[o(v,{src:`https://cdn.acedata.cloud/qpbbbb.jpg`,class:`avatar`})]),n(`div`,ii,[n(`div`,ai,[i(u(r.$t(`kling.name.klingBot`))+` `,1),n(`span`,oi,u(r.$dayjs.format(``+new Date(parseFloat((r.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,si,[r.referenceImages.length>0?(d(),t(`div`,ci,[(d(!0),t(s,null,e(r.referenceImages,(e,t)=>(d(),a(y,{key:t,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128))])):h(``,!0),r.modelValue?.request?.prompt?(d(),t(`p`,li,[i(u(r.modelValue?.request?.prompt)+` `,1),r.modelValue?.response?h(``,!0):(d(),t(`span`,ui,` - (`+u(r.$t(`kling.status.pending`))+`) `,1)),r.modelValue?.response?.state===`submitted`||r.modelValue?.response?.state===`processing`||r.modelValue?.response?.state===`pending`||r.modelValue?.response?.state===`completed`?(d(),t(`span`,di,` - (`+u(r.$t(`kling.status.processing`))+`) `,1)):h(``,!0)])):h(``,!0)]),r.modelValue?.response?.success===!0?(d(),t(`div`,fi,[r.modelValue?.response.video_url?(d(),t(`div`,pi,[o(b,{src:r.modelValue?.response.video_url},null,8,[`src`])])):h(``,!0),r.modelValue?.response.success?(d(),t(`div`,mi,[o(S,{class:`box-item`,effect:`dark`,content:r.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:_(()=>[r.modelValue?.response.video_url?(d(),a(x,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=e=>r.onDownload(e,r.modelValue?.response.video_url)},{default:_(()=>[i(u(r.$t(`kling.button.download`)),1)]),_:1})):h(``,!0)]),_:1},8,[`content`]),o(C,{path:`/kling/videos`,body:r.modelValue?.request},null,8,[`body`])])):h(``,!0),o(E,{closable:!1,class:`mt-2 success`},{default:_(()=>[n(`p`,hi,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.model`))+`: `+u(r.modelValue?.request?.model),1)]),n(`p`,gi,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(T,{content:r.modelValue?.id},null,8,[`content`])]),r.modelValue?.elapsed?(d(),t(`p`,_i,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0)]),_:1})])):h(``,!0),r.modelValue?.response?.success===!1?(d(),t(`div`,vi,[o(E,{closable:!1,class:`failure`},{template:_(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.failure`)),1)]),default:_(()=>[n(`p`,yi,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(T,{content:r.modelValue?.id},null,8,[`content`])]),n(`p`,bi,[o(w,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.failureReason`))+`: `+u(r.modelValue?.response?.error?.message)+` `,1),o(T,{content:r.modelValue?.response?.error?.message},null,8,[`content`])]),r.modelValue?.elapsed?(d(),t(`p`,xi,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0),r.modelValue?.response?.trace_id?(d(),t(`p`,Si,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(T,{content:r.modelValue?.response?.trace_id},null,8,[`content`])])):h(``,!0)]),_:1})])):h(``,!0),r.modelValue?.response?.success===void 0?(d(),t(`div`,Ci,[o(E,{closable:!1,class:`info`},{template:_(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.failure`)),1)]),default:_(()=>[n(`p`,wi,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(T,{content:r.modelValue?.id},null,8,[`content`])]),r.modelValue?.response?.trace_id?(d(),t(`p`,Ti,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(T,{content:r.modelValue?.response?.trace_id},null,8,[`content`])])):h(``,!0)]),_:1})])):h(``,!0)])])}var Di=r({name:`RecentPanel`,components:{TaskPreview:L(ti,[[`render`,Ei],[`__scopeId`,`data-v-c36bfd7f`]]),NoTasks:_e,BotPlaceholder:ge,ScrollList:fe},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Oi={key:0},ki={key:2,class:`w-full h-full flex items-center justify-center`};function Ai(n,r,i,c,l,u){let f=g(`bot-placeholder`),p=g(`task-preview`),m=g(`scroll-list`),v=g(`no-tasks`);return d(),t(s,null,[n.tasks?.items===void 0?(d(),t(`div`,Oi,[o(f)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(d(),a(m,{key:1,ref:`scrollList`,class:`h-full w-full overflow-y-auto tasks`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:_(()=>[(d(!0),t(s,null,e(n.tasks?.items,e=>(d(),a(p,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):h(``,!0),n.tasks?.items?.length===0?(d(),t(`div`,ki,[o(v)])):h(``,!0)],64)}var ji=r({name:`KlingIndex`,components:{ConfigPanel:jn,MotionPanel:Cr,TalkingPhotoPanel:ei,TabSwitcher:Or,Layout:we,RecentPanel:L(Di,[[`render`,Ai]])},mixins:[oe],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===se.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===se.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},talkingPhotoConfig(){return this.$store.state.kling.talkingPhotoConfig},taskType(){return this.$store.state.kling.taskType||`videos`},tasks(){return this.$store.state.kling.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 pe({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`kling/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`kling/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(`kling/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!z(this.uploadTracker,e=>this.$t(e),e=>U.warning(e)))return;let{camera_control:e,...t}=this.config||{},n={...t,async:!0};if(!n.video_id&&!t.video_url&&!n.start_image_url&&n.end_image_url){U.warning(this.$t(`kling.message.endImageRequiresStart`));return}if(n.action||(n.video_id||t.video_url?n.action=`extend`:n.start_image_url?n.action=`image2video`:n.action=`text2video`),n.action===`text2video`&&n.end_image_url&&delete n.end_image_url,e?.type&&(n.camera_control={type:e.type,...e.type===`simple`&&e.config?{config:Object.fromEntries(Object.entries(e.config).filter(([,e])=>e!=null))}:{}}),!H())return;let r=this.credential?.token;if(!r){console.error(`no token specified`);return}U.info(this.$t(`kling.message.startingTask`)),P(`kling`,N.generate(n,{token:r})).then(()=>{U.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`kling.message.usedUp`)):U.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},async onTabChange(e){e!==this.taskType&&(await this.$store.dispatch(`kling/setTaskType`,e),await this.onGetTasks(),await this.onScrollDown())},async onGenerateMotion(){if(!z(this.uploadTracker,e=>this.$t(e),e=>U.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){U.warning(this.$t(`kling.message.motionMissingInputs`));return}let t={image_url:e.image_url,video_url:e.video_url,character_orientation:e.character_orientation||`video`,mode:e.mode||`std`,keep_original_sound:e.keep_original_sound??`yes`,...e.prompt?{prompt:e.prompt}:{},async:!0};if(!H())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}U.info(this.$t(`kling.message.startingTask`)),P(`kling`,N.motion(t,{token:n})).then(()=>{U.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`kling.message.usedUp`)):U.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},async onGenerateTalkingPhoto(){if(!z(this.uploadTracker,e=>this.$t(e),e=>U.warning(e)))return;let e=this.talkingPhotoConfig||{};if(!e.image_url||!e.audio_url){U.warning(this.$t(`kling.message.talkingPhotoMissingInputs`));return}let t={image_url:e.image_url,audio_url:e.audio_url,model:e.model||`kling-v2-1-master`,mode:e.mode||`pro`,...e.prompt?{prompt:e.prompt}:{},...e.duration?{duration:e.duration}:{},async:!0};if(!H())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}U.info(this.$t(`kling.message.startingTask`)),P(`kling`,N.talkingPhoto(t,{token:n})).then(()=>{U.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`kling.message.usedUp`)):U.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),Mi={class:`flex flex-col h-full`},Ni={class:`flex-1 min-h-0`};function Pi(e,t,r,i,s,c){let l=g(`tab-switcher`),u=g(`config-panel`),f=g(`motion-panel`),p=g(`talking-photo-panel`),m=g(`recent-panel`),v=g(`layout`);return d(),a(v,null,{config:_(()=>[n(`div`,Mi,[o(l,{"model-value":e.taskType,"onUpdate:modelValue":e.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),n(`div`,Ni,[e.taskType===`videos`?(d(),a(u,{key:0,onGenerate:e.onGenerate},null,8,[`onGenerate`])):e.taskType===`motion`?(d(),a(f,{key:1,onGenerate:e.onGenerateMotion},null,8,[`onGenerate`])):e.taskType===`talking-photo`?(d(),a(p,{key:2,onGenerate:e.onGenerateTalkingPhoto},null,8,[`onGenerate`])):h(``,!0)])])]),result:_(()=>[o(m,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Fi=L(ji,[[`render`,Pi]]);export{Fi as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Ut as c,Vt as l,Wt as u,Z as d,b as f,dt as p,et as m,k as h,tt as g,ut as _,v}from"./vendor-chart-BJCvKk8-.js";import{t as y}from"./button-BydTr5nV.js";import{E as b}from"./use-deprecated-B-NFNg3W.js";import{r as x,t as S}from"./select-D3xXGtAg.js";import{n as C,t as w}from"./tabs-CEBj_wbA.js";import{t as T}from"./upload-izq5b45N.js";import{t as E}from"./tooltip-ivBOvVK_.js";import{t as ee}from"./image-98SuLK5-.js";import{t as D}from"./alert-C51owb6L.js";import{n as O,r as te}from"./radio-3Hz7h3DR.js";import{t as k}from"./drawer-Aw9IMZFK.js";import{t as A}from"./input-number-B6BEZroj.js";import{t as j}from"./slider-5CrpaEzT.js";import{t as ne}from"./switch-BKuYGnPZ.js";import{Zr as re,ei as ie,ni as M,ti as ae}from"./constants-D5XSekB2.js";import{Bt as oe,Dn as N,Jn as P,Kr as F,Lr as I,O as L,Pr as se,Rr as R,Rt as z,Ut as B,Vt as V,Wr as ce,Zt as H,zr as U,zt as W}from"./index-BRkE9zIu.js";import{t as G}from"./index.es-Dw0M6NcN.js";import{t as le}from"./CopyToClipboard-DFQ4IOLO.js";import{t as ue}from"./FilePreview-DqQ_7x8i.js";import{t as K}from"./ImagePreview-w1XgTsO0.js";import{n as de}from"./taskDrawerMixin-DEgO_R5H.js";import{t as q}from"./Consumption-C9jb4ANC.js";import{i as J,n as fe,t as pe}from"./pagination-B_40M0as.js";import{t as me}from"./VideoPlayer-CtxypgMD.js";import{t as he}from"./ApiCodeButton-CEvOQHRz.js";import{t as ge}from"./BotPlaceholder-CueTGOF1.js";import{t as _e}from"./NoTasks-BLkIrpVk.js";import{t as ve}from"./PromptTextarea-DfG4xE4f.js";var ye=r({name:`LayoutKling`,components:{ElDrawer:k,ElButton:y,FontAwesomeIcon:G},mixins:[de]}),be={class:`main flex flex-row flex-1 min-h-0`},xe={class:`config w-[320px] flex-none h-full flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Se={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Ce(e,r,i,a,s,c){let l=g(`font-awesome-icon`),u=g(`el-button`),f=g(`el-drawer`);return d(),t(`div`,be,[n(`div`,xe,[m(e.$slots,`config`,{},void 0,!0)]),n(`div`,Se,[m(e.$slots,`result`,{},void 0,!0)]),p(o(u,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:_(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[v,!e.tasksEmpty]]),o(f,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`350px`},{default:_(()=>[m(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var we=L(ye,[[`render`,Ce],[`__scopeId`,`data-v-b87958dc`]]),Te={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};function Y(e,t,n){let r=t||`std`,i=n??5;switch(e){case`kling-v1`:return{text2video:!0,image2video:!0,endImage:i===5,audio:!1,motionControl:i===5};case`kling-v1-6`:case`kling-v2-5-turbo`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:!1,motionControl:!1};case`kling-v2-6`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:r===`pro`,motionControl:!1};case`kling-v2-master`:case`kling-v2-1-master`:return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};case`kling-v3`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:r!==`4k`};case`kling-v3-omni`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1};case`kling-video-o1`:return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1};default:return Te}}function X(e,t){if(!e)return[];let n=t.model??e.model,r=t.mode??e.mode,i=t.duration??e.duration;if(!n)return[];let a=Y(n,r,i),o=[];return e.end_image_url&&!a.endImage&&o.push({field:`end_image_url`,i18nLabel:`kling.name.endImage`}),e.generate_audio&&!a.audio&&o.push({field:`generate_audio`,i18nLabel:`kling.name.generateAudio`}),e.camera_control?.type&&(!a.motionControl||e.start_image_url)&&o.push({field:`camera_control`,i18nLabel:`kling.name.cameraControl`}),o}function Z(e,t){let n={...e};for(let e of t)e.field===`end_image_url`&&(n.end_image_url=void 0),e.field===`generate_audio`&&(n.generate_audio=!1),e.field===`camera_control`&&(n.camera_control=void 0);return n}var Ee=r({name:`ModelSelector`,components:{ElSelect:x,ElOption:S},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{revertKey:0,options:[{value:`kling-v3`,label:`v3`},{value:`kling-v3-omni`,label:`v3-Omni`},{value:`kling-v2-6`,label:`v2.6`},{value:`kling-v2-5-turbo`,label:`v2.5-Turbo`},{value:`kling-v2-1-master`,label:`v2.1-Master`},{value:`kling-v2-master`,label:`v2-Master`},{value:`kling-v1-6`,label:`v1.6`},{value:`kling-v1`,label:`v1`},{value:`kling-video-o1`,label:`Video-o1`}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(re)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await R.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,model:e},n);this.$store.commit(`kling/setConfig`,i),U.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,model:e})}}}),De={class:`field`},Oe={class:`title font-bold`};function ke(r,i,o,c,l,f){let p=g(`el-option`),m=g(`el-select`);return d(),t(`div`,De,[n(`h2`,Oe,u(r.$t(`pika.name.model`)),1),(d(),a(m,{key:r.revertKey,"model-value":r.value,class:`value`,placeholder:r.$t(`pika.placeholder.select`),onChange:r.onChange},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(p,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Ae=L(Ee,[[`render`,ke],[`__scopeId`,`data-v-04059875`]]),je=r({name:`ModeSelector`,components:{ElSelect:x,ElOption:S,InfoIcon:J},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},cameraControlSet(){return!!this.$store.state.kling?.config?.camera_control?.type},fourKReason(){return M.includes(this.selectedModel)?this.cameraControlSet?this.$t(`kling.description.mode4kIncompatibleCamera`):``:this.$t(`kling.description.mode4kRequiresV3`)},options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`),disabled:!1,disabledReason:``},{value:`pro`,label:this.$t(`kling.name.modePro`),disabled:!1,disabledReason:``},{value:`4k`,label:this.$t(`kling.name.mode4k`),disabled:!!this.fourKReason,disabledReason:this.fourKReason}]},value(){return this.$store.state.kling?.config?.mode}},watch:{fourKReason(e){e&&this.value===`4k`&&this.applyMode(`std`)}},mounted(){this.value||this.applyMode(`std`)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{mode:e});if(n.length===0){this.applyMode(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await R.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,mode:e},n);this.$store.commit(`kling/setConfig`,i),U.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyMode(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,mode:e})}}}),Me={class:`field`},Ne={class:`header`},Pe={class:`title font-bold`},Fe={key:0,class:`opt-tip`};function Ie(r,i,c,f,p,m){let v=g(`info-icon`),y=g(`el-option`),b=g(`el-select`);return d(),t(`div`,Me,[n(`div`,Ne,[n(`h2`,Pe,u(r.$t(`kling.name.mode`)),1),o(v,{content:r.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(d(),a(b,{key:r.revertKey,"model-value":r.value,class:`value`,placeholder:r.$t(`kling.placeholder.select`),clearable:!0,onChange:r.onChange},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(y,{key:e.value,label:e.label,value:e.value,disabled:e.disabled},{default:_(()=>[n(`span`,{class:l({"opt-disabled":e.disabled})},u(e.label),3),e.disabled&&e.disabledReason?(d(),t(`span`,Fe,u(e.disabledReason),1)):h(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Le=L(je,[[`render`,Ie],[`__scopeId`,`data-v-9a8fa3c5`]]),Re=[3,5,8,10,12,15],ze=[5,10],Be=r({name:`DurationSelector`,components:{ElSelect:x,ElOption:S,InfoIcon:J},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return M.includes(this.selectedModel)},allowedDurations(){return this.isV3Model?Re:ze},value(){return this.$store.state.kling?.config?.duration??5},selectValue(){let e=this.allowedDurations;return e.includes(this.value)?this.value:e.includes(5)?5:e[0]}},watch:{isV3Model(){this.allowedDurations.includes(this.value)||this.applyDuration(5)}},mounted(){this.$store.state.kling?.config?.duration||this.applyDuration(5)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{duration:e});if(n.length===0){this.applyDuration(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await R.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,duration:e},n);this.$store.commit(`kling/setConfig`,i),U.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyDuration(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,duration:e})}}}),Ve={class:`field`},He={class:`control`},Ue={class:`label`},We={class:`title font-bold`};function Ge(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,Ve,[n(`div`,He,[n(`div`,Ue,[n(`h2`,We,u(r.$t(`kling.name.duration`)),1),o(m,{content:r.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(d(),a(v,{key:r.revertKey,"model-value":r.selectValue,class:`value`,placeholder:r.$t(`kling.placeholder.select`),onChange:r.onChange},{default:_(()=>[(d(!0),t(s,null,e(r.allowedDurations,e=>(d(),a(h,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var Ke=L(Be,[[`render`,Ge],[`__scopeId`,`data-v-5ae55e28`]]),qe=r({name:`RatioSelector`,data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug(`set ratio`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||=`1:1`}}),Je={class:`text-sm font-bold mb-2 block`},Ye={class:`items`},Xe=[`onClick`],Ze={class:`name`};function Qe(r,i,a,o,f,p){return d(),t(`div`,null,[n(`span`,Je,u(r.$t(`kling.name.ratio`)),1),n(`div`,Ye,[(d(!0),t(s,null,e(r.options,(e,i)=>(d(),t(`div`,{key:i,class:l({active:r.active===i,item:!0}),onClick:t=>r.value=e.value},[n(`div`,{class:l([`preview`,e.label])},[n(`div`,{class:`rect`,style:c({width:e.width+`px`,height:e.height+`px`})},null,4)],2),n(`p`,Ze,u(e.label),1)],10,Xe))),128))])])}var $e=L(qe,[[`render`,Qe],[`__scopeId`,`data-v-cdb14b2f`]]),et=r({name:`StartImage`,components:{ElUpload:T,ElButton:y,ElTooltip:E,InfoIcon:J,FontAwesomeIcon:G,ImagePreview:K},mixins:[V,W],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)},reachedLimit(){return(this.fileList?.length||0)>=1},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){U.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){U.error(this.$t(`kling.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),tt={class:`relative`},nt={class:`flex justify-between`},rt={class:`flex justify-start items-center`},it={class:`text-sm font-bold`};function at(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-tooltip`),x=g(`el-upload`);return d(),t(`div`,tt,[n(`div`,nt,[n(`div`,rt,[n(`span`,it,u(e.$t(`kling.name.startImage`)),1),o(p,{content:e.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.reachedLimit,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(b,{content:e.$t(`kling.message.uploadReferencesExceed`),disabled:!e.reachedLimit,placement:`top`},{default:_(()=>[n(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.reachedLimit},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var ot=L(et,[[`render`,at],[`__scopeId`,`data-v-756dc269`]]),st=r({name:`EndImage`,components:{ElUpload:T,ElButton:y,ElTooltip:E,ImagePreview:K,InfoIcon:J,FontAwesomeIcon:G},mixins:[V,W],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)},reachedLimit(){return(this.fileList?.length||0)>=1},klingConfig(){return this.$store.state?.kling?.config||{}},endImageSupported(){return Y(this.klingConfig.model,this.klingConfig.mode,this.klingConfig.duration).endImage},hasStartImage(){return!!this.klingConfig.start_image_url},uploadDisabled(){return this.reachedLimit||!this.endImageSupported||!this.hasStartImage},uploadTooltip(){return this.endImageSupported?this.hasStartImage?this.reachedLimit?this.$t(`kling.message.uploadReferencesExceed`):``:this.$t(`kling.message.endImageRequiresStart`):this.$t(`kling.message.endImageNotSupported`)},storeValue(){return this.klingConfig.end_image_url},value:{get(){return this.storeValue},set(){}}},watch:{storeValue(e){!e&&this.fileList.length>0&&(this.fileList=[])},hasStartImage(e){!e&&this.storeValue&&(this.fileList=[],this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:void 0}))}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onBeforeUpload(){return this.endImageSupported?this.hasStartImage?!0:(U.warning(this.$t(`kling.message.endImageRequiresStart`)),!1):(U.warning(this.$t(`kling.message.endImageNotSupported`)),!1)},onExceed(){U.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){U.error(this.$t(`kling.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ct={class:`relative`},lt={class:`flex justify-between`},ut={class:`flex justify-start items-center`},dt={class:`text-sm font-bold`};function ft(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-tooltip`),x=g(`el-upload`);return d(),t(`div`,ct,[n(`div`,lt,[n(`div`,ut,[n(`span`,dt,u(e.$t(`kling.name.endImage`)),1),o(p,{content:e.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"before-upload":e.onBeforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(b,{content:e.uploadTooltip,disabled:!e.uploadDisabled,placement:`top`},{default:_(()=>[n(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.uploadDisabled},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var pt=L(st,[[`render`,ft],[`__scopeId`,`data-v-c1b257e5`]]),mt=r({name:`CfgScaleSelector`,components:{ElSlider:j,InfoIcon:J,ElInputNumber:A},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug(`set cfg_scale`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||=0}}),ht={class:`flex justify-between`},gt={class:`flex justify-start items-center`},_t={class:`text-sm font-bold`},vt={class:`flex justify-end items-center`},yt={class:`w-full`};function bt(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-input-number`),p=g(`el-slider`);return d(),t(`div`,null,[n(`div`,ht,[n(`div`,gt,[n(`span`,_t,u(e.$t(`kling.name.cfgScale`)),1),o(l,{content:e.$t(`kling.description.cfgScale`)},null,8,[`content`])]),n(`div`,vt,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"controls-position":`right`},null,8,[`modelValue`])])]),n(`div`,yt,[o(p,{modelValue:e.value,"onUpdate:modelValue":r[1]||=t=>e.value=t,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var xt=L(mt,[[`render`,bt]]),St=r({name:`GenerateAudioSelector`,components:{ElSwitch:ne,InfoIcon:J},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},supported(){return!!(M.includes(this.selectedModel)||this.selectedModel===`kling-v2-6`&&this.selectedMode===`pro`)},tooltipContent(){return this.supported?this.$t(`kling.description.generateAudio`):this.$t(`kling.description.generateAudioUnsupported`)},value:{get(){return this.supported?this.$store.state.kling?.config?.generate_audio??!1:!1},set(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,generate_audio:e})}}},watch:{supported(e){!e&&this.$store.state.kling?.config?.generate_audio&&this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,generate_audio:!1})}}}),Ct={class:`relative`},wt={class:`flex justify-between items-center`},Tt={class:`flex justify-start items-center`},Et={class:`text-sm font-bold`};function Dt(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return d(),t(`div`,Ct,[n(`div`,wt,[n(`div`,Tt,[n(`span`,Et,u(e.$t(`kling.name.generateAudio`)),1),o(l,{content:e.tooltipContent},null,8,[`content`])]),o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`,disabled:!e.supported},null,8,[`modelValue`,`disabled`])])])}var Ot=L(St,[[`render`,Dt]]),kt=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],At=r({name:`CameraControlSelector`,components:{ElSelect:x,ElOption:S,ElSlider:j,ElInputNumber:A,InfoIcon:J},data(){return{configKeys:kt}},computed:{typeOptions(){return[{value:``,label:this.$t(`kling.name.cameraTypeNone`)},{value:`simple`,label:this.$t(`kling.name.cameraTypeSimple`)},{value:`down_back`,label:this.$t(`kling.name.cameraTypeDownBack`)},{value:`forward_up`,label:this.$t(`kling.name.cameraTypeForwardUp`)},{value:`left_turn_forward`,label:this.$t(`kling.name.cameraTypeLeftTurnForward`)},{value:`right_turn_forward`,label:this.$t(`kling.name.cameraTypeRightTurnForward`)}]},selectedMode(){return this.$store.state.kling?.config?.mode||``},selectedModel(){return this.$store.state.kling?.config?.model||``},selectedDuration(){return this.$store.state.kling?.config?.duration},motionControlSupported(){return Y(this.selectedModel,this.selectedMode,this.selectedDuration).motionControl},hasStartImage(){return!!this.$store.state.kling?.config?.start_image_url},disabled(){return!this.motionControlSupported||this.hasStartImage},tooltipContent(){return this.motionControlSupported?this.hasStartImage?this.$t(`kling.description.cameraControlDisabledImage2Video`):this.$t(`kling.description.cameraControl`):this.$t(`kling.description.cameraControlNotSupported`)},selectedType(){return this.$store.state.kling?.config?.camera_control?.type},selectedTypeRaw:{get(){return this.selectedType??``},set(e){let t=this.$store.state.kling?.config||{};if(!e){let e={...t};delete e.camera_control,this.$store.commit(`kling/setConfig`,e);return}let n=e;this.$store.commit(`kling/setConfig`,{...t,camera_control:{type:n,config:n===`simple`?t.camera_control?.config||{}:void 0}})}},configValues(){return this.$store.state.kling?.config?.camera_control?.config||{}}},watch:{disabled(e){e&&this.selectedType!==void 0&&(this.selectedTypeRaw=``)}},methods:{writeConfig(e,t){let n=this.$store.state.kling?.config||{},r=n.camera_control||{type:`simple`},i={...r.config||{}};t==null?delete i[e]:i[e]=t,this.$store.commit(`kling/setConfig`,{...n,camera_control:{...r,type:`simple`,config:i}})},onSliderChange(e,t){this.writeConfig(e,t)},onNumberChange(e,t){this.writeConfig(e,t)}}}),jt={class:`field`},Mt={class:`header`},Nt={class:`text-sm font-bold`},Pt={key:0,class:`config-grid`},Ft={class:`cfg-row-head`},It={class:`cfg-name`};function Lt(r,i,c,l,f,p){let m=g(`info-icon`),v=g(`el-option`),y=g(`el-select`),b=g(`el-input-number`),x=g(`el-slider`);return d(),t(`div`,jt,[n(`div`,Mt,[n(`span`,Nt,u(r.$t(`kling.name.cameraControl`)),1),o(m,{content:r.tooltipContent},null,8,[`content`])]),o(y,{modelValue:r.selectedTypeRaw,"onUpdate:modelValue":i[0]||=e=>r.selectedTypeRaw=e,class:`value`,placeholder:r.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:r.disabled},{default:_(()=>[(d(!0),t(s,null,e(r.typeOptions,e=>(d(),a(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),r.selectedType===`simple`&&!r.disabled?(d(),t(`div`,Pt,[(d(!0),t(s,null,e(r.configKeys,e=>(d(),t(`div`,{key:e,class:`cfg-row`},[n(`div`,Ft,[n(`span`,It,u(r.$t(`kling.name.cc_${e}`)),1),o(b,{modelValue:r.configValues[e],"onUpdate:modelValue":t=>r.configValues[e]=t,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:t=>r.onNumberChange(e,t)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),o(x,{"model-value":r.configValues[e]??0,min:-1,max:1,step:.1,onInput:t=>r.onSliderChange(e,t)},null,8,[`model-value`,`onInput`])]))),128))])):h(``,!0)])}var Rt=L(At,[[`render`,Lt],[`__scopeId`,`data-v-cd896060`]]),zt=[{groupKey:`cameraMovements`,chipKeys:[`rotateAround`,`stationary`,`handheld`,`zoomOut`,`zoomIn`,`follow`,`panRight`,`tiltUp`,`tiltDown`,`orbit`]},{groupKey:`cameraSpeed`,chipKeys:[`speedSlow`,`speedMedium`,`speedFast`]},{groupKey:`shotType`,chipKeys:[`shotClose`,`shotMedium`,`shotLong`,`shotLowAngle`,`shotHighAngle`,`shotShallowDof`,`shotFront`,`shotProfile`,`shotCloseUp`,`shotDrone`]},{groupKey:`light`,chipKeys:[`lightSunlight`,`lightSoft`,`lightNeon`,`lightWarm`,`lightNature`,`lightCandle`,`lightCityNight`]},{groupKey:`frame`,chipKeys:[`frameRichDetails`,`frameSimpleBg`]},{groupKey:`atmosphere`,chipKeys:[`atmosphereMysterious`,`atmospherePeaceful`,`atmosphereHeartwarming`,`atmosphereVivid`,`atmosphereColorful`]}],Q=`, `;function Bt(e,t){let n=(e||``).trim();return n?n.includes(t)?n:`${n}${Q}${t}`:t}function $(e,t){if(!e||!t)return e||``;let n=[`${t}${Q}`,`${Q}${t}`,t],r=e;for(let e of n)if(r.includes(e)){r=r.replace(e,``);break}return r.replace(/(?:,\s*)+$/,``).replace(/^(?:,\s*)+/,``)}var Vt=r({name:`InspirationPills`,components:{FontAwesomeIcon:G},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return zt.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selected(){let e=this.prompt;if(!e)return[];let t=[];for(let n of this.allChipTexts){let r=e.indexOf(n);r!==-1&&t.push({text:n,idx:r})}return t.sort((e,t)=>e.idx-t.idx).map(e=>e.text)}},methods:{onRemove(e){let t=$(this.prompt,e);this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:t})}}}),Ht={key:0,class:`pills`,role:`list`},Ut={class:`pill-text`},Wt=[`aria-label`,`onClick`];function Gt(r,i,a,c,l,p){let m=g(`font-awesome-icon`);return r.selected.length>0?(d(),t(`div`,Ht,[(d(!0),t(s,null,e(r.selected,e=>(d(),t(`div`,{key:e,class:`pill`,role:`listitem`},[n(`span`,Ut,u(e),1),n(`button`,{type:`button`,class:`pill-remove`,"aria-label":r.$t(`kling.inspiration.removeChip`),onClick:f(t=>r.onRemove(e),[`stop`])},[o(m,{icon:`fa-solid fa-xmark`})],8,Wt)]))),128))])):h(``,!0)}var Kt=r({name:`PromptInput`,components:{ElButton:y,FontAwesomeIcon:G,PromptTextarea:ve,InspirationPills:L(Vt,[[`render`,Gt],[`__scopeId`,`data-v-5fc4fa65`]])},emits:[`open-inspiration`],computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||=``}});function qt(e,t,n,r,s,c){let l=g(`font-awesome-icon`),f=g(`el-button`),p=g(`inspiration-pills`),m=g(`prompt-textarea`);return d(),a(m,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`kling.name.prompt`),info:e.$t(`kling.description.prompt`),placeholder:e.$t(`kling.placeholder.prompt`)},{actions:_(()=>[o(f,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:_(()=>[o(l,{icon:`fa-regular fa-lightbulb`,class:`mr-1`}),i(` `+u(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:_(()=>[o(p)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var Jt=L(Kt,[[`render`,qt],[`__scopeId`,`data-v-c01fc1a6`]]),Yt=r({name:`NegativePromptInput`,components:{ElInput:F,InfoIcon:J},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug(`set prompt`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||=``}}),Xt={class:`field`},Zt={class:`box`},Qt={class:`title font-bold`};function $t(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-input`);return d(),t(`div`,Xt,[n(`div`,Zt,[n(`h2`,Qt,u(e.$t(`kling.name.negativePrompt`)),1),o(l,{content:e.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),o(f,{modelValue:e.prompt,"onUpdate:modelValue":r[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var en=L(Yt,[[`render`,$t],[`__scopeId`,`data-v-de98cf01`]]),tn=r({name:`InspirationDrawer`,components:{ElDrawer:k,ElButton:y,FontAwesomeIcon:G},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:zt,Close:b}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit(`update:modelValue`,e)}},drawerSize(){return window.innerWidth<768?`100%`:`380px`},prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return this.groups.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selectedCount(){return this.allChipTexts.filter(e=>this.isSelected(e)).length}},methods:{chipText(e){return this.$t(`kling.inspiration.chip.${e}`)},isSelected(e){return e?this.prompt.includes(e):!1},setPrompt(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})},onToggle(e){e&&(this.isSelected(e)?this.setPrompt($(this.prompt,e)):this.setPrompt(Bt(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=$(e,t);this.setPrompt(e)}}}),nn={class:`drawer-content`},rn={class:`drawer-header`},an={class:`title-row`},on={class:`title`},sn={class:`hint`},cn={key:0,class:`selected-bar`},ln={class:`selected-text`},un={class:`groups`},dn={class:`group-title`},fn={class:`chip-grid`},pn=[`onClick`];function mn(r,c,f,p,m,v){let y=g(`font-awesome-icon`),b=g(`el-button`),x=g(`el-drawer`);return d(),a(x,{modelValue:r.visible,"onUpdate:modelValue":c[1]||=e=>r.visible=e,direction:`rtl`,"with-header":!1,size:r.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:_(()=>[n(`div`,nn,[n(`div`,rn,[n(`div`,an,[o(y,{icon:`fa-regular fa-lightbulb`,class:`mr-2`}),n(`span`,on,u(r.$t(`kling.inspiration.title`)),1)]),o(b,{text:``,icon:r.Close,class:`close-btn`,onClick:c[0]||=e=>r.visible=!1},null,8,[`icon`])]),n(`div`,sn,u(r.$t(`kling.inspiration.hint`)),1),r.selectedCount>0?(d(),t(`div`,cn,[n(`span`,ln,u(r.$t(`kling.inspiration.selectedSummary`,{count:r.selectedCount})),1),o(b,{text:``,size:`small`,class:`clear-btn`,onClick:r.onClearSelected},{default:_(()=>[i(u(r.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):h(``,!0),n(`div`,un,[(d(!0),t(s,null,e(r.groups,i=>(d(),t(`div`,{key:i.groupKey,class:`group`},[n(`div`,dn,u(r.$t(`kling.inspiration.group.${i.groupKey}`)),1),n(`div`,fn,[(d(!0),t(s,null,e(i.chipKeys,e=>(d(),t(`button`,{key:e,type:`button`,class:l({chip:!0,active:r.isSelected(r.chipText(e))}),onClick:t=>r.onToggle(r.chipText(e))},u(r.chipText(e)),11,pn))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var hn=L(tn,[[`render`,mn],[`__scopeId`,`data-v-7d457a69`]]),gn={"kling-v3":`v3`,"kling-v3-omni":`v3-Omni`,"kling-v2-6":`v2.6`,"kling-v2-5-turbo":`v2.5-Turbo`,"kling-v2-1-master":`v2.1-Master`,"kling-v2-master":`v2-Master`,"kling-v1-6":`v1.6`,"kling-v1":`v1`,"kling-video-o1":`Video-o1`},_n={std:`720p`,pro:`1080p`,"4k":`4K`},vn=r({name:`SummaryChip`,components:{FontAwesomeIcon:G},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return gn[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return _n[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),yn={class:`summary-chip`},bn=[`title`],xn=[`title`],Sn=[`title`],Cn=[`title`],wn=[`title`];function Tn(e,r,i,a,s,c){let l=g(`font-awesome-icon`);return d(),t(`div`,yn,[n(`span`,{class:`part`,title:e.$t(`kling.name.model`)},u(e.modelLabel),9,bn),r[0]||=n(`span`,{class:`dot`},`·`,-1),n(`span`,{class:`part`,title:e.$t(`kling.name.duration`)},u(e.durationLabel),9,xn),r[1]||=n(`span`,{class:`dot`},`·`,-1),n(`span`,{class:`part`,title:e.$t(`kling.name.ratio`)},u(e.aspectRatio||`16:9`),9,Sn),r[2]||=n(`span`,{class:`dot`},`·`,-1),n(`span`,{class:`part`,title:e.$t(`kling.name.mode`)},u(e.modeLabel),9,Cn),e.generateAudio?(d(),t(`span`,{key:0,class:`audio`,title:e.$t(`kling.name.generateAudio`)},[o(l,{icon:`fa-solid fa-headphones`})],8,wn)):h(``,!0)])}var En=r({name:`ConfigPanel`,components:{ElButton:y,Consumption:q,FontAwesomeIcon:G,PromptInput:Jt,NegativePromptInput:en,ModelSelector:Ae,ModeSelector:Le,DurationSelector:Ke,RatioSelector:$e,StartImage:ot,CfgScaleSelector:xt,GenerateAudioSelector:Ot,CameraControlSelector:Rt,InspirationDrawer:hn,SummaryChip:L(vn,[[`render`,Tn],[`__scopeId`,`data-v-418a6733`]]),EndImage:pt},emits:[`generate`],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},consumption(){return B(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Dn={class:`flex flex-col h-full`},On={class:`flex-1 overflow-y-auto p-5`},kn={class:`flex flex-col items-center justify-center px-5 pb-5`};function An(e,r,s,c,l,f){let p=g(`prompt-input`),m=g(`model-selector`),h=g(`ratio-selector`),v=g(`start-image`),y=g(`end-image`),b=g(`duration-selector`),x=g(`mode-selector`),S=g(`generate-audio-selector`),C=g(`camera-control-selector`),w=g(`cfg-scale-selector`),T=g(`negative-prompt-input`),E=g(`summary-chip`),ee=g(`consumption`),D=g(`font-awesome-icon`),O=g(`el-button`),te=g(`inspiration-drawer`);return d(),t(`div`,Dn,[n(`div`,On,[o(p,{class:`mb-4`,onOpenInspiration:r[0]||=t=>e.inspirationOpen=!0}),o(m,{class:`mb-4`}),o(h,{class:`mb-4`}),o(v,{class:`mb-2`}),o(y,{class:`mb-2`}),o(b,{class:`mb-4`}),o(x,{class:`mb-4`}),o(S,{class:`mb-4`}),o(C,{class:`mb-4`}),o(w,{class:`mb-4`}),o(T,{class:`mb-4`})]),n(`div`,kn,[o(E),o(ee,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),e.config?.video_url!==void 0||e.config?.custom?(d(),a(O,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:_(()=>[o(D,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`kling.button.extend`)),1)]),_:1},8,[`onClick`])):(d(),a(O,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:_(()=>[o(D,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`kling.button.generate`)),1)]),_:1},8,[`onClick`]))]),o(te,{modelValue:e.inspirationOpen,"onUpdate:modelValue":r[1]||=t=>e.inspirationOpen=t},null,8,[`modelValue`])])}var jn=L(En,[[`render`,An]]),Mn=r({name:`MotionImage`,components:{ElUpload:T,ElButton:y,InfoIcon:J,FontAwesomeIcon:G,ImagePreview:K},mixins:[V,W],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)}},mounted(){this.onSetImageUrl()},methods:{onExceed(){U.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){U.error(this.$t(`kling.message.uploadReferencesError`))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,image_url:void 0})},onSetImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,image_url:e})},async onSuccess(){this.onSetImageUrl()}}}),Nn={class:`relative`},Pn={class:`flex justify-between`},Fn={class:`flex justify-start items-center`},In={class:`text-sm font-bold`};function Ln(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return d(),t(`div`,Nn,[n(`div`,Pn,[n(`div`,Fn,[n(`span`,In,u(e.$t(`kling.name.motionImage`)),1),o(p,{content:e.$t(`kling.description.motionImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Rn=L(Mn,[[`render`,Ln],[`__scopeId`,`data-v-e52eaf2f`]]),zn=r({name:`MotionVideo`,components:{ElUpload:T,ElButton:y,InfoIcon:J,FilePreview:ue,FontAwesomeIcon:G},mixins:[W],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)}},mounted(){this.onSetVideoUrl()},methods:{onExceed(){U.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){U.error(this.$t(`kling.message.uploadVideoError`))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,video_url:void 0})},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<100;return t?n?!0:(U.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(U.error(this.$t(`kling.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,video_url:e})},async onSuccess(){this.onSetVideoUrl()}}}),Bn={class:`relative`},Vn={class:`flex justify-between`},Hn={class:`flex justify-start items-center`},Un={class:`text-sm font-bold`};function Wn(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`file-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return d(),t(`div`,Bn,[n(`div`,Vn,[n(`div`,Hn,[n(`span`,Un,u(e.$t(`kling.name.motionVideo`)),1),o(p,{content:e.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),o(b,{"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:_(({file:t})=>[t.percentage===void 0?h(``,!0):(d(),a(m,{key:0,url:t.url||t.response?.file_url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Gn=L(zn,[[`render`,Wn],[`__scopeId`,`data-v-7019a8d2`]]),Kn=r({name:`MotionPromptInput`,components:{ElInput:F,InfoIcon:J},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||``},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),qn={class:`field`},Jn={class:`box`},Yn={class:`title font-bold`};function Xn(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-input`);return d(),t(`div`,qn,[n(`div`,Jn,[n(`h2`,Yn,u(e.$t(`kling.name.motionPrompt`)),1),o(l,{content:e.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),o(f,{modelValue:e.prompt,"onUpdate:modelValue":r[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Zn=L(Kn,[[`render`,Xn],[`__scopeId`,`data-v-ca9fdbe5`]]),Qn=`video`,$n=r({name:`CharacterOrientationSelector`,components:{ElRadioGroup:te,ElRadioButton:O,InfoIcon:J},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||Qn},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,character_orientation:e})}}},mounted(){this.$store.state.kling?.motionConfig?.character_orientation||(this.value=Qn)}}),er={class:`field`},tr={class:`header`},nr={class:`text-sm font-bold`};function rr(e,r,a,s,c,l){let f=g(`info-icon`),p=g(`el-radio-button`),m=g(`el-radio-group`);return d(),t(`div`,er,[n(`div`,tr,[n(`span`,nr,u(e.$t(`kling.name.characterOrientation`)),1),o(f,{content:e.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),o(m,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,size:`small`,class:`value`},{default:_(()=>[o(p,{label:`image`},{default:_(()=>[i(u(e.$t(`kling.name.orientationImage`)),1)]),_:1}),o(p,{label:`video`},{default:_(()=>[i(u(e.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var ir=L($n,[[`render`,rr],[`__scopeId`,`data-v-7a91195b`]]),ar=`std`,or=r({name:`MotionModeSelector`,components:{ElSelect:x,ElOption:S,InfoIcon:J},computed:{options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`)},{value:`pro`,label:this.$t(`kling.name.modePro`)}]},value:{get(){return this.$store.state.kling?.motionConfig?.mode||ar},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=ar)}}),sr={class:`field`},cr={class:`header`},lr={class:`title font-bold`};function ur(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,sr,[n(`div`,cr,[n(`h2`,lr,u(r.$t(`kling.name.mode`)),1),o(m,{content:r.$t(`kling.description.motionMode`)},null,8,[`content`])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`kling.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var dr=L(or,[[`render`,ur],[`__scopeId`,`data-v-1295688c`]]),fr=r({name:`KeepOriginalSoundSelector`,components:{ElSwitch:ne,InfoIcon:J},computed:{value:{get(){return(this.$store.state.kling?.motionConfig?.keep_original_sound??`yes`)===`yes`},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,keep_original_sound:e?`yes`:`no`})}}}}),pr={class:`relative`},mr={class:`flex justify-between items-center`},hr={class:`flex justify-start items-center`},gr={class:`text-sm font-bold`};function _r(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return d(),t(`div`,pr,[n(`div`,mr,[n(`div`,hr,[n(`span`,gr,u(e.$t(`kling.name.keepOriginalSound`)),1),o(l,{content:e.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t},null,8,[`modelValue`])])])}var vr=r({name:`MotionPanel`,components:{ElButton:y,FontAwesomeIcon:G,Consumption:q,MotionImage:Rn,MotionVideo:Gn,MotionPromptInput:Zn,CharacterOrientationSelector:ir,MotionModeSelector:dr,KeepOriginalSoundSelector:L(fr,[[`render`,_r]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return B(this.motionConfig,this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){let e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit(`generate`)}}}),yr={class:`flex flex-col h-full`},br={class:`flex-1 overflow-y-auto p-5`},xr={class:`flex flex-col items-center justify-center px-5 pb-5`};function Sr(e,r,a,s,c,l){let f=g(`motion-image`),p=g(`motion-video`),m=g(`motion-prompt-input`),h=g(`character-orientation-selector`),v=g(`motion-mode-selector`),y=g(`keep-original-sound-selector`),b=g(`consumption`),x=g(`font-awesome-icon`),S=g(`el-button`);return d(),t(`div`,yr,[n(`div`,br,[o(f,{class:`mb-3`}),o(p,{class:`mb-3`}),o(m,{class:`mb-4`}),o(h,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`})]),n(`div`,xr,[o(b,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(S,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canGenerate,onClick:e.onGenerate},{default:_(()=>[o(x,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Cr=L(vr,[[`render`,Sr]]),wr=r({name:`KlingTabSwitcher`,components:{ElTabs:C,ElTabPane:w,ElTag:ce},props:{modelValue:{type:String,default:`videos`}},emits:[`update:modelValue`],computed:{tabs(){return[{value:`videos`,label:this.$t(`kling.tab.videoGeneration`)},{value:`motion`,label:this.$t(`kling.tab.motionControl`)},{value:`talking-photo`,label:this.$t(`kling.tab.talkingPhoto`)}]}},methods:{onUpdate(e){this.$emit(`update:modelValue`,e)}}}),Tr=[`title`],Er={class:`text`};function Dr(r,o,c,l,f,p){let m=g(`el-tag`),v=g(`el-tab-pane`),y=g(`el-tabs`);return d(),a(y,{"model-value":r.modelValue,class:`kling-tabs`,stretch:``,"onUpdate:modelValue":r.onUpdate},{default:_(()=>[(d(!0),t(s,null,e(r.tabs,e=>(d(),a(v,{key:e.value,name:e.value,disabled:e.disabled},{label:_(()=>[n(`span`,{class:`tab-label`,title:e.disabled?e.disabledReason:void 0},[n(`span`,Er,u(e.label),1),e.badge?(d(),a(m,{key:0,size:`small`,type:`warning`,class:`badge`},{default:_(()=>[i(u(e.badge),1)]),_:2},1024)):h(``,!0)],8,Tr)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Or=L(wr,[[`render`,Dr],[`__scopeId`,`data-v-fda33e4c`]]),kr={"kling-v2-6":`v2.6`,"kling-v2-5-turbo":`v2.5-Turbo`,"kling-v2-1-master":`v2.1-Master`,"kling-v2-master":`v2-Master`,"kling-v1-6":`v1.6`,"kling-v1":`v1`},Ar=r({name:`TalkingPhotoModelSelector`,components:{ElSelect:x,ElOption:S},data(){return{options:ae.map(e=>({value:e,label:kr[e]||e}))}},computed:{value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.model||`kling-v2-1-master`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,model:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.model||(this.value=ie)}}),jr={class:`field`},Mr={class:`title font-bold`};function Nr(r,i,c,l,f,p){let m=g(`el-option`),h=g(`el-select`);return d(),t(`div`,jr,[n(`h2`,Mr,u(r.$t(`kling.name.model`)),1),o(h,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`kling.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Pr=L(Ar,[[`render`,Nr],[`__scopeId`,`data-v-cbc83d11`]]),Fr=r({name:`TalkingPhotoModeSelector`,components:{ElSelect:x,ElOption:S},computed:{options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`)},{value:`pro`,label:this.$t(`kling.name.modePro`)}]},value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.mode||`pro`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,mode:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.mode||(this.value=`pro`)}}),Ir={class:`field`},Lr={class:`title font-bold`};function Rr(r,i,c,l,f,p){let m=g(`el-option`),h=g(`el-select`);return d(),t(`div`,Ir,[n(`h2`,Lr,u(r.$t(`kling.name.mode`)),1),o(h,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`kling.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var zr=r({name:`TalkingPhotoPanel`,components:{ElUpload:T,ElButton:y,ElInput:F,FontAwesomeIcon:G,Consumption:q,InfoIcon:J,ImagePreview:K,ModelSelector:Pr,ModeSelector:L(Fr,[[`render`,Rr],[`__scopeId`,`data-v-92525a1d`]])},mixins:[W],emits:[`generate`],data(){return{imageFiles:[],audioFiles:[],uploadUrl:I()+`/api/v1/files/`}},computed:{config(){return this.$store.state.kling?.talkingPhotoConfig||{}},audioUrl(){return this.config.audio_url},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},service(){return this.$store.state.kling?.service},consumption(){return B({...this.config,action:`talking-photo`},this.service?.cost)},canGenerate(){return!!(this.config.image_url&&this.config.audio_url)}},methods:{commit(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.config,...e})},onPromptChange(e){this.commit({prompt:e})},onImageExceed(){U.warning(this.$t(`kling.message.uploadReferencesExceed`))},onImageError(){U.error(this.$t(`kling.message.uploadReferencesError`))},onImageSuccess(e){this.commit({image_url:e?.file_url})},onImageRemove(e){this.imageFiles.splice(this.imageFiles.indexOf(e),1),this.commit({image_url:void 0})},onAudioExceed(){U.warning(this.$t(`kling.message.uploadAudioExceed`))},onAudioError(){U.error(this.$t(`kling.message.uploadAudioError`))},onAudioSuccess(e){this.commit({audio_url:e?.file_url})},onAudioRemove(){this.commit({audio_url:void 0})},onGenerate(){this.$emit(`generate`)}}}),Br={class:`flex flex-col h-full`},Vr={class:`flex-1 overflow-y-auto p-5`},Hr={class:`relative mb-4`},Ur={class:`flex justify-start items-center`},Wr={class:`text-sm font-bold`},Gr={class:`relative mb-4`},Kr={class:`flex justify-start items-center`},qr={class:`text-sm font-bold`},Jr=[`src`],Yr={class:`mb-4`},Xr={class:`flex justify-start items-center`},Zr={class:`text-sm font-bold`},Qr={class:`flex flex-col items-center justify-center px-5 pb-5`};function $r(e,r,s,c,l,f){let p=g(`model-selector`),m=g(`mode-selector`),v=g(`info-icon`),y=g(`image-preview`),b=g(`font-awesome-icon`),x=g(`el-button`),S=g(`el-upload`),C=g(`el-input`),w=g(`consumption`);return d(),t(`div`,Br,[n(`div`,Vr,[o(p,{class:`mb-4`}),o(m,{class:`mb-4`}),n(`div`,Hr,[n(`div`,Ur,[n(`span`,Wr,u(e.$t(`kling.name.talkingPhotoImage`)),1),o(v,{content:e.$t(`kling.description.talkingPhotoImage`)},null,8,[`content`])]),o(S,{ref:`imageUploader`,"file-list":e.imageFiles,"onUpdate:fileList":r[0]||=t=>e.imageFiles=t,name:`file`,accept:`.png,.jpg,.jpeg,.webp,.bmp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,headers:e.headers,"on-exceed":e.onImageExceed,"on-error":e.onImageError,"on-success":e.onImageSuccess},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(y,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.onImageRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(x,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(b,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`])]),n(`div`,Gr,[n(`div`,Kr,[n(`span`,qr,u(e.$t(`kling.name.talkingPhotoAudio`)),1),o(v,{content:e.$t(`kling.description.talkingPhotoAudio`)},null,8,[`content`])]),o(S,{ref:`audioUploader`,"file-list":e.audioFiles,"onUpdate:fileList":r[1]||=t=>e.audioFiles=t,name:`file`,accept:`.mp3,.wav,.m4a,.aac`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,headers:e.headers,"on-exceed":e.onAudioExceed,"on-error":e.onAudioError,"on-success":e.onAudioSuccess,"on-remove":e.onAudioRemove},{default:_(()=>[o(x,{round:``,type:`primary`,size:`small`,class:`btn`},{default:_(()=>[o(b,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadAudio`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`]),e.audioUrl?(d(),t(`audio`,{key:0,src:e.audioUrl,controls:``,class:`w-full mt-2`},null,8,Jr)):h(``,!0)]),n(`div`,Yr,[n(`div`,Xr,[n(`span`,Zr,u(e.$t(`kling.name.talkingPhotoPrompt`)),1),o(v,{content:e.$t(`kling.description.talkingPhotoPrompt`)},null,8,[`content`])]),o(C,{"model-value":e.config.prompt,type:`textarea`,rows:2,placeholder:e.$t(`kling.placeholder.talkingPhotoPrompt`),class:`mt-1`,"onUpdate:modelValue":e.onPromptChange},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])])]),n(`div`,Qr,[o(w,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(x,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canGenerate,onClick:e.onGenerate},{default:_(()=>[o(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`kling.button.generateTalkingPhoto`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var ei=L(zr,[[`render`,$r],[`__scopeId`,`data-v-27261e35`]]),ti=r({name:`TaskPreview`,components:{ElImage:ee,CopyToClipboard:le,FontAwesomeIcon:G,ElAlert:D,VideoPlayer:me,ElTooltip:E,ElButton:y,ImagePreview:K,ApiCodeButton:he},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config},referenceImages(){let e=[],t=this.modelValue?.request?.start_image_url,n=this.modelValue?.request?.end_image_url;return t&&e.push({url:t,name:`start-image`}),n&&e.push({url:n,name:`end-image`}),e}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),ni={class:`preview`},ri={class:`left`},ii={class:`main`},ai={class:`bot`},oi={class:`datetime`},si={class:`info`},ci={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},li={key:1,class:`prompt mt-2`},ui={key:0},di={key:1},fi={key:0,class:l({content:!0,failed:!0})},pi={key:0,class:`mb-4`},mi={key:1,class:l({operations:!0,"mt-2":!0})},hi={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gi={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_i={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},vi={key:1,class:l({content:!0})},yi={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bi={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xi={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Si={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ci={key:2,class:l({content:!0})},wi={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ti={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Ei(r,c,l,f,p,m){let v=g(`el-image`),y=g(`image-preview`),b=g(`video-player`),x=g(`el-button`),S=g(`el-tooltip`),C=g(`api-code-button`),w=g(`font-awesome-icon`),T=g(`copy-to-clipboard`),E=g(`el-alert`);return d(),t(`div`,ni,[n(`div`,ri,[o(v,{src:`https://cdn.acedata.cloud/qpbbbb.jpg`,class:`avatar`})]),n(`div`,ii,[n(`div`,ai,[i(u(r.$t(`kling.name.klingBot`))+` `,1),n(`span`,oi,u(r.$dayjs.format(``+new Date(parseFloat((r.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,si,[r.referenceImages.length>0?(d(),t(`div`,ci,[(d(!0),t(s,null,e(r.referenceImages,(e,t)=>(d(),a(y,{key:t,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128))])):h(``,!0),r.modelValue?.request?.prompt?(d(),t(`p`,li,[i(u(r.modelValue?.request?.prompt)+` `,1),r.modelValue?.response?h(``,!0):(d(),t(`span`,ui,` - (`+u(r.$t(`kling.status.pending`))+`) `,1)),r.modelValue?.response?.state===`submitted`||r.modelValue?.response?.state===`processing`||r.modelValue?.response?.state===`pending`||r.modelValue?.response?.state===`completed`?(d(),t(`span`,di,` - (`+u(r.$t(`kling.status.processing`))+`) `,1)):h(``,!0)])):h(``,!0)]),r.modelValue?.response?.success===!0?(d(),t(`div`,fi,[r.modelValue?.response.video_url?(d(),t(`div`,pi,[o(b,{src:r.modelValue?.response.video_url},null,8,[`src`])])):h(``,!0),r.modelValue?.response.success?(d(),t(`div`,mi,[o(S,{class:`box-item`,effect:`dark`,content:r.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:_(()=>[r.modelValue?.response.video_url?(d(),a(x,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=e=>r.onDownload(e,r.modelValue?.response.video_url)},{default:_(()=>[i(u(r.$t(`kling.button.download`)),1)]),_:1})):h(``,!0)]),_:1},8,[`content`]),o(C,{path:`/kling/videos`,body:r.modelValue?.request},null,8,[`body`])])):h(``,!0),o(E,{closable:!1,class:`mt-2 success`},{default:_(()=>[n(`p`,hi,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.model`))+`: `+u(r.modelValue?.request?.model),1)]),n(`p`,gi,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(T,{content:r.modelValue?.id},null,8,[`content`])]),r.modelValue?.elapsed?(d(),t(`p`,_i,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0)]),_:1})])):h(``,!0),r.modelValue?.response?.success===!1?(d(),t(`div`,vi,[o(E,{closable:!1,class:`failure`},{template:_(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.failure`)),1)]),default:_(()=>[n(`p`,yi,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(T,{content:r.modelValue?.id},null,8,[`content`])]),n(`p`,bi,[o(w,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.failureReason`))+`: `+u(r.modelValue?.response?.error?.message)+` `,1),o(T,{content:r.modelValue?.response?.error?.message},null,8,[`content`])]),r.modelValue?.elapsed?(d(),t(`p`,xi,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0),r.modelValue?.response?.trace_id?(d(),t(`p`,Si,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(T,{content:r.modelValue?.response?.trace_id},null,8,[`content`])])):h(``,!0)]),_:1})])):h(``,!0),r.modelValue?.response?.success===void 0?(d(),t(`div`,Ci,[o(E,{closable:!1,class:`info`},{template:_(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.failure`)),1)]),default:_(()=>[n(`p`,wi,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(T,{content:r.modelValue?.id},null,8,[`content`])]),r.modelValue?.response?.trace_id?(d(),t(`p`,Ti,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(T,{content:r.modelValue?.response?.trace_id},null,8,[`content`])])):h(``,!0)]),_:1})])):h(``,!0)])])}var Di=r({name:`RecentPanel`,components:{TaskPreview:L(ti,[[`render`,Ei],[`__scopeId`,`data-v-c36bfd7f`]]),NoTasks:_e,BotPlaceholder:ge,ScrollList:fe},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Oi={key:0},ki={key:2,class:`w-full h-full flex items-center justify-center`};function Ai(n,r,i,c,l,u){let f=g(`bot-placeholder`),p=g(`task-preview`),m=g(`scroll-list`),v=g(`no-tasks`);return d(),t(s,null,[n.tasks?.items===void 0?(d(),t(`div`,Oi,[o(f)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(d(),a(m,{key:1,ref:`scrollList`,class:`h-full w-full overflow-y-auto tasks`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:_(()=>[(d(!0),t(s,null,e(n.tasks?.items,e=>(d(),a(p,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):h(``,!0),n.tasks?.items?.length===0?(d(),t(`div`,ki,[o(v)])):h(``,!0)],64)}var ji=r({name:`KlingIndex`,components:{ConfigPanel:jn,MotionPanel:Cr,TalkingPhotoPanel:ei,TabSwitcher:Or,Layout:we,RecentPanel:L(Di,[[`render`,Ai]])},mixins:[oe],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===se.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===se.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},talkingPhotoConfig(){return this.$store.state.kling.talkingPhotoConfig},taskType(){return this.$store.state.kling.taskType||`videos`},tasks(){return this.$store.state.kling.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 pe({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`kling/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`kling/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(`kling/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!z(this.uploadTracker,e=>this.$t(e),e=>U.warning(e)))return;let{camera_control:e,...t}=this.config||{},n={...t,async:!0};if(!n.video_id&&!t.video_url&&!n.start_image_url&&n.end_image_url){U.warning(this.$t(`kling.message.endImageRequiresStart`));return}if(n.action||(n.video_id||t.video_url?n.action=`extend`:n.start_image_url?n.action=`image2video`:n.action=`text2video`),n.action===`text2video`&&n.end_image_url&&delete n.end_image_url,e?.type&&(n.camera_control={type:e.type,...e.type===`simple`&&e.config?{config:Object.fromEntries(Object.entries(e.config).filter(([,e])=>e!=null))}:{}}),!H())return;let r=this.credential?.token;if(!r){console.error(`no token specified`);return}U.info(this.$t(`kling.message.startingTask`)),P(`kling`,N.generate(n,{token:r})).then(()=>{U.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`kling.message.usedUp`)):U.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},async onTabChange(e){e!==this.taskType&&(await this.$store.dispatch(`kling/setTaskType`,e),await this.onGetTasks(),await this.onScrollDown())},async onGenerateMotion(){if(!z(this.uploadTracker,e=>this.$t(e),e=>U.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){U.warning(this.$t(`kling.message.motionMissingInputs`));return}let t={image_url:e.image_url,video_url:e.video_url,character_orientation:e.character_orientation||`video`,mode:e.mode||`std`,keep_original_sound:e.keep_original_sound??`yes`,...e.prompt?{prompt:e.prompt}:{},async:!0};if(!H())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}U.info(this.$t(`kling.message.startingTask`)),P(`kling`,N.motion(t,{token:n})).then(()=>{U.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`kling.message.usedUp`)):U.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},async onGenerateTalkingPhoto(){if(!z(this.uploadTracker,e=>this.$t(e),e=>U.warning(e)))return;let e=this.talkingPhotoConfig||{};if(!e.image_url||!e.audio_url){U.warning(this.$t(`kling.message.talkingPhotoMissingInputs`));return}let t={image_url:e.image_url,audio_url:e.audio_url,model:e.model||`kling-v2-1-master`,mode:e.mode||`pro`,...e.prompt?{prompt:e.prompt}:{},...e.duration?{duration:e.duration}:{},async:!0};if(!H())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}U.info(this.$t(`kling.message.startingTask`)),P(`kling`,N.talkingPhoto(t,{token:n})).then(()=>{U.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`kling.message.usedUp`)):U.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),Mi={class:`flex flex-col h-full`},Ni={class:`flex-1 min-h-0`};function Pi(e,t,r,i,s,c){let l=g(`tab-switcher`),u=g(`config-panel`),f=g(`motion-panel`),p=g(`talking-photo-panel`),m=g(`recent-panel`),v=g(`layout`);return d(),a(v,null,{config:_(()=>[n(`div`,Mi,[o(l,{"model-value":e.taskType,"onUpdate:modelValue":e.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),n(`div`,Ni,[e.taskType===`videos`?(d(),a(u,{key:0,onGenerate:e.onGenerate},null,8,[`onGenerate`])):e.taskType===`motion`?(d(),a(f,{key:1,onGenerate:e.onGenerateMotion},null,8,[`onGenerate`])):e.taskType===`talking-photo`?(d(),a(p,{key:2,onGenerate:e.onGenerateTalkingPhoto},null,8,[`onGenerate`])):h(``,!0)])])]),result:_(()=>[o(m,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Fi=L(ji,[[`render`,Pi]]);export{Fi as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Ut as c,Vt as l,Wt as u,Z as d,b as f,dt as p,et as m,k as h,tt as g,ut as _,v}from"./vendor-chart-BJCvKk8-.js";import{t as y}from"./button-BydTr5nV.js";import{r as b,t as x}from"./select-CTGAdTl9.js";import{t as S}from"./upload-CRcRB-U7.js";import{t as C}from"./tooltip-ivBOvVK_.js";import{t as w}from"./image-DwKDUrzV.js";import{t as T}from"./alert-C51owb6L.js";import{t as E}from"./drawer-Aw9IMZFK.js";import{t as D}from"./input-number-DDAxxsV9.js";import{t as O}from"./switch-C7bMRiui.js";import{$t as k,Gt as A,Ht as j,Jt as ee,Kt as te,Qt as ne,Rt as re,Ut as ie,Vt as ae,Wt as oe,Xt as se,Yt as ce,Zt as le,cn as M,en as ue,in as N,nn as P,on as de,qt as fe,rn as F,sn as I,tn as L,zt as R}from"./constants-D5XSekB2.js";import{Bt as z,Hr as B,Jn as V,Lr as H,O as U,Pr as W,Rt as pe,Ut as me,Vt as G,Zt as he,un as ge,zr as K,zt as q}from"./index-DlJr9VYp.js";import{t as J}from"./index.es-BHvvolz-.js";import{t as _e}from"./CopyToClipboard--2jgu_fL.js";import{t as Y}from"./ImagePreview-zuMlHykT.js";import{n as ve}from"./taskDrawerMixin-DEgO_R5H.js";import{t as ye}from"./Consumption-mzszOU5D.js";import{i as X,n as be,t as xe}from"./pagination-h9rCWZht.js";import{t as Z}from"./VideoPlayer-BowJFnOh.js";import{t as Se}from"./ApiCodeButton-w2H75bSh.js";import{t as Ce}from"./BotPlaceholder-CxKG8Hym.js";import{t as we}from"./NoTasks-DWF77Bjw.js";import{t as Te}from"./PromptTextarea-C_g1pSMP.js";import{t as Ee}from"./ImageWrapper-mOGvz7wJ.js";var De=r({name:`LayoutSeedance`,components:{ElDrawer:E,ElButton:y,FontAwesomeIcon:J},mixins:[ve]}),Oe={class:`main flex flex-row flex-1`},ke={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function je(e,r,i,a,s,c){let l=g(`font-awesome-icon`),u=g(`el-button`),f=g(`el-drawer`);return d(),t(`div`,Oe,[n(`div`,ke,[m(e.$slots,`config`,{},void 0,!0)]),n(`div`,Ae,[m(e.$slots,`result`,{},void 0,!0)]),p(o(u,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:_(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[v,!e.tasksEmpty]]),o(f,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`350px`},{default:_(()=>[m(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Me=U(De,[[`render`,je],[`__scopeId`,`data-v-ec312952`]]),Ne=r({name:`SeedancePromptInput`,components:{PromptTextarea:Te},computed:{prompt:{get(){return this.$store.state.seedance?.config?.prompt},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Pe(e,t,n,r,i,o){let s=g(`prompt-textarea`);return d(),a(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedance.name.prompt`),info:e.$t(`seedance.description.prompt`),placeholder:e.$t(`seedance.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Fe=U(Ne,[[`render`,Pe]]),Ie=r({name:`SeedanceModelSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:X},data(){return{options:[{value:ee,label:this.$t(`seedance.model.seedance20`)},{value:ce,label:this.$t(`seedance.model.seedance20Fast`)},{value:se,label:this.$t(`seedance.model.seedance20Mini`)},{value:fe,label:this.$t(`seedance.model.seedance15pro`)},{value:A,label:this.$t(`seedance.model.seedance10pro`)},{value:te,label:this.$t(`seedance.model.seedance10proFast`)},{value:oe,label:this.$t(`seedance.model.seedance10liteT2v`)},{value:ie,label:this.$t(`seedance.model.seedance10liteI2v`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.model},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,model:e})}}},mounted(){this.value||=re}}),Le={class:`field`},Re={class:`label`},ze={class:`box`},Be={class:`title font-bold`};function Ve(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,Le,[n(`div`,Re,[n(`div`,ze,[n(`h2`,Be,u(r.$t(`seedance.name.model`)),1),o(m,{content:r.$t(`seedance.description.model`),class:`info`},null,8,[`content`])])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedance.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var He=U(Ie,[[`render`,Ve],[`__scopeId`,`data-v-deb4c429`]]),Ue=r({name:`SeedanceDurationSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:X},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},options(){let e=[];for(let t=this.capability.minDuration;t<=this.capability.maxDuration;t++)e.push({value:t,label:`${t}s`});return e},value:{get(){return this.$store.state.seedance?.config?.duration},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,duration:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=5},methods:{clampValue(){let e=this.value;e!==void 0&&(e<this.capability.minDuration||e>this.capability.maxDuration)&&(this.value=5)}}}),We={class:`field`},Ge={class:`label`},Ke={class:`box`},qe={class:`title font-bold`};function Je(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,We,[n(`div`,Ge,[n(`div`,Ke,[n(`h2`,qe,u(r.$t(`seedance.name.duration`)),1),o(m,{content:r.$t(`seedance.description.duration`),class:`info`},null,8,[`content`])])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedance.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ye=U(Ue,[[`render`,Je],[`__scopeId`,`data-v-216def8f`]]),Q={[F]:0,[N]:1,[P]:2,"4k":3},Xe=r({name:`SeedanceResolutionSelector`,components:{InfoIcon:X,ElTooltip:C},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},options(){let e=[{value:F,label:`480p`},{value:N,label:`720p`},{value:P,label:`1080p`},{value:`4k`,label:`4k`}],t=Q[this.capability.maxResolution]??Q[`1080p`];return e.map(e=>({...e,disabled:Q[e.value]>t}))},value:{get(){return this.$store.state.seedance?.config?.resolution},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,resolution:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=this.capability.defaultResolution||`720p`},methods:{onSelect(e){e.disabled||(this.value=e.value)},clampValue(){let e=this.value,t=this.options.find(t=>t.value===e);(!e||t&&t.disabled)&&(this.value=this.capability.defaultResolution||`720p`)}}}),Ze={class:`resolution`},Qe={class:`header`},$e={class:`title font-bold`},et={class:`items`},tt=[`onClick`];function nt(r,i,c,f,p,m){let h=g(`info-icon`),v=g(`el-tooltip`);return d(),t(`div`,Ze,[n(`div`,Qe,[n(`h2`,$e,u(r.$t(`seedance.name.resolution`)),1),o(h,{content:r.$t(`seedance.description.resolution`),class:`info`},null,8,[`content`])]),n(`div`,et,[(d(!0),t(s,null,e(r.options,e=>(d(),a(v,{key:e.value,content:r.$t(`seedance.message.resolutionNotSupported`),disabled:!e.disabled,placement:`top`},{default:_(()=>[n(`div`,{class:l([`item`,{active:r.value===e.value,disabled:e.disabled}]),onClick:t=>r.onSelect(e)},u(e.label),11,tt)]),_:2},1032,[`content`,`disabled`]))),128))])])}var rt=U(Xe,[[`render`,nt],[`__scopeId`,`data-v-db7e8aff`]]),it=r({name:`SeedanceRatioSelector`,components:{InfoIcon:X},computed:{options(){return[{value:ne,label:`16:9`,w:32,h:18},{value:ue,label:`9:16`,w:18,h:32},{value:`4:3`,label:`4:3`,w:28,h:21},{value:`3:4`,label:`3:4`,w:21,h:28},{value:`1:1`,label:`1:1`,w:24,h:24},{value:k,label:`21:9`,w:34,h:14},{value:L,label:this.$t(`seedance.ratio.adaptive`),w:0,h:0}]},value:{get(){return this.$store.state.seedance?.config?.ratio},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,ratio:e})}}},mounted(){this.value||=R}}),at={class:`ratio`},ot={class:`header`},st={class:`title font-bold`},ct={class:`items`},lt=[`onClick`],ut={class:`preview`},dt={key:1,class:`rect rect-auto`},ft={class:`name`};function pt(r,i,a,f,p,m){let h=g(`info-icon`);return d(),t(`div`,at,[n(`div`,ot,[n(`h2`,st,u(r.$t(`seedance.name.ratio`)),1),o(h,{content:r.$t(`seedance.description.ratio`),class:`info`},null,8,[`content`])]),n(`div`,ct,[(d(!0),t(s,null,e(r.options,e=>(d(),t(`div`,{key:e.value,class:l([`item`,{active:r.value===e.value}]),onClick:t=>r.value=e.value},[n(`div`,ut,[e.w&&e.h?(d(),t(`div`,{key:0,class:`rect`,style:c({width:e.w+`px`,height:e.h+`px`})},null,4)):(d(),t(`div`,dt,`A`))]),n(`div`,ft,u(e.label),1)],10,lt))),128))])])}var mt=U(it,[[`render`,pt],[`__scopeId`,`data-v-8ddec2dd`]]),ht=r({name:`SeedanceGenerateAudioSwitch`,components:{ElSwitch:O,InfoIcon:X},computed:{isSupported(){let e=this.$store.state.seedance?.config?.model;return M(e).acceptsAudio},value:{get(){return this.$store.state.seedance?.config?.generate_audio??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,generate_audio:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),gt={key:0,class:`field`},_t={class:`label`},vt={class:`box`},yt={class:`title font-bold`},bt={class:`value`};function xt(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return e.isSupported?(d(),t(`div`,gt,[n(`div`,_t,[n(`div`,vt,[n(`h2`,yt,u(e.$t(`seedance.name.generateAudio`)),1),o(l,{content:e.$t(`seedance.description.generateAudio`),class:`info`},null,8,[`content`])])]),n(`div`,bt,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"inline-prompt":``,"active-text":e.$t(`seedance.button.on`),"inactive-text":e.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):h(``,!0)}var St=U(ht,[[`render`,xt],[`__scopeId`,`data-v-df51dfbd`]]),Ct=r({name:`SeedanceCameraFixedSwitch`,components:{ElSwitch:O,InfoIcon:X},computed:{value:{get(){return this.$store.state.seedance?.config?.camerafixed??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,camerafixed:e})}}},mounted(){this.$store.state.seedance?.config?.camerafixed===void 0&&(this.value=!1)}}),wt={class:`field`},Tt={class:`label`},Et={class:`box`},Dt={class:`title font-bold`},Ot={class:`value`};function kt(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return d(),t(`div`,wt,[n(`div`,Tt,[n(`div`,Et,[n(`h2`,Dt,u(e.$t(`seedance.name.cameraFixed`)),1),o(l,{content:e.$t(`seedance.description.cameraFixed`),class:`info`},null,8,[`content`])])]),n(`div`,Ot,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"inline-prompt":``,"active-text":e.$t(`seedance.button.on`),"inactive-text":e.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])}var At=U(Ct,[[`render`,kt],[`__scopeId`,`data-v-ae777d61`]]),jt=r({name:`SeedanceFirstFrameImage`,components:{ElUpload:S,ElButton:y,InfoIcon:X,FontAwesomeIcon:J,ImagePreview:Y},mixins:[G,q],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsImage"(e){e||(this.fileList=[],this.onSetFirstFrameUrl())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetFirstFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`first_frame`);e&&t.push({url:e,role:`first_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetFirstFrameUrl()},async onRemove(){this.onSetFirstFrameUrl()}}}),Mt={key:0,class:`relative`},Nt={class:`flex justify-between`},Pt={class:`flex justify-start items-center`},Ft={class:`text-sm font-bold`},It={key:0,class:`required-badge`};function Lt(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return e.capability.acceptsImage?(d(),t(`div`,Mt,[n(`div`,Nt,[n(`div`,Pt,[n(`span`,Ft,u(e.$t(`seedance.name.firstFrame`)),1),e.capability.requiresImage?(d(),t(`span`,It,u(e.$t(`seedance.name.required`)),1)):h(``,!0),o(p,{content:e.$t(`seedance.description.firstFrame`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var Rt=U(jt,[[`render`,Lt],[`__scopeId`,`data-v-e2597f23`]]),zt=r({name:`SeedanceLastFrameImage`,components:{ElUpload:S,ElButton:y,ImagePreview:Y,InfoIcon:X,FontAwesomeIcon:J},mixins:[G,q],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsLastFrame"(e){e||(this.fileList=[],this.onSetLastFrameUrl())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetLastFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`last_frame`);e&&t.push({url:e,role:`last_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetLastFrameUrl()},async onRemove(){this.onSetLastFrameUrl()}}}),Bt={key:0,class:`relative`},Vt={class:`flex justify-between`},Ht={class:`flex justify-start items-center`},Ut={class:`text-sm font-bold`};function Wt(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return e.capability.acceptsLastFrame?(d(),t(`div`,Bt,[n(`div`,Vt,[n(`div`,Ht,[n(`span`,Ut,u(e.$t(`seedance.name.lastFrame`)),1),o(p,{content:e.$t(`seedance.description.lastFrame`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var Gt=U(zt,[[`render`,Wt],[`__scopeId`,`data-v-3a191e51`]]),Kt=r({name:`SeedanceReferenceImage`,components:{ElUpload:S,ElButton:y,InfoIcon:X,FontAwesomeIcon:J,ImagePreview:Y},mixins:[G,q],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceImage"(e){e||(this.fileList=[],this.onSetReferenceImageUrls())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetReferenceImageUrls(){let e=(this.urls||[]).filter(Boolean),t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`reference_image`);e.forEach(e=>t.push({url:e,role:`reference_image`})),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetReferenceImageUrls()},async onRemove(){this.onSetReferenceImageUrls()}}}),qt={key:0,class:`relative`},Jt={class:`flex justify-between`},Yt={class:`flex justify-start items-center`},Xt={class:`text-sm font-bold`};function Zt(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return e.capability.acceptsReferenceImage?(d(),t(`div`,qt,[n(`div`,Jt,[n(`div`,Yt,[n(`span`,Xt,u(e.$t(`seedance.name.referenceImage`)),1),o(p,{content:e.$t(`seedance.description.referenceImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var Qt=U(Kt,[[`render`,Zt],[`__scopeId`,`data-v-230a67f6`]]),$t=r({name:`SeedanceReferenceAudio`,components:{ElUpload:S,ElButton:y,InfoIcon:X,FontAwesomeIcon:J},mixins:[q],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceAudio"(e){e||(this.fileList=[],this.onSetReferenceAudios())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetReferenceAudios(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,audios:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceAudios()},async onRemove(){this.onSetReferenceAudios()}}}),en={key:0,class:`relative`},tn={class:`flex justify-between`},nn={class:`flex justify-start items-center`},rn={class:`text-sm font-bold`};function an(e,r,a,s,c,l){let f=g(`info-icon`),p=g(`font-awesome-icon`),m=g(`el-button`),v=g(`el-upload`);return e.capability.acceptsReferenceAudio?(d(),t(`div`,en,[n(`div`,tn,[n(`div`,nn,[n(`span`,rn,u(e.$t(`seedance.name.referenceAudio`)),1),o(f,{content:e.$t(`seedance.description.referenceAudio`)},null,8,[`content`])])]),o(v,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.mp3,.wav,.m4a,.aac,.ogg,.flac`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`text`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{default:_(()=>[o(m,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(p,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var on=U($t,[[`render`,an],[`__scopeId`,`data-v-49515675`]]),sn=r({name:`SeedanceReferenceVideo`,components:{ElUpload:S,ElButton:y,InfoIcon:X,FontAwesomeIcon:J},mixins:[q],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceVideo"(e){e||(this.fileList=[],this.onSetReferenceVideos())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetReferenceVideos(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,videos:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceVideos()},async onRemove(){this.onSetReferenceVideos()}}}),cn={key:0,class:`relative`},ln={class:`flex justify-between`},un={class:`flex justify-start items-center`},dn={class:`text-sm font-bold`};function fn(e,r,a,s,c,l){let f=g(`info-icon`),p=g(`font-awesome-icon`),m=g(`el-button`),v=g(`el-upload`);return e.capability.acceptsReferenceVideo?(d(),t(`div`,cn,[n(`div`,ln,[n(`div`,un,[n(`span`,dn,u(e.$t(`seedance.name.referenceVideo`)),1),o(f,{content:e.$t(`seedance.description.referenceVideo`)},null,8,[`content`])])]),o(v,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.mp4,.mov,.webm,.mkv,.avi`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`text`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{default:_(()=>[o(m,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(p,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var pn=U(sn,[[`render`,fn],[`__scopeId`,`data-v-b212c474`]]),mn=r({name:`SeedanceServiceTierSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:X},data(){return{options:[{value:de,label:this.$t(`seedance.serviceTier.default`)},{value:I,label:this.$t(`seedance.serviceTier.flex`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.service_tier},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,service_tier:e})}}},mounted(){this.value||=ae}}),hn={class:`field`},gn={class:`label`},_n={class:`box`},vn={class:`title font-bold`};function yn(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,hn,[n(`div`,gn,[n(`div`,_n,[n(`h2`,vn,u(r.$t(`seedance.name.serviceTier`)),1),o(m,{content:r.$t(`seedance.description.serviceTier`),class:`info`},null,8,[`content`])])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedance.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var bn=U(mn,[[`render`,yn],[`__scopeId`,`data-v-cc938de2`]]),xn=r({name:`SeedanceReturnLastFrameSwitch`,components:{ElSwitch:O,InfoIcon:X},computed:{model(){return this.$store.state.seedance?.config?.model},isSupported(){return M(this.model).acceptsReturnLastFrame},value:{get(){return this.$store.state.seedance?.config?.return_last_frame},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,return_last_frame:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),Sn={key:0,class:`field`},Cn={class:`label`},wn={class:`box`},Tn={class:`title font-bold`},En={class:`value`};function Dn(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return e.isSupported?(d(),t(`div`,Sn,[n(`div`,Cn,[n(`div`,wn,[n(`h2`,Tn,u(e.$t(`seedance.name.returnLastFrame`)),1),o(l,{content:e.$t(`seedance.description.returnLastFrame`),class:`info`},null,8,[`content`])])]),n(`div`,En,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"inline-prompt":``,"active-text":e.$t(`seedance.button.on`),"inactive-text":e.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):h(``,!0)}var On=U(xn,[[`render`,Dn],[`__scopeId`,`data-v-edea5451`]]),kn=r({name:`SeedanceSeedInput`,components:{ElInputNumber:D,InfoIcon:X},computed:{value:{get(){let e=this.$store.state.seedance?.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.$store.state.seedance?.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedance/setConfig`,t)}}}}),An={class:`field`},jn={class:`label`},Mn={class:`box`},Nn={class:`title font-bold`},Pn={class:`value`};function Fn(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-input-number`);return d(),t(`div`,An,[n(`div`,jn,[n(`div`,Mn,[n(`h2`,Nn,u(e.$t(`seedance.name.seed`)),1),o(l,{content:e.$t(`seedance.description.seed`),class:`info`},null,8,[`content`])])]),n(`div`,Pn,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])}var In=r({name:`SeedanceConfigPanel`,components:{ElButton:y,FontAwesomeIcon:J,PromptInput:Fe,ModelSelector:He,DurationSelector:Ye,ResolutionSelector:rt,RatioSelector:mt,GenerateAudioSwitch:St,CameraFixedSwitch:At,ServiceTierSelector:bn,ReturnLastFrameSwitch:On,SeedInput:U(kn,[[`render`,Fn],[`__scopeId`,`data-v-685a9869`]]),FirstFrameImage:Rt,LastFrameImage:Gt,ReferenceImage:Qt,ReferenceAudio:on,ReferenceVideo:pn,Consumption:ye},emits:[`generate`],computed:{config(){return this.$store.state.seedance?.config},consumption(){return me(this.config,this.service?.cost)},service(){return this.$store.state.seedance?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ln={class:`flex flex-col h-full`},Rn={class:`flex-1 overflow-y-auto p-5`},zn={class:`flex flex-col items-center justify-center px-5 pb-5`};function Bn(e,r,a,s,c,l){let f=g(`prompt-input`),p=g(`model-selector`),m=g(`ratio-selector`),h=g(`resolution-selector`),v=g(`duration-selector`),y=g(`service-tier-selector`),b=g(`generate-audio-switch`),x=g(`camera-fixed-switch`),S=g(`return-last-frame-switch`),C=g(`seed-input`),w=g(`first-frame-image`),T=g(`last-frame-image`),E=g(`reference-image`),D=g(`reference-audio`),O=g(`reference-video`),k=g(`consumption`),A=g(`font-awesome-icon`),j=g(`el-button`);return d(),t(`div`,Ln,[n(`div`,Rn,[o(f,{class:`mb-4`}),o(p,{class:`mb-4`}),o(m,{class:`mb-4`}),o(h,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`}),o(b,{class:`mb-4`}),o(x,{class:`mb-4`}),o(S,{class:`mb-4`}),o(C,{class:`mb-4`}),o(w,{class:`mb-2`}),o(T,{class:`mb-2`}),o(E,{class:`mb-2`}),o(D,{class:`mb-2`}),o(O,{class:`mb-2`})]),n(`div`,zn,[o(k,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(j,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:_(()=>[o(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`seedance.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Vn=U(In,[[`render`,Bn]]),Hn=r({name:`AudioPreview`,components:{FontAwesomeIcon:J},props:{url:{type:String,required:!0},name:{type:String,required:!1,default:`audio`}},data(){return{playing:!1}},methods:{onToggle(){let e=this.$refs.audio;e&&(e.paused?e.play().catch(()=>{this.playing=!1}):e.pause())}}}),Un=[`title`],Wn=[`src`];function Gn(e,r,i,a,s,c){let l=g(`font-awesome-icon`);return d(),t(`div`,{class:`audio-preview w-[50px] h-[50px] relative rounded-[var(--el-border-radius-base)] overflow-hidden shadow-sm cursor-pointer flex items-center justify-center`,title:e.name,onClick:r[3]||=f((...t)=>e.onToggle&&e.onToggle(...t),[`stop`])},[o(l,{icon:e.playing?`fa-solid fa-pause`:`fa-solid fa-music`,class:`icon text-white text-[16px]`},null,8,[`icon`]),n(`audio`,{ref:`audio`,src:e.url,preload:`none`,onPlay:r[0]||=t=>e.playing=!0,onPause:r[1]||=t=>e.playing=!1,onEnded:r[2]||=t=>e.playing=!1},null,40,Wn)],8,Un)}var Kn=U(Hn,[[`render`,Gn],[`__scopeId`,`data-v-66cf67f6`]]),qn=r({name:`VideoPreview`,components:{ElDialog:B,FontAwesomeIcon:J,VideoPlayer:Z},props:{url:{type:String,required:!0},name:{type:String,required:!1,default:`video`}},data(){return{open:!1}}}),Jn=[`title`],Yn=[`src`],Xn={class:`overlay absolute inset-0 flex items-center justify-center bg-[rgba(0,0,0,0.25)]`};function Zn(e,r,i,a,s,c){let l=g(`font-awesome-icon`),u=g(`video-player`),p=g(`el-dialog`);return d(),t(`div`,{class:`video-preview w-[50px] h-[50px] relative rounded-[var(--el-border-radius-base)] overflow-hidden shadow-sm cursor-pointer bg-[var(--el-fill-color-darker)]`,title:e.name,onClick:r[2]||=f(t=>e.open=!0,[`stop`])},[n(`video`,{class:`w-full h-full object-cover`,src:`${e.url}#t=0.1`,muted:``,preload:`metadata`,playsinline:``},null,8,Yn),n(`div`,Xn,[o(l,{icon:`fa-solid fa-play`,class:`text-white text-[14px]`})]),o(p,{modelValue:e.open,"onUpdate:modelValue":r[0]||=t=>e.open=t,width:`640`,"align-center":``,"append-to-body":``,"destroy-on-close":``,class:`video-preview-dialog`,onClick:r[1]||=f(()=>{},[`stop`])},{default:_(()=>[o(u,{src:e.url},null,8,[`src`])]),_:1},8,[`modelValue`])],8,Jn)}var Qn=r({name:`SeedanceTaskPreview`,components:{ElImage:w,CopyToClipboard:_e,FontAwesomeIcon:J,ElAlert:T,VideoPlayer:Z,ElTooltip:C,ElButton:y,ImageWrapper:Ee,ImagePreview:Y,AudioPreview:Kn,VideoPreview:U(qn,[[`render`,Zn],[`__scopeId`,`data-v-d4752590`]]),ApiCodeButton:Se},props:{modelValue:{type:Object,required:!0}},data(){return{seedanceLogo:j}},computed:{video(){return this.modelValue?.response?.data},promptText(){let e=this.modelValue?.request;if(e?.prompt)return e.prompt;let t=e?.content?.find(e=>e?.type===`text`&&e?.text);return t?.text?t.text:this.video?.prompt},referenceImages(){let e=this.collectImages();if(e.length===0)return[];let t=[],n=e.find(e=>e?.role===`first_frame`);n?.url&&t.push({url:n.url,name:`first-frame`});let r=e.find(e=>e?.role===`last_frame`);return r?.url&&t.push({url:r.url,name:`last-frame`}),e.forEach((e,n)=>{e?.url&&e.role!==`first_frame`&&e.role!==`last_frame`&&t.push({url:e.url,name:e.role||`image-${n}`})}),t},referenceAudios(){let e=this.modelValue?.request,t=(e?.audios??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`audio_url`&&e?.audio_url?.url&&t.push(e.audio_url.url)}),t},referenceVideos(){let e=this.modelValue?.request,t=(e?.videos??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`video_url`&&e?.video_url?.url&&t.push(e.video_url.url)}),t}},methods:{collectImages(){let e=this.modelValue?.request,t=Array.isArray(e?.images)?[...e.images]:[];return(e?.content??[]).forEach(e=>{e?.type===`image_url`&&e?.image_url?.url&&t.push({url:e.image_url.url,role:e.role})}),t},onDownload(e){window.open(e,`_blank`)}}}),$n={class:`preview`},er={class:`left`},tr={class:`main`},nr={class:`bot`},rr={class:`datetime`},ir={class:`info`},ar={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},or={key:1,class:`prompt mt-2`},sr={key:0},cr={key:1},lr={key:0,class:l({content:!0})},ur={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},dr={key:1,class:l({content:!0})},fr={key:0,class:`mb-4`},pr={key:1,class:`mb-4`},mr={key:2,class:l({operations:!0,"mt-2":!0,"mb-2":!0})},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gr={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_r={key:0},vr={key:1},yr={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},br={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xr={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Sr={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Cr={key:2,class:l({content:!0})},wr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Er={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dr={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Or={key:3,class:l({content:!0})},kr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ar={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function jr(r,c,l,p,m,v){let y=g(`el-image`),b=g(`image-preview`),x=g(`audio-preview`),S=g(`video-preview`),C=g(`font-awesome-icon`),w=g(`copy-to-clipboard`),T=g(`el-alert`),E=g(`video-player`),D=g(`image-wrapper`),O=g(`el-button`),k=g(`el-tooltip`),A=g(`api-code-button`);return d(),t(`div`,$n,[n(`div`,er,[o(y,{src:r.seedanceLogo,class:`avatar`},null,8,[`src`])]),n(`div`,tr,[n(`div`,nr,[i(u(r.$t(`seedance.name.seedanceBot`))+` `,1),n(`span`,rr,u(r.$dayjs.format(``+new Date(parseFloat((r.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,ir,[r.referenceImages.length>0||r.referenceAudios.length>0||r.referenceVideos.length>0?(d(),t(`div`,ar,[(d(!0),t(s,null,e(r.referenceImages,(e,t)=>(d(),a(b,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(d(!0),t(s,null,e(r.referenceAudios,(e,t)=>(d(),a(x,{key:`audio-${t}`,url:e,name:`audio-${t+1}`},null,8,[`url`,`name`]))),128)),(d(!0),t(s,null,e(r.referenceVideos,(e,t)=>(d(),a(S,{key:`video-${t}`,url:e,name:`video-${t+1}`},null,8,[`url`,`name`]))),128))])):h(``,!0),r.promptText?(d(),t(`p`,or,[i(u(r.promptText)+` `,1),r.modelValue?.response?r.video?.status===`processing`||r.video?.status===`pending`?(d(),t(`span`,cr,` - (`+u(r.$t(`seedance.status.processing`))+`) `,1)):h(``,!0):(d(),t(`span`,sr,` - (`+u(r.$t(`seedance.status.pending`))+`) `,1))])):h(``,!0)]),r.modelValue?.response?r.modelValue?.response?.success===!0?(d(),t(`div`,dr,[r.video?.video_url?(d(),t(`div`,fr,[o(E,{src:r.video?.video_url},null,8,[`src`])])):h(``,!0),r.video?.last_frame_url?(d(),t(`div`,pr,[o(D,{src:r.video?.last_frame_url,"raw-src":r.video?.last_frame_url},null,8,[`src`,`raw-src`])])):h(``,!0),r.video?.video_url?(d(),t(`div`,mr,[o(k,{class:`box-item`,effect:`dark`,content:r.$t(`seedance.message.downloadVideo`),placement:`top-start`},{default:_(()=>[o(O,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=f(e=>r.onDownload(r.video?.video_url),[`stop`])},{default:_(()=>[i(u(r.$t(`seedance.button.download`)),1)]),_:1})]),_:1},8,[`content`]),o(A,{path:`/seedance/videos`,body:r.modelValue?.request},null,8,[`body`])])):h(``,!0),o(T,{closable:!1,class:`mt-2 success`},{default:_(()=>[r.modelValue?.request?.model?(d(),t(`p`,$,[o(C,{icon:`fa-solid fa-cube`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.model`))+`: `+u(r.modelValue?.request?.model),1)])):h(``,!0),r.video?.duration?(d(),t(`p`,hr,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.duration`))+`: `+u(r.video?.duration)+`s `,1)])):h(``,!0),r.video?.resolution?(d(),t(`p`,gr,[o(C,{icon:`fa-solid fa-expand`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.resolution`))+`: `+u(r.video?.resolution)+` `,1),r.video?.ratio?(d(),t(`span`,_r,` · `+u(r.video?.ratio),1)):h(``,!0),r.video?.framespersecond?(d(),t(`span`,vr,` · `+u(r.video?.framespersecond)+`fps`,1)):h(``,!0)])):h(``,!0),r.modelValue?.request?.generate_audio?(d(),t(`p`,yr,[o(C,{icon:`fa-solid fa-volume-up`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.generateAudio`))+`: `+u(r.$t(`seedance.button.on`)),1)])):h(``,!0),n(`p`,br,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.elapsed?(d(),t(`p`,xr,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0),r.modelValue?.response?.trace_id?(d(),t(`p`,Sr,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(w,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0)]),_:1})])):r.modelValue?.response?.success===!1?(d(),t(`div`,Cr,[o(T,{closable:!1,class:`failure`},{template:_(()=>[o(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.failure`)),1)]),default:_(()=>[n(`p`,wr,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.response?.error?.message?(d(),t(`p`,Tr,[o(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.failureReason`))+`: `+u(r.modelValue?.response?.error?.message)+` `,1),o(w,{content:r.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0),r.modelValue?.elapsed?(d(),t(`p`,Er,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0),r.modelValue?.response?.trace_id?(d(),t(`p`,Dr,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(w,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0)]),_:1})])):(d(),t(`div`,Or,[o(T,{closable:!1,class:`info`},{template:_(()=>[o(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.status`)),1)]),default:_(()=>[n(`p`,kr,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.response?.trace_id?(d(),t(`p`,Ar,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(w,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0)]),_:1})])):(d(),t(`div`,lr,[o(T,{closable:!1,class:`info`},{template:_(()=>[o(C,{icon:`fa-regular fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.status.pending`)),1)]),default:_(()=>[n(`p`,ur,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var Mr=r({name:`SeedanceRecentPanel`,components:{TaskPreview:U(Qn,[[`render`,jr],[`__scopeId`,`data-v-be65e8a9`]]),BotPlaceholder:Ce,NoTasks:we,ScrollList:be},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedance?.tasks,items:this.$store.state.seedance?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Nr={key:0},Pr={key:2,class:`w-full h-full flex items-center justify-center`};function Fr(n,r,i,c,l,u){let f=g(`bot-placeholder`),p=g(`task-preview`),m=g(`scroll-list`),v=g(`no-tasks`);return d(),t(s,null,[n.tasks?.items===void 0?(d(),t(`div`,Nr,[o(f)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(d(),a(m,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:_(()=>[(d(!0),t(s,null,e(n.tasks?.items,e=>(d(),a(p,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):h(``,!0),n.tasks?.items?.length===0?(d(),t(`div`,Pr,[o(v)])):h(``,!0)],64)}var Ir=r({name:`SeedanceIndex`,components:{ConfigPanel:Vn,Layout:Me,RecentPanel:U(Mr,[[`render`,Fr]])},mixins:[z],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.seedance?.status?.getApplications===W.Request},tasksLoading(){return this.$store.state.seedance?.status?.getTasks===W.Request||this.fetchingTasks},credential(){return this.$store.state.seedance?.credential},config(){return this.$store.state.seedance?.config},tasks(){return this.$store.state.seedance?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await xe({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`seedance/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`seedance/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!pe(this.uploadTracker,e=>this.$t(e),e=>K.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.images)){e.images=e.images.filter(e=>!!e?.url);let t=e.images.some(e=>e?.role===`first_frame`),n=e.images.some(e=>e?.role===`last_frame`);!t&&n&&(e.images=e.images.map(e=>e?.role===`last_frame`?{...e,role:`first_frame`}:e))}let t=Array.isArray(e?.images)&&e.images.length>0;if(!t&&`images`in e&&delete e.images,e?.model&&!le[e.model]){K.warning(this.$t(`seedance.message.modelUnsupported`));return}let n=M(e?.model);if(n.requiresImage&&!t){K.warning(this.$t(`seedance.message.modelRequiresImage`));return}if(!n.acceptsImage&&t){K.warning(this.$t(`seedance.message.modelRejectsImage`));return}if(!n.acceptsText&&!t){K.warning(this.$t(`seedance.message.modelRequiresImage`));return}!n.acceptsAudio&&e.generate_audio&&(e.generate_audio=!1),!n.acceptsReturnLastFrame&&e.return_last_frame&&(e.return_last_frame=!1),!n.acceptsLastFrame&&t&&(e.images=e.images.filter(e=>e?.role!==`last_frame`)),n.acceptsReferenceAudio&&Array.isArray(e?.audios)&&(e.audios=e.audios.filter(e=>e?.url)),(!n.acceptsReferenceAudio||!Array.isArray(e?.audios)||e.audios.length===0)&&delete e.audios,n.acceptsReferenceVideo&&Array.isArray(e?.videos)&&(e.videos=e.videos.filter(e=>e?.url)),(!n.acceptsReferenceVideo||!Array.isArray(e?.videos)||e.videos.length===0)&&delete e.videos,!n.acceptsReferenceImage&&Array.isArray(e?.images)&&(e.images=e.images.filter(e=>e?.role!==`reference_image`),e.images.length===0&&delete e.images);let r=Array.isArray(e?.images)&&e.images.some(e=>e?.role===`reference_image`);if(Array.isArray(e?.audios)&&e.audios.length>0&&!r){K.warning(this.$t(`seedance.message.audioRequiresReferenceImage`));return}let i={...e,async:!0};if(!he())return;let a=this.credential?.token;if(!a){console.error(`no token specified`);return}K.info(this.$t(`seedance.message.startingTask`)),V(`seedance`,ge.generate(i,{token:a})).then(()=>{K.success(this.$t(`seedance.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?K.error(this.$t(`seedance.message.usedUp`)):K.error(this.$t(`seedance.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Lr(e,t,n,r,i,s){let c=g(`config-panel`),l=g(`recent-panel`),u=g(`layout`);return d(),a(u,null,{config:_(()=>[o(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:_(()=>[o(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Rr=U(Ir,[[`render`,Lr]]);export{Rr as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Ut as c,Vt as l,Wt as u,Z as d,b as f,dt as p,et as m,k as h,tt as g,ut as _,v}from"./vendor-chart-BJCvKk8-.js";import{t as y}from"./button-BydTr5nV.js";import{r as b,t as x}from"./select-D3xXGtAg.js";import{t as S}from"./upload-izq5b45N.js";import{t as C}from"./tooltip-ivBOvVK_.js";import{t as w}from"./image-98SuLK5-.js";import{t as T}from"./alert-C51owb6L.js";import{t as E}from"./drawer-Aw9IMZFK.js";import{t as D}from"./input-number-B6BEZroj.js";import{t as O}from"./switch-BKuYGnPZ.js";import{$t as k,Gt as A,Ht as j,Jt as ee,Kt as te,Qt as ne,Rt as re,Ut as ie,Vt as ae,Wt as oe,Xt as se,Yt as ce,Zt as le,cn as M,en as ue,in as N,nn as P,on as de,qt as fe,rn as F,sn as I,tn as L,zt as R}from"./constants-D5XSekB2.js";import{Bt as z,Hr as B,Jn as V,Lr as H,O as U,Pr as W,Rt as pe,Ut as me,Vt as G,Zt as he,un as ge,zr as K,zt as q}from"./index-BRkE9zIu.js";import{t as J}from"./index.es-Dw0M6NcN.js";import{t as _e}from"./CopyToClipboard-DFQ4IOLO.js";import{t as Y}from"./ImagePreview-w1XgTsO0.js";import{n as ve}from"./taskDrawerMixin-DEgO_R5H.js";import{t as ye}from"./Consumption-C9jb4ANC.js";import{i as X,n as be,t as xe}from"./pagination-B_40M0as.js";import{t as Z}from"./VideoPlayer-CtxypgMD.js";import{t as Se}from"./ApiCodeButton-CEvOQHRz.js";import{t as Ce}from"./BotPlaceholder-CueTGOF1.js";import{t as we}from"./NoTasks-BLkIrpVk.js";import{t as Te}from"./PromptTextarea-DfG4xE4f.js";import{t as Ee}from"./ImageWrapper-CkAQcRG3.js";var De=r({name:`LayoutSeedance`,components:{ElDrawer:E,ElButton:y,FontAwesomeIcon:J},mixins:[ve]}),Oe={class:`main flex flex-row flex-1`},ke={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function je(e,r,i,a,s,c){let l=g(`font-awesome-icon`),u=g(`el-button`),f=g(`el-drawer`);return d(),t(`div`,Oe,[n(`div`,ke,[m(e.$slots,`config`,{},void 0,!0)]),n(`div`,Ae,[m(e.$slots,`result`,{},void 0,!0)]),p(o(u,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:_(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[v,!e.tasksEmpty]]),o(f,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`350px`},{default:_(()=>[m(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Me=U(De,[[`render`,je],[`__scopeId`,`data-v-ec312952`]]),Ne=r({name:`SeedancePromptInput`,components:{PromptTextarea:Te},computed:{prompt:{get(){return this.$store.state.seedance?.config?.prompt},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Pe(e,t,n,r,i,o){let s=g(`prompt-textarea`);return d(),a(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedance.name.prompt`),info:e.$t(`seedance.description.prompt`),placeholder:e.$t(`seedance.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Fe=U(Ne,[[`render`,Pe]]),Ie=r({name:`SeedanceModelSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:X},data(){return{options:[{value:ee,label:this.$t(`seedance.model.seedance20`)},{value:ce,label:this.$t(`seedance.model.seedance20Fast`)},{value:se,label:this.$t(`seedance.model.seedance20Mini`)},{value:fe,label:this.$t(`seedance.model.seedance15pro`)},{value:A,label:this.$t(`seedance.model.seedance10pro`)},{value:te,label:this.$t(`seedance.model.seedance10proFast`)},{value:oe,label:this.$t(`seedance.model.seedance10liteT2v`)},{value:ie,label:this.$t(`seedance.model.seedance10liteI2v`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.model},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,model:e})}}},mounted(){this.value||=re}}),Le={class:`field`},Re={class:`label`},ze={class:`box`},Be={class:`title font-bold`};function Ve(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,Le,[n(`div`,Re,[n(`div`,ze,[n(`h2`,Be,u(r.$t(`seedance.name.model`)),1),o(m,{content:r.$t(`seedance.description.model`),class:`info`},null,8,[`content`])])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedance.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var He=U(Ie,[[`render`,Ve],[`__scopeId`,`data-v-deb4c429`]]),Ue=r({name:`SeedanceDurationSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:X},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},options(){let e=[];for(let t=this.capability.minDuration;t<=this.capability.maxDuration;t++)e.push({value:t,label:`${t}s`});return e},value:{get(){return this.$store.state.seedance?.config?.duration},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,duration:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=5},methods:{clampValue(){let e=this.value;e!==void 0&&(e<this.capability.minDuration||e>this.capability.maxDuration)&&(this.value=5)}}}),We={class:`field`},Ge={class:`label`},Ke={class:`box`},qe={class:`title font-bold`};function Je(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,We,[n(`div`,Ge,[n(`div`,Ke,[n(`h2`,qe,u(r.$t(`seedance.name.duration`)),1),o(m,{content:r.$t(`seedance.description.duration`),class:`info`},null,8,[`content`])])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedance.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ye=U(Ue,[[`render`,Je],[`__scopeId`,`data-v-216def8f`]]),Q={[F]:0,[N]:1,[P]:2,"4k":3},Xe=r({name:`SeedanceResolutionSelector`,components:{InfoIcon:X,ElTooltip:C},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},options(){let e=[{value:F,label:`480p`},{value:N,label:`720p`},{value:P,label:`1080p`},{value:`4k`,label:`4k`}],t=Q[this.capability.maxResolution]??Q[`1080p`];return e.map(e=>({...e,disabled:Q[e.value]>t}))},value:{get(){return this.$store.state.seedance?.config?.resolution},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,resolution:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=this.capability.defaultResolution||`720p`},methods:{onSelect(e){e.disabled||(this.value=e.value)},clampValue(){let e=this.value,t=this.options.find(t=>t.value===e);(!e||t&&t.disabled)&&(this.value=this.capability.defaultResolution||`720p`)}}}),Ze={class:`resolution`},Qe={class:`header`},$e={class:`title font-bold`},et={class:`items`},tt=[`onClick`];function nt(r,i,c,f,p,m){let h=g(`info-icon`),v=g(`el-tooltip`);return d(),t(`div`,Ze,[n(`div`,Qe,[n(`h2`,$e,u(r.$t(`seedance.name.resolution`)),1),o(h,{content:r.$t(`seedance.description.resolution`),class:`info`},null,8,[`content`])]),n(`div`,et,[(d(!0),t(s,null,e(r.options,e=>(d(),a(v,{key:e.value,content:r.$t(`seedance.message.resolutionNotSupported`),disabled:!e.disabled,placement:`top`},{default:_(()=>[n(`div`,{class:l([`item`,{active:r.value===e.value,disabled:e.disabled}]),onClick:t=>r.onSelect(e)},u(e.label),11,tt)]),_:2},1032,[`content`,`disabled`]))),128))])])}var rt=U(Xe,[[`render`,nt],[`__scopeId`,`data-v-db7e8aff`]]),it=r({name:`SeedanceRatioSelector`,components:{InfoIcon:X},computed:{options(){return[{value:ne,label:`16:9`,w:32,h:18},{value:ue,label:`9:16`,w:18,h:32},{value:`4:3`,label:`4:3`,w:28,h:21},{value:`3:4`,label:`3:4`,w:21,h:28},{value:`1:1`,label:`1:1`,w:24,h:24},{value:k,label:`21:9`,w:34,h:14},{value:L,label:this.$t(`seedance.ratio.adaptive`),w:0,h:0}]},value:{get(){return this.$store.state.seedance?.config?.ratio},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,ratio:e})}}},mounted(){this.value||=R}}),at={class:`ratio`},ot={class:`header`},st={class:`title font-bold`},ct={class:`items`},lt=[`onClick`],ut={class:`preview`},dt={key:1,class:`rect rect-auto`},ft={class:`name`};function pt(r,i,a,f,p,m){let h=g(`info-icon`);return d(),t(`div`,at,[n(`div`,ot,[n(`h2`,st,u(r.$t(`seedance.name.ratio`)),1),o(h,{content:r.$t(`seedance.description.ratio`),class:`info`},null,8,[`content`])]),n(`div`,ct,[(d(!0),t(s,null,e(r.options,e=>(d(),t(`div`,{key:e.value,class:l([`item`,{active:r.value===e.value}]),onClick:t=>r.value=e.value},[n(`div`,ut,[e.w&&e.h?(d(),t(`div`,{key:0,class:`rect`,style:c({width:e.w+`px`,height:e.h+`px`})},null,4)):(d(),t(`div`,dt,`A`))]),n(`div`,ft,u(e.label),1)],10,lt))),128))])])}var mt=U(it,[[`render`,pt],[`__scopeId`,`data-v-8ddec2dd`]]),ht=r({name:`SeedanceGenerateAudioSwitch`,components:{ElSwitch:O,InfoIcon:X},computed:{isSupported(){let e=this.$store.state.seedance?.config?.model;return M(e).acceptsAudio},value:{get(){return this.$store.state.seedance?.config?.generate_audio??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,generate_audio:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),gt={key:0,class:`field`},_t={class:`label`},vt={class:`box`},yt={class:`title font-bold`},bt={class:`value`};function xt(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return e.isSupported?(d(),t(`div`,gt,[n(`div`,_t,[n(`div`,vt,[n(`h2`,yt,u(e.$t(`seedance.name.generateAudio`)),1),o(l,{content:e.$t(`seedance.description.generateAudio`),class:`info`},null,8,[`content`])])]),n(`div`,bt,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"inline-prompt":``,"active-text":e.$t(`seedance.button.on`),"inactive-text":e.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):h(``,!0)}var St=U(ht,[[`render`,xt],[`__scopeId`,`data-v-df51dfbd`]]),Ct=r({name:`SeedanceCameraFixedSwitch`,components:{ElSwitch:O,InfoIcon:X},computed:{value:{get(){return this.$store.state.seedance?.config?.camerafixed??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,camerafixed:e})}}},mounted(){this.$store.state.seedance?.config?.camerafixed===void 0&&(this.value=!1)}}),wt={class:`field`},Tt={class:`label`},Et={class:`box`},Dt={class:`title font-bold`},Ot={class:`value`};function kt(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return d(),t(`div`,wt,[n(`div`,Tt,[n(`div`,Et,[n(`h2`,Dt,u(e.$t(`seedance.name.cameraFixed`)),1),o(l,{content:e.$t(`seedance.description.cameraFixed`),class:`info`},null,8,[`content`])])]),n(`div`,Ot,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"inline-prompt":``,"active-text":e.$t(`seedance.button.on`),"inactive-text":e.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])}var At=U(Ct,[[`render`,kt],[`__scopeId`,`data-v-ae777d61`]]),jt=r({name:`SeedanceFirstFrameImage`,components:{ElUpload:S,ElButton:y,InfoIcon:X,FontAwesomeIcon:J,ImagePreview:Y},mixins:[G,q],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsImage"(e){e||(this.fileList=[],this.onSetFirstFrameUrl())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetFirstFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`first_frame`);e&&t.push({url:e,role:`first_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetFirstFrameUrl()},async onRemove(){this.onSetFirstFrameUrl()}}}),Mt={key:0,class:`relative`},Nt={class:`flex justify-between`},Pt={class:`flex justify-start items-center`},Ft={class:`text-sm font-bold`},It={key:0,class:`required-badge`};function Lt(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return e.capability.acceptsImage?(d(),t(`div`,Mt,[n(`div`,Nt,[n(`div`,Pt,[n(`span`,Ft,u(e.$t(`seedance.name.firstFrame`)),1),e.capability.requiresImage?(d(),t(`span`,It,u(e.$t(`seedance.name.required`)),1)):h(``,!0),o(p,{content:e.$t(`seedance.description.firstFrame`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var Rt=U(jt,[[`render`,Lt],[`__scopeId`,`data-v-e2597f23`]]),zt=r({name:`SeedanceLastFrameImage`,components:{ElUpload:S,ElButton:y,ImagePreview:Y,InfoIcon:X,FontAwesomeIcon:J},mixins:[G,q],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsLastFrame"(e){e||(this.fileList=[],this.onSetLastFrameUrl())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetLastFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`last_frame`);e&&t.push({url:e,role:`last_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetLastFrameUrl()},async onRemove(){this.onSetLastFrameUrl()}}}),Bt={key:0,class:`relative`},Vt={class:`flex justify-between`},Ht={class:`flex justify-start items-center`},Ut={class:`text-sm font-bold`};function Wt(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return e.capability.acceptsLastFrame?(d(),t(`div`,Bt,[n(`div`,Vt,[n(`div`,Ht,[n(`span`,Ut,u(e.$t(`seedance.name.lastFrame`)),1),o(p,{content:e.$t(`seedance.description.lastFrame`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var Gt=U(zt,[[`render`,Wt],[`__scopeId`,`data-v-3a191e51`]]),Kt=r({name:`SeedanceReferenceImage`,components:{ElUpload:S,ElButton:y,InfoIcon:X,FontAwesomeIcon:J,ImagePreview:Y},mixins:[G,q],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceImage"(e){e||(this.fileList=[],this.onSetReferenceImageUrls())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetReferenceImageUrls(){let e=(this.urls||[]).filter(Boolean),t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`reference_image`);e.forEach(e=>t.push({url:e,role:`reference_image`})),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetReferenceImageUrls()},async onRemove(){this.onSetReferenceImageUrls()}}}),qt={key:0,class:`relative`},Jt={class:`flex justify-between`},Yt={class:`flex justify-start items-center`},Xt={class:`text-sm font-bold`};function Zt(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return e.capability.acceptsReferenceImage?(d(),t(`div`,qt,[n(`div`,Jt,[n(`div`,Yt,[n(`span`,Xt,u(e.$t(`seedance.name.referenceImage`)),1),o(p,{content:e.$t(`seedance.description.referenceImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var Qt=U(Kt,[[`render`,Zt],[`__scopeId`,`data-v-230a67f6`]]),$t=r({name:`SeedanceReferenceAudio`,components:{ElUpload:S,ElButton:y,InfoIcon:X,FontAwesomeIcon:J},mixins:[q],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceAudio"(e){e||(this.fileList=[],this.onSetReferenceAudios())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetReferenceAudios(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,audios:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceAudios()},async onRemove(){this.onSetReferenceAudios()}}}),en={key:0,class:`relative`},tn={class:`flex justify-between`},nn={class:`flex justify-start items-center`},rn={class:`text-sm font-bold`};function an(e,r,a,s,c,l){let f=g(`info-icon`),p=g(`font-awesome-icon`),m=g(`el-button`),v=g(`el-upload`);return e.capability.acceptsReferenceAudio?(d(),t(`div`,en,[n(`div`,tn,[n(`div`,nn,[n(`span`,rn,u(e.$t(`seedance.name.referenceAudio`)),1),o(f,{content:e.$t(`seedance.description.referenceAudio`)},null,8,[`content`])])]),o(v,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.mp3,.wav,.m4a,.aac,.ogg,.flac`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`text`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{default:_(()=>[o(m,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(p,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var on=U($t,[[`render`,an],[`__scopeId`,`data-v-49515675`]]),sn=r({name:`SeedanceReferenceVideo`,components:{ElUpload:S,ElButton:y,InfoIcon:X,FontAwesomeIcon:J},mixins:[q],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return M(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceVideo"(e){e||(this.fileList=[],this.onSetReferenceVideos())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetReferenceVideos(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,videos:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceVideos()},async onRemove(){this.onSetReferenceVideos()}}}),cn={key:0,class:`relative`},ln={class:`flex justify-between`},un={class:`flex justify-start items-center`},dn={class:`text-sm font-bold`};function fn(e,r,a,s,c,l){let f=g(`info-icon`),p=g(`font-awesome-icon`),m=g(`el-button`),v=g(`el-upload`);return e.capability.acceptsReferenceVideo?(d(),t(`div`,cn,[n(`div`,ln,[n(`div`,un,[n(`span`,dn,u(e.$t(`seedance.name.referenceVideo`)),1),o(f,{content:e.$t(`seedance.description.referenceVideo`)},null,8,[`content`])])]),o(v,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.mp4,.mov,.webm,.mkv,.avi`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`text`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-remove":e.onRemove,headers:e.headers},{default:_(()=>[o(m,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(p,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):h(``,!0)}var pn=U(sn,[[`render`,fn],[`__scopeId`,`data-v-b212c474`]]),mn=r({name:`SeedanceServiceTierSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:X},data(){return{options:[{value:de,label:this.$t(`seedance.serviceTier.default`)},{value:I,label:this.$t(`seedance.serviceTier.flex`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.service_tier},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,service_tier:e})}}},mounted(){this.value||=ae}}),hn={class:`field`},gn={class:`label`},_n={class:`box`},vn={class:`title font-bold`};function yn(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,hn,[n(`div`,gn,[n(`div`,_n,[n(`h2`,vn,u(r.$t(`seedance.name.serviceTier`)),1),o(m,{content:r.$t(`seedance.description.serviceTier`),class:`info`},null,8,[`content`])])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`seedance.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var bn=U(mn,[[`render`,yn],[`__scopeId`,`data-v-cc938de2`]]),xn=r({name:`SeedanceReturnLastFrameSwitch`,components:{ElSwitch:O,InfoIcon:X},computed:{model(){return this.$store.state.seedance?.config?.model},isSupported(){return M(this.model).acceptsReturnLastFrame},value:{get(){return this.$store.state.seedance?.config?.return_last_frame},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,return_last_frame:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),Sn={key:0,class:`field`},Cn={class:`label`},wn={class:`box`},Tn={class:`title font-bold`},En={class:`value`};function Dn(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return e.isSupported?(d(),t(`div`,Sn,[n(`div`,Cn,[n(`div`,wn,[n(`h2`,Tn,u(e.$t(`seedance.name.returnLastFrame`)),1),o(l,{content:e.$t(`seedance.description.returnLastFrame`),class:`info`},null,8,[`content`])])]),n(`div`,En,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"inline-prompt":``,"active-text":e.$t(`seedance.button.on`),"inactive-text":e.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):h(``,!0)}var On=U(xn,[[`render`,Dn],[`__scopeId`,`data-v-edea5451`]]),kn=r({name:`SeedanceSeedInput`,components:{ElInputNumber:D,InfoIcon:X},computed:{value:{get(){let e=this.$store.state.seedance?.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.$store.state.seedance?.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedance/setConfig`,t)}}}}),An={class:`field`},jn={class:`label`},Mn={class:`box`},Nn={class:`title font-bold`},Pn={class:`value`};function Fn(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-input-number`);return d(),t(`div`,An,[n(`div`,jn,[n(`div`,Mn,[n(`h2`,Nn,u(e.$t(`seedance.name.seed`)),1),o(l,{content:e.$t(`seedance.description.seed`),class:`info`},null,8,[`content`])])]),n(`div`,Pn,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])}var In=r({name:`SeedanceConfigPanel`,components:{ElButton:y,FontAwesomeIcon:J,PromptInput:Fe,ModelSelector:He,DurationSelector:Ye,ResolutionSelector:rt,RatioSelector:mt,GenerateAudioSwitch:St,CameraFixedSwitch:At,ServiceTierSelector:bn,ReturnLastFrameSwitch:On,SeedInput:U(kn,[[`render`,Fn],[`__scopeId`,`data-v-685a9869`]]),FirstFrameImage:Rt,LastFrameImage:Gt,ReferenceImage:Qt,ReferenceAudio:on,ReferenceVideo:pn,Consumption:ye},emits:[`generate`],computed:{config(){return this.$store.state.seedance?.config},consumption(){return me(this.config,this.service?.cost)},service(){return this.$store.state.seedance?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ln={class:`flex flex-col h-full`},Rn={class:`flex-1 overflow-y-auto p-5`},zn={class:`flex flex-col items-center justify-center px-5 pb-5`};function Bn(e,r,a,s,c,l){let f=g(`prompt-input`),p=g(`model-selector`),m=g(`ratio-selector`),h=g(`resolution-selector`),v=g(`duration-selector`),y=g(`service-tier-selector`),b=g(`generate-audio-switch`),x=g(`camera-fixed-switch`),S=g(`return-last-frame-switch`),C=g(`seed-input`),w=g(`first-frame-image`),T=g(`last-frame-image`),E=g(`reference-image`),D=g(`reference-audio`),O=g(`reference-video`),k=g(`consumption`),A=g(`font-awesome-icon`),j=g(`el-button`);return d(),t(`div`,Ln,[n(`div`,Rn,[o(f,{class:`mb-4`}),o(p,{class:`mb-4`}),o(m,{class:`mb-4`}),o(h,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`}),o(b,{class:`mb-4`}),o(x,{class:`mb-4`}),o(S,{class:`mb-4`}),o(C,{class:`mb-4`}),o(w,{class:`mb-2`}),o(T,{class:`mb-2`}),o(E,{class:`mb-2`}),o(D,{class:`mb-2`}),o(O,{class:`mb-2`})]),n(`div`,zn,[o(k,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(j,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:_(()=>[o(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`seedance.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Vn=U(In,[[`render`,Bn]]),Hn=r({name:`AudioPreview`,components:{FontAwesomeIcon:J},props:{url:{type:String,required:!0},name:{type:String,required:!1,default:`audio`}},data(){return{playing:!1}},methods:{onToggle(){let e=this.$refs.audio;e&&(e.paused?e.play().catch(()=>{this.playing=!1}):e.pause())}}}),Un=[`title`],Wn=[`src`];function Gn(e,r,i,a,s,c){let l=g(`font-awesome-icon`);return d(),t(`div`,{class:`audio-preview w-[50px] h-[50px] relative rounded-[var(--el-border-radius-base)] overflow-hidden shadow-sm cursor-pointer flex items-center justify-center`,title:e.name,onClick:r[3]||=f((...t)=>e.onToggle&&e.onToggle(...t),[`stop`])},[o(l,{icon:e.playing?`fa-solid fa-pause`:`fa-solid fa-music`,class:`icon text-white text-[16px]`},null,8,[`icon`]),n(`audio`,{ref:`audio`,src:e.url,preload:`none`,onPlay:r[0]||=t=>e.playing=!0,onPause:r[1]||=t=>e.playing=!1,onEnded:r[2]||=t=>e.playing=!1},null,40,Wn)],8,Un)}var Kn=U(Hn,[[`render`,Gn],[`__scopeId`,`data-v-66cf67f6`]]),qn=r({name:`VideoPreview`,components:{ElDialog:B,FontAwesomeIcon:J,VideoPlayer:Z},props:{url:{type:String,required:!0},name:{type:String,required:!1,default:`video`}},data(){return{open:!1}}}),Jn=[`title`],Yn=[`src`],Xn={class:`overlay absolute inset-0 flex items-center justify-center bg-[rgba(0,0,0,0.25)]`};function Zn(e,r,i,a,s,c){let l=g(`font-awesome-icon`),u=g(`video-player`),p=g(`el-dialog`);return d(),t(`div`,{class:`video-preview w-[50px] h-[50px] relative rounded-[var(--el-border-radius-base)] overflow-hidden shadow-sm cursor-pointer bg-[var(--el-fill-color-darker)]`,title:e.name,onClick:r[2]||=f(t=>e.open=!0,[`stop`])},[n(`video`,{class:`w-full h-full object-cover`,src:`${e.url}#t=0.1`,muted:``,preload:`metadata`,playsinline:``},null,8,Yn),n(`div`,Xn,[o(l,{icon:`fa-solid fa-play`,class:`text-white text-[14px]`})]),o(p,{modelValue:e.open,"onUpdate:modelValue":r[0]||=t=>e.open=t,width:`640`,"align-center":``,"append-to-body":``,"destroy-on-close":``,class:`video-preview-dialog`,onClick:r[1]||=f(()=>{},[`stop`])},{default:_(()=>[o(u,{src:e.url},null,8,[`src`])]),_:1},8,[`modelValue`])],8,Jn)}var Qn=r({name:`SeedanceTaskPreview`,components:{ElImage:w,CopyToClipboard:_e,FontAwesomeIcon:J,ElAlert:T,VideoPlayer:Z,ElTooltip:C,ElButton:y,ImageWrapper:Ee,ImagePreview:Y,AudioPreview:Kn,VideoPreview:U(qn,[[`render`,Zn],[`__scopeId`,`data-v-d4752590`]]),ApiCodeButton:Se},props:{modelValue:{type:Object,required:!0}},data(){return{seedanceLogo:j}},computed:{video(){return this.modelValue?.response?.data},promptText(){let e=this.modelValue?.request;if(e?.prompt)return e.prompt;let t=e?.content?.find(e=>e?.type===`text`&&e?.text);return t?.text?t.text:this.video?.prompt},referenceImages(){let e=this.collectImages();if(e.length===0)return[];let t=[],n=e.find(e=>e?.role===`first_frame`);n?.url&&t.push({url:n.url,name:`first-frame`});let r=e.find(e=>e?.role===`last_frame`);return r?.url&&t.push({url:r.url,name:`last-frame`}),e.forEach((e,n)=>{e?.url&&e.role!==`first_frame`&&e.role!==`last_frame`&&t.push({url:e.url,name:e.role||`image-${n}`})}),t},referenceAudios(){let e=this.modelValue?.request,t=(e?.audios??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`audio_url`&&e?.audio_url?.url&&t.push(e.audio_url.url)}),t},referenceVideos(){let e=this.modelValue?.request,t=(e?.videos??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`video_url`&&e?.video_url?.url&&t.push(e.video_url.url)}),t}},methods:{collectImages(){let e=this.modelValue?.request,t=Array.isArray(e?.images)?[...e.images]:[];return(e?.content??[]).forEach(e=>{e?.type===`image_url`&&e?.image_url?.url&&t.push({url:e.image_url.url,role:e.role})}),t},onDownload(e){window.open(e,`_blank`)}}}),$n={class:`preview`},er={class:`left`},tr={class:`main`},nr={class:`bot`},rr={class:`datetime`},ir={class:`info`},ar={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},or={key:1,class:`prompt mt-2`},sr={key:0},cr={key:1},lr={key:0,class:l({content:!0})},ur={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},dr={key:1,class:l({content:!0})},fr={key:0,class:`mb-4`},pr={key:1,class:`mb-4`},mr={key:2,class:l({operations:!0,"mt-2":!0,"mb-2":!0})},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gr={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_r={key:0},vr={key:1},yr={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},br={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xr={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Sr={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Cr={key:2,class:l({content:!0})},wr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Er={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dr={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Or={key:3,class:l({content:!0})},kr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ar={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function jr(r,c,l,p,m,v){let y=g(`el-image`),b=g(`image-preview`),x=g(`audio-preview`),S=g(`video-preview`),C=g(`font-awesome-icon`),w=g(`copy-to-clipboard`),T=g(`el-alert`),E=g(`video-player`),D=g(`image-wrapper`),O=g(`el-button`),k=g(`el-tooltip`),A=g(`api-code-button`);return d(),t(`div`,$n,[n(`div`,er,[o(y,{src:r.seedanceLogo,class:`avatar`},null,8,[`src`])]),n(`div`,tr,[n(`div`,nr,[i(u(r.$t(`seedance.name.seedanceBot`))+` `,1),n(`span`,rr,u(r.$dayjs.format(``+new Date(parseFloat((r.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,ir,[r.referenceImages.length>0||r.referenceAudios.length>0||r.referenceVideos.length>0?(d(),t(`div`,ar,[(d(!0),t(s,null,e(r.referenceImages,(e,t)=>(d(),a(b,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(d(!0),t(s,null,e(r.referenceAudios,(e,t)=>(d(),a(x,{key:`audio-${t}`,url:e,name:`audio-${t+1}`},null,8,[`url`,`name`]))),128)),(d(!0),t(s,null,e(r.referenceVideos,(e,t)=>(d(),a(S,{key:`video-${t}`,url:e,name:`video-${t+1}`},null,8,[`url`,`name`]))),128))])):h(``,!0),r.promptText?(d(),t(`p`,or,[i(u(r.promptText)+` `,1),r.modelValue?.response?r.video?.status===`processing`||r.video?.status===`pending`?(d(),t(`span`,cr,` - (`+u(r.$t(`seedance.status.processing`))+`) `,1)):h(``,!0):(d(),t(`span`,sr,` - (`+u(r.$t(`seedance.status.pending`))+`) `,1))])):h(``,!0)]),r.modelValue?.response?r.modelValue?.response?.success===!0?(d(),t(`div`,dr,[r.video?.video_url?(d(),t(`div`,fr,[o(E,{src:r.video?.video_url},null,8,[`src`])])):h(``,!0),r.video?.last_frame_url?(d(),t(`div`,pr,[o(D,{src:r.video?.last_frame_url,"raw-src":r.video?.last_frame_url},null,8,[`src`,`raw-src`])])):h(``,!0),r.video?.video_url?(d(),t(`div`,mr,[o(k,{class:`box-item`,effect:`dark`,content:r.$t(`seedance.message.downloadVideo`),placement:`top-start`},{default:_(()=>[o(O,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=f(e=>r.onDownload(r.video?.video_url),[`stop`])},{default:_(()=>[i(u(r.$t(`seedance.button.download`)),1)]),_:1})]),_:1},8,[`content`]),o(A,{path:`/seedance/videos`,body:r.modelValue?.request},null,8,[`body`])])):h(``,!0),o(T,{closable:!1,class:`mt-2 success`},{default:_(()=>[r.modelValue?.request?.model?(d(),t(`p`,$,[o(C,{icon:`fa-solid fa-cube`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.model`))+`: `+u(r.modelValue?.request?.model),1)])):h(``,!0),r.video?.duration?(d(),t(`p`,hr,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.duration`))+`: `+u(r.video?.duration)+`s `,1)])):h(``,!0),r.video?.resolution?(d(),t(`p`,gr,[o(C,{icon:`fa-solid fa-expand`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.resolution`))+`: `+u(r.video?.resolution)+` `,1),r.video?.ratio?(d(),t(`span`,_r,` · `+u(r.video?.ratio),1)):h(``,!0),r.video?.framespersecond?(d(),t(`span`,vr,` · `+u(r.video?.framespersecond)+`fps`,1)):h(``,!0)])):h(``,!0),r.modelValue?.request?.generate_audio?(d(),t(`p`,yr,[o(C,{icon:`fa-solid fa-volume-up`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.generateAudio`))+`: `+u(r.$t(`seedance.button.on`)),1)])):h(``,!0),n(`p`,br,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.elapsed?(d(),t(`p`,xr,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0),r.modelValue?.response?.trace_id?(d(),t(`p`,Sr,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(w,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0)]),_:1})])):r.modelValue?.response?.success===!1?(d(),t(`div`,Cr,[o(T,{closable:!1,class:`failure`},{template:_(()=>[o(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.failure`)),1)]),default:_(()=>[n(`p`,wr,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.response?.error?.message?(d(),t(`p`,Tr,[o(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.failureReason`))+`: `+u(r.modelValue?.response?.error?.message)+` `,1),o(w,{content:r.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0),r.modelValue?.elapsed?(d(),t(`p`,Er,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0),r.modelValue?.response?.trace_id?(d(),t(`p`,Dr,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(w,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0)]),_:1})])):(d(),t(`div`,Or,[o(T,{closable:!1,class:`info`},{template:_(()=>[o(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.status`)),1)]),default:_(()=>[n(`p`,kr,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),r.modelValue?.response?.trace_id?(d(),t(`p`,Ar,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(w,{content:r.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):h(``,!0)]),_:1})])):(d(),t(`div`,lr,[o(T,{closable:!1,class:`info`},{template:_(()=>[o(C,{icon:`fa-regular fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`seedance.status.pending`)),1)]),default:_(()=>[n(`p`,ur,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`seedance.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var Mr=r({name:`SeedanceRecentPanel`,components:{TaskPreview:U(Qn,[[`render`,jr],[`__scopeId`,`data-v-be65e8a9`]]),BotPlaceholder:Ce,NoTasks:we,ScrollList:be},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedance?.tasks,items:this.$store.state.seedance?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Nr={key:0},Pr={key:2,class:`w-full h-full flex items-center justify-center`};function Fr(n,r,i,c,l,u){let f=g(`bot-placeholder`),p=g(`task-preview`),m=g(`scroll-list`),v=g(`no-tasks`);return d(),t(s,null,[n.tasks?.items===void 0?(d(),t(`div`,Nr,[o(f)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(d(),a(m,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:_(()=>[(d(!0),t(s,null,e(n.tasks?.items,e=>(d(),a(p,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):h(``,!0),n.tasks?.items?.length===0?(d(),t(`div`,Pr,[o(v)])):h(``,!0)],64)}var Ir=r({name:`SeedanceIndex`,components:{ConfigPanel:Vn,Layout:Me,RecentPanel:U(Mr,[[`render`,Fr]])},mixins:[z],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.seedance?.status?.getApplications===W.Request},tasksLoading(){return this.$store.state.seedance?.status?.getTasks===W.Request||this.fetchingTasks},credential(){return this.$store.state.seedance?.credential},config(){return this.$store.state.seedance?.config},tasks(){return this.$store.state.seedance?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await xe({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`seedance/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`seedance/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!pe(this.uploadTracker,e=>this.$t(e),e=>K.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.images)){e.images=e.images.filter(e=>!!e?.url);let t=e.images.some(e=>e?.role===`first_frame`),n=e.images.some(e=>e?.role===`last_frame`);!t&&n&&(e.images=e.images.map(e=>e?.role===`last_frame`?{...e,role:`first_frame`}:e))}let t=Array.isArray(e?.images)&&e.images.length>0;if(!t&&`images`in e&&delete e.images,e?.model&&!le[e.model]){K.warning(this.$t(`seedance.message.modelUnsupported`));return}let n=M(e?.model);if(n.requiresImage&&!t){K.warning(this.$t(`seedance.message.modelRequiresImage`));return}if(!n.acceptsImage&&t){K.warning(this.$t(`seedance.message.modelRejectsImage`));return}if(!n.acceptsText&&!t){K.warning(this.$t(`seedance.message.modelRequiresImage`));return}!n.acceptsAudio&&e.generate_audio&&(e.generate_audio=!1),!n.acceptsReturnLastFrame&&e.return_last_frame&&(e.return_last_frame=!1),!n.acceptsLastFrame&&t&&(e.images=e.images.filter(e=>e?.role!==`last_frame`)),n.acceptsReferenceAudio&&Array.isArray(e?.audios)&&(e.audios=e.audios.filter(e=>e?.url)),(!n.acceptsReferenceAudio||!Array.isArray(e?.audios)||e.audios.length===0)&&delete e.audios,n.acceptsReferenceVideo&&Array.isArray(e?.videos)&&(e.videos=e.videos.filter(e=>e?.url)),(!n.acceptsReferenceVideo||!Array.isArray(e?.videos)||e.videos.length===0)&&delete e.videos,!n.acceptsReferenceImage&&Array.isArray(e?.images)&&(e.images=e.images.filter(e=>e?.role!==`reference_image`),e.images.length===0&&delete e.images);let r=Array.isArray(e?.images)&&e.images.some(e=>e?.role===`reference_image`);if(Array.isArray(e?.audios)&&e.audios.length>0&&!r){K.warning(this.$t(`seedance.message.audioRequiresReferenceImage`));return}let i={...e,async:!0};if(!he())return;let a=this.credential?.token;if(!a){console.error(`no token specified`);return}K.info(this.$t(`seedance.message.startingTask`)),V(`seedance`,ge.generate(i,{token:a})).then(()=>{K.success(this.$t(`seedance.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?K.error(this.$t(`seedance.message.usedUp`)):K.error(this.$t(`seedance.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Lr(e,t,n,r,i,s){let c=g(`config-panel`),l=g(`recent-panel`),u=g(`layout`);return d(),a(u,null,{config:_(()=>[o(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:_(()=>[o(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Rr=U(Ir,[[`render`,Lr]]);export{Rr as default};