@acedatacloud/nexior 3.357.0 → 3.358.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 (452) hide show
  1. package/dist/assets/ApiCodeButton-CiNqmFYp.js +1 -0
  2. package/dist/assets/ApiCodeDialog-D5xtaIx6.css +1 -0
  3. package/dist/assets/ApiCodeDialog-z5vXc7Xi.js +282 -0
  4. package/dist/assets/{Artifacts-BEwz85G1.js → Artifacts-BgCwr5i5.js} +1 -1
  5. package/dist/assets/{AskUserQuestionCard-DszOz9O7.js → AskUserQuestionCard-c9PYBcSn.js} +1 -1
  6. package/dist/assets/{VideoPreview-CoUwodYx.css → AudioPreview-DJmmKcHK.css} +1 -1
  7. package/dist/assets/AudioPreview-uUWI_oVU.js +1 -0
  8. package/dist/assets/{Auth-4KSwo7U9.js → Auth-D7rXWt2c.js} +1 -1
  9. package/dist/assets/{Bare-LiVix71v.js → Bare-QIH-zKDl.js} +1 -1
  10. package/dist/assets/{BotPlaceholder-Bu9BbNUw.js → BotPlaceholder-CDv27X3P.js} +1 -1
  11. package/dist/assets/BottomFooter-CWWBSFTa.css +1 -0
  12. package/dist/assets/BottomFooter-CgjUhGFP.js +1 -0
  13. package/dist/assets/{BrowseConnectors-BNPBP42g.js → BrowseConnectors-1biG2Qgb.js} +1 -1
  14. package/dist/assets/{BrowserPairingDialog-CYZ_3lH5.js → BrowserPairingDialog-BIBE8_J9.js} +1 -1
  15. package/dist/assets/{Callback-oA5QMgjb.js → Callback-CgQSpuL1.js} +1 -1
  16. package/dist/assets/{CodeSnippet-Dt7rbpdx.js → CodeSnippet-CBWP_eZL.js} +1 -1
  17. package/dist/assets/{Console-dY3dWKr1.js → Console-XKqCKdZn.js} +1 -1
  18. package/dist/assets/{Consumption-B1H9Udpr.js → Consumption-Byk7yTVz.js} +1 -1
  19. package/dist/assets/{Conversation-DjuA6bV4.js → Conversation-D8Wm_Zri.js} +1 -1
  20. package/dist/assets/{Conversation-DJ5UhU4S.js → Conversation-dprhbIvD.js} +1 -1
  21. package/dist/assets/{CopyToClipboard-CrS-3Doq.js → CopyToClipboard-BMiCg7d2.js} +1 -1
  22. package/dist/assets/{Detail-DzWBjma1.css → Detail-BbDnDZ62.css} +1 -1
  23. package/dist/assets/Detail-BxuN8k_9.js +2 -0
  24. package/dist/assets/{Extra-B9IVw-0O.js → Extra-xrdEsbzz.js} +1 -1
  25. package/dist/assets/{FilePreview-Dqm4w0Zz.js → FilePreview-B2BrZCN4.js} +1 -1
  26. package/dist/assets/{Hailuo-DBe5Q4ZS.js → Hailuo-C2sgwciH.js} +1 -1
  27. package/dist/assets/{History-DnVVJzIr.js → History-DwzwIr-b.js} +1 -1
  28. package/dist/assets/{ImagePreview-Dx93HYYQ.js → ImagePreview-ESZQ89R1.js} +1 -1
  29. package/dist/assets/{ImageWrapper-BvF7E-9g.js → ImageWrapper-ByG7FJxY.js} +1 -1
  30. package/dist/assets/{Index-c6h5-cwk.js → Index-B3f-1Ux6.js} +1 -1
  31. package/dist/assets/Index-B8RYaLCH.js +1 -0
  32. package/dist/assets/Index-BMpUhZ9q.js +1 -0
  33. package/dist/assets/{Index-Bi11aQ4F2.js → Index-BSvC21Tn.js} +1 -1
  34. package/dist/assets/Index-B_Iz0WQh.js +1 -0
  35. package/dist/assets/{Index-Db0VUwx32.js → Index-Bpb4LsMP.js} +1 -1
  36. package/dist/assets/{Index-BZMb1YsP.js → Index-C6oXyNiR.js} +1 -1
  37. package/dist/assets/Index-CFip9nIj.css +1 -0
  38. package/dist/assets/Index-CP8kmAF9.js +1 -0
  39. package/dist/assets/Index-CQX-mX8l.js +1 -0
  40. package/dist/assets/Index-CRHRqEjI.js +1 -0
  41. package/dist/assets/{Index-COStC3a3.js → Index-CZTEOg82.js} +1 -1
  42. package/dist/assets/Index-C_69L5xX.js +1 -0
  43. package/dist/assets/{Index-pm4u6nZH.js → Index-CirWkDBR.js} +1 -1
  44. package/dist/assets/{Index-DSCQuNcd2.js → Index-CiwW7_xF.js} +1 -1
  45. package/dist/assets/{Index-Cb4WrYLI.js → Index-Cj5n4RJn2.js} +1 -1
  46. package/dist/assets/Index-CmbZFmpj.js +1 -0
  47. package/dist/assets/{Index-BpKi2l1M.js → Index-CvB6FNVL.js} +1 -1
  48. package/dist/assets/{Index-D1YCCMvB.js → Index-D2m8ATNJ.js} +2 -2
  49. package/dist/assets/Index-D3VSffBn.js +1 -0
  50. package/dist/assets/{Index-BsmkqifM.js → Index-D8Zqoj4n.js} +1 -1
  51. package/dist/assets/{Index-D7ckHLXP.js → Index-D8yq23DF.js} +1 -1
  52. package/dist/assets/Index-DG5VlJU5.js +1 -0
  53. package/dist/assets/{Index-B1JzWZxL.js → Index-DK143DDK.js} +1 -1
  54. package/dist/assets/Index-DOXpcGvC.js +1 -0
  55. package/dist/assets/{Index-DG2Sl0_0.js → Index-DSE4_905.js} +1 -1
  56. package/dist/assets/Index-DfULgGDk.js +1 -0
  57. package/dist/assets/{Index-BBEdzq_0.js → Index-Dh6I-L3l.js} +1 -1
  58. package/dist/assets/{Index-CKvzWqDc.js → Index-DpsQqW9b.js} +1 -1
  59. package/dist/assets/{Index-CQbOysRZ.js → Index-DrFIjAC4.js} +1 -1
  60. package/dist/assets/Index-DtxAmXcP.js +1 -0
  61. package/dist/assets/Index-DzfWc7R3.js +1 -0
  62. package/dist/assets/{Index-CCYVCct8.js → Index-YcZrDvKK.js} +1 -1
  63. package/dist/assets/{Index-DS_wLYVw.js → Index-alCHtqWd.js} +1 -1
  64. package/dist/assets/{Index-DZKSbHxm.js → Index-iHUpduNy.js} +1 -1
  65. package/dist/assets/Index-vI1pmCgu.js +1 -0
  66. package/dist/assets/{Invitees-CDhJx8UL.js → Invitees-DV3QywcL.js} +1 -1
  67. package/dist/assets/List-BARsKpTh.js +1 -0
  68. package/dist/assets/List-BW8OTe4G.js +1 -0
  69. package/dist/assets/List-DuRVdIUe.js +1 -0
  70. package/dist/assets/{LocalTools-CSUGxxHq.js → LocalTools-B5ToSxwe.js} +1 -1
  71. package/dist/assets/{LocalTools-CHKfOgco.js → LocalTools-BhSf8_Y4.js} +3 -3
  72. package/dist/assets/{Logo-Bhc7s5iP.js → Logo-BCsapzVO.js} +1 -1
  73. package/dist/assets/Main-Cy6-Ifg-.js +1 -0
  74. package/dist/assets/Main-DWK8rjPk.css +1 -0
  75. package/dist/assets/{Message--rJ5FRr0.js → Message-DlnFjCzr.js} +2 -2
  76. package/dist/assets/Model-Dt3P_UQQ.js +1 -0
  77. package/dist/assets/{Navigator-QERhEabp.js → Navigator-E7FCgVs1.js} +4 -4
  78. package/dist/assets/{NotFound-BTGjEVoq.js → NotFound-BopsMgLM.js} +1 -1
  79. package/dist/assets/{PageHeader-CRMBEU2F.js → PageHeader-Cd9mBW43.js} +1 -1
  80. package/dist/assets/{Pay-uyUwNQb3.js → Pay-0x3gmRoq.js} +1 -1
  81. package/dist/assets/{Player-BkhmrMhz.js → Player-DQNg6dOq.js} +1 -1
  82. package/dist/assets/{Poivelle-B3995q76.js → Poivelle-0k_mctcv.js} +1 -1
  83. package/dist/assets/{RealtimeCall-oro05Ct1.js → RealtimeCall-BgkQdni0.js} +1 -1
  84. package/dist/assets/{ReportButton-0FaWenrZ.js → ReportButton-CuTsbpH1.js} +1 -1
  85. package/dist/assets/{ReportDialog-CMbgvq9G.js → ReportDialog-dN-kkVrJ.js} +1 -1
  86. package/dist/assets/ScheduledTasks-CvrES_A8.css +1 -0
  87. package/dist/assets/ScheduledTasks-D-qGHm0o.js +2 -0
  88. package/dist/assets/SolanaWalletPickerDialog-CS7bSwXe.js +1 -0
  89. package/dist/assets/SolanaWalletPickerDialog-t81xwej4.css +1 -0
  90. package/dist/assets/Status-AZzfal7k.js +1 -0
  91. package/dist/assets/{Status-8gHhjAIu.css → Status-BDIpm7RB.css} +1 -1
  92. package/dist/assets/{Subscribe-DPDON8PP.js → Subscribe-zhWEFj1j.js} +1 -1
  93. package/dist/assets/{TabSwitcher-4H7n1Tlw.js → TabSwitcher-C4UtlgZ0.js} +1 -1
  94. package/dist/assets/Tts-CqGAcIoB.js +1 -0
  95. package/dist/assets/{VideoPlayer-BuqN0Gx_.js → VideoPlayer-B9ZoxGwN.js} +1 -1
  96. package/dist/assets/VideoPreview-D0f8om32.js +1 -0
  97. package/dist/assets/VideoPreview-DBUdhybU.css +1 -0
  98. package/dist/assets/arrow-down-CnzBxJOK.js +1 -0
  99. package/dist/assets/{arrow-down-wide-narrow-CbCKh4QV.js → arrow-down-wide-narrow-D9hT9P8T.js} +1 -1
  100. package/dist/assets/arrow-left-igb8AMz_.js +1 -0
  101. package/dist/assets/arrow-right-CGXNgdDZ.js +1 -0
  102. package/dist/assets/arrow-up-Drhcfl9s.js +1 -0
  103. package/dist/assets/{authorizeFlow-T33pIG_A.js → authorizeFlow-DjzUZZcO.js} +1 -1
  104. package/dist/assets/{avatar-Ch_b5GkH.js → avatar-DIY5kVwM.js} +1 -1
  105. package/dist/assets/{basic-BcJIU0kn.js → basic-C9st9xfO.js} +1 -1
  106. package/dist/assets/{book-open-CxPet1iD.js → book-open-89ot7rat.js} +1 -1
  107. package/dist/assets/{box-D01T0Rfx.js → box-C1K_05R1.js} +1 -1
  108. package/dist/assets/{boxes-Br6u6h7W.js → boxes-CVfQGj6z.js} +1 -1
  109. package/dist/assets/{brain-7SbdzKi-.js → brain-DFSeKAZC.js} +1 -1
  110. package/dist/assets/buffer-CnhyIITQ.js +1 -0
  111. package/dist/assets/{chart-no-axes-combined-a76jXeKY.js → chart-no-axes-combined-k3QiYa3s.js} +1 -1
  112. package/dist/assets/{chat-tVMgy5Vp.js → chat-BY9DKfAi.js} +1 -1
  113. package/dist/assets/{chat-BCesDtJ3.js → chat-BbW_31UJ.js} +1 -1
  114. package/dist/assets/{chat-X8Cat-XB.js → chat-C-7WVcbW.js} +1 -1
  115. package/dist/assets/{chat-D1g6XsR2.js → chat-C1uZputZ.js} +1 -1
  116. package/dist/assets/{chat-D8fIUUHI.js → chat-CA0MD_st.js} +1 -1
  117. package/dist/assets/{chat-IIVf-p05.js → chat-CFPaNnVM.js} +1 -1
  118. package/dist/assets/chat-CK9a-_Ni.js +1 -0
  119. package/dist/assets/{chat-Qs-jqcie.js → chat-CPepUbBA.js} +1 -1
  120. package/dist/assets/{chat-BBM7q6iO.js → chat-CPyDS1s8.js} +1 -1
  121. package/dist/assets/{chat-DCJKYRGJ.js → chat-CmjlhXy_.js} +1 -1
  122. package/dist/assets/{chat-3ZBsk2R8.js → chat-CwJDPmon.js} +1 -1
  123. package/dist/assets/{chat-a-osbcqP.js → chat-D0orhGlF.js} +1 -1
  124. package/dist/assets/{chat-CMr-RhTA.js → chat-DCsVMCF2.js} +1 -1
  125. package/dist/assets/{chat--hdiwTE1.js → chat-DPYlE44u.js} +1 -1
  126. package/dist/assets/{chat-ob9mF2EV.js → chat-DpRbp8uT.js} +1 -1
  127. package/dist/assets/{chat-N7Bh40up.js → chat-DsACa9Pk.js} +1 -1
  128. package/dist/assets/{chat-HPZrpkXN.js → chat-duM8vKdA.js} +1 -1
  129. package/dist/assets/{chat-CJ_Wx6Pf.js → chat-tfvZdHmk.js} +1 -1
  130. package/dist/assets/{chat-BJ3bwj1q.js → chat-yJqk9kt9.js} +1 -1
  131. package/dist/assets/check-sZ3LdzYe.js +1 -0
  132. package/dist/assets/chevron-down-B9A1h-il.js +1 -0
  133. package/dist/assets/chevron-right-CSsOai_n.js +1 -0
  134. package/dist/assets/circle-check-Cm0vi3QJ.js +1 -0
  135. package/dist/assets/{circle-question-mark-BYI0Fw8i.js → circle-question-mark-C5ETt-Gy.js} +1 -1
  136. package/dist/assets/{clipboard-list-q6zyt251.js → clipboard-list-BaOyMkLK.js} +1 -1
  137. package/dist/assets/clock-BRjX06BR.js +1 -0
  138. package/dist/assets/code-4fXy3EJM.js +1 -0
  139. package/dist/assets/{codingBridge-D94yLp8q.js → codingBridge-ZH5aQjeX.js} +2 -2
  140. package/dist/assets/codingBridgeNotify-Djdt8v1B.js +2 -0
  141. package/dist/assets/{coins-FZL59XN_.js → coins-o7-8OSvE.js} +1 -1
  142. package/dist/assets/{collapse-DJqll19W.js → collapse-B7B33h1p.js} +1 -1
  143. package/dist/assets/common-B0AwyZ0R.js +1 -0
  144. package/dist/assets/common-BhFY4Nfj.js +1 -0
  145. package/dist/assets/common-BxghAawV.js +1 -0
  146. package/dist/assets/common-C91IcTAP.js +1 -0
  147. package/dist/assets/common-CFA9D-B8.js +1 -0
  148. package/dist/assets/common-CGyig8uz.js +1 -0
  149. package/dist/assets/common-CIIPW1V6.js +1 -0
  150. package/dist/assets/common-CS44-vkN.js +1 -0
  151. package/dist/assets/common-Ci6lFKFu.js +1 -0
  152. package/dist/assets/common-D10tIq4t.js +1 -0
  153. package/dist/assets/common-DCZ9WgJa.js +1 -0
  154. package/dist/assets/common-DHIqv_E2.js +1 -0
  155. package/dist/assets/common-D_IBIEcB.js +1 -0
  156. package/dist/assets/common-DnhdQFuG.js +1 -0
  157. package/dist/assets/common-DvJgI5Kb.js +1 -0
  158. package/dist/assets/common-NE7dgihi.js +1 -0
  159. package/dist/assets/common-Xc5jgBlX.js +1 -0
  160. package/dist/assets/common-h-S2acsx.js +1 -0
  161. package/dist/assets/connector-gXUM4d-8.js +1 -0
  162. package/dist/assets/constants-CX4j41GC.js +1 -0
  163. package/dist/assets/{copy-DRq4dd9Q.js → copy-CS92scYJ.js} +1 -1
  164. package/dist/assets/{createTaskActions-CONOE9Ox.js → createTaskActions-DLdbSeB0.js} +1 -1
  165. package/dist/assets/debounce-5xtusvLq.js +1 -0
  166. package/dist/assets/{digitalhuman-C5_9rekl.js → digitalhuman-CRLcje7j.js} +1 -1
  167. package/dist/assets/{dollar-sign-DWx_G9MH.js → dollar-sign-Dp4uO1oi.js} +1 -1
  168. package/dist/assets/{download-CJKM7jCz.js → download-BdbUJy-0.js} +1 -1
  169. package/dist/assets/{drawer-CKZxuyy2.js → drawer-BWJ3_fqW.js} +1 -1
  170. package/dist/assets/{dropdown-DpNMkxRO.js → dropdown--LXlsWOR.js} +1 -1
  171. package/dist/assets/{dropdown-D1pMxYwA.js → dropdown-gJTX6f0h.js} +1 -1
  172. package/dist/assets/{ellipsis-CILfOizt.js → ellipsis-CGG2t4rN.js} +1 -1
  173. package/dist/assets/{esm-2PB4gbIJ.js → esm-BbAKv0FA.js} +1 -1
  174. package/dist/assets/{esm-BohU7l72.js → esm-BdQ3IlZD.js} +1 -1
  175. package/dist/assets/esm-COArLl5w.js +2 -0
  176. package/dist/assets/{esm-CA8Uyl0O.js → esm-ClxEw27d.js} +1 -1
  177. package/dist/assets/esm-D0SEwzQg.js +1 -0
  178. package/dist/assets/{esm-BtJ2xZct.js → esm-DJYfkLDv.js} +3 -3
  179. package/dist/assets/{esm-BADAICpD.js → esm-xK2aBMtJ.js} +2 -2
  180. package/dist/assets/{external-link-sLbl4U1-.js → external-link-B_1us9v2.js} +1 -1
  181. package/dist/assets/{eye-DmwkAD9t.js → eye-B7qn04JQ.js} +1 -1
  182. package/dist/assets/{file-FeLyPUia.js → file-BexmqRy7.js} +1 -1
  183. package/dist/assets/{file-output-kTMJELKZ.js → file-output-BJhPINIu.js} +1 -1
  184. package/dist/assets/{file-text-cKaWTcoM.js → file-text-CJaP1sSt.js} +1 -1
  185. package/dist/assets/fish-BJ8_esph.js +1 -0
  186. package/dist/assets/{flux-Du4-4xdo.js → flux-St5avyWB.js} +1 -1
  187. package/dist/assets/{folder-CapB5Yye.js → folder-CVwMb5LW.js} +1 -1
  188. package/dist/assets/gauge-DZ-l2vCx.js +1 -0
  189. package/dist/assets/{globe-3aOK7J1b.js → globe-BUY6KxOP.js} +1 -1
  190. package/dist/assets/{omni-CIzaCByJ.js → grokvideo-BzBXIfSN.js} +1 -1
  191. package/dist/assets/hailuo-Ehj7U293.js +1 -0
  192. package/dist/assets/{headphones-BV6kUfof.js → headphones-DP3Pmamv.js} +1 -1
  193. package/dist/assets/{history-D-fKzBv8.js → history-Drg92s0e.js} +1 -1
  194. package/dist/assets/{house-Cm0ctS2v.js → house-B1TwBkue.js} +1 -1
  195. package/dist/assets/i18n-thhk7vzg.js +3 -0
  196. package/dist/assets/{image-9QrJZd7m.js → image-DLh3kiN0.js} +1 -1
  197. package/dist/assets/imageRequests-BMlSTRGz.js +1 -0
  198. package/dist/assets/imageRequests-DGx3ElFQ.css +1 -0
  199. package/dist/assets/index-DKnFv8oI.js +570 -0
  200. package/dist/assets/{index-Bme61TZ_.css → index-DW-VIENs.css} +1 -1
  201. package/dist/assets/index.browser.esm-D1e4_8C8.js +2 -0
  202. package/dist/assets/{index.es-B4bDjPfm.js → index.es-lCrLu01L.js} +1 -1
  203. package/dist/assets/{info-BbgRo3R9.js → info-JrDUNc3f.js} +1 -1
  204. package/dist/assets/{input-number-OCoLwwKA.js → input-number-C61XfqeG.js} +1 -1
  205. package/dist/assets/{intro-2CIeLa4V.js → intro-BRxhwzgc.js} +1 -1
  206. package/dist/assets/{intro-CVqOAs0d.js → intro-B_1rEL4k.js} +1 -1
  207. package/dist/assets/{intro-D26BGrp9.js → intro-BcRXuT1K.js} +1 -1
  208. package/dist/assets/{intro-CumGy2RC.js → intro-Bg7QV5Rq.js} +1 -1
  209. package/dist/assets/{intro-DFfBLUfo.js → intro-CAF9HiWf.js} +1 -1
  210. package/dist/assets/{intro-CX-tVM1n.js → intro-CBekcUNN.js} +1 -1
  211. package/dist/assets/{intro-Dq8aF71M.js → intro-CGuk1jLl.js} +1 -1
  212. package/dist/assets/{intro-msK-p0lY.js → intro-COm5xqdX.js} +1 -1
  213. package/dist/assets/{intro-Z5WuhH2a.js → intro-CVWe7Kot.js} +1 -1
  214. package/dist/assets/{intro-BQHGX5HW.js → intro-CZrEGpvV.js} +1 -1
  215. package/dist/assets/{intro-HirJwSQO.js → intro-D8jlxqfD.js} +1 -1
  216. package/dist/assets/{intro-bo9fZbK4.js → intro-DdpC81qG.js} +1 -1
  217. package/dist/assets/{intro-D7SWXPm3.js → intro-Dty7Xa3w.js} +1 -1
  218. package/dist/assets/{intro-BTSbJEHO.js → intro-DxIDK4-7.js} +1 -1
  219. package/dist/assets/{intro-zxCwJqFb.js → intro-PFBIw-8e.js} +1 -1
  220. package/dist/assets/{intro-JkrATbbK.js → intro-RnQVpcEg.js} +1 -1
  221. package/dist/assets/{intro-BuaD45ZB.js → intro-SyZF6diN.js} +1 -1
  222. package/dist/assets/intro-xnV3M4NM.js +1 -0
  223. package/dist/assets/{key-round-AltJ_oGX.js → key-round-DXFWRMd5.js} +1 -1
  224. package/dist/assets/{kling-CmEWSSqE.js → kling-DoGXHJTZ.js} +1 -1
  225. package/dist/assets/{languages-BVZdKT0O.js → languages-Cgvplr1A.js} +1 -1
  226. package/dist/assets/{laptop-vuRLXAz4.js → laptop-I-UIq9Vj.js} +1 -1
  227. package/dist/assets/{lightbulb-BaRcDNdi.js → lightbulb-DQPhT5Fv.js} +1 -1
  228. package/dist/assets/{link-7MNWAqYH.js → link-DqeldxUU.js} +1 -1
  229. package/dist/assets/loader-circle-BOu6l4ZA.js +1 -0
  230. package/dist/assets/{lock-FlTMsW3N.js → lock-Cyg1wnc-.js} +1 -1
  231. package/dist/assets/{luma-C_X9uHsP.js → luma-gSaEzmni.js} +1 -1
  232. package/dist/assets/{maestro-DAyqXxl3.js → maestro-DpyfDSpq.js} +1 -1
  233. package/dist/assets/{maestro-B6dkh2k5.js → maestro-EccNg3GS.js} +1 -1
  234. package/dist/assets/{mail-CxH_j43J.js → mail-qBSkwZDU.js} +1 -1
  235. package/dist/assets/{message-circle--668KoV2.js → message-circle-BQZnKfis.js} +1 -1
  236. package/dist/assets/{mic-9FMbLwpP.js → mic-DcJCGd7v.js} +1 -1
  237. package/dist/assets/{midjourney-_sZ4XK7W.js → midjourney-CT0W-uYP.js} +1 -1
  238. package/dist/assets/minimax-6eNHY7wD.js +1 -0
  239. package/dist/assets/minimax-BXYNPt9a.js +1 -0
  240. package/dist/assets/minimax-Br7fn1f4.js +1 -0
  241. package/dist/assets/minimax-Bwj6f8AH.js +1 -0
  242. package/dist/assets/minimax-CAsYD5hY.js +1 -0
  243. package/dist/assets/minimax-CO0p_Bsi.js +1 -0
  244. package/dist/assets/minimax-Cfgk-7-d.js +1 -0
  245. package/dist/assets/minimax-D4ChR8N8.js +1 -0
  246. package/dist/assets/minimax-DPq7G_Om.js +1 -0
  247. package/dist/assets/minimax-DYwUq6OA.js +1 -0
  248. package/dist/assets/minimax-D_MqaBJe.js +1 -0
  249. package/dist/assets/minimax-Dgzja64h.js +1 -0
  250. package/dist/assets/minimax-DjOXj0u0.js +1 -0
  251. package/dist/assets/minimax-DzbpBiCf.js +1 -0
  252. package/dist/assets/{hailuo-CoiyFOk9.js → minimax-Pf3RXf5W.js} +1 -1
  253. package/dist/assets/minimax-UjKnoa_7.js +1 -0
  254. package/dist/assets/minimax-VLuwz_4L.js +1 -0
  255. package/dist/assets/minimax-kEKp0gQL.js +1 -0
  256. package/dist/assets/minimax-tk9lT-9L.js +1 -0
  257. package/dist/assets/{mobileLocalExec-CsJ1DlhZ.js → mobileLocalExec-ChALdNhl.js} +2 -2
  258. package/dist/assets/{models-p9iPUELt.js → models-D6J60Ang.js} +1 -1
  259. package/dist/assets/{monitor-DjWc24pt.js → monitor-C6EmGPtA.js} +1 -1
  260. package/dist/assets/{mouse-pointer-2-BaLCE3k6.js → mouse-pointer-2-BJ6u3j3g.js} +1 -1
  261. package/dist/assets/music-2-CuTbesAz.js +1 -0
  262. package/dist/assets/{nanobanana-CYMVtjQJ.js → nanobanana-DHdmNSY7.js} +1 -1
  263. package/dist/assets/{grokvideo-Cm8lZFLk.js → omni-DNB82gzr.js} +1 -1
  264. package/dist/assets/{openaiimage-d2R5G4CF.js → openaiimage-67EecuUS.js} +1 -1
  265. package/dist/assets/pagination-4fpGtxqE.css +1 -0
  266. package/dist/assets/{pagination-jkoF9i4Q.js → pagination-Bh_-G5Ma.js} +1 -1
  267. package/dist/assets/{pagination-Opqw9ZQt.js → pagination-D0KEjXO1.js} +1 -1
  268. package/dist/assets/pagination-D8oUwQ9k.js +1 -0
  269. package/dist/assets/{palette-DGfxXhb2.js → palette-BP1_UTBm.js} +1 -1
  270. package/dist/assets/{paperclip-DwOOMtLD.js → paperclip-bLPkbpvE.js} +1 -1
  271. package/dist/assets/{pause-CyDvWTEs.js → pause-DThYSFfn.js} +1 -1
  272. package/dist/assets/{pencil-dd20SUzj.js → pencil-U1H8ouvD.js} +1 -1
  273. package/dist/assets/{pika-C9Nl_EgS.js → pika-CWpxgVbz.js} +1 -1
  274. package/dist/assets/{pixverse-C66Q_ClW.js → pixverse-DzV6JmiT.js} +1 -1
  275. package/dist/assets/play-DUVZyA7n.js +1 -0
  276. package/dist/assets/{plug-DF1Drmqf.js → plug-qlX-ubkq.js} +1 -1
  277. package/dist/assets/plus-Coq-6ZBW.js +1 -0
  278. package/dist/assets/{poivelle-CPAzbABG.js → poivelle-BpE_pkIX.js} +1 -1
  279. package/dist/assets/{popover-DLr7y_Uh.js → popover-Bf9u8EI7.js} +1 -1
  280. package/dist/assets/{producer-C80raq6U.js → producer-B0atTy_p.js} +1 -1
  281. package/dist/assets/{qrart-Du4H365U.js → qrart-qKp7QNwE.js} +1 -1
  282. package/dist/assets/{realtime-A1shWHou.js → realtime-C9h-cRy7.js} +1 -1
  283. package/dist/assets/{refresh-cw-DkA2Ry2h.js → refresh-cw-DKpjew0c.js} +1 -1
  284. package/dist/assets/rotate-ccw-mdSBnuP9.js +1 -0
  285. package/dist/assets/rotate-cw-C-F1OyBK.js +1 -0
  286. package/dist/assets/{row-VbE9AC9S.js → row-CSMwp8He.js} +1 -1
  287. package/dist/assets/scenarioPayment-BQxaybOL.js +1 -0
  288. package/dist/assets/search-C73sRSFS.js +1 -0
  289. package/dist/assets/{seedance-C46ZkvoT.js → seedance-CgiMOVoI.js} +1 -1
  290. package/dist/assets/{seedream-gSv2k-4j.js → seedream-CCN_-T37.js} +1 -1
  291. package/dist/assets/select-BPmmsYsL.js +1 -0
  292. package/dist/assets/{serp-DVpfEC9H.js → serp-75AFhZeM.js} +1 -1
  293. package/dist/assets/{shield-CQ9k7RbX.js → shield-DYsoSjvj.js} +1 -1
  294. package/dist/assets/{shuffle-DdEsELXO.js → shuffle-C2cXZMq5.js} +1 -1
  295. package/dist/assets/site-AhbD1cAy.js +1 -0
  296. package/dist/assets/site-ApsDzXmT.js +1 -0
  297. package/dist/assets/site-B5aK2u48.js +1 -0
  298. package/dist/assets/{site-DHk_XgpA.js → site-BSs5bzZR.js} +1 -1
  299. package/dist/assets/site-Bp09pxfx.js +1 -0
  300. package/dist/assets/site-CAj6esyl.js +1 -0
  301. package/dist/assets/site-CFOpzeB9.js +1 -0
  302. package/dist/assets/site-CgKjNFLm.js +1 -0
  303. package/dist/assets/site-CpvOXr5j.js +1 -0
  304. package/dist/assets/site-Cz55lBe5.js +1 -0
  305. package/dist/assets/site-D0_3FJ19.js +1 -0
  306. package/dist/assets/site-DSnZF7EC.js +1 -0
  307. package/dist/assets/site-DUtm0lCL.js +1 -0
  308. package/dist/assets/site-Dyw5SF13.js +1 -0
  309. package/dist/assets/site-HEpGPpP9.js +1 -0
  310. package/dist/assets/site-KpCMucOQ.js +1 -0
  311. package/dist/assets/site-awqEUONZ.js +1 -0
  312. package/dist/assets/site-wXX_sllY.js +1 -0
  313. package/dist/assets/{slider-C4r6NKNm.js → slider-BkpC12ud.js} +1 -1
  314. package/dist/assets/solana-BXAF_MAk.js +2 -0
  315. package/dist/assets/solana-wallets-DX1uEpyK.js +2 -0
  316. package/dist/assets/{solana-wallets-vue-DAQ5o4O_.js → solana-wallets-vue-BnsXwDtg.js} +1 -1
  317. package/dist/assets/{sora-C8XocUnV.js → sora-BkHyNKjN.js} +1 -1
  318. package/dist/assets/{sparkles-CbcZMIfo.js → sparkles-BwWvghRX.js} +1 -1
  319. package/dist/assets/square-B1xtLDOg.js +1 -0
  320. package/dist/assets/{store-mGO3sGR3.js → store-p6xQ2bAP.js} +1 -1
  321. package/dist/assets/{suno-Doqed2Wn.js → suno-CFFLk4vG.js} +1 -1
  322. package/dist/assets/{switch-DQqqW0wa.js → switch-B42bu5O7.js} +1 -1
  323. package/dist/assets/table-BD6Hv1lx.js +1 -0
  324. package/dist/assets/{tabs-Di1oS89l.js → tabs-MtKgGPfn.js} +1 -1
  325. package/dist/assets/{tag-BE2K9Ewm.js → tag-q7oTj4uz.js} +1 -1
  326. package/dist/assets/terminal-bgNmS1ov.js +1 -0
  327. package/dist/assets/time-picker-BcOKI3mu.js +1 -0
  328. package/dist/assets/{tooltip-BPdAozKj.js → tooltip-DKF_sGto.js} +1 -1
  329. package/dist/assets/{trash-2-DW1SgSXi.js → trash-2-Cf1lYl_N.js} +1 -1
  330. package/dist/assets/{triangle-alert-DsomYnuJ.js → triangle-alert-_LVPy92s.js} +1 -1
  331. package/dist/assets/{upload-Bh12CGQx.js → upload-C1h3h1KN.js} +1 -1
  332. package/dist/assets/{upload-B8IAn10v.js → upload-CTvrSmVZ.js} +1 -1
  333. package/dist/assets/user-F688Rsm5.js +1 -0
  334. package/dist/assets/{veo-C86UrRN2.js → veo-sG-RXLUg.js} +1 -1
  335. package/dist/assets/{video-Ck_qgs54.js → video-BaKcHmj6.js} +1 -1
  336. package/dist/assets/{volume-2-BRbvvNs-.js → volume-2-CY9fv2mC.js} +1 -1
  337. package/dist/assets/{wallet-tq2jwvVE.js → wallet-3BCb_2vC.js} +1 -1
  338. package/dist/assets/{wan-CXCg5qaC.js → wan-DKcIIxSa.js} +1 -1
  339. package/dist/assets/{wand-sparkles-C3ALfy6z.js → wand-sparkles-DNHHWq-f.js} +1 -1
  340. package/dist/assets/{web-Bscx0aaK.js → web-BLn3-jMx.js} +1 -1
  341. package/dist/assets/{web-j2yPIGe7.js → web-CFOndwVN.js} +1 -1
  342. package/dist/assets/{web-mnX9fKey.js → web-CFTtGOqY.js} +1 -1
  343. package/dist/assets/web-DK27GiIu.js +1 -0
  344. package/dist/assets/{web-B1aVByrm.js → web-oUobTiGG.js} +1 -1
  345. package/dist/assets/{webextrator-CKOLzgYV.js → webextrator-C8hHzuf5.js} +1 -1
  346. package/dist/assets/{zap-CZjQNphx.js → zap-BQE62bDm.js} +1 -1
  347. package/dist/index.html +8 -7
  348. package/dist/llms.txt +1 -0
  349. package/package.json +3 -1
  350. package/dist/assets/ApiCodeButton-CRlp6GD-.js +0 -1
  351. package/dist/assets/BottomFooter-C0SdkqUC.css +0 -1
  352. package/dist/assets/BottomFooter-DkrgDnSg.js +0 -1
  353. package/dist/assets/Detail-BidG7sXY.js +0 -2
  354. package/dist/assets/Index-BPapRrP0.js +0 -1
  355. package/dist/assets/Index-B_F1a1zs2.js +0 -1
  356. package/dist/assets/Index-BtNX8PST.js +0 -1
  357. package/dist/assets/Index-CETf2VGo.js +0 -1
  358. package/dist/assets/Index-D3Ns4o6p.js +0 -1
  359. package/dist/assets/Index-D5cgyNi3.js +0 -1
  360. package/dist/assets/Index-DSKqWu0B.js +0 -1
  361. package/dist/assets/Index-DcuFghgf.js +0 -1
  362. package/dist/assets/Index-DxuT9E1c.js +0 -1
  363. package/dist/assets/Index-MIdGVr_9.js +0 -1
  364. package/dist/assets/Index-TzhxEvXJ.js +0 -1
  365. package/dist/assets/Index-a2z0Y2iK.js +0 -1
  366. package/dist/assets/Index-aMaloB8u.js +0 -1
  367. package/dist/assets/Index-czhLphPj2.js +0 -1
  368. package/dist/assets/List-B_2l-zWb.js +0 -1
  369. package/dist/assets/List-CLjZLy4L.js +0 -1
  370. package/dist/assets/List-rmkbUytg.js +0 -1
  371. package/dist/assets/Main-2YjTjyp5.js +0 -1
  372. package/dist/assets/Main-BALdIhZB.css +0 -1
  373. package/dist/assets/Model-C5bRMXQz.js +0 -1
  374. package/dist/assets/ScheduledTasks-B1OjmRtz.js +0 -2
  375. package/dist/assets/ScheduledTasks-BvzXEojt.css +0 -1
  376. package/dist/assets/Status-Bfnjonis.js +0 -1
  377. package/dist/assets/Tts-BtaWoKMF.js +0 -1
  378. package/dist/assets/VideoPreview-Byn0YMDk.js +0 -1
  379. package/dist/assets/arrow-down-BQCQC8nV.js +0 -1
  380. package/dist/assets/arrow-left-BbbM5t3V.js +0 -1
  381. package/dist/assets/arrow-right-CushVcKS.js +0 -1
  382. package/dist/assets/arrow-up-KQxjqQmQ.js +0 -1
  383. package/dist/assets/chat-ZabZ8MFE.js +0 -1
  384. package/dist/assets/check-C3_2-V6X.js +0 -1
  385. package/dist/assets/chevron-down-CHoFb-pv.js +0 -1
  386. package/dist/assets/chevron-right-tp5-Jg7b.js +0 -1
  387. package/dist/assets/circle-check-yNp9lEPH.js +0 -1
  388. package/dist/assets/clock-DZS73nzp.js +0 -1
  389. package/dist/assets/code-R3uyMdPG.js +0 -1
  390. package/dist/assets/codingBridgeNotify-B4HxVU3L.js +0 -2
  391. package/dist/assets/common-0xkfUWM4.js +0 -1
  392. package/dist/assets/common-3KCHcrTl.js +0 -1
  393. package/dist/assets/common-B9H_zz9e.js +0 -1
  394. package/dist/assets/common-BpcRKD49.js +0 -1
  395. package/dist/assets/common-BqGcbDl7.js +0 -1
  396. package/dist/assets/common-BxIeKYny.js +0 -1
  397. package/dist/assets/common-CGbweoim.js +0 -1
  398. package/dist/assets/common-CLqGazEF.js +0 -1
  399. package/dist/assets/common-Ct-EpYwz.js +0 -1
  400. package/dist/assets/common-CvTXmvLn.js +0 -1
  401. package/dist/assets/common-Cwu1Gn5P.js +0 -1
  402. package/dist/assets/common-DegDnkpe.js +0 -1
  403. package/dist/assets/common-DoAmMmay.js +0 -1
  404. package/dist/assets/common-GzY-Z64w.js +0 -1
  405. package/dist/assets/common-WNyCiTYq.js +0 -1
  406. package/dist/assets/common-fZ1LBM7O.js +0 -1
  407. package/dist/assets/common-ueJlzLRe.js +0 -1
  408. package/dist/assets/common-zE-rMniU.js +0 -1
  409. package/dist/assets/connector-tdn_tiGZ.js +0 -1
  410. package/dist/assets/constants-nRb-ZD8Y.js +0 -1
  411. package/dist/assets/esm-D640cN7p.js +0 -1
  412. package/dist/assets/esm-DCnhbcXq.js +0 -2
  413. package/dist/assets/fish-DrIDKV1G.js +0 -1
  414. package/dist/assets/gauge-BpfNtyBm.js +0 -1
  415. package/dist/assets/i18n-D5TLPQOi.js +0 -3
  416. package/dist/assets/index-Ckt9JRr7.js +0 -570
  417. package/dist/assets/index.browser.esm-DDMjyGsz.js +0 -2
  418. package/dist/assets/intro-Y10dLinG.js +0 -1
  419. package/dist/assets/loader-circle-BVPxZbHr.js +0 -1
  420. package/dist/assets/music-2-CtD5-QLb.js +0 -1
  421. package/dist/assets/pagination-BL2RhP-o.js +0 -282
  422. package/dist/assets/pagination-CRTv_yDs.css +0 -1
  423. package/dist/assets/play-DX2GAS2m.js +0 -1
  424. package/dist/assets/plus-cKUQQazx.js +0 -1
  425. package/dist/assets/rotate-ccw-MV5cIaG4.js +0 -1
  426. package/dist/assets/rotate-cw-b0KArUXq.js +0 -1
  427. package/dist/assets/search-CJ78r1po.js +0 -1
  428. package/dist/assets/select-C90FIlgu.js +0 -1
  429. package/dist/assets/site-6Ci_fg9y.js +0 -1
  430. package/dist/assets/site-B5RTMBqu.js +0 -1
  431. package/dist/assets/site-BMDSkjob.js +0 -1
  432. package/dist/assets/site-BiVr0_ek.js +0 -1
  433. package/dist/assets/site-BwLFMUFh.js +0 -1
  434. package/dist/assets/site-C-KQgU-K.js +0 -1
  435. package/dist/assets/site-Ci9B-nmV.js +0 -1
  436. package/dist/assets/site-CzIcrHMT.js +0 -1
  437. package/dist/assets/site-D-WFYnzU.js +0 -1
  438. package/dist/assets/site-D0DPN8zr.js +0 -1
  439. package/dist/assets/site-D0LRUG99.js +0 -1
  440. package/dist/assets/site-DHABVFTD.js +0 -1
  441. package/dist/assets/site-DZFl5W1X.js +0 -1
  442. package/dist/assets/site-DoqeUy8k.js +0 -1
  443. package/dist/assets/site-Dz45PCvb.js +0 -1
  444. package/dist/assets/site-m5Aai-D9.js +0 -1
  445. package/dist/assets/site-psVaJ5kf.js +0 -1
  446. package/dist/assets/solana-wallets-CYHIHIkN.js +0 -2
  447. package/dist/assets/square-uwdrImGE.js +0 -1
  448. package/dist/assets/table-Cl_Yjqcx.js +0 -1
  449. package/dist/assets/terminal-D0Ga62Jo.js +0 -1
  450. package/dist/assets/time-picker-PqTvJMDy.js +0 -1
  451. package/dist/assets/user-DmlcZfLh.js +0 -1
  452. package/dist/assets/web-DM7m2lDa.js +0 -1
