@acedatacloud/nexior 3.380.3 → 3.380.4

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 (266) hide show
  1. package/dist/assets/{ApiCodeButton-CAQzrT4K.js → ApiCodeButton-DSt2Pz0O.js} +1 -1
  2. package/dist/assets/{ApiCodeDialog-LvzBskrJ.js → ApiCodeDialog-Byr4CPCS.js} +1 -1
  3. package/dist/assets/{Artifacts-BC-9S6PN.js → Artifacts-CwC_U4xA.js} +1 -1
  4. package/dist/assets/{AskUserQuestionCard-D7OS85bK.js → AskUserQuestionCard-D9fOfq80.js} +1 -1
  5. package/dist/assets/{AudioPreview-DQViM4FT.js → AudioPreview-DbtJFAs7.js} +1 -1
  6. package/dist/assets/{Auth-Df14yfuP.js → Auth-b-NGU3Lu.js} +1 -1
  7. package/dist/assets/{Bare-DzY0TQIE.js → Bare-D0G3hFJE.js} +1 -1
  8. package/dist/assets/{BotPlaceholder-BlCUdjzq.js → BotPlaceholder-BC8u-j84.js} +1 -1
  9. package/dist/assets/{BottomFooter-D3UQv_gV.js → BottomFooter-CXPg4oia.js} +1 -1
  10. package/dist/assets/{BrowseConnectors-DlJx58_J.js → BrowseConnectors-DS5nGp3i.js} +1 -1
  11. package/dist/assets/{BrowserPairingDialog-CW7vfPJR.js → BrowserPairingDialog-NeyovLD-.js} +1 -1
  12. package/dist/assets/{Callback-CNFgYm3T.js → Callback-DuZ9zjkR.js} +1 -1
  13. package/dist/assets/{CodeSnippet-C0eBeX2U.js → CodeSnippet-Djz4eOTz.js} +1 -1
  14. package/dist/assets/{Console-CAVioWhS.js → Console-DcLA9Qt3.js} +1 -1
  15. package/dist/assets/Conversation-BQ7kjoFg.js +2 -0
  16. package/dist/assets/{Conversation-D7nm4oS-.js → Conversation-O_Xv-6R6.js} +1 -1
  17. package/dist/assets/{Conversation-BHYltyL3.css → Conversation-myNal5UI.css} +1 -1
  18. package/dist/assets/{CopyToClipboard-BQaEPLyt.js → CopyToClipboard-CQT78wob.js} +1 -1
  19. package/dist/assets/{Detail-DD55uGpe.js → Detail-BqVKPO9C.js} +1 -1
  20. package/dist/assets/{Extra-CV4hv9OG.js → Extra-RTJPBXX1.js} +1 -1
  21. package/dist/assets/{FilePreview-BjUbMA7c.js → FilePreview-D640d7Cq.js} +1 -1
  22. package/dist/assets/{Hailuo-xFaz9TxD.js → Hailuo-ClYsc7Vc.js} +1 -1
  23. package/dist/assets/{History-D1zqqw7y.js → History-DeAIxtE9.js} +1 -1
  24. package/dist/assets/{ImagePreview-Dm16d0L7.js → ImagePreview-YXx0To-U.js} +1 -1
  25. package/dist/assets/{ImageWrapper-KvH_Kyox.js → ImageWrapper-DH6OlBWC.js} +1 -1
  26. package/dist/assets/{Index-fbMiNaKB.js → Index-3enMEt0q.js} +1 -1
  27. package/dist/assets/{Index-C18MzxuW.js → Index-4M6goWY5.js} +1 -1
  28. package/dist/assets/Index-7Lx1-FVY.js +88 -0
  29. package/dist/assets/{Index-Dmc0ZPfE.js → Index-B0S_YnIQ.js} +1 -1
  30. package/dist/assets/{Index-D-bh_mWQ.js → Index-B2mD07Ei.js} +1 -1
  31. package/dist/assets/{Index-DR-1kfGp.js → Index-B80CvBO0.js} +1 -1
  32. package/dist/assets/{Index-DlHoDKfg.js → Index-BDNNQGYY.js} +1 -1
  33. package/dist/assets/{Index-CqmNg2WZ.js → Index-BHOeQ3H9.js} +1 -1
  34. package/dist/assets/{Index-BoWt8dWh.js → Index-BRky2LVx.js} +1 -1
  35. package/dist/assets/{Index-CQE7c7Bs.js → Index-BjS0ggii.js} +1 -1
  36. package/dist/assets/{Index-C5CT7Ktv.js → Index-Bp-GjqgR.js} +1 -1
  37. package/dist/assets/{Index-DJVr7ydY.js → Index-CYJ4Mi3M.js} +1 -1
  38. package/dist/assets/{Index-CTaXbXmT.js → Index-Cc2vUCVA.js} +1 -1
  39. package/dist/assets/{Index-fTR2-Z-3.js → Index-Chg7-uHY.js} +1 -1
  40. package/dist/assets/{Index-BecIFcGo.js → Index-CjPN5GZr.js} +1 -1
  41. package/dist/assets/{Index-zjZ7CPr72.js → Index-CnknPEOW2.js} +1 -1
  42. package/dist/assets/{Index-BwfuDrJ9.js → Index-Cuw-pJ0I.js} +1 -1
  43. package/dist/assets/{Index-ex7Y1vY4.js → Index-CyKGM7MD.js} +1 -1
  44. package/dist/assets/{Index-BkbELH7_.js → Index-D0f6VCCu.js} +1 -1
  45. package/dist/assets/{Index-C1QW_CFl.js → Index-DK07tGm1.js} +1 -1
  46. package/dist/assets/{Index-BucEDFrW.css → Index-DOv21tLH.css} +1 -1
  47. package/dist/assets/{Index-DVXw0pwb.js → Index-DTFPAlsp.js} +1 -1
  48. package/dist/assets/{Index-DvGsYLo7.js → Index-De1b43q9.js} +1 -1
  49. package/dist/assets/{Index-T0_cSwPH.js → Index-DeE_gyAr.js} +1 -1
  50. package/dist/assets/{Index-8by4vnko.js → Index-DjMjXRYa.js} +1 -1
  51. package/dist/assets/{Index-CjVzRlMN.js → Index-DqwY22ln.js} +1 -1
  52. package/dist/assets/{Index-7QD2V3wg.js → Index-Dx52UhVA.js} +1 -1
  53. package/dist/assets/{Index-BPAo6_jC.js → Index-GUuys43B.js} +1 -1
  54. package/dist/assets/{Index-DOU9VNl0.js → Index-Mw1xrmbA.js} +1 -1
  55. package/dist/assets/{Index-CxqeZIDT.js → Index-NwESkz1G.js} +1 -1
  56. package/dist/assets/{Index-COJPpNNU.js → Index-VvE544ki.js} +1 -1
  57. package/dist/assets/{Index-jn2z6JP9.js → Index-eXdcllSH.js} +1 -1
  58. package/dist/assets/{Index-1ZGPMaND.js → Index-eY2m4uYt.js} +1 -1
  59. package/dist/assets/{Index-eMf5-MRc.js → Index-jZMrIwYv.js} +1 -1
  60. package/dist/assets/{Index-tjXScQUo.js → Index-uAG9GoTD.js} +1 -1
  61. package/dist/assets/{Index-B4GT4puq.js → Index-uBZSGiEh.js} +1 -1
  62. package/dist/assets/{Index-Bk546k4m.js → Index-uemFTdfN.js} +1 -1
  63. package/dist/assets/{Invitees-tBHppasN.js → Invitees-DJE7UMCL.js} +1 -1
  64. package/dist/assets/{List-ObMnOLL-.js → List-B8wHqSvA.js} +1 -1
  65. package/dist/assets/{List-CEnfs31Y.js → List-DlT9iEAG.js} +1 -1
  66. package/dist/assets/{List-B12lnQg5.js → List-MtsKWkKG.js} +1 -1
  67. package/dist/assets/{LocalTools-DyjoYQ4h.js → LocalTools-C5elVqih.js} +1 -1
  68. package/dist/assets/{LocalTools-CVbTpoYn.js → LocalTools-DlPjqmJb.js} +1 -1
  69. package/dist/assets/{Logo-DmgrIDIl.js → Logo-BRsMoZUf.js} +1 -1
  70. package/dist/assets/{Main-D1Gr1FHA.js → Main-DkcDWNRf.js} +1 -1
  71. package/dist/assets/{Message-Db6-S5sM.js → Message-TyAQUCUU.js} +1 -1
  72. package/dist/assets/{Model-C8RNsnbd.js → Model-DZqCeCtl.js} +1 -1
  73. package/dist/assets/{Navigator-Nfj8gArg.js → Navigator-DJR1Vv92.js} +3 -3
  74. package/dist/assets/{NotFound-D-CoxUw9.js → NotFound-DCPalElg.js} +1 -1
  75. package/dist/assets/{PageHeader-CNpwb3CV.js → PageHeader-DF-zuRdB.js} +1 -1
  76. package/dist/assets/{Pay-BI2Q9Jyg.js → Pay-5sKP-5mn.js} +1 -1
  77. package/dist/assets/{Player-DpnDR3pi.js → Player-BofEgCOB.js} +1 -1
  78. package/dist/assets/{Poivelle-BSP4AAyK.js → Poivelle-nb8MW5Qx.js} +1 -1
  79. package/dist/assets/{RealtimeCall-B2L27PB_.js → RealtimeCall-C9IB8DsU.js} +1 -1
  80. package/dist/assets/{ReportButton-BAx8pia_.js → ReportButton-B6G5OWJ0.js} +1 -1
  81. package/dist/assets/{ReportDialog-CE_HdnOJ.js → ReportDialog-C8ssbL5B.js} +1 -1
  82. package/dist/assets/{ScenarioPaymentMode-C2uR8lvu.js → ScenarioPaymentMode-DRMdqOm9.js} +1 -1
  83. package/dist/assets/{ScheduledTasks-BLT-jdpt.js → ScheduledTasks-BjZ3cZyb.js} +1 -1
  84. package/dist/assets/{ServicePricingSummary-DPzfamaB.js → ServicePricingSummary-rLPlqY7R.js} +1 -1
  85. package/dist/assets/{SharedMarkdown-0ELGv4ui.js → SharedMarkdown-BmNuEnIj.js} +1 -1
  86. package/dist/assets/{ShowcaseGrid-XqUFFvtm.js → ShowcaseGrid-DOcNBb0W.js} +1 -1
  87. package/dist/assets/{ShowcaseResultTabs-DEfMzemw.js → ShowcaseResultTabs-CS9fv2h_.js} +1 -1
  88. package/dist/assets/{SolanaWalletPickerDialog-YgC0eQsl.js → SolanaWalletPickerDialog-zxd6nO8P.js} +1 -1
  89. package/dist/assets/{Status-DKf5Jsod.js → Status-Pg6vKJcY.js} +1 -1
  90. package/dist/assets/{Subscribe-CkkGJTnx.js → Subscribe-C5hDRcCw.js} +1 -1
  91. package/dist/assets/{TabSwitcher-CfjEN161.js → TabSwitcher-VfoHJIjb.js} +1 -1
  92. package/dist/assets/{Tts-D1u48--B.js → Tts-BaBl3ymq.js} +1 -1
  93. package/dist/assets/{VideoPlayer-Cdtv4baV.js → VideoPlayer-DuUSbT-p.js} +1 -1
  94. package/dist/assets/{VideoPreview-D3jWNNx1.js → VideoPreview-DiHzfmhx.js} +1 -1
  95. package/dist/assets/{VueMarkdown-CQ26Rk6o.js → VueMarkdown-DX3n2_s6.js} +2 -2
  96. package/dist/assets/{WriteSkillDialog-Dli1HaFr.js → WriteSkillDialog-B4lxIDJK.js} +1 -1
  97. package/dist/assets/{airwallexCheckout-BOMCtt32.js → airwallexCheckout-DImF7qWM.js} +1 -1
  98. package/dist/assets/arrow-down-B7gY3qc0.js +1 -0
  99. package/dist/assets/arrow-left-D9PzI6lU.js +1 -0
  100. package/dist/assets/arrow-right-BZVVykF9.js +1 -0
  101. package/dist/assets/arrow-up-vjX6ESSZ.js +1 -0
  102. package/dist/assets/{authorizeFlow-BMC9h_3t.js → authorizeFlow-iv3I40NA.js} +1 -1
  103. package/dist/assets/{avatar-BsnEjqLw.js → avatar-Bk-KlfGF.js} +1 -1
  104. package/dist/assets/{back-navigation-DPa7442X.js → back-navigation-DCnyH9QK.js} +1 -1
  105. package/dist/assets/{basic-p_zsFmA2.js → basic-DhRe680f.js} +1 -1
  106. package/dist/assets/{book-open-CpRGukR7.js → book-open-EQsOnwpQ.js} +1 -1
  107. package/dist/assets/{box-CGOU4lJt.js → box-Eq7xsVMG.js} +1 -1
  108. package/dist/assets/{boxes-32lkEX3G.js → boxes-_p2gozxH.js} +1 -1
  109. package/dist/assets/{brain-CEopvMNh.js → brain-B3HPVkyt.js} +1 -1
  110. package/dist/assets/{chart-no-axes-combined-tiBL2Ggm.js → chart-no-axes-combined-wCOmZXlo.js} +1 -1
  111. package/dist/assets/{chat-g6sUFB58.js → chat-DlJM5HiQ.js} +1 -1
  112. package/dist/assets/check-DEuTU4c8.js +1 -0
  113. package/dist/assets/chevron-down-CCvMOkAm.js +1 -0
  114. package/dist/assets/chevron-right-CMN7EUPl.js +1 -0
  115. package/dist/assets/{circle-alert-CXkPdq0D.js → circle-alert-CudS64vb.js} +1 -1
  116. package/dist/assets/circle-check-BzGCItgQ.js +1 -0
  117. package/dist/assets/{circle-question-mark-CVOAxMdj.js → circle-question-mark-CT3dP_S-.js} +1 -1
  118. package/dist/assets/{clipboard-list-Dze8SlYc.js → clipboard-list-rh0gR3f-.js} +1 -1
  119. package/dist/assets/clock-BooSG6zB.js +1 -0
  120. package/dist/assets/code-DyNs0diY.js +1 -0
  121. package/dist/assets/{codingBridge-y6RP64MI.js → codingBridge-D5m47vOt.js} +1 -1
  122. package/dist/assets/{codingBridgeNotify-U3RuiX2r.js → codingBridgeNotify-C68uE2gS.js} +2 -2
  123. package/dist/assets/{coins-dxsmnq-4.js → coins-8GLEA8kx.js} +1 -1
  124. package/dist/assets/{copy-DnKHOq1a.js → copy-BIXUZXhN.js} +1 -1
  125. package/dist/assets/{createTaskActions-B2GAm9bk.js → createTaskActions-Bz2OI0ye.js} +1 -1
  126. package/dist/assets/{date-picker-bOwyWLdL.js → date-picker-qwrQLSa0.js} +1 -1
  127. package/dist/assets/{digitalhuman-DEbD6hPM.js → digitalhuman-EWWLamU7.js} +1 -1
  128. package/dist/assets/{dollar-sign-BLWNTUv9.js → dollar-sign-3CctSein.js} +1 -1
  129. package/dist/assets/{download-BCOklSE_.js → download-0mLTP8WQ.js} +1 -1
  130. package/dist/assets/{drawer-CvX2U8ly.js → drawer-APcI0MuL.js} +1 -1
  131. package/dist/assets/{dropdown-DPKXaIsL.js → dropdown-BZ5uH0eb.js} +1 -1
  132. package/dist/assets/{dropdown-XCwzKYm5.js → dropdown-C1V-gXTG.js} +1 -1
  133. package/dist/assets/{ellipsis-DPB3bXTW.js → ellipsis-DaK_tv_8.js} +1 -1
  134. package/dist/assets/{esm-CyHOLycc.js → esm-CwuiP5gS.js} +2 -2
  135. package/dist/assets/esm-Czt26omG.js +1 -0
  136. package/dist/assets/{esm-UoEBYxr0.js → esm-DDwto2T_.js} +2 -2
  137. package/dist/assets/{external-link-BZpZYYUS.js → external-link-GS6joyO2.js} +1 -1
  138. package/dist/assets/{eye-BhdeJEHm.js → eye-BjqPsB38.js} +1 -1
  139. package/dist/assets/{file-BEBKIB3d.js → file-DN0Fq1Cv.js} +1 -1
  140. package/dist/assets/{file-output-Wrne3aLm.js → file-output-CYRVDW3O.js} +1 -1
  141. package/dist/assets/{file-text-BXNggY_W.js → file-text-DLwLkvbZ.js} +1 -1
  142. package/dist/assets/{fish-VuGOhXsW.js → fish-CuUidYqW.js} +1 -1
  143. package/dist/assets/{flux-BPC7XmH0.js → flux-CkT5DOwc.js} +1 -1
  144. package/dist/assets/{folder-l95IzSNw.js → folder-DGjP5SDg.js} +1 -1
  145. package/dist/assets/gauge-DRD3bzzD.js +1 -0
  146. package/dist/assets/{globe-CSktj64F.js → globe-CfmQv6dc.js} +1 -1
  147. package/dist/assets/{grokvideo-DTBgLS47.js → grokvideo-jylBR3ej.js} +1 -1
  148. package/dist/assets/{hailuo-BVUhC8lk.js → hailuo-DaQVZPNi.js} +1 -1
  149. package/dist/assets/{hash-CRnccwx_.js → hash-GTQkcsQj.js} +1 -1
  150. package/dist/assets/{headphones-DoG13pCL.js → headphones-B8VUrUji.js} +1 -1
  151. package/dist/assets/{history-BHl5ASZC.js → history-BENBo59s.js} +1 -1
  152. package/dist/assets/{house-DNNF-zQb.js → house-WEmC14W_.js} +1 -1
  153. package/dist/assets/{image-2jgf6twa.js → image-BEbYTJ0m.js} +1 -1
  154. package/dist/assets/{index-BYbC-2BV.js → index-Dr2ooWnm.js} +4 -4
  155. package/dist/assets/{index.es-DFqTR-gs.js → index.es-BADyL8Or.js} +1 -1
  156. package/dist/assets/{info-Bqj02p3r.js → info-PmX6OJ8X.js} +1 -1
  157. package/dist/assets/{input-number-BecdXhq4.js → input-number-CQyq1gfs.js} +1 -1
  158. package/dist/assets/{kling-C9azn2UB.js → kling-CSMDk42y.js} +1 -1
  159. package/dist/assets/{languages-Bn9-XqQr.js → languages-D0-qojfd.js} +1 -1
  160. package/dist/assets/{laptop-C_0NyrMl.js → laptop-CiCND6PE.js} +1 -1
  161. package/dist/assets/{lightbulb-C9MU_4ds.js → lightbulb-rCoLSMOl.js} +1 -1
  162. package/dist/assets/{link-CYbuO3R8.js → link-DfdSHXXz.js} +1 -1
  163. package/dist/assets/loader-circle-DlDNc4da.js +1 -0
  164. package/dist/assets/{luma-BtitSxad.js → luma-BnxSbH2s.js} +1 -1
  165. package/dist/assets/{maestro-Cmd5jQVR.js → maestro-C3qz5VUl.js} +1 -1
  166. package/dist/assets/{mail-BJofA_Qf.js → mail-LZDXgeS8.js} +1 -1
  167. package/dist/assets/{message-circle-CKGmdIMI.js → message-circle-VRo45xNQ.js} +1 -1
  168. package/dist/assets/{mic-Ci4tIrSN.js → mic-x3pAaagI.js} +1 -1
  169. package/dist/assets/{midjourney-BQZo_d2M.js → midjourney-DiDJ_NAX.js} +1 -1
  170. package/dist/assets/{minimax-DsdxWCjq.js → minimax-CezIM2Vc.js} +1 -1
  171. package/dist/assets/{mobileLocalExec-Dwqc6v0t.js → mobileLocalExec-Ba06Ginw.js} +2 -2
  172. package/dist/assets/{monitor-CPFxk1wZ.js → monitor-f-HdAnII.js} +1 -1
  173. package/dist/assets/{mouse-pointer-2-B08HzOwW.js → mouse-pointer-2-D28_tEOD.js} +1 -1
  174. package/dist/assets/music-2-DimqlZ0P.js +1 -0
  175. package/dist/assets/{nanobanana-CJ9wJoGd.js → nanobanana-C47zn35Q.js} +1 -1
  176. package/dist/assets/{omni-C-SLGStU.js → omni-BRhJ9p2L.js} +1 -1
  177. package/dist/assets/{openaiimage-D5MNRqg3.js → openaiimage-DN5cekWI.js} +1 -1
  178. package/dist/assets/{pagination-io6RYkJR.js → pagination-CkelWLyU.js} +1 -1
  179. package/dist/assets/{pagination-CYVcmJmV.js → pagination-RVZs5Fps.js} +1 -1
  180. package/dist/assets/{pagination-VjpfotZ8.js → pagination-W-HQ78h5.js} +1 -1
  181. package/dist/assets/{palette-SWZNaMAh.js → palette-Bnao4N1E.js} +1 -1
  182. package/dist/assets/{paperclip-CoovJMXo.js → paperclip-BIrljPlV.js} +1 -1
  183. package/dist/assets/{pause-B7eeiCnH.js → pause-B1oVLxPW.js} +1 -1
  184. package/dist/assets/{pencil-f21Vtqty.js → pencil-tfoCLZ10.js} +1 -1
  185. package/dist/assets/{pika-CsHCQJSE.js → pika-oMB8We5G.js} +1 -1
  186. package/dist/assets/{pixverse-CyDxwFeI.js → pixverse-CrjkStpM.js} +1 -1
  187. package/dist/assets/play-CKD5ICgk.js +1 -0
  188. package/dist/assets/{plug-Dg_9VErH.js → plug-CneJpKAI.js} +1 -1
  189. package/dist/assets/plus-B_fnUe1I.js +1 -0
  190. package/dist/assets/{poivelle-C0zLhGUa.js → poivelle-aDT78zU0.js} +1 -1
  191. package/dist/assets/{popover-BBskEwZL.js → popover-CdWXDZ4Y.js} +1 -1
  192. package/dist/assets/{producer-9b3QkEP1.js → producer-Cmo7xf9M.js} +1 -1
  193. package/dist/assets/{qrart-CtfMNq1M.js → qrart-PjwpBvHh.js} +1 -1
  194. package/dist/assets/{qwenimage-BTvJJiDf.js → qwenimage-DiCadgpU.js} +1 -1
  195. package/dist/assets/{realtime-Dd7fkm3x.js → realtime-cKmm03Gk.js} +1 -1
  196. package/dist/assets/{refresh-cw-Cr7yuII3.js → refresh-cw-Bx7-OW-L.js} +1 -1
  197. package/dist/assets/rotate-ccw-DxSDeWPl.js +1 -0
  198. package/dist/assets/rotate-cw-ZIUqlSwU.js +1 -0
  199. package/dist/assets/{scheduledTasks-CrtGggKP.js → scheduledTasks-DfyCRMUo.js} +1 -1
  200. package/dist/assets/{scroll-text-WT63idaP.js → scroll-text-BznQ-upq.js} +1 -1
  201. package/dist/assets/search-CgyxhhlQ.js +1 -0
  202. package/dist/assets/{seedance-tUqFe83z.js → seedance-B5iHVffg.js} +1 -1
  203. package/dist/assets/{seedream-CuoLy1o8.js → seedream-BUCCanJU.js} +1 -1
  204. package/dist/assets/{select-CxPN3D9u.js → select-GALwUZll.js} +1 -1
  205. package/dist/assets/{serp-D6lCOvz4.js → serp-ByhpOEFk.js} +1 -1
  206. package/dist/assets/{shield-CK7NS6Gf.js → shield-zOrEMlZR.js} +1 -1
  207. package/dist/assets/{showcase-D6Og0HHm.js → showcase-ClAsok_u.js} +1 -1
  208. package/dist/assets/{showcaseRecreateMixin-BEyu8Djp.js → showcaseRecreateMixin-Dhdr3T0y.js} +1 -1
  209. package/dist/assets/{shuffle-DpfFdEcH.js → shuffle-Bsn1YQVr.js} +1 -1
  210. package/dist/assets/{siteHome-3TZFCcij.js → siteHome-DOZxDTUA.js} +1 -1
  211. package/dist/assets/{slider-DNzVAHfq.js → slider-C8pY6U4o.js} +1 -1
  212. package/dist/assets/{solana-wallets-DzzoQdIQ.js → solana-wallets-Cib8AJ2S.js} +2 -2
  213. package/dist/assets/{sora-BxwK55Oy.js → sora-8X-omnaE.js} +1 -1
  214. package/dist/assets/{sparkles-Bj8vdW1Y.js → sparkles-C1bLa319.js} +1 -1
  215. package/dist/assets/square-CT3nJzJZ.js +1 -0
  216. package/dist/assets/{suno-DNbz_RKF.js → suno-DoUkooAP.js} +1 -1
  217. package/dist/assets/{switch-CpihU-Bq.js → switch-4nC3Yz4b.js} +1 -1
  218. package/dist/assets/{table-BQFx3k1H.js → table-CHg1iLS7.js} +1 -1
  219. package/dist/assets/{tag-_vZb-8xx.js → tag-ILhm5hh0.js} +1 -1
  220. package/dist/assets/{taskPolling-9csjvORN.js → taskPolling-DfRWd0Q5.js} +1 -1
  221. package/dist/assets/terminal-B0UFZK-h.js +1 -0
  222. package/dist/assets/{time-picker-RtWvk_sa.js → time-picker-DqmuplAb.js} +1 -1
  223. package/dist/assets/{tooltip-B60Iasgv.js → tooltip-4w7ghPQM.js} +1 -1
  224. package/dist/assets/{trash-2-BBCXfu0p.js → trash-2-BkEkcSHv.js} +1 -1
  225. package/dist/assets/{triangle-alert-BRov4JmE.js → triangle-alert-DBmpuUlm.js} +1 -1
  226. package/dist/assets/{upload-D3ICVrNB.js → upload-DidTvyIg.js} +1 -1
  227. package/dist/assets/user-D8eTVZ1t.js +1 -0
  228. package/dist/assets/{veo-DkZy7hTq.js → veo-BooE6Coe.js} +1 -1
  229. package/dist/assets/{video-CDFVAtyn.js → video-DwVV0C_d.js} +1 -1
  230. package/dist/assets/{volume-2-B06KZpAy.js → volume-2-CpkYjlNM.js} +1 -1
  231. package/dist/assets/{wallet-C2_hOWbL.js → wallet-CSEdeUVb.js} +1 -1
  232. package/dist/assets/{wan-QRuyJPFu.js → wan-NceqaOX8.js} +1 -1
  233. package/dist/assets/{wand-sparkles-D8Xtkkgr.js → wand-sparkles-CwgjO5Gl.js} +1 -1
  234. package/dist/assets/{web-BUdzeUVv.js → web-Be7eYSTS.js} +1 -1
  235. package/dist/assets/{web-JP1HvmQN.js → web-ChTQtMOV.js} +1 -1
  236. package/dist/assets/{web-CY-888ED.js → web-CtwYyIHk.js} +1 -1
  237. package/dist/assets/{web-DaBEVlWo.js → web-DR1td9xt.js} +1 -1
  238. package/dist/assets/{web-BYJbjRYk.js → web-DYYogIAJ.js} +1 -1
  239. package/dist/assets/{webextrator-CW6y2mdz.js → webextrator-DcBVygf6.js} +1 -1
  240. package/dist/assets/{zap-D2PJQZbU.js → zap-5TJ16_7J.js} +1 -1
  241. package/dist/index.html +1 -1
  242. package/package.json +1 -1
  243. package/dist/assets/Conversation-DQ5RmRdb.js +0 -2
  244. package/dist/assets/Index-Dn3EoEQQ.js +0 -88
  245. package/dist/assets/arrow-down-B6_R0HuI.js +0 -1
  246. package/dist/assets/arrow-left-BJOpEVmr.js +0 -1
  247. package/dist/assets/arrow-right-COdHSgP-.js +0 -1
  248. package/dist/assets/arrow-up-3YBgb0Kr.js +0 -1
  249. package/dist/assets/check-C0uK_-Ji.js +0 -1
  250. package/dist/assets/chevron-down-BIqc6Sh0.js +0 -1
  251. package/dist/assets/chevron-right-CewUT0fp.js +0 -1
  252. package/dist/assets/circle-check-GRq8kiSg.js +0 -1
  253. package/dist/assets/clock-BRqsgYwQ.js +0 -1
  254. package/dist/assets/code-DoM9goq2.js +0 -1
  255. package/dist/assets/esm-CCt2cEvm.js +0 -1
  256. package/dist/assets/gauge-Ncwvr6wi.js +0 -1
  257. package/dist/assets/loader-circle-BBOOwaos.js +0 -1
  258. package/dist/assets/music-2-DXzd8a9x.js +0 -1
  259. package/dist/assets/play-D8gxtxAY.js +0 -1
  260. package/dist/assets/plus-BMzVPasG.js +0 -1
  261. package/dist/assets/rotate-ccw-DLsc8rAo.js +0 -1
  262. package/dist/assets/rotate-cw-1vYEmZtB.js +0 -1
  263. package/dist/assets/search-CTbEtirV.js +0 -1
  264. package/dist/assets/square-C64WmG3-.js +0 -1
  265. package/dist/assets/terminal-Clq9LUIa.js +0 -1
  266. package/dist/assets/user-D8RgR1_m.js +0 -1
