@acedatacloud/nexior 3.342.0 → 3.343.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (353) hide show
  1. package/dist/assets/ApiCodeButton-V0PNC5hd.js +1 -0
  2. package/dist/assets/{Artifacts-DWv7hZm7.js → Artifacts-BYeOc8nC.js} +1 -1
  3. package/dist/assets/AskUserQuestionCard-tUwIOzad.js +1 -0
  4. package/dist/assets/{AudioPreview-Cu7tFQ3O.js → AudioPreview-QhwYz5OI.js} +1 -1
  5. package/dist/assets/{Auth-DBG_9BBB.js → Auth-By5V9Nsl.js} +1 -1
  6. package/dist/assets/{Bare-CI4aDptm.js → Bare-zd2QVMDl.js} +1 -1
  7. package/dist/assets/{BotPlaceholder-DEzlsX3N.js → BotPlaceholder-BMeL50cE.js} +1 -1
  8. package/dist/assets/{BottomFooter-Bjq8MsS9.js → BottomFooter-YKs8pno9.js} +1 -1
  9. package/dist/assets/{Callback-CqRRYle1.js → Callback-CpOQU4dn.js} +1 -1
  10. package/dist/assets/CodeSnippet-Bn21xWAq.js +1 -0
  11. package/dist/assets/{Console-9MncIaGy.css → Console-1tSVCxa2.css} +1 -1
  12. package/dist/assets/Console-CvO0gQ1x.js +1 -0
  13. package/dist/assets/{Consumption-Bj1vPgJr.js → Consumption-DWMEoulW.js} +1 -1
  14. package/dist/assets/Conversation-BLCU8-T1.js +1 -0
  15. package/dist/assets/{Conversation-eDIVd-G3.css → Conversation-DWG-mIDb.css} +1 -1
  16. package/dist/assets/Conversation-bPD472U7.js +1 -0
  17. package/dist/assets/{CopyToClipboard-jI-6D-bZ.js → CopyToClipboard-DAsxz05c.js} +1 -1
  18. package/dist/assets/Detail-D1ncfV4P.js +2 -0
  19. package/dist/assets/Extra-D9m665NV.js +1 -0
  20. package/dist/assets/{FilePreview-waS6P9QI.js → FilePreview-D4-VAXV8.js} +1 -1
  21. package/dist/assets/{Hailuo-BMahH61V.js → Hailuo-BHAsd96T.js} +1 -1
  22. package/dist/assets/{History-DHO1JUMf.js → History-CoNbrEJD.js} +1 -1
  23. package/dist/assets/{ImagePreview-D_nlD8_0.js → ImagePreview-0F7lED-X.js} +1 -1
  24. package/dist/assets/{ImageWrapper-arrFKmON.js → ImageWrapper-Cdezi8bX.js} +1 -1
  25. package/dist/assets/{Index-Cy_8j9K1.js → Index-044Ro6Bq.js} +1 -1
  26. package/dist/assets/{Index-D4836pnj.js → Index-4U6r-iaT.js} +1 -1
  27. package/dist/assets/Index-64oaFTmU.css +1 -0
  28. package/dist/assets/Index-9pYDV1qL2.js +1 -0
  29. package/dist/assets/Index-BGz-O4np.js +1 -0
  30. package/dist/assets/Index-BI4EKdo6.js +1 -0
  31. package/dist/assets/{Index-jmUqbYbJ.js → Index-BPe5qtsb.js} +1 -1
  32. package/dist/assets/{Index-Cm7Z3vZg.js → Index-BRNk-wiu2.js} +2 -2
  33. package/dist/assets/Index-BbI2zF5S.js +1 -0
  34. package/dist/assets/{Index-Ld7CmLzm.js → Index-BlOKNnPe.js} +1 -1
  35. package/dist/assets/Index-BqAm4pVA.js +1 -0
  36. package/dist/assets/{Index-C2SjjQcQ.js → Index-Br0lmVsx.js} +1 -1
  37. package/dist/assets/Index-BvHEIXrL.js +1 -0
  38. package/dist/assets/{Index-C6GKK_wo.js → Index-BxeRFkXY.js} +1 -1
  39. package/dist/assets/Index-CBDDxJWV.js +1 -0
  40. package/dist/assets/{Index-DYjx6H-j.js → Index-CBxCduYm.js} +1 -1
  41. package/dist/assets/Index-CFeWQRUh.js +1 -0
  42. package/dist/assets/Index-CNdop1tw.js +1 -0
  43. package/dist/assets/Index-CqvCKSL3.js +1 -0
  44. package/dist/assets/Index-CtFzRWS_.js +1 -0
  45. package/dist/assets/Index-CxTGG9bk.js +1 -0
  46. package/dist/assets/Index-D7c_yBVK.js +1 -0
  47. package/dist/assets/{Index-fgvRd9Gj.js → Index-DCSQepKp.js} +1 -1
  48. package/dist/assets/Index-DDAs6VA4.js +1 -0
  49. package/dist/assets/Index-DGkriLhl.js +1 -0
  50. package/dist/assets/Index-DM9BjAa_.js +1 -0
  51. package/dist/assets/{Index-DcOdM_Tm.js → Index-Dcl6fiB52.js} +1 -1
  52. package/dist/assets/Index-DdRXx7GK.js +1 -0
  53. package/dist/assets/Index-DpuLXWul.js +1 -0
  54. package/dist/assets/{Index-DUWdLoet.js → Index-UfXAAmxF.js} +1 -1
  55. package/dist/assets/Index-cuj6_xMs.js +1 -0
  56. package/dist/assets/Index-njQy9uD5.js +1 -0
  57. package/dist/assets/Index-o_YjysBO2.js +1 -0
  58. package/dist/assets/{Invitees-CbuK1aDg.js → Invitees-CcDTR8z9.js} +1 -1
  59. package/dist/assets/{List-GFrKDD4y.js → List-B9Ona_vK.js} +1 -1
  60. package/dist/assets/List-BQYD9zNq.js +1 -0
  61. package/dist/assets/{List-DJXloozM.js → List-BzV12ot6.js} +1 -1
  62. package/dist/assets/{LocalTools-NvvXMet_.js → LocalTools-BUZ3lh8b.js} +1 -1
  63. package/dist/assets/LocalTools-Daqzp_fD.js +5 -0
  64. package/dist/assets/{Main-CIAP4AC5.js → Main-B8FxEpkO.js} +1 -1
  65. package/dist/assets/Message-VvwjEOcv.js +3 -0
  66. package/dist/assets/Model-CqTlz_rR.js +1 -0
  67. package/dist/assets/{Navigator-Ci3JbYQc.js → Navigator-B3vGoST6.js} +4 -4
  68. package/dist/assets/{NotFound-B-5g2Hwf.js → NotFound-Btr_yyEF.js} +1 -1
  69. package/dist/assets/Pay-DubZaprl.js +1 -0
  70. package/dist/assets/{Player-Bj9RbTJJ.js → Player-DQrkjYkn.js} +1 -1
  71. package/dist/assets/{Poivelle-Bi1i6oiw.js → Poivelle-DGzubWIL.js} +1 -1
  72. package/dist/assets/{PromptTextarea-Ck-RQCWL.js → PromptTextarea-BdxR43fI.js} +1 -1
  73. package/dist/assets/{RealtimeCall-m06qsf_-.js → RealtimeCall-hvx4LO61.js} +1 -1
  74. package/dist/assets/ScheduledTasks-DQysrq5o.js +2 -0
  75. package/dist/assets/{Status-D9ma2JsQ.js → Status-BhmBIYFW.js} +1 -1
  76. package/dist/assets/{Subscribe-CT5HYf_T.js → Subscribe-vSoI-fH8.js} +1 -1
  77. package/dist/assets/{TabSwitcher-BQADzwP3.js → TabSwitcher-XBC7Wgfm.js} +1 -1
  78. package/dist/assets/{Tts-CN1EhBou.js → Tts-BCxb2qXy.js} +1 -1
  79. package/dist/assets/{VideoPlayer-8GmZfaeT.js → VideoPlayer-DTVJVKri.js} +1 -1
  80. package/dist/assets/VueMarkdown-CiiRjbWs.js +20 -0
  81. package/dist/assets/{alert-HuInTm83.js → alert-BY_joJSO.js} +1 -1
  82. package/dist/assets/application-Dsk7Htmk.js +1 -0
  83. package/dist/assets/arrow-down-wSWETU-Z.js +1 -0
  84. package/dist/assets/{arrow-down-wide-narrow-CGuqoOsI.js → arrow-down-wide-narrow-BBwnqJqv.js} +1 -1
  85. package/dist/assets/arrow-left-8-Xw7Ohz.js +1 -0
  86. package/dist/assets/arrow-right-wypyEZlo.js +1 -0
  87. package/dist/assets/arrow-up-CD-EsIda.js +1 -0
  88. package/dist/assets/avatar-lZyFrAl_.js +1 -0
  89. package/dist/assets/{basic-BkbLX1KI.js → basic-C8Bta_Tj.js} +1 -1
  90. package/dist/assets/book-open-G49d0HIY.js +1 -0
  91. package/dist/assets/{box-BCoet0RR.js → box-BOmBNuoO.js} +1 -1
  92. package/dist/assets/{boxes-BxFNEE1B.js → boxes-OXfwrz_Y.js} +1 -1
  93. package/dist/assets/{brain-CmJqzRjA.js → brain-CjtFB784.js} +1 -1
  94. package/dist/assets/byok-Bbtn_ySo.js +1 -0
  95. package/dist/assets/{chart-no-axes-combined-Y5AH63Oh.js → chart-no-axes-combined-BHuW8WfQ.js} +1 -1
  96. package/dist/assets/{chat-CVOPEJJ0.js → chat-CiLnEkUF.js} +1 -1
  97. package/dist/assets/{chat-D_4NhZvL.js → chat-DYP-QalC.js} +1 -1
  98. package/dist/assets/check-DI-MESEH.js +1 -0
  99. package/dist/assets/chevron-down-WfupmEeM.js +1 -0
  100. package/dist/assets/chevron-right-CF-4xDq-.js +1 -0
  101. package/dist/assets/circle-check-r9lU9RtY.js +1 -0
  102. package/dist/assets/circle-question-mark-DD9uSbOU.js +1 -0
  103. package/dist/assets/clipboard-list-BwXfk8sx.js +1 -0
  104. package/dist/assets/clock-otSJpi4t.js +1 -0
  105. package/dist/assets/code-D3E3xVo1.js +1 -0
  106. package/dist/assets/{codingBridge-DIvM5iZv.js → codingBridge-RDeuAMgB.js} +2 -2
  107. package/dist/assets/{codingBridgeNotify-D7s7KERq.js → codingBridgeNotify-B4B5G7Va.js} +2 -2
  108. package/dist/assets/{coins-Da9Xu1zA.js → coins-DcJKW6bq.js} +1 -1
  109. package/dist/assets/{collapse-BtJTB1bk.js → collapse-2ZkQBwEA.js} +1 -1
  110. package/dist/assets/common-C3y24hsM.js +1 -0
  111. package/dist/assets/{console-D8kEzS1g.js → console-BGXbhX8g.js} +1 -1
  112. package/dist/assets/{console-CxtPaJNm.js → console-BIOAuKS9.js} +1 -1
  113. package/dist/assets/{console-ohooaa4W.js → console-BX0G2auT.js} +1 -1
  114. package/dist/assets/{console-DEPh_uMf.js → console-CBxupHDs.js} +1 -1
  115. package/dist/assets/{console-KooQEhkO.js → console-CE6gyKyL.js} +1 -1
  116. package/dist/assets/{console-BNs-ToBH.js → console-CNgtblbl.js} +1 -1
  117. package/dist/assets/{console-BCUgfQ3a.js → console-CRI07Yjf.js} +1 -1
  118. package/dist/assets/{console-BgPfIxMN.js → console-CUVAcg0e.js} +1 -1
  119. package/dist/assets/{console-CR5Ir7It.js → console-CUdCMgwb.js} +1 -1
  120. package/dist/assets/{console-O-5wS6BF.js → console-C_QRIEqw.js} +1 -1
  121. package/dist/assets/{console-CdkAoqik.js → console-Cnqwd48k.js} +1 -1
  122. package/dist/assets/{console-DEqu-zsN.js → console-Cuk22ZZE.js} +1 -1
  123. package/dist/assets/{console-fm3pjYNZ.js → console-D7PVWE6S.js} +1 -1
  124. package/dist/assets/{console-CokGta10.js → console-DB7A00V8.js} +1 -1
  125. package/dist/assets/{console-Df5vn3T4.js → console-DBKsvrcX.js} +1 -1
  126. package/dist/assets/{console-BokX8flL.js → console-g5MzcXx5.js} +1 -1
  127. package/dist/assets/{console-c10ctVEg.js → console-hmvJJfSg.js} +1 -1
  128. package/dist/assets/{console-D2aIByUt.js → console-j5eIDwLq.js} +1 -1
  129. package/dist/assets/{constants-B5AtX8h0.js → constants-Dm-HitpB.js} +1 -1
  130. package/dist/assets/{copy-DcsaXXBx.js → copy-ZC2WLlnJ.js} +1 -1
  131. package/dist/assets/{createTaskActions-Cn2WyOOR.js → createTaskActions-BY8s7Yjy.js} +1 -1
  132. package/dist/assets/digitalhuman-BmnHCR8e.js +1 -0
  133. package/dist/assets/{digitalhuman-lTQaxGbr.js → digitalhuman-qp3ZgdPE.js} +1 -1
  134. package/dist/assets/{dollar-sign-BMCPXRrh.js → dollar-sign-mIKoeQxp.js} +1 -1
  135. package/dist/assets/{download-BDcUBlou.js → download-LDDA2n95.js} +1 -1
  136. package/dist/assets/{drawer-C3ym1xsG.js → drawer-DdjNUdLN.js} +1 -1
  137. package/dist/assets/{dropdown-DxmpF-nO.js → dropdown-CMiXxU1B.js} +1 -1
  138. package/dist/assets/{dropdown-DkhEqGNe.js → dropdown-D0WY3qJO.js} +1 -1
  139. package/dist/assets/{ellipsis-Poi2jOME.js → ellipsis-CP-BL-iO.js} +1 -1
  140. package/dist/assets/{esm-HkKACtuh.js → esm-4VTl49X9.js} +3 -3
  141. package/dist/assets/esm-B6hBOBRW.js +1 -0
  142. package/dist/assets/{esm-D1uxcogG.js → esm-Bp3iQn3w.js} +1 -1
  143. package/dist/assets/{esm-DCJwXkp3.js → esm-D3ExGrJd.js} +2 -2
  144. package/dist/assets/{esm-_tyzrFgl.js → esm-DMgweWk_.js} +2 -2
  145. package/dist/assets/{esm-DkBd5VZY.js → esm-Yweo4ODl.js} +1 -1
  146. package/dist/assets/{esm-CJ8-Gzlc.js → esm-gmc8Tpjs.js} +1 -1
  147. package/dist/assets/{external-link-DuJk070y.js → external-link-CiFxVqfE.js} +1 -1
  148. package/dist/assets/{eye-Dz1EUjic.js → eye-DI6pShDu.js} +1 -1
  149. package/dist/assets/{file-K1rm9b4T.js → file-B80udnm7.js} +1 -1
  150. package/dist/assets/{file-output-DadHHKE9.js → file-output-BAi6qoc7.js} +1 -1
  151. package/dist/assets/{file-text-B75csuCX.js → file-text-BhROIBYy.js} +1 -1
  152. package/dist/assets/{fish-Bnd4b37c.js → fish-BRLJYUAO.js} +1 -1
  153. package/dist/assets/{flux-Cvzm1M90.js → flux-DfBqyacW.js} +1 -1
  154. package/dist/assets/{folder-B8bIPURP.js → folder-txym0RUE.js} +1 -1
  155. package/dist/assets/gauge-BBuq5rxO.js +1 -0
  156. package/dist/assets/{globe-CvIWEnH9.js → globe-BIvs6o6q.js} +1 -1
  157. package/dist/assets/{omni-DN2ElKwG.js → grokvideo-Bou5B1Uj.js} +1 -1
  158. package/dist/assets/{pika-CI6scEGM.js → hailuo-DMzGp4xb.js} +1 -1
  159. package/dist/assets/{headphones-CNlAFnHR.js → headphones-rnilQWSF.js} +1 -1
  160. package/dist/assets/{history-CMbMcvPD.js → history-N-pozsdR.js} +1 -1
  161. package/dist/assets/{house-CNyzhph0.js → house-BoRR2eE1.js} +1 -1
  162. package/dist/assets/{i18n-CGSl7nP0.js → i18n-BMgeFHoQ.js} +1 -1
  163. package/dist/assets/{image-D6t3Iitl.js → image-Ctt9oB_3.js} +1 -1
  164. package/dist/assets/{index-P4zymybO.js → index-NQhLFvCT.js} +11 -11
  165. package/dist/assets/{index.browser.esm-DwkZ4zAo.js → index.browser.esm-BWIAsVvx.js} +1 -1
  166. package/dist/assets/{index.es-sqPULfxw.js → index.es-o35-q5Jn.js} +1 -1
  167. package/dist/assets/{info-BRA-_T8y.js → info-RB2UKcjL.js} +1 -1
  168. package/dist/assets/{input-number-BKAsEVuC.js → input-number-Dz4VZooF.js} +1 -1
  169. package/dist/assets/{key-round-CKbb_D1W.js → key-round-Cq1XDG6i.js} +1 -1
  170. package/dist/assets/{kling-BCMkuMN8.js → kling-ChTIJza1.js} +1 -1
  171. package/dist/assets/{languages-zWnMYa2j.js → languages-OIQ5tSKm.js} +1 -1
  172. package/dist/assets/{laptop-sENY98Oo.js → laptop-CXKAiyi1.js} +1 -1
  173. package/dist/assets/{lightbulb-Bt5xoXkd.js → lightbulb-CSEYdZB7.js} +1 -1
  174. package/dist/assets/{link-yHlAOSK-.js → link-DBLtRDbw.js} +1 -1
  175. package/dist/assets/loader-circle-Cw68u1V8.js +1 -0
  176. package/dist/assets/lock-ncHLf-gT.js +1 -0
  177. package/dist/assets/{luma-CjAoP_Up.js → luma-T60Sxoxa.js} +1 -1
  178. package/dist/assets/{maestro-DxutemxW.js → maestro-CSLWUtZt.js} +1 -1
  179. package/dist/assets/{maestro-Cj1NO7Oh.js → maestro-kHSSjXRl.js} +1 -1
  180. package/dist/assets/{mail-D1AUEb3n.js → mail-D9oBZXHV.js} +1 -1
  181. package/dist/assets/{message-circle-BPE5Zcp5.js → message-circle-Dr6hubpu.js} +1 -1
  182. package/dist/assets/{mic-BI2ZWDBn.js → mic-D2DowRjY.js} +1 -1
  183. package/dist/assets/{midjourney-Jz1SL5VJ.js → midjourney-CYUTkNWu.js} +1 -1
  184. package/dist/assets/{midjourney-Catq_3fk.js → midjourney-DAwMOlT5.js} +1 -1
  185. package/dist/assets/{mobileLocalExec-BowJAIeZ.js → mobileLocalExec-k-5trNVt.js} +2 -2
  186. package/dist/assets/{monitor-CxoqyO_-.js → monitor-Cmqb9sW9.js} +1 -1
  187. package/dist/assets/{mouse-pointer-2-CkvsYzAY.js → mouse-pointer-2-B90DsmXY.js} +1 -1
  188. package/dist/assets/music-2-DmEjQhJK.js +1 -0
  189. package/dist/assets/{seedance-CHQlPdwR.js → nanobanana-BvKdAjiT.js} +1 -1
  190. package/dist/assets/{grokvideo-D9mIMH1K.js → omni-COmbH6WS.js} +1 -1
  191. package/dist/assets/{openaiimage-CwpY1izM.js → openaiimage-DNCUohcn.js} +1 -1
  192. package/dist/assets/order-CdfkZCC4.js +1 -0
  193. package/dist/assets/pagination-CFcD1SQE.js +1 -0
  194. package/dist/assets/{pagination-B1w7bn_h.js → pagination-D0u3tuFM.js} +2 -2
  195. package/dist/assets/pagination-D_6MZ9Xf.js +1 -0
  196. package/dist/assets/{palette-DIK7R_Hp.js → palette-BvIE3Qr-.js} +1 -1
  197. package/dist/assets/{paperclip-BPtWaxWH.js → paperclip-oOuIi8Qk.js} +1 -1
  198. package/dist/assets/{pause-B_0Qmik_.js → pause-Chqy-1mW.js} +1 -1
  199. package/dist/assets/{pencil-Dv4e5Y2i.js → pencil-DMujlmFy.js} +1 -1
  200. package/dist/assets/{hailuo-Bea5aRk0.js → pika-DvEpF-Y5.js} +1 -1
  201. package/dist/assets/pixverse-PXC6IU1D.js +1 -0
  202. package/dist/assets/{sora-DaWaY5vB.js → pixverse-Vyq3UFYx.js} +1 -1
  203. package/dist/assets/play-vgkRlP0T.js +1 -0
  204. package/dist/assets/{plug-Ce75C2kf.js → plug-CkDQ51_L.js} +1 -1
  205. package/dist/assets/plus-By5Qacpg.js +1 -0
  206. package/dist/assets/{poivelle-BV6SNVBq.js → poivelle-DXySdil3.js} +1 -1
  207. package/dist/assets/{popover-BNpyEjfo.js → popover-CKdKLGKL.js} +1 -1
  208. package/dist/assets/{producer-C606raEG.js → producer-Bgo4swLN.js} +1 -1
  209. package/dist/assets/{qrart-ByjVDW9B.js → qrart-BdULO0ov.js} +1 -1
  210. package/dist/assets/{qrart-BsOMx4Rn.js → qrart-pSMfz59P.js} +1 -1
  211. package/dist/assets/realtime-Cfve3bp8.js +1 -0
  212. package/dist/assets/{refresh-cw-Bq5ibcJF.js → refresh-cw-BP2lZ4Io.js} +1 -1
  213. package/dist/assets/rotate-ccw-wk763BVv.js +1 -0
  214. package/dist/assets/rotate-cw-DY3HK_Vz.js +1 -0
  215. package/dist/assets/{row-DjE0FevX.js → row-KG3FewmS.js} +1 -1
  216. package/dist/assets/search-BfbZESba.js +1 -0
  217. package/dist/assets/{nanobanana-CQtWsOmc.js → seedance-Bds_eiU6.js} +1 -1
  218. package/dist/assets/{seedream-BnanqDBr.js → seedream-eX9gchwX.js} +1 -1
  219. package/dist/assets/{select-CBX_IrQp.js → select-LvaKgyRc.js} +1 -1
  220. package/dist/assets/{serp-BBn8wL-Z.js → serp-D5x3oibU.js} +1 -1
  221. package/dist/assets/{shield-nHNtz7Ic.js → shield-DsobIZ9Z.js} +1 -1
  222. package/dist/assets/{shuffle-DpeZ8fLS.js → shuffle-DTRD25qg.js} +1 -1
  223. package/dist/assets/skill-0i74Fj_O.js +8 -0
  224. package/dist/assets/skill-B0G9tQHH.js +8 -0
  225. package/dist/assets/skill-BJoSDUm2.js +8 -0
  226. package/dist/assets/skill-Bdwiv8q3.js +8 -0
  227. package/dist/assets/skill-Bm_BDGaQ.js +8 -0
  228. package/dist/assets/skill-BoE7nhUS.js +8 -0
  229. package/dist/assets/skill-C27zo6FZ.js +8 -0
  230. package/dist/assets/skill-CJS966ZP.js +8 -0
  231. package/dist/assets/skill-CMjI3y1J.js +8 -0
  232. package/dist/assets/skill-CRLfSlIp.js +8 -0
  233. package/dist/assets/skill-CWiA3OfU.js +8 -0
  234. package/dist/assets/skill-CmNmHGLf.js +8 -0
  235. package/dist/assets/skill-DGY2KDYe.js +8 -0
  236. package/dist/assets/skill-DOzQHGwb.js +8 -0
  237. package/dist/assets/skill-X6jBvGkj.js +8 -0
  238. package/dist/assets/skill-mW9sBB4h.js +8 -0
  239. package/dist/assets/skill-o1t7rk9x.js +8 -0
  240. package/dist/assets/skill-ufNnZ28x.js +8 -0
  241. package/dist/assets/{slider-DftS7Sgq.js → slider-DTkR70h5.js} +1 -1
  242. package/dist/assets/{sliders-horizontal-IRYvZwMD.js → sliders-horizontal-B9zIWPLK.js} +1 -1
  243. package/dist/assets/{solana-wallets-B1CbyTFb.js → solana-wallets-C3-1zaf5.js} +2 -2
  244. package/dist/assets/{solana-wallets-vue-Bf5vJMRO.js → solana-wallets-vue-tqXpV-EK.js} +1 -1
  245. package/dist/assets/sora-Bs-MLj1B.js +1 -0
  246. package/dist/assets/{pixverse-CD6OU0x8.js → sora-CRXgdPdI.js} +1 -1
  247. package/dist/assets/{sparkles-DO7k2rdB.js → sparkles-ZIpFDwe5.js} +1 -1
  248. package/dist/assets/square-CwMDSLCu.js +1 -0
  249. package/dist/assets/store-ejQKhlRj.js +1 -0
  250. package/dist/assets/subsite-Bw-69e_3.js +1 -0
  251. package/dist/assets/{suno-Dv09L3I8.js → suno-CHQLw2LR.js} +2 -2
  252. package/dist/assets/{suno-BeMa5iXp.js → suno-DuvxR84W.js} +1 -1
  253. package/dist/assets/{switch-BK65lk1B.js → switch-DAdN8Vh2.js} +1 -1
  254. package/dist/assets/{table-CsDCpixQ.js → table-DG76fdz9.js} +1 -1
  255. package/dist/assets/{tabs-D4L0iUrz.js → tabs--xygkAUx.js} +1 -1
  256. package/dist/assets/{tag-dllrlH7L.js → tag-CpHzgK0_.js} +1 -1
  257. package/dist/assets/taskDrawerMixin-DyAUhFEq.js +1 -0
  258. package/dist/assets/terminal-p3haoUR9.js +1 -0
  259. package/dist/assets/{time-picker-C7stOWq7.js → time-picker-mD-BhI85.js} +1 -1
  260. package/dist/assets/{tooltip-qUtLFuMO.js → tooltip-Dy1LvOzq.js} +1 -1
  261. package/dist/assets/{trash-2-Bpdf-yvt.js → trash-2-D_NoEBBp.js} +1 -1
  262. package/dist/assets/{triangle-alert-8jr8sw3e.js → triangle-alert-BK4-7oIL.js} +1 -1
  263. package/dist/assets/{upload-ClxIGeiH.js → upload-D_Iy8VUb.js} +1 -1
  264. package/dist/assets/{upload-rtgu1fiP.js → upload-DqEeyoiI.js} +1 -1
  265. package/dist/assets/user-Dzf5Fm_O.js +1 -0
  266. package/dist/assets/vendor-highlight-BHrfT4-E.js +5 -0
  267. package/dist/assets/vendor-highlight-XQIgUEMi.css +1 -0
  268. package/dist/assets/{veo-CAjfthzH.js → veo-BJbqBk7K.js} +1 -1
  269. package/dist/assets/{video-PQKZqx-_.js → video-Ce-Ja6Ku.js} +1 -1
  270. package/dist/assets/{volume-2-oJUwQDyM.js → volume-2-B0OmSr3V.js} +1 -1
  271. package/dist/assets/{wallet-xexJXK-y.js → wallet-D16wnA4X.js} +1 -1
  272. package/dist/assets/wan-CHl84oZe.js +1 -0
  273. package/dist/assets/{wand-sparkles-pjNJLsqz.js → wand-sparkles-CpJf9L5C.js} +1 -1
  274. package/dist/assets/{web-CBJi7a1m.js → web-2rte_Iql.js} +1 -1
  275. package/dist/assets/{web-BQ4yhUAP.js → web-ChLkUjRK.js} +1 -1
  276. package/dist/assets/{web-Y5iRCj0B.js → web-CjHGXeZy.js} +1 -1
  277. package/dist/assets/{web-DaeaGVQ9.js → web-R9wbecSS.js} +1 -1
  278. package/dist/assets/web-sM2d7cVw.js +1 -0
  279. package/dist/assets/{webextrator-C8MIgaCB.js → webextrator-CPKVHzM9.js} +1 -1
  280. package/dist/assets/{zap-NExMhJi9.js → zap-DDJuUmtO.js} +1 -1
  281. package/dist/index.html +3 -3
  282. package/package.json +1 -1
  283. package/dist/assets/ApiCodeButton-BOMuF77p.js +0 -1
  284. package/dist/assets/AskUserQuestionCard-VrUkudAk.js +0 -20
  285. package/dist/assets/CodeSnippet-CFv-0vOS.js +0 -1
  286. package/dist/assets/Console-CAzD9m97.js +0 -1
  287. package/dist/assets/Conversation-Bfe3AJIT.js +0 -1
  288. package/dist/assets/Conversation-MaYBU2PW.js +0 -1
  289. package/dist/assets/Detail-B3Hrq7Ra.js +0 -2
  290. package/dist/assets/Extra-DLV9civS.js +0 -1
  291. package/dist/assets/Index-7Nb9tT4B.js +0 -1
  292. package/dist/assets/Index-B-a59plD.js +0 -1
  293. package/dist/assets/Index-BIQxjo24.js +0 -1
  294. package/dist/assets/Index-BKVoN3Af.js +0 -1
  295. package/dist/assets/Index-BU8qvu0P.js +0 -1
  296. package/dist/assets/Index-BeM0UrrX2.js +0 -1
  297. package/dist/assets/Index-C5mMGnuZ.js +0 -1
  298. package/dist/assets/Index-C7LeUsin.js +0 -1
  299. package/dist/assets/Index-C9eePlJ_.js +0 -1
  300. package/dist/assets/Index-CPAuiWtG.js +0 -1
  301. package/dist/assets/Index-CfS81-kv.js +0 -1
  302. package/dist/assets/Index-D7KHB928.js +0 -1
  303. package/dist/assets/Index-DM1JPBiZ.js +0 -1
  304. package/dist/assets/Index-DexatKJn2.js +0 -1
  305. package/dist/assets/Index-Dm2AEiMJ.js +0 -1
  306. package/dist/assets/Index-L8IG973_.js +0 -1
  307. package/dist/assets/Index-T0tMvwCY.js +0 -1
  308. package/dist/assets/Index-Xs2ZSEWu.js +0 -1
  309. package/dist/assets/Index-eo3jBrLq.js +0 -1
  310. package/dist/assets/Index-wm2N6kNj.js +0 -1
  311. package/dist/assets/List-ElywpzNh.js +0 -1
  312. package/dist/assets/LocalTools-CpYKdEIy.js +0 -5
  313. package/dist/assets/Message-CTc5XaFh.js +0 -3
  314. package/dist/assets/Model-DoDqd4yC.js +0 -1
  315. package/dist/assets/Pay-C6LB3le3.js +0 -1
  316. package/dist/assets/ScheduledTasks-D5bqoHNi.js +0 -2
  317. package/dist/assets/application-BxWkr4G9.js +0 -1
  318. package/dist/assets/arrow-down-HJt9FmJm.js +0 -1
  319. package/dist/assets/arrow-left-CUCwYVxK.js +0 -1
  320. package/dist/assets/arrow-right-BCj9oL-J.js +0 -1
  321. package/dist/assets/arrow-up-D0qX2G8d.js +0 -1
  322. package/dist/assets/avatar-DhPL9Vis.js +0 -1
  323. package/dist/assets/byok-DHOdfufU.js +0 -1
  324. package/dist/assets/check-BI8o1sHQ.js +0 -1
  325. package/dist/assets/chevron-down-DbCcEg9Y.js +0 -1
  326. package/dist/assets/chevron-right-HCeDz9Zy.js +0 -1
  327. package/dist/assets/circle-check-BkFQlwkf.js +0 -1
  328. package/dist/assets/clock-D-h5ShMs.js +0 -1
  329. package/dist/assets/common-D9rVh4i4.js +0 -1
  330. package/dist/assets/digitalhuman-BkJwNrqn.js +0 -1
  331. package/dist/assets/esm-BV7TKUnr.js +0 -1
  332. package/dist/assets/gauge-B0RLwq7H.js +0 -1
  333. package/dist/assets/loader-circle-CtI9qMSe.js +0 -1
  334. package/dist/assets/music-2-D0ZYCPX5.js +0 -1
  335. package/dist/assets/order-mdMeAKDl.js +0 -1
  336. package/dist/assets/pagination-j6-MXuok.js +0 -1
  337. package/dist/assets/pixverse-DRSxcF4B.js +0 -1
  338. package/dist/assets/play-BPY31d2O.js +0 -1
  339. package/dist/assets/plus-BpF_-3UA.js +0 -1
  340. package/dist/assets/realtime-E-VdTNYR.js +0 -1
  341. package/dist/assets/rotate-ccw-BLq3mw96.js +0 -1
  342. package/dist/assets/rotate-cw-CXB0mV84.js +0 -1
  343. package/dist/assets/search-B5pc_XQM.js +0 -1
  344. package/dist/assets/sora-DJnPtn3L.js +0 -1
  345. package/dist/assets/square-ClBOyqhd.js +0 -1
  346. package/dist/assets/subsite-VdEaGCsY.js +0 -1
  347. package/dist/assets/taskDrawerMixin-BnaaHNWt.js +0 -1
  348. package/dist/assets/terminal-BxMtwACq.js +0 -1
  349. package/dist/assets/user-CZsVj6tF.js +0 -1
  350. package/dist/assets/vendor-highlight-BtIeKitL.js +0 -5
  351. package/dist/assets/vendor-highlight-DFgTH0rK.css +0 -1
  352. package/dist/assets/wan-D9l-_qnz.js +0 -1
  353. package/dist/assets/web-AKBFUEeU.js +0 -1
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,I as n,Jt as r,L as i,M as a,N as o,S as s,T as c,at as l,ht as u,it as d,j as f,mt as p,ot as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{W as y}from"./use-deprecated-r4dlLNqm.js";import{r as b,t as x}from"./select-LvaKgyRc.js";import{n as S,t as C}from"./tabs--xygkAUx.js";import{t as w}from"./upload-DqEeyoiI.js";import{t as T}from"./tooltip-Dy1LvOzq.js";import{t as E}from"./alert-BY_joJSO.js";import{t as D}from"./avatar-CGdf6QsT.js";import{n as O,r as k}from"./radio-DgDgyT2l.js";import{n as A,t as j}from"./collapse-2ZkQBwEA.js";import{t as M}from"./drawer-DdjNUdLN.js";import{n as N,r as P,t as F}from"./dropdown-CMiXxU1B.js";import{t as I}from"./input-number-Dz4VZooF.js";import{n as L,t as R}from"./skeleton-B3LIGUiE.js";import{t as z}from"./slider-DTkR70h5.js";import{t as B}from"./switch-DAdN8Vh2.js";import{i as V,n as ee,r as H,t as te}from"./Player-DQrkjYkn.js";import{t as ne}from"./code-D3E3xVo1.js";import{t as re}from"./download-LDDA2n95.js";import{t as ie}from"./ellipsis-CP-BL-iO.js";import{r as ae,t as oe}from"./PromptTextarea-BdxR43fI.js";import{t as se}from"./image-Ctt9oB_3.js";import{t as ce}from"./info-RB2UKcjL.js";import{t as le}from"./loader-circle-Cw68u1V8.js";import{t as U}from"./pause-Chqy-1mW.js";import{t as W}from"./play-vgkRlP0T.js";import{t as ue}from"./triangle-alert-BK4-7oIL.js";import{t as de}from"./upload-D_Iy8VUb.js";import{t as G}from"./wand-sparkles-CpJf9L5C.js";import{$n as fe}from"./constants-Dm-HitpB.js";import{E as K,Gt as pe,Ji as q,Kt as me,Mn as J,Oi as Y,Sr as he,Ti as X,Ut as ge,Wt as _e,Yt as ve,ci as Z,cn as ye,di as be,hr as xe,in as Se,zi as Q}from"./index-NQhLFvCT.js";import{t as Ce}from"./CopyToClipboard-DAsxz05c.js";import{n as we}from"./taskDrawerMixin-DyAUhFEq.js";import{t as Te}from"./Consumption-DWMEoulW.js";import{a as $,i as Ee,n as De,r as Oe,t as ke}from"./pagination-D0u3tuFM.js";var Ae=v({name:`LayoutProducer`,components:{MagicIcon:G,ElDrawer:M,ElButton:Q},mixins:[we],data(){return{preview:!1}},computed:{}}),je={class:`main flex flex-row flex-1`},Me={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ne={class:`result h-full flex flex-col flex-1 min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`},Pe={class:`preview h-full w-[300px] flex flex-col`};function Fe(t,n,r,a,s,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),o(`div`,je,[e(`div`,Me,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ne,[d(t.$slots,`result`,{},void 0,!0)]),e(`div`,Pe,[d(t.$slots,`preview`,{},void 0,!0)]),u(i(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[i(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),i(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Ie=K(Ae,[[`render`,Fe],[`__scopeId`,`data-v-6461643a`]]),Le=v({name:`TypeSelector`,components:{ElSelect:b,ElOption:x,ElSwitch:B,InfoIcon:$},data(){return{options:[{label:`FUZZ-2.0 Pro`,value:`FUZZ-2.0 Pro`,desc:this.$t(`producer.model.fuzz20proDesc`)},{label:`FUZZ-2.0`,value:`FUZZ-2.0`,desc:this.$t(`producer.model.fuzz20desc`)},{label:`FUZZ-2.0 Raw`,value:`FUZZ-2.0 Raw`,desc:this.$t(`producer.model.fuzz20rawDesc`)},{label:`FUZZ-1.1 Pro`,value:`FUZZ-1.1 Pro`,desc:this.$t(`producer.model.fuzz11proDesc`)},{label:`FUZZ-1.1`,value:`FUZZ-1.1`,desc:this.$t(`producer.model.fuzz11desc`)},{label:`FUZZ-1.0 Pro`,value:`FUZZ-1.0 Pro`,desc:this.$t(`producer.model.fuzz10proDesc`)},{label:`FUZZ-1.0`,value:`FUZZ-1.0`,desc:this.$t(`producer.model.fuzz10desc`)},{label:`FUZZ-0.8`,value:`FUZZ-0.8`,desc:this.$t(`producer.model.fuzz08desc`)}]}},computed:{custom:{get(){return this.$store.state.producer?.config?.custom||!1},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,custom:e})}},instrumental:{get(){return this.$store.state.producer?.config?.instrumental||!1},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,instrumental:e})}},model:{get(){return this.$store.state.producer?.config?.model},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:e})}}},mounted(){this.model||=fe}}),Re={class:`mb-3`},ze={class:`flex items-center mb-1`},Be={class:`text-sm font-bold`},Ve={class:`model-option`},He={class:`model-option-name`},Ue={class:`model-option-desc`},We={key:0,class:`flex items-center justify-between mb-3`},Ge={class:`flex items-center`},Ke={class:`text-sm font-bold`};function qe(t,n,s,u,d,m){let _=l(`el-option`),v=l(`el-select`),y=l(`info-icon`),b=l(`el-switch`);return g(),o(`div`,null,[e(`div`,Re,[e(`div`,ze,[e(`span`,Be,r(t.$t(`producer.name.model`)),1)]),i(v,{modelValue:t.model,"onUpdate:modelValue":n[0]||=e=>t.model=e,class:`w-full model-select`,size:`default`,placeholder:t.$t(`producer.placeholder.select`)},{default:p(()=>[(g(!0),o(c,null,h(t.options,t=>(g(),f(_,{key:t.value,label:t.label,value:t.value},{default:p(()=>[e(`div`,Ve,[e(`span`,He,r(t.label),1),e(`span`,Ue,r(t.desc),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),t.custom?(g(),o(`div`,We,[e(`div`,Ge,[e(`span`,Ke,r(t.$t(`producer.name.instrumental`)),1),i(y,{content:t.$t(`producer.description.instrumental`)},null,8,[`content`])]),i(b,{modelValue:t.instrumental,"onUpdate:modelValue":n[1]||=e=>t.instrumental=e},null,8,[`modelValue`])])):a(``,!0)])}var Je=K(Le,[[`render`,qe],[`__scopeId`,`data-v-42496b9a`]]),Ye=v({name:`UploadAudio`,components:{UploadIcon:de,ElUpload:w,ElButton:Q,ElRadioGroup:k,ElRadioButton:O,InfoIcon:$},mixins:[me,_e],emits:[`change`],data(){return{fileList:[],uploadUrl:be()+`/api/v1/files/`,audioPreviewUrl:null,uploading:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},hasUploadedAudio(){let e=this.$store.state.producer?.config?.action;return e===`upload_extend`||e===`upload_cover`},uploadAction:{get(){return this.$store.state.producer?.config?.action||`upload_extend`},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,action:e})}}},watch:{urls:{handler(e){this.$emit(`change`,e)}}},methods:{onExceed(){X.warning(this.$t(`producer.message.uploadReferencesExceed`))},onError(){this.uploading=!1,X.error(this.$t(`producer.message.uploadReferencesError`))},async onSuccess(){let e=this.urls?.[0];if(!e){this.uploading=!1;return}this.audioPreviewUrl=e,await this.onGenerateAudioId(e)},async onGenerateAudioId(e){let t={audio_url:e},n=this.credential?.token;if(!n){console.error(`no token specified`),this.uploading=!1;return}this.uploading=!0,X.info(this.$t(`producer.message.startingUploadAudio`));try{let e=(await J.upload(t,{token:n})).data?.data.audio_id;this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,audio_id:e,action:`upload_extend`}),X.success(this.$t(`producer.message.startUploadAudioSuccess`))}catch(e){X.error(e?.response?.data?.error?.message||this.$t(`producer.message.startUploadAudioFailed`))}finally{this.uploading=!1}}}}),Xe={class:`relative`},Ze={class:`flex justify-between items-center mb-2`},Qe={class:`flex justify-start items-center`},$e={class:`text-sm font-bold`},et={key:0,class:`mb-2`},tt=[`src`],nt={key:1,class:`mt-1`};function rt(t,s,c,u,d,f){let m=l(`info-icon`),h=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`),y=l(`el-radio-button`),b=l(`el-radio-group`);return g(),o(`div`,Xe,[e(`div`,Ze,[e(`div`,Qe,[e(`span`,$e,r(t.$t(`producer.name.referenceAudios`)),1),i(m,{content:t.$t(`producer.description.uploadAudios`)},null,8,[`content`])]),i(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,limit:1,class:`upload-wrapper inline-upload`,action:t.uploadUrl,accept:`.mp3,.wav,.m4a,audio/*`,"show-file-list":!1,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{default:p(()=>[i(_,{round:``,type:`primary`,size:`small`,loading:t.uploading},{default:p(()=>[i(h,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.$t(`producer.button.uploadAudios`)),1)]),_:1},8,[`loading`])]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.audioPreviewUrl?(g(),o(`div`,et,[e(`audio`,{src:t.audioPreviewUrl,controls:``,class:`w-full`},null,8,tt)])):a(``,!0),t.hasUploadedAudio?(g(),o(`div`,nt,[i(b,{modelValue:t.uploadAction,"onUpdate:modelValue":s[1]||=e=>t.uploadAction=e,size:`small`},{default:p(()=>[i(y,{value:`upload_extend`},{default:p(()=>[n(r(t.$t(`producer.button.extend`)),1)]),_:1}),i(y,{value:`upload_cover`},{default:p(()=>[n(r(t.$t(`producer.button.cover_music`)),1)]),_:1})]),_:1},8,[`modelValue`])])):a(``,!0)])}var it=K(Ye,[[`render`,rt],[`__scopeId`,`data-v-39eb655b`]]),at=v({name:`PromptInput`,components:{PromptTextarea:oe},computed:{prompt:{get(){return this.$store.state.producer?.config?.prompt},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,prompt:e})}}},mounted(){this.prompt||=``}});function ot(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`producer.name.songDescription`),info:e.$t(`producer.description.prompt`),placeholder:e.$t(`producer.placeholder.prompt`),"min-rows":5,"max-rows":14},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var st=K(at,[[`render`,ot]]),ct=v({name:`LyricInput`,components:{MagicIcon:G,ElInput:q,ElButton:Q,InfoIcon:$},data(){return{generatingLyrics:!1}},computed:{lyric:{get(){return this.$store.state.producer?.config?.lyric},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,lyric:e})}},config(){return this.$store.state.producer?.config},credential(){return this.$store.state.producer?.credential}},mounted(){this.lyric||=``},methods:{async onGenerateLyrics(){let e=this.credential?.token;if(!e)return;let t=this.config?.style||this.config?.title||`a beautiful song`;this.generatingLyrics=!0,X.info(this.$t(`producer.message.generatingLyrics`));try{let n=(await J.lyric({prompt:t},{token:e})).data?.data;n?.text&&(this.lyric=n.text,n?.title&&!this.config?.title&&this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,lyric:n.text,title:n.title}),X.success(this.$t(`producer.message.generateLyricsSuccess`)))}catch{X.error(this.$t(`producer.message.generateLyricsFailed`))}finally{this.generatingLyrics=!1}}}}),lt={class:`field`},ut={class:`flex items-center justify-between mb-1`},dt={class:`flex items-center`},ft={class:`text-sm font-bold`};function pt(t,s,c,u,d,m){let h=l(`info-icon`),_=l(`magic-icon`),v=l(`el-button`),y=l(`el-input`);return g(),o(`div`,lt,[e(`div`,ut,[e(`div`,dt,[e(`span`,ft,r(t.$t(`producer.name.lyrics`)),1),i(h,{content:t.$t(`producer.description.lyrics`)},null,8,[`content`])]),t.config?.action===`extend`?a(``,!0):(g(),f(v,{key:0,size:`small`,loading:t.generatingLyrics,round:``,onClick:t.onGenerateLyrics},{default:p(()=>[t.generatingLyrics?a(``,!0):(g(),f(_,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),n(` `+r(t.$t(`producer.button.generate_lyrics`)),1)]),_:1},8,[`loading`,`onClick`]))]),t.config?.action===`extend`?(g(),f(y,{key:1,modelValue:t.lyric,"onUpdate:modelValue":s[1]||=e=>t.lyric=e,rows:5,type:`textarea`,class:`lyrics`,placeholder:t.$t(`producer.placeholder.extend.lyrics`)},null,8,[`modelValue`,`placeholder`])):(g(),f(y,{key:0,modelValue:t.lyric,"onUpdate:modelValue":s[0]||=e=>t.lyric=e,rows:5,type:`textarea`,class:`lyrics`,placeholder:t.$t(`producer.placeholder.lyrics`)},null,8,[`modelValue`,`placeholder`]))])}var mt=K(ct,[[`render`,pt],[`__scopeId`,`data-v-b1a497a4`]]),ht=v({name:`StyleInput`,components:{ElInput:q,InfoIcon:$},computed:{style:{get(){return this.$store.state.producer?.config?.style},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,style:e})}}}}),gt={class:`field`},_t={class:`flex items-center justify-between mb-1`},vt={class:`flex items-center`},yt={class:`text-sm font-bold`};function bt(t,n,a,s,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),o(`div`,gt,[e(`div`,_t,[e(`div`,vt,[e(`span`,yt,r(t.$t(`producer.name.style`)),1),i(d,{content:t.$t(`producer.description.style`)},null,8,[`content`])])]),i(f,{modelValue:t.style,"onUpdate:modelValue":n[0]||=e=>t.style=e,rows:2,type:`textarea`,placeholder:t.$t(`producer.placeholder.style`)},null,8,[`modelValue`,`placeholder`])])}var xt=K(ht,[[`render`,bt]]),St=v({name:`TitleInput`,components:{ElInput:q,InfoIcon:$},computed:{title:{get(){return this.$store.state.producer?.config?.title},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,title:e})}}}}),Ct={class:`field`},wt={class:`flex items-center mb-1`},Tt={class:`text-sm font-bold`};function Et(t,n,a,s,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),o(`div`,Ct,[e(`div`,wt,[e(`span`,Tt,r(t.$t(`producer.name.title`)),1),i(d,{content:t.$t(`producer.description.title`)},null,8,[`content`])]),i(f,{modelValue:t.title,"onUpdate:modelValue":n[0]||=e=>t.title=e,placeholder:t.$t(`producer.placeholder.title`)},null,8,[`modelValue`,`placeholder`])])}var Dt=K(St,[[`render`,Et]]),Ot=v({name:`ExtendFromInput`,components:{ElImage:Y,ElIcon:y,ElInputNumber:I,VideoPlay:W,VideoPause:U},data(){return{}},computed:{audio(){return this.$store.state.producer?.config?.audio},value:{get(){return this.$store.state.producer?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:H,onPlay(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),kt={class:`field`},At={class:`box`},jt={class:`title font-bold`},Mt={class:`input-wrapper`},Nt={class:`task`},Pt={class:`left`},Ft=[`aria-label`,`title`],It=[`aria-label`,`title`],Lt={key:2,class:`duration`},Rt={class:`info`},zt={class:`title`},Bt={class:`style`};function Vt(n,c,d,f,h,_){let v=l(`el-input-number`),y=l(`el-image`),b=l(`video-pause`),x=l(`el-icon`),S=l(`video-play`),C=m(`loading`);return g(),o(`div`,kt,[e(`div`,At,[e(`h2`,jt,r(n.$t(`producer.name.extend`)),1),e(`div`,Mt,[i(v,{modelValue:n.value,"onUpdate:modelValue":c[0]||=e=>n.value=e,class:`value`,min:0,max:n.audio?.duration,controls:!1,placeholder:n.$t(`producer.placeholder.extend.continue_at`),onChange:n.handleChange},null,8,[`modelValue`,`max`,`placeholder`,`onChange`])])]),e(`div`,Nt,[n.audio?(g(),o(`div`,{key:0,class:`audio`,onClick:c[7]||=e=>n.onClick(n.audio)},[u((g(),o(`div`,Pt,[i(y,{src:n.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),n.audio?.audio_url&&n.$store.state?.producer?.audio?.id===n.audio.id&&n.$store.state?.producer?.audio?.state===`playing`?(g(),o(`div`,{key:0,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.pause`),title:n.$t(`common.player.pause`),onClick:c[1]||=e=>n.onPause(n.audio),onKeydown:[c[2]||=s(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`enter`]),c[3]||=s(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`space`])]},[i(x,null,{default:p(()=>[i(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,Ft)):a(``,!0),n.audio?.audio_url&&(n.$store.state?.producer?.audio?.id!==n.audio.id||n.$store.state?.producer?.audio?.id===n.audio.id&&n.$store.state?.producer?.audio?.state===`paused`)?(g(),o(`div`,{key:1,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.play`),title:n.$t(`common.player.play`),onClick:c[4]||=e=>n.onPlay(n.audio),onKeydown:[c[5]||=s(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`enter`]),c[6]||=s(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`space`])]},[i(x,null,{default:p(()=>[i(S,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,It)):a(``,!0),n.audio?.duration?(g(),o(`div`,Lt,r(n.useFormatDuring(n.audio?.duration)),1)):a(``,!0)])),[[C,!n.audio?.audio_url]]),e(`div`,Rt,[e(`h2`,zt,r(n.audio?.title),1),e(`p`,Bt,r(n.audio?.style),1)])])):a(``,!0)])])}var Ht=K(Ot,[[`render`,Vt],[`__scopeId`,`data-v-96005bd8`]]),Ut=v({name:`CoverFromInput`,components:{ElImage:Y,ElIcon:y,VideoPlay:W,VideoPause:U},data(){return{}},computed:{audio(){return this.$store.state.producer?.config?.audio},value:{get(){return this.$store.state.producer?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:H,onPlay(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Wt={class:`field`},Gt={class:`box`},Kt={class:`title font-bold`},qt={class:`task`},Jt={class:`left`},Yt=[`aria-label`,`title`],Xt=[`aria-label`,`title`],Zt={key:2,class:`duration`},Qt={class:`info`},$t={class:`title`},en={class:`style`};function tn(n,c,d,f,h,_){let v=l(`el-image`),y=l(`video-pause`),b=l(`el-icon`),x=l(`video-play`),S=m(`loading`);return g(),o(`div`,Wt,[e(`div`,Gt,[e(`h2`,Kt,r(n.$t(`producer.name.cover`)),1)]),e(`div`,qt,[n.audio?(g(),o(`div`,{key:0,class:`audio`,onClick:c[6]||=e=>n.onClick(n.audio)},[u((g(),o(`div`,Jt,[i(v,{src:n.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),n.audio?.audio_url&&n.$store.state?.producer?.audio?.id===n.audio.id&&n.$store.state?.producer?.audio?.state===`playing`?(g(),o(`div`,{key:0,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.pause`),title:n.$t(`common.player.pause`),onClick:c[0]||=e=>n.onPause(n.audio),onKeydown:[c[1]||=s(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`enter`]),c[2]||=s(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`space`])]},[i(b,null,{default:p(()=>[i(y,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,Yt)):a(``,!0),n.audio?.audio_url&&(n.$store.state?.producer?.audio?.id!==n.audio.id||n.$store.state?.producer?.audio?.id===n.audio.id&&n.$store.state?.producer?.audio?.state===`paused`)?(g(),o(`div`,{key:1,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.play`),title:n.$t(`common.player.play`),onClick:c[3]||=e=>n.onPlay(n.audio),onKeydown:[c[4]||=s(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`enter`]),c[5]||=s(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`space`])]},[i(b,null,{default:p(()=>[i(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,Xt)):a(``,!0),n.audio?.duration?(g(),o(`div`,Zt,r(n.useFormatDuring(n.audio?.duration)),1)):a(``,!0)])),[[S,!n.audio?.audio_url]]),e(`div`,Qt,[e(`h2`,$t,r(n.audio?.title),1),e(`p`,en,r(n.audio?.style),1)])])):a(``,!0)])])}var nn=K(Ut,[[`render`,tn],[`__scopeId`,`data-v-9a4b0b16`]]),rn=v({name:`VocalGenderSelector`,components:{ElRadioGroup:k,ElRadioButton:O,InfoIcon:$},computed:{vocalGender:{get(){return this.$store.state.producer?.config?.vocal_gender||``},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,vocal_gender:e||void 0})}}}}),an={class:`mb-2`},on={class:`flex items-center mb-1`},sn={class:`text-sm font-bold`};function cn(t,a,s,c,u,d){let f=l(`info-icon`),m=l(`el-radio-button`),h=l(`el-radio-group`);return g(),o(`div`,an,[e(`div`,on,[e(`span`,sn,r(t.$t(`producer.name.vocalGender`)),1),i(f,{content:t.$t(`producer.description.vocalGender`)},null,8,[`content`])]),i(h,{modelValue:t.vocalGender,"onUpdate:modelValue":a[0]||=e=>t.vocalGender=e},{default:p(()=>[i(m,{value:``},{default:p(()=>[n(r(t.$t(`producer.gender.auto`)),1)]),_:1}),i(m,{value:`f`},{default:p(()=>[n(r(t.$t(`producer.gender.female`)),1)]),_:1}),i(m,{value:`m`},{default:p(()=>[n(r(t.$t(`producer.gender.male`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var ln=K(rn,[[`render`,cn]]),un=v({name:`AdvancedParams`,components:{ElCollapse:j,ElCollapseItem:A,ElInput:q,ElSlider:z,ElInputNumber:I,InfoIcon:$},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.producer?.config},styleNegative:{get(){return this.$store.state.producer?.config?.style_negative||``},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,style_negative:e||void 0})}},lyricPrompt:{get(){return this.$store.state.producer?.config?.lyric_prompt||``},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,lyric_prompt:e||void 0})}},weirdness:{get(){return this.$store.state.producer?.config?.weirdness??.5},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,weirdness:e})}},soundStrength:{get(){return this.$store.state.producer?.config?.sound_strength??.7},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,sound_strength:e})}},lyricsStrength:{get(){return this.$store.state.producer?.config?.lyrics_strength??.7},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,lyrics_strength:e})}},seed:{get(){return this.$store.state.producer?.config?.seed},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,seed:e})}}},mounted(){let e=this.$store.state.producer?.config;if(!e)return;let t={};typeof e.weirdness==`number`&&e.weirdness>1&&(t.weirdness=e.weirdness/100),typeof e.sound_strength==`number`&&e.sound_strength>1&&(t.sound_strength=e.sound_strength/100),typeof e.lyrics_strength==`number`&&e.lyrics_strength>1&&(t.lyrics_strength=e.lyrics_strength/100),Object.keys(t).length>0&&this.$store.commit(`producer/setConfig`,{...e,...t})}}),dn={key:0,class:`mb-3`},fn={class:`flex items-center mb-1`},pn={class:`text-xs font-bold`},mn={key:1,class:`mb-3`},hn={class:`flex items-center mb-1`},gn={class:`text-xs font-bold`},_n={class:`mb-3`},vn={class:`flex items-center justify-between mb-1`},yn={class:`flex items-center`},bn={class:`text-xs font-bold`},xn={class:`text-xs text-[var(--el-text-color-secondary)]`},Sn={class:`mb-3`},Cn={class:`flex items-center justify-between mb-1`},wn={class:`flex items-center`},Tn={class:`text-xs font-bold`},En={class:`text-xs text-[var(--el-text-color-secondary)]`},Dn={key:2,class:`mb-3`},On={class:`flex items-center justify-between mb-1`},kn={class:`flex items-center`},An={class:`text-xs font-bold`},jn={class:`text-xs text-[var(--el-text-color-secondary)]`},Mn={class:`mb-3`},Nn={class:`flex items-center mb-1`},Pn={class:`text-xs font-bold`};function Fn(t,n,s,c,u,d){let m=l(`info-icon`),h=l(`el-input`),_=l(`el-slider`),v=l(`el-input-number`),y=l(`el-collapse-item`),b=l(`el-collapse`);return g(),f(b,{modelValue:t.activeNames,"onUpdate:modelValue":n[6]||=e=>t.activeNames=e,class:`advanced-collapse`},{default:p(()=>[i(y,{title:t.$t(`producer.name.advancedParams`),name:`advanced`},{default:p(()=>[t.config?.custom?(g(),o(`div`,dn,[e(`div`,fn,[e(`span`,pn,r(t.$t(`producer.name.styleNegative`)),1),i(m,{content:t.$t(`producer.description.styleNegative`)},null,8,[`content`])]),i(h,{modelValue:t.styleNegative,"onUpdate:modelValue":n[0]||=e=>t.styleNegative=e,size:`small`,placeholder:t.$t(`producer.placeholder.styleNegative`)},null,8,[`modelValue`,`placeholder`])])):a(``,!0),t.config?.custom&&!t.config?.instrumental?(g(),o(`div`,mn,[e(`div`,hn,[e(`span`,gn,r(t.$t(`producer.name.lyricPrompt`)),1),i(m,{content:t.$t(`producer.description.lyricPrompt`)},null,8,[`content`])]),i(h,{modelValue:t.lyricPrompt,"onUpdate:modelValue":n[1]||=e=>t.lyricPrompt=e,size:`small`,placeholder:t.$t(`producer.placeholder.lyricPrompt`)},null,8,[`modelValue`,`placeholder`])])):a(``,!0),e(`div`,_n,[e(`div`,vn,[e(`div`,yn,[e(`span`,bn,r(t.$t(`producer.name.weirdness`)),1),i(m,{content:t.$t(`producer.description.weirdness`)},null,8,[`content`])]),e(`span`,xn,r(t.weirdness??.5),1)]),i(_,{modelValue:t.weirdness,"onUpdate:modelValue":n[2]||=e=>t.weirdness=e,min:0,max:1,step:.01},null,8,[`modelValue`])]),e(`div`,Sn,[e(`div`,Cn,[e(`div`,wn,[e(`span`,Tn,r(t.$t(`producer.name.soundStrength`)),1),i(m,{content:t.$t(`producer.description.soundStrength`)},null,8,[`content`])]),e(`span`,En,r(t.soundStrength??.7),1)]),i(_,{modelValue:t.soundStrength,"onUpdate:modelValue":n[3]||=e=>t.soundStrength=e,min:.2,max:1,step:.01},null,8,[`modelValue`])]),t.config?.custom&&!t.config?.instrumental?(g(),o(`div`,Dn,[e(`div`,On,[e(`div`,kn,[e(`span`,An,r(t.$t(`producer.name.lyricsStrength`)),1),i(m,{content:t.$t(`producer.description.lyricsStrength`)},null,8,[`content`])]),e(`span`,jn,r(t.lyricsStrength??.7),1)]),i(_,{modelValue:t.lyricsStrength,"onUpdate:modelValue":n[4]||=e=>t.lyricsStrength=e,min:0,max:1,step:.01},null,8,[`modelValue`])])):a(``,!0),e(`div`,Mn,[e(`div`,Nn,[e(`span`,Pn,r(t.$t(`producer.name.seed`)),1),i(m,{content:t.$t(`producer.description.seed`)},null,8,[`content`])]),i(v,{modelValue:t.seed,"onUpdate:modelValue":n[5]||=e=>t.seed=e,min:0,controls:!1,size:`small`,placeholder:t.$t(`producer.placeholder.seed`),class:`w-full`},null,8,[`modelValue`,`placeholder`])])]),_:1},8,[`title`])]),_:1},8,[`modelValue`])}var In=K(un,[[`render`,Fn],[`__scopeId`,`data-v-f9296888`]]),Ln=v({name:`ReplaceSectionInput`,components:{ElInputNumber:I,ElImage:Y,InfoIcon:$},computed:{audio(){return this.$store.state.producer?.config?.audio},replaceSectionStart:{get(){return this.$store.state.producer?.config?.replace_section_start},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,replace_section_start:e})}},replaceSectionEnd:{get(){return this.$store.state.producer?.config?.replace_section_end},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,replace_section_end:e})}}},methods:{onClick(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`playing`})}}}),Rn={class:`field`},zn={class:`flex items-center mb-2`},Bn={class:`text-sm font-bold m-0`},Vn={key:0,class:`task mb-2`},Hn={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Un={class:`info flex-1 min-w-0`},Wn={class:`text-sm font-bold m-0 truncate`},Gn={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Kn={class:`flex gap-2`};function qn(t,n,s,c,d,f){let p=l(`info-icon`),h=l(`el-image`),_=l(`el-input-number`),v=m(`loading`);return g(),o(`div`,Rn,[e(`div`,zn,[e(`h2`,Bn,r(t.$t(`producer.name.replaceSection`)),1),i(p,{content:t.$t(`producer.description.replaceSection`)},null,8,[`content`])]),t.audio?(g(),o(`div`,Vn,[e(`div`,{class:`audio flex items-center`,onClick:n[0]||=e=>t.onClick(t.audio)},[u((g(),o(`div`,Hn,[i(h,{src:t.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!t.audio?.audio_url]]),e(`div`,Un,[e(`h2`,Wn,r(t.audio?.title),1),e(`p`,Gn,r(t.audio?.style),1)])])])):a(``,!0),e(`div`,Kn,[i(_,{modelValue:t.replaceSectionStart,"onUpdate:modelValue":n[1]||=e=>t.replaceSectionStart=e,class:`flex-1`,min:0,max:t.audio?.duration,controls:!1,placeholder:t.$t(`producer.placeholder.replaceSectionStart`)},null,8,[`modelValue`,`max`,`placeholder`]),i(_,{modelValue:t.replaceSectionEnd,"onUpdate:modelValue":n[2]||=e=>t.replaceSectionEnd=e,class:`flex-1`,min:t.replaceSectionStart||0,max:t.audio?.duration,controls:!1,placeholder:t.$t(`producer.placeholder.replaceSectionEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var Jn=v({name:`PresetPanel`,components:{CleanupIcon:V,MagicIcon:G,TypeSelector:Je,PromptInput:st,LyricInput:mt,StyleInput:xt,TitleInput:Dt,ExtendFromInput:Ht,CoverFromInput:nn,UploadAudio:it,VocalGenderSelector:ln,AdvancedParams:In,ReplaceSectionInput:K(Ln,[[`render`,qn]]),ElButton:Q,ElTabs:S,ElTabPane:C,Consumption:Te},emits:[`generate`],computed:{config(){return this.$store.state.producer?.config},mode:{get(){return this.$store.state.producer?.config?.custom?`custom`:`simple`},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,custom:e===`custom`})}},consumption(){return ve(this.config,this.service?.cost)},service(){return this.$store.state.producer?.service},generateButtonText(){let e=this.config?.action;return e===`extend`||e===`upload_extend`?this.$t(`producer.button.extend`):e===`cover`||e===`upload_cover`?this.$t(`producer.button.cover_music`):e===`variation`?this.$t(`producer.button.variation`):e===`replace_section`?this.$t(`producer.button.replace_section`):e===`stems`?this.$t(`producer.button.get_stems`):e===`swap_vocals`?this.$t(`producer.button.swap_vocals`):e===`swap_instrumentals`?this.$t(`producer.button.swap_instrumentals`):this.$t(`producer.button.generate`)}},methods:{onGenerate(){this.$emit(`generate`)},onClearAll(){this.$store.commit(`producer/setConfig`,{custom:this.$store.state.producer?.config?.custom||!1,instrumental:!1,prompt:``,lyric:``,style:``,title:``,model:this.$store.state.producer?.config?.model})}}}),Yn={class:`flex flex-col h-full`},Xn={class:`flex-1 min-h-0 overflow-hidden`},Zn={class:`p-5`},Qn={class:`p-5`},$n={class:`flex flex-col items-center justify-center px-5 pb-5 gap-2`},er={class:`flex gap-2 w-full`};function tr(t,s,c,u,d,m){let h=l(`type-selector`),_=l(`upload-audio`),v=l(`prompt-input`),y=l(`extend-from-input`),b=l(`cover-from-input`),x=l(`replace-section-input`),S=l(`advanced-params`),C=l(`el-tab-pane`),w=l(`lyric-input`),T=l(`style-input`),E=l(`title-input`),D=l(`vocal-gender-selector`),O=l(`el-tabs`),k=l(`consumption`),A=l(`cleanup-icon`),j=l(`el-button`),M=l(`magic-icon`);return g(),o(`div`,Yn,[e(`div`,Xn,[i(O,{modelValue:t.mode,"onUpdate:modelValue":s[0]||=e=>t.mode=e,class:`producer-mode-tabs scenario-tabs scenario-tabs--scrollable scenario-tabs--divided`},{default:p(()=>[i(C,{label:t.$t(`producer.mode.simple`),name:`simple`},{default:p(()=>[e(`div`,Zn,[i(h,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),t.config?.action===`extend`?(g(),f(y,{key:0,class:`mb-4`})):a(``,!0),t.config?.action===`cover`?(g(),f(b,{key:1,class:`mb-4`})):a(``,!0),t.config?.action===`replace_section`?(g(),f(x,{key:2,class:`mb-4`})):a(``,!0),i(S,{class:`mb-4`})])]),_:1},8,[`label`]),i(C,{label:t.$t(`producer.mode.custom`),name:`custom`},{default:p(()=>[e(`div`,Qn,[i(h,{class:`mb-4`}),i(_,{class:`mb-4`}),t.config?.instrumental?a(``,!0):(g(),f(w,{key:0,class:`mb-4`})),i(T,{class:`mb-4`}),i(E,{class:`mb-4`}),t.config?.instrumental?a(``,!0):(g(),f(D,{key:1,class:`mb-4`})),t.config?.action===`extend`?(g(),f(y,{key:2,class:`mb-4`})):a(``,!0),t.config?.action===`cover`?(g(),f(b,{key:3,class:`mb-4`})):a(``,!0),t.config?.action===`replace_section`?(g(),f(x,{key:4,class:`mb-4`})):a(``,!0),i(S,{class:`mb-4`})])]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),e(`div`,$n,[i(k,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),e(`div`,er,[i(j,{class:`flex-1`,onClick:t.onClearAll},{default:p(()=>[i(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.$t(`producer.button.clear_all`)),1)]),_:1},8,[`onClick`]),i(j,{type:`primary`,class:`flex-1`,round:``,onClick:t.onGenerate},{default:p(()=>[i(M,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.generateButtonText),1)]),_:1},8,[`onClick`])])])])}var nr=K(Jn,[[`render`,tr],[`__scopeId`,`data-v-fb94614b`]]),rr=ee(),ir=v({name:`TaskPreview`,components:{ChannelIcon:ae,CodeIcon:ne,DownloadIcon:re,InfoIcon:ce,MagicIcon:G,MoreIcon:ie,WarningIcon:ue,ElAlert:E,ElImage:Y,ElIcon:y,ElTooltip:T,VideoPlay:W,VideoPause:U,ElDropdown:F,ElDropdownMenu:P,ElDropdownItem:N,Loading:le,ApiCodeDialog:Ee,CopyToClipboard:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1,apiCodeVisible:!1,apiCodePath:`/producer/audios`,apiCodeBody:{}}},computed:{loading(){return this.$store.state.producer?.status?.getApplications===Z.Request},showViewCode(){return ye()},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},task(){return this.$store.state.producer?.tasks},audios(){let e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(e=>({...e,action:t})):e},isFailure(){return this.audios.length===0&&(this.modelValue?.response?.success===!1||!!this.modelValue?.response?.error)},failureReason(){let e=this.modelValue?.response?.error;return typeof e==`string`?e:e?.message},traceId(){return this.modelValue?.response?.trace_id||this.modelValue?.trace_id},application(){return this.$store.state.producer?.application},active(){return this.$store.state.producer?.tasks?.active}},methods:{useFormatDuring:H,onViewCode(){let e=this.modelValue?.request||{},t={};Object.entries(e).forEach(([e,n])=>{e===`application_id`||e===`callback_url`||n!=null&&(typeof n==`string`&&n===``||Array.isArray(n)&&n.length===0||(t[e]=n))}),this.apiCodeBody=t,this.apiCodePath=`/producer/audios`,this.apiCodeVisible=!0},onPlay(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e?.stopPropagation(),console.debug(`set config`,t),this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:`extend`,audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e?.stopPropagation();let n=new URL(t).pathname,r=n.substring(n.lastIndexOf(`/`)+1);fetch(t).then(e=>e.blob()).then(e=>{(0,rr.saveAs)(e,r)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;let t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(e){console.error(`get videoUrl failed:`,e),X.error(this.$t(`producer.message.getVideoUrlFailed`))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,n)=>{let r={audio_id:e},i=this.credential?.token;if(!i){console.error(`no token specified`),n(Error(`No token specified`));return}J.video(r,{token:i}).then(e=>{let r=e.data?.data?.video_url;r?t(r):n(Error(`Video URL not found in response`))}).catch(e=>{n(e)})})},onPreview(e,t){e?.stopPropagation(),window.open(t,`_blank`)},async onGetStems(e){await this.onGenerateAudioUrl(`stems`,e)},onCover(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`cover`,audio:e,audio_id:e.id})},onVariation(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:e.model,custom:!0,style:e.style,action:`variation`,audio:e,audio_id:e.id})},async onSwapVocals(e){await this.onGenerateAudioUrl(`swap_vocals`,e)},async onSwapInstrumentals(e){await this.onGenerateAudioUrl(`swap_instrumentals`,e)},async onGetAllStems(e){await this.onGenerateAudioUrl(`all_stems`,e)},onReplaceSection(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`replace_section`,audio:e,audio_id:e.id,replace_section_start:0,replace_section_end:Math.min(30,e.duration||30)})},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;let t=this.credential?.token;if(t)try{this.isFetchingWav=!0,X.info(this.$t(`producer.message.fetchingWav`));let n=(await J.wav({audio_id:e.id},{token:t})).data?.data,r=Array.isArray(n)?n[0]?.file_url:n?.file_url||n?.audio_url;r?this.onDownload(null,r):X.error(this.$t(`producer.message.fetchWavFailed`))}catch{X.error(this.$t(`producer.message.fetchWavFailed`))}finally{this.isFetchingWav=!1}},async onGenerateAudioUrl(e,t){let n={action:e,audio_id:t,async:!0},r=this.credential?.token;if(!r){console.error(`no token specified`);return}X.info(this.$t(`producer.message.startingTask`)),J.audio(n,{token:r}).then(()=>{X.success(this.$t(`producer.message.startTaskSuccess`))}).catch(e=>{X.error(e?.response?.data?.error?.message||this.$t(`producer.message.startTaskFailed`))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{let e=document.querySelector(`.tasks`);e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug(`loading`);return}await this.$store.dispatch(`producer/getTasks`,{limit:30,offset:0})}}}),ar={class:`task`},or={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},lr=[`onClick`],ur={class:`left`},dr=[`aria-label`,`title`,`onClick`,`onKeydown`],fr=[`aria-label`,`title`,`onClick`,`onKeydown`],pr={key:2,class:`duration`},mr={class:`info`},hr={class:`title`},gr={class:`style`},_r={class:`right`},vr={class:`el-dropdown-link`},yr={class:`flex items-center min-w-[120px]`},br={class:`flex items-center min-w-[120px]`},xr={class:`el-dropdown-link`};function Sr(d,_,v,y,b,x){let S=l(`warning-icon`),C=l(`magic-icon`),w=l(`copy-to-clipboard`),T=l(`info-icon`),E=l(`channel-icon`),D=l(`el-alert`),O=l(`el-image`),k=l(`video-pause`),A=l(`el-icon`),j=l(`video-play`),M=l(`download-icon`),N=l(`el-tooltip`),P=l(`Loading`),F=l(`el-dropdown-item`),I=l(`el-dropdown-menu`),L=l(`el-dropdown`),R=l(`more-icon`),z=l(`code-icon`),B=l(`api-code-dialog`),V=m(`loading`);return g(),o(`div`,ar,[d.isFailure?(g(),f(D,{key:0,closable:!1,class:`task-failure`},{title:p(()=>[i(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(d.$t(`producer.name.failure`)),1)]),default:p(()=>[e(`p`,or,[i(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(d.$t(`producer.name.taskId`))+`: `+r(d.modelValue?.id)+` `,1),i(w,{content:d.modelValue?.id},null,8,[`content`])]),d.failureReason?(g(),o(`p`,sr,[i(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(d.$t(`producer.name.failureReason`))+`: `+r(d.failureReason)+` `,1),i(w,{content:d.failureReason},null,8,[`content`])])):a(``,!0),d.traceId?(g(),o(`p`,cr,[i(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(d.$t(`producer.name.traceId`))+`: `+r(d.traceId)+` `,1),i(w,{content:d.traceId},null,8,[`content`])])):a(``,!0)]),_:1})):a(``,!0),(g(!0),o(c,null,h(d.audios,c=>(g(),o(`div`,{key:c.id,class:`audio`,onClick:t(e=>d.onClick(c),[`stop`])},[u((g(),o(`div`,ur,[i(O,{src:c?.image_url,class:`cover`,fit:`cover`,lazy:``},null,8,[`src`]),c?.audio_url&&d.$store.state?.producer?.audio?.id===c.id&&d.$store.state?.producer?.audio?.state===`playing`?(g(),o(`div`,{key:0,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":d.$t(`common.player.pause`),title:d.$t(`common.player.pause`),onClick:t(e=>d.onPause(c),[`stop`]),onKeydown:[s(t(e=>d.onPause(c),[`stop`,`prevent`]),[`enter`]),s(t(e=>d.onPause(c),[`stop`,`prevent`]),[`space`])]},[i(A,null,{default:p(()=>[i(k,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,dr)):a(``,!0),c?.audio_url&&(d.$store.state?.producer?.audio?.id!==c.id||d.$store.state?.producer?.audio?.id===c.id&&d.$store.state?.producer?.audio?.state===`paused`)?(g(),o(`div`,{key:1,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":d.$t(`common.player.play`),title:d.$t(`common.player.play`),onClick:t(e=>d.onPlay(c),[`stop`]),onKeydown:[s(t(e=>d.onPlay(c),[`stop`,`prevent`]),[`enter`]),s(t(e=>d.onPlay(c),[`stop`,`prevent`]),[`space`])]},[i(A,null,{default:p(()=>[i(j,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,fr)):a(``,!0),c?.duration?(g(),o(`div`,pr,r(d.useFormatDuring(c?.duration)),1)):a(``,!0)])),[[V,!c?.audio_url]]),e(`div`,mr,[e(`h2`,hr,r(c?.title),1),e(`p`,gr,r(c?.style),1)]),e(`div`,_r,[i(L,null,{dropdown:p(()=>[i(I,null,{default:p(()=>[i(F,{disabled:d.isFetchingVideoUrl,onClick:e=>d.handleVideoDownload(c)},{default:p(()=>[e(`div`,yr,[d.isFetchingVideoUrl?(g(),f(A,{key:0,class:`is-loading mr-2`},{default:p(()=>[i(P,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})):a(``,!0),e(`span`,null,r(d.$t(`producer.button.download_video`)),1)])]),_:1},8,[`disabled`,`onClick`]),c?.audio_url?(g(),f(F,{key:0,onClick:t(e=>d.onDownload(e,c?.audio_url),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.download_audio`)),1)]),_:1},8,[`onClick`])):a(``,!0),i(F,{disabled:d.isFetchingWav,onClick:e=>d.handleWavDownload(c)},{default:p(()=>[e(`div`,br,[d.isFetchingWav?(g(),f(A,{key:0,class:`is-loading mr-2`},{default:p(()=>[i(P,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})):a(``,!0),e(`span`,null,r(d.$t(`producer.button.download_wav`)),1)])]),_:1},8,[`disabled`,`onClick`])]),_:2},1024)]),default:p(()=>[e(`span`,vr,[i(N,{effect:`dark`,content:d.$t(`producer.button.download`),placement:`top`},{default:p(()=>[c?.audio_url||c?.video_url?(g(),f(M,{key:0,class:`icon icon-download`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):a(``,!0)]),_:2},1032,[`content`])])]),_:2},1024),i(L,null,{dropdown:p(()=>[i(I,null,{default:p(()=>[c?.audio_url?(g(),f(F,{key:0,onClick:t(e=>d.onExtend(e,c),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.extend`)),1)]),_:1},8,[`onClick`])):a(``,!0),c.id?(g(),f(F,{key:1,onClick:t(e=>d.onGetStems(c.id),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.get_stems`)),1)]),_:1},8,[`onClick`])):a(``,!0),c.id?(g(),f(F,{key:2,onClick:t(e=>d.onGetAllStems(c.id),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.all_stems`)),1)]),_:1},8,[`onClick`])):a(``,!0),i(F,{onClick:t(e=>d.onCover(c),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.cover_music`)),1)]),_:1},8,[`onClick`]),c?.id?(g(),f(F,{key:3,onClick:t(e=>d.onVariation(c),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.variation`)),1)]),_:1},8,[`onClick`])):a(``,!0),c?.id?(g(),f(F,{key:4,onClick:t(e=>d.onSwapVocals(c.id),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.swap_vocals`)),1)]),_:1},8,[`onClick`])):a(``,!0),c?.id?(g(),f(F,{key:5,onClick:t(e=>d.onSwapInstrumentals(c.id),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.swap_instrumentals`)),1)]),_:1},8,[`onClick`])):a(``,!0),c?.id?(g(),f(F,{key:6,onClick:t(e=>d.onReplaceSection(c),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.replace_section`)),1)]),_:1},8,[`onClick`])):a(``,!0),d.showViewCode?(g(),f(F,{key:7,onClick:t(d.onViewCode,[`stop`])},{default:p(()=>[i(z,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(d.$t(`common.button.viewCode`)),1)]),_:1},8,[`onClick`])):a(``,!0)]),_:2},1024)]),default:p(()=>[e(`span`,xr,[i(N,{effect:`dark`,content:d.$t(`producer.button.more`),placement:`top`},{default:p(()=>[c?.audio_url||c?.video_url?(g(),f(R,{key:0,class:`icon icon-ellipsis`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):a(``,!0)]),_:2},1032,[`content`])])]),_:2},1024)])],8,lr))),128)),i(B,{visible:d.apiCodeVisible,"onUpdate:visible":_[0]||=e=>d.apiCodeVisible=e,method:`POST`,path:d.apiCodePath,body:d.apiCodeBody,token:d.$store.state.producer?.credential?.token||``},null,8,[`visible`,`path`,`body`,`token`])])}var Cr=v({name:`RecentPanel`,components:{ElSkeletonItem:L,ElSkeleton:R,TaskPreview:K(ir,[[`render`,Sr]]),Player:te,NoTasks:Oe,ScrollList:De},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.producer?.tasks,items:this.$store.state.producer?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),wr={key:0,class:`tasks`},Tr={class:`left w-[70px] p-[10px] flex items-center`},Er={class:`main w-[calc(100%-70px)] flex-1 p-[10px]`},Dr={key:2,class:`w-full flex-1 flex items-center justify-center`},Or={class:`h-20`};function kr(t,n,r,s,d,m){let v=l(`el-skeleton-item`),y=l(`el-skeleton`),b=l(`task-preview`),x=l(`scroll-list`),S=l(`no-tasks`),C=l(`player`);return g(),o(c,null,[t.tasks?.items===void 0?(g(),o(`div`,wr,[(g(),o(c,null,h(3,t=>e(`div`,{key:t,class:`flex`},[e(`div`,Tr,[i(y,{animated:``},{template:p(()=>[i(v,{variant:`image`,class:`avatar w-[50px] h-[50px]`})]),_:1})]),e(`div`,Er,[i(y,{animated:``},{template:p(()=>[i(v,{variant:`p`,class:`w-[200px] h-[15px] mb-[5px] mt-[10px]`}),i(v,{variant:`text`})]),_:1})])])),64))])):t.tasks?.items?.length&&t.tasks?.items?.length>0?(g(),f(x,{key:1,ref:`scrollList`,class:`flex-1 w-full overflow-y-auto tasks p-2`,loading:t.loading,onReachTop:n[0]||=e=>t.$emit(`reach-top`)},{default:p(()=>[(g(!0),o(c,null,h(t.tasks?.items,(e,t)=>(g(),f(b,{key:t,"model-value":e,class:`preview`},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),t.tasks?.items?.length===0?(g(),o(`div`,Dr,[i(S)])):a(``,!0),u(e(`div`,Or,[i(C,{namespace:`producer`})],512),[[_,!!t.$store?.state?.producer?.audio?.object]])],64)}var Ar=K(Cr,[[`render`,kr]]),jr=v({name:`TaskPreview`,components:{IconPicture:se,ElImage:Y,ElAvatar:D,ElIcon:y},computed:{audio(){return this.$store.state.producer?.audio}}}),Mr={key:0,class:`size-full overflow-hidden`},Nr={class:`relative h-[300px]`},Pr={class:`flex items-center justify-center size-full bg-[var(--el-bg-color)]`},Fr={class:`absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent`},Ir={class:`p-4`},Lr={class:`flex items-center font-bold mb-2`},Rr={class:`text-[var(--el-text-color-regular)] mb-2`},zr={class:`text-xs text-[var(--el-text-color-regular)]`},Br={class:`mt-4 text-sm leading-[25px] whitespace-pre-wrap`},Vr={key:1,class:`w-full h-full`};function Hr(t,n,a,s,c,u){let d=l(`icon-picture`),f=l(`el-icon`),m=l(`el-image`),h=l(`el-avatar`);return t.audio?.object?(g(),o(`div`,Mr,[e(`div`,Nr,[i(m,{src:t.audio.image_url,fit:`cover`,class:`size-full`},{error:p(()=>[e(`div`,Pr,[i(f,{class:`text-3xl`},{default:p(()=>[i(d,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})])]),_:1},8,[`src`]),e(`h2`,Fr,r(t.audio?.title),1)]),e(`div`,Ir,[e(`div`,Lr,[i(h,{size:30,src:t.audio?.image_url,class:`mr-2`},null,8,[`src`]),e(`span`,null,r(t.audio?.title),1)]),e(`p`,Rr,r(t.audio?.style),1),e(`p`,zr,r(t.$dayjs.format(t.audio?.created_at)),1),e(`div`,Br,[e(`p`,null,r(t.audio?.lyric),1)])])])):(g(),o(`div`,Vr))}var Ur=v({name:`ProducerIndex`,components:{Layout:Ie,ConfigPanel:nr,RecentPanel:Ar,PreviewPanel:K(jr,[[`render`,Hr]])},mixins:[pe],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.producer?.status?.getApplications===Z.Request},tasksLoading(){return this.$store.state.producer?.status?.getTasks===Z.Request||this.fetchingTasks},service(){return this.$store.state.producer.service},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},initializing(){return this.$store.state.producer.status.getApplications===Z.Request},needApply(){return this.$store.state.producer.status.getApplications===Z.Success&&!this.application},application(){return this.$store.state.producer.application},tasks(){return this.$store.state.producer.tasks},applications(){return this.$store.state.producer.applications}},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 ke({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`producer/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplications`),await this.$store.dispatch(`producer/getApplications`),console.debug(`end onGetApplications`),await this.onGetTasks()},onApply(){xe.create({application:this.application}).then(({data:e})=>{this.application=e,X.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&X.error(this.$t(`application.message.alreadyApplied`))})},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(`producer/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){if(!ge(this.uploadTracker,e=>this.$t(e),e=>X.warning(e)))return;let e={...this.config,async:!0};if(!Se())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}X.info(this.$t(`producer.message.startingTask`)),he(`producer`,J.audio(e,{token:t})).then(()=>{X.success(this.$t(`producer.message.startTaskSuccess`))}).catch(e=>{X.error(e?.response?.data?.error?.message||this.$t(`producer.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Wr(e,t,n,r,a,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`preview-panel`),d=l(`layout`);return g(),f(d,null,{config:p(()=>[i(s,{onGenerate:e.onGenerateAudio},null,8,[`onGenerate`])]),result:p(()=>[i(c,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),preview:p(()=>[i(u)]),_:1})}var Gr=K(Ur,[[`render`,Wr],[`__scopeId`,`data-v-23eb99dc`]]);export{Gr as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,at as o,j as s,mt as c,tt as l,z as u}from"./vendor-chart-Dw-P17PN.js";import{n as d,t as f}from"./table-DG76fdz9.js";import{t as ee}from"./tooltip-Dy1LvOzq.js";import{t as p}from"./card-D-4S-l7a.js";import{n as m,t as h}from"./row-KG3FewmS.js";import{t as g}from"./divider-BNWJAaA2.js";import{t as _}from"./progress-bSUZvkfj.js";import{t as v}from"./skeleton-B3LIGUiE.js";import{t as y}from"./coins-DcJKW6bq.js";import{t as b}from"./link-DBLtRDbw.js";import{t as x}from"./user-Dzf5Fm_O.js";import{t as S}from"./wallet-D16wnA4X.js";import{Ci as C,E as w,Q as T,Rt as E,Xt as D,et as O,ln as k,mr as A,nr as j,rr as M,tr as N,zi as P}from"./index-NQhLFvCT.js";import{t as F}from"./CopyToClipboard-DAsxz05c.js";var I=u({name:`ConsoleDistributionList`,components:{CreditsIcon:y,LinkIcon:b,PercentIcon:C(`percent`,[[`line`,{x1:`19`,x2:`5`,y1:`5`,y2:`19`,key:`1x9vlm`}],[`circle`,{cx:`6.5`,cy:`6.5`,r:`2.5`,key:`4mh3h7`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`2.5`,key:`1mdrzq`}]]),UserIcon:x,WalletIcon:S,CopyToClipboard:F,QrCode:E,ElProgress:_,ElRow:h,ElCol:m,ElButton:P,ElDivider:g,ElCard:p,ElTooltip:ee,ElTable:f,ElTableColumn:d,ElSkeleton:v},data(){return{invitees:[],inviteesCount:void 0,distributionLevels:[],distributionLink:void 0,distributionStatus:void 0,loading:!1}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)},qrColor(){let e=document.documentElement.classList.contains(`dark`);return{dark:e?`#ffffff`:`#000000`,light:e?`#1e1e1e`:`#ffffff`}},distributionLevelMap(){let e={};return this.distributionLevels.forEach(t=>{e[t.level]=t}),e}},watch:{page:{handler(){this.onFetchData()}}},async mounted(){this.onFetchData(),this.onGenerateDistributionLink()},methods:{getPriceString:D,goHistory(){this.$router.push({name:T})},goInvitees(){this.$router.push({name:O})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{page:e}})},getPercentageForNextLevel(){let e=this.distributionLevelMap[this.distributionStatus?.level?.level]?.threshold,t=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor((this.distributionStatus?.price-e)/(t-e)*100)},getDeltaForNextLevel(){let e=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor(e-this.distributionStatus?.price)},async onFetchData(){this.loading=!0,await j.initialize(),Promise.all([this.onFetchDistributionStatus(),this.onFetchDistributionLevels(),this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onGenerateDistributionLink(){let e=`${window.location.origin}?inviter_id=${this.$store.getters.user.id}`;try{let t=(await M.create(e))?.data?.data?.url||e;this.distributionLink=k()?t.replace(`surl.id`,`share.acedata.cloud`):t}catch{this.distributionLink=e}},async onFetchDistributionStatus(){let{data:e}=await j.getAll({user_id:this.$store.getters.user.id});e.items&&e.items.length>0&&(this.distributionStatus=e.items[0])},async onFetchDistributionLevels(){let{data:e}=await N.getAll({limit:20,user_id:this.$store.getters.user.id});this.distributionLevels=e.items},async onFetchInvitees(){let{data:e}=await A.getInvitees({});this.invitees=e.items,this.inviteesCount=e.count}}}),L={class:`title`},R={key:1},z={class:`icon-wrapper`},B={class:`text-left`},V={class:`description`},H={class:`value`},U={key:1},W={class:`icon-wrapper`},G={class:`text-left`},K={class:`description`},q={class:`value`},J={key:1},Y={class:`icon-wrapper`},X={class:`text-left`},Z={class:`description`},te={class:`value`},Q={key:1},ne={class:`icon-wrapper`},re={class:`text-left`},ie={class:`description`},ae={class:`value`},oe={key:1},se={class:`title`},ce={class:`clear-both overflow-hidden`},le={class:`float-left description`},ue={class:`float-right description`},de={class:`description`},fe={class:`level`},pe={class:`level`},$={class:`level`},me={key:1},he={class:`title`},ge={class:`link-wrapper text-center`},_e=[`href`],ve={class:`qr-wrapper ml-auto mr-auto`},ye={class:`mt-0`},be={class:`description`},xe={class:`more`};function Se(u,d,f,ee,p,m){let h=o(`el-col`),g=o(`el-row`),_=o(`el-skeleton`),v=o(`wallet-icon`),y=o(`el-button`),b=o(`el-card`),x=o(`credits-icon`),S=o(`el-tooltip`),C=o(`percent-icon`),w=o(`user-icon`),T=o(`el-progress`),E=o(`el-divider`),D=o(`el-table-column`),O=o(`el-table`);o(`link-icon`);let k=o(`copy-to-clipboard`),A=o(`qr-code`);return l(),s(g,{class:`panel`},{default:c(()=>[r(h,{span:24},{default:c(()=>[r(g,null,{default:c(()=>[r(h,{span:24},{default:c(()=>[e(`h2`,L,n(u.$t(`common.title.distribution`)),1)]),_:1})]),_:1}),r(g,{gutter:15},{default:c(()=>[r(h,{md:6,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`item-mini mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,R,[e(`div`,z,[r(v,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`div`,B,[e(`p`,V,n(u.$t(`distribution.title.price`)),1),e(`p`,H,n(u.getPriceString({value:u.distributionStatus?.price})),1)]),r(y,{type:`primary`,round:``,size:`small`,class:`btn`,onClick:u.goHistory},{default:c(()=>[t(n(u.$t(`distribution.button.detail`)),1)]),_:1},8,[`onClick`])]))]),_:1})]),_:1}),r(h,{md:6,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`item-mini mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,U,[e(`div`,W,[r(x,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`div`,G,[e(`p`,K,n(u.$t(`distribution.title.reward`)),1),e(`p`,q,n(u.getPriceString({value:u.distributionStatus?.reward})),1)]),r(S,{effect:`dark`,content:u.$t(`distribution.message.developingWithDrawal`),placement:`top`},{default:c(()=>[r(y,{type:`primary`,round:``,size:`small`,class:`btn`},{default:c(()=>[t(n(u.$t(`distribution.button.withdrawal`)),1)]),_:1})]),_:1},8,[`content`])]))]),_:1})]),_:1}),r(h,{md:6,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`item-mini mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,J,[e(`div`,Y,[r(C,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`div`,X,[e(`p`,Z,n(u.$t(`distribution.title.percentage`)),1),e(`p`,te,n(u.distributionStatus?.level?.percentage)+`%`,1)])]))]),_:1})]),_:1}),r(h,{md:6,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`item-mini mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,Q,[e(`div`,ne,[r(w,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`div`,re,[e(`p`,ie,n(u.$t(`distribution.title.inviteesCount`)),1),e(`p`,ae,n(u.inviteesCount),1)]),r(y,{type:`primary`,round:``,size:`small`,class:`btn`,onClick:u.goInvitees},{default:c(()=>[t(n(u.$t(`distribution.button.detail`)),1)]),_:1},8,[`onClick`])]))]),_:1})]),_:1})]),_:1}),r(g,{gutter:15},{default:c(()=>[r(h,{md:12,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`level-info mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,oe,[e(`h4`,se,n(u.$t(`distribution.title.levelInfo`)),1),e(`div`,ce,[e(`div`,le,[e(`p`,null,n(u.$t(`distribution.title.currentLevel`))+`: L`+n(u.distributionStatus?.level?.level),1),e(`p`,null,n(u.$t(`distribution.title.currentPercentage`))+`: `+n(u.distributionLevelMap[u.distributionStatus?.level?.level]?.percentage)+`% `,1)]),e(`div`,ue,[e(`p`,null,n(u.$t(`distribution.title.nextLevel`))+`: L`+n(u.distributionStatus?.level?.level+1),1),e(`p`,null,n(u.$t(`distribution.title.nextPercentage`))+`: `+n(u.distributionLevelMap[u.distributionStatus?.level?.level+1]?.percentage)+`% `,1)])]),r(T,{"text-inside":!0,"stroke-width":20,percentage:u.getPercentageForNextLevel(),class:`mb-2`},null,8,[`percentage`]),e(`p`,de,n(u.$t(`distribution.message.deltaPriceForNextLevel`))+`: $`+n(u.getDeltaForNextLevel()),1),r(E),u.distributionLevels?(l(),s(O,{key:0,data:u.distributionLevels,stripe:``},{default:c(()=>[r(D,{label:u.$t(`distribution.field.level`)},{default:c(t=>[e(`span`,fe,`L`+n(t.row?.level),1)]),_:1},8,[`label`]),r(D,{label:u.$t(`distribution.field.threshold`)},{default:c(t=>[e(`span`,pe,`$`+n(t.row?.threshold),1)]),_:1},8,[`label`]),r(D,{label:u.$t(`distribution.field.percentage`)},{default:c(t=>[e(`span`,$,n(t.row?.percentage)+`%`,1)]),_:1},8,[`label`])]),_:1},8,[`data`])):i(``,!0)]))]),_:1})]),_:1}),r(h,{md:12,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`distribution-info mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,me,[e(`h4`,he,n(u.$t(`distribution.title.distributionLink`)),1),r(E),e(`div`,ge,[i(``,!0),e(`a`,{href:u.distributionLink,class:`link`},n(u.distributionLink),9,_e),r(k,{content:u.distributionLink},null,8,[`content`])]),e(`div`,ve,[u.distributionLink?(l(),s(A,{key:0,value:u.distributionLink,size:180,margin:2,class:`block mb-2 ml-auto mr-auto`,type:`image/png`,color:u.qrColor},null,8,[`value`,`color`])):i(``,!0),e(`p`,ye,n(u.$t(`distribution.message.distributionQrDescription`)),1)]),e(`p`,be,[t(n(u.$t(`distribution.message.distributionLinkDescription`))+` `,1),e(`span`,xe,[r(S,{effect:`dark`,content:u.$t(`distribution.message.distributionLinkDescription2`),placement:`top`},{default:c(()=>[t(n(u.$t(`distribution.message.technicalDetail`)),1)]),_:1},8,[`content`])])])]))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}var Ce=w(I,[[`render`,Se],[`__scopeId`,`data-v-3657f823`]]);export{Ce as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,F as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,it as l,j as u,mt as d,rt as f,tt as p,z as m}from"./vendor-chart-Dw-P17PN.js";import{r as h,t as g}from"./select-LvaKgyRc.js";import{n as _,t as v}from"./collapse-2ZkQBwEA.js";import{t as y}from"./drawer-DdjNUdLN.js";import{t as b}from"./circle-question-mark-DD9uSbOU.js";import{t as x}from"./globe-BIvs6o6q.js";import{t as S}from"./search-BfbZESba.js";import"./constants-Dm-HitpB.js";import{E as C,Ji as w,Ti as T,Yt as ee,ci as E,in as te,zi as D}from"./index-NQhLFvCT.js";import{t as O}from"./Consumption-DWMEoulW.js";var k=m({name:`LayoutSerp`,components:{SearchIcon:S,ElDrawer:y,ElButton:D},data(){return{drawer:!1}}}),A={class:`main flex flex-row flex-1`},j={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},M={class:`result h-full flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function N(t,n,r,a,s,u){let f=c(`search-icon`),m=c(`el-button`),h=c(`el-drawer`);return p(),o(`div`,A,[e(`div`,j,[l(t.$slots,`config`,{},void 0,!0)]),e(`div`,M,[l(t.$slots,`result`,{},void 0,!0)]),i(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:d(()=>[i(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),i(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:d(()=>[l(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var P=C(k,[[`render`,N],[`__scopeId`,`data-v-fc67ba0b`]]),F=m({name:`QueryInput`,components:{ElInput:w},computed:{query:{get(){return this.$store.state.serp?.config?.query},set(e){this.$store.commit(`serp/setConfig`,{...this.$store.state.serp?.config,query:e})}}}}),I={class:`field`},L={class:`box`},R={class:`title font-bold`};function z(t,n,a,s,l,u){let d=c(`el-input`);return p(),o(`div`,I,[e(`div`,L,[e(`h2`,R,r(t.$t(`serp.name.query`)),1)]),i(d,{modelValue:t.query,"onUpdate:modelValue":n[0]||=e=>t.query=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`serp.placeholder.query`)},null,8,[`modelValue`,`placeholder`])])}var B=C(F,[[`render`,z],[`__scopeId`,`data-v-3582b195`]]),V=m({name:`TypeSelector`,components:{ElSelect:h,ElOption:g},computed:{value:{get(){return this.$store.state.serp?.config?.type},set(e){this.$store.commit(`serp/setConfig`,{...this.$store.state.serp?.config,type:e})}}},mounted(){this.value||=`search`}}),H={class:`field`},U={class:`title font-bold`};function W(t,n,a,s,l,u){let f=c(`el-option`),m=c(`el-select`);return p(),o(`div`,H,[e(`h2`,U,r(t.$t(`serp.name.type`)),1),i(m,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},{default:d(()=>[i(f,{value:`search`,label:t.$t(`serp.type.search`)},null,8,[`label`]),i(f,{value:`images`,label:t.$t(`serp.type.images`)},null,8,[`label`]),i(f,{value:`news`,label:t.$t(`serp.type.news`)},null,8,[`label`]),i(f,{value:`videos`,label:t.$t(`serp.type.videos`)},null,8,[`label`])]),_:1},8,[`modelValue`])])}var G=C(V,[[`render`,W],[`__scopeId`,`data-v-2913fb62`]]),K=m({name:`CountryInput`,components:{ElInput:w},computed:{value:{get(){return this.$store.state.serp?.config?.country},set(e){this.$store.commit(`serp/setConfig`,{...this.$store.state.serp?.config,country:e})}}},mounted(){this.value||=`US`}}),q={class:`field`},J={class:`title font-bold`};function Y(t,n,a,s,l,u){let d=c(`el-input`);return p(),o(`div`,q,[e(`h2`,J,r(t.$t(`serp.name.country`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`serp.placeholder.country`)},null,8,[`modelValue`,`placeholder`])])}var X=C(K,[[`render`,Y],[`__scopeId`,`data-v-f0672cc6`]]),Z=m({name:`LanguageInput`,components:{ElInput:w},computed:{value:{get(){return this.$store.state.serp?.config?.language},set(e){this.$store.commit(`serp/setConfig`,{...this.$store.state.serp?.config,language:e})}}},mounted(){this.value||=`en`}}),Q={class:`field`},ne={class:`title font-bold`};function re(t,n,a,s,l,u){let d=c(`el-input`);return p(),o(`div`,Q,[e(`h2`,ne,r(t.$t(`serp.name.language`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`serp.placeholder.language`)},null,8,[`modelValue`,`placeholder`])])}var ie=m({name:`SearchPanel`,components:{SearchIcon:S,ElButton:D,QueryInput:B,TypeSelector:G,CountryInput:X,LanguageInput:C(Z,[[`render`,re],[`__scopeId`,`data-v-dc1c94b7`]]),Consumption:O},emits:[`search`],computed:{config(){return this.$store.state.serp?.config},consumption(){return ee(this.config,this.service?.cost)},service(){return this.$store.state.serp?.service},searching(){return this.$store.state.serp?.status?.search===E.Request}},methods:{onSearch(){this.$emit(`search`)}}}),ae={class:`flex flex-col h-full`},oe={class:`flex-1 overflow-y-auto p-5`},se={class:`flex flex-col items-center justify-center px-5 pb-5`};function ce(t,a,s,l,u,f){let m=c(`query-input`),h=c(`type-selector`),g=c(`country-input`),_=c(`language-input`),v=c(`consumption`),y=c(`search-icon`),b=c(`el-button`);return p(),o(`div`,ae,[e(`div`,oe,[i(m,{class:`mb-4`}),i(h,{class:`mb-4`}),i(g,{class:`mb-4`}),i(_,{class:`mb-4`})]),e(`div`,se,[i(v,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(b,{type:`primary`,class:`btn w-full`,round:``,loading:t.searching,onClick:t.onSearch},{default:d(()=>[i(y,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.$t(`serp.button.search`)),1)]),_:1},8,[`loading`,`onClick`])])])}var le=C(ie,[[`render`,ce]]),ue=m({name:`KnowledgeGraph`,props:{data:{type:Object,required:!0}}}),de={class:`knowledge-graph rounded-xl border border-[var(--el-border-color-lighter)] p-5 bg-[var(--el-fill-color-blank)]`},fe={class:`flex flex-row gap-4`},pe=[`src`,`alt`],me={class:`flex-1 min-w-0`},he={key:0,class:`text-xs text-[var(--el-text-color-disabled)] mb-1 uppercase tracking-wide`},ge={class:`text-xl font-bold mb-1.5`},_e={key:1,class:`text-sm text-[var(--el-text-color-regular)] mb-3 leading-relaxed`},ve=[`href`],ye={key:2,class:`text-sm`},be={class:`text-[var(--el-text-color-disabled)] flex-none font-medium`},xe={class:`text-[var(--el-text-color-regular)]`};function Se(t,i,c,l,u,d){return p(),o(`div`,de,[e(`div`,fe,[t.data.image_url?(p(),o(`img`,{key:0,src:t.data.image_url,alt:t.data.title,class:`w-28 h-28 rounded-lg object-cover flex-none shadow-sm`},null,8,pe)):a(``,!0),e(`div`,me,[t.data.type?(p(),o(`div`,he,r(t.data.type),1)):a(``,!0),e(`h3`,ge,r(t.data.title),1),t.data.description?(p(),o(`p`,_e,[n(r(t.data.description)+` `,1),t.data.description_link?(p(),o(`a`,{key:0,href:t.data.description_link,target:`_blank`,rel:`noopener noreferrer`,class:`text-[var(--el-color-primary)] hover:underline ml-1`},r(t.data.description_source||`Source`),9,ve)):a(``,!0)])):a(``,!0),t.data.attributes&&Object.keys(t.data.attributes).length?(p(),o(`div`,ye,[(p(!0),o(s,null,f(t.data.attributes,(t,n)=>(p(),o(`div`,{key:n,class:`flex gap-2 mb-1 py-0.5`},[e(`span`,be,r(n)+`:`,1),e(`span`,xe,r(t),1)]))),128))])):a(``,!0)])])])}var Ce=C(ue,[[`render`,Se]]),we=m({name:`OrganicResult`,props:{data:{type:Object,required:!0}},data(){return{faviconFailed:!1}},computed:{hostname(){if(!this.data.link)return``;try{return new URL(this.data.link).hostname}catch{return``}},pathname(){if(!this.data.link)return``;try{let e=new URL(this.data.link).pathname;return e===`/`?``:e}catch{return``}},displayUrl(){return this.hostname},faviconUrl(){return this.faviconFailed||!this.hostname?``:`https://www.google.com/s2/favicons?domain=${this.hostname}&sz=32`}},methods:{onFaviconError(e){this.faviconFailed=!0,e.target.style.display=`none`}}}),Te={class:`organic-result rounded-lg p-4 transition-all duration-200 hover:bg-[var(--el-fill-color-lighter)]`},Ee={key:0,class:`flex items-center gap-2 mb-1.5`},De=[`src`,`alt`],Oe={class:`text-xs text-[var(--el-text-color-secondary)] truncate`},ke={class:`text-xs text-[var(--el-text-color-disabled)]`},Ae=[`href`],je={key:1,class:`text-xs text-[var(--el-text-color-disabled)] mt-1`},Me={key:2,class:`text-sm text-[var(--el-text-color-regular)] mt-1.5 leading-relaxed line-clamp-3`},Ne={key:3,class:`mt-3 flex flex-wrap gap-x-4 gap-y-1`},Pe=[`href`];function Fe(t,n,i,c,l,u){return p(),o(`div`,Te,[t.displayUrl?(p(),o(`div`,Ee,[e(`img`,{src:t.faviconUrl,alt:t.hostname,class:`w-4 h-4 rounded-sm flex-none`,loading:`lazy`,onError:n[0]||=(...e)=>t.onFaviconError&&t.onFaviconError(...e)},null,40,De),e(`span`,Oe,r(t.hostname),1),e(`span`,ke,r(t.pathname),1)])):a(``,!0),e(`a`,{href:t.data.link,target:`_blank`,rel:`noopener noreferrer`,class:`text-base font-semibold text-[var(--el-color-primary)] hover:underline leading-snug block`},r(t.data.title),9,Ae),t.data.date?(p(),o(`div`,je,r(t.data.date),1)):a(``,!0),t.data.snippet?(p(),o(`p`,Me,r(t.data.snippet),1)):a(``,!0),t.data.sitelinks?.length?(p(),o(`div`,Ne,[(p(!0),o(s,null,f(t.data.sitelinks,(e,t)=>(p(),o(`a`,{key:t,href:e.link,target:`_blank`,rel:`noopener noreferrer`,class:`text-xs text-[var(--el-color-primary-light-3)] hover:text-[var(--el-color-primary)] hover:underline transition-colors`},r(e.title),9,Pe))),128))])):a(``,!0)])}var Ie=C(we,[[`render`,Fe]]),Le=m({name:`ImageResults`,props:{data:{type:Array,required:!0}}}),Re={class:`rounded-xl border border-[var(--el-border-color-lighter)] p-5 bg-[var(--el-fill-color-blank)]`},ze={class:`text-base font-bold mb-3`},Be={class:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3`},Ve=[`href`],He=[`src`,`alt`],Ue={class:`absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent p-2.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200`},We={class:`text-xs text-white line-clamp-2`};function Ge(t,n,i,c,l,u){return p(),o(`div`,Re,[e(`h3`,ze,r(t.$t(`serp.name.imageResults`)),1),e(`div`,Be,[(p(!0),o(s,null,f(t.data,(t,n)=>(p(),o(`a`,{key:n,href:t.link,target:`_blank`,rel:`noopener noreferrer`,class:`group relative rounded-lg overflow-hidden bg-[var(--el-fill-color-light)] aspect-square`},[t.image_url?(p(),o(`img`,{key:0,src:t.image_url,alt:t.title,class:`w-full h-full object-cover transition-transform duration-300 group-hover:scale-105`,loading:`lazy`},null,8,He)):a(``,!0),e(`div`,Ue,[e(`span`,We,r(t.title),1)])],8,Ve))),128))])])}var Ke=C(Le,[[`render`,Ge]]),qe=m({name:`VideoResults`,props:{data:{type:Array,required:!0}}}),Je={class:`text-base font-bold mb-3`},Ye={class:`space-y-4`},Xe=[`href`],Ze={class:`relative flex-shrink-0 w-40 h-24 rounded overflow-hidden bg-gray-100 dark:bg-gray-800`},Qe=[`src`,`alt`],$e={key:1,class:`absolute bottom-1 right-1 bg-black/80 text-white text-xs px-1 rounded`},et={class:`flex-1 min-w-0`},tt={class:`text-blue-600 group-hover:underline font-medium line-clamp-2`},nt={class:`text-xs text-gray-400 mt-1`},rt={key:0},it={key:1},at={key:2},ot={key:0,class:`text-sm text-gray-600 dark:text-gray-300 mt-1 line-clamp-2`};function st(t,n,i,c,l,u){return p(),o(`div`,null,[e(`h3`,Je,r(t.$t(`serp.name.videoResults`)),1),e(`div`,Ye,[(p(!0),o(s,null,f(t.data,(t,n)=>(p(),o(`a`,{key:n,href:t.link,target:`_blank`,rel:`noopener noreferrer`,class:`flex gap-4 group`},[e(`div`,Ze,[t.image_url?(p(),o(`img`,{key:0,src:t.image_url,alt:t.title,class:`w-full h-full object-cover`,loading:`lazy`},null,8,Qe)):a(``,!0),t.duration?(p(),o(`div`,$e,r(t.duration),1)):a(``,!0)]),e(`div`,et,[e(`div`,tt,r(t.title),1),e(`div`,nt,[t.source?(p(),o(`span`,rt,r(t.source),1)):a(``,!0),t.channel?(p(),o(`span`,it,` · `+r(t.channel),1)):a(``,!0),t.date?(p(),o(`span`,at,` · `+r(t.date),1)):a(``,!0)]),t.snippet?(p(),o(`p`,ot,r(t.snippet),1)):a(``,!0)])],8,Xe))),128))])])}var ct=C(qe,[[`render`,st]]),lt=m({name:`NewsResults`,props:{data:{type:Array,required:!0}}}),ut={class:`text-base font-bold mb-3`},dt={class:`space-y-4`},ft=[`href`],pt={class:`flex-1 min-w-0`},mt={class:`text-blue-600 group-hover:underline font-medium line-clamp-2`},ht={class:`text-xs text-gray-400 mt-1`},gt={key:0},_t={key:1},vt={key:0,class:`text-sm text-gray-600 dark:text-gray-300 mt-1 line-clamp-2`},yt={key:0,class:`flex-shrink-0 w-24 h-24 rounded overflow-hidden bg-gray-100 dark:bg-gray-800`},bt=[`src`,`alt`];function xt(t,n,i,c,l,u){return p(),o(`div`,null,[e(`h3`,ut,r(t.$t(`serp.name.newsResults`)),1),e(`div`,dt,[(p(!0),o(s,null,f(t.data,(t,n)=>(p(),o(`a`,{key:n,href:t.link,target:`_blank`,rel:`noopener noreferrer`,class:`flex gap-4 group`},[e(`div`,pt,[e(`div`,mt,r(t.title),1),e(`div`,ht,[t.source?(p(),o(`span`,gt,r(t.source),1)):a(``,!0),t.date?(p(),o(`span`,_t,` · `+r(t.date),1)):a(``,!0)]),t.snippet?(p(),o(`p`,vt,r(t.snippet),1)):a(``,!0)]),t.image_url?(p(),o(`div`,yt,[e(`img`,{src:t.image_url,alt:t.title,class:`w-full h-full object-cover`,loading:`lazy`},null,8,bt)])):a(``,!0)],8,ft))),128))])])}var St=C(lt,[[`render`,xt]]),Ct=m({name:`PeopleAlsoAsk`,components:{ElCollapse:v,ElCollapseItem:_},props:{data:{type:Array,required:!0}}}),wt={class:`rounded-xl border border-[var(--el-border-color-lighter)] p-5 bg-[var(--el-fill-color-blank)]`},Tt={class:`text-base font-bold mb-3`},Et={key:0,class:`text-sm text-[var(--el-text-color-regular)] mb-2 leading-relaxed`},Dt=[`href`];function Ot(t,n,l,m,h,g){let _=c(`el-collapse-item`),v=c(`el-collapse`);return p(),o(`div`,wt,[e(`h3`,Tt,r(t.$t(`serp.name.peopleAlsoAsk`)),1),i(v,null,{default:d(()=>[(p(!0),o(s,null,f(t.data,(e,t)=>(p(),u(_,{key:t,title:e.question||e.title||``},{default:d(()=>[e.snippet?(p(),o(`p`,Et,r(e.snippet),1)):a(``,!0),e.link?(p(),o(`a`,{key:1,href:e.link,target:`_blank`,rel:`noopener noreferrer`,class:`text-xs text-[var(--el-color-primary)] hover:underline`},r(e.title||e.link),9,Dt)):a(``,!0)]),_:2},1032,[`title`]))),128))]),_:1})])}var kt=C(Ct,[[`render`,Ot]]),At=m({name:`RelatedSearches`,components:{SearchIcon:S},props:{data:{type:Array,required:!0}},emits:[`search`],methods:{onSearch(e){e&&this.$emit(`search`,e)}}}),jt={class:`rounded-xl border border-[var(--el-border-color-lighter)] p-5 bg-[var(--el-fill-color-blank)]`},Mt={class:`text-base font-bold mb-3`},Nt={class:`flex flex-wrap gap-2`},$=[`onClick`];function Pt(t,a,l,u,d,m){let h=c(`search-icon`);return p(),o(`div`,jt,[e(`h3`,Mt,r(t.$t(`serp.name.relatedSearches`)),1),e(`div`,Nt,[(p(!0),o(s,null,f(t.data,(e,a)=>(p(),o(`button`,{key:a,class:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm bg-[var(--el-fill-color-light)] text-[var(--el-text-color-regular)] hover:bg-[var(--el-color-primary-light-9)] hover:text-[var(--el-color-primary)] transition-colors cursor-pointer border-none`,onClick:n=>t.onSearch(e.query)},[i(h,{class:`text-xs opacity-50`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(e.query),1)],8,$))),128))])])}var Ft=m({name:`ResultPanel`,components:{GlobeIcon:x,HelpIcon:b,KnowledgeGraph:Ce,OrganicResult:Ie,ImageResults:Ke,VideoResults:ct,NewsResults:St,PeopleAlsoAsk:kt,RelatedSearches:C(At,[[`render`,Pt]])},emits:[`related-search`],computed:{results(){return this.$store.state.serp?.results},searching(){return this.$store.state.serp?.status?.search===E.Request},noResults(){return this.$store.state.serp?.status?.search===E.Success&&this.results&&!this.results.organic?.length&&!this.results.images?.length&&!this.results.videos?.length&&!this.results.news?.length&&!this.results.knowledge_graph?.title}},methods:{onRelatedSearch(e){this.$emit(`related-search`,e)}}}),It={class:`h-full overflow-y-auto p-6`},Lt={key:0,class:`max-w-3xl mx-auto py-8`},Rt={key:1,class:`flex flex-col items-center justify-center py-24 text-[var(--el-text-color-disabled)]`},zt={class:`text-base`},Bt={key:2,class:`max-w-3xl mx-auto`},Vt={key:1,class:`mb-6`},Ht={key:3,class:`flex flex-col items-center justify-center py-24 text-[var(--el-text-color-disabled)]`},Ut={class:`text-base`};function Wt(n,l,d,m,h,g){let _=c(`help-icon`),v=c(`knowledge-graph`),y=c(`organic-result`),b=c(`image-results`),x=c(`video-results`),S=c(`news-results`),C=c(`people-also-ask`),w=c(`related-searches`),T=c(`globe-icon`);return p(),o(`div`,It,[n.searching?(p(),o(`div`,Lt,[(p(),o(s,null,f(4,n=>e(`div`,{key:n,class:`mb-6 animate-pulse`},[...l[0]||=[t(`<div class="flex items-center gap-2 mb-2"><div class="w-4 h-4 rounded-sm bg-[var(--el-fill-color-darker)]"></div><div class="h-3 w-32 rounded bg-[var(--el-fill-color-darker)]"></div></div><div class="h-4 w-3/4 rounded bg-[var(--el-fill-color-dark)] mb-2"></div><div class="h-3 w-full rounded bg-[var(--el-fill-color)] mb-1"></div><div class="h-3 w-5/6 rounded bg-[var(--el-fill-color)]"></div>`,4)]])),64))])):n.noResults?(p(),o(`div`,Rt,[i(_,{class:`text-5xl mb-4 opacity-40`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,zt,r(n.$t(`serp.message.noResults`)),1)])):n.results?(p(),o(`div`,Bt,[n.results.knowledge_graph?.title?(p(),u(v,{key:0,data:n.results.knowledge_graph,class:`mb-6`},null,8,[`data`])):a(``,!0),n.results.organic?.length?(p(),o(`div`,Vt,[(p(!0),o(s,null,f(n.results.organic,(e,t)=>(p(),u(y,{key:t,data:e,class:`mb-1`},null,8,[`data`]))),128))])):a(``,!0),n.results.images?.length?(p(),u(b,{key:2,data:n.results.images,class:`mb-6`},null,8,[`data`])):a(``,!0),n.results.videos?.length?(p(),u(x,{key:3,data:n.results.videos,class:`mb-6`},null,8,[`data`])):a(``,!0),n.results.news?.length?(p(),u(S,{key:4,data:n.results.news,class:`mb-6`},null,8,[`data`])):a(``,!0),n.results.people_also_ask?.length?(p(),u(C,{key:5,data:n.results.people_also_ask,class:`mb-6`},null,8,[`data`])):a(``,!0),n.results.related_searches?.length?(p(),u(w,{key:6,data:n.results.related_searches,class:`mb-6`,onSearch:n.onRelatedSearch},null,8,[`data`,`onSearch`])):a(``,!0)])):(p(),o(`div`,Ht,[i(T,{class:`text-5xl mb-4 opacity-30`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,Ut,r(n.$t(`serp.description.query`)),1)]))])}var Gt=m({name:`SerpIndex`,components:{Layout:P,SearchPanel:le,ResultPanel:C(Ft,[[`render`,Wt]])},inject:[`initialized`],async mounted(){await this.onGetService()},methods:{async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`serp/getService`),console.debug(`end onGetService`)},async onSearch(){if(te()&&this.$store.state.serp?.config?.query){T.info(this.$t(`serp.message.searching`));try{await this.$store.dispatch(`serp/search`),T.success(this.$t(`serp.message.searchSuccess`))}catch(e){(e?.response?.data)?.error?.code===`used_up`?T.error(this.$t(`serp.message.usedUp`)):T.error(this.$t(`serp.message.searchFailed`))}}},async onRelatedSearch(e){this.$store.commit(`serp/setConfig`,{...this.$store.state.serp?.config,query:e}),await this.onSearch()}}});function Kt(e,t,n,r,a,o){let s=c(`search-panel`),l=c(`result-panel`),f=c(`layout`);return p(),u(f,null,{config:d(()=>[i(s,{onSearch:e.onSearch},null,8,[`onSearch`])]),result:d(()=>[i(l,{onRelatedSearch:e.onRelatedSearch},null,8,[`onRelatedSearch`])]),_:1})}var qt=C(Gt,[[`render`,Kt]]);export{qt as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-CBX_IrQp.js";import{t as b}from"./upload-rtgu1fiP.js";import{t as x}from"./tooltip-qUtLFuMO.js";import{t as S}from"./alert-HuInTm83.js";import{t as C}from"./drawer-C3ym1xsG.js";import{t as w}from"./input-number-BKAsEVuC.js";import{t as T}from"./slider-DftS7Sgq.js";import{n as E}from"./taskDrawerMixin-BnaaHNWt.js";import{t as D}from"./clock-D-h5ShMs.js";import{r as O,t as k}from"./PromptTextarea-Ck-RQCWL.js";import{t as A}from"./info-BRA-_T8y.js";import{t as j}from"./trash-2-Bpdf-yvt.js";import{t as M}from"./triangle-alert-8jr8sw3e.js";import{t as N}from"./upload-ClxIGeiH.js";import{t as P}from"./wand-sparkles-pjNJLsqz.js";import{cr as F,lr as ee,ur as te}from"./constants-B5AtX8h0.js";import{Bn as ne,Ci as I,E as L,Gt as R,Ht as z,Jt as B,Kt as V,Li as H,Si as U,Ut as W,Wt as G,rn as K,si as q,ui as J,xr as Y}from"./index-P4zymybO.js";import{t as X}from"./CopyToClipboard-jI-6D-bZ.js";import{t as Z}from"./ImagePreview-D_nlD8_0.js";import{t as re}from"./Consumption-Bj1vPgJr.js";import{a as Q,n as ie,r as ae,t as oe}from"./pagination-B1w7bn_h.js";import{t as se}from"./ApiCodeButton-BOMuF77p.js";import{t as ce}from"./BotPlaceholder-DEzlsX3N.js";import{t as le}from"./ImageWrapper-arrFKmON.js";var ue=_({name:`LayoutFlux`,components:{MagicIcon:P,ElDrawer:C,ElButton:H},mixins:[E]}),de={class:`main flex flex-row flex-1`},fe={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},pe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function me(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,de,[e(`div`,fe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,pe,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var he=L(ue,[[`render`,me],[`__scopeId`,`data-v-72e82d52`]]),ge=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`flux-dev`,label:`flux-dev`},{value:`flux-pro`,label:`flux-pro`},{value:`flux-kontext-pro`,label:`flux-kontext-pro`},{value:`flux-kontext-max`,label:`flux-kontext-max`},{value:`flux-2-flex`,label:`flux-2-flex`},{value:`flux-2-pro`,label:`flux-2-pro`},{value:`flux-2-max`,label:`flux-2-max`}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||=te}}),_e={class:`field`},ve={class:`title font-bold`};function ye(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,_e,[e(`h2`,ve,i(t.$t(`flux.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`flux.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var be=L(ge,[[`render`,ye],[`__scopeId`,`data-v-e9b17945`]]),xe=_({name:`CountSelector`,components:{ElSlider:T,InfoIcon:Q,ElInputNumber:w},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug(`set count`,e),this.$store.commit(`flux/setConfig`,{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||=1}}),Se={class:`flex justify-between`},Ce={class:`flex justify-start items-center`},we={class:`text-sm font-bold`},Te={class:`flex justify-end items-center`},Ee={class:`w-full`};function De(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`),p=l(`el-slider`);return h(),s(`div`,null,[e(`div`,Se,[e(`div`,Ce,[e(`span`,we,i(t.$t(`flux.name.numbers`)),1),a(d,{content:t.$t(`flux.description.numbers`)},null,8,[`content`])]),e(`div`,Te,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,Ee,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:1,max:4,step:1},null,8,[`modelValue`])])])}var Oe=L(xe,[[`render`,De]]),ke=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`generate`,label:this.$t(`flux.name.generate`)},{value:`edits`,label:this.$t(`flux.name.edits`)}]}},computed:{value:{get(){return this.$store.state.flux?.config?.action},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux.config,action:e})}}},mounted(){this.value||=ee}}),Ae={class:`field`},je={class:`title font-bold`};function Me(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Ae,[e(`h2`,je,i(t.$t(`flux.name.task`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`flux.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ne=L(ke,[[`render`,Me],[`__scopeId`,`data-v-81fd05e5`]]),Pe=_({name:`ImageUrlInput`,components:{UploadIcon:N,ElUpload:b,ElButton:H,InfoIcon:Q,ImagePreview:Z},mixins:[V,R,W],emits:[`change`],data(){return{fileList:[],uploadUrl:J()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{urls:{handler(e){console.debug(`URLs changed:`,e),this.$store.commit(`flux/setConfig`,{...this.$store.state.flux.config,image_url:e[0]})}}},methods:{onExceed(){I.warning(this.$t(`flux.message.uploadStartImageExceed`))},onError(){I.error(this.$t(`flux.message.uploadStartImageError`))}}}),Fe={class:`relative`},Ie={class:`flex justify-between`},Le={class:`flex justify-start items-center`},Re={class:`text-sm font-bold`};function ze(t,n,o,c,u,d){let f=l(`info-icon`),m=l(`image-preview`),g=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`);return h(),s(`div`,Fe,[e(`div`,Ie,[e(`div`,Le,[e(`span`,Re,i(t.$t(`flux.name.imageUrl`)),1),a(f,{content:t.$t(`flux.description.imageUrl`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,limit:5,class:`upload-wrapper`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,multiple:!0,"list-type":`picture`,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,headers:t.headers},{file:p(({file:e})=>[a(m,{url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])]),default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(g,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`flux.button.uploadImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`headers`])])}var Be=L(Pe,[[`render`,ze],[`__scopeId`,`data-v-2e7e6966`]]),Ve=_({name:`PromptInput`,components:{PromptTextarea:k},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||=``}});function He(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`flux.name.prompt`),info:e.$t(`flux.description.prompt`),placeholder:e.$t(`flux.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ue=L(Ve,[[`render`,He]]),We=_({name:`SizeSelector`,components:{ElSelect:v,ElOption:y},data(){return{options:F}},computed:{value:{get(){return this.$store.state.flux?.config?.size},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux?.config,size:e})}}},mounted(){this.value||=`1:1`}}),Ge={class:`field`},Ke={class:`title font-bold`};function qe(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Ge,[e(`h2`,Ke,i(t.$t(`flux.name.ratio`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`flux.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Je=_({name:`PresetPanel`,components:{MagicIcon:P,ElButton:H,PromptInput:Ue,ModelSelector:be,CountSelector:Oe,Consumption:re,ActionSelector:Ne,ImageUrlInput:Be,SizeSelector:L(We,[[`render`,qe],[`__scopeId`,`data-v-8c58dc91`]])},emits:[`generate`],computed:{config(){return this.$store.state.flux?.config},consumption(){return B(this.config,this.service?.cost)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ye={class:`flex flex-col h-full`},Xe={class:`flex-1 overflow-y-auto p-5`},Ze={class:`flex flex-col items-center justify-center px-5 pb-5`};function Qe(t,n,c,u,d,m){let g=l(`action-selector`),_=l(`prompt-input`),v=l(`image-url-input`),y=l(`model-selector`),b=l(`size-selector`),x=l(`count-selector`),S=l(`consumption`),C=l(`magic-icon`),w=l(`el-button`);return h(),s(`div`,Ye,[e(`div`,Xe,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),t.config?.action===`edits`?(h(),f(v,{key:0,class:`mb-4`})):o(``,!0),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`})]),e(`div`,Ze,[a(S,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(w,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(C,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`flux.button.generate`)),1)]),_:1},8,[`onClick`])])])}var $e=L(Je,[[`render`,Qe]]),et=_({name:`TaskPreview`,components:{DeleteIcon:j,ElTooltip:x,ChannelIcon:O,InfoIcon:A,MagicIcon:P,TimeIcon:D,WarningIcon:M,CopyToClipboard:X,ElAlert:S,ImageWrapper:le,ApiCodeButton:se},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[],t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(n=>{let r=n;t&&(r.action=t),e.push(r)}),e}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await U.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`flux/deleteTask`,{id:e}),I.success(this.$t(`common.message.deleteTaskSuccess`))}catch{I.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenImage(e){window.open(e,`_blank`)}}}),tt={class:`preview`},nt={class:`left`},rt={class:`main`},it={class:`bot`},at={class:`datetime`},ot=[`aria-label`],st={class:`info`},ct={key:0,class:`prompt mt-2`},lt={key:0},ut={key:0,class:n({content:!0,failed:!0})},dt={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},ft={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},pt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ht={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},gt={key:1,class:n({content:!0})},_t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},bt={key:2,class:n({content:!0})},xt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function St(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-wrapper`),C=l(`api-code-button`),w=l(`channel-icon`),T=l(`magic-icon`),E=l(`copy-to-clipboard`),D=l(`time-icon`),O=l(`el-alert`),k=l(`warning-icon`),A=l(`info-icon`);return h(),s(`div`,tt,[e(`div`,nt,[a(y,{capability:`flux`,part:`avatar`,class:`avatar`})]),e(`div`,rt,[e(`div`,it,[a(y,{capability:`flux`,part:`name`}),e(`span`,at,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:u[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,ot)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,st,[n.modelValue?.request?.prompt?(h(),s(`p`,ct,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,lt,` - (`+i(n.$t(`flux.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,ut,[e(`div`,dt,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(S,{key:t,src:e?.image_url,"raw-src":e?.image_url,"model-value":e},null,8,[`src`,`raw-src`,`model-value`]))),128))]),e(`div`,ft,[a(C,{path:`/flux/images`,body:n.modelValue?.request},null,8,[`body`])]),a(O,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,pt,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.model`))+`: `+i(n.modelValue?.request?.model),1)]),e(`p`,mt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,ht,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.success===!1?(h(),s(`div`,gt,[a(O,{closable:!1,class:`failure`},{template:p(()=>[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.failure`)),1)]),default:p(()=>[e(`p`,_t,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,vt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(E,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,yt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,$,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0),n.modelValue?.response?o(``,!0):(h(),s(`div`,bt,[a(O,{closable:!1,class:`info`},{template:p(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.status.pending`)),1)]),default:p(()=>[e(`p`,xt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})]))])])}var Ct=_({name:`RecentPanel`,components:{TaskPreview:L(et,[[`render`,St],[`__scopeId`,`data-v-6df6d58d`]]),BotPlaceholder:ce,NoTasks:ae,ScrollList:ie},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),wt={key:0},Tt={key:2,class:`w-full h-full flex items-center justify-center`};function Et(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,wt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Tt,[a(v)])):o(``,!0)],64)}var Dt=_({name:`FluxIndex`,components:{ConfigPanel:$e,Layout:he,RecentPanel:L(Ct,[[`render`,Et]])},mixins:[G],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.flux?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.flux?.status?.getTasks===q.Request||this.fetchingTasks},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.tasks}},watch:{tasks:{handler(e,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 oe({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`flux/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`flux/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){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(`flux/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!z(this.uploadTracker,e=>this.$t(e),e=>I.warning(e)))return;let e={...this.config,async:!0};if(!K())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}I.info(this.$t(`flux.message.startingTask`)),Y(`flux`,ne.generate(e,{token:t})).then(()=>{I.success(this.$t(`flux.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?I.error(this.$t(`flux.message.usedUp`)):I.error(this.$t(`flux.message.startTaskFailed`)+t?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ot(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var kt=L(Dt,[[`render`,Ot]]);export{kt as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-LvaKgyRc.js";import{t as b}from"./upload-DqEeyoiI.js";import{t as x}from"./tooltip-Dy1LvOzq.js";import{t as S}from"./alert-BY_joJSO.js";import{t as C}from"./drawer-DdjNUdLN.js";import{t as w}from"./input-number-Dz4VZooF.js";import{t as T}from"./slider-DTkR70h5.js";import{t as E}from"./clock-otSJpi4t.js";import{r as D,t as O}from"./PromptTextarea-BdxR43fI.js";import{t as k}from"./info-RB2UKcjL.js";import{t as A}from"./trash-2-D_NoEBBp.js";import{t as j}from"./triangle-alert-BK4-7oIL.js";import{t as ee}from"./upload-D_Iy8VUb.js";import{t as M}from"./wand-sparkles-CpJf9L5C.js";import{cr as N,lr as P,ur as te}from"./constants-Dm-HitpB.js";import{E as F,Gt as ne,Kt as I,Sr as L,Ti as R,Ut as z,Vn as B,Wt as V,Yt as H,ci as U,di as W,in as G,qt as K,wi as q,zi as J}from"./index-NQhLFvCT.js";import{t as Y}from"./CopyToClipboard-DAsxz05c.js";import{t as X}from"./ImagePreview-0F7lED-X.js";import{n as Z}from"./taskDrawerMixin-DyAUhFEq.js";import{t as re}from"./Consumption-DWMEoulW.js";import{a as Q,n as ie,r as ae,t as oe}from"./pagination-D0u3tuFM.js";import{t as se}from"./ApiCodeButton-V0PNC5hd.js";import{t as ce}from"./BotPlaceholder-BMeL50cE.js";import{t as le}from"./ImageWrapper-Cdezi8bX.js";var ue=_({name:`LayoutFlux`,components:{MagicIcon:M,ElDrawer:C,ElButton:J},mixins:[Z]}),de={class:`main flex flex-row flex-1`},fe={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},pe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function me(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,de,[e(`div`,fe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,pe,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var he=F(ue,[[`render`,me],[`__scopeId`,`data-v-72e82d52`]]),ge=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`flux-dev`,label:`flux-dev`},{value:`flux-pro`,label:`flux-pro`},{value:`flux-kontext-pro`,label:`flux-kontext-pro`},{value:`flux-kontext-max`,label:`flux-kontext-max`},{value:`flux-2-flex`,label:`flux-2-flex`},{value:`flux-2-pro`,label:`flux-2-pro`},{value:`flux-2-max`,label:`flux-2-max`}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||=te}}),_e={class:`field`},ve={class:`title font-bold`};function ye(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,_e,[e(`h2`,ve,i(t.$t(`flux.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`flux.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var be=F(ge,[[`render`,ye],[`__scopeId`,`data-v-e9b17945`]]),xe=_({name:`CountSelector`,components:{ElSlider:T,InfoIcon:Q,ElInputNumber:w},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug(`set count`,e),this.$store.commit(`flux/setConfig`,{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||=1}}),Se={class:`flex justify-between`},Ce={class:`flex justify-start items-center`},we={class:`text-sm font-bold`},Te={class:`flex justify-end items-center`},Ee={class:`w-full`};function De(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`),p=l(`el-slider`);return h(),s(`div`,null,[e(`div`,Se,[e(`div`,Ce,[e(`span`,we,i(t.$t(`flux.name.numbers`)),1),a(d,{content:t.$t(`flux.description.numbers`)},null,8,[`content`])]),e(`div`,Te,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,Ee,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:1,max:4,step:1},null,8,[`modelValue`])])])}var Oe=F(xe,[[`render`,De]]),ke=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`generate`,label:this.$t(`flux.name.generate`)},{value:`edits`,label:this.$t(`flux.name.edits`)}]}},computed:{value:{get(){return this.$store.state.flux?.config?.action},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux.config,action:e})}}},mounted(){this.value||=P}}),Ae={class:`field`},je={class:`title font-bold`};function Me(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Ae,[e(`h2`,je,i(t.$t(`flux.name.task`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`flux.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ne=F(ke,[[`render`,Me],[`__scopeId`,`data-v-81fd05e5`]]),Pe=_({name:`ImageUrlInput`,components:{UploadIcon:ee,ElUpload:b,ElButton:J,InfoIcon:Q,ImagePreview:X},mixins:[K,I,V],emits:[`change`],data(){return{fileList:[],uploadUrl:W()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{urls:{handler(e){console.debug(`URLs changed:`,e),this.$store.commit(`flux/setConfig`,{...this.$store.state.flux.config,image_url:e[0]})}}},methods:{onExceed(){R.warning(this.$t(`flux.message.uploadStartImageExceed`))},onError(){R.error(this.$t(`flux.message.uploadStartImageError`))}}}),Fe={class:`relative`},Ie={class:`flex justify-between`},Le={class:`flex justify-start items-center`},Re={class:`text-sm font-bold`};function ze(t,n,o,c,u,d){let f=l(`info-icon`),m=l(`image-preview`),g=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`);return h(),s(`div`,Fe,[e(`div`,Ie,[e(`div`,Le,[e(`span`,Re,i(t.$t(`flux.name.imageUrl`)),1),a(f,{content:t.$t(`flux.description.imageUrl`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,limit:5,class:`upload-wrapper`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,multiple:!0,"list-type":`picture`,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,headers:t.headers},{file:p(({file:e})=>[a(m,{url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])]),default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(g,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`flux.button.uploadImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`headers`])])}var Be=F(Pe,[[`render`,ze],[`__scopeId`,`data-v-2e7e6966`]]),Ve=_({name:`PromptInput`,components:{PromptTextarea:O},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||=``}});function He(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`flux.name.prompt`),info:e.$t(`flux.description.prompt`),placeholder:e.$t(`flux.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ue=F(Ve,[[`render`,He]]),We=_({name:`SizeSelector`,components:{ElSelect:v,ElOption:y},data(){return{options:N}},computed:{value:{get(){return this.$store.state.flux?.config?.size},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux?.config,size:e})}}},mounted(){this.value||=`1:1`}}),Ge={class:`field`},Ke={class:`title font-bold`};function qe(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Ge,[e(`h2`,Ke,i(t.$t(`flux.name.ratio`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`flux.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Je=_({name:`PresetPanel`,components:{MagicIcon:M,ElButton:J,PromptInput:Ue,ModelSelector:be,CountSelector:Oe,Consumption:re,ActionSelector:Ne,ImageUrlInput:Be,SizeSelector:F(We,[[`render`,qe],[`__scopeId`,`data-v-8c58dc91`]])},emits:[`generate`],computed:{config(){return this.$store.state.flux?.config},consumption(){return H(this.config,this.service?.cost)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ye={class:`flex flex-col h-full`},Xe={class:`flex-1 overflow-y-auto p-5`},Ze={class:`flex flex-col items-center justify-center px-5 pb-5`};function Qe(t,n,c,u,d,m){let g=l(`action-selector`),_=l(`prompt-input`),v=l(`image-url-input`),y=l(`model-selector`),b=l(`size-selector`),x=l(`count-selector`),S=l(`consumption`),C=l(`magic-icon`),w=l(`el-button`);return h(),s(`div`,Ye,[e(`div`,Xe,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),t.config?.action===`edits`?(h(),f(v,{key:0,class:`mb-4`})):o(``,!0),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`})]),e(`div`,Ze,[a(S,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(w,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(C,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`flux.button.generate`)),1)]),_:1},8,[`onClick`])])])}var $e=F(Je,[[`render`,Qe]]),et=_({name:`TaskPreview`,components:{DeleteIcon:A,ElTooltip:x,ChannelIcon:D,InfoIcon:k,MagicIcon:M,TimeIcon:E,WarningIcon:j,CopyToClipboard:Y,ElAlert:S,ImageWrapper:le,ApiCodeButton:se},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[],t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(n=>{let r=n;t&&(r.action=t),e.push(r)}),e}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await q.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`flux/deleteTask`,{id:e}),R.success(this.$t(`common.message.deleteTaskSuccess`))}catch{R.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenImage(e){window.open(e,`_blank`)}}}),tt={class:`preview`},nt={class:`left`},rt={class:`main`},it={class:`bot`},at={class:`datetime`},ot=[`aria-label`],st={class:`info`},ct={key:0,class:`prompt mt-2`},lt={key:0},ut={key:0,class:n({content:!0,failed:!0})},dt={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},ft={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},pt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ht={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},gt={key:1,class:n({content:!0})},_t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},bt={key:2,class:n({content:!0})},xt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function St(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-wrapper`),C=l(`api-code-button`),w=l(`channel-icon`),T=l(`magic-icon`),E=l(`copy-to-clipboard`),D=l(`time-icon`),O=l(`el-alert`),k=l(`warning-icon`),A=l(`info-icon`);return h(),s(`div`,tt,[e(`div`,nt,[a(y,{capability:`flux`,part:`avatar`,class:`avatar`})]),e(`div`,rt,[e(`div`,it,[a(y,{capability:`flux`,part:`name`}),e(`span`,at,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:u[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,ot)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,st,[n.modelValue?.request?.prompt?(h(),s(`p`,ct,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,lt,` - (`+i(n.$t(`flux.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,ut,[e(`div`,dt,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(S,{key:t,src:e?.image_url,"raw-src":e?.image_url,"model-value":e},null,8,[`src`,`raw-src`,`model-value`]))),128))]),e(`div`,ft,[a(C,{path:`/flux/images`,body:n.modelValue?.request},null,8,[`body`])]),a(O,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,pt,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.model`))+`: `+i(n.modelValue?.request?.model),1)]),e(`p`,mt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,ht,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.success===!1?(h(),s(`div`,gt,[a(O,{closable:!1,class:`failure`},{template:p(()=>[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.failure`)),1)]),default:p(()=>[e(`p`,_t,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,vt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(E,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,yt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,$,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0),n.modelValue?.response?o(``,!0):(h(),s(`div`,bt,[a(O,{closable:!1,class:`info`},{template:p(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.status.pending`)),1)]),default:p(()=>[e(`p`,xt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})]))])])}var Ct=_({name:`RecentPanel`,components:{TaskPreview:F(et,[[`render`,St],[`__scopeId`,`data-v-6df6d58d`]]),BotPlaceholder:ce,NoTasks:ae,ScrollList:ie},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),wt={key:0},Tt={key:2,class:`w-full h-full flex items-center justify-center`};function Et(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,wt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Tt,[a(v)])):o(``,!0)],64)}var Dt=_({name:`FluxIndex`,components:{ConfigPanel:$e,Layout:he,RecentPanel:F(Ct,[[`render`,Et]])},mixins:[ne],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.flux?.status?.getApplications===U.Request},tasksLoading(){return this.$store.state.flux?.status?.getTasks===U.Request||this.fetchingTasks},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.tasks}},watch:{tasks:{handler(e,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 oe({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`flux/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`flux/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){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(`flux/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!z(this.uploadTracker,e=>this.$t(e),e=>R.warning(e)))return;let e={...this.config,async:!0};if(!G())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}R.info(this.$t(`flux.message.startingTask`)),L(`flux`,B.generate(e,{token:t})).then(()=>{R.success(this.$t(`flux.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?R.error(this.$t(`flux.message.usedUp`)):R.error(this.$t(`flux.message.startTaskFailed`)+t?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ot(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var kt=F(Dt,[[`render`,Ot]]);export{kt as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{n as v,r as y,t as b}from"./select-LvaKgyRc.js";import{t as x}from"./upload-DqEeyoiI.js";import{t as S}from"./tooltip-Dy1LvOzq.js";import{t as C}from"./alert-BY_joJSO.js";import{t as w}from"./drawer-DdjNUdLN.js";import{t as T}from"./input-number-Dz4VZooF.js";import{t as E}from"./box-BOmBNuoO.js";import{t as D}from"./clock-otSJpi4t.js";import{r as O,t as k}from"./PromptTextarea-BdxR43fI.js";import{t as A}from"./image-Ctt9oB_3.js";import{t as j}from"./info-RB2UKcjL.js";import{t as M}from"./trash-2-D_NoEBBp.js";import{t as N}from"./triangle-alert-BK4-7oIL.js";import{t as P}from"./upload-D_Iy8VUb.js";import{t as F}from"./wand-sparkles-CpJf9L5C.js";import{t as I}from"./zap-DDJuUmtO.js";import{An as ee,Cn as L,Dn as te,En as R,On as ne,Sn as z,Tn as B,jn as V,vn as re,wn as H,xn as U,yn as W}from"./constants-Dm-HitpB.js";import{E as G,Gt as ie,Kt as ae,Sr as oe,Ti as K,Ut as se,Wt as ce,Yt as le,ci as q,di as ue,in as de,kn as fe,qt as pe,wi as J,zi as Y}from"./index-NQhLFvCT.js";import{t as me}from"./CopyToClipboard-DAsxz05c.js";import{t as X}from"./ImagePreview-0F7lED-X.js";import{n as he}from"./taskDrawerMixin-DyAUhFEq.js";import{t as ge}from"./Consumption-DWMEoulW.js";import{a as Z,n as _e,r as ve,t as ye}from"./pagination-D0u3tuFM.js";import{t as be}from"./ApiCodeButton-V0PNC5hd.js";import{t as xe}from"./BotPlaceholder-BMeL50cE.js";import{t as Se}from"./ImageWrapper-Cdezi8bX.js";var Ce=_({name:`LayoutSeedream`,components:{MagicIcon:F,ElDrawer:w,ElButton:Y},mixins:[he]}),we={class:`main flex flex-row flex-1`},Te={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ee={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function De(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,we,[e(`div`,Te,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ee,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Oe=G(Ce,[[`render`,De],[`__scopeId`,`data-v-c10167d0`]]),ke=_({name:`SeedreamPromptInput`,components:{PromptTextarea:k},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ae(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var je=G(ke,[[`render`,Ae]]),Me={image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};function Q(e){switch(e){case B:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case H:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case L:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case z:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case U:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:W[U],outputFormat:!1,tools:!1};case R:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:W[R],outputFormat:!1,tools:!1};default:return Me}}function Ne(e,t){let n=Q(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Pe=[`1K`,`2K`,`3K`,`4K`];function Fe(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Q(n),i=[];Array.isArray(e.image)&&e.image.length>0&&!r.image&&i.push({field:`image`,i18nLabel:`seedream.name.imageUrls`});let a=typeof e.size==`string`?e.size:void 0;if(a){let e=a.toUpperCase();(Pe.includes(e)&&!r.sizeTiers.includes(e)||a===`adaptive`&&!r.sizeAdaptive)&&i.push({field:`size`,i18nLabel:`seedream.name.size`})}return e.sequential_image_generation===`auto`&&!r.groupGeneration&&i.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&e.seed!==null&&!r.seed&&i.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&e.guidance_scale!==null&&!r.guidanceScale&&i.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!r.outputFormat&&i.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),Array.isArray(e.tools)&&e.tools.length>0&&!r.tools&&i.push({field:`tools`,i18nLabel:`seedream.name.tools`}),i}function Ie(e,t,n){let r={...e},i=Q(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var Le=_({name:`SeedreamImageInput`,components:{UploadIcon:P,ElUpload:x,ElButton:Y,InfoIcon:Z,ImagePreview:X},mixins:[pe,ae,ce],data(){return{fileList:[],uploadUrl:ue()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.seedream?.config?.image},model(){return this.$store.state.seedream?.config?.model},supported(){return Q(this.model).image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){K.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){K.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),Re={key:0},ze={class:`field`},Be={class:`label`},Ve={class:`box`},He={class:`title font-bold`},Ue={class:`value`},We={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ge(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`upload-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return t.supported?(h(),s(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`div`,Ve,[e(`h2`,He,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Ue,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,We,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):o(``,!0)}var Ke=G(Le,[[`render`,Ge],[`__scopeId`,`data-v-fef518c4`]]),qe=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{revertKey:0,options:[{value:B,label:this.$t(`seedream.model.seedream50pro`)},{value:H,label:this.$t(`seedream.model.seedream50`)},{value:L,label:this.$t(`seedream.model.seedream45`)},{value:z,label:this.$t(`seedream.model.seedream40`)},{value:U,label:this.$t(`seedream.model.seedream30t2i`)},{value:R,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(re)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Fe(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await J.confirm(this.$t(`seedream.message.featureNotSupportedBody`,{fields:r}),this.$t(`seedream.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`seedream.button.confirmContinue`),cancelButtonText:this.$t(`seedream.button.cancelSwitch`),type:`warning`});let i=Ie({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),K.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),Je={class:`field`},Ye={class:`label`},Xe={class:`box`},Ze={class:`title font-bold`};function Qe(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Je,[e(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`seedream.name.model`)),1),a(g,{content:t.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(h(),f(v,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`seedream.placeholder.select`),onChange:t.onChange},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var $e=G(qe,[[`render`,Qe],[`__scopeId`,`data-v-6413c179`]]),et=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:Z},data(){return{SEEDREAM_SIZE_ADAPTIVE:ee,pixelOptions:ne}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Q(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),tt={class:`field`},nt={class:`label`},rt={class:`box`},it={class:`title font-bold`};function at(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`);return h(),s(`div`,tt,[e(`div`,nt,[e(`div`,rt,[e(`h2`,it,i(t.$t(`seedream.name.size`)),1),a(_,{content:t.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:p(()=>[t.capabilities.sizeTiers.length?(h(),f(y,{key:0,label:t.$t(`seedream.size.group.tier`)},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.sizeTiers,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),t.capabilities.sizeAdaptive?(h(),f(y,{key:1,label:t.$t(`seedream.size.group.adaptive`)},{default:p(()=>[(h(),f(v,{key:t.SEEDREAM_SIZE_ADAPTIVE,label:t.$t(`seedream.size.adaptive`),value:t.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:t.$t(`seedream.size.group.pixel`)},{default:p(()=>[(h(!0),s(c,null,m(t.pixelOptions,e=>(h(),f(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var ot=G(et,[[`render`,at],[`__scopeId`,`data-v-dd7bd021`]]),st=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),ct={key:0,class:`field`},lt={class:`label`},ut={class:`box`},dt={class:`title font-bold`},ft={class:`value`};function pt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,ct,[e(`div`,lt,[e(`div`,ut,[e(`h2`,dt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:t.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var mt=G(st,[[`render`,pt],[`__scopeId`,`data-v-f079fd20`]]),ht=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[...te]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),gt={key:0,class:`field`},_t={class:`label`},vt={class:`box`},yt={class:`title font-bold`};function bt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,gt,[e(`div`,_t,[e(`div`,vt,[e(`h2`,yt,i(t.$t(`seedream.name.outputFormat`)),1),a(_,{content:t.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var xt=G(ht,[[`render`,bt],[`__scopeId`,`data-v-69ea4c07`]]),St=_({name:`SeedreamSeedInput`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),Ct={key:0,class:`field`},wt={class:`label`},Tt={class:`box`},Et={class:`title font-bold`},Dt={class:`value`};function Ot(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,Ct,[e(`div`,wt,[e(`div`,Tt,[e(`h2`,Et,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Dt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var kt=G(St,[[`render`,Ot],[`__scopeId`,`data-v-10cdc1e0`]]),At=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).guidanceScale},defaultValue(){return Q(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),jt={key:0,class:`field`},Mt={class:`label`},Nt={class:`box`},Pt={class:`title font-bold`},Ft={class:`value`};function It(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,jt,[e(`div`,Mt,[e(`div`,Nt,[e(`h2`,Pt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Lt=G(At,[[`render`,It],[`__scopeId`,`data-v-7386f064`]]),$=e=>{let t={...e||{}},n=Ne(t.model,t.image);return delete t.action,t.watermark=!1,(n!==`edit`||!t.image?.length)&&delete t.image,t.size||delete t.size,t.sequential_image_generation!==`auto`&&delete t.sequential_image_generation_options,{...t,async:!0}},Rt=_({name:`SeedreamConfigPanel`,components:{MagicIcon:F,ElButton:Y,PromptInput:je,Consumption:ge,ImageInput:Ke,ModelSelector:$e,SizeSelector:ot,MaxImagesSelector:mt,OutputFormatSelector:xt,SeedInput:kt,GuidanceScaleInput:Lt},emits:[`generate`],computed:{action(){return Ne(this.config?.model,this.config?.image)},capabilities(){return Q(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=$(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return le({...e,action:this.action,model:V(e.model),input_image_count:e.image?.length||0,count:t},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),zt={class:`flex flex-col h-full`},Bt={class:`flex-1 overflow-y-auto p-5`},Vt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ht(t,n,c,u,d,m){let g=l(`model-selector`),_=l(`size-selector`),v=l(`max-images-selector`),y=l(`output-format-selector`),b=l(`seed-input`),x=l(`guidance-scale-input`),S=l(`prompt-input`),C=l(`image-input`),w=l(`consumption`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,zt,[e(`div`,Bt,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),t.capabilities.image?(h(),f(C,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,Vt,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(E,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ut=G(Rt,[[`render`,Ht]]),Wt=_({name:`SeedreamTaskPreview`,components:{DeleteIcon:M,ApplicationIcon:E,ChannelIcon:O,ImageIcon:A,InfoIcon:j,LightningIcon:I,MagicIcon:F,TimeIcon:D,WarningIcon:N,CopyToClipboard:me,ElAlert:C,ImageWrapper:Se,ElButton:Y,ElTooltip:S,ImagePreview:X,ApiCodeButton:be},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return $(this.modelValue?.request)},isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await J.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`seedream/deleteTask`,{id:e}),K.success(this.$t(`common.message.deleteTaskSuccess`))}catch{K.error(this.$t(`common.message.deleteTaskFailed`))}}},shortModel(e){return V(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Gt={class:`preview`},Kt={class:`left`},qt={class:`main`},Jt={class:`bot`},Yt={class:`datetime`},Xt=[`aria-label`],Zt={class:`info`},Qt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},$t={key:1,class:`prompt mt-2`},en={key:0},tn={key:0,class:n({content:!0})},nn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},rn={key:1,class:n({content:!0,failed:!0})},an={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},on={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ln={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},un={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},pn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},bn={key:3,class:n({content:!0})},xn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Cn(u,d,g,_,v,y){let b=l(`capability-presentation`),x=l(`delete-icon`),S=l(`el-tooltip`),C=l(`image-preview`),w=l(`time-icon`),T=l(`magic-icon`),E=l(`copy-to-clipboard`),D=l(`el-alert`),O=l(`image-wrapper`),k=l(`el-button`),A=l(`api-code-button`),j=l(`application-icon`),M=l(`image-icon`),N=l(`lightning-icon`),P=l(`channel-icon`),F=l(`warning-icon`),I=l(`info-icon`);return h(),s(`div`,Gt,[e(`div`,Kt,[a(b,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,qt,[e(`div`,Jt,[a(b,{capability:`seedream`,part:`name`}),e(`span`,Yt,i(u.$dayjs.format(``+new Date(parseFloat((u.modelValue?.created_at||``).toString())*1e3))),1),a(S,{effect:`dark`,content:u.$t(`common.button.delete`),placement:`top`},{default:p(()=>[u.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":u.$t(`common.button.delete`),onClick:d[0]||=t((...e)=>u.onDelete&&u.onDelete(...e),[`stop`])},[a(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Xt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Zt,[Array.isArray(u.modelValue?.request?.image)&&u.modelValue?.request?.image.length>0?(h(),s(`div`,Qt,[(h(!0),s(c,null,m(u.modelValue?.request?.image,(e,t)=>(h(),f(C,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),u.modelValue?.request?.prompt?(h(),s(`p`,$t,[r(i(u.modelValue?.request?.prompt)+` `,1),u.modelValue?.response?o(``,!0):(h(),s(`span`,en,` - (`+i(u.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),u.modelValue?.response?u.modelValue?.response?.success===!0?(h(),s(`div`,rn,[e(`div`,an,[(h(!0),s(c,null,m(u.images,(e,t)=>(h(),f(O,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,on,[a(S,{class:`box-item`,effect:`dark`,content:u.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(k,{type:`info`,size:`small`,class:`btn-action`,onClick:d[1]||=t(e=>u.onEdit(u.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(u.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(A,{path:`/seedream/images`,body:u.apiRequest},null,8,[`body`])]),a(D,{closable:!1,class:`mt-2 success`},{default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,sn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,cn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,un,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),u.modelValue?.elapsed?(h(),s(`p`,dn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,fn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):u.modelValue?.response?.success===!1?(h(),s(`div`,{key:2,class:n({content:!0,"mt-[15px]":!u.modelValue?.request?.prompt})},[a(D,{closable:!1,class:`failure`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failure`)),1)]),default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,pn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,mn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,hn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,gn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.error?.message?(h(),s(`p`,_n,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failureReason`))+`: `+i(u.modelValue?.response?.error?.message)+` `,1),a(E,{content:u.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),u.modelValue?.elapsed?(h(),s(`p`,vn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,yn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})],2)):(h(),s(`div`,bn,[a(D,{closable:!1,class:`info`},{template:p(()=>[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,xn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.trace_id?(h(),s(`p`,Sn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,tn,[a(D,{closable:!1,class:`info`},{template:p(()=>[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,nn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var wn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:G(Wt,[[`render`,Cn],[`__scopeId`,`data-v-394e4796`]]),BotPlaceholder:xe,NoTasks:ve,ScrollList:_e},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Tn={key:0},En={key:2,class:`w-full h-full flex items-center justify-center`};function Dn(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Tn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,En,[a(v)])):o(``,!0)],64)}var On=_({name:`SeedreamIndex`,components:{ConfigPanel:Ut,Layout:Oe,RecentPanel:G(wn,[[`render`,Dn]])},mixins:[ie],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===q.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ye({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!se(this.uploadTracker,e=>this.$t(e),e=>K.warning(e)))return;if(Q(this.config?.model).imageRequired&&!this.config?.image?.length){K.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=$(this.config);if(!de())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}K.info(this.$t(`seedream.message.startingTask`)),oe(`seedream`,fe.generate(e,{token:t})).then(()=>{K.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?K.error(this.$t(`seedream.message.usedUp`)):K.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function kn(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var An=G(On,[[`render`,kn]]);export{An as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-LvaKgyRc.js";import{n as x,t as S}from"./tabs--xygkAUx.js";import{t as C}from"./upload-DqEeyoiI.js";import{t as w}from"./tooltip-Dy1LvOzq.js";import{t as T}from"./alert-BY_joJSO.js";import{n as E,r as D}from"./radio-DgDgyT2l.js";import{t as O}from"./drawer-DdjNUdLN.js";import{t as k}from"./input-number-Dz4VZooF.js";import{t as A}from"./slider-DTkR70h5.js";import{t as j}from"./switch-DAdN8Vh2.js";import{t as M}from"./clock-otSJpi4t.js";import{r as N,t as ee}from"./PromptTextarea-BdxR43fI.js";import{t as te}from"./headphones-rnilQWSF.js";import{t as ne}from"./info-RB2UKcjL.js";import{t as re}from"./lightbulb-CSEYdZB7.js";import{t as ie}from"./trash-2-D_NoEBBp.js";import{t as ae}from"./triangle-alert-BK4-7oIL.js";import{t as P}from"./upload-D_Iy8VUb.js";import{t as F}from"./wand-sparkles-CpJf9L5C.js";import{hi as oe,mi as se,pi as ce,ui as le}from"./constants-Dm-HitpB.js";import{E as I,Gt as ue,Ji as L,Jn as R,Kt as z,Li as de,Si as fe,Sr as B,Ti as V,Ut as H,Wt as U,Yt as pe,ci as me,di as W,in as G,qt as K,wi as q,zi as J}from"./index-NQhLFvCT.js";import{t as he}from"./CopyToClipboard-DAsxz05c.js";import{t as ge}from"./FilePreview-D4-VAXV8.js";import{t as Y}from"./ImagePreview-0F7lED-X.js";import{n as _e}from"./taskDrawerMixin-DyAUhFEq.js";import{t as X}from"./Consumption-DWMEoulW.js";import{a as Z,n as ve,r as ye,t as be}from"./pagination-D0u3tuFM.js";import{t as xe}from"./VideoPlayer-DTVJVKri.js";import{t as Se}from"./ApiCodeButton-V0PNC5hd.js";import{t as Ce}from"./BotPlaceholder-BMeL50cE.js";import{n as we,t as Te}from"./AudioPreview-QhwYz5OI.js";var Ee=v({name:`LayoutKling`,components:{MagicIcon:F,ElDrawer:O,ElButton:J},mixins:[_e]}),De={class:`main flex flex-row flex-1 min-h-0`},Oe={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ke={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Ae(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,De,[e(`div`,Oe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ke,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var je=I(Ee,[[`render`,Ae],[`__scopeId`,`data-v-2d826924`]]),Me={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};function Q(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,referenceVideo:!1,referenceImages:!1};case`kling-v1-6`:case`kling-v2-5-turbo`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v2-6`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:r===`pro`,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v2-master`:case`kling-v2-1-master`:return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v3`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:r!==`4k`,referenceVideo:!1,referenceImages:!1};case`kling-v3-omni`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1,referenceVideo:!0,referenceImages:!0};case`kling-o1`:return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1,referenceVideo:!0,referenceImages:!0};default:return Me}}var $=`<<<video_1>>>`,Ne=/<<<image_\d+>>>/g;function Pe(e){return e?e.split($).join(` `).replace(/\s{2,}/g,` `).trim():``}function Fe(e){return e?e.replace(Ne,` `).replace(/\s{2,}/g,` `).trim():``}function Ie(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=Q(n,r,i),o=[];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`}),e.video_list?.length&&!a.referenceVideo&&o.push({field:`video_list`,i18nLabel:`kling.name.referenceVideo`}),e.image_list?.length&&!a.referenceImages&&o.push({field:`image_list`,i18nLabel:`kling.name.referenceImages`});let s=n===`kling-o1`||!!(e.image_list?.length||e.video_list?.length);return s&&e.cfg_scale!==void 0&&o.push({field:`cfg_scale`,i18nLabel:`kling.name.cfgScale`}),s&&e.negative_prompt&&o.push({field:`negative_prompt`,i18nLabel:`kling.name.negativePrompt`}),o}function Le(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),e.field===`cfg_scale`&&(n.cfg_scale=void 0),e.field===`negative_prompt`&&(n.negative_prompt=void 0),e.field===`video_list`&&(n.video_list=void 0,n.prompt=Pe(n.prompt)),e.field===`image_list`&&(n.image_list=void 0,n.prompt=Fe(n.prompt));return n}var Re=v({name:`ModelSelector`,components:{ElSelect:y,ElOption:b},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-o1`,label:`Kling O1`}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(le)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=Ie(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await q.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=Le({...t,model:e},n);this.$store.commit(`kling/setConfig`,i),V.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})}}}),ze={class:`field`},Be={class:`title font-bold`};function Ve(t,n,r,a,o,u){let d=l(`el-option`),m=l(`el-select`);return g(),s(`div`,ze,[e(`h2`,Be,i(t.$t(`pika.name.model`)),1),(g(),f(m,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`pika.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(d,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var He=I(Re,[[`render`,Ve],[`__scopeId`,`data-v-a74e7f31`]]),Ue=v({name:`ModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},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 oe.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=Ie(t,{mode:e});if(n.length===0){this.applyMode(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await q.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=Le({...t,mode:e},n);this.$store.commit(`kling/setConfig`,i),V.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})}}}),We={class:`field`},Ge={class:`header`},Ke={class:`title font-bold`},qe={key:0,class:`opt-tip`};function Je(t,r,u,d,m,_){let v=l(`info-icon`),y=l(`el-option`),b=l(`el-select`);return g(),s(`div`,We,[e(`div`,Ge,[e(`h2`,Ke,i(t.$t(`kling.name.mode`)),1),a(v,{content:t.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(g(),f(b,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`kling.placeholder.select`),clearable:!0,onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,t=>(g(),f(y,{key:t.value,label:t.label,value:t.value,disabled:t.disabled},{default:p(()=>[e(`span`,{class:n({"opt-disabled":t.disabled})},i(t.label),3),t.disabled&&t.disabledReason?(g(),s(`span`,qe,i(t.disabledReason),1)):o(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Ye=I(Ue,[[`render`,Je],[`__scopeId`,`data-v-9a8fa3c5`]]),Xe=[3,5,8,10,12,15],Ze=[5,10],Qe=[5],$e=v({name:`DurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return oe.includes(this.selectedModel)},allowedDurations(){return this.selectedModel===`kling-o1`?Qe:this.isV3Model?Xe: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:{selectedModel(){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=Ie(t,{duration:e});if(n.length===0){this.applyDuration(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await q.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=Le({...t,duration:e},n);this.$store.commit(`kling/setConfig`,i),V.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})}}}),et={class:`field`},tt={class:`control`},nt={class:`label`},rt={class:`title font-bold`};function it(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,et,[e(`div`,tt,[e(`div`,nt,[e(`h2`,rt,i(t.$t(`kling.name.duration`)),1),a(m,{content:t.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(g(),f(v,{key:t.revertKey,"model-value":t.selectValue,class:`value`,placeholder:t.$t(`kling.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.allowedDurations,e=>(g(),f(_,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var at=I($e,[[`render`,it],[`__scopeId`,`data-v-496bf31c`]]),ot=v({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`}}),st={class:`text-sm font-bold mb-2 block`},ct={class:`items`},lt=[`onClick`],ut={class:`name`};function dt(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,st,i(t.$t(`kling.name.ratio`)),1),e(`div`,ct,[(g(!0),s(c,null,h(t.options,(r,a)=>(g(),s(`div`,{key:a,class:n({active:t.active===a,item:!0}),onClick:e=>t.value=r.value},[e(`div`,{class:n([`preview`,r.label])},[e(`div`,{class:`rect`,style:m({width:r.width+`px`,height:r.height+`px`})},null,4)],2),e(`p`,ut,i(r.label),1)],10,lt))),128))])])}var ft=I(ot,[[`render`,dt],[`__scopeId`,`data-v-cdb14b2f`]]),pt=v({name:`StartImage`,components:{UploadIcon:P,ElUpload:C,ElButton:J,ElTooltip:w,InfoIcon:Z,ImagePreview:Y},mixins:[K,z,U],emits:[`change`],data(){return{fileList:[],uploadUrl:W()+`/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(){}}},watch:{value(e){!e&&this.fileList.length>0&&(this.fileList=[])}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){V.error(this.$t(`kling.message.uploadReferencesError`))},onBeforeUpload(){let e=this.$store.state.kling?.config||{};if(e.video_list?.[0]?.refer_type===`base`)return V.warning(this.$t(`kling.message.baseVideoFrameConflict`)),!1;let t=e.video_list?.length?4:7;return(e.image_list?.length||0)+Number(!!e.end_image_url)+1>t?(V.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:t})),!1):!0},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.onSetStartImageUrl()}}}),mt={class:`relative`},ht={class:`flex min-h-8 items-center pr-20`},gt={class:`flex justify-start items-center`},_t={class:`text-sm font-bold`};function vt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-tooltip`),x=l(`el-upload`);return g(),s(`div`,mt,[e(`div`,ht,[e(`div`,gt,[e(`span`,_t,i(t.$t(`kling.name.startImage`)),1),a(h,{content:t.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:t.reachedLimit,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"before-upload":t.onBeforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(b,{content:t.$t(`kling.message.uploadReferencesExceed`),disabled:!t.reachedLimit,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.reachedLimit},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$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 yt=I(pt,[[`render`,vt],[`__scopeId`,`data-v-60844ac3`]]),bt=v({name:`EndImage`,components:{UploadIcon:P,ElUpload:C,ElButton:J,ElTooltip:w,ImagePreview:Y,InfoIcon:Z},mixins:[K,z,U],data(){return{fileList:[],uploadUrl:W()+`/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 Q(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(){if(!this.endImageSupported)return V.warning(this.$t(`kling.message.endImageNotSupported`)),!1;if(!this.hasStartImage)return V.warning(this.$t(`kling.message.endImageRequiresStart`)),!1;if(this.klingConfig.video_list?.[0]?.refer_type===`base`)return V.warning(this.$t(`kling.message.baseVideoFrameConflict`)),!1;let e=this.klingConfig.video_list?.length?4:7;return(this.klingConfig.image_list?.length||0)+2>e?(V.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:e})),!1):!0},onExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){V.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()},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.onSetEndImageUrl()}}}),xt={class:`relative`},St={class:`flex min-h-8 items-center pr-20`},Ct={class:`flex justify-start items-center`},wt={class:`text-sm font-bold`};function Tt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-tooltip`),x=l(`el-upload`);return g(),s(`div`,xt,[e(`div`,St,[e(`div`,Ct,[e(`span`,wt,i(t.$t(`kling.name.endImage`)),1),a(h,{content:t.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:t.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"before-upload":t.onBeforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(b,{content:t.uploadTooltip,disabled:!t.uploadDisabled,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.uploadDisabled},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$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 Et=I(bt,[[`render`,Tt],[`__scopeId`,`data-v-b286c4d0`]]),Dt=v({name:`ReferenceVideo`,components:{ElUpload:C,ElButton:J,ElRadioButton:E,ElRadioGroup:D,ElSwitch:j,InfoIcon:Z,FilePreview:ge,UploadIcon:P},mixins:[z,U],data(){return{fileList:[],uploadUrl:W()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},config(){return this.$store.state.kling?.config||{}},hasVideo(){return!!this.urls?.[0]},referenceType:{get(){return this.config.video_list?.[0]?.refer_type||`feature`},set(e){this.updateVideoOptions(e,this.keepOriginalSound)}},keepOriginalSound:{get(){return this.config.video_list?.[0]?.keep_original_sound===`yes`},set(e){this.updateVideoOptions(this.referenceType,e)}}},methods:{onExceed(){V.warning(this.$t(`kling.message.referenceVideoExceed`))},onError(){V.error(this.$t(`kling.message.referenceVideoError`))},beforeUpload(e){if((this.config.image_list?.length||0)+Number(!!this.config.start_image_url)+Number(!!this.config.end_image_url)>4)return V.error(this.$t(`kling.message.referenceVideoImageLimit`)),!1;let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<200;return t?n?!0:(V.error(this.$t(`kling.message.referenceVideoSizeExceed`)),!1):(V.error(this.$t(`kling.message.referenceVideoTypeFailed`)),!1)},ensurePromptToken(e){let t=this.$store.state.kling?.config,n=t?.prompt||``,r=n.includes($),i;if(e&&!r)i=n?`${n} ${$}`:$;else if(!e&&r)i=Pe(n);else return;this.$store.commit(`kling/setConfig`,{...t,prompt:i})},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,video_list:void 0}),this.ensurePromptToken(!1)},onSetVideoList(){let e=this.urls?.[0],t=e?[{video_url:e,refer_type:this.referenceType,keep_original_sound:this.keepOriginalSound?`yes`:`no`}]:void 0;this.$store.commit(`kling/setConfig`,{...this.config,video_list:t,generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0}),this.ensurePromptToken(!!e)},updateVideoOptions(e,t){let n=this.urls?.[0];n&&this.$store.commit(`kling/setConfig`,{...this.config,video_list:[{video_url:n,refer_type:e,keep_original_sound:t?`yes`:`no`}],...e===`base`?{start_image_url:void 0,end_image_url:void 0}:{},generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0})},async onSuccess(){this.onSetVideoList()}}}),Ot={class:`relative`},kt={class:`flex min-h-8 items-center pr-20`},At={class:`flex justify-start items-center`},jt={class:`text-sm font-bold`},Mt={key:0,class:`reference-options mt-3 flex flex-col gap-3`},Nt={class:`flex flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between`},Pt={class:`text-sm`},Ft={class:`flex items-center justify-between gap-3`},It={class:`text-sm`};function Lt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`el-radio-button`),S=l(`el-radio-group`),C=l(`el-switch`);return g(),s(`div`,Ot,[e(`div`,kt,[e(`div`,At,[e(`span`,jt,i(t.$t(`kling.name.referenceVideo`)),1),a(h,{content:t.$t(`kling.description.omniReferenceVideo`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage===void 0?o(``,!0):(g(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferenceVideo`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`]),t.hasVideo?(g(),s(`div`,Mt,[e(`div`,Nt,[e(`span`,Pt,i(t.$t(`kling.name.referenceVideoType`)),1),a(S,{modelValue:t.referenceType,"onUpdate:modelValue":n[1]||=e=>t.referenceType=e,size:`small`},{default:p(()=>[a(x,{value:`feature`},{default:p(()=>[r(i(t.$t(`kling.name.referenceVideoFeature`)),1)]),_:1}),a(x,{value:`base`},{default:p(()=>[r(i(t.$t(`kling.name.referenceVideoBase`)),1)]),_:1})]),_:1},8,[`modelValue`])]),e(`div`,Ft,[e(`span`,It,i(t.$t(`kling.name.keepOriginalSound`)),1),a(C,{modelValue:t.keepOriginalSound,"onUpdate:modelValue":n[2]||=e=>t.keepOriginalSound=e},null,8,[`modelValue`])])])):o(``,!0)])}var Rt=I(Dt,[[`render`,Lt],[`__scopeId`,`data-v-f0c5414a`]]),zt=v({name:`KlingReferenceImages`,components:{ElButton:J,ElUpload:C,UploadIcon:P,ImagePreview:Y,InfoIcon:Z},mixins:[K,z,U],data(){return{fileList:[],uploadUrl:W()+`/api/v1/files/`}},computed:{config(){return this.$store.state.kling?.config||{}},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},frameCount(){return Number(!!this.config.start_image_url)+Number(!!this.config.end_image_url)},maxImages(){return this.config.video_list?.length?4:7},referenceLimit(){return Math.max(0,this.maxImages-this.frameCount)},remainingSlots(){return Math.max(0,this.referenceLimit-this.urls.length)},urls(){return this.fileList.map(e=>e.response?.file_url||e.url).filter(Boolean)},storeImages(){return this.config.image_list}},watch:{frameCount(){this.syncPromptTokens()},storeImages(e){!e?.length&&this.fileList.length>0&&(this.fileList=[])}},methods:{beforeUpload(){return this.remainingSlots===0?(this.onExceed(),!1):!0},onExceed(){V.warning(this.$t(`kling.message.referenceImagesExceed`,{count:this.remainingSlots}))},onError(){V.error(this.$t(`kling.message.referenceImagesError`))},clearOmniConflicts(e){return{...e,generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0}},syncPromptTokens(e){let t=e||this.config,n=[Fe(t.prompt),...this.urls.map((e,t)=>`<<<image_${this.frameCount+t+1}>>>`)].filter(Boolean).join(` `);n!==t.prompt&&this.$store.commit(`kling/setConfig`,{...t,prompt:n})},syncConfig(){let e=this.urls.length?this.urls.map(e=>({image_url:e})):void 0,t=this.clearOmniConflicts({...this.config,image_list:e});this.$store.commit(`kling/setConfig`,t),this.syncPromptTokens(t)},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.syncConfig()},onRemove(e,t){this.fileList.splice(e,1),t.url?.startsWith(`blob:`)&&URL.revokeObjectURL(t.url),this.syncConfig()}}}),Bt={class:`relative`},Vt={class:`flex justify-between items-center`},Ht={class:`flex justify-start items-center`},Ut={class:`text-sm font-bold`},Wt={key:0,class:`file-list flex flex-wrap gap-2 mt-2`};function Gt(t,n,u,d,m,_){let v=l(`info-icon`),y=l(`UploadIcon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return g(),s(`div`,Bt,[e(`div`,Vt,[e(`div`,Ht,[e(`span`,Ut,i(t.$t(`kling.name.referenceImages`)),1),a(v,{content:t.$t(`kling.description.referenceImages`)},null,8,[`content`])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg`,name:`file`,limit:t.referenceLimit,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{default:p(()=>[a(b,{round:``,type:`primary`,size:`small`,disabled:t.remainingSlots===0},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferenceImages`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`file-list`,`limit`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.fileList.length?(g(),s(`div`,Wt,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(S,{key:e.uid||e.url||n,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemove(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])):o(``,!0)])}var Kt=I(zt,[[`render`,Gt]]),qt=v({name:`CfgScaleSelector`,components:{ElSlider:A,InfoIcon:Z,ElInputNumber:k},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}}),Jt={class:`flex justify-between`},Yt={class:`flex justify-start items-center`},Xt={class:`text-sm font-bold`},Zt={class:`flex justify-end items-center`},Qt={class:`w-full`};function $t(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`),p=l(`el-slider`);return g(),s(`div`,null,[e(`div`,Jt,[e(`div`,Yt,[e(`span`,Xt,i(t.$t(`kling.name.cfgScale`)),1),a(d,{content:t.$t(`kling.description.cfgScale`)},null,8,[`content`])]),e(`div`,Zt,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,Qt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var en=I(qt,[[`render`,$t]]),tn=v({name:`GenerateAudioSelector`,components:{ElSwitch:j,InfoIcon:Z},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},supported(){return!!(oe.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})}}}),nn={class:`relative`},rn={class:`flex justify-between items-center`},an={class:`flex justify-start items-center`},on={class:`text-sm font-bold`};function sn(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,nn,[e(`div`,rn,[e(`div`,an,[e(`span`,on,i(t.$t(`kling.name.generateAudio`)),1),a(d,{content:t.tooltipContent},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,disabled:!t.supported},null,8,[`modelValue`,`disabled`])])])}var cn=I(tn,[[`render`,sn]]),ln=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],un=v({name:`CameraControlSelector`,components:{ElSelect:y,ElOption:b,ElSlider:A,ElInputNumber:k,InfoIcon:Z},data(){return{configKeys:ln}},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 Q(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)}}}),dn={class:`field`},fn={class:`header`},pn={class:`text-sm font-bold`},mn={key:0,class:`config-grid`},hn={class:`cfg-row-head`},gn={class:`cfg-name`};function _n(t,n,r,u,d,m){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`),b=l(`el-input-number`),x=l(`el-slider`);return g(),s(`div`,dn,[e(`div`,fn,[e(`span`,pn,i(t.$t(`kling.name.cameraControl`)),1),a(_,{content:t.tooltipContent},null,8,[`content`])]),a(y,{modelValue:t.selectedTypeRaw,"onUpdate:modelValue":n[0]||=e=>t.selectedTypeRaw=e,class:`value`,placeholder:t.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:t.disabled},{default:p(()=>[(g(!0),s(c,null,h(t.typeOptions,e=>(g(),f(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),t.selectedType===`simple`&&!t.disabled?(g(),s(`div`,mn,[(g(!0),s(c,null,h(t.configKeys,n=>(g(),s(`div`,{key:n,class:`cfg-row`},[e(`div`,hn,[e(`span`,gn,i(t.$t(`kling.name.cc_${n}`)),1),a(b,{modelValue:t.configValues[n],"onUpdate:modelValue":e=>t.configValues[n]=e,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:e=>t.onNumberChange(n,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),a(x,{"model-value":t.configValues[n]??0,min:-1,max:1,step:.1,onInput:e=>t.onSliderChange(n,e)},null,8,[`model-value`,`onInput`])]))),128))])):o(``,!0)])}var vn=I(un,[[`render`,_n],[`__scopeId`,`data-v-cd896060`]]),yn=[{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`]}],bn=`, `;function xn(e,t){let n=(e||``).trim();return n?n.includes(t)?n:`${n}${bn}${t}`:t}function Sn(e,t){if(!e||!t)return e||``;let n=[`${t}${bn}`,`${bn}${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 Cn=v({name:`InspirationPills`,components:{CloseIcon:fe},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return yn.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=Sn(this.prompt,e);this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:t})}}}),wn={key:0,class:`pills`,role:`list`},Tn={class:`pill-text`},En=[`aria-label`,`title`,`onClick`];function Dn(n,r,u,d,f,p){let m=l(`close-icon`);return n.selected.length>0?(g(),s(`div`,wn,[(g(!0),s(c,null,h(n.selected,r=>(g(),s(`div`,{key:r,class:`pill`,role:`listitem`},[e(`span`,Tn,i(r),1),e(`button`,{type:`button`,class:`pill-remove`,"aria-label":n.$t(`kling.inspiration.removeChip`),title:n.$t(`kling.inspiration.removeChip`),onClick:t(e=>n.onRemove(r),[`stop`])},[a(m,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,En)]))),128))])):o(``,!0)}var On=v({name:`PromptInput`,components:{IdeaIcon:re,ElButton:J,PromptTextarea:ee,InspirationPills:I(Cn,[[`render`,Dn],[`__scopeId`,`data-v-6be01bcf`]])},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 kn(e,t,n,o,s,c){let u=l(`idea-icon`),d=l(`el-button`),m=l(`inspiration-pills`),h=l(`prompt-textarea`);return g(),f(h,{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:p(()=>[a(d,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:p(()=>[a(u,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:p(()=>[a(m)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var An=I(On,[[`render`,kn],[`__scopeId`,`data-v-5754ae54`]]),jn=v({name:`NegativePromptInput`,components:{ElInput:L,InfoIcon:Z},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||=``}}),Mn={class:`field`},Nn={class:`box`},Pn={class:`title font-bold`};function Fn(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,Mn,[e(`div`,Nn,[e(`h2`,Pn,i(t.$t(`kling.name.negativePrompt`)),1),a(d,{content:t.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var In=I(jn,[[`render`,Fn],[`__scopeId`,`data-v-de98cf01`]]),Ln=v({name:`InspirationDrawer`,components:{Close:fe,IdeaIcon:re,ElDrawer:O,ElButton:J},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:yn}},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(Sn(this.prompt,e)):this.setPrompt(xn(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=Sn(e,t);this.setPrompt(e)}}}),Rn={class:`drawer-content`},zn={class:`drawer-header`},Bn={class:`title-row`},Vn={class:`title`},Hn={class:`hint`},Un={key:0,class:`selected-bar`},Wn={class:`selected-text`},Gn={class:`groups`},Kn={class:`group-title`},qn={class:`chip-grid`},Jn=[`onClick`];function Yn(t,u,d,m,_,v){let y=l(`idea-icon`),b=l(`close`),x=l(`el-button`),S=l(`el-drawer`);return g(),f(S,{modelValue:t.visible,"onUpdate:modelValue":u[1]||=e=>t.visible=e,direction:`rtl`,"with-header":!1,size:t.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:p(()=>[e(`div`,Rn,[e(`div`,zn,[e(`div`,Bn,[a(y,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`span`,Vn,i(t.$t(`kling.inspiration.title`)),1)]),a(x,{text:``,class:`close-btn`,"aria-label":t.$t(`common.button.close`),title:t.$t(`common.button.close`),onClick:u[0]||=e=>t.visible=!1},{default:p(()=>[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`])]),e(`div`,Hn,i(t.$t(`kling.inspiration.hint`)),1),t.selectedCount>0?(g(),s(`div`,Un,[e(`span`,Wn,i(t.$t(`kling.inspiration.selectedSummary`,{count:t.selectedCount})),1),a(x,{text:``,size:`small`,class:`clear-btn`,onClick:t.onClearSelected},{default:p(()=>[r(i(t.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):o(``,!0),e(`div`,Gn,[(g(!0),s(c,null,h(t.groups,r=>(g(),s(`div`,{key:r.groupKey,class:`group`},[e(`div`,Kn,i(t.$t(`kling.inspiration.group.${r.groupKey}`)),1),e(`div`,qn,[(g(!0),s(c,null,h(r.chipKeys,e=>(g(),s(`button`,{key:e,type:`button`,class:n({chip:!0,active:t.isSelected(t.chipText(e))}),onClick:n=>t.onToggle(t.chipText(e))},i(t.chipText(e)),11,Jn))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var Xn=I(Ln,[[`render`,Yn],[`__scopeId`,`data-v-8b2e6a5d`]]),Zn={"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-o1":`Kling O1`},Qn={std:`720p`,pro:`1080p`,"4k":`4K`},$n=v({name:`SummaryChip`,components:{AudioIcon:te},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return Zn[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return Qn[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),er={class:`summary-chip`},tr=[`title`],nr=[`title`],rr=[`title`],ir=[`title`],ar=[`title`];function or(t,n,r,c,u,d){let f=l(`audio-icon`);return g(),s(`div`,er,[e(`span`,{class:`part`,title:t.$t(`kling.name.model`)},i(t.modelLabel),9,tr),n[0]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.duration`)},i(t.durationLabel),9,nr),n[1]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.ratio`)},i(t.aspectRatio||`16:9`),9,rr),n[2]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.mode`)},i(t.modeLabel),9,ir),t.generateAudio?(g(),s(`span`,{key:0,class:`audio`,title:t.$t(`kling.name.generateAudio`)},[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,ar)):o(``,!0)])}var sr=v({name:`ConfigPanel`,components:{MagicIcon:F,ElButton:J,Consumption:X,PromptInput:An,NegativePromptInput:In,ModelSelector:He,ModeSelector:Ye,DurationSelector:at,RatioSelector:ft,StartImage:yt,CfgScaleSelector:en,GenerateAudioSelector:cn,CameraControlSelector:vn,InspirationDrawer:Xn,SummaryChip:I($n,[[`render`,or],[`__scopeId`,`data-v-c800852a`]]),EndImage:Et,ReferenceImages:Kt,ReferenceVideo:Rt},emits:[`generate`],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},capabilities(){return Q(this.config?.model,this.config?.mode,this.config?.duration)},omniActive(){return this.config?.model===`kling-o1`||!!(this.config?.image_list?.length||this.config?.video_list?.length)},consumption(){return pe(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),cr={class:`flex flex-col h-full`},lr={class:`flex-1 overflow-y-auto p-5`},ur={class:`flex flex-col items-center justify-center px-5 pb-5`};function dr(t,n,c,u,d,m){let h=l(`prompt-input`),_=l(`model-selector`),v=l(`ratio-selector`),y=l(`reference-images`),b=l(`reference-video`),x=l(`start-image`),S=l(`end-image`),C=l(`duration-selector`),w=l(`mode-selector`),T=l(`generate-audio-selector`),E=l(`camera-control-selector`),D=l(`cfg-scale-selector`),O=l(`negative-prompt-input`),k=l(`summary-chip`),A=l(`consumption`),j=l(`magic-icon`),M=l(`el-button`),N=l(`inspiration-drawer`);return g(),s(`div`,cr,[e(`div`,lr,[a(h,{class:`mb-4`,onOpenInspiration:n[0]||=e=>t.inspirationOpen=!0}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),t.capabilities.referenceImages?(g(),f(y,{key:0,class:`mb-3`})):o(``,!0),t.capabilities.referenceVideo?(g(),f(b,{key:1,class:`mb-4`})):o(``,!0),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`}),a(w,{class:`mb-4`}),a(T,{class:`mb-4`}),t.omniActive?o(``,!0):(g(),f(E,{key:2,class:`mb-4`})),t.omniActive?o(``,!0):(g(),f(D,{key:3,class:`mb-4`})),t.omniActive?o(``,!0):(g(),f(O,{key:4,class:`mb-4`}))]),e(`div`,ur,[a(k),a(A,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(g(),f(M,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(j,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.extend`)),1)]),_:1},8,[`onClick`])):(g(),f(M,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(j,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generate`)),1)]),_:1},8,[`onClick`]))]),a(N,{modelValue:t.inspirationOpen,"onUpdate:modelValue":n[1]||=e=>t.inspirationOpen=e},null,8,[`modelValue`])])}var fr=I(sr,[[`render`,dr]]),pr=v({name:`MotionImage`,components:{UploadIcon:P,ElUpload:C,ElButton:J,InfoIcon:Z,ImagePreview:Y},mixins:[K,z,U],data(){return{fileList:[],uploadUrl:W()+`/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(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){V.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()}}}),mr={class:`relative`},hr={class:`flex justify-between`},gr={class:`flex justify-start items-center`},_r={class:`text-sm font-bold`};function vr(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,mr,[e(`div`,hr,[e(`div`,gr,[e(`span`,_r,i(t.$t(`kling.name.motionImage`)),1),a(h,{content:t.$t(`kling.description.motionImage`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var yr=I(pr,[[`render`,vr],[`__scopeId`,`data-v-c1e8a1af`]]),br=v({name:`MotionVideo`,components:{UploadIcon:P,ElUpload:C,ElButton:J,InfoIcon:Z,FilePreview:ge},mixins:[z,U],data(){return{fileList:[],uploadUrl:W()+`/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(){V.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){V.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:(V.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(V.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()}}}),xr={class:`relative`},Sr={class:`flex justify-between`},Cr={class:`flex justify-start items-center`},wr={class:`text-sm font-bold`};function Tr(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,xr,[e(`div`,Sr,[e(`div`,Cr,[e(`span`,wr,i(t.$t(`kling.name.motionVideo`)),1),a(h,{content:t.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage===void 0?o(``,!0):(g(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Er=I(br,[[`render`,Tr],[`__scopeId`,`data-v-630c4521`]]),Dr=v({name:`MotionPromptInput`,components:{ElInput:L,InfoIcon:Z},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||``},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),Or={class:`field`},kr={class:`box`},Ar={class:`title font-bold`};function jr(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,Or,[e(`div`,kr,[e(`h2`,Ar,i(t.$t(`kling.name.motionPrompt`)),1),a(d,{content:t.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Mr=I(Dr,[[`render`,jr],[`__scopeId`,`data-v-ca9fdbe5`]]),Nr=`video`,Pr=v({name:`CharacterOrientationSelector`,components:{ElRadioGroup:D,ElRadioButton:E,InfoIcon:Z},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||Nr},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=Nr)}}),Fr={class:`field`},Ir={class:`header`},Lr={class:`text-sm font-bold`};function Rr(t,n,o,c,u,d){let f=l(`info-icon`),m=l(`el-radio-button`),h=l(`el-radio-group`);return g(),s(`div`,Fr,[e(`div`,Ir,[e(`span`,Lr,i(t.$t(`kling.name.characterOrientation`)),1),a(f,{content:t.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),a(h,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,size:`small`,class:`value`},{default:p(()=>[a(m,{label:`image`},{default:p(()=>[r(i(t.$t(`kling.name.orientationImage`)),1)]),_:1}),a(m,{label:`video`},{default:p(()=>[r(i(t.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var zr=I(Pr,[[`render`,Rr],[`__scopeId`,`data-v-7a91195b`]]),Br=`kling-v2-6`,Vr=v({name:`MotionModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},computed:{options(){return[{value:`kling-v2-6`,label:`Kling 2.6`},{value:`kling-v3`,label:`Kling 3.0`}]},value:{get(){return this.$store.state.kling?.motionConfig?.model_name||Br},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,model_name:e})}}},mounted(){this.$store.state.kling?.motionConfig?.model_name||(this.value=Br)}}),Hr={class:`field`},Ur={class:`header`},Wr={class:`title font-bold`};function Gr(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Hr,[e(`div`,Ur,[e(`h2`,Wr,i(t.$t(`kling.name.motionModel`)),1),a(m,{content:t.$t(`kling.description.motionModel`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Kr=I(Vr,[[`render`,Gr],[`__scopeId`,`data-v-480e8da2`]]),qr=`std`,Jr=v({name:`MotionModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},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||qr},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=qr)}}),Yr={class:`field`},Xr={class:`header`},Zr={class:`title font-bold`};function Qr(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Yr,[e(`div`,Xr,[e(`h2`,Zr,i(t.$t(`kling.name.mode`)),1),a(m,{content:t.$t(`kling.description.motionMode`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var $r=I(Jr,[[`render`,Qr],[`__scopeId`,`data-v-1295688c`]]),ei=v({name:`KeepOriginalSoundSelector`,components:{ElSwitch:j,InfoIcon:Z},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`})}}}}),ti={class:`relative`},ni={class:`flex justify-between items-center`},ri={class:`flex justify-start items-center`},ii={class:`text-sm font-bold`};function ai(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,ti,[e(`div`,ni,[e(`div`,ri,[e(`span`,ii,i(t.$t(`kling.name.keepOriginalSound`)),1),a(d,{content:t.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e},null,8,[`modelValue`])])])}var oi=v({name:`MotionPanel`,components:{MagicIcon:F,ElButton:J,Consumption:X,MotionImage:yr,MotionVideo:Er,MotionPromptInput:Mr,CharacterOrientationSelector:zr,MotionModelSelector:Kr,MotionModeSelector:$r,KeepOriginalSoundSelector:I(ei,[[`render`,ai]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return pe({...this.motionConfig,duration:1},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`)}}}),si={class:`flex flex-col h-full`},ci={class:`flex-1 overflow-y-auto p-5`},li={class:`flex flex-col items-center justify-center px-5 pb-5`};function ui(t,n,o,c,u,d){let f=l(`motion-image`),m=l(`motion-video`),h=l(`motion-prompt-input`),_=l(`character-orientation-selector`),v=l(`motion-model-selector`),y=l(`motion-mode-selector`),b=l(`keep-original-sound-selector`),x=l(`consumption`),S=l(`magic-icon`),C=l(`el-button`);return g(),s(`div`,si,[e(`div`,ci,[a(f,{class:`mb-3`}),a(m,{class:`mb-3`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`})]),e(`div`,li,[a(x,{value:t.consumption,service:t.service,"rate-unit":t.$t(`kling.name.perSecond`),note:t.$t(`kling.message.motionPricingNote`)},null,8,[`value`,`service`,`rate-unit`,`note`]),a(C,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(S,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var di=I(oi,[[`render`,ui]]),fi=v({name:`KlingTabSwitcher`,components:{ElTabs:x,ElTabPane:S,ElTag:de},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)}}}),pi=[`title`],mi={class:`text`};function hi(t,n,a,u,d,m){let _=l(`el-tag`),v=l(`el-tab-pane`),y=l(`el-tabs`);return g(),f(y,{"model-value":t.modelValue,class:`kling-tabs scenario-tabs scenario-tabs--divided`,"onUpdate:modelValue":t.onUpdate},{default:p(()=>[(g(!0),s(c,null,h(t.tabs,t=>(g(),f(v,{key:t.value,name:t.value,disabled:t.disabled},{label:p(()=>[e(`span`,{class:`tab-label`,title:t.disabled?t.disabledReason:void 0},[e(`span`,mi,i(t.label),1),t.badge?(g(),f(_,{key:0,size:`small`,type:`warning`,class:`badge`},{default:p(()=>[r(i(t.badge),1)]),_:2},1024)):o(``,!0)],8,pi)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var gi=I(fi,[[`render`,hi],[`__scopeId`,`data-v-e6a2bb26`]]),_i={"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`},vi=v({name:`TalkingPhotoModelSelector`,components:{ElSelect:y,ElOption:b},data(){return{options:se.map(e=>({value:e,label:_i[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=ce)}}),yi={class:`field`},bi={class:`title font-bold`};function xi(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,yi,[e(`h2`,bi,i(t.$t(`kling.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Si=I(vi,[[`render`,xi],[`__scopeId`,`data-v-cbc83d11`]]),Ci=v({name:`TalkingPhotoModeSelector`,components:{ElSelect:y,ElOption:b},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`)}}),wi={class:`field`},Ti={class:`title font-bold`};function Ei(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,wi,[e(`h2`,Ti,i(t.$t(`kling.name.mode`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Di=v({name:`TalkingPhotoPanel`,components:{MagicIcon:F,UploadIcon:P,ElUpload:C,ElButton:J,ElInput:L,Consumption:X,InfoIcon:Z,ImagePreview:Y,ModelSelector:Si,ModeSelector:I(Ci,[[`render`,Ei],[`__scopeId`,`data-v-92525a1d`]])},mixins:[U],emits:[`generate`],data(){return{imageFiles:[],audioFiles:[],uploadUrl:W()+`/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 pe({...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(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onImageError(){V.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(){V.warning(this.$t(`kling.message.uploadAudioExceed`))},onAudioError(){V.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`)}}}),Oi={class:`flex flex-col h-full`},ki={class:`flex-1 overflow-y-auto p-5`},Ai={class:`relative mb-4`},ji={class:`flex justify-start items-center`},Mi={class:`text-sm font-bold`},Ni={class:`relative mb-4`},Pi={class:`flex justify-start items-center`},Fi={class:`text-sm font-bold`},Ii=[`src`],Li={class:`mb-4`},Ri={class:`flex justify-start items-center`},zi={class:`text-sm font-bold`},Bi={class:`flex flex-col items-center justify-center px-5 pb-5`};function Vi(t,n,c,u,d,m){let h=l(`model-selector`),_=l(`mode-selector`),v=l(`info-icon`),y=l(`image-preview`),b=l(`upload-icon`),x=l(`el-button`),S=l(`el-upload`),C=l(`el-input`),w=l(`consumption`),T=l(`magic-icon`);return g(),s(`div`,Oi,[e(`div`,ki,[a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),e(`div`,Ai,[e(`div`,ji,[e(`span`,Mi,i(t.$t(`kling.name.talkingPhotoImage`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoImage`)},null,8,[`content`])]),a(S,{ref:`imageUploader`,"file-list":t.imageFiles,"onUpdate:fileList":n[0]||=e=>t.imageFiles=e,name:`file`,accept:`.png,.jpg,.jpeg,.webp,.bmp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,headers:t.headers,"on-exceed":t.onImageExceed,"on-error":t.onImageError,"on-success":t.onImageSuccess},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(y,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onImageRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(b,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`])]),e(`div`,Ni,[e(`div`,Pi,[e(`span`,Fi,i(t.$t(`kling.name.talkingPhotoAudio`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoAudio`)},null,8,[`content`])]),a(S,{ref:`audioUploader`,"file-list":t.audioFiles,"onUpdate:fileList":n[1]||=e=>t.audioFiles=e,name:`file`,accept:`.mp3,.wav,.m4a,.aac`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,headers:t.headers,"on-exceed":t.onAudioExceed,"on-error":t.onAudioError,"on-success":t.onAudioSuccess,"on-remove":t.onAudioRemove},{default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn`},{default:p(()=>[a(b,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadAudio`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`]),t.audioUrl?(g(),s(`audio`,{key:0,src:t.audioUrl,controls:``,class:`w-full mt-2`},null,8,Ii)):o(``,!0)]),e(`div`,Li,[e(`div`,Ri,[e(`span`,zi,i(t.$t(`kling.name.talkingPhotoPrompt`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoPrompt`)},null,8,[`content`])]),a(C,{"model-value":t.config.prompt,type:`textarea`,rows:2,placeholder:t.$t(`kling.placeholder.talkingPhotoPrompt`),class:`mt-1`,"onUpdate:modelValue":t.onPromptChange},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])])]),e(`div`,Bi,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generateTalkingPhoto`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Hi=I(Di,[[`render`,Vi],[`__scopeId`,`data-v-1cf65bf0`]]),Ui=v({name:`TaskPreview`,components:{DeleteIcon:ie,ChannelIcon:N,InfoIcon:ne,MagicIcon:F,TimeIcon:M,WarningIcon:ae,CopyToClipboard:he,ElAlert:T,VideoPlayer:xe,ElTooltip:w,ElButton:J,ImagePreview:Y,VideoPreview:we,AudioPreview:Te,ApiCodeButton:Se},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{isFailure(){let e=this.modelValue?.response;return e?.success===!1||!!e?.error||e?.state===`failed`||e?.state===`cancelled`},isWaiting(){let e=this.modelValue?.response;return!e||!this.isFailure&&e.success!==!0&&!e.video_url},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,r=this.modelValue?.request?.image_url;return t&&e.push({url:t,name:`start-image`}),n&&e.push({url:n,name:`end-image`}),r&&e.push({url:r,name:`reference-image`}),e},referenceVideos(){let e=[],t=this.modelValue?.request?.video_url;t&&e.push({url:t,name:`reference-video`});let n=this.modelValue?.request?.video_list;return(Array.isArray(n)?n:[]).forEach((t,n)=>{t?.video_url&&e.push({url:t.video_url,name:`reference-video-${n+1}`})}),e},referenceAudios(){let e=this.modelValue?.request?.audio_url;return e?[{url:e,name:`reference-audio`}]:[]}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await q.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`kling/deleteTask`,{id:e}),V.success(this.$t(`common.message.deleteTaskSuccess`))}catch{V.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Wi={class:`preview`},Gi={class:`left`},Ki={class:`main`},qi={class:`bot`},Ji={class:`datetime`},Yi=[`aria-label`],Xi={class:`info`},Zi={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Qi={key:1,class:`prompt mt-2`},$i={key:0},ea={key:1},ta={key:0,class:n({content:!0,failed:!0})},na={key:0,class:`mb-4`},ra={key:1,class:n({operations:!0,"mt-2":!0})},ia={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},aa={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},oa={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},sa={key:1,class:n({content:!0})},ca={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},la={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ua={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},da={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},fa={key:2,class:n({content:!0})},pa={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ma={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function ha(n,u,d,m,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-preview`),C=l(`video-preview`),w=l(`audio-preview`),T=l(`video-player`),E=l(`el-button`),D=l(`api-code-button`),O=l(`channel-icon`),k=l(`magic-icon`),A=l(`copy-to-clipboard`),j=l(`time-icon`),M=l(`el-alert`),N=l(`warning-icon`),ee=l(`info-icon`);return g(),s(`div`,Wi,[e(`div`,Gi,[a(y,{capability:`kling`,part:`avatar`,class:`avatar`})]),e(`div`,Ki,[e(`div`,qi,[a(y,{capability:`kling`,part:`name`}),e(`span`,Ji,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(g(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:u[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Yi)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Xi,[n.referenceImages.length>0||n.referenceVideos.length>0||n.referenceAudios.length>0?(g(),s(`div`,Zi,[(g(!0),s(c,null,h(n.referenceImages,(e,t)=>(g(),f(S,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceVideos,(e,t)=>(g(),f(C,{key:`video-${t}`,url:e.url,name:e.name},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceAudios,(e,t)=>(g(),f(w,{key:`audio-${t}`,url:e.url,name:e.name},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,Qi,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.isWaiting?(g(),s(`span`,ea,` - (`+i(n.$t(`kling.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,$i,` - (`+i(n.$t(`kling.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?.success===!0&&!n.isFailure?(g(),s(`div`,ta,[n.modelValue?.response.video_url?(g(),s(`div`,na,[a(T,{src:n.modelValue?.response.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response.success?(g(),s(`div`,ra,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:p(()=>[n.modelValue?.response.video_url?(g(),f(E,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:u[1]||=e=>n.onDownload(e,n.modelValue?.response.video_url)},{default:p(()=>[r(i(n.$t(`kling.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(D,{path:`/kling/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(M,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,ia,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.model`))+`: `+i(n.modelValue?.request?.model),1)]),e(`p`,aa,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,oa,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.isFailure?(g(),s(`div`,sa,[a(M,{closable:!1,class:`failure`},{template:p(()=>[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.failure`)),1)]),default:p(()=>[e(`p`,ca,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,la,[a(ee,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(A,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,ua,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,da,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(A,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),n.isWaiting?(g(),s(`div`,fa,[a(M,{closable:!1,class:`info`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`kling.status.processing`:`kling.status.pending`)),1)]),default:p(()=>[e(`p`,pa,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.response?.trace_id?(g(),s(`p`,ma,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(A,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var ga=v({name:`RecentPanel`,components:{TaskPreview:I(Ui,[[`render`,ha],[`__scopeId`,`data-v-6e8a9e6b`]]),NoTasks:ye,BotPlaceholder:Ce,ScrollList:ve},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?.()}}}),_a={key:0},va={key:2,class:`w-full h-full flex items-center justify-center`};function ya(e,t,n,r,i,u){let d=l(`bot-placeholder`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,_a,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`h-full w-full overflow-y-auto tasks`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,e=>(g(),f(m,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,va,[a(v)])):o(``,!0)],64)}var ba=v({name:`KlingIndex`,components:{ConfigPanel:fr,MotionPanel:di,TalkingPhotoPanel:Hi,TabSwitcher:gi,Layout:je,RecentPanel:I(ga,[[`render`,ya]])},mixins:[ue],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===me.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===me.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 be({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(!H(this.uploadTracker,e=>this.$t(e),e=>V.warning(e)))return;let{camera_control:e,...t}=this.config||{},n={...t,async:!0},r=Number(!!n.start_image_url)+Number(!!n.end_image_url),i=n.image_list?.length||0,a=n.video_list?.length?4:7;if(r+i>a){V.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:a}));return}if(n.video_list?.[0]?.refer_type===`base`&&(n.start_image_url||n.end_image_url||n.image_list?.some(({type:e})=>e))){V.warning(this.$t(`kling.message.baseVideoFrameConflict`));return}if(!n.video_id&&!t.video_url&&!n.start_image_url&&n.end_image_url){V.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))}:{}}),!G())return;let o=this.credential?.token;if(!o){console.error(`no token specified`);return}V.info(this.$t(`kling.message.startingTask`)),B(`kling`,R.generate(n,{token:o})).then(()=>{V.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?V.error(this.$t(`kling.message.usedUp`)):V.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(!H(this.uploadTracker,e=>this.$t(e),e=>V.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){V.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.model_name?{model_name:e.model_name}:{},...e.prompt?{prompt:e.prompt}:{},async:!0};if(!G())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}V.info(this.$t(`kling.message.startingTask`)),B(`kling`,R.motion(t,{token:n})).then(()=>{V.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?V.error(this.$t(`kling.message.usedUp`)):V.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},async onGenerateTalkingPhoto(){if(!H(this.uploadTracker,e=>this.$t(e),e=>V.warning(e)))return;let e=this.talkingPhotoConfig||{};if(!e.image_url||!e.audio_url){V.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(!G())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}V.info(this.$t(`kling.message.startingTask`)),B(`kling`,R.talkingPhoto(t,{token:n})).then(()=>{V.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?V.error(this.$t(`kling.message.usedUp`)):V.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),xa={class:`flex flex-col h-full`},Sa={class:`flex-1 min-h-0`};function Ca(t,n,r,i,s,c){let u=l(`tab-switcher`),d=l(`config-panel`),m=l(`motion-panel`),h=l(`talking-photo-panel`),_=l(`recent-panel`),v=l(`layout`);return g(),f(v,null,{config:p(()=>[e(`div`,xa,[a(u,{"model-value":t.taskType,"onUpdate:modelValue":t.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),e(`div`,Sa,[t.taskType===`videos`?(g(),f(d,{key:0,onGenerate:t.onGenerate},null,8,[`onGenerate`])):t.taskType===`motion`?(g(),f(m,{key:1,onGenerate:t.onGenerateMotion},null,8,[`onGenerate`])):t.taskType===`talking-photo`?(g(),f(h,{key:2,onGenerate:t.onGenerateTalkingPhoto},null,8,[`onGenerate`])):o(``,!0)])])]),result:p(()=>[a(_,{ref:`recentPanel`,loading:t.loadingMore,onReachTop:t.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var wa=I(ba,[[`render`,Ca]]);export{wa as default};