@@ -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-BPmmsYsL.js";import{n as x,t as S}from"./tabs-MtKgGPfn.js";import{t as C}from"./upload-C1h3h1KN.js";import{t as w}from"./tooltip-DKF_sGto.js";import{t as T}from"./alert-BprQRUmf.js";import{h as E,v as D}from"./models-D6J60Ang.js";import{n as O,r as k}from"./radio-BNhFzeBO.js";import{t as A}from"./drawer-BWJ3_fqW.js";import{t as j}from"./input-number-C61XfqeG.js";import{t as M}from"./slider-BkpC12ud.js";import{t as N}from"./switch-B42bu5O7.js";import{t as ee}from"./clock-BRjX06BR.js";import{a as P,i as te,n as ne,r as re,s as ie,t as ae}from"./pagination-D8oUwQ9k.js";import{t as oe}from"./headphones-DP3Pmamv.js";import{t as se}from"./info-JrDUNc3f.js";import{t as ce}from"./lightbulb-DQPhT5Fv.js";import{t as le}from"./trash-2-Cf1lYl_N.js";import{t as ue}from"./triangle-alert-_LVPy92s.js";import{t as F}from"./upload-CTvrSmVZ.js";import{t as I}from"./wand-sparkles-DNHHWq-f.js";import{di as de,gi as L,hi as fe,mi as pe}from"./constants-CX4j41GC.js";import{$t as me,Di as R,Lr as z,O as B,Qt as he,Ti as ge,Vi as V,Xt as _e,Yi as H,Yt as ve,Zt as ye,an as U,cr as W,en as G,mn as K,nn as q,pi as J,rn as Y,tn as be,zi as xe}from"./index-DKnFv8oI.js";import{t as Se}from"./CopyToClipboard-BMiCg7d2.js";import{t as Ce}from"./ReportButton-CuTsbpH1.js";import{t as we}from"./FilePreview-B2BrZCN4.js";import{t as X}from"./ImagePreview-ESZQ89R1.js";import{n as Te}from"./taskDrawerMixin-DyAUhFEq.js";import{t as Z}from"./Consumption-Byk7yTVz.js";import{t as Ee}from"./AudioPreview-uUWI_oVU.js";import{t as De}from"./VideoPlayer-B9ZoxGwN.js";import{t as Oe}from"./VideoPreview-D0f8om32.js";import{t as ke}from"./ApiCodeButton-CiNqmFYp.js";import{t as Ae}from"./BotPlaceholder-CDv27X3P.js";var je=v({name:`LayoutKling`,components:{MagicIcon:I,ElDrawer:A,ElButton:V},mixins:[Te]}),Me={class:`main flex flex-row flex-1 min-h-0`},Ne={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 Fe(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,Me,[e(`div`,Ne,[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`]),[[_,!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 Ie=B(je,[[`render`,Fe],[`__scopeId`,`data-v-2d826924`]]),Le={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 Le}}var $=`<<<video_1>>>`,Re=/<<<image_\d+>>>/g;function ze(e){return e?e.split($).join(` `).replace(/\s{2,}/g,` `).trim():``}function Be(e){return e?e.replace(Re,` `).replace(/\s{2,}/g,` `).trim():``}function Ve(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 He(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=ze(n.prompt)),e.field===`image_list`&&(n.image_list=void 0,n.prompt=Be(n.prompt));return n}var Ue=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(de)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=Ve(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await R.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=He({...t,model:e},n);this.$store.commit(`kling/setConfig`,i),D.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})}}}),We={class:`field`},Ge={class:`title font-bold`};function Ke(t,n,r,a,o,u){let d=l(`el-option`),m=l(`el-select`);return g(),s(`div`,We,[e(`h2`,Ge,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 qe=B(Ue,[[`render`,Ke],[`__scopeId`,`data-v-a74e7f31`]]),Je=v({name:`ModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},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 L.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=Ve(t,{mode:e});if(n.length===0){this.applyMode(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await R.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=He({...t,mode:e},n);this.$store.commit(`kling/setConfig`,i),D.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})}}}),Ye={class:`field`},Xe={class:`header`},Ze={class:`title font-bold`},Qe={key:0,class:`opt-tip`};function $e(t,r,u,d,m,_){let v=l(`info-icon`),y=l(`el-option`),b=l(`el-select`);return g(),s(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,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 et=B(Je,[[`render`,$e],[`__scopeId`,`data-v-9a8fa3c5`]]),tt=[3,5,8,10,12,15],nt=[5,10],rt=[5],it=v({name:`DurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return L.includes(this.selectedModel)},allowedDurations(){return this.selectedModel===`kling-o1`?rt:this.isV3Model?tt:nt},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=Ve(t,{duration:e});if(n.length===0){this.applyDuration(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await R.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=He({...t,duration:e},n);this.$store.commit(`kling/setConfig`,i),D.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})}}}),at={class:`field`},ot={class:`control`},st={class:`label`},ct={class:`title font-bold`};function lt(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,at,[e(`div`,ot,[e(`div`,st,[e(`h2`,ct,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 ut=B(it,[[`render`,lt],[`__scopeId`,`data-v-496bf31c`]]),dt=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`}}),ft={class:`text-sm font-bold mb-2 block`},pt={class:`items`},mt=[`onClick`],ht={class:`name`};function gt(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,ft,i(t.$t(`kling.name.ratio`)),1),e(`div`,pt,[(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`,ht,i(r.label),1)],10,mt))),128))])])}var _t=B(dt,[[`render`,gt],[`__scopeId`,`data-v-cdb14b2f`]]),vt=v({name:`StartImage`,components:{UploadIcon:F,ElUpload:C,ElButton:V,ElTooltip:w,InfoIcon:P,ImagePreview:X},mixins:[Y,q,G],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)},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(){D.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){D.error(this.$t(`kling.message.uploadReferencesError`))},onBeforeUpload(){let e=this.$store.state.kling?.config||{};if(e.video_list?.[0]?.refer_type===`base`)return D.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?(D.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()}}}),yt={class:`relative`},bt={class:`flex min-h-8 items-center pr-20`},xt={class:`flex justify-start items-center`},St={class:`text-sm font-bold`};function Ct(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`,yt,[e(`div`,bt,[e(`div`,xt,[e(`span`,St,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 wt=B(vt,[[`render`,Ct],[`__scopeId`,`data-v-60844ac3`]]),Tt=v({name:`EndImage`,components:{UploadIcon:F,ElUpload:C,ElButton:V,ElTooltip:w,ImagePreview:X,InfoIcon:P},mixins:[Y,q,G],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)},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 D.warning(this.$t(`kling.message.endImageNotSupported`)),!1;if(!this.hasStartImage)return D.warning(this.$t(`kling.message.endImageRequiresStart`)),!1;if(this.klingConfig.video_list?.[0]?.refer_type===`base`)return D.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?(D.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:e})),!1):!0},onExceed(){D.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){D.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()}}}),Et={class:`relative`},Dt={class:`flex min-h-8 items-center pr-20`},Ot={class:`flex justify-start items-center`},kt={class:`text-sm font-bold`};function At(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`,Et,[e(`div`,Dt,[e(`div`,Ot,[e(`span`,kt,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 jt=B(Tt,[[`render`,At],[`__scopeId`,`data-v-b286c4d0`]]),Mt=v({name:`ReferenceVideo`,components:{ElUpload:C,ElButton:V,ElRadioButton:O,ElRadioGroup:k,ElSwitch:N,InfoIcon:P,FilePreview:we,UploadIcon:F},mixins:[q,G],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)},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(){D.warning(this.$t(`kling.message.referenceVideoExceed`))},onError(){D.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 D.error(this.$t(`kling.message.referenceVideoImageLimit`)),!1;let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=he(e.size);return t?n?!0:(D.error(this.$t(`kling.message.referenceVideoSizeExceed`,{max:ye(_e)})),!1):(D.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=ze(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()}}}),Nt={class:`relative`},Pt={class:`flex min-h-8 items-center pr-20`},Ft={class:`flex justify-start items-center`},It={class:`text-sm font-bold`},Lt={key:0,class:`reference-options mt-3 flex flex-col gap-3`},Rt={class:`flex flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between`},zt={class:`text-sm`},Bt={class:`flex items-center justify-between gap-3`},Vt={class:`text-sm`};function Ht(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`,Nt,[e(`div`,Pt,[e(`div`,Ft,[e(`span`,It,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`,Lt,[e(`div`,Rt,[e(`span`,zt,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`,Bt,[e(`span`,Vt,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 Ut=B(Mt,[[`render`,Ht],[`__scopeId`,`data-v-e3a9dfab`]]),Wt=v({name:`KlingReferenceImages`,components:{ElButton:V,ElUpload:C,UploadIcon:F,ImagePreview:X,InfoIcon:P},mixins:[Y,q,G],data(){return{fileList:[],uploadUrl:J()+`/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(){D.warning(this.$t(`kling.message.referenceImagesExceed`,{count:this.remainingSlots}))},onError(){D.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=[Be(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()}}}),Gt={class:`relative`},Kt={class:`flex justify-between items-center`},qt={class:`flex justify-start items-center`},Jt={class:`text-sm font-bold`},Yt={key:0,class:`file-list flex flex-wrap gap-2 mt-2`};function Xt(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`,Gt,[e(`div`,Kt,[e(`div`,qt,[e(`span`,Jt,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`,Yt,[(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 Zt=B(Wt,[[`render`,Xt]]),Qt=v({name:`CfgScaleSelector`,components:{ElSlider:M,InfoIcon:P,ElInputNumber:j},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}}),$t={class:`flex justify-between`},en={class:`flex justify-start items-center`},tn={class:`text-sm font-bold`},nn={class:`flex justify-end items-center`},rn={class:`w-full`};function an(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`,$t,[e(`div`,en,[e(`span`,tn,i(t.$t(`kling.name.cfgScale`)),1),a(d,{content:t.$t(`kling.description.cfgScale`)},null,8,[`content`])]),e(`div`,nn,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,rn,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var on=B(Qt,[[`render`,an]]),sn=v({name:`GenerateAudioSelector`,components:{ElSwitch:N,InfoIcon:P},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},supported(){return!!(L.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})}}}),cn={class:`relative`},ln={class:`flex justify-between items-center`},un={class:`flex justify-start items-center`},dn={class:`text-sm font-bold`};function fn(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,cn,[e(`div`,ln,[e(`div`,un,[e(`span`,dn,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 pn=B(sn,[[`render`,fn]]),mn=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],hn=v({name:`CameraControlSelector`,components:{ElSelect:y,ElOption:b,ElSlider:M,ElInputNumber:j,InfoIcon:P},data(){return{configKeys:mn}},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)}}}),gn={class:`field`},_n={class:`header`},vn={class:`text-sm font-bold`},yn={key:0,class:`config-grid`},bn={class:`cfg-row-head`},xn={class:`cfg-name`};function Sn(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`,gn,[e(`div`,_n,[e(`span`,vn,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`,yn,[(g(!0),s(c,null,h(t.configKeys,n=>(g(),s(`div`,{key:n,class:`cfg-row`},[e(`div`,bn,[e(`span`,xn,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 Cn=B(hn,[[`render`,Sn],[`__scopeId`,`data-v-cd896060`]]),wn=[{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`]}],Tn=`, `;function En(e,t){let n=(e||``).trim();return n?n.includes(t)?n:`${n}${Tn}${t}`:t}function Dn(e,t){if(!e||!t)return e||``;let n=[`${t}${Tn}`,`${Tn}${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 On=v({name:`InspirationPills`,components:{CloseIcon:ge},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return wn.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=Dn(this.prompt,e);this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:t})}}}),kn={key:0,class:`pills`,role:`list`},An={class:`pill-text`},jn=[`aria-label`,`title`,`onClick`];function Mn(n,r,u,d,f,p){let m=l(`close-icon`);return n.selected.length>0?(g(),s(`div`,kn,[(g(!0),s(c,null,h(n.selected,r=>(g(),s(`div`,{key:r,class:`pill`,role:`listitem`},[e(`span`,An,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,jn)]))),128))])):o(``,!0)}var Nn=v({name:`PromptInput`,components:{IdeaIcon:ce,ElButton:V,PromptTextarea:te,InspirationPills:B(On,[[`render`,Mn],[`__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 Pn(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 Fn=B(Nn,[[`render`,Pn],[`__scopeId`,`data-v-5754ae54`]]),In=v({name:`NegativePromptInput`,components:{ElInput:H,InfoIcon:P},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||=``}}),Ln={class:`field`},Rn={class:`box`},zn={class:`title font-bold`};function Bn(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,Ln,[e(`div`,Rn,[e(`h2`,zn,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 Vn=B(In,[[`render`,Bn],[`__scopeId`,`data-v-de98cf01`]]),Hn=v({name:`InspirationDrawer`,components:{Close:ge,IdeaIcon:ce,ElDrawer:A,ElButton:V},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:wn}},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(Dn(this.prompt,e)):this.setPrompt(En(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=Dn(e,t);this.setPrompt(e)}}}),Un={class:`drawer-content`},Wn={class:`drawer-header`},Gn={class:`title-row`},Kn={class:`title`},qn={class:`hint`},Jn={key:0,class:`selected-bar`},Yn={class:`selected-text`},Xn={class:`groups`},Zn={class:`group-title`},Qn={class:`chip-grid`},$n=[`onClick`];function er(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`,Un,[e(`div`,Wn,[e(`div`,Gn,[a(y,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`span`,Kn,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`,qn,i(t.$t(`kling.inspiration.hint`)),1),t.selectedCount>0?(g(),s(`div`,Jn,[e(`span`,Yn,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`,Xn,[(g(!0),s(c,null,h(t.groups,r=>(g(),s(`div`,{key:r.groupKey,class:`group`},[e(`div`,Zn,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,$n))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var tr=B(Hn,[[`render`,er],[`__scopeId`,`data-v-8b2e6a5d`]]),nr={"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`},rr={std:`720p`,pro:`1080p`,"4k":`4K`},ir=v({name:`SummaryChip`,components:{AudioIcon:oe},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return nr[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return rr[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),ar={class:`summary-chip`},or=[`title`],sr=[`title`],cr=[`title`],lr=[`title`],ur=[`title`];function dr(t,n,r,c,u,d){let f=l(`audio-icon`);return g(),s(`div`,ar,[e(`span`,{class:`part`,title:t.$t(`kling.name.model`)},i(t.modelLabel),9,or),n[0]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.duration`)},i(t.durationLabel),9,sr),n[1]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.ratio`)},i(t.aspectRatio||`16:9`),9,cr),n[2]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.mode`)},i(t.modeLabel),9,lr),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,ur)):o(``,!0)])}var fr=v({name:`ConfigPanel`,components:{MagicIcon:I,ElButton:V,Consumption:Z,PromptInput:Fn,NegativePromptInput:Vn,ModelSelector:qe,ModeSelector:et,DurationSelector:ut,RatioSelector:_t,StartImage:wt,CfgScaleSelector:on,GenerateAudioSelector:pn,CameraControlSelector:Cn,InspirationDrawer:tr,SummaryChip:B(ir,[[`render`,dr],[`__scopeId`,`data-v-c800852a`]]),EndImage:jt,ReferenceImages:Zt,ReferenceVideo:Ut},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 U(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),pr={class:`flex flex-col h-full`},mr={class:`flex-1 overflow-y-auto p-5`},hr={class:`flex flex-col items-center justify-center px-5 pb-5`};function gr(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`,pr,[e(`div`,mr,[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`,hr,[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 _r=B(fr,[[`render`,gr]]),vr=v({name:`MotionImage`,components:{UploadIcon:F,ElUpload:C,ElButton:V,InfoIcon:P,ImagePreview:X},mixins:[Y,q,G,ve],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)}},mounted(){this.onSetImageUrl()},methods:{onExceed(){D.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){D.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()}}}),yr={class:`relative`},br={class:`flex justify-between`},xr={class:`flex justify-start items-center`},Sr={class:`text-sm font-bold`};function Cr(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`,yr,[e(`div`,br,[e(`div`,xr,[e(`span`,Sr,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,"before-upload":t.beforeUploadSizeGuard,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`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var wr=B(vr,[[`render`,Cr],[`__scopeId`,`data-v-4a95ef2c`]]),Tr=v({name:`MotionVideo`,components:{UploadIcon:F,ElUpload:C,ElButton:V,InfoIcon:P,FilePreview:we},mixins:[q,G],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)}},mounted(){this.onSetVideoUrl()},methods:{onExceed(){D.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){D.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:(D.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(D.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()}}}),Er={class:`relative`},Dr={class:`flex justify-between`},Or={class:`flex justify-start items-center`},kr={class:`text-sm font-bold`};function Ar(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`,Er,[e(`div`,Dr,[e(`div`,Or,[e(`span`,kr,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 jr=B(Tr,[[`render`,Ar],[`__scopeId`,`data-v-630c4521`]]),Mr=v({name:`MotionPromptInput`,components:{ElInput:H,InfoIcon:P},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||``},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),Nr={class:`field`},Pr={class:`box`},Fr={class:`title font-bold`};function Ir(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,Nr,[e(`div`,Pr,[e(`h2`,Fr,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 Lr=B(Mr,[[`render`,Ir],[`__scopeId`,`data-v-ca9fdbe5`]]),Rr=`video`,zr=v({name:`CharacterOrientationSelector`,components:{ElRadioGroup:k,ElRadioButton:O,InfoIcon:P},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||Rr},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=Rr)}}),Br={class:`field`},Vr={class:`header`},Hr={class:`text-sm font-bold`};function Ur(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`,Br,[e(`div`,Vr,[e(`span`,Hr,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 Wr=B(zr,[[`render`,Ur],[`__scopeId`,`data-v-7a91195b`]]),Gr=`kling-v2-6`,Kr=v({name:`MotionModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},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||Gr},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=Gr)}}),qr={class:`field`},Jr={class:`header`},Yr={class:`title font-bold`};function Xr(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,qr,[e(`div`,Jr,[e(`h2`,Yr,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 Zr=B(Kr,[[`render`,Xr],[`__scopeId`,`data-v-480e8da2`]]),Qr=`std`,$r=v({name:`MotionModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},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)}}),ei={class:`field`},ti={class:`header`},ni={class:`title font-bold`};function ri(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,ei,[e(`div`,ti,[e(`h2`,ni,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 ii=B($r,[[`render`,ri],[`__scopeId`,`data-v-1295688c`]]),ai=v({name:`KeepOriginalSoundSelector`,components:{ElSwitch:N,InfoIcon:P},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`})}}}}),oi={class:`relative`},si={class:`flex justify-between items-center`},ci={class:`flex justify-start items-center`},li={class:`text-sm font-bold`};function ui(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,oi,[e(`div`,si,[e(`div`,ci,[e(`span`,li,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 di=v({name:`MotionPanel`,components:{MagicIcon:I,ElButton:V,Consumption:Z,MotionImage:wr,MotionVideo:jr,MotionPromptInput:Lr,CharacterOrientationSelector:Wr,MotionModelSelector:Zr,MotionModeSelector:ii,KeepOriginalSoundSelector:B(ai,[[`render`,ui]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return U({...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`)}}}),fi={class:`flex flex-col h-full`},pi={class:`flex-1 overflow-y-auto p-5`},mi={class:`flex flex-col items-center justify-center px-5 pb-5`};function hi(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`,fi,[e(`div`,pi,[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`,mi,[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 gi=B(di,[[`render`,hi]]),_i=v({name:`KlingTabSwitcher`,components:{ElTabs:x,ElTabPane:S,ElTag:xe},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)}}}),vi=[`title`],yi={class:`text`};function bi(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`,yi,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,vi)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var xi=B(_i,[[`render`,bi],[`__scopeId`,`data-v-e6a2bb26`]]),Si={"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`},Ci=v({name:`TalkingPhotoModelSelector`,components:{ElSelect:y,ElOption:b},data(){return{options:fe.map(e=>({value:e,label:Si[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=pe)}}),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.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 Di=B(Ci,[[`render`,Ei],[`__scopeId`,`data-v-cbc83d11`]]),Oi=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`)}}),ki={class:`field`},Ai={class:`title font-bold`};function ji(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,ki,[e(`h2`,Ai,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 Mi=v({name:`TalkingPhotoPanel`,components:{MagicIcon:I,UploadIcon:F,ElUpload:C,ElButton:V,ElInput:H,Consumption:Z,InfoIcon:P,ImagePreview:X,ModelSelector:Di,ModeSelector:B(Oi,[[`render`,ji],[`__scopeId`,`data-v-92525a1d`]])},mixins:[G,ve],emits:[`generate`],data(){return{imageFiles:[],audioFiles:[],uploadUrl:J()+`/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 U({...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(){D.warning(this.$t(`kling.message.uploadReferencesExceed`))},onImageError(){D.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(){D.warning(this.$t(`kling.message.uploadAudioExceed`))},onAudioError(){D.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`)}}}),Ni={class:`flex flex-col h-full`},Pi={class:`flex-1 overflow-y-auto p-5`},Fi={class:`relative mb-4`},Ii={class:`flex justify-start items-center`},Li={class:`text-sm font-bold`},Ri={class:`relative mb-4`},zi={class:`flex justify-start items-center`},Bi={class:`text-sm font-bold`},Vi=[`src`],Hi={class:`mb-4`},Ui={class:`flex justify-start items-center`},Wi={class:`text-sm font-bold`},Gi={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ki(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`,Ni,[e(`div`,Pi,[a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),e(`div`,Fi,[e(`div`,Ii,[e(`span`,Li,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,"before-upload":t.beforeUploadSizeGuard,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`,`before-upload`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`])]),e(`div`,Ri,[e(`div`,zi,[e(`span`,Bi,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,"before-upload":t.beforeUploadSizeGuard,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`,`before-upload`,`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,Vi)):o(``,!0)]),e(`div`,Hi,[e(`div`,Ui,[e(`span`,Wi,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`,Gi,[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 qi=B(Mi,[[`render`,Ki],[`__scopeId`,`data-v-b47b80bd`]]),Ji=v({name:`TaskPreview`,components:{DeleteIcon:le,ChannelIcon:ie,InfoIcon:se,MagicIcon:I,TimeIcon:ee,WarningIcon:ue,CopyToClipboard:Se,ElAlert:T,VideoPlayer:De,ElTooltip:w,ElButton:V,ImagePreview:X,VideoPreview:Oe,AudioPreview:Ee,ApiCodeButton:ke,ReportButton:Ce},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},displayText(){return this.modelValue?.request?.prompt?.trim()||this.modelValue?.request?.text?.trim()||``},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 R.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}),D.success(this.$t(`common.message.deleteTaskSuccess`))}catch{D.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`)}}}),Yi={class:`preview`},Xi={class:`left`},Zi={class:`main`},Qi={class:`bot`},$i={class:`datetime`},ea=[`aria-label`],ta={key:0,class:`info`},na={key:0,class:`request-media flex justify-start items-center gap-2 w-full overflow-x-auto`},ra={key:1,class:`prompt`},ia={key:0},aa={key:1},oa={key:1,class:n({content:!0,failed:!0})},sa={key:0,class:`mb-4`},ca={key:1,class:n({operations:!0,"mt-2":!0})},la={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ua={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},da={key:0,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={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ha={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ga={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},_a={key:3,class:n({content:!0})},va={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ya={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function ba(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(`report-button`),k=l(`channel-icon`),A=l(`magic-icon`),j=l(`copy-to-clipboard`),M=l(`time-icon`),N=l(`el-alert`),ee=l(`warning-icon`),P=l(`info-icon`);return g(),s(`div`,Yi,[e(`div`,Xi,[a(y,{capability:`kling`,part:`avatar`,class:`avatar`})]),e(`div`,Zi,[e(`div`,Qi,[a(y,{capability:`kling`,part:`name`}),e(`span`,$i,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,ea)):o(``,!0)]),_:1},8,[`content`])]),n.referenceImages.length>0||n.referenceVideos.length>0||n.referenceAudios.length>0||n.displayText?(g(),s(`div`,ta,[n.referenceImages.length>0||n.referenceVideos.length>0||n.referenceAudios.length>0?(g(),s(`div`,na,[(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.displayText?(g(),s(`p`,ra,[r(i(n.displayText)+` `,1),n.modelValue?.response?n.isWaiting?(g(),s(`span`,aa,` - (`+i(n.$t(`kling.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,ia,` - (`+i(n.$t(`kling.status.pending`))+`) `,1))])):o(``,!0)])):o(``,!0),n.modelValue?.response?.success===!0&&!n.isFailure?(g(),s(`div`,oa,[n.modelValue?.response.video_url?(g(),s(`div`,sa,[a(T,{src:n.modelValue?.response.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response.success?(g(),s(`div`,ca,[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`]),a(O,{service:`kling`,"target-id":n.modelValue?.id,snapshot:{prompt:n.displayText}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(N,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,la,[a(k,{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`,ua,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,da,[a(M,{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`,fa,[a(N,{closable:!1,class:`failure`},{template:p(()=>[a(ee,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.failure`)),1)]),default:p(()=>[e(`p`,pa,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,ma,[a(P,{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(j,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,ha,[a(M,{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`,ga,[a(k,{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(j,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),n.isWaiting?(g(),s(`div`,_a,[a(N,{closable:!1,class:`info`},{template:p(()=>[a(M,{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`,va,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.response?.trace_id?(g(),s(`p`,ya,[a(k,{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(j,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var xa=v({name:`RecentPanel`,components:{TaskPreview:B(Ji,[[`render`,ba],[`__scopeId`,`data-v-73637147`]]),NoTasks:re,BotPlaceholder:Ae,ScrollList:ne},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?.()}}}),Sa={key:0},Ca={key:2,class:`w-full h-full flex items-center justify-center`};function wa(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`,Sa,[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`,Ca,[a(v)])):o(``,!0)],64)}var Ta=v({name:`KlingIndex`,components:{ConfigPanel:_r,MotionPanel:gi,TalkingPhotoPanel:qi,TabSwitcher:xi,Layout:Ie,RecentPanel:B(xa,[[`render`,wa]])},mixins:[be],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===E.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===E.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 ae({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(!me(this.uploadTracker,e=>this.$t(e),e=>D.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){D.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))){D.warning(this.$t(`kling.message.baseVideoFrameConflict`));return}if(!n.video_id&&!t.video_url&&!n.start_image_url&&n.end_image_url){D.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))}:{}}),!K())return;let o=this.credential?.token;if(!o){console.error(`no token specified`);return}D.info(this.$t(`kling.message.startingTask`)),z(`kling`,W.generate(n,{token:o})).then(()=>{D.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?D.error(this.$t(`kling.message.usedUp`)):D.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(!me(this.uploadTracker,e=>this.$t(e),e=>D.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){D.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(!K())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}D.info(this.$t(`kling.message.startingTask`)),z(`kling`,W.motion(t,{token:n})).then(()=>{D.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?D.error(this.$t(`kling.message.usedUp`)):D.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},async onGenerateTalkingPhoto(){if(!me(this.uploadTracker,e=>this.$t(e),e=>D.warning(e)))return;let e=this.talkingPhotoConfig||{};if(!e.image_url||!e.audio_url){D.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(!K())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}D.info(this.$t(`kling.message.startingTask`)),z(`kling`,W.talkingPhoto(t,{token:n})).then(()=>{D.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?D.error(this.$t(`kling.message.usedUp`)):D.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),Ea={class:`flex flex-col h-full`},Da={class:`flex-1 min-h-0`};function Oa(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`,Ea,[a(u,{"model-value":t.taskType,"onUpdate:modelValue":t.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),e(`div`,Da,[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 ka=B(Ta,[[`render`,Oa]]);export{ka 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,S as c,T as l,at as u,ht as d,it as f,j as p,mt as m,qt as h,rt as g,tt as _,x as v,z as y}from"./vendor-chart-Dw-P17PN.js";import{r as b,t as x}from"./select-BPmmsYsL.js";import{t as S}from"./upload-C1h3h1KN.js";import{t as C}from"./tooltip-DKF_sGto.js";import{t as w}from"./alert-BprQRUmf.js";import{h as T,v as E}from"./models-D6J60Ang.js";import{t as D}from"./drawer-BWJ3_fqW.js";import{t as O}from"./box-C1K_05R1.js";import{t as k}from"./clock-BRjX06BR.js";import{t as A}from"./external-link-B_1us9v2.js";import{a as j,i as M,n as N,r as P,s as F,t as I}from"./pagination-D8oUwQ9k.js";import{t as L}from"./image-DLh3kiN0.js";import{t as R}from"./info-JrDUNc3f.js";import{t as ee}from"./trash-2-Cf1lYl_N.js";import{t as z}from"./triangle-alert-_LVPy92s.js";import{t as B}from"./upload-CTvrSmVZ.js";import{t as V}from"./wand-sparkles-DNHHWq-f.js";import{t as H}from"./zap-BQE62bDm.js";import{Qn as te,Xn as ne,Yn as re,Zn as U,qn as ie}from"./constants-CX4j41GC.js";import{$t as ae,Di as W,Lr as G,O as K,Vi as q,Wn as J,Yt as oe,an as se,en as ce,fr as le,mn as ue,nn as de,pi as fe,rn as pe,tn as me}from"./index-DKnFv8oI.js";import{t as he}from"./CopyToClipboard-BMiCg7d2.js";import{n as Y,t as X}from"./scenarioPayment-BQxaybOL.js";import{t as ge}from"./ReportButton-CuTsbpH1.js";import{t as Z}from"./ImagePreview-ESZQ89R1.js";import{n as _e}from"./taskDrawerMixin-DyAUhFEq.js";import{t as ve}from"./Consumption-Byk7yTVz.js";import{t as ye}from"./ApiCodeButton-CiNqmFYp.js";import{t as be}from"./BotPlaceholder-CDv27X3P.js";import{t as xe}from"./ImageWrapper-ByG7FJxY.js";import{r as Se,t as Q}from"./imageRequests-BMlSTRGz.js";var Ce=y({name:`LayoutNanobanana`,components:{MagicIcon:V,ElDrawer:D,ElButton:q},mixins:[_e]}),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 l=u(`magic-icon`),p=u(`el-button`),h=u(`el-drawer`);return _(),s(`div`,we,[e(`div`,Te,[f(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ee,[f(t.$slots,`result`,{},void 0,!0)]),d(a(p,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[a(l,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[v,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:m(()=>[f(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Oe=K(Ce,[[`render`,De],[`__scopeId`,`data-v-6419fc74`]]),ke=y({name:`PromptInput`,components:{PromptTextarea:M},computed:{prompt:{get(){return this.$store.state.nanobanana?.config?.prompt},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ae(e,t,n,r,i,a){let o=u(`prompt-textarea`);return _(),p(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`nanobanana.name.prompt`),info:e.$t(`nanobanana.description.prompt`),placeholder:e.$t(`nanobanana.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var je=K(ke,[[`render`,Ae]]),Me=y({name:`ImageUrlsInput`,components:{UploadIcon:B,ElUpload:S,ElButton:q,InfoIcon:j,ImagePreview:Z},mixins:[pe,de,ce,oe],data(){return{fileList:[],uploadUrl:fe()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.nanobanana?.config?.image_urls}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},mounted(){},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImageUrls()},onExceed(){E.warning(this.$t(`nanobanana.message.uploadImageExceed`))},onError(){E.error(this.$t(`nanobanana.message.uploadImageError`))},onSetImageUrls(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,image_urls:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImageUrls()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImageUrls()}}}),Ne={class:`field mb-[10px] flex min-h-8 w-full items-center justify-between gap-3`},Pe={class:`flex min-w-0 items-center`},Fe={class:`title m-0 text-[14px] font-bold`},Ie={class:`file-list flex flex-wrap gap-[10px]`};function Le(t,n,o,c,d,f){let h=u(`info-icon`),v=u(`upload-icon`),y=u(`el-button`),b=u(`el-upload`),x=u(`image-preview`);return _(),s(`div`,null,[e(`div`,Ne,[e(`div`,Pe,[e(`h2`,Fe,i(t.$t(`nanobanana.name.imageUrls`)),1),a(h,{content:t.$t(`nanobanana.description.imageUrls`)},null,8,[`content`])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value shrink-0`,limit:5,multiple:!0,"show-file-list":!1,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:m(()=>[a(y,{size:`small`,type:`primary`,round:``},{default:m(()=>[a(v,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`nanobanana.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,Ie,[(_(!0),s(l,null,g(t.fileList,(e,n)=>(_(),p(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])}var Re=K(Me,[[`render`,Le]]),ze=y({name:`AspectRatioSelector`,components:{InfoIcon:j},data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`3:2`,label:`3:2`,width:27,height:18},{value:`2:3`,label:`2:3`,width:18,height:27},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25},{value:`4:3`,label:`4:3`,width:24,height:18},{value:`3:4`,label:`3:4`,width:18,height:24}]}},computed:{value(){return this.$store.state.nanobanana?.config?.aspect_ratio}},methods:{onSelect(e){let t=this.value===e?void 0:e,n={...this.$store.state.nanobanana?.config||{}};t?n.aspect_ratio=t:delete n.aspect_ratio,this.$store.commit(`nanobanana/setConfig`,n)}}}),Be={class:`ratio`},Ve={class:`header`},He={class:`title font-bold`},Ue=[`aria-label`],We=[`aria-checked`,`aria-label`,`onClick`,`onKeydown`],Ge={class:`preview`},Ke={class:`name`};function qe(r,o,d,f,p,m){let v=u(`info-icon`);return _(),s(`div`,Be,[e(`div`,Ve,[e(`h2`,He,i(r.$t(`nanobanana.name.aspectRatio`)),1),a(v,{content:r.$t(`nanobanana.description.aspectRatio`),class:`ml-1`},null,8,[`content`])]),e(`div`,{class:`items`,role:`radiogroup`,"aria-label":r.$t(`nanobanana.name.aspectRatio`)},[(_(!0),s(l,null,g(r.options,a=>(_(),s(`div`,{key:a.value,class:n([`item`,{active:r.value===a.value}]),role:`radio`,"aria-checked":r.value===a.value,"aria-label":a.label,tabindex:`0`,onClick:e=>r.onSelect(a.value),onKeydown:[c(t(e=>r.onSelect(a.value),[`prevent`]),[`enter`]),c(t(e=>r.onSelect(a.value),[`prevent`]),[`space`])]},[e(`div`,Ge,[e(`div`,{class:`rect`,style:h({width:a.width+`px`,height:a.height+`px`})},null,4)]),e(`p`,Ke,i(a.label),1)],42,We))),128))],8,Ue)])}var Je=K(ze,[[`render`,qe],[`__scopeId`,`data-v-7131eb97`]]),Ye=y({name:`NanobananaModelSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:j},data(){return{options:[{value:re,label:this.$t(`nanobanana.model.nanoBanana`)},{value:U,label:U},{value:te,label:this.$t(`nanobanana.model.nanoBananaPro`)},{value:ne,label:this.$t(`nanobanana.model.nanoBanana2`)}]}},computed:{value:{get(){return this.$store.state.nanobanana?.config?.model},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,model:e})}},modelDescription(){return this.$t(`nanobanana.description.model`)}},mounted(){this.value||=ie}}),Xe={class:`field`},Ze={class:`label`},Qe={class:`box`},$e={class:`title font-bold`};function et(t,n,r,o,c,d){let f=u(`info-icon`),h=u(`el-option`),v=u(`el-select`);return _(),s(`div`,Xe,[e(`div`,Ze,[e(`div`,Qe,[e(`h2`,$e,i(t.$t(`nanobanana.name.model`)),1),a(f,{content:t.modelDescription,class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`nanobanana.placeholder.select`)},{default:m(()=>[(_(!0),s(l,null,g(t.options,e=>(_(),p(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var tt=K(Ye,[[`render`,et],[`__scopeId`,`data-v-11cb675b`]]),nt=y({name:`NanobananaResolutionSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:j},data(){return{cachedResolution:`1K`,options:[{value:`1K`,label:`1K`},{value:`2K`,label:`2K`},{value:`4K`,label:`4K`}]}},computed:{value:{get(){return this.$store.state.nanobanana?.config?.resolution},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:e})}},supportsResolution(){let e=this.$store.state.nanobanana?.config?.model;return e===`nano-banana-2`||e===`nano-banana-pro`}},watch:{value(e){this.supportsResolution&&e&&(this.cachedResolution=e)},supportsResolution(e){e?this.value||=this.cachedResolution||`1K`:(this.value&&(this.cachedResolution=this.value),this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:void 0}))}},mounted(){this.supportsResolution&&!this.value&&(this.value=`1K`),!this.supportsResolution&&this.value&&(this.cachedResolution=this.value,this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:void 0}))}}),rt={class:`field`},it={class:`label`},at={class:`box`},ot={class:`title font-bold`};function st(t,n,r,o,c,d){let f=u(`info-icon`),h=u(`el-option`),v=u(`el-select`);return _(),s(`div`,rt,[e(`div`,it,[e(`div`,at,[e(`h2`,ot,i(t.$t(`nanobanana.name.resolution`)),1),a(f,{content:t.$t(`nanobanana.description.resolutionProOnly`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`nanobanana.placeholder.select`),disabled:!t.supportsResolution},{default:m(()=>[(_(!0),s(l,null,g(t.options,e=>(_(),p(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`])])}var ct=K(nt,[[`render`,st],[`__scopeId`,`data-v-7ab9d4d4`]]),lt=350,ut=y({name:`ConfigPanel`,components:{MagicIcon:V,ElButton:q,PromptInput:je,Consumption:ve,ImageUrlsInput:Re,AspectRatioSelector:Je,ModelSelector:tt,ResolutionSelector:ct,ScenarioPaymentMode:Se},emits:[`generate`],data(){return{quoteTimer:0,quoteRunId:0}},computed:{config(){return this.$store.state.nanobanana?.config},consumption(){let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;return se({...e,action:t?`edit`:`generate`},this.service?.cost)},service(){return this.$store.state.nanobanana?.service},walletMode(){return X()&&Y(`nanobanana`).mode===`wallet`}},watch:{walletMode:{handler(e){e&&this.scheduleQuote()},immediate:!0},config:{handler(){this.walletMode&&this.scheduleQuote()},deep:!0}},beforeUnmount(){window.clearTimeout(this.quoteTimer),this.quoteRunId+=1},methods:{scheduleQuote(){window.clearTimeout(this.quoteTimer),this.quoteTimer=window.setTimeout(this.refreshQuote,lt)},async refreshQuote(){let e=Y(`nanobanana`),t=++this.quoteRunId;e.quoteLoading=!0,e.quoteUsdc=void 0;try{let n=await J.quote(Q(this.config));t===this.quoteRunId&&e.mode===`wallet`&&(e.quoteUsdc=n.amountUsdc)}catch(e){console.warn(`x402 quote failed`,e)}finally{t===this.quoteRunId&&(e.quoteLoading=!1)}},onGenerate(){this.$emit(`generate`)}}}),dt={class:`flex flex-col h-full`},ft={class:`flex-1 overflow-y-auto p-5`},pt={class:`flex flex-col items-center justify-center px-5 pb-5`};function mt(t,n,c,l,d,f){let h=u(`model-selector`),g=u(`resolution-selector`),v=u(`prompt-input`),y=u(`aspect-ratio-selector`),b=u(`image-urls-input`),x=u(`scenario-payment-mode`),S=u(`consumption`),C=u(`magic-icon`),w=u(`el-button`);return _(),s(`div`,dt,[e(`div`,ft,[a(h,{class:`mb-4`}),a(g,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`})]),e(`div`,pt,[a(x,{scenario:`nanobanana`}),t.walletMode?o(``,!0):(_(),p(S,{key:0,value:t.consumption,service:t.service},null,8,[`value`,`service`])),a(w,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:m(()=>[a(C,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`nanobanana.button.generate`)),1)]),_:1},8,[`onClick`])])])}var ht=K(ut,[[`render`,mt]]),gt=y({name:`TaskPreview`,components:{ApplicationIcon:O,ChannelIcon:F,DeleteIcon:ee,ExternalLinkIcon:A,ImageIcon:L,InfoIcon:R,LightningIcon:H,MagicIcon:V,TimeIcon:k,WarningIcon:z,CopyToClipboard:he,ElAlert:w,ImageWrapper:xe,ElButton:q,ElTooltip:C,ImagePreview:Z,ApiCodeButton:ye,ReportButton:ge},props:{modelValue:{type:Object,required:!0}},computed:{images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e},hasImages(){return this.images.some(e=>!!e?.image_url)},showResult(){let e=this.modelValue?.response;return e?e.success===!0?!0:this.hasImages&&e.success!==!1:!1}},methods:{onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.nanobanana?.config||{}};delete t.action,t.image_urls=[e],this.$store.commit(`nanobanana/setConfig`,t)},async onDelete(){let e=this.modelValue?.id;if(e){try{await W.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(`nanobanana/deleteTask`,{id:e}),E.success(this.$t(`common.message.deleteTaskSuccess`))}catch{E.error(this.$t(`common.message.deleteTaskFailed`))}}}}}),_t={class:`preview`},vt={class:`left`},yt={class:`main`},bt={class:`bot`},xt={class:`datetime`},St=[`aria-label`],Ct={class:`info`},wt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Tt={key:1,class:`prompt mt-2`},Et={key:0},Dt={key:0,class:n({content:!0,failed:!0})},Ot={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},kt={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},At={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},It={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Lt={key:1,class:n({content:!0})},Rt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},zt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Bt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Vt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ht={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ut={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Wt={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Gt={key:2,class:n({content:!0})},Kt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Jt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Yt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Xt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`};function Zt(n,c,d,f,h,v){let y=u(`capability-presentation`),b=u(`delete-icon`),x=u(`el-tooltip`),S=u(`image-preview`),C=u(`image-wrapper`),w=u(`el-button`),T=u(`api-code-button`),E=u(`report-button`),D=u(`application-icon`),O=u(`image-icon`),k=u(`external-link-icon`),A=u(`lightning-icon`),j=u(`magic-icon`),M=u(`copy-to-clipboard`),N=u(`time-icon`),P=u(`channel-icon`),F=u(`el-alert`),I=u(`warning-icon`),L=u(`info-icon`);return _(),s(`div`,_t,[e(`div`,vt,[a(y,{capability:`nanobanana`,part:`avatar`,class:`avatar`})]),e(`div`,yt,[e(`div`,bt,[a(y,{capability:`nanobanana`,part:`name`}),e(`span`,xt,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:m(()=>[n.modelValue?.id?(_(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,St)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Ct,[n.modelValue?.request?.image_urls&&n.modelValue?.request?.image_urls.length>0?(_(),s(`div`,wt,[(_(!0),s(l,null,g(n.modelValue?.request?.image_urls,(e,t)=>(_(),p(S,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(_(),s(`p`,Tt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(_(),s(`span`,Et,` - (`+i(n.$t(`nanobanana.status.pending`))+`) `,1))])):o(``,!0)]),n.showResult?(_(),s(`div`,Dt,[e(`div`,Ot,[(_(!0),s(l,null,g(n.images,(e,t)=>(_(),p(C,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,kt,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:m(()=>[a(w,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:m(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(T,{path:`/nano-banana/images`,body:n.modelValue?.request},null,8,[`body`]),a(E,{service:`nanobanana`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])]),a(F,{closable:!1,class:`mt-2 success`},{default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,At,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,jt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,Mt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,Nt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,Pt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(M,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(_(),s(`p`,Ft,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(_(),s(`p`,It,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(M,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1||n.modelValue?.response?.error?(_(),s(`div`,Lt,[a(F,{closable:!1,class:`failure`},{template:m(()=>[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.failure`)),1)]),default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,Rt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,zt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,Bt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,$,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,Vt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(M,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,Ht,[a(L,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(M,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(_(),s(`p`,Ut,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(_(),s(`p`,Wt,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(M,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(_(),s(`div`,Gt,[a(F,{closable:!1,class:`info`},{template:m(()=>[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.status.pending`)),1)]),default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,Kt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,qt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,Jt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,Yt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,Xt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(M,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})]))])])}var Qt=y({name:`RecentPanel`,components:{TaskPreview:K(gt,[[`render`,Zt],[`__scopeId`,`data-v-45a0e049`]]),BotPlaceholder:be,NoTasks:P,ScrollList:N},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.nanobanana?.tasks,items:this.$store.state.nanobanana?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),$t={key:0},en={key:2,class:`w-full h-full flex items-center justify-center`};function tn(e,t,n,r,i,c){let d=u(`bot-placeholder`),f=u(`task-preview`),h=u(`scroll-list`),v=u(`no-tasks`);return _(),s(l,null,[e.tasks?.items===void 0?(_(),s(`div`,$t,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(_(),p(h,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:m(()=>[(_(!0),s(l,null,g(e.tasks?.items,e=>(_(),p(f,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(_(),s(`div`,en,[a(v)])):o(``,!0)],64)}var nn=y({name:`NanobananaIndex`,components:{ConfigPanel:ht,Layout:Oe,RecentPanel:K(Qt,[[`render`,tn]])},mixins:[me],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1,walletTaskIds:[]}},computed:{applicationsLoading(){return this.$store.state.nanobanana?.status?.getApplications===T.Request},tasksLoading(){return this.$store.state.nanobanana?.status?.getTasks===T.Request},credential(){return this.$store.state.nanobanana?.credential},config(){return this.$store.state.nanobanana?.config},application(){return this.$store.state.nanobanana?.application},tasks(){return this.$store.state.nanobanana?.tasks},walletMode(){return X()&&Y(`nanobanana`).mode===`wallet`}},watch:{walletMode:{async handler(e,t){t===void 0||e===t||(this.$store.commit(`nanobanana/setTasks`,void 0),await this.onGetTasks(),await this.onScrollDown())}},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 I({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`nanobanana/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`nanobanana/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug(`loading`);return}let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};await this.$store.dispatch(`nanobanana/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r,...this.walletMode&&!this.credential?.token?{mode:`x402`,ids:this.walletTaskIds}:{}})},async onGenerate(){if(!ae(this.uploadTracker,e=>this.$t(e),e=>E.warning(e)))return;let e=Q(this.config),t;if(this.walletMode){let n=this.getWalletContext();if(!n){E.warning(this.$t(`common.x402Scenario.connectWalletFirst`));return}t=J.generate(e,{mode:`x402`,x402:{wallet:n,confirm:e=>this.confirmWalletPayment(e),identityToken:this.credential?.token}})}else{if(!ue())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}t=J.generate(e,{token:n})}E.info(this.$t(`nanobanana.message.startingTask`)),G(`nanobanana`,t).then(e=>{let t=e?.data?.task_id;this.walletMode&&!this.credential?.token&&t&&!this.walletTaskIds.includes(t)&&this.walletTaskIds.unshift(t),E.success(this.$t(`nanobanana.message.startTaskSuccess`))}).catch(e=>{if(e instanceof le)return;let t=e?.response?.data;t?.error?.code===`used_up`?E.error(this.$t(`nanobanana.message.usedUp`)):this.walletMode?E.error(`${this.$t(`common.x402Scenario.paymentFailed`)} ${e?.message||``}`.trim()):E.error(this.$t(`nanobanana.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getWalletContext(){let e=this.$wallet,t=e?.publicKey?.value,n=e?.wallet?.value?.adapter;if(!(!t||!n?.signTransaction))return{publicKey:t,signTransaction:n.signTransaction.bind(n)}},async confirmWalletPayment(e){return W.confirm(this.$t(`common.x402Scenario.confirmPayment`,{amount:e.amountUsdc}),this.$t(`order.message.x402ConfirmTitle`),{confirmButtonText:this.$t(`order.message.x402WalletPayCta`),cancelButtonText:this.$t(`common.button.cancel`),type:`warning`}).then(()=>!0).catch(()=>!1)},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function rn(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`layout`);return _(),p(l,null,{config:m(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var an=K(nn,[[`render`,rn]]);export{an 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{n as v,r as y,t as b}from"./select-C90FIlgu.js";import{t as x}from"./upload-Bh12CGQx.js";import{t as S}from"./tooltip-BPdAozKj.js";import{t as C}from"./alert-BprQRUmf.js";import{h as w,v as T}from"./models-p9iPUELt.js";import{t as E}from"./drawer-CKZxuyy2.js";import{t as D}from"./input-number-OCoLwwKA.js";import{t as O}from"./box-D01T0Rfx.js";import{t as k}from"./clock-DZS73nzp.js";import{a as A,c as j,n as M,o as N,r as P,t as F}from"./pagination-BL2RhP-o.js";import{t as I}from"./image-9QrJZd7m.js";import{t as ee}from"./info-BbgRo3R9.js";import{t as te}from"./trash-2-DW1SgSXi.js";import{t as ne}from"./triangle-alert-DsomYnuJ.js";import{t as re}from"./upload-B8IAn10v.js";import{t as L}from"./wand-sparkles-C3ALfy6z.js";import{t as ie}from"./zap-CZjQNphx.js";import{An as R,Cn as z,Dn as ae,En as oe,Sn as B,Tn as V,bn as H,kn as se,wn as U}from"./constants-nRb-ZD8Y.js";import{$t as ce,Fi as W,Jt as le,Mr as ue,O as G,Qt as de,en as fe,in as pe,nn as me,pn as he,si as ge,tn as _e,xi as K,zn as ve}from"./index-Ckt9JRr7.js";import{t as ye}from"./CopyToClipboard-CrS-3Doq.js";import{t as be}from"./ReportButton-0FaWenrZ.js";import{t as q}from"./ImagePreview-Dx93HYYQ.js";import{n as xe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as Se}from"./Consumption-B1H9Udpr.js";import{t as Ce}from"./ApiCodeButton-CRlp6GD-.js";import{t as we}from"./BotPlaceholder-Bu9BbNUw.js";import{t as Te}from"./ImageWrapper-BvF7E-9g.js";var Ee=_({name:`LayoutSeedream`,components:{MagicIcon:L,ElDrawer:E,ElButton:W},mixins:[xe]}),De={class:`main flex flex-row flex-1`},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`),_=l(`el-drawer`);return h(),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`]),[[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 je=G(Ee,[[`render`,Ae],[`__scopeId`,`data-v-c10167d0`]]),Me=_({name:`SeedreamPromptInput`,components:{PromptTextarea:A},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 Ne(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 Pe=G(Me,[[`render`,Ne]]),Fe={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 J(e){switch(e){case V:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case U:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case z:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case B:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};default:return Fe}}function Y(e,t){let n=J(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Ie=[`1K`,`2K`,`3K`,`4K`];function X(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=J(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();(Ie.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 Z(e,t,n){let r={...e},i=J(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:re,ElUpload:x,ElButton:W,InfoIcon:N,ImagePreview:q},mixins:[me,_e,ce,le],data(){return{fileList:[],uploadUrl:ge()+`/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 J(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(){T.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){T.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,"before-upload":t.beforeUploadSizeGuard,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`,`before-upload`,`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-21f4dd97`]]),qe=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:N},data(){return{revertKey:0,options:[{value:V,label:this.$t(`seedream.model.seedream50pro`)},{value:U,label:this.$t(`seedream.model.seedream50`)},{value:z,label:this.$t(`seedream.model.seedream45`)},{value:B,label:this.$t(`seedream.model.seedream40`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){if(this.value&&this.options.some(e=>e.value===this.value))return;let e={...this.$store.state.seedream?.config||{},model:H},t=X(e,{model:H});this.$store.commit(`seedream/setConfig`,Z(e,t,{model:H}))},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=X(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await K.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=Z({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),T.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-bb6a29ab`]]),et=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:N},data(){return{SEEDREAM_SIZE_ADAPTIVE:se,pixelOptions:ae}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return J(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:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(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:N},data(){return{options:[...oe]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(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:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(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:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(this.config?.model).guidanceScale},defaultValue(){return J(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`]]),Q=e=>{let t={...e||{}},n=Y(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:L,ElButton:W,PromptInput:Pe,Consumption:Se,ImageInput:Ke,ModelSelector:$e,SizeSelector:ot,MaxImagesSelector:mt,OutputFormatSelector:xt,SeedInput:kt,GuidanceScaleInput:Lt},emits:[`generate`],computed:{action(){return Y(this.config?.model,this.config?.image)},capabilities(){return J(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=Q(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return pe({...e,action:this.action,model:R(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:te,ApplicationIcon:O,ChannelIcon:j,ImageIcon:I,InfoIcon:ee,LightningIcon:ie,MagicIcon:L,TimeIcon:k,WarningIcon:ne,CopyToClipboard:ye,ElAlert:C,ImageWrapper:Te,ElButton:W,ElTooltip:S,ImagePreview:q,ApiCodeButton:Ce,ReportButton:be},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return Q(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 K.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}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.error(this.$t(`common.message.deleteTaskFailed`))}}},shortModel(e){return R(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:2,class:`content`},mn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={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(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-preview`),C=l(`time-icon`),w=l(`magic-icon`),T=l(`copy-to-clipboard`),E=l(`el-alert`),D=l(`image-wrapper`),O=l(`el-button`),k=l(`api-code-button`),A=l(`report-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(y,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,qt,[e(`div`,Jt,[a(y,{capability:`seedream`,part:`name`}),e(`span`,Yt,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,Xt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Zt,[Array.isArray(n.modelValue?.request?.image)&&n.modelValue?.request?.image.length>0?(h(),s(`div`,Qt,[(h(!0),s(c,null,m(n.modelValue?.request?.image,(e,t)=>(h(),f(S,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(h(),s(`p`,$t,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,en,` - (`+i(n.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(h(),s(`div`,rn,[e(`div`,an,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(D,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,on,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(O,{type:`info`,size:`small`,class:`btn-action`,onClick:u[1]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(k,{path:`/seedream/images`,body:n.apiRequest},null,8,[`body`]),a(A,{service:`seedream`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])]),a(E,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,sn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,cn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,un,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,dn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,fn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(h(),s(`div`,pn,[a(E,{closable:!1,class:`failure`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.failure`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,mn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,hn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,gn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,_n,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(h(),s(`p`,vn,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(T,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(h(),s(`p`,yn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,$,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,bn,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,xn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(h(),s(`p`,Sn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,tn,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,nn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var wn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:G(Wt,[[`render`,Cn],[`__scopeId`,`data-v-b0055abb`]]),BotPlaceholder:we,NoTasks:P,ScrollList:M},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:je,RecentPanel:G(wn,[[`render`,Dn]])},mixins:[fe],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===w.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 F({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(!de(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;if(J(this.config?.model).imageRequired&&!this.config?.image?.length){T.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=Q(this.config);if(!he())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}T.info(this.$t(`seedream.message.startingTask`)),ue(`seedream`,ve.generate(e,{token:t})).then(()=>{T.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?T.error(this.$t(`seedream.message.usedUp`)):T.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};
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-BPmmsYsL.js";import{t as x}from"./upload-C1h3h1KN.js";import{t as S}from"./tooltip-DKF_sGto.js";import{t as C}from"./alert-BprQRUmf.js";import{h as w,v as T}from"./models-D6J60Ang.js";import{t as E}from"./drawer-BWJ3_fqW.js";import{t as D}from"./input-number-C61XfqeG.js";import{t as O}from"./box-C1K_05R1.js";import{t as k}from"./clock-BRjX06BR.js";import{a as A,i as j,n as M,r as N,s as P,t as F}from"./pagination-D8oUwQ9k.js";import{t as I}from"./image-DLh3kiN0.js";import{t as ee}from"./info-JrDUNc3f.js";import{t as te}from"./trash-2-Cf1lYl_N.js";import{t as ne}from"./triangle-alert-_LVPy92s.js";import{t as re}from"./upload-CTvrSmVZ.js";import{t as L}from"./wand-sparkles-DNHHWq-f.js";import{t as ie}from"./zap-BQE62bDm.js";import{An as R,Cn as z,Dn as ae,En as oe,Sn as B,Tn as V,bn as H,kn as se,wn as U}from"./constants-CX4j41GC.js";import{$t as ce,Di as W,Hn as le,Lr as ue,O as G,Vi as K,Yt as de,an as fe,en as pe,mn as me,nn as he,pi as ge,rn as _e,tn as ve}from"./index-DKnFv8oI.js";import{t as ye}from"./CopyToClipboard-BMiCg7d2.js";import{t as be}from"./ReportButton-CuTsbpH1.js";import{t as q}from"./ImagePreview-ESZQ89R1.js";import{n as xe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as Se}from"./Consumption-Byk7yTVz.js";import{t as Ce}from"./ApiCodeButton-CiNqmFYp.js";import{t as we}from"./BotPlaceholder-CDv27X3P.js";import{t as Te}from"./ImageWrapper-ByG7FJxY.js";var Ee=_({name:`LayoutSeedream`,components:{MagicIcon:L,ElDrawer:E,ElButton:K},mixins:[xe]}),De={class:`main flex flex-row flex-1`},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`),_=l(`el-drawer`);return h(),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`]),[[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 je=G(Ee,[[`render`,Ae],[`__scopeId`,`data-v-c10167d0`]]),Me=_({name:`SeedreamPromptInput`,components:{PromptTextarea:j},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 Ne(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 Pe=G(Me,[[`render`,Ne]]),Fe={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 J(e){switch(e){case V:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case U:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case z:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case B:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};default:return Fe}}function Y(e,t){let n=J(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Ie=[`1K`,`2K`,`3K`,`4K`];function X(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=J(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();(Ie.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 Z(e,t,n){let r={...e},i=J(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:re,ElUpload:x,ElButton:K,InfoIcon:A,ImagePreview:q},mixins:[_e,he,pe,de],data(){return{fileList:[],uploadUrl:ge()+`/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 J(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(){T.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){T.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,"before-upload":t.beforeUploadSizeGuard,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`,`before-upload`,`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-21f4dd97`]]),qe=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:A},data(){return{revertKey:0,options:[{value:V,label:this.$t(`seedream.model.seedream50pro`)},{value:U,label:this.$t(`seedream.model.seedream50`)},{value:z,label:this.$t(`seedream.model.seedream45`)},{value:B,label:this.$t(`seedream.model.seedream40`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){if(this.value&&this.options.some(e=>e.value===this.value))return;let e={...this.$store.state.seedream?.config||{},model:H},t=X(e,{model:H});this.$store.commit(`seedream/setConfig`,Z(e,t,{model:H}))},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=X(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await W.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=Z({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),T.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-bb6a29ab`]]),et=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:A},data(){return{SEEDREAM_SIZE_ADAPTIVE:se,pixelOptions:ae}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return J(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:D,InfoIcon:A},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(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:A},data(){return{options:[...oe]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(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:D,InfoIcon:A},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(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:D,InfoIcon:A},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(this.config?.model).guidanceScale},defaultValue(){return J(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`]]),Q=e=>{let t={...e||{}},n=Y(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:L,ElButton:K,PromptInput:Pe,Consumption:Se,ImageInput:Ke,ModelSelector:$e,SizeSelector:ot,MaxImagesSelector:mt,OutputFormatSelector:xt,SeedInput:kt,GuidanceScaleInput:Lt},emits:[`generate`],computed:{action(){return Y(this.config?.model,this.config?.image)},capabilities(){return J(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=Q(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return fe({...e,action:this.action,model:R(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:te,ApplicationIcon:O,ChannelIcon:P,ImageIcon:I,InfoIcon:ee,LightningIcon:ie,MagicIcon:L,TimeIcon:k,WarningIcon:ne,CopyToClipboard:ye,ElAlert:C,ImageWrapper:Te,ElButton:K,ElTooltip:S,ImagePreview:q,ApiCodeButton:Ce,ReportButton:be},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return Q(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 W.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}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.error(this.$t(`common.message.deleteTaskFailed`))}}},shortModel(e){return R(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:2,class:`content`},mn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={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(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-preview`),C=l(`time-icon`),w=l(`magic-icon`),T=l(`copy-to-clipboard`),E=l(`el-alert`),D=l(`image-wrapper`),O=l(`el-button`),k=l(`api-code-button`),A=l(`report-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(y,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,qt,[e(`div`,Jt,[a(y,{capability:`seedream`,part:`name`}),e(`span`,Yt,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,Xt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Zt,[Array.isArray(n.modelValue?.request?.image)&&n.modelValue?.request?.image.length>0?(h(),s(`div`,Qt,[(h(!0),s(c,null,m(n.modelValue?.request?.image,(e,t)=>(h(),f(S,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(h(),s(`p`,$t,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,en,` - (`+i(n.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(h(),s(`div`,rn,[e(`div`,an,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(D,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,on,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(O,{type:`info`,size:`small`,class:`btn-action`,onClick:u[1]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(k,{path:`/seedream/images`,body:n.apiRequest},null,8,[`body`]),a(A,{service:`seedream`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])]),a(E,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,sn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,cn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,un,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,dn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,fn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(h(),s(`div`,pn,[a(E,{closable:!1,class:`failure`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.failure`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,mn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,hn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,gn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,_n,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(h(),s(`p`,vn,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(T,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(h(),s(`p`,yn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,$,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,bn,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,xn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(h(),s(`p`,Sn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,tn,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,nn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var wn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:G(Wt,[[`render`,Cn],[`__scopeId`,`data-v-b0055abb`]]),BotPlaceholder:we,NoTasks:N,ScrollList:M},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:je,RecentPanel:G(wn,[[`render`,Dn]])},mixins:[ve],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===w.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 F({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(!ce(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;if(J(this.config?.model).imageRequired&&!this.config?.image?.length){T.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=Q(this.config);if(!me())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}T.info(this.$t(`seedream.message.startingTask`)),ue(`seedream`,le.generate(e,{token:t})).then(()=>{T.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?T.error(this.$t(`seedream.message.usedUp`)):T.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,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-BPmmsYsL.js";import{t as _}from"./upload-C1h3h1KN.js";import{t as v}from"./tooltip-DKF_sGto.js";import{t as y}from"./alert-BprQRUmf.js";import{h as b,v as x}from"./models-D6J60Ang.js";import{t as S}from"./clock-BRjX06BR.js";import{a as C,i as w,n as T,r as E,s as D,t as O}from"./pagination-D8oUwQ9k.js";import{t as k}from"./info-JrDUNc3f.js";import{t as A}from"./trash-2-Cf1lYl_N.js";import{t as j}from"./triangle-alert-_LVPy92s.js";import{t as M}from"./wand-sparkles-DNHHWq-f.js";import{cr as N}from"./constants-CX4j41GC.js";import{$t as ee,Di as te,Lr as P,O as F,Vi as I,Yt as L,an as R,en as z,er as B,mn as V,nn as H,pi as U,rn as W,tn as G}from"./index-DKnFv8oI.js";import{t as K}from"./CopyToClipboard-BMiCg7d2.js";import{t as q}from"./ReportButton-CuTsbpH1.js";import{t as J}from"./ImagePreview-ESZQ89R1.js";import{t as Y}from"./Consumption-Byk7yTVz.js";import{t as X}from"./VideoPlayer-B9ZoxGwN.js";import{t as Z}from"./ApiCodeButton-CiNqmFYp.js";import{t as Q}from"./BotPlaceholder-CDv27X3P.js";import{t as ne}from"./Hailuo-C2sgwciH.js";var re=m({name:`ModelSelector`,components:{ElSelect:h,ElOption:g},data(){return{}},computed:{options(){return[{value:`minimax-t2v`,label:this.$t(`hailuo.button.model1`)},{value:`minimax-i2v`,label:this.$t(`hailuo.button.model2`)},{value:`minimax-i2v-director`,label:this.$t(`hailuo.button.model3`)}]},value:{get(){return this.$store.state.hailuo?.config?.model},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,model:e})}}},mounted(){this.value||=N}}),ie={class:`field`},ae={class:`title font-bold`},oe={class:`float-left`};function se(t,n,r,o,m,h){let g=l(`el-option`),_=l(`el-select`);return p(),s(`div`,ie,[e(`h2`,ae,i(t.$t(`hailuo.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`hailuo.placeholder.select`),clearable:``},{default:d(()=>[(p(!0),s(c,null,f(t.options,t=>(p(),u(g,{key:t.value,label:t.label,value:t.value},{default:d(()=>[e(`span`,oe,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ce=F(re,[[`render`,se],[`__scopeId`,`data-v-a768fbd9`]]),le=m({name:`StartImageUrlInput`,components:{ElUpload:_,ElButton:I,InfoIcon:C,ImagePreview:J},mixins:[W,H,z,L],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.hailuo?.config?.first_image_url},set(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){x.warning(this.$t(`hailuo.message.uploadStartImageExceed`))},onError(){x.error(this.$t(`hailuo.message.uploadStartImageError`))},async onRemove(){x.error(this.$t(`hailuo.message.uploadStartImageError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),ue={class:`relative`},de={class:`flex justify-between`},fe={class:`flex justify-start items-center`},pe={class:`text-sm font-bold`};function me(t,n,c,f,m,h){let g=l(`info-icon`),_=l(`image-preview`),v=l(`el-button`),y=l(`el-upload`);return p(),s(`div`,ue,[e(`div`,de,[e(`div`,fe,[e(`span`,pe,i(t.$t(`hailuo.name.startImageUrl`)),1),a(g,{content:t.$t(`hailuo.description.startImageUrl`),class:`info`},null,8,[`content`])])]),a(y,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,"show-file-list":!0,limit:1,multiple:!1,"list-type":`picture`,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-remove":t.onRemove,"on-success":t.onSuccess,headers:t.headers},{file:d(({file:e})=>[e.url&&e.percentage!==void 0?(p(),u(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:d(()=>[a(v,{size:`small`,type:`primary`,class:`btn btn-upload`,round:``},{default:d(()=>[r(i(t.$t(`hailuo.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])])}var he=F(le,[[`render`,me],[`__scopeId`,`data-v-322d7e4c`]]),ge=m({name:`PromptInput`,components:{PromptTextarea:w},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function _e(e,t,n,r,i,a){let o=l(`prompt-textarea`);return p(),u(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`hailuo.name.prompt`),info:e.$t(`hailuo.description.prompt`),placeholder:e.$t(`hailuo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ve=m({name:`PresetPanel`,components:{MagicIcon:M,ElButton:I,PromptInput:F(ge,[[`render`,_e]]),StartImageUrlInput:he,ModelSelector:ce,Consumption:Y},emits:[`generate`],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return R(this.config,this.service?.cost)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),ye={class:`flex flex-col h-full`},be={class:`flex-1 overflow-y-auto p-5`},xe={class:`flex flex-col items-center justify-center px-5 pb-5`};function Se(t,n,c,f,m,h){let g=l(`prompt-input`),_=l(`model-selector`),v=l(`start-image-url-input`),y=l(`consumption`),b=l(`magic-icon`),x=l(`el-button`);return p(),s(`div`,ye,[e(`div`,be,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),t.config?.model===`minimax-i2v`?(p(),u(v,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,xe,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(p(),u(x,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:d(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`hailuo.button.extend`)),1)]),_:1},8,[`onClick`])):(p(),u(x,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:d(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`hailuo.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var Ce=F(ve,[[`render`,Se]]),we=m({name:`TaskPreview`,components:{DeleteIcon:A,ChannelIcon:D,InfoIcon:k,MagicIcon:M,TimeIcon:S,WarningIcon:j,CopyToClipboard:K,ElAlert:y,VideoPlayer:X,ElTooltip:v,ElButton:I,ApiCodeButton:Z,ReportButton:q},props:{modelValue:{type:Object,required:!0}},computed:{isFailure(){let e=this.modelValue?.response;return e?.success===!1||!!e?.error||this.video?.state===`failed`||this.video?.state===`cancelled`},isWaiting(){return!this.modelValue?.response||!this.isFailure&&[`queued`,`pending`,`processing`,`running`].includes(this.video?.state||``)},application(){return this.$store.state.hailuo?.application},config(){return this.$store.state.hailuo?.config},video(){return this.modelValue?.response?.data?.[0]}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await te.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(`hailuo/deleteTask`,{id:e}),x.success(this.$t(`common.message.deleteTaskSuccess`))}catch{x.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e){console.debug(`on download hailuo video`,e),window.open(e,`_blank`)}}}),Te={class:`preview`},Ee={class:`left`},De={class:`main`},Oe={class:`bot`},ke={class:`datetime`},Ae=[`aria-label`],je={class:`info`},Me={key:0,class:`prompt mt-2`},Ne={key:0},Pe={key:1},Fe={key:0,class:n({content:!0,failed:!0})},Ie={key:0,class:`mb-4`},Le={key:1,class:n({operations:!0,"mt-2":!0})},Re={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ze={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Be={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ve={key:1,class:n({content:!0})},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},He={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ue={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},We={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ge={key:2,class:n({content:!0})},Ke={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function qe(n,c,f,m,h,g){let _=l(`capability-presentation`),v=l(`delete-icon`),y=l(`el-tooltip`),b=l(`video-player`),x=l(`el-button`),S=l(`api-code-button`),C=l(`report-button`),w=l(`channel-icon`),T=l(`copy-to-clipboard`),E=l(`magic-icon`),D=l(`time-icon`),O=l(`el-alert`),k=l(`warning-icon`),A=l(`info-icon`);return p(),s(`div`,Te,[e(`div`,Ee,[a(_,{capability:`hailuo`,part:`avatar`,class:`avatar`})]),e(`div`,De,[e(`div`,Oe,[a(_,{capability:`hailuo`,part:`name`}),e(`span`,ke,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(y,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:d(()=>[n.modelValue?.id?(p(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(v,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Ae)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,je,[n.modelValue?.request?.prompt?(p(),s(`p`,Me,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(p(),s(`span`,Ne,` - (`+i(n.$t(`hailuo.status.pending`))+`) `,1)),n.modelValue?.response&&n.isWaiting?(p(),s(`span`,Pe,` - (`+i(n.$t(`hailuo.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0&&!n.isFailure&&!n.isWaiting?(p(),s(`div`,Fe,[n.video?.video_url?(p(),s(`div`,Ie,[a(b,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?(p(),s(`div`,Le,[a(y,{class:`box-item`,effect:`dark`,content:n.$t(`hailuo.message.downloadVideo`),placement:`top-start`},{default:d(()=>[n.video?.video_url?(p(),u(x,{key:0,type:`info`,size:`small`,class:`mb-2`,onClick:c[1]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:d(()=>[r(i(n.$t(`hailuo.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(S,{path:`/hailuo/videos`,body:n.modelValue?.request},null,8,[`body`]),a(C,{service:`hailuo`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(O,{closable:!1,class:`mt-2 success`},{default:d(()=>[n.modelValue?.request?.model?(p(),s(`p`,Re,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.model`))+`: `+i(n.modelValue?.request?.model)+` `,1),a(T,{content:n.modelValue?.id},null,8,[`content`])])):o(``,!0),e(`p`,ze,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(p(),s(`p`,Be,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.isFailure?(p(),s(`div`,Ve,[a(O,{closable:!1,class:`failure`},{template:d(()=>[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.failure`)),1)]),default:d(()=>[e(`p`,$,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,He,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(T,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(p(),s(`p`,Ue,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,We,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),n.isWaiting?(p(),s(`div`,Ge,[a(O,{closable:!1,class:`info`},{template:d(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`hailuo.status.processing`:`hailuo.status.pending`)),1)]),default:d(()=>[e(`p`,Ke,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var Je=m({name:`RecentPanel`,components:{TaskPreview:F(we,[[`render`,qe],[`__scopeId`,`data-v-f8835e7e`]]),BotPlaceholder:Q,NoTasks:E,ScrollList:T},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.hailuo?.tasks,items:this.$store.state.hailuo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Ye={key:0},Xe={key:2,class:`w-full h-full flex items-center justify-center`};function Ze(e,t,n,r,i,m){let h=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return p(),s(c,null,[e.tasks?.items===void 0?(p(),s(`div`,Ye,[a(h)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(p(),u(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:d(()=>[(p(!0),s(c,null,f(e.tasks?.items,e=>(p(),u(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(p(),s(`div`,Xe,[a(v)])):o(``,!0)],64)}var Qe=m({name:`HailuoIndex`,components:{ConfigPanel:Ce,Layout:ne,RecentPanel:F(Je,[[`render`,Ze]])},mixins:[G],inject:[`initialized`],data(){return{task:void 0,job:0,timer:void 0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.hailuo?.status?.getApplications===b.Request},tasksLoading(){return this.$store.state.hailuo?.status?.getTasks===b.Request||this.fetchingTasks},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},application(){return this.$store.state.hailuo.application},tasks(){return this.$store.state.hailuo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await O({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`hailuo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`hailuo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`hailuo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!ee(this.uploadTracker,e=>this.$t(e),e=>x.warning(e)))return;let e={...this.config,async:!0};if(!V())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}x.info(this.$t(`hailuo.message.startingTask`)),P(`hailuo`,B.generate(e,{token:t})).then(()=>{x.success(this.$t(`hailuo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?x.error(this.$t(`hailuo.message.usedUp`)):x.error(this.$t(`hailuo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function $e(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),f=l(`layout`);return p(),u(f,null,{config:d(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:d(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var et=F(Qe,[[`render`,$e]]);export{et as default};