@@ -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-CxPN3D9u.js";import{t as x}from"./upload-Sju4DbiY.js";import{t as S}from"./tooltip-B60Iasgv.js";import{t as C}from"./alert-BprQRUmf.js";import{_ as w,v as T}from"./vuex.esm-bundler-BV9tXD4i.js";import{t as E}from"./drawer-CvX2U8ly.js";import{t as D}from"./input-number-BecdXhq4.js";import{t as O}from"./switch-CpihU-Bq.js";import{t as k}from"./box-CGOU4lJt.js";import{t as A}from"./clock-BRqsgYwQ.js";import{t as j}from"./hash-CRnccwx_.js";import{t as M}from"./image-2jgf6twa.js";import{t as N}from"./info-Bqj02p3r.js";import{a as P,i as F,n as I,r as ee,t as te}from"./pagination-VjpfotZ8.js";import{t as ne}from"./trash-2-BBCXfu0p.js";import{t as re}from"./triangle-alert-BRov4JmE.js";import{t as ie}from"./upload-D3ICVrNB.js";import{t as L}from"./wand-sparkles-D8Xtkkgr.js";import{t as ae}from"./zap-D2PJQZbU.js";import{Bn as R,Fn as z,In as oe,Ln as se,Mn as B,Nn as ce,Pn as V,jn as H,kn as U,zn as W}from"./constants-GmVIn7tC.js";import{D as G,Na as le,Qa as K,T as ue,Tn as de,Xn as fe,at as pe,ct as me,lt as he,ot as ge,qi as _e,st as ve,ta as ye,tt as be,za as q}from"./index-BYbC-2BV.js";import{t as xe}from"./CopyToClipboard-BQaEPLyt.js";import{t as Se}from"./ReportButton-BAx8pia_.js";import{t as J}from"./ImagePreview-Dm16d0L7.js";import{n as Ce}from"./taskDrawerMixin-DyAUhFEq.js";import{t as we}from"./ServicePricingSummary-DPzfamaB.js";import{t as Te}from"./ApiCodeButton-CAQzrT4K.js";import{t as Ee}from"./BotPlaceholder-BlCUdjzq.js";import{t as De}from"./taskPollingMixin-CcLxtz8z.js";import{t as Oe}from"./ShowcaseResultTabs-DEfMzemw.js";import{t as ke}from"./showcaseRecreateMixin-BEyu8Djp.js";import{n as Ae,t as je}from"./generationInput--J_4Niw5.js";import{t as Me}from"./ImageWrapper-KvH_Kyox.js";var Ne=_({name:`LayoutSeedream`,components:{MagicIcon:L,ElDrawer:E,ElButton:K},mixins:[Ce]}),Pe={class:`main flex flex-row flex-1`},Fe={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ie={class:`result h-full p-4 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Le(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,Pe,[e(`div`,Fe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ie,[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 Re=G(Ne,[[`render`,Le],[`__scopeId`,`data-v-fa2db192`]]),ze=_({name:`SeedreamPromptInput`,components:{PromptTextarea:F},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 Be(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 Ve=G(ze,[[`render`,Be]]),He={image:!0,imageRequired:!1,maxInputImages:14,sizeTiers:[`1K`,`2K`,`4K`],sizePixel:!0,sizeAdaptive:!1,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,webSearch:!1,promptOptimization:[],layerDecomposition:!1,transparentBackground:!1};function Y(e){switch(e){case z:return{image:!0,imageRequired:!1,maxInputImages:10,sizeTiers:[`1K`,W,`2K`],sizePixel:!0,sizeAdaptive:!1,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,webSearch:!1,promptOptimization:[`standard`,`fast`],layerDecomposition:!0,transparentBackground:!0};case V:case ce:return{image:!0,imageRequired:!1,maxInputImages:14,sizeTiers:[`2K`,`3K`,`4K`],sizePixel:!0,sizeAdaptive:!1,sizePixelDefault:void 0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,webSearch:!0,promptOptimization:[`standard`],layerDecomposition:!1,transparentBackground:!1};case B:return{image:!0,imageRequired:!1,maxInputImages:14,sizeTiers:[`2K`,`4K`],sizePixel:!0,sizeAdaptive:!1,sizePixelDefault:void 0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,webSearch:!1,promptOptimization:[`standard`],layerDecomposition:!1,transparentBackground:!1};case H:return{image:!0,imageRequired:!1,maxInputImages:14,sizeTiers:[`1K`,`2K`,`4K`],sizePixel:!0,sizeAdaptive:!1,sizePixelDefault:void 0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,webSearch:!1,promptOptimization:[`standard`,`fast`],layerDecomposition:!1,transparentBackground:!1};default:return He}}function Ue(e,t){return t?.length?`edit`:`generate`}var We=[`1K`,W,`2K`,`3K`,`4K`];function X(e,t){if(!e)return[];let n=Y(t.model??e.model),r=[],i=typeof e.size==`string`?e.size:void 0;Array.isArray(e.image)&&e.image.length>n.maxInputImages&&r.push({field:`image`,i18nLabel:`seedream.name.imageUrls`}),i&&(i===`adaptive`||We.includes(i)&&!n.sizeTiers.includes(i))&&r.push({field:`size`,i18nLabel:`seedream.name.size`}),e.sequential_image_generation===`auto`&&!n.groupGeneration&&r.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&r.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&r.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!n.outputFormat&&r.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),e.tools?.length&&!n.webSearch&&r.push({field:`tools`,i18nLabel:`seedream.name.webSearch`});let a=e.optimize_prompt_options?.mode;return a&&!n.promptOptimization.includes(a)&&r.push({field:`optimize_prompt_options`,i18nLabel:`seedream.name.promptOptimization`}),e.layer_decomposition&&!n.layerDecomposition&&r.push({field:`layer_decomposition`,i18nLabel:`seedream.name.layerDecomposition`}),e.background&&!n.transparentBackground&&r.push({field:`background`,i18nLabel:`seedream.name.background`}),r}function Z(e,t,n){let r={...e};for(let e of t)switch(e.field){case`image`:r.image=(r.image||[]).slice(0,Y(r.model).maxInputImages);break;case`size`:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:case`guidance_scale`:case`output_format`:case`tools`:case`optimize_prompt_options`:case`layer_decomposition`:case`background`:delete r[e.field];break}return r}var Ge=_({name:`SeedreamImageInput`,components:{UploadIcon:ie,ElUpload:x,ElButton:K,InfoIcon:P,ImagePreview:J},mixins:[he,me,ge,be],data(){return{fileList:[],uploadUrl:le()+`/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(){let e=this.$store.state.seedream?.config?.image;return typeof e==`string`?[e]:Array.isArray(e)?e:void 0},model(){return this.$store.state.seedream?.config?.model},supported(){return Y(this.model).image},limit(){return(this.$store.state.seedream?.config||{}).layer_decomposition?1:Y(this.model).maxInputImages}},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`,{count:this.limit}))},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()}}}),Ke={key:0},qe={class:`field`},Je={class:`label`},Ye={class:`box`},Xe={class:`title font-bold`},Ze={class:`value`},Qe={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function $e(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`,Ke,[e(`div`,qe,[e(`div`,Je,[e(`div`,Ye,[e(`h2`,Xe,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Ze,[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:t.limit,multiple:t.limit>1,"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`,`limit`,`multiple`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,Qe,[(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 et=G(Ge,[[`render`,$e],[`__scopeId`,`data-v-500d9564`]]),tt=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},data(){return{revertKey:0,options:[{value:z,label:this.$t(`seedream.model.seedream50pro`)},{value:V,label:this.$t(`seedream.model.seedream50`)},{value:B,label:this.$t(`seedream.model.seedream45`)},{value:H,label:this.$t(`seedream.model.seedream40`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){let e=this.value===`doubao-seedream-5-0-260128`?V:this.value;if(e&&this.options.some(t=>t.value===e)){e!==this.value&&this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e});return}let t={...this.$store.state.seedream?.config||{},model:U},n=X(t,{model:U});this.$store.commit(`seedream/setConfig`,Z(t,n,{model:U}))},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 q.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})}}}),nt={class:`field`},rt={class:`label`},it={class:`box`},at={class:`title font-bold`};function ot(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,nt,[e(`div`,rt,[e(`div`,it,[e(`h2`,at,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 st=G(tt,[[`render`,ot],[`__scopeId`,`data-v-dd2c4aee`]]),ct=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:P},data(){return{allPixelOptions:se}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Y(this.model)},pixelOptions(){let e=this.model===`doubao-seedream-5-0-lite-260128`||this.model===`doubao-seedream-5-0-260128`||this.model===`doubao-seedream-4-5-251128`?3686400:921600;return this.allPixelOptions.filter(t=>{let[n,r]=t.value.split(`x`).map(Number);return n*r>=e})},layerDecomposition(){return this.$store.state.seedream?.config?.layer_decomposition===!0},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)}}}}),lt={class:`field`},ut={class:`label`},dt={class:`box`},ft={class:`title font-bold`};function pt(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`,lt,[e(`div`,ut,[e(`div`,dt,[e(`h2`,ft,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)),t.layerDecomposition?(h(),f(v,{key:0,label:`AUTO`,value:`auto`})):o(``,!0)]),_: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 mt=G(ct,[[`render`,pt],[`__scopeId`,`data-v-810b7ca9`]]),ht=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:D,InfoIcon:P},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Y(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)}}}),gt={key:0,class:`field`},_t={class:`label`},vt={class:`box`},yt={class:`title font-bold`},bt={class:`value`};function xt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,gt,[e(`div`,_t,[e(`div`,vt,[e(`h2`,yt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,bt,[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 St=G(ht,[[`render`,xt],[`__scopeId`,`data-v-f079fd20`]]),Ct=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},data(){return{options:[...oe]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Y(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)}}}}),wt={key:0,class:`field`},Tt={class:`label`},Et={class:`box`},Dt={class:`title font-bold`};function Ot(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,wt,[e(`div`,Tt,[e(`div`,Et,[e(`h2`,Dt,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 kt=G(Ct,[[`render`,Ot],[`__scopeId`,`data-v-69ea4c07`]]),At=_({name:`SeedreamAdvancedOptions`,components:{ElOption:b,ElSelect:y,ElSwitch:O},computed:{config(){return this.$store.state.seedream?.config||{}},capabilities(){return Y(this.config.model)},hasSingleImage(){return Array.isArray(this.config.image)&&this.config.image.length===1},mode:{get(){return this.config.layer_decomposition?`layers`:`image`},set(e){let t={...this.config};e===`layers`?(t.layer_decomposition=!0,t.image=(t.image||[]).slice(0,1),t.size=`auto`,delete t.background,delete t.sequential_image_generation,delete t.sequential_image_generation_options,delete t.tools):(delete t.layer_decomposition,t.size===`auto`&&delete t.size),this.$store.commit(`seedream/setConfig`,t)}},background:{get(){return this.config.background},set(e){let t={...this.config,background:e};e===`transparent`&&(t.output_format=`png`),e||delete t.background,this.$store.commit(`seedream/setConfig`,t)}},promptOptimization:{get(){return this.config.optimize_prompt_options?.mode},set(e){let t={...this.config};e?t.optimize_prompt_options={mode:e}:delete t.optimize_prompt_options,this.$store.commit(`seedream/setConfig`,t)}},webSearch:{get(){return this.config.tools?.some(e=>e?.type===`web_search`)===!0},set(e){let t={...this.config};e?t.tools=[{type:`web_search`}]:delete t.tools,this.$store.commit(`seedream/setConfig`,t)}}}}),jt={class:`advanced-options`},Mt={key:0,class:`field`},Nt={class:`label`},Pt={class:`title font-bold`},Ft={key:1,class:`field`},It={class:`label`},Lt={class:`title font-bold`},Rt={key:2,class:`field`},zt={class:`label`},Bt={class:`title font-bold`},Vt={key:3,class:`field`},Ht={class:`label`},Ut={class:`title font-bold`};function Wt(t,n,r,u,d,g){let _=l(`el-option`),v=l(`el-select`),y=l(`el-switch`);return h(),s(`div`,jt,[t.capabilities.layerDecomposition?(h(),s(`div`,Mt,[e(`div`,Nt,[e(`h2`,Pt,i(t.$t(`seedream.name.mode`)),1)]),a(v,{modelValue:t.mode,"onUpdate:modelValue":n[0]||=e=>t.mode=e,class:`value`},{default:p(()=>[a(_,{label:t.$t(`seedream.mode.image`),value:`image`},null,8,[`label`]),a(_,{label:t.$t(`seedream.mode.layers`),value:`layers`},null,8,[`label`])]),_:1},8,[`modelValue`])])):o(``,!0),t.capabilities.transparentBackground&&t.mode===`image`&&t.hasSingleImage?(h(),s(`div`,Ft,[e(`div`,It,[e(`h2`,Lt,i(t.$t(`seedream.name.background`)),1)]),a(v,{modelValue:t.background,"onUpdate:modelValue":n[1]||=e=>t.background=e,class:`value`,clearable:``},{default:p(()=>[a(_,{label:t.$t(`seedream.background.opaque`),value:`opaque`},null,8,[`label`]),a(_,{label:t.$t(`seedream.background.transparent`),value:`transparent`},null,8,[`label`])]),_:1},8,[`modelValue`])])):o(``,!0),t.capabilities.promptOptimization.length?(h(),s(`div`,Rt,[e(`div`,zt,[e(`h2`,Bt,i(t.$t(`seedream.name.promptOptimization`)),1)]),a(v,{modelValue:t.promptOptimization,"onUpdate:modelValue":n[2]||=e=>t.promptOptimization=e,class:`value`,clearable:``},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.promptOptimization,e=>(h(),f(_,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])])):o(``,!0),t.capabilities.webSearch&&t.mode===`image`?(h(),s(`div`,Vt,[e(`div`,Ht,[e(`h2`,Ut,i(t.$t(`seedream.name.webSearch`)),1)]),a(y,{modelValue:t.webSearch,"onUpdate:modelValue":n[3]||=e=>t.webSearch=e},null,8,[`modelValue`])])):o(``,!0)])}var Gt=G(At,[[`render`,Wt],[`__scopeId`,`data-v-085ad2ee`]]),Kt=_({name:`SeedreamSeedInput`,components:{ElInputNumber:D,InfoIcon:P},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Y(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)}}}}),qt={key:0,class:`field`},Jt={class:`label`},Yt={class:`box`},Xt={class:`title font-bold`},Zt={class:`value`};function Qt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,qt,[e(`div`,Jt,[e(`div`,Yt,[e(`h2`,Xt,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Zt,[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 $t=G(Kt,[[`render`,Qt],[`__scopeId`,`data-v-10cdc1e0`]]),en=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:D,InfoIcon:P},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Y(this.config?.model).guidanceScale},defaultValue(){return Y(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)}}}}),tn={key:0,class:`field`},nn={class:`label`},rn={class:`box`},an={class:`title font-bold`},on={class:`value`};function sn(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,tn,[e(`div`,nn,[e(`div`,rn,[e(`h2`,an,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,on,[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 cn=G(en,[[`render`,sn],[`__scopeId`,`data-v-7386f064`]]),Q=e=>{let t={...e||{}};typeof t.prompt==`string`&&(t.prompt=t.prompt.trim()),delete t.action,delete t.stream,delete t.seed,delete t.guidance_scale,t.watermark=!1;let n=Y(t.model),r=t.model===`doubao-seedream-5-0-pro-260628`&&t.layer_decomposition===!0;t.image?.length||delete t.image,t.size||delete t.size,r?(t.image=t.image?.slice(0,1),t.size=t.size||`auto`,t.prompt||delete t.prompt,delete t.background,delete t.sequential_image_generation,delete t.sequential_image_generation_options,delete t.tools):(delete t.layer_decomposition,n.transparentBackground||delete t.background,t.background===`transparent`&&(t.output_format=`png`),(!n.groupGeneration||t.sequential_image_generation!==`auto`)&&(n.groupGeneration||delete t.sequential_image_generation,delete t.sequential_image_generation_options),n.webSearch||delete t.tools),n.outputFormat||delete t.output_format;let i=t.optimize_prompt_options?.mode;return(!i||!n.promptOptimization.includes(i))&&delete t.optimize_prompt_options,{...t,async:!0}},ln=_({name:`SeedreamConfigPanel`,components:{MagicIcon:L,ElButton:K,PromptInput:Ve,ServicePricingSummary:we,ImageInput:et,ModelSelector:st,SizeSelector:mt,MaxImagesSelector:St,OutputFormatSelector:kt,AdvancedOptions:Gt,SeedInput:$t,GuidanceScaleInput:cn},emits:[`generate`],computed:{action(){let e=this.config?.image;return Ue(this.config?.model,typeof e==`string`?[e]:e)},capabilities(){return Y(this.config?.model)},canGenerate(){let e=Q(this.config);return e.layer_decomposition?e.image?.length===1:je(`seedream`,e)},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,n=typeof e.size==`string`&&/^\d+x\d+$/i.test(e.size)?e.size.split(`x`).map(Number).reduce((e,t)=>e*t):e.size===`2K`?4194304:1e6,r=e.model===`doubao-seedream-5-0-pro-260628`;return de({...e,action:this.action,model:R(e.model),input_image_count:Array.isArray(e.image)?e.image.length:+!!e.image,count:t,layer_decomposition:e.layer_decomposition===!0,layer_low_count:+!!e.layer_decomposition,regular_low_count:r&&!e.layer_decomposition&&n<=261e4?1:0,regular_high_count:r&&!e.layer_decomposition&&n>261e4?1:0},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),un={class:`flex flex-col h-full`},dn={class:`flex-1 overflow-y-auto p-5`},fn={class:`flex flex-col items-center justify-center px-5 pb-5`};function pn(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(`advanced-options`),x=l(`seed-input`),S=l(`guidance-scale-input`),C=l(`prompt-input`),w=l(`image-input`),T=l(`service-pricing-summary`),E=l(`magic-icon`),D=l(`el-button`);return h(),s(`div`,un,[e(`div`,dn,[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`}),a(C,{class:`mb-4`}),t.capabilities.image?(h(),f(w,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,fn,[a(T,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(D,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(E,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var mn=G(ln,[[`render`,pn]]),hn=_({name:`SeedreamTaskPreview`,components:{DeleteIcon:ne,ApplicationIcon:k,ChannelIcon:j,ImageIcon:M,InfoIcon:N,LightningIcon:ae,MagicIcon:L,TimeIcon:A,WarningIcon:re,CopyToClipboard:xe,ElAlert:C,ImageWrapper:Me,ElButton:K,ElTooltip:S,ImagePreview:J,ApiCodeButton:Te,ReportButton:Se},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return Q(this.modelValue?.request)},requestImages(){let e=this.modelValue?.request?.image;return typeof e==`string`?[e]:Array.isArray(e)?e:[]},isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=this.modelValue?.response?.data;return Array.isArray(e)?[...e].sort((e,t)=>(e.z_index??2**53-1)-(t.z_index??2**53-1)):[]},isLayerResult(){return this.modelValue?.request?.layer_decomposition===!0||this.images.some(e=>e.z_index!==void 0)}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await q.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`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},layerTitle(e,t){return e.error?this.$t(`seedream.name.failedLayer`,{index:t+1}):e.z_index===0?this.$t(`seedream.name.baseLayer`):e.name||this.$t(`seedream.name.layer`,{index:e.z_index??t+1})},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)}}}),gn={class:`preview`},_n={class:`left`},vn={class:`main`},yn={class:`bot`},bn={class:`datetime`},xn=[`aria-label`],Sn={class:`info`},Cn={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},wn={key:1,class:`prompt mt-2`},Tn={key:0},En={key:0,class:n({content:!0})},Dn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},On={key:1,class:n({content:!0,failed:!0})},kn={class:`layer-grid`},An={key:1,class:`layer-meta`},jn={key:0},Mn={key:1},Nn={key:2},Pn={key:3,class:`layer-error`},Fn={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},In={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ln={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Rn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},zn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Bn={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-0`},Vn={key:2,class:`content`},Hn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Un={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Wn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Kn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Jn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Yn={key:3,class:n({content:!0})},Xn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Zn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Qn(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`,gn,[e(`div`,_n,[a(y,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,vn,[e(`div`,yn,[a(y,{capability:`seedream`,part:`name`}),e(`span`,bn,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,xn)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Sn,[n.requestImages.length>0?(h(),s(`div`,Cn,[(h(!0),s(c,null,m(n.requestImages,(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`,wn,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,Tn,` - (`+i(n.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(h(),s(`div`,On,[e(`div`,kn,[(h(!0),s(c,null,m(n.images,(t,r)=>(h(),s(`article`,{key:r,class:`layer-card`},[t?.image_url?(h(),f(D,{key:0,src:t.image_url,"raw-src":t.image_url},null,8,[`src`,`raw-src`])):o(``,!0),n.isLayerResult||t.error?(h(),s(`div`,An,[e(`strong`,null,i(n.layerTitle(t,r)),1),t.size?(h(),s(`span`,jn,i(t.size)+` · `+i(t.output_format?.toUpperCase()),1)):o(``,!0),t.description?(h(),s(`span`,Mn,i(t.description),1)):o(``,!0),t.bounding_box?.absolute?(h(),s(`code`,Nn,i(t.bounding_box.absolute.join(`, `)),1)):o(``,!0),t.error?(h(),s(`span`,Pn,i(t.error.message||t.error.code),1)):o(``,!0)])):o(``,!0)]))),128))]),e(`div`,Fn,[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`,In,[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`,Ln,[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`,Rn,[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`,zn,[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`,Bn,[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 inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(h(),s(`div`,Vn,[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`,Hn,[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`,Un,[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`,Wn,[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`,Gn,[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`,Kn,[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`,qn,[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`,Jn,[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`,Yn,[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`,Zn,[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`,En,[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`,Dn,[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 $n=_({name:`SeedreamRecentPanel`,components:{TaskPreview:G(hn,[[`render`,Qn],[`__scopeId`,`data-v-3411e2b0`]]),BotPlaceholder:Ee,NoTasks:ee,ScrollList:I},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?.()}}}),er={key:0},tr={key:2,class:`w-full h-full flex items-center justify-center`};function nr(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`,er,[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`,tr,[a(v)])):o(``,!0)],64)}var rr=_({name:`SeedreamIndex`,components:{ConfigPanel:mn,Layout:Re,RecentPanel:G($n,[[`render`,nr]]),ShowcaseResultTabs:Oe},mixins:[ve,ke(`seedream`),De(`seedream`)],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.onPollTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await te({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(){let e=Q(this.config),t=Ae(`seedream`,e);if(t){T.error(this.$t(`common.message.${t}`));return}if(!pe(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;if(Y(this.config?.model).imageRequired&&!this.config?.image?.length){T.warning(this.$t(`seedream.message.referenceImageRequired`));return}if(!ye())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}T.info(this.$t(`seedream.message.startingTask`)),_e(`seedream`,fe.generate(e,{token:n})).then(()=>{T.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;ue(e,`seedream`)||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 ir(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`showcase-result-tabs`),d=l(`layout`);return h(),f(d,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(u,{service:`seedream`},{tasks:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})]),_:1})}var ar=G(rr,[[`render`,ir]]);export{ar 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-GALwUZll.js";import{t as x}from"./upload-Sju4DbiY.js";import{t as S}from"./tooltip-4w7ghPQM.js";import{t as C}from"./alert-BprQRUmf.js";import{_ as w,v as T}from"./vuex.esm-bundler-BV9tXD4i.js";import{t as E}from"./drawer-APcI0MuL.js";import{t as D}from"./input-number-CQyq1gfs.js";import{t as O}from"./switch-4nC3Yz4b.js";import{t as k}from"./box-Eq7xsVMG.js";import{t as A}from"./clock-BooSG6zB.js";import{t as j}from"./hash-GTQkcsQj.js";import{t as M}from"./image-BEbYTJ0m.js";import{t as N}from"./info-PmX6OJ8X.js";import{a as P,i as F,n as I,r as ee,t as te}from"./pagination-W-HQ78h5.js";import{t as ne}from"./trash-2-BkEkcSHv.js";import{t as re}from"./triangle-alert-DBmpuUlm.js";import{t as ie}from"./upload-DidTvyIg.js";import{t as L}from"./wand-sparkles-CwgjO5Gl.js";import{t as ae}from"./zap-5TJ16_7J.js";import{Bn as R,Fn as z,In as oe,Ln as se,Mn as B,Nn as ce,Pn as V,jn as H,kn as U,zn as W}from"./constants-GmVIn7tC.js";import{D as G,Na as le,Qa as K,T as ue,Tn as de,Xn as fe,at as pe,ct as me,lt as he,ot as ge,qi as _e,st as ve,ta as ye,tt as be,za as q}from"./index-Dr2ooWnm.js";import{t as xe}from"./CopyToClipboard-CQT78wob.js";import{t as Se}from"./ReportButton-B6G5OWJ0.js";import{t as J}from"./ImagePreview-YXx0To-U.js";import{n as Ce}from"./taskDrawerMixin-DyAUhFEq.js";import{t as we}from"./ServicePricingSummary-rLPlqY7R.js";import{t as Te}from"./ApiCodeButton-DSt2Pz0O.js";import{t as Ee}from"./BotPlaceholder-BC8u-j84.js";import{t as De}from"./taskPollingMixin-CcLxtz8z.js";import{t as Oe}from"./ShowcaseResultTabs-CS9fv2h_.js";import{t as ke}from"./showcaseRecreateMixin-Dhdr3T0y.js";import{n as Ae,t as je}from"./generationInput--J_4Niw5.js";import{t as Me}from"./ImageWrapper-DH6OlBWC.js";var Ne=_({name:`LayoutSeedream`,components:{MagicIcon:L,ElDrawer:E,ElButton:K},mixins:[Ce]}),Pe={class:`main flex flex-row flex-1`},Fe={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ie={class:`result h-full p-4 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Le(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,Pe,[e(`div`,Fe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ie,[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 Re=G(Ne,[[`render`,Le],[`__scopeId`,`data-v-fa2db192`]]),ze=_({name:`SeedreamPromptInput`,components:{PromptTextarea:F},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 Be(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 Ve=G(ze,[[`render`,Be]]),He={image:!0,imageRequired:!1,maxInputImages:14,sizeTiers:[`1K`,`2K`,`4K`],sizePixel:!0,sizeAdaptive:!1,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,webSearch:!1,promptOptimization:[],layerDecomposition:!1,transparentBackground:!1};function Y(e){switch(e){case z:return{image:!0,imageRequired:!1,maxInputImages:10,sizeTiers:[`1K`,W,`2K`],sizePixel:!0,sizeAdaptive:!1,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,webSearch:!1,promptOptimization:[`standard`,`fast`],layerDecomposition:!0,transparentBackground:!0};case V:case ce:return{image:!0,imageRequired:!1,maxInputImages:14,sizeTiers:[`2K`,`3K`,`4K`],sizePixel:!0,sizeAdaptive:!1,sizePixelDefault:void 0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,webSearch:!0,promptOptimization:[`standard`],layerDecomposition:!1,transparentBackground:!1};case B:return{image:!0,imageRequired:!1,maxInputImages:14,sizeTiers:[`2K`,`4K`],sizePixel:!0,sizeAdaptive:!1,sizePixelDefault:void 0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,webSearch:!1,promptOptimization:[`standard`],layerDecomposition:!1,transparentBackground:!1};case H:return{image:!0,imageRequired:!1,maxInputImages:14,sizeTiers:[`1K`,`2K`,`4K`],sizePixel:!0,sizeAdaptive:!1,sizePixelDefault:void 0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,webSearch:!1,promptOptimization:[`standard`,`fast`],layerDecomposition:!1,transparentBackground:!1};default:return He}}function Ue(e,t){return t?.length?`edit`:`generate`}var We=[`1K`,W,`2K`,`3K`,`4K`];function X(e,t){if(!e)return[];let n=Y(t.model??e.model),r=[],i=typeof e.size==`string`?e.size:void 0;Array.isArray(e.image)&&e.image.length>n.maxInputImages&&r.push({field:`image`,i18nLabel:`seedream.name.imageUrls`}),i&&(i===`adaptive`||We.includes(i)&&!n.sizeTiers.includes(i))&&r.push({field:`size`,i18nLabel:`seedream.name.size`}),e.sequential_image_generation===`auto`&&!n.groupGeneration&&r.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&r.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&r.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!n.outputFormat&&r.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),e.tools?.length&&!n.webSearch&&r.push({field:`tools`,i18nLabel:`seedream.name.webSearch`});let a=e.optimize_prompt_options?.mode;return a&&!n.promptOptimization.includes(a)&&r.push({field:`optimize_prompt_options`,i18nLabel:`seedream.name.promptOptimization`}),e.layer_decomposition&&!n.layerDecomposition&&r.push({field:`layer_decomposition`,i18nLabel:`seedream.name.layerDecomposition`}),e.background&&!n.transparentBackground&&r.push({field:`background`,i18nLabel:`seedream.name.background`}),r}function Z(e,t,n){let r={...e};for(let e of t)switch(e.field){case`image`:r.image=(r.image||[]).slice(0,Y(r.model).maxInputImages);break;case`size`:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:case`guidance_scale`:case`output_format`:case`tools`:case`optimize_prompt_options`:case`layer_decomposition`:case`background`:delete r[e.field];break}return r}var Ge=_({name:`SeedreamImageInput`,components:{UploadIcon:ie,ElUpload:x,ElButton:K,InfoIcon:P,ImagePreview:J},mixins:[he,me,ge,be],data(){return{fileList:[],uploadUrl:le()+`/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(){let e=this.$store.state.seedream?.config?.image;return typeof e==`string`?[e]:Array.isArray(e)?e:void 0},model(){return this.$store.state.seedream?.config?.model},supported(){return Y(this.model).image},limit(){return(this.$store.state.seedream?.config||{}).layer_decomposition?1:Y(this.model).maxInputImages}},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`,{count:this.limit}))},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()}}}),Ke={key:0},qe={class:`field`},Je={class:`label`},Ye={class:`box`},Xe={class:`title font-bold`},Ze={class:`value`},Qe={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function $e(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`,Ke,[e(`div`,qe,[e(`div`,Je,[e(`div`,Ye,[e(`h2`,Xe,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Ze,[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:t.limit,multiple:t.limit>1,"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`,`limit`,`multiple`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,Qe,[(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 et=G(Ge,[[`render`,$e],[`__scopeId`,`data-v-500d9564`]]),tt=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},data(){return{revertKey:0,options:[{value:z,label:this.$t(`seedream.model.seedream50pro`)},{value:V,label:this.$t(`seedream.model.seedream50`)},{value:B,label:this.$t(`seedream.model.seedream45`)},{value:H,label:this.$t(`seedream.model.seedream40`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){let e=this.value===`doubao-seedream-5-0-260128`?V:this.value;if(e&&this.options.some(t=>t.value===e)){e!==this.value&&this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e});return}let t={...this.$store.state.seedream?.config||{},model:U},n=X(t,{model:U});this.$store.commit(`seedream/setConfig`,Z(t,n,{model:U}))},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 q.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})}}}),nt={class:`field`},rt={class:`label`},it={class:`box`},at={class:`title font-bold`};function ot(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,nt,[e(`div`,rt,[e(`div`,it,[e(`h2`,at,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 st=G(tt,[[`render`,ot],[`__scopeId`,`data-v-dd2c4aee`]]),ct=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:P},data(){return{allPixelOptions:se}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Y(this.model)},pixelOptions(){let e=this.model===`doubao-seedream-5-0-lite-260128`||this.model===`doubao-seedream-5-0-260128`||this.model===`doubao-seedream-4-5-251128`?3686400:921600;return this.allPixelOptions.filter(t=>{let[n,r]=t.value.split(`x`).map(Number);return n*r>=e})},layerDecomposition(){return this.$store.state.seedream?.config?.layer_decomposition===!0},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)}}}}),lt={class:`field`},ut={class:`label`},dt={class:`box`},ft={class:`title font-bold`};function pt(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`,lt,[e(`div`,ut,[e(`div`,dt,[e(`h2`,ft,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)),t.layerDecomposition?(h(),f(v,{key:0,label:`AUTO`,value:`auto`})):o(``,!0)]),_: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 mt=G(ct,[[`render`,pt],[`__scopeId`,`data-v-810b7ca9`]]),ht=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:D,InfoIcon:P},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Y(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)}}}),gt={key:0,class:`field`},_t={class:`label`},vt={class:`box`},yt={class:`title font-bold`},bt={class:`value`};function xt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,gt,[e(`div`,_t,[e(`div`,vt,[e(`h2`,yt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,bt,[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 St=G(ht,[[`render`,xt],[`__scopeId`,`data-v-f079fd20`]]),Ct=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},data(){return{options:[...oe]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Y(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)}}}}),wt={key:0,class:`field`},Tt={class:`label`},Et={class:`box`},Dt={class:`title font-bold`};function Ot(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,wt,[e(`div`,Tt,[e(`div`,Et,[e(`h2`,Dt,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 kt=G(Ct,[[`render`,Ot],[`__scopeId`,`data-v-69ea4c07`]]),At=_({name:`SeedreamAdvancedOptions`,components:{ElOption:b,ElSelect:y,ElSwitch:O},computed:{config(){return this.$store.state.seedream?.config||{}},capabilities(){return Y(this.config.model)},hasSingleImage(){return Array.isArray(this.config.image)&&this.config.image.length===1},mode:{get(){return this.config.layer_decomposition?`layers`:`image`},set(e){let t={...this.config};e===`layers`?(t.layer_decomposition=!0,t.image=(t.image||[]).slice(0,1),t.size=`auto`,delete t.background,delete t.sequential_image_generation,delete t.sequential_image_generation_options,delete t.tools):(delete t.layer_decomposition,t.size===`auto`&&delete t.size),this.$store.commit(`seedream/setConfig`,t)}},background:{get(){return this.config.background},set(e){let t={...this.config,background:e};e===`transparent`&&(t.output_format=`png`),e||delete t.background,this.$store.commit(`seedream/setConfig`,t)}},promptOptimization:{get(){return this.config.optimize_prompt_options?.mode},set(e){let t={...this.config};e?t.optimize_prompt_options={mode:e}:delete t.optimize_prompt_options,this.$store.commit(`seedream/setConfig`,t)}},webSearch:{get(){return this.config.tools?.some(e=>e?.type===`web_search`)===!0},set(e){let t={...this.config};e?t.tools=[{type:`web_search`}]:delete t.tools,this.$store.commit(`seedream/setConfig`,t)}}}}),jt={class:`advanced-options`},Mt={key:0,class:`field`},Nt={class:`label`},Pt={class:`title font-bold`},Ft={key:1,class:`field`},It={class:`label`},Lt={class:`title font-bold`},Rt={key:2,class:`field`},zt={class:`label`},Bt={class:`title font-bold`},Vt={key:3,class:`field`},Ht={class:`label`},Ut={class:`title font-bold`};function Wt(t,n,r,u,d,g){let _=l(`el-option`),v=l(`el-select`),y=l(`el-switch`);return h(),s(`div`,jt,[t.capabilities.layerDecomposition?(h(),s(`div`,Mt,[e(`div`,Nt,[e(`h2`,Pt,i(t.$t(`seedream.name.mode`)),1)]),a(v,{modelValue:t.mode,"onUpdate:modelValue":n[0]||=e=>t.mode=e,class:`value`},{default:p(()=>[a(_,{label:t.$t(`seedream.mode.image`),value:`image`},null,8,[`label`]),a(_,{label:t.$t(`seedream.mode.layers`),value:`layers`},null,8,[`label`])]),_:1},8,[`modelValue`])])):o(``,!0),t.capabilities.transparentBackground&&t.mode===`image`&&t.hasSingleImage?(h(),s(`div`,Ft,[e(`div`,It,[e(`h2`,Lt,i(t.$t(`seedream.name.background`)),1)]),a(v,{modelValue:t.background,"onUpdate:modelValue":n[1]||=e=>t.background=e,class:`value`,clearable:``},{default:p(()=>[a(_,{label:t.$t(`seedream.background.opaque`),value:`opaque`},null,8,[`label`]),a(_,{label:t.$t(`seedream.background.transparent`),value:`transparent`},null,8,[`label`])]),_:1},8,[`modelValue`])])):o(``,!0),t.capabilities.promptOptimization.length?(h(),s(`div`,Rt,[e(`div`,zt,[e(`h2`,Bt,i(t.$t(`seedream.name.promptOptimization`)),1)]),a(v,{modelValue:t.promptOptimization,"onUpdate:modelValue":n[2]||=e=>t.promptOptimization=e,class:`value`,clearable:``},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.promptOptimization,e=>(h(),f(_,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])])):o(``,!0),t.capabilities.webSearch&&t.mode===`image`?(h(),s(`div`,Vt,[e(`div`,Ht,[e(`h2`,Ut,i(t.$t(`seedream.name.webSearch`)),1)]),a(y,{modelValue:t.webSearch,"onUpdate:modelValue":n[3]||=e=>t.webSearch=e},null,8,[`modelValue`])])):o(``,!0)])}var Gt=G(At,[[`render`,Wt],[`__scopeId`,`data-v-085ad2ee`]]),Kt=_({name:`SeedreamSeedInput`,components:{ElInputNumber:D,InfoIcon:P},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Y(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)}}}}),qt={key:0,class:`field`},Jt={class:`label`},Yt={class:`box`},Xt={class:`title font-bold`},Zt={class:`value`};function Qt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,qt,[e(`div`,Jt,[e(`div`,Yt,[e(`h2`,Xt,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Zt,[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 $t=G(Kt,[[`render`,Qt],[`__scopeId`,`data-v-10cdc1e0`]]),en=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:D,InfoIcon:P},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Y(this.config?.model).guidanceScale},defaultValue(){return Y(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)}}}}),tn={key:0,class:`field`},nn={class:`label`},rn={class:`box`},an={class:`title font-bold`},on={class:`value`};function sn(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,tn,[e(`div`,nn,[e(`div`,rn,[e(`h2`,an,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,on,[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 cn=G(en,[[`render`,sn],[`__scopeId`,`data-v-7386f064`]]),Q=e=>{let t={...e||{}};typeof t.prompt==`string`&&(t.prompt=t.prompt.trim()),delete t.action,delete t.stream,delete t.seed,delete t.guidance_scale,t.watermark=!1;let n=Y(t.model),r=t.model===`doubao-seedream-5-0-pro-260628`&&t.layer_decomposition===!0;t.image?.length||delete t.image,t.size||delete t.size,r?(t.image=t.image?.slice(0,1),t.size=t.size||`auto`,t.prompt||delete t.prompt,delete t.background,delete t.sequential_image_generation,delete t.sequential_image_generation_options,delete t.tools):(delete t.layer_decomposition,n.transparentBackground||delete t.background,t.background===`transparent`&&(t.output_format=`png`),(!n.groupGeneration||t.sequential_image_generation!==`auto`)&&(n.groupGeneration||delete t.sequential_image_generation,delete t.sequential_image_generation_options),n.webSearch||delete t.tools),n.outputFormat||delete t.output_format;let i=t.optimize_prompt_options?.mode;return(!i||!n.promptOptimization.includes(i))&&delete t.optimize_prompt_options,{...t,async:!0}},ln=_({name:`SeedreamConfigPanel`,components:{MagicIcon:L,ElButton:K,PromptInput:Ve,ServicePricingSummary:we,ImageInput:et,ModelSelector:st,SizeSelector:mt,MaxImagesSelector:St,OutputFormatSelector:kt,AdvancedOptions:Gt,SeedInput:$t,GuidanceScaleInput:cn},emits:[`generate`],computed:{action(){let e=this.config?.image;return Ue(this.config?.model,typeof e==`string`?[e]:e)},capabilities(){return Y(this.config?.model)},canGenerate(){let e=Q(this.config);return e.layer_decomposition?e.image?.length===1:je(`seedream`,e)},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,n=typeof e.size==`string`&&/^\d+x\d+$/i.test(e.size)?e.size.split(`x`).map(Number).reduce((e,t)=>e*t):e.size===`2K`?4194304:1e6,r=e.model===`doubao-seedream-5-0-pro-260628`;return de({...e,action:this.action,model:R(e.model),input_image_count:Array.isArray(e.image)?e.image.length:+!!e.image,count:t,layer_decomposition:e.layer_decomposition===!0,layer_low_count:+!!e.layer_decomposition,regular_low_count:r&&!e.layer_decomposition&&n<=261e4?1:0,regular_high_count:r&&!e.layer_decomposition&&n>261e4?1:0},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),un={class:`flex flex-col h-full`},dn={class:`flex-1 overflow-y-auto p-5`},fn={class:`flex flex-col items-center justify-center px-5 pb-5`};function pn(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(`advanced-options`),x=l(`seed-input`),S=l(`guidance-scale-input`),C=l(`prompt-input`),w=l(`image-input`),T=l(`service-pricing-summary`),E=l(`magic-icon`),D=l(`el-button`);return h(),s(`div`,un,[e(`div`,dn,[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`}),a(C,{class:`mb-4`}),t.capabilities.image?(h(),f(w,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,fn,[a(T,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(D,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(E,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var mn=G(ln,[[`render`,pn]]),hn=_({name:`SeedreamTaskPreview`,components:{DeleteIcon:ne,ApplicationIcon:k,ChannelIcon:j,ImageIcon:M,InfoIcon:N,LightningIcon:ae,MagicIcon:L,TimeIcon:A,WarningIcon:re,CopyToClipboard:xe,ElAlert:C,ImageWrapper:Me,ElButton:K,ElTooltip:S,ImagePreview:J,ApiCodeButton:Te,ReportButton:Se},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return Q(this.modelValue?.request)},requestImages(){let e=this.modelValue?.request?.image;return typeof e==`string`?[e]:Array.isArray(e)?e:[]},isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=this.modelValue?.response?.data;return Array.isArray(e)?[...e].sort((e,t)=>(e.z_index??2**53-1)-(t.z_index??2**53-1)):[]},isLayerResult(){return this.modelValue?.request?.layer_decomposition===!0||this.images.some(e=>e.z_index!==void 0)}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await q.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`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},layerTitle(e,t){return e.error?this.$t(`seedream.name.failedLayer`,{index:t+1}):e.z_index===0?this.$t(`seedream.name.baseLayer`):e.name||this.$t(`seedream.name.layer`,{index:e.z_index??t+1})},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)}}}),gn={class:`preview`},_n={class:`left`},vn={class:`main`},yn={class:`bot`},bn={class:`datetime`},xn=[`aria-label`],Sn={class:`info`},Cn={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},wn={key:1,class:`prompt mt-2`},Tn={key:0},En={key:0,class:n({content:!0})},Dn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},On={key:1,class:n({content:!0,failed:!0})},kn={class:`layer-grid`},An={key:1,class:`layer-meta`},jn={key:0},Mn={key:1},Nn={key:2},Pn={key:3,class:`layer-error`},Fn={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},In={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ln={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Rn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},zn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Bn={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-0`},Vn={key:2,class:`content`},Hn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Un={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Wn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Kn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Jn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Yn={key:3,class:n({content:!0})},Xn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Zn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Qn(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`,gn,[e(`div`,_n,[a(y,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,vn,[e(`div`,yn,[a(y,{capability:`seedream`,part:`name`}),e(`span`,bn,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,xn)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Sn,[n.requestImages.length>0?(h(),s(`div`,Cn,[(h(!0),s(c,null,m(n.requestImages,(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`,wn,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,Tn,` - (`+i(n.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(h(),s(`div`,On,[e(`div`,kn,[(h(!0),s(c,null,m(n.images,(t,r)=>(h(),s(`article`,{key:r,class:`layer-card`},[t?.image_url?(h(),f(D,{key:0,src:t.image_url,"raw-src":t.image_url},null,8,[`src`,`raw-src`])):o(``,!0),n.isLayerResult||t.error?(h(),s(`div`,An,[e(`strong`,null,i(n.layerTitle(t,r)),1),t.size?(h(),s(`span`,jn,i(t.size)+` · `+i(t.output_format?.toUpperCase()),1)):o(``,!0),t.description?(h(),s(`span`,Mn,i(t.description),1)):o(``,!0),t.bounding_box?.absolute?(h(),s(`code`,Nn,i(t.bounding_box.absolute.join(`, `)),1)):o(``,!0),t.error?(h(),s(`span`,Pn,i(t.error.message||t.error.code),1)):o(``,!0)])):o(``,!0)]))),128))]),e(`div`,Fn,[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`,In,[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`,Ln,[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`,Rn,[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`,zn,[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`,Bn,[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 inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(h(),s(`div`,Vn,[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`,Hn,[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`,Un,[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`,Wn,[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`,Gn,[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`,Kn,[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`,qn,[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`,Jn,[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`,Yn,[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`,Zn,[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`,En,[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`,Dn,[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 $n=_({name:`SeedreamRecentPanel`,components:{TaskPreview:G(hn,[[`render`,Qn],[`__scopeId`,`data-v-3411e2b0`]]),BotPlaceholder:Ee,NoTasks:ee,ScrollList:I},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?.()}}}),er={key:0},tr={key:2,class:`w-full h-full flex items-center justify-center`};function nr(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`,er,[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`,tr,[a(v)])):o(``,!0)],64)}var rr=_({name:`SeedreamIndex`,components:{ConfigPanel:mn,Layout:Re,RecentPanel:G($n,[[`render`,nr]]),ShowcaseResultTabs:Oe},mixins:[ve,ke(`seedream`),De(`seedream`)],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.onPollTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await te({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(){let e=Q(this.config),t=Ae(`seedream`,e);if(t){T.error(this.$t(`common.message.${t}`));return}if(!pe(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;if(Y(this.config?.model).imageRequired&&!this.config?.image?.length){T.warning(this.$t(`seedream.message.referenceImageRequired`));return}if(!ye())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}T.info(this.$t(`seedream.message.startingTask`)),_e(`seedream`,fe.generate(e,{token:n})).then(()=>{T.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;ue(e,`seedream`)||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 ir(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`showcase-result-tabs`),d=l(`layout`);return h(),f(d,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(u,{service:`seedream`},{tasks:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})]),_:1})}var ar=G(rr,[[`render`,ir]]);export{ar 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,P as c,T as l,at as u,ht as d,it as f,j as p,mt 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-CxPN3D9u.js";import{t as x}from"./upload-Sju4DbiY.js";import{t as S}from"./tooltip-B60Iasgv.js";import{t as C}from"./alert-BprQRUmf.js";import{_ as w,v as T}from"./vuex.esm-bundler-BV9tXD4i.js";import{n as E,r as D}from"./radio-BNhFzeBO.js";import{n as O,t as k}from"./collapse-Dwaru9dv.js";import{t as A}from"./drawer-CvX2U8ly.js";import{t as j}from"./input-number-BecdXhq4.js";import{t as M}from"./progress-BuyYfFZn.js";import{t as N}from"./clock-BRqsgYwQ.js";import{t as ee}from"./hash-CRnccwx_.js";import{t as P}from"./info-Bqj02p3r.js";import{a as te,i as ne,n as re,o as ie,r as ae,t as oe}from"./pagination-VjpfotZ8.js";import{t as se}from"./music-2-DXzd8a9x.js";import{t as ce}from"./plus-BMzVPasG.js";import{t as F}from"./trash-2-BBCXfu0p.js";import{t as I}from"./triangle-alert-BRov4JmE.js";import{t as le}from"./upload-D3ICVrNB.js";import{t as ue}from"./user-D8RgR1_m.js";import{t as de}from"./video-CDFVAtyn.js";import{t as L}from"./wand-sparkles-D8Xtkkgr.js";import{Gr as fe,Kr as pe,Ur as me,Wr as R,Xr as he,Yr as ge}from"./constants-GmVIn7tC.js";import{D as z,Fa as _e,Ga as ve,La as ye,Mi as B,Na as be,Pi as V,Qa as H,T as xe,Tn as Se,at as Ce,br as U,ct as we,lt as Te,oi as W,oo as Ee,ot as De,qi as Oe,ri as G,st as ke,ta as Ae,tt as je,vr as K,yr as Me,za as q}from"./index-BYbC-2BV.js";import{t as Ne}from"./CopyToClipboard-BQaEPLyt.js";import{t as Pe}from"./ReportButton-BAx8pia_.js";import{t as J}from"./ImagePreview-Dm16d0L7.js";import{n as Fe}from"./taskDrawerMixin-DyAUhFEq.js";import{n as Ie,t as Le}from"./ServicePricingSummary-DPzfamaB.js";import{t as Y}from"./AudioPreview-DQViM4FT.js";import{t as Re}from"./VideoPlayer-Cdtv4baV.js";import{t as X}from"./VideoPreview-D3jWNNx1.js";import{t as ze}from"./ScenarioPaymentMode-C2uR8lvu.js";import{t as Be}from"./ApiCodeButton-CAQzrT4K.js";import{t as Ve}from"./BotPlaceholder-BlCUdjzq.js";import{t as He}from"./taskPollingMixin-CcLxtz8z.js";var Ue=v({name:`LayoutDigitalHuman`,components:{UserIcon:ue,ElDrawer:A,ElButton:H},mixins:[Fe]}),We={class:`main flex flex-row flex-1`},Ge={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-4 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function qe(t,n,r,i,o,c){let l=u(`user-icon`),p=u(`el-button`),h=u(`el-drawer`);return g(),s(`div`,We,[e(`div`,Ge,[f(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ke,[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`]),[[_,!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:m(()=>[f(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Je=z(Ue,[[`render`,qe],[`__scopeId`,`data-v-909c6359`]]),Ye=v({name:`DigitalHumanMediaInput`,components:{AudioPreview:Y,CloseIcon:ye,ElButton:H,ElProgress:M,ElUpload:x,ImagePreview:J,MusicIcon:se,UploadIcon:le,VideoIcon:de,VideoPreview:X},mixins:[Te,we,De,je],props:{kind:{type:String,required:!0},accept:{type:String,default:``},buttonText:{type:String,default:``},hint:{type:String,default:``}},emits:[`change`],data(){return{fileList:[],uploadUrl:be()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},hasFile(){return this.fileList.length>0}},methods:{uploadedUrl(e){return e?.response?.file_url},isPending(e){return e.status===`ready`||e.status===`uploading`},onExceed(e){let t=this.$refs.uploader;t?.clearFiles();let n=e[0];n&&(t?.handleStart?.(n),t?.submit?.())},onError(){T.error(this.$t(`digitalhuman.message.uploadError`))},onRemoveFile(e){let t=this.fileList.indexOf(e);t>=0&&this.fileList.splice(t,1),this.onChange()},onChange(){let e=this.fileList?.[0];this.$emit(`change`,e?this.uploadedUrl(e):void 0)}}}),Xe={class:`thumb`},Ze={key:2,class:`placeholder`},Qe=[`title`],$e=[`aria-label`,`title`,`onClick`],et={key:0,class:`hint`};function tt(c,d,f,h,_,v){let y=u(`image-preview`),b=u(`video-preview`),x=u(`audio-preview`),S=u(`el-progress`),C=u(`video-icon`),w=u(`music-icon`),T=u(`close-icon`),E=u(`upload-icon`),D=u(`el-button`),O=u(`el-upload`);return g(),p(O,{ref:`uploader`,"file-list":c.fileList,"onUpdate:fileList":d[0]||=e=>c.fileList=e,accept:c.accept,name:`file`,class:`media-input`,limit:1,multiple:!1,"before-upload":c.beforeUploadSizeGuard,action:c.uploadUrl,headers:c.headers,"on-exceed":c.onExceed,"on-error":c.onError,"on-success":c.onChange,"on-remove":c.onChange},{file:m(({file:r})=>[e(`div`,{class:n([`slot`,{pending:c.isPending(r)}])},[c.kind===`image`&&r.url?(g(),p(y,{key:0,url:r.url,name:r.name,percentage:r.percentage,onRemove:e=>c.onRemoveFile(r)},null,8,[`url`,`name`,`percentage`,`onRemove`])):(g(),s(l,{key:1},[e(`div`,Xe,[c.kind===`video`&&c.uploadedUrl(r)?(g(),p(b,{key:0,url:c.uploadedUrl(r)},null,8,[`url`])):c.kind===`audio`&&c.uploadedUrl(r)?(g(),p(x,{key:1,url:c.uploadedUrl(r)},null,8,[`url`])):(g(),s(`div`,Ze,[c.isPending(r)?(g(),p(S,{key:0,type:`circle`,"stroke-width":4,percentage:Math.round(r.percentage||0),width:34},null,8,[`percentage`])):c.kind===`video`?(g(),p(C,{key:1,size:`1em`,"aria-hidden":`true`,focusable:`false`})):(g(),p(w,{key:2,size:`1em`,"aria-hidden":`true`,focusable:`false`}))]))]),e(`span`,{class:`filename`,title:r.name},i(r.name),9,Qe),e(`button`,{type:`button`,class:`remove`,"aria-label":c.$t(`common.button.close`),title:c.$t(`common.button.close`),onClick:t(e=>c.onRemoveFile(r),[`stop`])},[a(T,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,$e)],64))],2)]),default:m(()=>[a(D,{round:``,type:`primary`,size:`small`,class:`btn`},{default:m(()=>[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(c.hasFile?c.$t(`digitalhuman.button.replace`):c.buttonText),1)]),_:1}),c.hint?(g(),s(`p`,et,i(c.hint),1)):o(``,!0)]),_:1},8,[`file-list`,`accept`,`before-upload`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`])}var Z=z(Ye,[[`render`,tt],[`__scopeId`,`data-v-db0590a9`]]),nt=20,Q=e=>{let t=e;return!!t&&typeof t.voice_id==`string`&&!!t.voice_id&&typeof t.name==`string`},$=()=>{try{let e=JSON.parse(localStorage.getItem(`digitalhuman.voices`)||`[]`);return Array.isArray(e)?e.filter(Q).map(e=>({voice_id:e.voice_id,name:e.name,lang:typeof e.lang==`string`?e.lang:`zh`,created_at:typeof e.created_at==`number`?e.created_at:0})):[]}catch{return[]}},rt=e=>{try{localStorage.setItem(he,JSON.stringify(e))}catch{}return e},it=e=>Q(e)?rt([e,...$().filter(t=>t.voice_id!==e.voice_id)].slice(0,nt)):$(),at=e=>rt($().filter(t=>t.voice_id!==e)),ot=e=>`${e} ${$().length+1}`,st=3e3,ct=60,lt=v({name:`DigitalHumanVoiceCloneDialog`,components:{Consumption:Ie,ElAlert:C,ElButton:H,ElDialog:ve,ElInput:Ee,ElRadioButton:E,ElRadioGroup:D,MediaInput:Z},props:{visible:{type:Boolean,default:!1}},emits:[`update:visible`,`cloned`],data(){return{sampleUrl:void 0,name:``,lang:`zh`,cloning:!1,destroyed:!1,runId:0,DIGITALHUMAN_AUDIO_ACCEPT:R,DIGITALHUMAN_VOICE_CLONE_CONSUMPTION:2,voiceQuoteUsdc:void 0,voiceQuoteLoading:!1,quoteRunId:0}},computed:{service(){return this.$store.state.digitalhuman?.service},credentialToken(){return this.$store.state.digitalhuman?.credential?.token},walletMode(){return B()&&V(`digitalhuman`).mode===`wallet`},langOptions(){return me.map(e=>({value:e,label:this.$t(`digitalhuman.name.lang_${e}`)}))}},watch:{walletMode(e){this.voiceQuoteUsdc=void 0,e&&this.visible&&this.sampleUrl&&this.refreshVoiceQuote()},visible(e){e?(this.sampleUrl=void 0,this.name=ot(this.$t(`digitalhuman.name.myVoice`)),this.lang=`zh`):(this.runId++,this.quoteRunId++,this.cloning=!1,this.voiceQuoteLoading=!1)}},beforeUnmount(){this.destroyed=!0,this.runId++,this.quoteRunId++},methods:{onVisible(e){this.cloning&&!e||this.$emit(`update:visible`,e)},onSampleChange(e){this.sampleUrl=e,this.voiceQuoteUsdc=void 0,e&&this.walletMode&&this.refreshVoiceQuote()},isStale(e){return this.destroyed||e!==this.runId},sleep(e){return new Promise(t=>setTimeout(t,e))},async refreshVoiceQuote(){if(!this.sampleUrl)return;let e=++this.quoteRunId;this.voiceQuoteLoading=!0;try{let t=await U.quoteVoice(this.voiceRequest());e===this.quoteRunId&&this.walletMode&&(this.voiceQuoteUsdc=t.amountUsdc)}catch(e){console.warn(`x402 voice quote failed`,e)}finally{e===this.quoteRunId&&(this.voiceQuoteLoading=!1)}},voiceRequest(){return Me({audio_url:this.sampleUrl||``,lang:this.lang,name:this.name||void 0})},paymentOptions(){if(!this.walletMode)return this.credentialToken?{token:this.credentialToken}:void 0;let e=this.getWalletContext();if(!e){T.warning(this.$t(`common.x402Scenario.connectWalletFirst`));return}return{mode:`x402`,x402:{wallet:e,confirm:e=>this.confirmWalletPayment(e),identityToken:this.credentialToken}}},async onClone(){if(!this.sampleUrl)return;let e=this.paymentOptions();if(!e)return;let t=++this.runId;this.cloning=!0;try{let{data:n}=await U.cloneVoice(this.voiceRequest(),e);if(this.isStale(t))return;if(n?.voice_id){this.onCloned(n.voice_id);return}if(n?.task_id)await this.pollVoice(n.task_id,t);else throw Error(`no task`)}catch(e){if(e instanceof G)return;this.isStale(t)||T.error(this.$t(`digitalhuman.message.voiceCloneFailed`))}finally{this.isStale(t)||(this.cloning=!1)}},async pollVoice(e,t){for(let n=0;n<ct;n++){if(this.isStale(t)||(await this.sleep(st),this.isStale(t)))return;let n=this.credentialToken,{data:r}=await U.pollTask(e,n?{token:n}:{mode:`x402`});if(this.isStale(t))return;if(r?.voice_id){this.onCloned(r.voice_id);return}if(r?.state===`failed`)throw Error(`clone failed`)}throw Error(`timeout`)},getWalletContext(){return W(this.$wallet)},async confirmWalletPayment(e){return q.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)},onCloned(e){it({voice_id:e,name:this.name||this.$t(`digitalhuman.name.myVoice`),lang:this.lang,created_at:Date.now()/1e3}),T.success(this.$t(`digitalhuman.message.voiceCloneSuccess`)),this.cloning=!1,this.$emit(`cloned`,e),this.$emit(`update:visible`,!1)}}}),ut={class:`text-xs text-[var(--el-text-color-secondary)] mb-3`},dt={class:`field mb-3`},ft={class:`label`},pt={class:`field`},mt={class:`label`},ht={class:`text-xs mb-0`},gt={key:1,class:`mt-4 text-xs text-[var(--el-text-color-secondary)]`},_t={class:`footer`},vt={key:0,class:`cost text-xs text-[var(--el-text-color-secondary)]`};function yt(t,n,o,c,d,f){let _=u(`media-input`),v=u(`el-input`),y=u(`el-radio-button`),b=u(`el-radio-group`),x=u(`el-alert`),S=u(`consumption`),C=u(`el-button`),w=u(`el-dialog`);return g(),p(w,{"model-value":t.visible,title:t.$t(`digitalhuman.name.cloneVoice`),width:`440`,"align-center":``,"append-to-body":``,"close-on-click-modal":!t.cloning,"close-on-press-escape":!t.cloning,"onUpdate:modelValue":t.onVisible},{footer:m(()=>[e(`div`,_t,[t.walletMode?(g(),s(`span`,vt,i(t.voiceQuoteLoading?`…`:t.voiceQuoteUsdc?`${t.voiceQuoteUsdc} USDC`:t.$t(`common.x402Scenario.quoteBeforeSigning`)),1)):(g(),p(S,{key:1,value:t.DIGITALHUMAN_VOICE_CLONE_CONSUMPTION,service:t.service,class:`cost`},null,8,[`value`,`service`])),e(`div`,null,[a(C,{disabled:t.cloning,onClick:n[2]||=e=>t.onVisible(!1)},{default:m(()=>[r(i(t.$t(`common.button.cancel`)),1)]),_:1},8,[`disabled`]),a(C,{type:`primary`,loading:t.cloning,disabled:!t.sampleUrl||t.cloning,onClick:t.onClone},{default:m(()=>[r(i(t.$t(`digitalhuman.button.startClone`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])])])]),default:m(()=>[e(`p`,ut,i(t.$t(`digitalhuman.message.voiceCloneHint`)),1),a(_,{kind:`audio`,accept:t.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadSample`),hint:t.$t(`digitalhuman.message.audioHint`),class:`mb-4`,onChange:t.onSampleChange},null,8,[`accept`,`button-text`,`hint`,`onChange`]),e(`div`,dt,[e(`span`,ft,i(t.$t(`digitalhuman.name.voiceName`)),1),a(v,{modelValue:t.name,"onUpdate:modelValue":n[0]||=e=>t.name=e,class:`control`,placeholder:t.$t(`digitalhuman.placeholder.voiceName`)},null,8,[`modelValue`,`placeholder`])]),e(`div`,pt,[e(`span`,mt,i(t.$t(`digitalhuman.name.voiceLang`)),1),a(b,{modelValue:t.lang,"onUpdate:modelValue":n[1]||=e=>t.lang=e,class:`control`},{default:m(()=>[(g(!0),s(l,null,h(t.langOptions,e=>(g(),p(y,{key:e.value,value:e.value},{default:m(()=>[r(i(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])]),t.cloning?(g(),p(x,{key:0,closable:!1,type:`info`,class:`mt-4`},{default:m(()=>[e(`p`,ht,i(t.$t(`digitalhuman.message.voiceCloneRunning`)),1)]),_:1})):(g(),s(`p`,gt,i(t.$t(`digitalhuman.message.voiceStoredLocally`)),1))]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`onUpdate:modelValue`])}var bt=v({name:`DigitalHumanTimbreSelector`,components:{AddIcon:ce,DeleteIcon:F,ElButton:H,ElOption:b,ElSelect:y,VoiceCloneDialog:z(lt,[[`render`,yt],[`__scopeId`,`data-v-037c810e`]])},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{voices:$(),dialogVisible:!1}},mounted(){this.modelValue&&!this.voices.some(e=>e.voice_id===this.modelValue)&&this.$emit(`update:modelValue`,void 0)},methods:{labelFor(e){let t=this.$t(`digitalhuman.name.lang_${e.lang}`);return t.startsWith(`digitalhuman.`)?e.name:`${e.name} · ${t}`},onCloned(e){this.voices=$(),this.$emit(`update:modelValue`,e)},onRemove(e){this.voices=at(e),this.modelValue===e&&this.$emit(`update:modelValue`,void 0)}}}),xt={class:`row`},St={class:`label`},Ct={class:`option`},wt={class:`option-name`},Tt=[`aria-label`,`title`,`onClick`],Et={class:`empty`};function Dt(n,o,d,f,_,v){let y=u(`delete-icon`),b=u(`el-option`),x=u(`el-select`),S=u(`add-icon`),C=u(`el-button`),w=u(`voice-clone-dialog`);return g(),s(`div`,null,[e(`div`,xt,[e(`span`,St,i(n.$t(`digitalhuman.name.timbre`)),1),a(x,{"model-value":n.modelValue,class:`control`,placeholder:n.$t(`digitalhuman.placeholder.pickTimbre`),"onUpdate:modelValue":o[0]||=e=>n.$emit(`update:modelValue`,e)},c({default:m(()=>[(g(!0),s(l,null,h(n.voices,r=>(g(),p(b,{key:r.voice_id,label:n.labelFor(r),value:r.voice_id},{default:m(()=>[e(`span`,Ct,[e(`span`,wt,i(n.labelFor(r)),1),e(`button`,{type:`button`,class:`option-remove`,"aria-label":n.$t(`common.button.delete`),title:n.$t(`common.button.delete`),onClick:t(e=>n.onRemove(r.voice_id),[`stop`])},[a(y,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Tt)])]),_:2},1032,[`label`,`value`]))),128))]),_:2},[n.voices.length===0?{name:`empty`,fn:m(()=>[e(`p`,Et,i(n.$t(`digitalhuman.message.noVoiceYet`)),1)]),key:`0`}:void 0]),1032,[`model-value`,`placeholder`])]),a(C,{size:`small`,text:``,type:`primary`,class:`clone`,onClick:o[1]||=e=>n.dialogVisible=!0},{default:m(()=>[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.button.cloneNewVoice`)),1)]),_:1}),a(w,{visible:n.dialogVisible,"onUpdate:visible":o[2]||=e=>n.dialogVisible=e,onCloned:n.onCloned},null,8,[`visible`,`onCloned`])])}var Ot=v({name:`ConfigPanel`,components:{MetaTag:_e,ServicePricingSummary:Le,ElButton:H,ElCollapse:k,ElCollapseItem:O,ElInputNumber:j,ElRadioButton:E,ElRadioGroup:D,InfoIcon:te,MagicIcon:L,MediaInput:Z,PromptTextarea:ne,TimbreSelector:z(bt,[[`render`,Dt],[`__scopeId`,`data-v-e191cc56`]]),WarningIcon:I,ScenarioPaymentMode:ze},emits:[`generate`],data(){return{faceMode:`video`,voiceMode:`text`,advancedOpen:[],DIGITALHUMAN_VIDEO_ACCEPT:ge,DIGITALHUMAN_IMAGE_ACCEPT:pe,DIGITALHUMAN_AUDIO_ACCEPT:R,quoteTimer:0,quoteRunId:0}},computed:{config(){return this.$store.state.digitalhuman?.config},service(){return this.$store.state.digitalhuman?.service},consumption(){return Se(this.config,this.service?.cost)},missing(){let e=[];return(this.faceMode===`video`?this.config?.video_url:this.config?.image_url)||e.push({key:`face`,message:this.$t(`digitalhuman.message.missingFace`)}),this.voiceMode===`text`?(this.config?.text?.trim()||e.push({key:`text`,message:this.$t(`digitalhuman.message.missingText`)}),this.config?.voice_id||e.push({key:`timbre`,message:this.$t(`digitalhuman.message.missingTimbre`)})):this.config?.audio_url||e.push({key:`audio`,message:this.$t(`digitalhuman.message.missingAudio`)}),e},text:{get(){return this.config?.text},set(e){this.update({text:e})}},voiceId:{get(){return this.config?.voice_id},set(e){this.update({voice_id:e})}},speed:{get(){return this.config?.speed??1},set(e){this.update({speed:e})}},walletMode(){return B()&&V(`digitalhuman`).mode===`wallet`}},watch:{walletMode:{handler(e){e&&this.scheduleQuote()},immediate:!0},config:{handler(){this.walletMode&&this.scheduleQuote()},deep:!0},faceMode(){this.walletMode&&this.scheduleQuote()},voiceMode(){this.walletMode&&this.scheduleQuote()}},mounted(){this.config?.image_url&&!this.config?.video_url&&(this.faceMode=`photo`),this.config?.audio_url&&(this.voiceMode=`audio`)},beforeUnmount(){window.clearTimeout(this.quoteTimer),this.quoteRunId+=1},methods:{scheduleQuote(){window.clearTimeout(this.quoteTimer),this.quoteTimer=window.setTimeout(this.refreshQuote,350)},async refreshQuote(){let e=V(`digitalhuman`),t=++this.quoteRunId;e.quoteLoading=!0,e.quoteUsdc=void 0;try{let n=K(this.config,this.faceMode,this.voiceMode),r=await U.quote(n);t===this.quoteRunId&&e.mode===`wallet`&&(e.quoteUsdc=r.amountUsdc)}catch(e){console.warn(`x402 quote failed`,e)}finally{t===this.quoteRunId&&(e.quoteLoading=!1)}},isMissing(e){return this.missing.some(t=>t.key===e)},update(e){this.$store.commit(`digitalhuman/setConfig`,{...this.config,...e})},onFaceModeChange(e){this.update(e===`video`?{image_url:void 0}:{video_url:void 0})},onVoiceModeChange(e){this.update(e===`audio`?{text:void 0,voice_id:void 0}:{audio_url:void 0})},onFaceVideoChange(e){this.update({video_url:e})},onFacePhotoChange(e){this.update({image_url:e})},onAudioChange(e){this.update({audio_url:e})},onGenerate(){let e=this.missing[0];if(e){T.warning(e.message);let t=e.key===`face`?`face`:`voice`;this.$refs[t]?.scrollIntoView?.({behavior:`smooth`,block:`center`});return}this.$emit(`generate`,K(this.config,this.faceMode,this.voiceMode))}}}),kt={class:`flex flex-col h-full`},At={class:`flex-1 overflow-y-auto p-5`},jt={ref:`face`,class:`field-block mb-6`},Mt={class:`field-head`},Nt={class:`field-title font-bold`},Pt={ref:`voice`,class:`field-block mb-6`},Ft={class:`field-head`},It={class:`field-title font-bold`},Lt={class:`field-row`},Rt={class:`field-head`},zt={class:`field-title font-bold`},Bt={class:`flex flex-col items-center justify-center px-5 pb-5`},Vt={key:0,class:`hint-missing`},Ht={class:`hint-eta`};function Ut(t,n,c,d,f,h){let _=u(`meta-tag`),v=u(`info-icon`),y=u(`el-radio-button`),b=u(`el-radio-group`),x=u(`media-input`),S=u(`prompt-textarea`),C=u(`timbre-selector`),w=u(`el-input-number`),T=u(`el-collapse-item`),E=u(`el-collapse`),D=u(`warning-icon`),O=u(`scenario-payment-mode`),k=u(`service-pricing-summary`),A=u(`magic-icon`),j=u(`el-button`);return g(),s(`div`,kt,[e(`div`,At,[e(`section`,jt,[e(`div`,Mt,[e(`h2`,Nt,i(t.$t(`digitalhuman.name.step1`)),1),t.isMissing(`face`)?(g(),p(_,{key:0,class:`required-badge`,density:`compact`,tone:`warning`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.required`)),1)]),_:1})):o(``,!0),a(v,{content:t.$t(`digitalhuman.description.step1`),class:`ml-1`},null,8,[`content`])]),a(b,{modelValue:t.faceMode,"onUpdate:modelValue":n[0]||=e=>t.faceMode=e,class:`mode-switch mb-3`,onChange:t.onFaceModeChange},{default:m(()=>[a(y,{value:`video`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.faceModeVideo`)),1)]),_:1}),a(y,{value:`photo`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.faceModePhoto`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),t.faceMode===`video`?(g(),p(x,{key:0,kind:`video`,accept:t.DIGITALHUMAN_VIDEO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadFaceVideo`),hint:t.$t(`digitalhuman.message.faceVideoHint`),onChange:t.onFaceVideoChange},null,8,[`accept`,`button-text`,`hint`,`onChange`])):(g(),p(x,{key:1,kind:`image`,accept:t.DIGITALHUMAN_IMAGE_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadFacePhoto`),hint:t.$t(`digitalhuman.message.facePhotoHint`),onChange:t.onFacePhotoChange},null,8,[`accept`,`button-text`,`hint`,`onChange`]))],512),e(`section`,Pt,[e(`div`,Ft,[e(`h2`,It,i(t.$t(`digitalhuman.name.step2`)),1),t.isMissing(`text`)||t.isMissing(`timbre`)||t.isMissing(`audio`)?(g(),p(_,{key:0,class:`required-badge`,density:`compact`,tone:`warning`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.required`)),1)]),_:1})):o(``,!0),a(v,{content:t.$t(`digitalhuman.description.step2`),class:`ml-1`},null,8,[`content`])]),a(b,{modelValue:t.voiceMode,"onUpdate:modelValue":n[1]||=e=>t.voiceMode=e,class:`mode-switch mb-3`,onChange:t.onVoiceModeChange},{default:m(()=>[a(y,{value:`text`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.voiceModeText`)),1)]),_:1}),a(y,{value:`audio`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.voiceModeAudio`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),t.voiceMode===`text`?(g(),s(l,{key:0},[a(S,{modelValue:t.text,"onUpdate:modelValue":n[2]||=e=>t.text=e,class:`mb-3`,title:t.$t(`digitalhuman.name.speech`),placeholder:t.$t(`digitalhuman.placeholder.speech`),"min-rows":5,"max-rows":14},null,8,[`modelValue`,`title`,`placeholder`]),a(C,{modelValue:t.voiceId,"onUpdate:modelValue":n[3]||=e=>t.voiceId=e},null,8,[`modelValue`])],64)):(g(),p(x,{key:1,kind:`audio`,accept:t.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadSpeechAudio`),hint:t.$t(`digitalhuman.message.audioHint`),onChange:t.onAudioChange},null,8,[`accept`,`button-text`,`hint`,`onChange`]))],512),a(E,{modelValue:t.advancedOpen,"onUpdate:modelValue":n[5]||=e=>t.advancedOpen=e,class:`advanced`},{default:m(()=>[a(T,{name:`advanced`,title:t.$t(`digitalhuman.name.advanced`)},{default:m(()=>[e(`div`,Lt,[e(`div`,Rt,[e(`h2`,zt,i(t.$t(`digitalhuman.name.speed`)),1),a(v,{content:t.$t(`digitalhuman.description.speed`),class:`ml-1`},null,8,[`content`])]),a(w,{modelValue:t.speed,"onUpdate:modelValue":n[4]||=e=>t.speed=e,class:`field-control`,min:.5,max:2,step:.1,precision:1,"controls-position":`right`},null,8,[`modelValue`])])]),_:1},8,[`title`])]),_:1},8,[`modelValue`])]),e(`div`,Bt,[t.missing.length>0?(g(),s(`p`,Vt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.missing[0].message),1)])):o(``,!0),a(O,{scenario:`digitalhuman`}),t.walletMode?o(``,!0):(g(),p(k,{key:1,value:t.consumption,service:t.service},null,8,[`value`,`service`])),a(j,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:m(()=>[a(A,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`digitalhuman.button.generateVideo`)),1)]),_:1},8,[`onClick`]),e(`p`,Ht,i(t.$t(`digitalhuman.message.eta`)),1)])])}var Wt=z(Ot,[[`render`,Ut],[`__scopeId`,`data-v-a43f6be7`]]),Gt=[`.jpg`,`.jpeg`,`.png`,`.webp`,`.bmp`,`.gif`],Kt=v({name:`TaskPreview`,components:{ApiCodeButton:Be,AudioPreview:Y,ChannelIcon:ee,CopyToClipboard:Ne,DeleteIcon:F,ElAlert:C,ElButton:H,ElProgress:M,ElTooltip:S,FullscreenIcon:ie,ImagePreview:J,InfoIcon:P,MagicIcon:L,ReportButton:Pe,TimeIcon:N,VideoPlayer:Re,VideoPreview:X,WarningIcon:I},props:{modelValue:{type:Object,required:!0}},computed:{status(){return this.modelValue?.status||this.modelValue?.response?.state||`pending`},isSuccess(){return[`succeed`,`succeeded`].includes(this.status)||!!this.modelValue?.response?.video_url},isFailure(){return[`failed`,`dead`].includes(this.status)||this.modelValue?.response?.success===!1},isTerminal(){return this.isSuccess||this.isFailure},videoUrl(){return this.modelValue?.response?.video_url},progressPct(){let e=this.modelValue?.response?.progress;return typeof e==`number`?e:0},voiceLabel(){return this.modelValue?.request?.audio_url?this.$t(`digitalhuman.name.audioDriven`):this.$t(`digitalhuman.name.textDriven`)},faceUrl(){return this.modelValue?.request?.video_url||this.modelValue?.request?.image_url},isPhotoFace(){if(this.modelValue?.request?.image_url)return!0;let e=(this.faceUrl||``).split(`?`)[0].toLowerCase();return Gt.some(t=>e.endsWith(t))},audioUrl(){return this.modelValue?.request?.audio_url},outputSize(){let{width:e,height:t}=this.modelValue?.response||{};return e&&t?`${e}×${t}`:void 0},etaText(){let e=parseFloat((this.modelValue?.created_at||``).toString());if(!e)return;let t=fe-(Date.now()/1e3-e);return t<=60?this.$t(`digitalhuman.message.etaAlmostDone`):this.$t(`digitalhuman.message.etaRemaining`,{minutes:Math.ceil(t/60)})},statusLabel(){let e=`digitalhuman.status.${this.status}`,t=this.$t(e);return t===e?this.$t(`digitalhuman.status.processing`):t},failureReason(){let e=this.modelValue?.response?.error;if(e)return typeof e==`string`?e:e?.message}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await q.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`digitalhuman/deleteTask`,{id:e}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),window.open(t,`_blank`)}}}),qt={class:`preview`},Jt={class:`left`},Yt={class:`main`},Xt={class:`bot`},Zt={class:`datetime`},Qt=[`aria-label`],$t={class:`info`},en={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},tn={class:`prompt mt-2`},nn={key:0},rn={key:0,class:`content`},an={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},cn={key:1,class:`content`},ln={class:`operations mt-2`},un={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},hn={key:2,class:`content`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function bn(n,c,l,d,f,h){let _=u(`capability-presentation`),v=u(`delete-icon`),y=u(`el-tooltip`),b=u(`image-preview`),x=u(`video-preview`),S=u(`audio-preview`),C=u(`time-icon`),w=u(`el-progress`),T=u(`magic-icon`),E=u(`copy-to-clipboard`),D=u(`el-alert`),O=u(`video-player`),k=u(`el-button`),A=u(`api-code-button`),j=u(`report-button`),M=u(`fullscreen-icon`),N=u(`channel-icon`),ee=u(`warning-icon`),P=u(`info-icon`);return g(),s(`div`,qt,[e(`div`,Jt,[a(_,{capability:`digitalhuman`,part:`avatar`,class:`avatar`})]),e(`div`,Yt,[e(`div`,Xt,[a(_,{capability:`digitalhuman`,part:`name`}),e(`span`,Zt,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:m(()=>[n.modelValue?.id?(g(),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,Qt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,$t,[n.faceUrl||n.audioUrl?(g(),s(`div`,en,[n.faceUrl&&n.isPhotoFace?(g(),p(b,{key:0,url:n.faceUrl,name:`face`,closable:!1},null,8,[`url`])):n.faceUrl?(g(),p(x,{key:1,url:n.faceUrl,name:`face`},null,8,[`url`])):o(``,!0),n.audioUrl?(g(),p(S,{key:2,url:n.audioUrl,name:`audio`},null,8,[`url`])):o(``,!0)])):o(``,!0),e(`p`,tn,[r(i(n.modelValue?.request?.text||n.voiceLabel)+` `,1),n.isTerminal?o(``,!0):(g(),s(`span`,nn,` - (`+i(n.statusLabel)+`) `,1))])]),n.isTerminal?o(``,!0):(g(),s(`div`,rn,[a(D,{closable:!1,class:`info-state`},{default:m(()=>[e(`p`,an,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.statusLabel),1)]),a(w,{percentage:n.progressPct,"stroke-width":6,class:`mb-2`},null,8,[`percentage`]),n.etaText?(g(),s(`p`,on,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.etaLabel`))+`: `+i(n.etaText),1)])):o(``,!0),e(`p`,sn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])),n.isSuccess?(g(),s(`div`,cn,[n.videoUrl?(g(),p(O,{key:0,src:n.videoUrl},null,8,[`src`])):o(``,!0),e(`div`,ln,[n.videoUrl?(g(),p(k,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=e=>n.onDownload(e,n.videoUrl)},{default:m(()=>[r(i(n.$t(`digitalhuman.button.download`)),1)]),_:1})):o(``,!0),a(A,{path:`/digital-human/videos`,body:n.modelValue?.request},null,8,[`body`]),a(j,{service:`digitalhuman`,"target-id":n.modelValue?.id,snapshot:{text:n.modelValue?.request?.text}},null,8,[`target-id`,`snapshot`])]),a(D,{closable:!1,class:`mt-2 success`},{default:m(()=>[n.modelValue?.response?.duration?(g(),s(`p`,un,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.duration`))+`: `+i(n.modelValue?.response?.duration?.toFixed(1))+`s `,1)])):o(``,!0),n.outputSize?(g(),s(`p`,dn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.outputSize`))+`: `+i(n.outputSize),1)])):o(``,!0),e(`p`,fn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,pn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,mn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),n.isFailure?(g(),s(`div`,hn,[a(D,{closable:!1,class:`failure`},{template:m(()=>[a(ee,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.failure`)),1)]),default:m(()=>[e(`p`,gn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),n.failureReason?(g(),s(`p`,_n,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.failureReason`))+`: `+i(n.failureReason)+` `,1),a(E,{content:n.failureReason},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(g(),s(`p`,vn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,yn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var xn=v({name:`RecentPanel`,components:{TaskPreview:z(Kt,[[`render`,bn],[`__scopeId`,`data-v-342f1d6d`]]),NoTasks:ae,BotPlaceholder:Ve,ScrollList:re},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.digitalhuman?.tasks,items:this.$store.state.digitalhuman?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Sn={key:0},Cn={key:2,class:`w-full h-full flex items-center justify-center`};function wn(e,t,n,r,i,c){let d=u(`bot-placeholder`),f=u(`task-preview`),_=u(`scroll-list`),v=u(`no-tasks`);return g(),s(l,null,[e.tasks?.items===void 0?(g(),s(`div`,Sn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),p(_,{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(()=>[(g(!0),s(l,null,h(e.tasks?.items,(e,t)=>(g(),p(f,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,Cn,[a(v)])):o(``,!0)],64)}var Tn=v({name:`DigitalHumanIndex`,components:{ConfigPanel:Wt,Layout:Je,RecentPanel:z(xn,[[`render`,wn]])},mixins:[ke,He(`digitalhuman`,!1)],inject:[`initialized`],data(){return{job:0,loadingMore:!1,fetchingTasks:!1,walletTaskIds:[]}},computed:{applicationsLoading(){return this.$store.state.digitalhuman?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.digitalhuman?.status?.getTasks===w.Request||this.fetchingTasks},credential(){return this.$store.state.digitalhuman.credential},config(){return this.$store.state.digitalhuman.config},tasks(){return this.$store.state.digitalhuman.tasks},walletMode(){return B()&&V(`digitalhuman`).mode===`wallet`}},watch:{walletMode:{async handler(e,t){if(!(t===void 0||e===t)){if(this.$store.commit(`digitalhuman/setTasks`,void 0),e&&!this.job&&(this.job=window.setInterval(this.onPollTasks,5e3)),!e&&!this.credential?.token){window.clearInterval(this.job),this.job=0,await this.onScrollDown();return}await this.onGetTasks(),await this.onScrollDown()}}},initialized:{async handler(e){window.clearInterval(this.job),e&&(await this.onGetTasks(),await this.onScrollDown(),this.job||=window.setInterval(this.onPollTasks,5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await oe({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`digitalhuman/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`digitalhuman/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r,...this.walletMode&&!this.credential?.token?{mode:`x402`,ids:this.walletTaskIds}:{}})}finally{this.fetchingTasks=!1}},async onGenerate(e){if(!Ce(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;let t;if(this.walletMode){let n=this.getWalletContext();if(!n){T.warning(this.$t(`common.x402Scenario.connectWalletFirst`));return}t=U.generate(e,{mode:`x402`,x402:{wallet:n,confirm:e=>this.confirmWalletPayment(e),identityToken:this.credential?.token}})}else{if(!Ae())return;let n=this.credential?.token;if(!n)return;t=U.generate(e,{token:n})}T.info(this.$t(`digitalhuman.message.startingTask`)),Oe(`digitalhuman`,t).then(e=>{let t=e?.data?.task_id;this.walletMode&&!this.credential?.token&&t&&!this.walletTaskIds.includes(t)&&this.walletTaskIds.unshift(t),T.success(this.$t(`digitalhuman.message.startTaskSuccess`))}).catch(e=>{e instanceof G||xe(e,`digitalhuman`)||(this.walletMode?T.error(this.$t(`common.x402Scenario.paymentFailed`)):T.error(this.$t(`digitalhuman.message.startTaskFailed`)))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getWalletContext(){return W(this.$wallet)},async confirmWalletPayment(e){return q.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 En(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`layout`);return g(),p(l,null,{config:m(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Dn=z(Tn,[[`render`,En]]);export{Dn 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,P as c,T as l,at as u,ht as d,it as f,j as p,mt 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-GALwUZll.js";import{t as x}from"./upload-Sju4DbiY.js";import{t as S}from"./tooltip-4w7ghPQM.js";import{t as C}from"./alert-BprQRUmf.js";import{_ as w,v as T}from"./vuex.esm-bundler-BV9tXD4i.js";import{n as E,r as D}from"./radio-BNhFzeBO.js";import{n as O,t as k}from"./collapse-Dwaru9dv.js";import{t as A}from"./drawer-APcI0MuL.js";import{t as j}from"./input-number-CQyq1gfs.js";import{t as M}from"./progress-BuyYfFZn.js";import{t as N}from"./clock-BooSG6zB.js";import{t as ee}from"./hash-GTQkcsQj.js";import{t as P}from"./info-PmX6OJ8X.js";import{a as te,i as ne,n as re,o as ie,r as ae,t as oe}from"./pagination-W-HQ78h5.js";import{t as se}from"./music-2-DimqlZ0P.js";import{t as ce}from"./plus-B_fnUe1I.js";import{t as F}from"./trash-2-BkEkcSHv.js";import{t as I}from"./triangle-alert-DBmpuUlm.js";import{t as le}from"./upload-DidTvyIg.js";import{t as ue}from"./user-D8eTVZ1t.js";import{t as de}from"./video-DwVV0C_d.js";import{t as L}from"./wand-sparkles-CwgjO5Gl.js";import{Gr as fe,Kr as pe,Ur as me,Wr as R,Xr as he,Yr as ge}from"./constants-GmVIn7tC.js";import{D as z,Fa as _e,Ga as ve,La as ye,Mi as B,Na as be,Pi as V,Qa as H,T as xe,Tn as Se,at as Ce,br as U,ct as we,lt as Te,oi as W,oo as Ee,ot as De,qi as Oe,ri as G,st as ke,ta as Ae,tt as je,vr as K,yr as Me,za as q}from"./index-Dr2ooWnm.js";import{t as Ne}from"./CopyToClipboard-CQT78wob.js";import{t as Pe}from"./ReportButton-B6G5OWJ0.js";import{t as J}from"./ImagePreview-YXx0To-U.js";import{n as Fe}from"./taskDrawerMixin-DyAUhFEq.js";import{n as Ie,t as Le}from"./ServicePricingSummary-rLPlqY7R.js";import{t as Y}from"./AudioPreview-DbtJFAs7.js";import{t as Re}from"./VideoPlayer-DuUSbT-p.js";import{t as X}from"./VideoPreview-DiHzfmhx.js";import{t as ze}from"./ScenarioPaymentMode-DRMdqOm9.js";import{t as Be}from"./ApiCodeButton-DSt2Pz0O.js";import{t as Ve}from"./BotPlaceholder-BC8u-j84.js";import{t as He}from"./taskPollingMixin-CcLxtz8z.js";var Ue=v({name:`LayoutDigitalHuman`,components:{UserIcon:ue,ElDrawer:A,ElButton:H},mixins:[Fe]}),We={class:`main flex flex-row flex-1`},Ge={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-4 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function qe(t,n,r,i,o,c){let l=u(`user-icon`),p=u(`el-button`),h=u(`el-drawer`);return g(),s(`div`,We,[e(`div`,Ge,[f(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ke,[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`]),[[_,!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:m(()=>[f(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Je=z(Ue,[[`render`,qe],[`__scopeId`,`data-v-909c6359`]]),Ye=v({name:`DigitalHumanMediaInput`,components:{AudioPreview:Y,CloseIcon:ye,ElButton:H,ElProgress:M,ElUpload:x,ImagePreview:J,MusicIcon:se,UploadIcon:le,VideoIcon:de,VideoPreview:X},mixins:[Te,we,De,je],props:{kind:{type:String,required:!0},accept:{type:String,default:``},buttonText:{type:String,default:``},hint:{type:String,default:``}},emits:[`change`],data(){return{fileList:[],uploadUrl:be()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},hasFile(){return this.fileList.length>0}},methods:{uploadedUrl(e){return e?.response?.file_url},isPending(e){return e.status===`ready`||e.status===`uploading`},onExceed(e){let t=this.$refs.uploader;t?.clearFiles();let n=e[0];n&&(t?.handleStart?.(n),t?.submit?.())},onError(){T.error(this.$t(`digitalhuman.message.uploadError`))},onRemoveFile(e){let t=this.fileList.indexOf(e);t>=0&&this.fileList.splice(t,1),this.onChange()},onChange(){let e=this.fileList?.[0];this.$emit(`change`,e?this.uploadedUrl(e):void 0)}}}),Xe={class:`thumb`},Ze={key:2,class:`placeholder`},Qe=[`title`],$e=[`aria-label`,`title`,`onClick`],et={key:0,class:`hint`};function tt(c,d,f,h,_,v){let y=u(`image-preview`),b=u(`video-preview`),x=u(`audio-preview`),S=u(`el-progress`),C=u(`video-icon`),w=u(`music-icon`),T=u(`close-icon`),E=u(`upload-icon`),D=u(`el-button`),O=u(`el-upload`);return g(),p(O,{ref:`uploader`,"file-list":c.fileList,"onUpdate:fileList":d[0]||=e=>c.fileList=e,accept:c.accept,name:`file`,class:`media-input`,limit:1,multiple:!1,"before-upload":c.beforeUploadSizeGuard,action:c.uploadUrl,headers:c.headers,"on-exceed":c.onExceed,"on-error":c.onError,"on-success":c.onChange,"on-remove":c.onChange},{file:m(({file:r})=>[e(`div`,{class:n([`slot`,{pending:c.isPending(r)}])},[c.kind===`image`&&r.url?(g(),p(y,{key:0,url:r.url,name:r.name,percentage:r.percentage,onRemove:e=>c.onRemoveFile(r)},null,8,[`url`,`name`,`percentage`,`onRemove`])):(g(),s(l,{key:1},[e(`div`,Xe,[c.kind===`video`&&c.uploadedUrl(r)?(g(),p(b,{key:0,url:c.uploadedUrl(r)},null,8,[`url`])):c.kind===`audio`&&c.uploadedUrl(r)?(g(),p(x,{key:1,url:c.uploadedUrl(r)},null,8,[`url`])):(g(),s(`div`,Ze,[c.isPending(r)?(g(),p(S,{key:0,type:`circle`,"stroke-width":4,percentage:Math.round(r.percentage||0),width:34},null,8,[`percentage`])):c.kind===`video`?(g(),p(C,{key:1,size:`1em`,"aria-hidden":`true`,focusable:`false`})):(g(),p(w,{key:2,size:`1em`,"aria-hidden":`true`,focusable:`false`}))]))]),e(`span`,{class:`filename`,title:r.name},i(r.name),9,Qe),e(`button`,{type:`button`,class:`remove`,"aria-label":c.$t(`common.button.close`),title:c.$t(`common.button.close`),onClick:t(e=>c.onRemoveFile(r),[`stop`])},[a(T,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,$e)],64))],2)]),default:m(()=>[a(D,{round:``,type:`primary`,size:`small`,class:`btn`},{default:m(()=>[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(c.hasFile?c.$t(`digitalhuman.button.replace`):c.buttonText),1)]),_:1}),c.hint?(g(),s(`p`,et,i(c.hint),1)):o(``,!0)]),_:1},8,[`file-list`,`accept`,`before-upload`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`])}var Z=z(Ye,[[`render`,tt],[`__scopeId`,`data-v-db0590a9`]]),nt=20,Q=e=>{let t=e;return!!t&&typeof t.voice_id==`string`&&!!t.voice_id&&typeof t.name==`string`},$=()=>{try{let e=JSON.parse(localStorage.getItem(`digitalhuman.voices`)||`[]`);return Array.isArray(e)?e.filter(Q).map(e=>({voice_id:e.voice_id,name:e.name,lang:typeof e.lang==`string`?e.lang:`zh`,created_at:typeof e.created_at==`number`?e.created_at:0})):[]}catch{return[]}},rt=e=>{try{localStorage.setItem(he,JSON.stringify(e))}catch{}return e},it=e=>Q(e)?rt([e,...$().filter(t=>t.voice_id!==e.voice_id)].slice(0,nt)):$(),at=e=>rt($().filter(t=>t.voice_id!==e)),ot=e=>`${e} ${$().length+1}`,st=3e3,ct=60,lt=v({name:`DigitalHumanVoiceCloneDialog`,components:{Consumption:Ie,ElAlert:C,ElButton:H,ElDialog:ve,ElInput:Ee,ElRadioButton:E,ElRadioGroup:D,MediaInput:Z},props:{visible:{type:Boolean,default:!1}},emits:[`update:visible`,`cloned`],data(){return{sampleUrl:void 0,name:``,lang:`zh`,cloning:!1,destroyed:!1,runId:0,DIGITALHUMAN_AUDIO_ACCEPT:R,DIGITALHUMAN_VOICE_CLONE_CONSUMPTION:2,voiceQuoteUsdc:void 0,voiceQuoteLoading:!1,quoteRunId:0}},computed:{service(){return this.$store.state.digitalhuman?.service},credentialToken(){return this.$store.state.digitalhuman?.credential?.token},walletMode(){return B()&&V(`digitalhuman`).mode===`wallet`},langOptions(){return me.map(e=>({value:e,label:this.$t(`digitalhuman.name.lang_${e}`)}))}},watch:{walletMode(e){this.voiceQuoteUsdc=void 0,e&&this.visible&&this.sampleUrl&&this.refreshVoiceQuote()},visible(e){e?(this.sampleUrl=void 0,this.name=ot(this.$t(`digitalhuman.name.myVoice`)),this.lang=`zh`):(this.runId++,this.quoteRunId++,this.cloning=!1,this.voiceQuoteLoading=!1)}},beforeUnmount(){this.destroyed=!0,this.runId++,this.quoteRunId++},methods:{onVisible(e){this.cloning&&!e||this.$emit(`update:visible`,e)},onSampleChange(e){this.sampleUrl=e,this.voiceQuoteUsdc=void 0,e&&this.walletMode&&this.refreshVoiceQuote()},isStale(e){return this.destroyed||e!==this.runId},sleep(e){return new Promise(t=>setTimeout(t,e))},async refreshVoiceQuote(){if(!this.sampleUrl)return;let e=++this.quoteRunId;this.voiceQuoteLoading=!0;try{let t=await U.quoteVoice(this.voiceRequest());e===this.quoteRunId&&this.walletMode&&(this.voiceQuoteUsdc=t.amountUsdc)}catch(e){console.warn(`x402 voice quote failed`,e)}finally{e===this.quoteRunId&&(this.voiceQuoteLoading=!1)}},voiceRequest(){return Me({audio_url:this.sampleUrl||``,lang:this.lang,name:this.name||void 0})},paymentOptions(){if(!this.walletMode)return this.credentialToken?{token:this.credentialToken}:void 0;let e=this.getWalletContext();if(!e){T.warning(this.$t(`common.x402Scenario.connectWalletFirst`));return}return{mode:`x402`,x402:{wallet:e,confirm:e=>this.confirmWalletPayment(e),identityToken:this.credentialToken}}},async onClone(){if(!this.sampleUrl)return;let e=this.paymentOptions();if(!e)return;let t=++this.runId;this.cloning=!0;try{let{data:n}=await U.cloneVoice(this.voiceRequest(),e);if(this.isStale(t))return;if(n?.voice_id){this.onCloned(n.voice_id);return}if(n?.task_id)await this.pollVoice(n.task_id,t);else throw Error(`no task`)}catch(e){if(e instanceof G)return;this.isStale(t)||T.error(this.$t(`digitalhuman.message.voiceCloneFailed`))}finally{this.isStale(t)||(this.cloning=!1)}},async pollVoice(e,t){for(let n=0;n<ct;n++){if(this.isStale(t)||(await this.sleep(st),this.isStale(t)))return;let n=this.credentialToken,{data:r}=await U.pollTask(e,n?{token:n}:{mode:`x402`});if(this.isStale(t))return;if(r?.voice_id){this.onCloned(r.voice_id);return}if(r?.state===`failed`)throw Error(`clone failed`)}throw Error(`timeout`)},getWalletContext(){return W(this.$wallet)},async confirmWalletPayment(e){return q.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)},onCloned(e){it({voice_id:e,name:this.name||this.$t(`digitalhuman.name.myVoice`),lang:this.lang,created_at:Date.now()/1e3}),T.success(this.$t(`digitalhuman.message.voiceCloneSuccess`)),this.cloning=!1,this.$emit(`cloned`,e),this.$emit(`update:visible`,!1)}}}),ut={class:`text-xs text-[var(--el-text-color-secondary)] mb-3`},dt={class:`field mb-3`},ft={class:`label`},pt={class:`field`},mt={class:`label`},ht={class:`text-xs mb-0`},gt={key:1,class:`mt-4 text-xs text-[var(--el-text-color-secondary)]`},_t={class:`footer`},vt={key:0,class:`cost text-xs text-[var(--el-text-color-secondary)]`};function yt(t,n,o,c,d,f){let _=u(`media-input`),v=u(`el-input`),y=u(`el-radio-button`),b=u(`el-radio-group`),x=u(`el-alert`),S=u(`consumption`),C=u(`el-button`),w=u(`el-dialog`);return g(),p(w,{"model-value":t.visible,title:t.$t(`digitalhuman.name.cloneVoice`),width:`440`,"align-center":``,"append-to-body":``,"close-on-click-modal":!t.cloning,"close-on-press-escape":!t.cloning,"onUpdate:modelValue":t.onVisible},{footer:m(()=>[e(`div`,_t,[t.walletMode?(g(),s(`span`,vt,i(t.voiceQuoteLoading?`…`:t.voiceQuoteUsdc?`${t.voiceQuoteUsdc} USDC`:t.$t(`common.x402Scenario.quoteBeforeSigning`)),1)):(g(),p(S,{key:1,value:t.DIGITALHUMAN_VOICE_CLONE_CONSUMPTION,service:t.service,class:`cost`},null,8,[`value`,`service`])),e(`div`,null,[a(C,{disabled:t.cloning,onClick:n[2]||=e=>t.onVisible(!1)},{default:m(()=>[r(i(t.$t(`common.button.cancel`)),1)]),_:1},8,[`disabled`]),a(C,{type:`primary`,loading:t.cloning,disabled:!t.sampleUrl||t.cloning,onClick:t.onClone},{default:m(()=>[r(i(t.$t(`digitalhuman.button.startClone`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])])])]),default:m(()=>[e(`p`,ut,i(t.$t(`digitalhuman.message.voiceCloneHint`)),1),a(_,{kind:`audio`,accept:t.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadSample`),hint:t.$t(`digitalhuman.message.audioHint`),class:`mb-4`,onChange:t.onSampleChange},null,8,[`accept`,`button-text`,`hint`,`onChange`]),e(`div`,dt,[e(`span`,ft,i(t.$t(`digitalhuman.name.voiceName`)),1),a(v,{modelValue:t.name,"onUpdate:modelValue":n[0]||=e=>t.name=e,class:`control`,placeholder:t.$t(`digitalhuman.placeholder.voiceName`)},null,8,[`modelValue`,`placeholder`])]),e(`div`,pt,[e(`span`,mt,i(t.$t(`digitalhuman.name.voiceLang`)),1),a(b,{modelValue:t.lang,"onUpdate:modelValue":n[1]||=e=>t.lang=e,class:`control`},{default:m(()=>[(g(!0),s(l,null,h(t.langOptions,e=>(g(),p(y,{key:e.value,value:e.value},{default:m(()=>[r(i(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])]),t.cloning?(g(),p(x,{key:0,closable:!1,type:`info`,class:`mt-4`},{default:m(()=>[e(`p`,ht,i(t.$t(`digitalhuman.message.voiceCloneRunning`)),1)]),_:1})):(g(),s(`p`,gt,i(t.$t(`digitalhuman.message.voiceStoredLocally`)),1))]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`onUpdate:modelValue`])}var bt=v({name:`DigitalHumanTimbreSelector`,components:{AddIcon:ce,DeleteIcon:F,ElButton:H,ElOption:b,ElSelect:y,VoiceCloneDialog:z(lt,[[`render`,yt],[`__scopeId`,`data-v-037c810e`]])},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{voices:$(),dialogVisible:!1}},mounted(){this.modelValue&&!this.voices.some(e=>e.voice_id===this.modelValue)&&this.$emit(`update:modelValue`,void 0)},methods:{labelFor(e){let t=this.$t(`digitalhuman.name.lang_${e.lang}`);return t.startsWith(`digitalhuman.`)?e.name:`${e.name} · ${t}`},onCloned(e){this.voices=$(),this.$emit(`update:modelValue`,e)},onRemove(e){this.voices=at(e),this.modelValue===e&&this.$emit(`update:modelValue`,void 0)}}}),xt={class:`row`},St={class:`label`},Ct={class:`option`},wt={class:`option-name`},Tt=[`aria-label`,`title`,`onClick`],Et={class:`empty`};function Dt(n,o,d,f,_,v){let y=u(`delete-icon`),b=u(`el-option`),x=u(`el-select`),S=u(`add-icon`),C=u(`el-button`),w=u(`voice-clone-dialog`);return g(),s(`div`,null,[e(`div`,xt,[e(`span`,St,i(n.$t(`digitalhuman.name.timbre`)),1),a(x,{"model-value":n.modelValue,class:`control`,placeholder:n.$t(`digitalhuman.placeholder.pickTimbre`),"onUpdate:modelValue":o[0]||=e=>n.$emit(`update:modelValue`,e)},c({default:m(()=>[(g(!0),s(l,null,h(n.voices,r=>(g(),p(b,{key:r.voice_id,label:n.labelFor(r),value:r.voice_id},{default:m(()=>[e(`span`,Ct,[e(`span`,wt,i(n.labelFor(r)),1),e(`button`,{type:`button`,class:`option-remove`,"aria-label":n.$t(`common.button.delete`),title:n.$t(`common.button.delete`),onClick:t(e=>n.onRemove(r.voice_id),[`stop`])},[a(y,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Tt)])]),_:2},1032,[`label`,`value`]))),128))]),_:2},[n.voices.length===0?{name:`empty`,fn:m(()=>[e(`p`,Et,i(n.$t(`digitalhuman.message.noVoiceYet`)),1)]),key:`0`}:void 0]),1032,[`model-value`,`placeholder`])]),a(C,{size:`small`,text:``,type:`primary`,class:`clone`,onClick:o[1]||=e=>n.dialogVisible=!0},{default:m(()=>[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.button.cloneNewVoice`)),1)]),_:1}),a(w,{visible:n.dialogVisible,"onUpdate:visible":o[2]||=e=>n.dialogVisible=e,onCloned:n.onCloned},null,8,[`visible`,`onCloned`])])}var Ot=v({name:`ConfigPanel`,components:{MetaTag:_e,ServicePricingSummary:Le,ElButton:H,ElCollapse:k,ElCollapseItem:O,ElInputNumber:j,ElRadioButton:E,ElRadioGroup:D,InfoIcon:te,MagicIcon:L,MediaInput:Z,PromptTextarea:ne,TimbreSelector:z(bt,[[`render`,Dt],[`__scopeId`,`data-v-e191cc56`]]),WarningIcon:I,ScenarioPaymentMode:ze},emits:[`generate`],data(){return{faceMode:`video`,voiceMode:`text`,advancedOpen:[],DIGITALHUMAN_VIDEO_ACCEPT:ge,DIGITALHUMAN_IMAGE_ACCEPT:pe,DIGITALHUMAN_AUDIO_ACCEPT:R,quoteTimer:0,quoteRunId:0}},computed:{config(){return this.$store.state.digitalhuman?.config},service(){return this.$store.state.digitalhuman?.service},consumption(){return Se(this.config,this.service?.cost)},missing(){let e=[];return(this.faceMode===`video`?this.config?.video_url:this.config?.image_url)||e.push({key:`face`,message:this.$t(`digitalhuman.message.missingFace`)}),this.voiceMode===`text`?(this.config?.text?.trim()||e.push({key:`text`,message:this.$t(`digitalhuman.message.missingText`)}),this.config?.voice_id||e.push({key:`timbre`,message:this.$t(`digitalhuman.message.missingTimbre`)})):this.config?.audio_url||e.push({key:`audio`,message:this.$t(`digitalhuman.message.missingAudio`)}),e},text:{get(){return this.config?.text},set(e){this.update({text:e})}},voiceId:{get(){return this.config?.voice_id},set(e){this.update({voice_id:e})}},speed:{get(){return this.config?.speed??1},set(e){this.update({speed:e})}},walletMode(){return B()&&V(`digitalhuman`).mode===`wallet`}},watch:{walletMode:{handler(e){e&&this.scheduleQuote()},immediate:!0},config:{handler(){this.walletMode&&this.scheduleQuote()},deep:!0},faceMode(){this.walletMode&&this.scheduleQuote()},voiceMode(){this.walletMode&&this.scheduleQuote()}},mounted(){this.config?.image_url&&!this.config?.video_url&&(this.faceMode=`photo`),this.config?.audio_url&&(this.voiceMode=`audio`)},beforeUnmount(){window.clearTimeout(this.quoteTimer),this.quoteRunId+=1},methods:{scheduleQuote(){window.clearTimeout(this.quoteTimer),this.quoteTimer=window.setTimeout(this.refreshQuote,350)},async refreshQuote(){let e=V(`digitalhuman`),t=++this.quoteRunId;e.quoteLoading=!0,e.quoteUsdc=void 0;try{let n=K(this.config,this.faceMode,this.voiceMode),r=await U.quote(n);t===this.quoteRunId&&e.mode===`wallet`&&(e.quoteUsdc=r.amountUsdc)}catch(e){console.warn(`x402 quote failed`,e)}finally{t===this.quoteRunId&&(e.quoteLoading=!1)}},isMissing(e){return this.missing.some(t=>t.key===e)},update(e){this.$store.commit(`digitalhuman/setConfig`,{...this.config,...e})},onFaceModeChange(e){this.update(e===`video`?{image_url:void 0}:{video_url:void 0})},onVoiceModeChange(e){this.update(e===`audio`?{text:void 0,voice_id:void 0}:{audio_url:void 0})},onFaceVideoChange(e){this.update({video_url:e})},onFacePhotoChange(e){this.update({image_url:e})},onAudioChange(e){this.update({audio_url:e})},onGenerate(){let e=this.missing[0];if(e){T.warning(e.message);let t=e.key===`face`?`face`:`voice`;this.$refs[t]?.scrollIntoView?.({behavior:`smooth`,block:`center`});return}this.$emit(`generate`,K(this.config,this.faceMode,this.voiceMode))}}}),kt={class:`flex flex-col h-full`},At={class:`flex-1 overflow-y-auto p-5`},jt={ref:`face`,class:`field-block mb-6`},Mt={class:`field-head`},Nt={class:`field-title font-bold`},Pt={ref:`voice`,class:`field-block mb-6`},Ft={class:`field-head`},It={class:`field-title font-bold`},Lt={class:`field-row`},Rt={class:`field-head`},zt={class:`field-title font-bold`},Bt={class:`flex flex-col items-center justify-center px-5 pb-5`},Vt={key:0,class:`hint-missing`},Ht={class:`hint-eta`};function Ut(t,n,c,d,f,h){let _=u(`meta-tag`),v=u(`info-icon`),y=u(`el-radio-button`),b=u(`el-radio-group`),x=u(`media-input`),S=u(`prompt-textarea`),C=u(`timbre-selector`),w=u(`el-input-number`),T=u(`el-collapse-item`),E=u(`el-collapse`),D=u(`warning-icon`),O=u(`scenario-payment-mode`),k=u(`service-pricing-summary`),A=u(`magic-icon`),j=u(`el-button`);return g(),s(`div`,kt,[e(`div`,At,[e(`section`,jt,[e(`div`,Mt,[e(`h2`,Nt,i(t.$t(`digitalhuman.name.step1`)),1),t.isMissing(`face`)?(g(),p(_,{key:0,class:`required-badge`,density:`compact`,tone:`warning`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.required`)),1)]),_:1})):o(``,!0),a(v,{content:t.$t(`digitalhuman.description.step1`),class:`ml-1`},null,8,[`content`])]),a(b,{modelValue:t.faceMode,"onUpdate:modelValue":n[0]||=e=>t.faceMode=e,class:`mode-switch mb-3`,onChange:t.onFaceModeChange},{default:m(()=>[a(y,{value:`video`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.faceModeVideo`)),1)]),_:1}),a(y,{value:`photo`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.faceModePhoto`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),t.faceMode===`video`?(g(),p(x,{key:0,kind:`video`,accept:t.DIGITALHUMAN_VIDEO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadFaceVideo`),hint:t.$t(`digitalhuman.message.faceVideoHint`),onChange:t.onFaceVideoChange},null,8,[`accept`,`button-text`,`hint`,`onChange`])):(g(),p(x,{key:1,kind:`image`,accept:t.DIGITALHUMAN_IMAGE_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadFacePhoto`),hint:t.$t(`digitalhuman.message.facePhotoHint`),onChange:t.onFacePhotoChange},null,8,[`accept`,`button-text`,`hint`,`onChange`]))],512),e(`section`,Pt,[e(`div`,Ft,[e(`h2`,It,i(t.$t(`digitalhuman.name.step2`)),1),t.isMissing(`text`)||t.isMissing(`timbre`)||t.isMissing(`audio`)?(g(),p(_,{key:0,class:`required-badge`,density:`compact`,tone:`warning`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.required`)),1)]),_:1})):o(``,!0),a(v,{content:t.$t(`digitalhuman.description.step2`),class:`ml-1`},null,8,[`content`])]),a(b,{modelValue:t.voiceMode,"onUpdate:modelValue":n[1]||=e=>t.voiceMode=e,class:`mode-switch mb-3`,onChange:t.onVoiceModeChange},{default:m(()=>[a(y,{value:`text`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.voiceModeText`)),1)]),_:1}),a(y,{value:`audio`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.voiceModeAudio`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),t.voiceMode===`text`?(g(),s(l,{key:0},[a(S,{modelValue:t.text,"onUpdate:modelValue":n[2]||=e=>t.text=e,class:`mb-3`,title:t.$t(`digitalhuman.name.speech`),placeholder:t.$t(`digitalhuman.placeholder.speech`),"min-rows":5,"max-rows":14},null,8,[`modelValue`,`title`,`placeholder`]),a(C,{modelValue:t.voiceId,"onUpdate:modelValue":n[3]||=e=>t.voiceId=e},null,8,[`modelValue`])],64)):(g(),p(x,{key:1,kind:`audio`,accept:t.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadSpeechAudio`),hint:t.$t(`digitalhuman.message.audioHint`),onChange:t.onAudioChange},null,8,[`accept`,`button-text`,`hint`,`onChange`]))],512),a(E,{modelValue:t.advancedOpen,"onUpdate:modelValue":n[5]||=e=>t.advancedOpen=e,class:`advanced`},{default:m(()=>[a(T,{name:`advanced`,title:t.$t(`digitalhuman.name.advanced`)},{default:m(()=>[e(`div`,Lt,[e(`div`,Rt,[e(`h2`,zt,i(t.$t(`digitalhuman.name.speed`)),1),a(v,{content:t.$t(`digitalhuman.description.speed`),class:`ml-1`},null,8,[`content`])]),a(w,{modelValue:t.speed,"onUpdate:modelValue":n[4]||=e=>t.speed=e,class:`field-control`,min:.5,max:2,step:.1,precision:1,"controls-position":`right`},null,8,[`modelValue`])])]),_:1},8,[`title`])]),_:1},8,[`modelValue`])]),e(`div`,Bt,[t.missing.length>0?(g(),s(`p`,Vt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.missing[0].message),1)])):o(``,!0),a(O,{scenario:`digitalhuman`}),t.walletMode?o(``,!0):(g(),p(k,{key:1,value:t.consumption,service:t.service},null,8,[`value`,`service`])),a(j,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:m(()=>[a(A,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`digitalhuman.button.generateVideo`)),1)]),_:1},8,[`onClick`]),e(`p`,Ht,i(t.$t(`digitalhuman.message.eta`)),1)])])}var Wt=z(Ot,[[`render`,Ut],[`__scopeId`,`data-v-a43f6be7`]]),Gt=[`.jpg`,`.jpeg`,`.png`,`.webp`,`.bmp`,`.gif`],Kt=v({name:`TaskPreview`,components:{ApiCodeButton:Be,AudioPreview:Y,ChannelIcon:ee,CopyToClipboard:Ne,DeleteIcon:F,ElAlert:C,ElButton:H,ElProgress:M,ElTooltip:S,FullscreenIcon:ie,ImagePreview:J,InfoIcon:P,MagicIcon:L,ReportButton:Pe,TimeIcon:N,VideoPlayer:Re,VideoPreview:X,WarningIcon:I},props:{modelValue:{type:Object,required:!0}},computed:{status(){return this.modelValue?.status||this.modelValue?.response?.state||`pending`},isSuccess(){return[`succeed`,`succeeded`].includes(this.status)||!!this.modelValue?.response?.video_url},isFailure(){return[`failed`,`dead`].includes(this.status)||this.modelValue?.response?.success===!1},isTerminal(){return this.isSuccess||this.isFailure},videoUrl(){return this.modelValue?.response?.video_url},progressPct(){let e=this.modelValue?.response?.progress;return typeof e==`number`?e:0},voiceLabel(){return this.modelValue?.request?.audio_url?this.$t(`digitalhuman.name.audioDriven`):this.$t(`digitalhuman.name.textDriven`)},faceUrl(){return this.modelValue?.request?.video_url||this.modelValue?.request?.image_url},isPhotoFace(){if(this.modelValue?.request?.image_url)return!0;let e=(this.faceUrl||``).split(`?`)[0].toLowerCase();return Gt.some(t=>e.endsWith(t))},audioUrl(){return this.modelValue?.request?.audio_url},outputSize(){let{width:e,height:t}=this.modelValue?.response||{};return e&&t?`${e}×${t}`:void 0},etaText(){let e=parseFloat((this.modelValue?.created_at||``).toString());if(!e)return;let t=fe-(Date.now()/1e3-e);return t<=60?this.$t(`digitalhuman.message.etaAlmostDone`):this.$t(`digitalhuman.message.etaRemaining`,{minutes:Math.ceil(t/60)})},statusLabel(){let e=`digitalhuman.status.${this.status}`,t=this.$t(e);return t===e?this.$t(`digitalhuman.status.processing`):t},failureReason(){let e=this.modelValue?.response?.error;if(e)return typeof e==`string`?e:e?.message}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await q.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`digitalhuman/deleteTask`,{id:e}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),window.open(t,`_blank`)}}}),qt={class:`preview`},Jt={class:`left`},Yt={class:`main`},Xt={class:`bot`},Zt={class:`datetime`},Qt=[`aria-label`],$t={class:`info`},en={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},tn={class:`prompt mt-2`},nn={key:0},rn={key:0,class:`content`},an={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},cn={key:1,class:`content`},ln={class:`operations mt-2`},un={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},hn={key:2,class:`content`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function bn(n,c,l,d,f,h){let _=u(`capability-presentation`),v=u(`delete-icon`),y=u(`el-tooltip`),b=u(`image-preview`),x=u(`video-preview`),S=u(`audio-preview`),C=u(`time-icon`),w=u(`el-progress`),T=u(`magic-icon`),E=u(`copy-to-clipboard`),D=u(`el-alert`),O=u(`video-player`),k=u(`el-button`),A=u(`api-code-button`),j=u(`report-button`),M=u(`fullscreen-icon`),N=u(`channel-icon`),ee=u(`warning-icon`),P=u(`info-icon`);return g(),s(`div`,qt,[e(`div`,Jt,[a(_,{capability:`digitalhuman`,part:`avatar`,class:`avatar`})]),e(`div`,Yt,[e(`div`,Xt,[a(_,{capability:`digitalhuman`,part:`name`}),e(`span`,Zt,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:m(()=>[n.modelValue?.id?(g(),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,Qt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,$t,[n.faceUrl||n.audioUrl?(g(),s(`div`,en,[n.faceUrl&&n.isPhotoFace?(g(),p(b,{key:0,url:n.faceUrl,name:`face`,closable:!1},null,8,[`url`])):n.faceUrl?(g(),p(x,{key:1,url:n.faceUrl,name:`face`},null,8,[`url`])):o(``,!0),n.audioUrl?(g(),p(S,{key:2,url:n.audioUrl,name:`audio`},null,8,[`url`])):o(``,!0)])):o(``,!0),e(`p`,tn,[r(i(n.modelValue?.request?.text||n.voiceLabel)+` `,1),n.isTerminal?o(``,!0):(g(),s(`span`,nn,` - (`+i(n.statusLabel)+`) `,1))])]),n.isTerminal?o(``,!0):(g(),s(`div`,rn,[a(D,{closable:!1,class:`info-state`},{default:m(()=>[e(`p`,an,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.statusLabel),1)]),a(w,{percentage:n.progressPct,"stroke-width":6,class:`mb-2`},null,8,[`percentage`]),n.etaText?(g(),s(`p`,on,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.etaLabel`))+`: `+i(n.etaText),1)])):o(``,!0),e(`p`,sn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])),n.isSuccess?(g(),s(`div`,cn,[n.videoUrl?(g(),p(O,{key:0,src:n.videoUrl},null,8,[`src`])):o(``,!0),e(`div`,ln,[n.videoUrl?(g(),p(k,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=e=>n.onDownload(e,n.videoUrl)},{default:m(()=>[r(i(n.$t(`digitalhuman.button.download`)),1)]),_:1})):o(``,!0),a(A,{path:`/digital-human/videos`,body:n.modelValue?.request},null,8,[`body`]),a(j,{service:`digitalhuman`,"target-id":n.modelValue?.id,snapshot:{text:n.modelValue?.request?.text}},null,8,[`target-id`,`snapshot`])]),a(D,{closable:!1,class:`mt-2 success`},{default:m(()=>[n.modelValue?.response?.duration?(g(),s(`p`,un,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.duration`))+`: `+i(n.modelValue?.response?.duration?.toFixed(1))+`s `,1)])):o(``,!0),n.outputSize?(g(),s(`p`,dn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.outputSize`))+`: `+i(n.outputSize),1)])):o(``,!0),e(`p`,fn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,pn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,mn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),n.isFailure?(g(),s(`div`,hn,[a(D,{closable:!1,class:`failure`},{template:m(()=>[a(ee,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.failure`)),1)]),default:m(()=>[e(`p`,gn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),n.failureReason?(g(),s(`p`,_n,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.failureReason`))+`: `+i(n.failureReason)+` `,1),a(E,{content:n.failureReason},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(g(),s(`p`,vn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,yn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var xn=v({name:`RecentPanel`,components:{TaskPreview:z(Kt,[[`render`,bn],[`__scopeId`,`data-v-342f1d6d`]]),NoTasks:ae,BotPlaceholder:Ve,ScrollList:re},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.digitalhuman?.tasks,items:this.$store.state.digitalhuman?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Sn={key:0},Cn={key:2,class:`w-full h-full flex items-center justify-center`};function wn(e,t,n,r,i,c){let d=u(`bot-placeholder`),f=u(`task-preview`),_=u(`scroll-list`),v=u(`no-tasks`);return g(),s(l,null,[e.tasks?.items===void 0?(g(),s(`div`,Sn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),p(_,{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(()=>[(g(!0),s(l,null,h(e.tasks?.items,(e,t)=>(g(),p(f,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,Cn,[a(v)])):o(``,!0)],64)}var Tn=v({name:`DigitalHumanIndex`,components:{ConfigPanel:Wt,Layout:Je,RecentPanel:z(xn,[[`render`,wn]])},mixins:[ke,He(`digitalhuman`,!1)],inject:[`initialized`],data(){return{job:0,loadingMore:!1,fetchingTasks:!1,walletTaskIds:[]}},computed:{applicationsLoading(){return this.$store.state.digitalhuman?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.digitalhuman?.status?.getTasks===w.Request||this.fetchingTasks},credential(){return this.$store.state.digitalhuman.credential},config(){return this.$store.state.digitalhuman.config},tasks(){return this.$store.state.digitalhuman.tasks},walletMode(){return B()&&V(`digitalhuman`).mode===`wallet`}},watch:{walletMode:{async handler(e,t){if(!(t===void 0||e===t)){if(this.$store.commit(`digitalhuman/setTasks`,void 0),e&&!this.job&&(this.job=window.setInterval(this.onPollTasks,5e3)),!e&&!this.credential?.token){window.clearInterval(this.job),this.job=0,await this.onScrollDown();return}await this.onGetTasks(),await this.onScrollDown()}}},initialized:{async handler(e){window.clearInterval(this.job),e&&(await this.onGetTasks(),await this.onScrollDown(),this.job||=window.setInterval(this.onPollTasks,5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await oe({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`digitalhuman/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`digitalhuman/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r,...this.walletMode&&!this.credential?.token?{mode:`x402`,ids:this.walletTaskIds}:{}})}finally{this.fetchingTasks=!1}},async onGenerate(e){if(!Ce(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;let t;if(this.walletMode){let n=this.getWalletContext();if(!n){T.warning(this.$t(`common.x402Scenario.connectWalletFirst`));return}t=U.generate(e,{mode:`x402`,x402:{wallet:n,confirm:e=>this.confirmWalletPayment(e),identityToken:this.credential?.token}})}else{if(!Ae())return;let n=this.credential?.token;if(!n)return;t=U.generate(e,{token:n})}T.info(this.$t(`digitalhuman.message.startingTask`)),Oe(`digitalhuman`,t).then(e=>{let t=e?.data?.task_id;this.walletMode&&!this.credential?.token&&t&&!this.walletTaskIds.includes(t)&&this.walletTaskIds.unshift(t),T.success(this.$t(`digitalhuman.message.startTaskSuccess`))}).catch(e=>{e instanceof G||xe(e,`digitalhuman`)||(this.walletMode?T.error(this.$t(`common.x402Scenario.paymentFailed`)):T.error(this.$t(`digitalhuman.message.startTaskFailed`)))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getWalletContext(){return W(this.$wallet)},async confirmWalletPayment(e){return q.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 En(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`layout`);return g(),p(l,null,{config:m(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Dn=z(Tn,[[`render`,En]]);export{Dn 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,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{t as y}from"./upload-Sju4DbiY.js";import{t as b}from"./tooltip-B60Iasgv.js";import{t as x}from"./alert-BprQRUmf.js";import{_ as S,v as C}from"./vuex.esm-bundler-BV9tXD4i.js";import{t as w}from"./drawer-CvX2U8ly.js";import{t as T}from"./box-CGOU4lJt.js";import{t as E}from"./clock-BRqsgYwQ.js";import{t as D}from"./hash-CRnccwx_.js";import{t as O}from"./info-Bqj02p3r.js";import{a as k,i as A,n as j,o as M,r as ee,t as N}from"./pagination-VjpfotZ8.js";import{t as te}from"./trash-2-BBCXfu0p.js";import{t as ne}from"./triangle-alert-BRov4JmE.js";import{t as P}from"./upload-D3ICVrNB.js";import{t as F}from"./wand-sparkles-D8Xtkkgr.js";import{Mt as I,Nt as L,Ot as R,Pt as re,jt as ie,kt as ae}from"./constants-GmVIn7tC.js";import{D as z,Gn as B,Mi as V,Na as H,Pi as U,Qa as W,T as G,Tn as K,Wn as q,at as J,ct as Y,it as oe,lt as se,nt as ce,oi as le,ot as X,qi as ue,ri as de,rt as fe,st as pe,ta as me,tt as he,za as Z}from"./index-BYbC-2BV.js";import{t as ge}from"./CopyToClipboard-BQaEPLyt.js";import{t as _e}from"./ReportButton-BAx8pia_.js";import{t as ve}from"./FilePreview-BjUbMA7c.js";import{t as Q}from"./ImagePreview-Dm16d0L7.js";import{n as ye}from"./taskDrawerMixin-DyAUhFEq.js";import{t as be}from"./ServicePricingSummary-DPzfamaB.js";import{t as xe}from"./VideoPlayer-Cdtv4baV.js";import{t as Se}from"./ScenarioPaymentMode-C2uR8lvu.js";import{t as Ce}from"./ApiCodeButton-CAQzrT4K.js";import{t as we}from"./BotPlaceholder-BlCUdjzq.js";import{t as Te}from"./taskPollingMixin-CcLxtz8z.js";var Ee=v({name:`LayoutOmni`,components:{MagicIcon:F,ElDrawer:w,ElButton:W},mixins:[ye]}),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-4 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Ae(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,De,[e(`div`,Oe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ke,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var je=z(Ee,[[`render`,Ae],[`__scopeId`,`data-v-847afabf`]]),Me=v({name:`OmniPromptInput`,components:{PromptTextarea:A},computed:{prompt:{get(){return this.$store.state.omni?.config?.prompt},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ne(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`omni.name.prompt`),info:e.$t(`omni.description.prompt`),placeholder:e.$t(`omni.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Pe=z(Me,[[`render`,Ne]]),Fe=v({name:`OmniResolutionSelector`,components:{InfoIcon:k},data(){return{options:[{value:re,label:`720p`},{value:L,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.omni?.config?.resolution},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,resolution:e})}}},mounted(){this.value||=ae}}),Ie={class:`resolution`},Le={class:`header`},Re={class:`title font-bold`},ze={class:`items`},Be=[`onClick`];function Ve(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Ie,[e(`div`,Le,[e(`h2`,Re,i(t.$t(`omni.name.resolution`)),1),a(p,{content:t.$t(`omni.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,ze,[(g(!0),s(c,null,h(t.options,e=>(g(),s(`div`,{key:e.value,class:n([`item`,{active:t.value===e.value}]),onClick:n=>t.value=e.value},i(e.label),11,Be))),128))])])}var He=z(Fe,[[`render`,Ve],[`__scopeId`,`data-v-1f9abe29`]]),Ue=v({name:`OmniRatioSelector`,components:{InfoIcon:k},computed:{options(){return[{value:ie,label:`16:9`,w:32,h:18},{value:I,label:`9:16`,w:18,h:32}]},value:{get(){return this.$store.state.omni?.config?.aspect_ratio},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,aspect_ratio:e})}}},mounted(){this.value||=R}}),We={class:`ratio`},Ge={class:`header`},Ke={class:`title font-bold`},qe={class:`items`},Je=[`onClick`],Ye={class:`preview`},Xe={class:`name`};function Ze(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,We,[e(`div`,Ge,[e(`h2`,Ke,i(t.$t(`omni.name.ratio`)),1),a(p,{content:t.$t(`omni.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,qe,[(g(!0),s(c,null,h(t.options,r=>(g(),s(`div`,{key:r.value,class:n([`item`,{active:t.value===r.value}]),onClick:e=>t.value=r.value},[e(`div`,Ye,[e(`div`,{class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)]),e(`div`,Xe,i(r.label),1)],10,Je))),128))])])}var Qe=z(Ue,[[`render`,Ze],[`__scopeId`,`data-v-1c0c1511`]]),$e=4,et=v({name:`OmniReferenceImagesInput`,components:{ElUpload:y,ElButton:W,InfoIcon:k,ImagePreview:Q,UploadIcon:P},mixins:[se,Y,X,he],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`,limit:$e,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.omni?.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}}},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.onSetReferenceImages()},onExceed(){C.warning(this.$t(`omni.message.uploadReferenceExceed`))},onError(){C.error(this.$t(`omni.message.uploadError`))},onSetReferenceImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,image_urls:e.length?e:void 0}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetReferenceImages()},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.onSetReferenceImages()}}}),tt={class:`field mb-[10px] flex min-h-8 w-full items-center justify-between gap-3`},nt={class:`flex min-w-0 items-center`},rt={class:`title m-0 text-[14px] font-bold`},it={class:`file-list flex flex-wrap gap-[10px]`};function at(t,n,o,u,d,m){let _=l(`info-icon`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`image-preview`);return g(),s(`div`,null,[e(`div`,tt,[e(`div`,nt,[e(`h2`,rt,i(t.$t(`omni.name.referenceImages`)),1),a(_,{content:t.$t(`omni.description.referenceImages`)},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:t.limit,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(y,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(v,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,it,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(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 ot=z(et,[[`render`,at]]),st=v({name:`OmniVideoInput`,components:{ElUpload:y,ElButton:W,InfoIcon:k,FilePreview:ve,UploadIcon:P},mixins:[Y,X],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},videoUrl(){return this.$store.state.omni?.config?.video_urls?.[0]},videoName(){let e=this.videoUrl||``;return e.split(`/`).pop()||e}},methods:{onExceed(){C.warning(this.$t(`omni.message.uploadVideoExceed`))},onError(){C.error(this.$t(`omni.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=oe(e.size);return t?n?!0:(C.error(this.$t(`omni.message.uploadVideoSizeExceed`,{max:fe(ce)})),!1):(C.error(this.$t(`omni.message.uploadVideoTypeFailed`)),!1)},setVideoUrls(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,video_urls:e?[e]:void 0})},onRemove(){this.fileList=[],this.setVideoUrls(void 0)},async onSuccess(e,t){let n=e?.file_url||t?.response?.file_url;this.setVideoUrls(n||void 0)}}}),ct={class:`field flex min-h-8 w-full items-center justify-between gap-3`},lt={class:`flex min-w-0 items-center`},ut={class:`title m-0 text-[14px] font-bold`},dt={key:0,class:`file-list flex flex-wrap gap-[10px]`};function ft(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`),y=l(`file-preview`);return g(),s(`div`,null,[e(`div`,ct,[e(`div`,lt,[e(`h2`,ut,i(t.$t(`omni.name.referenceVideo`)),1),a(m,{content:t.$t(`omni.description.referenceVideo`)},null,8,[`content`])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value shrink-0`,"show-file-list":!1,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},{default:p(()=>[a(_,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(h,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.uploadVideo`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.videoUrl?(g(),s(`div`,dt,[a(y,{url:t.videoUrl,name:t.videoName,percentage:100,onRemove:t.onRemove},null,8,[`url`,`name`,`onRemove`])])):o(``,!0)])}var pt=v({name:`OmniConfigPanel`,components:{ElButton:W,MagicIcon:F,PromptInput:Pe,ResolutionSelector:He,RatioSelector:Qe,ReferenceImagesInput:ot,VideoInput:z(st,[[`render`,ft],[`__scopeId`,`data-v-b87d1e4e`]]),ServicePricingSummary:be,ScenarioPaymentMode:Se},emits:[`generate`],data(){return{quoteTimer:0,quoteRunId:0}},computed:{config(){return this.$store.state.omni?.config},consumption(){return K(this.config,this.service?.cost)},service(){return this.$store.state.omni?.service},walletMode(){return V()&&U(`omni`).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,350)},async refreshQuote(){let e=U(`omni`),t=++this.quoteRunId;e.quoteLoading=!0,e.quoteUsdc=void 0;try{let n=await B.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`)}}}),mt={class:`flex flex-col h-full`},ht={class:`flex-1 overflow-y-auto p-5`},gt={class:`flex flex-col items-center justify-center px-5 pb-5`};function _t(t,n,c,u,d,m){let h=l(`prompt-input`),_=l(`ratio-selector`),v=l(`resolution-selector`),y=l(`reference-images-input`),b=l(`video-input`),x=l(`scenario-payment-mode`),S=l(`service-pricing-summary`),C=l(`magic-icon`),w=l(`el-button`);return g(),s(`div`,mt,[e(`div`,ht,[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`,gt,[a(x,{scenario:`omni`}),t.walletMode?o(``,!0):(g(),f(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:p(()=>[a(C,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.generate`)),1)]),_:1},8,[`onClick`])])])}var vt=z(pt,[[`render`,_t]]),yt=v({name:`OmniTaskPreview`,components:{DeleteIcon:te,ApplicationIcon:T,ChannelIcon:D,CopyToClipboard:ge,ExpandIcon:M,InfoIcon:O,MagicIcon:F,TimeIcon:E,WarningIcon:ne,ElAlert:x,VideoPlayer:xe,ElTooltip:b,ElButton:W,ImagePreview:Q,ApiCodeButton:Ce,ReportButton:_e},props:{modelValue:{type:Object,required:!0}},data(){return{nowTs:Date.now(),timer:0}},computed:{video(){return this.modelValue?.response?.data?.[0]},inputImage(){return this.modelValue?.request?.image_urls?.[0]},pendingElapsed(){let e=parseFloat((this.modelValue?.created_at||``).toString());if(e)return Math.max(0,Math.floor(this.nowTs/1e3-e))}},watch:{"modelValue.response":{handler(e){e&&this.stopTimer()}}},mounted(){this.modelValue?.response||(this.timer=window.setInterval(()=>{this.nowTs=Date.now()},1e3))},beforeUnmount(){this.stopTimer()},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await Z.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(`omni/deleteTask`,{id:e}),C.success(this.$t(`common.message.deleteTaskSuccess`))}catch{C.error(this.$t(`common.message.deleteTaskFailed`))}}},stopTimer(){this.timer&&=(window.clearInterval(this.timer),0)},onDownload(e){window.open(e,`_blank`)}}}),bt={class:`preview`},xt={class:`left`},St={class:`main`},Ct={class:`bot`},wt={class:`datetime`},Tt=[`aria-label`],Et={class:`info`},Dt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Ot={key:1,class:`prompt mt-2`},kt={key:0},At={key:1},jt={key:0,class:n({content:!0})},Mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Pt={key:1,class:n({content:!0})},Ft={key:0,class:`mb-4`},It={key:1,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},Lt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Rt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},zt={key:0},Bt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Vt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ht={key:2,class:n({content:!0})},Ut={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Wt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Gt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Kt={key:3,class:n({content:!0})},qt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Jt(n,c,u,d,f,m){let h=l(`capability-presentation`),_=l(`delete-icon`),v=l(`el-tooltip`),y=l(`image-preview`),b=l(`time-icon`),x=l(`magic-icon`),S=l(`copy-to-clipboard`),C=l(`el-alert`),w=l(`video-player`),T=l(`el-button`),E=l(`api-code-button`),D=l(`report-button`),O=l(`application-icon`),k=l(`expand-icon`),A=l(`channel-icon`),j=l(`warning-icon`),M=l(`info-icon`);return g(),s(`div`,bt,[e(`div`,xt,[a(h,{capability:`omni`,part:`avatar`,class:`avatar`})]),e(`div`,St,[e(`div`,Ct,[a(h,{capability:`omni`,part:`name`}),e(`span`,wt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(v,{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:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(_,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Tt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Et,[n.inputImage?(g(),s(`div`,Dt,[a(y,{url:n.inputImage,name:`image`,closable:!1},null,8,[`url`])])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,Ot,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.video?.state===`processing`||n.video?.state===`pending`?(g(),s(`span`,At,` - (`+i(n.$t(`omni.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,kt,` - (`+i(n.$t(`omni.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,Pt,[n.video?.video_url?(g(),s(`div`,Ft,[a(w,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,It,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`omni.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(T,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(E,{path:`/gemini/videos`,body:n.modelValue?.request},null,8,[`body`]),a(D,{service:`omni`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,Lt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(g(),s(`p`,Rt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.resolution`))+`: `+i(n.modelValue?.request?.resolution)+` `,1),n.modelValue?.request?.aspect_ratio?(g(),s(`span`,zt,` · `+i(n.modelValue?.request?.aspect_ratio),1)):o(``,!0)])):o(``,!0),e(`p`,Bt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,$,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Vt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(g(),s(`div`,Ht,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failure`)),1)]),default:p(()=>[e(`p`,Ut,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,Wt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(S,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Gt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,Kt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.status`)),1)]),default:p(()=>[e(`p`,qt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})])):(g(),s(`div`,jt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.status.pending`)),1)]),default:p(()=>[e(`p`,Mt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.pendingElapsed===void 0?o(``,!0):(g(),s(`p`,Nt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.pendingElapsed)+`s `,1)]))]),_:1})]))])])}var Yt=v({name:`OmniRecentPanel`,components:{TaskPreview:z(yt,[[`render`,Jt],[`__scopeId`,`data-v-83851ad5`]]),BotPlaceholder:we,NoTasks:ee,ScrollList:j},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.omni?.tasks,items:this.$store.state.omni?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Xt={key:0},Zt={key:2,class:`w-full h-full flex items-center justify-center`};function Qt(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`,Xt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{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: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`,Zt,[a(v)])):o(``,!0)],64)}var $t=v({name:`OmniIndex`,components:{ConfigPanel:vt,Layout:je,RecentPanel:z(Yt,[[`render`,Qt]])},mixins:[pe,Te(`omni`)],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1,walletTaskIds:[]}},computed:{applicationsLoading(){return this.$store.state.omni?.status?.getApplications===S.Request},tasksLoading(){return this.$store.state.omni?.status?.getTasks===S.Request||this.fetchingTasks},credential(){return this.$store.state.omni?.credential},config(){return this.$store.state.omni?.config},tasks(){return this.$store.state.omni?.tasks},walletMode(){return V()&&U(`omni`).mode===`wallet`}},watch:{walletMode:{async handler(e,t){if(!(t===void 0||e===t)){if(this.$store.commit(`omni/setTasks`,void 0),e&&!this.job&&(this.job=window.setInterval(this.onPollTasks,5e3)),!e&&!this.credential?.token){window.clearInterval(this.job),this.job=0,await this.onScrollDown();return}await this.onGetTasks(),await this.onScrollDown()}}},initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job||=window.setInterval(this.onPollTasks,5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await N({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`omni/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`omni/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r,...this.walletMode&&!this.credential?.token?{mode:`x402`,ids:this.walletTaskIds}:{}})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!J(this.uploadTracker,e=>this.$t(e),e=>C.warning(e)))return;let e=q(this.config);if(!e.prompt){C.warning(this.$t(`omni.message.promptRequired`));return}if(e.video_urls&&!e.image_urls){C.warning(this.$t(`omni.message.videoRequiresImage`));return}let t;if(this.walletMode){let n=this.getWalletContext();if(!n){C.warning(this.$t(`common.x402Scenario.connectWalletFirst`));return}t=B.generate(e,{mode:`x402`,x402:{wallet:n,confirm:e=>this.confirmWalletPayment(e),identityToken:this.credential?.token}})}else{if(!me())return;let n=this.credential?.token;if(!n)return;t=B.generate(e,{token:n})}C.info(this.$t(`omni.message.startingTask`)),ue(`omni`,t).then(e=>{let t=e?.data?.task_id;this.walletMode&&!this.credential?.token&&t&&!this.walletTaskIds.includes(t)&&this.walletTaskIds.unshift(t),C.success(this.$t(`omni.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;e instanceof de||G(e,`omni`)||(this.walletMode?C.error(this.$t(`common.x402Scenario.paymentFailed`)):C.error(this.$t(`omni.message.startTaskFailed`)+(t?.error?.message||``)))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getWalletContext(){return le(this.$wallet)},async confirmWalletPayment(e){return Z.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 en(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var tn=z($t,[[`render`,en]]);export{tn 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,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{t as y}from"./upload-Sju4DbiY.js";import{t as b}from"./tooltip-4w7ghPQM.js";import{t as x}from"./alert-BprQRUmf.js";import{_ as S,v as C}from"./vuex.esm-bundler-BV9tXD4i.js";import{t as w}from"./drawer-APcI0MuL.js";import{t as T}from"./box-Eq7xsVMG.js";import{t as E}from"./clock-BooSG6zB.js";import{t as D}from"./hash-GTQkcsQj.js";import{t as O}from"./info-PmX6OJ8X.js";import{a as k,i as A,n as j,o as M,r as ee,t as N}from"./pagination-W-HQ78h5.js";import{t as te}from"./trash-2-BkEkcSHv.js";import{t as ne}from"./triangle-alert-DBmpuUlm.js";import{t as P}from"./upload-DidTvyIg.js";import{t as F}from"./wand-sparkles-CwgjO5Gl.js";import{Mt as I,Nt as L,Ot as R,Pt as re,jt as ie,kt as ae}from"./constants-GmVIn7tC.js";import{D as z,Gn as B,Mi as V,Na as H,Pi as U,Qa as W,T as G,Tn as K,Wn as q,at as J,ct as Y,it as oe,lt as se,nt as ce,oi as le,ot as X,qi as ue,ri as de,rt as fe,st as pe,ta as me,tt as he,za as Z}from"./index-Dr2ooWnm.js";import{t as ge}from"./CopyToClipboard-CQT78wob.js";import{t as _e}from"./ReportButton-B6G5OWJ0.js";import{t as ve}from"./FilePreview-D640d7Cq.js";import{t as Q}from"./ImagePreview-YXx0To-U.js";import{n as ye}from"./taskDrawerMixin-DyAUhFEq.js";import{t as be}from"./ServicePricingSummary-rLPlqY7R.js";import{t as xe}from"./VideoPlayer-DuUSbT-p.js";import{t as Se}from"./ScenarioPaymentMode-DRMdqOm9.js";import{t as Ce}from"./ApiCodeButton-DSt2Pz0O.js";import{t as we}from"./BotPlaceholder-BC8u-j84.js";import{t as Te}from"./taskPollingMixin-CcLxtz8z.js";var Ee=v({name:`LayoutOmni`,components:{MagicIcon:F,ElDrawer:w,ElButton:W},mixins:[ye]}),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-4 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Ae(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,De,[e(`div`,Oe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ke,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var je=z(Ee,[[`render`,Ae],[`__scopeId`,`data-v-847afabf`]]),Me=v({name:`OmniPromptInput`,components:{PromptTextarea:A},computed:{prompt:{get(){return this.$store.state.omni?.config?.prompt},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ne(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`omni.name.prompt`),info:e.$t(`omni.description.prompt`),placeholder:e.$t(`omni.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Pe=z(Me,[[`render`,Ne]]),Fe=v({name:`OmniResolutionSelector`,components:{InfoIcon:k},data(){return{options:[{value:re,label:`720p`},{value:L,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.omni?.config?.resolution},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,resolution:e})}}},mounted(){this.value||=ae}}),Ie={class:`resolution`},Le={class:`header`},Re={class:`title font-bold`},ze={class:`items`},Be=[`onClick`];function Ve(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Ie,[e(`div`,Le,[e(`h2`,Re,i(t.$t(`omni.name.resolution`)),1),a(p,{content:t.$t(`omni.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,ze,[(g(!0),s(c,null,h(t.options,e=>(g(),s(`div`,{key:e.value,class:n([`item`,{active:t.value===e.value}]),onClick:n=>t.value=e.value},i(e.label),11,Be))),128))])])}var He=z(Fe,[[`render`,Ve],[`__scopeId`,`data-v-1f9abe29`]]),Ue=v({name:`OmniRatioSelector`,components:{InfoIcon:k},computed:{options(){return[{value:ie,label:`16:9`,w:32,h:18},{value:I,label:`9:16`,w:18,h:32}]},value:{get(){return this.$store.state.omni?.config?.aspect_ratio},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,aspect_ratio:e})}}},mounted(){this.value||=R}}),We={class:`ratio`},Ge={class:`header`},Ke={class:`title font-bold`},qe={class:`items`},Je=[`onClick`],Ye={class:`preview`},Xe={class:`name`};function Ze(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,We,[e(`div`,Ge,[e(`h2`,Ke,i(t.$t(`omni.name.ratio`)),1),a(p,{content:t.$t(`omni.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,qe,[(g(!0),s(c,null,h(t.options,r=>(g(),s(`div`,{key:r.value,class:n([`item`,{active:t.value===r.value}]),onClick:e=>t.value=r.value},[e(`div`,Ye,[e(`div`,{class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)]),e(`div`,Xe,i(r.label),1)],10,Je))),128))])])}var Qe=z(Ue,[[`render`,Ze],[`__scopeId`,`data-v-1c0c1511`]]),$e=4,et=v({name:`OmniReferenceImagesInput`,components:{ElUpload:y,ElButton:W,InfoIcon:k,ImagePreview:Q,UploadIcon:P},mixins:[se,Y,X,he],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`,limit:$e,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.omni?.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}}},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.onSetReferenceImages()},onExceed(){C.warning(this.$t(`omni.message.uploadReferenceExceed`))},onError(){C.error(this.$t(`omni.message.uploadError`))},onSetReferenceImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,image_urls:e.length?e:void 0}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetReferenceImages()},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.onSetReferenceImages()}}}),tt={class:`field mb-[10px] flex min-h-8 w-full items-center justify-between gap-3`},nt={class:`flex min-w-0 items-center`},rt={class:`title m-0 text-[14px] font-bold`},it={class:`file-list flex flex-wrap gap-[10px]`};function at(t,n,o,u,d,m){let _=l(`info-icon`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`image-preview`);return g(),s(`div`,null,[e(`div`,tt,[e(`div`,nt,[e(`h2`,rt,i(t.$t(`omni.name.referenceImages`)),1),a(_,{content:t.$t(`omni.description.referenceImages`)},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:t.limit,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(y,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(v,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,it,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(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 ot=z(et,[[`render`,at]]),st=v({name:`OmniVideoInput`,components:{ElUpload:y,ElButton:W,InfoIcon:k,FilePreview:ve,UploadIcon:P},mixins:[Y,X],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},videoUrl(){return this.$store.state.omni?.config?.video_urls?.[0]},videoName(){let e=this.videoUrl||``;return e.split(`/`).pop()||e}},methods:{onExceed(){C.warning(this.$t(`omni.message.uploadVideoExceed`))},onError(){C.error(this.$t(`omni.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=oe(e.size);return t?n?!0:(C.error(this.$t(`omni.message.uploadVideoSizeExceed`,{max:fe(ce)})),!1):(C.error(this.$t(`omni.message.uploadVideoTypeFailed`)),!1)},setVideoUrls(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,video_urls:e?[e]:void 0})},onRemove(){this.fileList=[],this.setVideoUrls(void 0)},async onSuccess(e,t){let n=e?.file_url||t?.response?.file_url;this.setVideoUrls(n||void 0)}}}),ct={class:`field flex min-h-8 w-full items-center justify-between gap-3`},lt={class:`flex min-w-0 items-center`},ut={class:`title m-0 text-[14px] font-bold`},dt={key:0,class:`file-list flex flex-wrap gap-[10px]`};function ft(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`),y=l(`file-preview`);return g(),s(`div`,null,[e(`div`,ct,[e(`div`,lt,[e(`h2`,ut,i(t.$t(`omni.name.referenceVideo`)),1),a(m,{content:t.$t(`omni.description.referenceVideo`)},null,8,[`content`])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value shrink-0`,"show-file-list":!1,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},{default:p(()=>[a(_,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(h,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.uploadVideo`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.videoUrl?(g(),s(`div`,dt,[a(y,{url:t.videoUrl,name:t.videoName,percentage:100,onRemove:t.onRemove},null,8,[`url`,`name`,`onRemove`])])):o(``,!0)])}var pt=v({name:`OmniConfigPanel`,components:{ElButton:W,MagicIcon:F,PromptInput:Pe,ResolutionSelector:He,RatioSelector:Qe,ReferenceImagesInput:ot,VideoInput:z(st,[[`render`,ft],[`__scopeId`,`data-v-b87d1e4e`]]),ServicePricingSummary:be,ScenarioPaymentMode:Se},emits:[`generate`],data(){return{quoteTimer:0,quoteRunId:0}},computed:{config(){return this.$store.state.omni?.config},consumption(){return K(this.config,this.service?.cost)},service(){return this.$store.state.omni?.service},walletMode(){return V()&&U(`omni`).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,350)},async refreshQuote(){let e=U(`omni`),t=++this.quoteRunId;e.quoteLoading=!0,e.quoteUsdc=void 0;try{let n=await B.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`)}}}),mt={class:`flex flex-col h-full`},ht={class:`flex-1 overflow-y-auto p-5`},gt={class:`flex flex-col items-center justify-center px-5 pb-5`};function _t(t,n,c,u,d,m){let h=l(`prompt-input`),_=l(`ratio-selector`),v=l(`resolution-selector`),y=l(`reference-images-input`),b=l(`video-input`),x=l(`scenario-payment-mode`),S=l(`service-pricing-summary`),C=l(`magic-icon`),w=l(`el-button`);return g(),s(`div`,mt,[e(`div`,ht,[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`,gt,[a(x,{scenario:`omni`}),t.walletMode?o(``,!0):(g(),f(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:p(()=>[a(C,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.generate`)),1)]),_:1},8,[`onClick`])])])}var vt=z(pt,[[`render`,_t]]),yt=v({name:`OmniTaskPreview`,components:{DeleteIcon:te,ApplicationIcon:T,ChannelIcon:D,CopyToClipboard:ge,ExpandIcon:M,InfoIcon:O,MagicIcon:F,TimeIcon:E,WarningIcon:ne,ElAlert:x,VideoPlayer:xe,ElTooltip:b,ElButton:W,ImagePreview:Q,ApiCodeButton:Ce,ReportButton:_e},props:{modelValue:{type:Object,required:!0}},data(){return{nowTs:Date.now(),timer:0}},computed:{video(){return this.modelValue?.response?.data?.[0]},inputImage(){return this.modelValue?.request?.image_urls?.[0]},pendingElapsed(){let e=parseFloat((this.modelValue?.created_at||``).toString());if(e)return Math.max(0,Math.floor(this.nowTs/1e3-e))}},watch:{"modelValue.response":{handler(e){e&&this.stopTimer()}}},mounted(){this.modelValue?.response||(this.timer=window.setInterval(()=>{this.nowTs=Date.now()},1e3))},beforeUnmount(){this.stopTimer()},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await Z.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(`omni/deleteTask`,{id:e}),C.success(this.$t(`common.message.deleteTaskSuccess`))}catch{C.error(this.$t(`common.message.deleteTaskFailed`))}}},stopTimer(){this.timer&&=(window.clearInterval(this.timer),0)},onDownload(e){window.open(e,`_blank`)}}}),bt={class:`preview`},xt={class:`left`},St={class:`main`},Ct={class:`bot`},wt={class:`datetime`},Tt=[`aria-label`],Et={class:`info`},Dt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Ot={key:1,class:`prompt mt-2`},kt={key:0},At={key:1},jt={key:0,class:n({content:!0})},Mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Pt={key:1,class:n({content:!0})},Ft={key:0,class:`mb-4`},It={key:1,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},Lt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Rt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},zt={key:0},Bt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Vt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ht={key:2,class:n({content:!0})},Ut={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Wt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Gt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Kt={key:3,class:n({content:!0})},qt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Jt(n,c,u,d,f,m){let h=l(`capability-presentation`),_=l(`delete-icon`),v=l(`el-tooltip`),y=l(`image-preview`),b=l(`time-icon`),x=l(`magic-icon`),S=l(`copy-to-clipboard`),C=l(`el-alert`),w=l(`video-player`),T=l(`el-button`),E=l(`api-code-button`),D=l(`report-button`),O=l(`application-icon`),k=l(`expand-icon`),A=l(`channel-icon`),j=l(`warning-icon`),M=l(`info-icon`);return g(),s(`div`,bt,[e(`div`,xt,[a(h,{capability:`omni`,part:`avatar`,class:`avatar`})]),e(`div`,St,[e(`div`,Ct,[a(h,{capability:`omni`,part:`name`}),e(`span`,wt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(v,{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:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(_,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Tt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Et,[n.inputImage?(g(),s(`div`,Dt,[a(y,{url:n.inputImage,name:`image`,closable:!1},null,8,[`url`])])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,Ot,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.video?.state===`processing`||n.video?.state===`pending`?(g(),s(`span`,At,` - (`+i(n.$t(`omni.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,kt,` - (`+i(n.$t(`omni.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,Pt,[n.video?.video_url?(g(),s(`div`,Ft,[a(w,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,It,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`omni.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(T,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(E,{path:`/gemini/videos`,body:n.modelValue?.request},null,8,[`body`]),a(D,{service:`omni`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,Lt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(g(),s(`p`,Rt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.resolution`))+`: `+i(n.modelValue?.request?.resolution)+` `,1),n.modelValue?.request?.aspect_ratio?(g(),s(`span`,zt,` · `+i(n.modelValue?.request?.aspect_ratio),1)):o(``,!0)])):o(``,!0),e(`p`,Bt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,$,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Vt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(g(),s(`div`,Ht,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failure`)),1)]),default:p(()=>[e(`p`,Ut,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,Wt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(S,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Gt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,Kt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.status`)),1)]),default:p(()=>[e(`p`,qt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})])):(g(),s(`div`,jt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.status.pending`)),1)]),default:p(()=>[e(`p`,Mt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.pendingElapsed===void 0?o(``,!0):(g(),s(`p`,Nt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.pendingElapsed)+`s `,1)]))]),_:1})]))])])}var Yt=v({name:`OmniRecentPanel`,components:{TaskPreview:z(yt,[[`render`,Jt],[`__scopeId`,`data-v-83851ad5`]]),BotPlaceholder:we,NoTasks:ee,ScrollList:j},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.omni?.tasks,items:this.$store.state.omni?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Xt={key:0},Zt={key:2,class:`w-full h-full flex items-center justify-center`};function Qt(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`,Xt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{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: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`,Zt,[a(v)])):o(``,!0)],64)}var $t=v({name:`OmniIndex`,components:{ConfigPanel:vt,Layout:je,RecentPanel:z(Yt,[[`render`,Qt]])},mixins:[pe,Te(`omni`)],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1,walletTaskIds:[]}},computed:{applicationsLoading(){return this.$store.state.omni?.status?.getApplications===S.Request},tasksLoading(){return this.$store.state.omni?.status?.getTasks===S.Request||this.fetchingTasks},credential(){return this.$store.state.omni?.credential},config(){return this.$store.state.omni?.config},tasks(){return this.$store.state.omni?.tasks},walletMode(){return V()&&U(`omni`).mode===`wallet`}},watch:{walletMode:{async handler(e,t){if(!(t===void 0||e===t)){if(this.$store.commit(`omni/setTasks`,void 0),e&&!this.job&&(this.job=window.setInterval(this.onPollTasks,5e3)),!e&&!this.credential?.token){window.clearInterval(this.job),this.job=0,await this.onScrollDown();return}await this.onGetTasks(),await this.onScrollDown()}}},initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job||=window.setInterval(this.onPollTasks,5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await N({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`omni/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`omni/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r,...this.walletMode&&!this.credential?.token?{mode:`x402`,ids:this.walletTaskIds}:{}})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!J(this.uploadTracker,e=>this.$t(e),e=>C.warning(e)))return;let e=q(this.config);if(!e.prompt){C.warning(this.$t(`omni.message.promptRequired`));return}if(e.video_urls&&!e.image_urls){C.warning(this.$t(`omni.message.videoRequiresImage`));return}let t;if(this.walletMode){let n=this.getWalletContext();if(!n){C.warning(this.$t(`common.x402Scenario.connectWalletFirst`));return}t=B.generate(e,{mode:`x402`,x402:{wallet:n,confirm:e=>this.confirmWalletPayment(e),identityToken:this.credential?.token}})}else{if(!me())return;let n=this.credential?.token;if(!n)return;t=B.generate(e,{token:n})}C.info(this.$t(`omni.message.startingTask`)),ue(`omni`,t).then(e=>{let t=e?.data?.task_id;this.walletMode&&!this.credential?.token&&t&&!this.walletTaskIds.includes(t)&&this.walletTaskIds.unshift(t),C.success(this.$t(`omni.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;e instanceof de||G(e,`omni`)||(this.walletMode?C.error(this.$t(`common.x402Scenario.paymentFailed`)):C.error(this.$t(`omni.message.startTaskFailed`)+(t?.error?.message||``)))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getWalletContext(){return le(this.$wallet)},async confirmWalletPayment(e){return Z.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 en(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var tn=z($t,[[`render`,en]]);export{tn as default};