@acedatacloud/nexior 3.343.2 → 3.343.3

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 (246) hide show
  1. package/dist/assets/{ApiCodeButton-BnhZ1r3c.js → ApiCodeButton-C_DtLteh.js} +1 -1
  2. package/dist/assets/{Artifacts-CaJxmQOP.js → Artifacts-COeoAH1p.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-CMkeSMFn.js → AskUserQuestionCard-D_oKKGYl.js} +1 -1
  4. package/dist/assets/{AudioPreview-bocLH6sL.js → AudioPreview-DGeWuq2A.js} +1 -1
  5. package/dist/assets/{Auth-BRupoyMh.js → Auth-C4TMJpeT.js} +1 -1
  6. package/dist/assets/{Bare-BAhPcFz_.js → Bare-CGTyxVcY.js} +1 -1
  7. package/dist/assets/{BotPlaceholder-B6Y-k016.js → BotPlaceholder-miO90qGo.js} +1 -1
  8. package/dist/assets/{BottomFooter-CYGg2B0I.js → BottomFooter-Dn7ALxdB.js} +1 -1
  9. package/dist/assets/{Callback-CnPlFK8U.js → Callback-W-Bnbyvh.js} +1 -1
  10. package/dist/assets/{CodeSnippet-BTyXtTEF.js → CodeSnippet-imENkgS_.js} +1 -1
  11. package/dist/assets/{Console-CAvKfZXu.js → Console-DdNJBvyg.js} +1 -1
  12. package/dist/assets/{Consumption-BdZ1c3ei.js → Consumption-DL0zm78X.js} +1 -1
  13. package/dist/assets/{Conversation-SPaNEZ42.js → Conversation-D2nipuJ4.js} +1 -1
  14. package/dist/assets/{Conversation-gQ1OYZa4.js → Conversation-DWOLdrk3.js} +1 -1
  15. package/dist/assets/{CopyToClipboard-DTo9jexV.js → CopyToClipboard-BMaxYkX6.js} +1 -1
  16. package/dist/assets/{Detail-1gsV1ZX_.js → Detail-Csw1iIvn.js} +2 -2
  17. package/dist/assets/{Extra-jQ-L_eB4.js → Extra-B_UQU3zj.js} +1 -1
  18. package/dist/assets/{FilePreview-UA-4U2mr.js → FilePreview-CQ8miS5e.js} +1 -1
  19. package/dist/assets/{Hailuo-BFCWw87y.js → Hailuo-BYDp8J6m.js} +1 -1
  20. package/dist/assets/{History-CVrTdGB6.js → History-B0VN2MMH.js} +1 -1
  21. package/dist/assets/{ImagePreview-C_R7broQ.js → ImagePreview-Dzwq5j1p.js} +1 -1
  22. package/dist/assets/{ImageWrapper-BRkG-4ZC.js → ImageWrapper-B6kHPphW.js} +1 -1
  23. package/dist/assets/{Index-CRI6tbcL2.js → Index-1ZhbeLVS2.js} +1 -1
  24. package/dist/assets/{Index-BZxLL7gj.js → Index-B-VI_aRb.js} +1 -1
  25. package/dist/assets/{Index-BszbJEWT.js → Index-B0ZHlDuU.js} +1 -1
  26. package/dist/assets/{Index-D1aHn9gj.js → Index-BB5sCnez.js} +1 -1
  27. package/dist/assets/{Index-BMFXyYUN.js → Index-BJKwkkFZ.js} +1 -1
  28. package/dist/assets/{Index-CGtZfo1E.js → Index-BfpEVkAV.js} +1 -1
  29. package/dist/assets/{Index-0iY0sqJS2.js → Index-BhOweqDE2.js} +1 -1
  30. package/dist/assets/{Index-Cw-2P5EZ.js → Index-BsuI8C6x.js} +1 -1
  31. package/dist/assets/{Index-xttUMrEs.js → Index-BuNB2iGw.js} +1 -1
  32. package/dist/assets/{Index-FZep4Y2l.js → Index-C6OyAWLW.js} +1 -1
  33. package/dist/assets/{Index-B4Yr4_IJ.js → Index-CKrZwUSr.js} +1 -1
  34. package/dist/assets/{Index-DhBKPEna.js → Index-COkAWs3N.js} +1 -1
  35. package/dist/assets/{Index-B2VQCAmi.js → Index-CQd3EYF4.js} +1 -1
  36. package/dist/assets/{Index-DOmk_Fm5.js → Index-CSgmw5Xk.js} +1 -1
  37. package/dist/assets/{Index-BZ14Y3ha.js → Index-CU9m8W_1.js} +1 -1
  38. package/dist/assets/{Index-Cq_PuYdW.js → Index-CfwR5Za5.js} +1 -1
  39. package/dist/assets/{Index-cmCF0tfO.js → Index-Ci8dp03A.js} +1 -1
  40. package/dist/assets/{Index-BpnILkwN.js → Index-ClkrY5lP.js} +1 -1
  41. package/dist/assets/{Index-CKLSGpvZ.js → Index-CwMONzyV.js} +1 -1
  42. package/dist/assets/{Index-Boqj6Yd-.js → Index-DJL_xfuy.js} +1 -1
  43. package/dist/assets/{Index-CILcMy4D2.js → Index-DaZEAkZx2.js} +1 -1
  44. package/dist/assets/{Index-C7kvIfwU.js → Index-DeGiucbo.js} +1 -1
  45. package/dist/assets/{Index-C5btuUth.js → Index-DgNAKfOZ.js} +1 -1
  46. package/dist/assets/{Index-TJFSha-j.js → Index-Dq9auTf_.js} +1 -1
  47. package/dist/assets/{Index-B7vA1RBY.js → Index-DrVLoVNo.js} +1 -1
  48. package/dist/assets/{Index-CVGgzdrS.js → Index-Dz5AFp1c.js} +1 -1
  49. package/dist/assets/{Index-LpcbHK6O.js → Index-L4nFhGoI.js} +1 -1
  50. package/dist/assets/{Index-C_IfEwca.js → Index-Mgk2TALV.js} +1 -1
  51. package/dist/assets/{Index-BXGee7g2.js → Index-QNTsRM_t.js} +1 -1
  52. package/dist/assets/{Index-UetzJVKI2.js → Index-Zxz1nVei2.js} +1 -1
  53. package/dist/assets/{Index-V3b5jGGJ.js → Index-vA8vIG53.js} +1 -1
  54. package/dist/assets/{Index-CFw1FLwn.js → Index-xk9mGgHC.js} +1 -1
  55. package/dist/assets/{Invitees-Tw81KutK.js → Invitees-CMMHSe4y.js} +1 -1
  56. package/dist/assets/{List-CJy8am6o.js → List-B6JleUhS.js} +1 -1
  57. package/dist/assets/{List-ZGE8PGhI.js → List-CV9tFd5K.js} +1 -1
  58. package/dist/assets/{List-oe2KAJIP.js → List-CtK2fe34.js} +1 -1
  59. package/dist/assets/{LocalTools-DB2mlE-7.js → LocalTools-CnXNzgGY.js} +1 -1
  60. package/dist/assets/{LocalTools-CldMvgMI.js → LocalTools-DL6YNvwa.js} +1 -1
  61. package/dist/assets/{Main-D7crVqTv.js → Main-r3pYZNua.js} +1 -1
  62. package/dist/assets/{Message-BGlON6N3.js → Message-TT9Tt5EG.js} +1 -1
  63. package/dist/assets/{Model-Bt0uhJJ0.js → Model-bznEL95u.js} +1 -1
  64. package/dist/assets/{Navigator-BcD0NEVT.js → Navigator-DnHUGeWq.js} +3 -3
  65. package/dist/assets/{NotFound-DskbKuWo.js → NotFound-BUz1btfj.js} +1 -1
  66. package/dist/assets/{Pay-Bu4lkOAy.js → Pay-C_Fcl29f.js} +1 -1
  67. package/dist/assets/{Player-BWPSNIsG.js → Player-CcmsVWf7.js} +1 -1
  68. package/dist/assets/{Poivelle-Bnsu9gZ6.js → Poivelle-3ecrWx9E.js} +1 -1
  69. package/dist/assets/{PromptTextarea-DSF00J6p.js → PromptTextarea-BPhoRMVI.js} +1 -1
  70. package/dist/assets/{RealtimeCall-Ctrjch7s.js → RealtimeCall-CXRpEKEL.js} +1 -1
  71. package/dist/assets/{ScheduledTasks-rQlsednu.js → ScheduledTasks-CCgZLKXl.js} +1 -1
  72. package/dist/assets/{Status-DAAA1AAC.js → Status-B7sFQTuB.js} +1 -1
  73. package/dist/assets/{Subscribe-RqlJCxg9.js → Subscribe-DA13iozT.js} +1 -1
  74. package/dist/assets/{TabSwitcher-D1Zx36SR.js → TabSwitcher-DT8rOtuT.js} +1 -1
  75. package/dist/assets/{Tts-kpu-QIej.js → Tts-BdpmdYva.js} +1 -1
  76. package/dist/assets/{VideoPlayer-K-a68Yxk.js → VideoPlayer-CyCnHmhk.js} +1 -1
  77. package/dist/assets/{alert-C16GyeJ_.js → alert-BmDhbY4N.js} +1 -1
  78. package/dist/assets/arrow-down-_laNvAF4.js +1 -0
  79. package/dist/assets/{arrow-down-wide-narrow-BGo5iUya.js → arrow-down-wide-narrow-BV17RuKt.js} +1 -1
  80. package/dist/assets/arrow-left-BxY2ckiR.js +1 -0
  81. package/dist/assets/arrow-right-C-DwIyqJ.js +1 -0
  82. package/dist/assets/arrow-up-DuBOEPlK.js +1 -0
  83. package/dist/assets/{avatar-CMbnWo1W.js → avatar-DMypDW5N.js} +1 -1
  84. package/dist/assets/{basic-CNPEecVF.js → basic-Czbj6f9D.js} +1 -1
  85. package/dist/assets/{book-open-DSJyv-Tq.js → book-open-DgulRtEJ.js} +1 -1
  86. package/dist/assets/{box-BT9y4YFN.js → box-CXHZJ19d.js} +1 -1
  87. package/dist/assets/{boxes-dPE_g6A1.js → boxes-CbZlGzxn.js} +1 -1
  88. package/dist/assets/{brain-BxL5I621.js → brain-BY6PRLuS.js} +1 -1
  89. package/dist/assets/{chart-no-axes-combined-PZoqng3S.js → chart-no-axes-combined-3j5FM4nV.js} +1 -1
  90. package/dist/assets/{chat-BJhOSKKx.js → chat-DzHJ5mA8.js} +1 -1
  91. package/dist/assets/check-D4mUmwCI.js +1 -0
  92. package/dist/assets/chevron-down-n14G0ihm.js +1 -0
  93. package/dist/assets/chevron-right-CrLR-sC-.js +1 -0
  94. package/dist/assets/circle-check-CcZvIPVM.js +1 -0
  95. package/dist/assets/{circle-question-mark-tBuKgAmQ.js → circle-question-mark-Dg_6R6Ml.js} +1 -1
  96. package/dist/assets/{clipboard-list-BWvm3BDS.js → clipboard-list-DQY8azPJ.js} +1 -1
  97. package/dist/assets/clock-CTJncUP-.js +1 -0
  98. package/dist/assets/code-DHK4Pm5M.js +1 -0
  99. package/dist/assets/{codingBridge-BJi_ckQz.js → codingBridge-BXkxqJJC.js} +1 -1
  100. package/dist/assets/{codingBridgeNotify-c55KEyJp.js → codingBridgeNotify-DkQVrSnN.js} +2 -2
  101. package/dist/assets/{coins-BufMrWPi.js → coins-Ccai4H-a.js} +1 -1
  102. package/dist/assets/{collapse-EtgNqWAr.js → collapse-CTug-yP6.js} +1 -1
  103. package/dist/assets/{copy-0lsL87Wd.js → copy-CaELERYD.js} +1 -1
  104. package/dist/assets/{createTaskActions-9dfgMEbH.js → createTaskActions-DT6637AA.js} +1 -1
  105. package/dist/assets/{digitalhuman-B0uTHRKp.js → digitalhuman-Cb-npF4z.js} +1 -1
  106. package/dist/assets/{dollar-sign-CfOsLLKY.js → dollar-sign-DCSgo-yC.js} +1 -1
  107. package/dist/assets/{download-BWU-lZHT.js → download-X3vwDSki.js} +1 -1
  108. package/dist/assets/{drawer-D_3Ux5r0.js → drawer-BgpN40Ig.js} +1 -1
  109. package/dist/assets/{dropdown-w_5tAQr5.js → dropdown-BNMcCva2.js} +1 -1
  110. package/dist/assets/{dropdown-mcMMCG7K.js → dropdown-EfsWv0Yl.js} +1 -1
  111. package/dist/assets/{ellipsis-sveOlT_Y.js → ellipsis-BLq9exTH.js} +1 -1
  112. package/dist/assets/{esm-CO9x-2vR.js → esm-6WbJSUyo.js} +1 -1
  113. package/dist/assets/{esm-Bucp_n66.js → esm-7bTqS524.js} +2 -2
  114. package/dist/assets/{esm-DwwA4_JY.js → esm-B0fPuulX.js} +1 -1
  115. package/dist/assets/esm-CjoFX8Xc.js +1 -0
  116. package/dist/assets/{esm-CTHpz8-o.js → esm-DBxl_F3e.js} +2 -2
  117. package/dist/assets/{esm-9mO1n0Mh.js → esm-DPZ-0-TA.js} +3 -3
  118. package/dist/assets/{esm-BPRNiHle.js → esm-Dx7az4yl.js} +1 -1
  119. package/dist/assets/{external-link-2Z2kMqFE.js → external-link-DZ3DxAmT.js} +1 -1
  120. package/dist/assets/{eye-DCxnyN3d.js → eye-Dt7czJN5.js} +1 -1
  121. package/dist/assets/{file-CoeAd2zT.js → file-BjjWIKuD.js} +1 -1
  122. package/dist/assets/{file-output-TEwR2dNe.js → file-output-D5VoOEt1.js} +1 -1
  123. package/dist/assets/{file-text-D9BhZW2U.js → file-text-Cg1esE6-.js} +1 -1
  124. package/dist/assets/{fish-Bsv53DVE.js → fish-B4CwYRmY.js} +1 -1
  125. package/dist/assets/{flux-6Ii4OUKH.js → flux-C_ZHZbF2.js} +1 -1
  126. package/dist/assets/{folder-DF_k--vf.js → folder-BmoEieDF.js} +1 -1
  127. package/dist/assets/gauge-DO8VgOsK.js +1 -0
  128. package/dist/assets/{globe-UEaaaNoJ.js → globe-BC1t7ZUy.js} +1 -1
  129. package/dist/assets/{grokvideo-C4fp9yAt.js → grokvideo-CAG_3RdK.js} +1 -1
  130. package/dist/assets/{hailuo-ABggZ67q.js → hailuo-DZD-sPQC.js} +1 -1
  131. package/dist/assets/{headphones-D7x1YAMx.js → headphones-MFMcymce.js} +1 -1
  132. package/dist/assets/{history-Ck2WpVat.js → history-BWgGP74I.js} +1 -1
  133. package/dist/assets/{house-Dp_D0oeZ.js → house-CbITAy_f.js} +1 -1
  134. package/dist/assets/{image-DRW5OCUW.js → image-BLa4-1L7.js} +1 -1
  135. package/dist/assets/{index-CX5tT44B.js → index-X4H_LD85.js} +3 -3
  136. package/dist/assets/{index.browser.esm-1yA9M6CC.js → index.browser.esm-CCmiJWW3.js} +1 -1
  137. package/dist/assets/{index.es-QIK6Za0X.js → index.es-GZAOy__u.js} +1 -1
  138. package/dist/assets/{info-BqYsJSgm.js → info-L0HoT29_.js} +1 -1
  139. package/dist/assets/{input-number-mWiCY8x-.js → input-number-COp7UOII.js} +1 -1
  140. package/dist/assets/{key-round-B-7vmYcK.js → key-round-COPBeT2c.js} +1 -1
  141. package/dist/assets/{kling-B6pPbqGQ.js → kling-ekkDIWur.js} +1 -1
  142. package/dist/assets/{languages-C3fLU8tJ.js → languages-DCbhf2nn.js} +1 -1
  143. package/dist/assets/{laptop-DLmDa5cm.js → laptop-vqo6zEX9.js} +1 -1
  144. package/dist/assets/{lightbulb-0wAwGzn1.js → lightbulb-C5Ftvxfh.js} +1 -1
  145. package/dist/assets/{link-vzT89AJs.js → link-CclstGdq.js} +1 -1
  146. package/dist/assets/loader-circle-CChCBdje.js +1 -0
  147. package/dist/assets/{lock-CuveUOB_.js → lock-BPdr7Bk-.js} +1 -1
  148. package/dist/assets/{luma-CBATmP2O.js → luma-BlJzM-S0.js} +1 -1
  149. package/dist/assets/{maestro-CAZq6DTw.js → maestro-CCVCYo9K.js} +1 -1
  150. package/dist/assets/{mail-OkfIgZvZ.js → mail-P-Y3KiSi.js} +1 -1
  151. package/dist/assets/{message-circle-FxSQMQ04.js → message-circle-CMGjhLSL.js} +1 -1
  152. package/dist/assets/{mic-i8JOGAbe.js → mic-CD1EVj2b.js} +1 -1
  153. package/dist/assets/{midjourney-gkvwOOeo.js → midjourney--Ck1Wfqc.js} +1 -1
  154. package/dist/assets/{mobileLocalExec-CGZHthaT.js → mobileLocalExec--fsbqVUV.js} +2 -2
  155. package/dist/assets/{monitor-EO0RvNrv.js → monitor-B90FW30X.js} +1 -1
  156. package/dist/assets/{mouse-pointer-2-CPtgnbQR.js → mouse-pointer-2-BVNozhkt.js} +1 -1
  157. package/dist/assets/music-2-DGNhWGN8.js +1 -0
  158. package/dist/assets/{nanobanana-Boq7_JZY.js → nanobanana-2O8uFKaf.js} +1 -1
  159. package/dist/assets/{omni-e5RucB9v.js → omni-0Viu8s3W.js} +1 -1
  160. package/dist/assets/{openaiimage-CecDzHo_.js → openaiimage-o1NjJPhw.js} +1 -1
  161. package/dist/assets/{pagination-D60ws_82.js → pagination-Bn-Te_lz.js} +1 -1
  162. package/dist/assets/{pagination-SRh1R-Wq.js → pagination-Bn4f3wYD.js} +1 -1
  163. package/dist/assets/{pagination-BGdyJzOy.js → pagination-DpHxEI-k.js} +1 -1
  164. package/dist/assets/{palette-CJs4iujU.js → palette-DIHsHC32.js} +1 -1
  165. package/dist/assets/{paperclip-B8vIHRoV.js → paperclip-CYkP9UNQ.js} +1 -1
  166. package/dist/assets/{pause-DKV3CUc2.js → pause-BgXcwbWB.js} +1 -1
  167. package/dist/assets/{pencil-DBnzAthV.js → pencil-tUu6ouB5.js} +1 -1
  168. package/dist/assets/{pika-uSymPQgW.js → pika-rKlrUBan.js} +1 -1
  169. package/dist/assets/{pixverse-DJoTHlvm.js → pixverse-BsYpepIg.js} +1 -1
  170. package/dist/assets/play-DPIxDecq.js +1 -0
  171. package/dist/assets/{plug-DbhoeWq8.js → plug-B2G0FN8y.js} +1 -1
  172. package/dist/assets/plus-BJtw637u.js +1 -0
  173. package/dist/assets/{poivelle-D2KkNd5j.js → poivelle-BgSa25CB.js} +1 -1
  174. package/dist/assets/{popover-Bwr3zebM.js → popover-B-XDEzXf.js} +1 -1
  175. package/dist/assets/{producer-Cxno7MHc.js → producer-Ld_9lBUQ.js} +1 -1
  176. package/dist/assets/{qrart-B_O2hSUW.js → qrart-DeeVv1qS.js} +1 -1
  177. package/dist/assets/{realtime-DPnxL6F4.js → realtime-DbcX-uYY.js} +1 -1
  178. package/dist/assets/{refresh-cw-XK6d1Rrn.js → refresh-cw-t0kiTZWs.js} +1 -1
  179. package/dist/assets/rotate-ccw-D3cY5lvz.js +1 -0
  180. package/dist/assets/rotate-cw-Q9go6gdx.js +1 -0
  181. package/dist/assets/{row-CJFGEaUu.js → row-B5owDjio.js} +1 -1
  182. package/dist/assets/search-BL6paE0R.js +1 -0
  183. package/dist/assets/{seedance-DU1j5J-g.js → seedance-B-_3RBUv.js} +1 -1
  184. package/dist/assets/{seedream-CArwJJXh.js → seedream-BR7o2P5I.js} +1 -1
  185. package/dist/assets/{select-dFQR69yU.js → select-DqVvQzGq.js} +1 -1
  186. package/dist/assets/{serp-CrnveDjz.js → serp-DFtauEc7.js} +1 -1
  187. package/dist/assets/{shield-CD-cwA-R.js → shield-BPTkbELz.js} +1 -1
  188. package/dist/assets/{shuffle-CNtL7bxS.js → shuffle-Bmv2t6R6.js} +1 -1
  189. package/dist/assets/{slider-CkoC7Vaw.js → slider-Daiw6Iva.js} +1 -1
  190. package/dist/assets/{sliders-horizontal-C_QkROg-.js → sliders-horizontal-BYKTTTwE.js} +1 -1
  191. package/dist/assets/{solana-wallets-prYscF3m.js → solana-wallets-CXC-8jG6.js} +2 -2
  192. package/dist/assets/{solana-wallets-vue-DEUEO5z0.js → solana-wallets-vue-fIiCXbp_.js} +1 -1
  193. package/dist/assets/{sora-CzwyO5Uf.js → sora-DiGUJQy2.js} +1 -1
  194. package/dist/assets/{sparkles-oT2sABLz.js → sparkles-BGrSMnoO.js} +1 -1
  195. package/dist/assets/square-CdZofyiS.js +1 -0
  196. package/dist/assets/{store-B5vEOT3v.js → store-BqFA4FXv.js} +1 -1
  197. package/dist/assets/{suno-YHGQYMc-.js → suno-DzHPaaTE.js} +1 -1
  198. package/dist/assets/{switch-DvY2NqFp.js → switch-Co1BiZ5s.js} +1 -1
  199. package/dist/assets/{table-TGYHw4HJ.js → table-BJBYrivw.js} +1 -1
  200. package/dist/assets/{tabs-zBQZp7-W.js → tabs-C4gim7Ak.js} +1 -1
  201. package/dist/assets/{tag-DX9-5Mti.js → tag-DKlEOhWa.js} +1 -1
  202. package/dist/assets/terminal-DSXKpkoK.js +1 -0
  203. package/dist/assets/{time-picker-fxAwDpta.js → time-picker-BsiiE59u.js} +1 -1
  204. package/dist/assets/{tooltip-DQRB5WQe.js → tooltip-DowzbA2H.js} +1 -1
  205. package/dist/assets/{trash-2-DooQKonb.js → trash-2-DY-Xs8eB.js} +1 -1
  206. package/dist/assets/{triangle-alert-CFrX8gEt.js → triangle-alert-DIl0w9Tt.js} +1 -1
  207. package/dist/assets/{upload-Dc_bG_Na.js → upload-C2q57sfz.js} +1 -1
  208. package/dist/assets/{upload-CfWJ5heB.js → upload-Dysa20WI.js} +1 -1
  209. package/dist/assets/user-DC1cJhr8.js +1 -0
  210. package/dist/assets/{veo-P9G1eZDl.js → veo-Dgiv3d9X.js} +1 -1
  211. package/dist/assets/{video-B4V6U2Lt.js → video-D-94pvqW.js} +1 -1
  212. package/dist/assets/{volume-2-CBU3mumY.js → volume-2-glzy9b7l.js} +1 -1
  213. package/dist/assets/{wallet-tXZJhZb4.js → wallet-DkDB80A7.js} +1 -1
  214. package/dist/assets/{wan-B1_lze58.js → wan-D7WRSQx1.js} +1 -1
  215. package/dist/assets/{wand-sparkles-DCARF_Gq.js → wand-sparkles-bgHAAYDe.js} +1 -1
  216. package/dist/assets/{web-Dt3i8jv0.js → web-BDw62ZyG.js} +1 -1
  217. package/dist/assets/{web-DqXv8HYa.js → web-BLnYRWAe.js} +1 -1
  218. package/dist/assets/{web-BCgE-YPT.js → web-CTwCReHZ.js} +1 -1
  219. package/dist/assets/{web-wPabi9Z9.js → web-CUvu7cWL.js} +1 -1
  220. package/dist/assets/{web-BDLdne_6.js → web-Dlm8jA1i.js} +1 -1
  221. package/dist/assets/{webextrator-CHz758G4.js → webextrator-BMKrL7aS.js} +1 -1
  222. package/dist/assets/{zap-BmraLjdI.js → zap-CQ29DxkU.js} +1 -1
  223. package/dist/index.html +1 -1
  224. package/package.json +1 -1
  225. package/dist/assets/arrow-down-DaxXAapG.js +0 -1
  226. package/dist/assets/arrow-left-CMgkzUy4.js +0 -1
  227. package/dist/assets/arrow-right-CkqFf1lT.js +0 -1
  228. package/dist/assets/arrow-up-D0O3p4cy.js +0 -1
  229. package/dist/assets/check-Jfe3Th-Y.js +0 -1
  230. package/dist/assets/chevron-down-fSJrrHQk.js +0 -1
  231. package/dist/assets/chevron-right-CUmIF3cC.js +0 -1
  232. package/dist/assets/circle-check-DkiYC-4D.js +0 -1
  233. package/dist/assets/clock-BMPDGdzS.js +0 -1
  234. package/dist/assets/code-BsYG89RQ.js +0 -1
  235. package/dist/assets/esm-CtLuh6nv.js +0 -1
  236. package/dist/assets/gauge-B5TeYhb-.js +0 -1
  237. package/dist/assets/loader-circle-BZ_qzblK.js +0 -1
  238. package/dist/assets/music-2-Da1AgiG2.js +0 -1
  239. package/dist/assets/play-DxJ3LldF.js +0 -1
  240. package/dist/assets/plus-Cjb15y66.js +0 -1
  241. package/dist/assets/rotate-ccw-Bd5EpOiS.js +0 -1
  242. package/dist/assets/rotate-cw-DhiaU2S1.js +0 -1
  243. package/dist/assets/search-Bh1--Pgw.js +0 -1
  244. package/dist/assets/square-CBVTZP_r.js +0 -1
  245. package/dist/assets/terminal-Dzk8plxI.js +0 -1
  246. package/dist/assets/user-BkFnDeCc.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,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-dFQR69yU.js";import{t as x}from"./upload-CfWJ5heB.js";import{t as S}from"./tooltip-DQRB5WQe.js";import{t as C}from"./alert-C16GyeJ_.js";import{t as w}from"./drawer-D_3Ux5r0.js";import{t as T}from"./box-BT9y4YFN.js";import{t as E}from"./clock-BMPDGdzS.js";import{n as D,r as O,t as k}from"./PromptTextarea-DSF00J6p.js";import{t as A}from"./info-BqYsJSgm.js";import{t as j}from"./trash-2-DooQKonb.js";import{t as ee}from"./triangle-alert-CFrX8gEt.js";import{t as M}from"./upload-Dc_bG_Na.js";import{t as N}from"./wand-sparkles-DCARF_Gq.js";import{Bt as P,Ht as F,It as te,Jt as I,Kt as ne,Lt as re,Mt as ie,Nt as ae,Pt as oe,Rt as se,Ut as ce,Vt as le,Wt as L,jt as R,qt as z,zt as B}from"./constants-Dm-HitpB.js";import{Dn as V,E as H,Gt as U,Kt as W,Sr as ue,Ti as G,Ut as de,Wt as K,Yt as fe,ci as q,di as J,in as pe,qt as Y,wi as me,zi as X}from"./index-CX5tT44B.js";import{t as he}from"./CopyToClipboard-DTo9jexV.js";import{t as Z}from"./ImagePreview-C_R7broQ.js";import{n as ge}from"./taskDrawerMixin-DyAUhFEq.js";import{t as _e}from"./Consumption-BdZ1c3ei.js";import{a as Q,n as ve,r as ye,t as be}from"./pagination-BGdyJzOy.js";import{t as xe}from"./VideoPlayer-K-a68Yxk.js";import{t as Se}from"./ApiCodeButton-BnhZ1r3c.js";import{t as Ce}from"./BotPlaceholder-B6Y-k016.js";var we=v({name:`LayoutGrokVideo`,components:{MagicIcon:N,ElDrawer:w,ElButton:X},mixins:[ge]}),Te={class:`main flex flex-row flex-1`},Ee={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)]`},De={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Oe(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,Te,[e(`div`,Ee,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,De,[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 ke=H(we,[[`render`,Oe],[`__scopeId`,`data-v-cdd6b8f3`]]),Ae=v({name:`GrokVideoPromptInput`,components:{PromptTextarea:k},computed:{prompt:{get(){return this.$store.state.grokvideo?.config?.prompt},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function je(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(`grokvideo.name.prompt`),info:e.$t(`grokvideo.description.prompt`),placeholder:e.$t(`grokvideo.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Me=H(Ae,[[`render`,je]]),Ne=v({name:`GrokVideoModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Q},data(){return{options:[{value:re,label:this.$t(`grokvideo.model.fastReverse`)},{value:B,label:this.$t(`grokvideo.model.reverse`)},{value:se,label:this.$t(`grokvideo.model.official`)},{value:te,label:this.$t(`grokvideo.model.official15`)}]}},computed:{value:{get(){return this.$store.state.grokvideo?.config?.model},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,model:e})}}},mounted(){this.value||=R}}),Pe={class:`field`},Fe={class:`label`},Ie={class:`box`},Le={class:`title font-bold`};function Re(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Pe,[e(`div`,Fe,[e(`div`,Ie,[e(`h2`,Le,i(t.$t(`grokvideo.name.model`)),1),a(m,{content:t.$t(`grokvideo.description.model`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`grokvideo.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ze=H(Ne,[[`render`,Re],[`__scopeId`,`data-v-9e6fef88`]]),Be=v({name:`GrokVideoDurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Q},computed:{model(){return this.$store.state.grokvideo?.config?.model},maxDuration(){return ne(this.model)},minDuration(){return z(this.model)},options(){return oe.filter(e=>e>=this.minDuration&&e<=this.maxDuration).map(e=>({value:e,label:`${e}s`}))},value:{get(){return this.$store.state.grokvideo?.config?.duration},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,duration:e})}}},watch:{maxDuration(e){this.value&&this.value>e&&(this.value=e)},minDuration(e){this.value&&this.value<e&&(this.value=e)}},mounted(){this.value||=6}}),Ve={class:`field`},He={class:`label`},Ue={class:`box`},We={class:`title font-bold`};function Ge(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Ve,[e(`div`,He,[e(`div`,Ue,[e(`h2`,We,i(t.$t(`grokvideo.name.duration`)),1),a(m,{content:t.$t(`grokvideo.description.duration`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`grokvideo.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ke=H(Be,[[`render`,Ge],[`__scopeId`,`data-v-673a8bbc`]]),qe=v({name:`GrokVideoResolutionSelector`,components:{InfoIcon:Q},data(){return{options:[{value:ce,label:`480p`},{value:L,label:`720p`},{value:F,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.grokvideo?.config?.resolution},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,resolution:e})}}},mounted(){this.value||=ae}}),Je={class:`resolution`},Ye={class:`header`},Xe={class:`title font-bold`},Ze={class:`items`},Qe=[`onClick`];function $e(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Je,[e(`div`,Ye,[e(`h2`,Xe,i(t.$t(`grokvideo.name.resolution`)),1),a(p,{content:t.$t(`grokvideo.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,Qe))),128))])])}var et=H(qe,[[`render`,$e],[`__scopeId`,`data-v-54f22a22`]]),tt=v({name:`GrokVideoRatioSelector`,components:{InfoIcon:Q},computed:{options(){return[{value:P,label:`16:9`,w:32,h:18},{value:le,label:`9:16`,w:18,h:32},{value:`1:1`,label:`1:1`,w:24,h:24},{value:`4:3`,label:`4:3`,w:28,h:21},{value:`3:4`,label:`3:4`,w:21,h:28},{value:`3:2`,label:`3:2`,w:30,h:20},{value:`2:3`,label:`2:3`,w:20,h:30}]},value:{get(){return this.$store.state.grokvideo?.config?.aspect_ratio},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,aspect_ratio:e})}}},mounted(){this.value||=ie}}),nt={class:`ratio`},rt={class:`header`},it={class:`title font-bold`},at={class:`items`},ot=[`onClick`],st={class:`preview`},ct={class:`name`};function lt(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,nt,[e(`div`,rt,[e(`h2`,it,i(t.$t(`grokvideo.name.ratio`)),1),a(p,{content:t.$t(`grokvideo.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,at,[(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`,st,[e(`div`,{class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)]),e(`div`,ct,i(r.label),1)],10,ot))),128))])])}var ut=H(tt,[[`render`,lt],[`__scopeId`,`data-v-70115284`]]),dt=v({name:`GrokVideoImageInput`,components:{UploadIcon:M,ElUpload:x,ElButton:X,InfoIcon:Q,ImagePreview:Z},mixins:[Y,W,K],data(){return{fileList:[],uploadUrl:J()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},required(){return I(this.$store.state.grokvideo?.config?.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},methods:{onExceed(){G.warning(this.$t(`grokvideo.message.uploadExceed`))},onError(){G.error(this.$t(`grokvideo.message.uploadError`))},onSetImageUrl(){let e=this.urls?.[0];this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,image_url:e||void 0})},async onSuccess(){this.onSetImageUrl()},async onRemove(){this.onSetImageUrl()}}}),ft={class:`relative`},pt={class:`flex justify-between`},mt={class:`flex justify-start items-center`},ht={class:`text-sm font-bold`},gt={key:0,class:`required-badge`};function _t(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,ft,[e(`div`,pt,[e(`div`,mt,[e(`span`,ht,i(t.$t(`grokvideo.name.image`)),1),t.required?(g(),s(`span`,gt,i(t.$t(`grokvideo.name.required`)),1)):o(``,!0),a(h,{content:t.$t(`grokvideo.description.image`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`grokvideo.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])}var vt=H(dt,[[`render`,_t],[`__scopeId`,`data-v-3365627a`]]),yt=4,bt=v({name:`GrokVideoReferenceImagesInput`,components:{UploadIcon:M,ElUpload:x,ElButton:X,InfoIcon:Q,ImagePreview:Z},mixins:[Y,W,K],data(){return{fileList:[],uploadUrl:J()+`/api/v1/files/`,limit:yt,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.grokvideo?.config?.reference_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(){G.warning(this.$t(`grokvideo.message.uploadReferenceExceed`))},onError(){G.error(this.$t(`grokvideo.message.uploadError`))},onSetReferenceImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,reference_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()}}}),xt={class:`field mb-[10px] flex min-h-8 w-full items-center justify-between gap-3`},St={class:`flex min-w-0 items-center`},Ct={class:`title m-0 text-[14px] font-bold`},wt={class:`file-list flex flex-wrap gap-[10px]`};function Tt(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`,xt,[e(`div`,St,[e(`h2`,Ct,i(t.$t(`grokvideo.name.referenceImages`)),1),a(_,{content:t.$t(`grokvideo.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,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(`grokvideo.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,wt,[(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 Et=v({name:`GrokVideoConfigPanel`,components:{MagicIcon:N,ElButton:X,PromptInput:Me,ModelSelector:ze,DurationSelector:Ke,ResolutionSelector:et,RatioSelector:ut,ImageInput:vt,ReferenceImagesInput:H(bt,[[`render`,Tt]]),Consumption:_e},emits:[`generate`],computed:{config(){return this.$store.state.grokvideo?.config},supportsReferenceImages(){return!I(this.$store.state.grokvideo?.config?.model)},consumption(){return fe(this.config,this.service?.cost)},service(){return this.$store.state.grokvideo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Dt={class:`flex flex-col h-full`},Ot={class:`flex-1 overflow-y-auto p-5`},kt={class:`flex flex-col items-center justify-center px-5 pb-5`};function At(t,n,c,u,d,m){let h=l(`prompt-input`),_=l(`model-selector`),v=l(`ratio-selector`),y=l(`resolution-selector`),b=l(`duration-selector`),x=l(`image-input`),S=l(`reference-images-input`),C=l(`consumption`),w=l(`magic-icon`),T=l(`el-button`);return g(),s(`div`,Dt,[e(`div`,Ot,[a(h,{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`}),t.supportsReferenceImages?(g(),f(S,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,kt,[a(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(w,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`grokvideo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var jt=H(Et,[[`render`,At]]),Mt=v({name:`GrokVideoTaskPreview`,components:{DeleteIcon:j,ApplicationIcon:T,ChannelIcon:O,FullscreenIcon:D,InfoIcon:A,MagicIcon:N,TimeIcon:E,WarningIcon:ee,CopyToClipboard:he,ElAlert:C,VideoPlayer:xe,ElTooltip:S,ElButton:X,ImagePreview:Z,ApiCodeButton:Se},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_url},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 me.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(`grokvideo/deleteTask`,{id:e}),G.success(this.$t(`common.message.deleteTaskSuccess`))}catch{G.error(this.$t(`common.message.deleteTaskFailed`))}}},stopTimer(){this.timer&&=(window.clearInterval(this.timer),0)},onDownload(e){window.open(e,`_blank`)}}}),Nt={class:`preview`},Pt={class:`left`},Ft={class:`main`},It={class:`bot`},Lt={class:`datetime`},Rt=[`aria-label`],zt={class:`info`},Bt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Vt={key:1,class:`prompt mt-2`},Ht={key:0},Ut={key:1},Wt={key:0,class:n({content:!0})},Gt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Kt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},qt={key:1,class:n({content:!0})},Jt={key:0,class:`mb-4`},Yt={key:1,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},Xt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Zt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Qt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$t={key:0},en={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},nn={key:2,class:n({content:!0})},rn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},sn={key:3,class:n({content:!0})},cn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function ln(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(`application-icon`),O=l(`fullscreen-icon`),k=l(`channel-icon`),A=l(`warning-icon`),j=l(`info-icon`);return g(),s(`div`,Nt,[e(`div`,Pt,[a(h,{capability:`grokvideo`,part:`avatar`,class:`avatar`})]),e(`div`,Ft,[e(`div`,It,[a(h,{capability:`grokvideo`,part:`name`}),e(`span`,Lt,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,Rt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,zt,[n.inputImage?(g(),s(`div`,Bt,[a(y,{url:n.inputImage,name:`image`,closable:!1},null,8,[`url`])])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,Vt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.video?.state===`processing`||n.video?.state===`pending`?(g(),s(`span`,Ut,` - (`+i(n.$t(`grokvideo.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,Ht,` - (`+i(n.$t(`grokvideo.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,qt,[n.video?.video_url?(g(),s(`div`,Jt,[a(w,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Yt,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`grokvideo.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(`grokvideo.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(E,{path:`/grok/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,Xt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.video?.duration?(g(),s(`p`,Zt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.name.duration`))+`: `+i(n.video?.duration)+`s `,1)])):o(``,!0),n.modelValue?.request?.resolution?(g(),s(`p`,Qt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.name.resolution`))+`: `+i(n.modelValue?.request?.resolution)+` `,1),n.modelValue?.request?.aspect_ratio?(g(),s(`span`,$t,` · `+i(n.modelValue?.request?.aspect_ratio),1)):o(``,!0)])):o(``,!0),e(`p`,en,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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(`grokvideo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,tn,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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`,nn,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.name.failure`)),1)]),default:p(()=>[e(`p`,rn,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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`,an,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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`,on,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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`,sn,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.name.status`)),1)]),default:p(()=>[e(`p`,cn,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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`,Wt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.status.pending`)),1)]),default:p(()=>[e(`p`,Gt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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`,Kt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.name.elapsed`))+`: `+i(n.pendingElapsed)+`s `,1)]))]),_:1})]))])])}var un=v({name:`GrokVideoRecentPanel`,components:{TaskPreview:H(Mt,[[`render`,ln],[`__scopeId`,`data-v-e40b2893`]]),BotPlaceholder:Ce,NoTasks:ye,ScrollList:ve},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.grokvideo?.tasks,items:this.$store.state.grokvideo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),dn={key:0},fn={key:2,class:`w-full h-full flex items-center justify-center`};function pn(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`,dn,[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`,fn,[a(v)])):o(``,!0)],64)}var mn=v({name:`GrokVideoIndex`,components:{ConfigPanel:jt,Layout:ke,RecentPanel:H(un,[[`render`,pn]])},mixins:[U],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.grokvideo?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.grokvideo?.status?.getTasks===q.Request||this.fetchingTasks},credential(){return this.$store.state.grokvideo?.credential},config(){return this.$store.state.grokvideo?.config},tasks(){return this.$store.state.grokvideo?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await be({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`grokvideo/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(`grokvideo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!de(this.uploadTracker,e=>this.$t(e),e=>G.warning(e)))return;let e={...this.config||{}};typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),typeof e?.image_url==`string`&&!e.image_url.trim()&&delete e.image_url,(I(e?.model)||!(Array.isArray(e?.reference_image_urls)&&e.reference_image_urls.length))&&delete e.reference_image_urls;let t=!!e?.image_url;if(I(e?.model)&&!t){G.warning(this.$t(`grokvideo.message.modelRequiresImage`));return}if(!t&&!e?.prompt){G.warning(this.$t(`grokvideo.message.promptOrImageRequired`));return}let n={...e,async:!0};if(!pe())return;let r=this.credential?.token;if(!r){console.error(`no token specified`);return}G.info(this.$t(`grokvideo.message.startingTask`)),ue(`grokvideo`,V.generate(n,{token:r})).then(()=>{G.success(this.$t(`grokvideo.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?G.error(this.$t(`grokvideo.message.usedUp`)):G.error(this.$t(`grokvideo.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function hn(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 gn=H(mn,[[`render`,hn]]);export{gn 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{r as y,t as b}from"./select-DqVvQzGq.js";import{t as x}from"./upload-Dysa20WI.js";import{t as S}from"./tooltip-DowzbA2H.js";import{t as C}from"./alert-BmDhbY4N.js";import{t as w}from"./drawer-BgpN40Ig.js";import{t as T}from"./box-CXHZJ19d.js";import{t as E}from"./clock-CTJncUP-.js";import{n as D,r as O,t as k}from"./PromptTextarea-BPhoRMVI.js";import{t as A}from"./info-L0HoT29_.js";import{t as j}from"./trash-2-DY-Xs8eB.js";import{t as ee}from"./triangle-alert-DIl0w9Tt.js";import{t as M}from"./upload-C2q57sfz.js";import{t as N}from"./wand-sparkles-bgHAAYDe.js";import{Bt as P,Ht as F,It as te,Jt as I,Kt as ne,Lt as re,Mt as ie,Nt as ae,Pt as oe,Rt as se,Ut as ce,Vt as le,Wt as L,jt as R,qt as z,zt as B}from"./constants-Dm-HitpB.js";import{Dn as V,E as H,Gt as U,Kt as W,Sr as ue,Ti as G,Ut as de,Wt as K,Yt as fe,ci as q,di as J,in as pe,qt as Y,wi as me,zi as X}from"./index-X4H_LD85.js";import{t as he}from"./CopyToClipboard-BMaxYkX6.js";import{t as Z}from"./ImagePreview-Dzwq5j1p.js";import{n as ge}from"./taskDrawerMixin-DyAUhFEq.js";import{t as _e}from"./Consumption-DL0zm78X.js";import{a as Q,n as ve,r as ye,t as be}from"./pagination-DpHxEI-k.js";import{t as xe}from"./VideoPlayer-CyCnHmhk.js";import{t as Se}from"./ApiCodeButton-C_DtLteh.js";import{t as Ce}from"./BotPlaceholder-miO90qGo.js";var we=v({name:`LayoutGrokVideo`,components:{MagicIcon:N,ElDrawer:w,ElButton:X},mixins:[ge]}),Te={class:`main flex flex-row flex-1`},Ee={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)]`},De={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Oe(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,Te,[e(`div`,Ee,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,De,[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 ke=H(we,[[`render`,Oe],[`__scopeId`,`data-v-cdd6b8f3`]]),Ae=v({name:`GrokVideoPromptInput`,components:{PromptTextarea:k},computed:{prompt:{get(){return this.$store.state.grokvideo?.config?.prompt},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function je(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(`grokvideo.name.prompt`),info:e.$t(`grokvideo.description.prompt`),placeholder:e.$t(`grokvideo.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Me=H(Ae,[[`render`,je]]),Ne=v({name:`GrokVideoModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Q},data(){return{options:[{value:re,label:this.$t(`grokvideo.model.fastReverse`)},{value:B,label:this.$t(`grokvideo.model.reverse`)},{value:se,label:this.$t(`grokvideo.model.official`)},{value:te,label:this.$t(`grokvideo.model.official15`)}]}},computed:{value:{get(){return this.$store.state.grokvideo?.config?.model},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,model:e})}}},mounted(){this.value||=R}}),Pe={class:`field`},Fe={class:`label`},Ie={class:`box`},Le={class:`title font-bold`};function Re(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Pe,[e(`div`,Fe,[e(`div`,Ie,[e(`h2`,Le,i(t.$t(`grokvideo.name.model`)),1),a(m,{content:t.$t(`grokvideo.description.model`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`grokvideo.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ze=H(Ne,[[`render`,Re],[`__scopeId`,`data-v-9e6fef88`]]),Be=v({name:`GrokVideoDurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Q},computed:{model(){return this.$store.state.grokvideo?.config?.model},maxDuration(){return ne(this.model)},minDuration(){return z(this.model)},options(){return oe.filter(e=>e>=this.minDuration&&e<=this.maxDuration).map(e=>({value:e,label:`${e}s`}))},value:{get(){return this.$store.state.grokvideo?.config?.duration},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,duration:e})}}},watch:{maxDuration(e){this.value&&this.value>e&&(this.value=e)},minDuration(e){this.value&&this.value<e&&(this.value=e)}},mounted(){this.value||=6}}),Ve={class:`field`},He={class:`label`},Ue={class:`box`},We={class:`title font-bold`};function Ge(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Ve,[e(`div`,He,[e(`div`,Ue,[e(`h2`,We,i(t.$t(`grokvideo.name.duration`)),1),a(m,{content:t.$t(`grokvideo.description.duration`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`grokvideo.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ke=H(Be,[[`render`,Ge],[`__scopeId`,`data-v-673a8bbc`]]),qe=v({name:`GrokVideoResolutionSelector`,components:{InfoIcon:Q},data(){return{options:[{value:ce,label:`480p`},{value:L,label:`720p`},{value:F,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.grokvideo?.config?.resolution},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,resolution:e})}}},mounted(){this.value||=ae}}),Je={class:`resolution`},Ye={class:`header`},Xe={class:`title font-bold`},Ze={class:`items`},Qe=[`onClick`];function $e(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Je,[e(`div`,Ye,[e(`h2`,Xe,i(t.$t(`grokvideo.name.resolution`)),1),a(p,{content:t.$t(`grokvideo.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,Qe))),128))])])}var et=H(qe,[[`render`,$e],[`__scopeId`,`data-v-54f22a22`]]),tt=v({name:`GrokVideoRatioSelector`,components:{InfoIcon:Q},computed:{options(){return[{value:P,label:`16:9`,w:32,h:18},{value:le,label:`9:16`,w:18,h:32},{value:`1:1`,label:`1:1`,w:24,h:24},{value:`4:3`,label:`4:3`,w:28,h:21},{value:`3:4`,label:`3:4`,w:21,h:28},{value:`3:2`,label:`3:2`,w:30,h:20},{value:`2:3`,label:`2:3`,w:20,h:30}]},value:{get(){return this.$store.state.grokvideo?.config?.aspect_ratio},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,aspect_ratio:e})}}},mounted(){this.value||=ie}}),nt={class:`ratio`},rt={class:`header`},it={class:`title font-bold`},at={class:`items`},ot=[`onClick`],st={class:`preview`},ct={class:`name`};function lt(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,nt,[e(`div`,rt,[e(`h2`,it,i(t.$t(`grokvideo.name.ratio`)),1),a(p,{content:t.$t(`grokvideo.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,at,[(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`,st,[e(`div`,{class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)]),e(`div`,ct,i(r.label),1)],10,ot))),128))])])}var ut=H(tt,[[`render`,lt],[`__scopeId`,`data-v-70115284`]]),dt=v({name:`GrokVideoImageInput`,components:{UploadIcon:M,ElUpload:x,ElButton:X,InfoIcon:Q,ImagePreview:Z},mixins:[Y,W,K],data(){return{fileList:[],uploadUrl:J()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},required(){return I(this.$store.state.grokvideo?.config?.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},methods:{onExceed(){G.warning(this.$t(`grokvideo.message.uploadExceed`))},onError(){G.error(this.$t(`grokvideo.message.uploadError`))},onSetImageUrl(){let e=this.urls?.[0];this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,image_url:e||void 0})},async onSuccess(){this.onSetImageUrl()},async onRemove(){this.onSetImageUrl()}}}),ft={class:`relative`},pt={class:`flex justify-between`},mt={class:`flex justify-start items-center`},ht={class:`text-sm font-bold`},gt={key:0,class:`required-badge`};function _t(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,ft,[e(`div`,pt,[e(`div`,mt,[e(`span`,ht,i(t.$t(`grokvideo.name.image`)),1),t.required?(g(),s(`span`,gt,i(t.$t(`grokvideo.name.required`)),1)):o(``,!0),a(h,{content:t.$t(`grokvideo.description.image`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`grokvideo.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])}var vt=H(dt,[[`render`,_t],[`__scopeId`,`data-v-3365627a`]]),yt=4,bt=v({name:`GrokVideoReferenceImagesInput`,components:{UploadIcon:M,ElUpload:x,ElButton:X,InfoIcon:Q,ImagePreview:Z},mixins:[Y,W,K],data(){return{fileList:[],uploadUrl:J()+`/api/v1/files/`,limit:yt,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.grokvideo?.config?.reference_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(){G.warning(this.$t(`grokvideo.message.uploadReferenceExceed`))},onError(){G.error(this.$t(`grokvideo.message.uploadError`))},onSetReferenceImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,reference_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()}}}),xt={class:`field mb-[10px] flex min-h-8 w-full items-center justify-between gap-3`},St={class:`flex min-w-0 items-center`},Ct={class:`title m-0 text-[14px] font-bold`},wt={class:`file-list flex flex-wrap gap-[10px]`};function Tt(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`,xt,[e(`div`,St,[e(`h2`,Ct,i(t.$t(`grokvideo.name.referenceImages`)),1),a(_,{content:t.$t(`grokvideo.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,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(`grokvideo.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,wt,[(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 Et=v({name:`GrokVideoConfigPanel`,components:{MagicIcon:N,ElButton:X,PromptInput:Me,ModelSelector:ze,DurationSelector:Ke,ResolutionSelector:et,RatioSelector:ut,ImageInput:vt,ReferenceImagesInput:H(bt,[[`render`,Tt]]),Consumption:_e},emits:[`generate`],computed:{config(){return this.$store.state.grokvideo?.config},supportsReferenceImages(){return!I(this.$store.state.grokvideo?.config?.model)},consumption(){return fe(this.config,this.service?.cost)},service(){return this.$store.state.grokvideo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Dt={class:`flex flex-col h-full`},Ot={class:`flex-1 overflow-y-auto p-5`},kt={class:`flex flex-col items-center justify-center px-5 pb-5`};function At(t,n,c,u,d,m){let h=l(`prompt-input`),_=l(`model-selector`),v=l(`ratio-selector`),y=l(`resolution-selector`),b=l(`duration-selector`),x=l(`image-input`),S=l(`reference-images-input`),C=l(`consumption`),w=l(`magic-icon`),T=l(`el-button`);return g(),s(`div`,Dt,[e(`div`,Ot,[a(h,{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`}),t.supportsReferenceImages?(g(),f(S,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,kt,[a(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(w,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`grokvideo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var jt=H(Et,[[`render`,At]]),Mt=v({name:`GrokVideoTaskPreview`,components:{DeleteIcon:j,ApplicationIcon:T,ChannelIcon:O,FullscreenIcon:D,InfoIcon:A,MagicIcon:N,TimeIcon:E,WarningIcon:ee,CopyToClipboard:he,ElAlert:C,VideoPlayer:xe,ElTooltip:S,ElButton:X,ImagePreview:Z,ApiCodeButton:Se},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_url},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 me.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(`grokvideo/deleteTask`,{id:e}),G.success(this.$t(`common.message.deleteTaskSuccess`))}catch{G.error(this.$t(`common.message.deleteTaskFailed`))}}},stopTimer(){this.timer&&=(window.clearInterval(this.timer),0)},onDownload(e){window.open(e,`_blank`)}}}),Nt={class:`preview`},Pt={class:`left`},Ft={class:`main`},It={class:`bot`},Lt={class:`datetime`},Rt=[`aria-label`],zt={class:`info`},Bt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Vt={key:1,class:`prompt mt-2`},Ht={key:0},Ut={key:1},Wt={key:0,class:n({content:!0})},Gt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Kt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},qt={key:1,class:n({content:!0})},Jt={key:0,class:`mb-4`},Yt={key:1,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},Xt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Zt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Qt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$t={key:0},en={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},nn={key:2,class:n({content:!0})},rn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},sn={key:3,class:n({content:!0})},cn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function ln(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(`application-icon`),O=l(`fullscreen-icon`),k=l(`channel-icon`),A=l(`warning-icon`),j=l(`info-icon`);return g(),s(`div`,Nt,[e(`div`,Pt,[a(h,{capability:`grokvideo`,part:`avatar`,class:`avatar`})]),e(`div`,Ft,[e(`div`,It,[a(h,{capability:`grokvideo`,part:`name`}),e(`span`,Lt,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,Rt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,zt,[n.inputImage?(g(),s(`div`,Bt,[a(y,{url:n.inputImage,name:`image`,closable:!1},null,8,[`url`])])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,Vt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.video?.state===`processing`||n.video?.state===`pending`?(g(),s(`span`,Ut,` - (`+i(n.$t(`grokvideo.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,Ht,` - (`+i(n.$t(`grokvideo.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,qt,[n.video?.video_url?(g(),s(`div`,Jt,[a(w,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Yt,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`grokvideo.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(`grokvideo.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(E,{path:`/grok/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,Xt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.video?.duration?(g(),s(`p`,Zt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.name.duration`))+`: `+i(n.video?.duration)+`s `,1)])):o(``,!0),n.modelValue?.request?.resolution?(g(),s(`p`,Qt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.name.resolution`))+`: `+i(n.modelValue?.request?.resolution)+` `,1),n.modelValue?.request?.aspect_ratio?(g(),s(`span`,$t,` · `+i(n.modelValue?.request?.aspect_ratio),1)):o(``,!0)])):o(``,!0),e(`p`,en,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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(`grokvideo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,tn,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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`,nn,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.name.failure`)),1)]),default:p(()=>[e(`p`,rn,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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`,an,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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`,on,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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`,sn,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.name.status`)),1)]),default:p(()=>[e(`p`,cn,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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`,Wt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.status.pending`)),1)]),default:p(()=>[e(`p`,Gt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.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`,Kt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`grokvideo.name.elapsed`))+`: `+i(n.pendingElapsed)+`s `,1)]))]),_:1})]))])])}var un=v({name:`GrokVideoRecentPanel`,components:{TaskPreview:H(Mt,[[`render`,ln],[`__scopeId`,`data-v-e40b2893`]]),BotPlaceholder:Ce,NoTasks:ye,ScrollList:ve},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.grokvideo?.tasks,items:this.$store.state.grokvideo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),dn={key:0},fn={key:2,class:`w-full h-full flex items-center justify-center`};function pn(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`,dn,[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`,fn,[a(v)])):o(``,!0)],64)}var mn=v({name:`GrokVideoIndex`,components:{ConfigPanel:jt,Layout:ke,RecentPanel:H(un,[[`render`,pn]])},mixins:[U],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.grokvideo?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.grokvideo?.status?.getTasks===q.Request||this.fetchingTasks},credential(){return this.$store.state.grokvideo?.credential},config(){return this.$store.state.grokvideo?.config},tasks(){return this.$store.state.grokvideo?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await be({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`grokvideo/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(`grokvideo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!de(this.uploadTracker,e=>this.$t(e),e=>G.warning(e)))return;let e={...this.config||{}};typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),typeof e?.image_url==`string`&&!e.image_url.trim()&&delete e.image_url,(I(e?.model)||!(Array.isArray(e?.reference_image_urls)&&e.reference_image_urls.length))&&delete e.reference_image_urls;let t=!!e?.image_url;if(I(e?.model)&&!t){G.warning(this.$t(`grokvideo.message.modelRequiresImage`));return}if(!t&&!e?.prompt){G.warning(this.$t(`grokvideo.message.promptOrImageRequired`));return}let n={...e,async:!0};if(!pe())return;let r=this.credential?.token;if(!r){console.error(`no token specified`);return}G.info(this.$t(`grokvideo.message.startingTask`)),ue(`grokvideo`,V.generate(n,{token:r})).then(()=>{G.success(this.$t(`grokvideo.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?G.error(this.$t(`grokvideo.message.usedUp`)):G.error(this.$t(`grokvideo.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function hn(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 gn=H(mn,[[`render`,hn]]);export{gn 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-CfWJ5heB.js";import{t as b}from"./tooltip-DQRB5WQe.js";import{t as x}from"./alert-C16GyeJ_.js";import{t as S}from"./drawer-D_3Ux5r0.js";import{t as C}from"./box-BT9y4YFN.js";import{t as w}from"./clock-BMPDGdzS.js";import{n as T,r as E,t as D}from"./PromptTextarea-DSF00J6p.js";import{t as O}from"./info-BqYsJSgm.js";import{t as k}from"./trash-2-DooQKonb.js";import{t as A}from"./triangle-alert-CFrX8gEt.js";import{t as j}from"./upload-Dc_bG_Na.js";import{t as M}from"./wand-sparkles-DCARF_Gq.js";import{Ct as N,Dt as ee,Et as P,Ot as F,kt as I,wt as L}from"./constants-Dm-HitpB.js";import{E as R,En as te,Gt as ne,Kt as z,Sr as re,Ti as B,Ut as V,Wt as H,Yt as U,ci as W,di as G,in as K,qt as q,wi as J,zi as Y}from"./index-CX5tT44B.js";import{t as X}from"./CopyToClipboard-DTo9jexV.js";import{t as ie}from"./FilePreview-UA-4U2mr.js";import{t as Z}from"./ImagePreview-C_R7broQ.js";import{n as ae}from"./taskDrawerMixin-DyAUhFEq.js";import{t as oe}from"./Consumption-BdZ1c3ei.js";import{a as Q,n as se,r as ce,t as le}from"./pagination-BGdyJzOy.js";import{t as ue}from"./VideoPlayer-K-a68Yxk.js";import{t as de}from"./ApiCodeButton-BnhZ1r3c.js";import{t as fe}from"./BotPlaceholder-B6Y-k016.js";var pe=v({name:`LayoutOmni`,components:{MagicIcon:M,ElDrawer:S,ElButton:Y},mixins:[ae]}),me={class:`main flex flex-row flex-1`},he={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)]`},ge={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function _e(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,me,[e(`div`,he,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ge,[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 ve=R(pe,[[`render`,_e],[`__scopeId`,`data-v-b76ffabf`]]),ye=v({name:`OmniPromptInput`,components:{PromptTextarea:D},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 be(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 xe=R(ye,[[`render`,be]]),Se=v({name:`OmniResolutionSelector`,components:{InfoIcon:Q},data(){return{options:[{value:I,label:`720p`},{value:F,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||=L}}),Ce={class:`resolution`},we={class:`header`},Te={class:`title font-bold`},Ee={class:`items`},De=[`onClick`];function Oe(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Ce,[e(`div`,we,[e(`h2`,Te,i(t.$t(`omni.name.resolution`)),1),a(p,{content:t.$t(`omni.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,Ee,[(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,De))),128))])])}var ke=R(Se,[[`render`,Oe],[`__scopeId`,`data-v-1f9abe29`]]),Ae=v({name:`OmniRatioSelector`,components:{InfoIcon:Q},computed:{options(){return[{value:P,label:`16:9`,w:32,h:18},{value:ee,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||=N}}),je={class:`ratio`},Me={class:`header`},Ne={class:`title font-bold`},Pe={class:`items`},Fe=[`onClick`],Ie={class:`preview`},Le={class:`name`};function Re(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,je,[e(`div`,Me,[e(`h2`,Ne,i(t.$t(`omni.name.ratio`)),1),a(p,{content:t.$t(`omni.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,Pe,[(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`,Ie,[e(`div`,{class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)]),e(`div`,Le,i(r.label),1)],10,Fe))),128))])])}var ze=R(Ae,[[`render`,Re],[`__scopeId`,`data-v-1c0c1511`]]),Be=4,Ve=v({name:`OmniReferenceImagesInput`,components:{ElUpload:y,ElButton:Y,InfoIcon:Q,ImagePreview:Z,UploadIcon:j},mixins:[q,z,H],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`,limit:Be,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(){B.warning(this.$t(`omni.message.uploadReferenceExceed`))},onError(){B.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()}}}),He={class:`field mb-[10px] flex min-h-8 w-full items-center justify-between gap-3`},Ue={class:`flex min-w-0 items-center`},We={class:`title m-0 text-[14px] font-bold`},Ge={class:`file-list flex flex-wrap gap-[10px]`};function Ke(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`,He,[e(`div`,Ue,[e(`h2`,We,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,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`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,Ge,[(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 qe=R(Ve,[[`render`,Ke]]),Je=v({name:`OmniVideoInput`,components:{ElUpload:y,ElButton:Y,InfoIcon:Q,FilePreview:ie,UploadIcon:j},mixins:[z,H],data(){return{fileList:[],uploadUrl:G()+`/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(){B.warning(this.$t(`omni.message.uploadVideoExceed`))},onError(){B.error(this.$t(`omni.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<200;return t?n?!0:(B.error(this.$t(`omni.message.uploadVideoSizeExceed`)),!1):(B.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)}}}),Ye={class:`field flex min-h-8 w-full items-center justify-between gap-3`},Xe={class:`flex min-w-0 items-center`},Ze={class:`title m-0 text-[14px] font-bold`},Qe={key:0,class:`file-list flex flex-wrap gap-[10px]`};function $e(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`,Ye,[e(`div`,Xe,[e(`h2`,Ze,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`,Qe,[a(y,{url:t.videoUrl,name:t.videoName,percentage:100,onRemove:t.onRemove},null,8,[`url`,`name`,`onRemove`])])):o(``,!0)])}var et=v({name:`OmniConfigPanel`,components:{ElButton:Y,MagicIcon:M,PromptInput:xe,ResolutionSelector:ke,RatioSelector:ze,ReferenceImagesInput:qe,VideoInput:R(Je,[[`render`,$e],[`__scopeId`,`data-v-bec16553`]]),Consumption:oe},emits:[`generate`],computed:{config(){return this.$store.state.omni?.config},consumption(){return U(this.config,this.service?.cost)},service(){return this.$store.state.omni?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),tt={class:`flex flex-col h-full`},nt={class:`flex-1 overflow-y-auto p-5`},rt={class:`flex flex-col items-center justify-center px-5 pb-5`};function it(t,n,o,c,u,d){let f=l(`prompt-input`),m=l(`ratio-selector`),h=l(`resolution-selector`),_=l(`reference-images-input`),v=l(`video-input`),y=l(`consumption`),b=l(`magic-icon`),x=l(`el-button`);return g(),s(`div`,tt,[e(`div`,nt,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`})]),e(`div`,rt,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.generate`)),1)]),_:1},8,[`onClick`])])])}var at=R(et,[[`render`,it]]),ot=v({name:`OmniTaskPreview`,components:{DeleteIcon:k,ApplicationIcon:C,ChannelIcon:E,CopyToClipboard:X,ExpandIcon:T,InfoIcon:O,MagicIcon:M,TimeIcon:w,WarningIcon:A,ElAlert:x,VideoPlayer:ue,ElTooltip:b,ElButton:Y,ImagePreview:Z,ApiCodeButton:de},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 J.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`omni/deleteTask`,{id:e}),B.success(this.$t(`common.message.deleteTaskSuccess`))}catch{B.error(this.$t(`common.message.deleteTaskFailed`))}}},stopTimer(){this.timer&&=(window.clearInterval(this.timer),0)},onDownload(e){window.open(e,`_blank`)}}}),st={class:`preview`},ct={class:`left`},lt={class:`main`},ut={class:`bot`},dt={class:`datetime`},ft=[`aria-label`],pt={class:`info`},mt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},ht={key:1,class:`prompt mt-2`},gt={key:0},_t={key:1},vt={key:0,class:n({content:!0})},yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},xt={key:1,class:n({content:!0})},St={key:0,class:`mb-4`},Ct={key:1,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},wt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={key:0},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},kt={key:2,class:n({content:!0})},At={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Nt={key:3,class:n({content:!0})},Pt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Ft(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(`application-icon`),O=l(`expand-icon`),k=l(`channel-icon`),A=l(`warning-icon`),j=l(`info-icon`);return g(),s(`div`,st,[e(`div`,ct,[a(h,{capability:`omni`,part:`avatar`,class:`avatar`})]),e(`div`,lt,[e(`div`,ut,[a(h,{capability:`omni`,part:`name`}),e(`span`,dt,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,ft)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,pt,[n.inputImage?(g(),s(`div`,mt,[a(y,{url:n.inputImage,name:`image`,closable:!1},null,8,[`url`])])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,ht,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.video?.state===`processing`||n.video?.state===`pending`?(g(),s(`span`,_t,` - (`+i(n.$t(`omni.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,gt,` - (`+i(n.$t(`omni.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,xt,[n.video?.video_url?(g(),s(`div`,St,[a(w,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Ct,[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(`omni.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(E,{path:`/gemini/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,wt,[a(D,{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`,Tt,[a(O,{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`,Et,` · `+i(n.modelValue?.request?.aspect_ratio),1)):o(``,!0)])):o(``,!0),e(`p`,$,[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`,Dt,[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`,Ot,[a(k,{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`,kt,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failure`)),1)]),default:p(()=>[e(`p`,At,[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`,jt,[a(j,{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`,Mt,[a(k,{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`,Nt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.status`)),1)]),default:p(()=>[e(`p`,Pt,[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`,vt,[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`,yt,[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`,bt,[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 It=v({name:`OmniRecentPanel`,components:{TaskPreview:R(ot,[[`render`,Ft],[`__scopeId`,`data-v-2f40a5a9`]]),BotPlaceholder:fe,NoTasks:ce,ScrollList:se},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?.()}}}),Lt={key:0},Rt={key:2,class:`w-full h-full flex items-center justify-center`};function zt(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`,Lt,[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`,Rt,[a(v)])):o(``,!0)],64)}var Bt=v({name:`OmniIndex`,components:{ConfigPanel:at,Layout:ve,RecentPanel:R(It,[[`render`,zt]])},mixins:[ne],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.omni?.status?.getApplications===W.Request},tasksLoading(){return this.$store.state.omni?.status?.getTasks===W.Request||this.fetchingTasks},credential(){return this.$store.state.omni?.credential},config(){return this.$store.state.omni?.config},tasks(){return this.$store.state.omni?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await le({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})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!V(this.uploadTracker,e=>this.$t(e),e=>B.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.image_urls)&&(e.image_urls=e.image_urls.filter(e=>typeof e==`string`&&e.trim()),e.image_urls.length||delete e.image_urls),Array.isArray(e?.video_urls)&&(e.video_urls=e.video_urls.filter(e=>typeof e==`string`&&e.trim()),e.video_urls.length||delete e.video_urls),!e?.prompt){B.warning(this.$t(`omni.message.promptRequired`));return}if(e?.video_urls&&!e?.image_urls){B.warning(this.$t(`omni.message.videoRequiresImage`));return}let t={...e,async:!0};if(!K())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}B.info(this.$t(`omni.message.startingTask`)),re(`omni`,te.generate(t,{token:n})).then(()=>{B.success(this.$t(`omni.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?B.error(this.$t(`omni.message.usedUp`)):B.error(this.$t(`omni.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Vt(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 Ht=R(Bt,[[`render`,Vt]]);export{Ht 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-Dysa20WI.js";import{t as b}from"./tooltip-DowzbA2H.js";import{t as x}from"./alert-BmDhbY4N.js";import{t as S}from"./drawer-BgpN40Ig.js";import{t as C}from"./box-CXHZJ19d.js";import{t as w}from"./clock-CTJncUP-.js";import{n as T,r as E,t as D}from"./PromptTextarea-BPhoRMVI.js";import{t as O}from"./info-L0HoT29_.js";import{t as k}from"./trash-2-DY-Xs8eB.js";import{t as A}from"./triangle-alert-DIl0w9Tt.js";import{t as j}from"./upload-C2q57sfz.js";import{t as M}from"./wand-sparkles-bgHAAYDe.js";import{Ct as N,Dt as ee,Et as P,Ot as F,kt as I,wt as L}from"./constants-Dm-HitpB.js";import{E as R,En as te,Gt as ne,Kt as z,Sr as re,Ti as B,Ut as V,Wt as H,Yt as U,ci as W,di as G,in as K,qt as q,wi as J,zi as Y}from"./index-X4H_LD85.js";import{t as X}from"./CopyToClipboard-BMaxYkX6.js";import{t as ie}from"./FilePreview-CQ8miS5e.js";import{t as Z}from"./ImagePreview-Dzwq5j1p.js";import{n as ae}from"./taskDrawerMixin-DyAUhFEq.js";import{t as oe}from"./Consumption-DL0zm78X.js";import{a as Q,n as se,r as ce,t as le}from"./pagination-DpHxEI-k.js";import{t as ue}from"./VideoPlayer-CyCnHmhk.js";import{t as de}from"./ApiCodeButton-C_DtLteh.js";import{t as fe}from"./BotPlaceholder-miO90qGo.js";var pe=v({name:`LayoutOmni`,components:{MagicIcon:M,ElDrawer:S,ElButton:Y},mixins:[ae]}),me={class:`main flex flex-row flex-1`},he={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)]`},ge={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function _e(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,me,[e(`div`,he,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ge,[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 ve=R(pe,[[`render`,_e],[`__scopeId`,`data-v-b76ffabf`]]),ye=v({name:`OmniPromptInput`,components:{PromptTextarea:D},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 be(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 xe=R(ye,[[`render`,be]]),Se=v({name:`OmniResolutionSelector`,components:{InfoIcon:Q},data(){return{options:[{value:I,label:`720p`},{value:F,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||=L}}),Ce={class:`resolution`},we={class:`header`},Te={class:`title font-bold`},Ee={class:`items`},De=[`onClick`];function Oe(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Ce,[e(`div`,we,[e(`h2`,Te,i(t.$t(`omni.name.resolution`)),1),a(p,{content:t.$t(`omni.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,Ee,[(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,De))),128))])])}var ke=R(Se,[[`render`,Oe],[`__scopeId`,`data-v-1f9abe29`]]),Ae=v({name:`OmniRatioSelector`,components:{InfoIcon:Q},computed:{options(){return[{value:P,label:`16:9`,w:32,h:18},{value:ee,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||=N}}),je={class:`ratio`},Me={class:`header`},Ne={class:`title font-bold`},Pe={class:`items`},Fe=[`onClick`],Ie={class:`preview`},Le={class:`name`};function Re(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,je,[e(`div`,Me,[e(`h2`,Ne,i(t.$t(`omni.name.ratio`)),1),a(p,{content:t.$t(`omni.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,Pe,[(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`,Ie,[e(`div`,{class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)]),e(`div`,Le,i(r.label),1)],10,Fe))),128))])])}var ze=R(Ae,[[`render`,Re],[`__scopeId`,`data-v-1c0c1511`]]),Be=4,Ve=v({name:`OmniReferenceImagesInput`,components:{ElUpload:y,ElButton:Y,InfoIcon:Q,ImagePreview:Z,UploadIcon:j},mixins:[q,z,H],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`,limit:Be,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(){B.warning(this.$t(`omni.message.uploadReferenceExceed`))},onError(){B.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()}}}),He={class:`field mb-[10px] flex min-h-8 w-full items-center justify-between gap-3`},Ue={class:`flex min-w-0 items-center`},We={class:`title m-0 text-[14px] font-bold`},Ge={class:`file-list flex flex-wrap gap-[10px]`};function Ke(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`,He,[e(`div`,Ue,[e(`h2`,We,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,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`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,Ge,[(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 qe=R(Ve,[[`render`,Ke]]),Je=v({name:`OmniVideoInput`,components:{ElUpload:y,ElButton:Y,InfoIcon:Q,FilePreview:ie,UploadIcon:j},mixins:[z,H],data(){return{fileList:[],uploadUrl:G()+`/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(){B.warning(this.$t(`omni.message.uploadVideoExceed`))},onError(){B.error(this.$t(`omni.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<200;return t?n?!0:(B.error(this.$t(`omni.message.uploadVideoSizeExceed`)),!1):(B.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)}}}),Ye={class:`field flex min-h-8 w-full items-center justify-between gap-3`},Xe={class:`flex min-w-0 items-center`},Ze={class:`title m-0 text-[14px] font-bold`},Qe={key:0,class:`file-list flex flex-wrap gap-[10px]`};function $e(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`,Ye,[e(`div`,Xe,[e(`h2`,Ze,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`,Qe,[a(y,{url:t.videoUrl,name:t.videoName,percentage:100,onRemove:t.onRemove},null,8,[`url`,`name`,`onRemove`])])):o(``,!0)])}var et=v({name:`OmniConfigPanel`,components:{ElButton:Y,MagicIcon:M,PromptInput:xe,ResolutionSelector:ke,RatioSelector:ze,ReferenceImagesInput:qe,VideoInput:R(Je,[[`render`,$e],[`__scopeId`,`data-v-bec16553`]]),Consumption:oe},emits:[`generate`],computed:{config(){return this.$store.state.omni?.config},consumption(){return U(this.config,this.service?.cost)},service(){return this.$store.state.omni?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),tt={class:`flex flex-col h-full`},nt={class:`flex-1 overflow-y-auto p-5`},rt={class:`flex flex-col items-center justify-center px-5 pb-5`};function it(t,n,o,c,u,d){let f=l(`prompt-input`),m=l(`ratio-selector`),h=l(`resolution-selector`),_=l(`reference-images-input`),v=l(`video-input`),y=l(`consumption`),b=l(`magic-icon`),x=l(`el-button`);return g(),s(`div`,tt,[e(`div`,nt,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`})]),e(`div`,rt,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.generate`)),1)]),_:1},8,[`onClick`])])])}var at=R(et,[[`render`,it]]),ot=v({name:`OmniTaskPreview`,components:{DeleteIcon:k,ApplicationIcon:C,ChannelIcon:E,CopyToClipboard:X,ExpandIcon:T,InfoIcon:O,MagicIcon:M,TimeIcon:w,WarningIcon:A,ElAlert:x,VideoPlayer:ue,ElTooltip:b,ElButton:Y,ImagePreview:Z,ApiCodeButton:de},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 J.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`omni/deleteTask`,{id:e}),B.success(this.$t(`common.message.deleteTaskSuccess`))}catch{B.error(this.$t(`common.message.deleteTaskFailed`))}}},stopTimer(){this.timer&&=(window.clearInterval(this.timer),0)},onDownload(e){window.open(e,`_blank`)}}}),st={class:`preview`},ct={class:`left`},lt={class:`main`},ut={class:`bot`},dt={class:`datetime`},ft=[`aria-label`],pt={class:`info`},mt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},ht={key:1,class:`prompt mt-2`},gt={key:0},_t={key:1},vt={key:0,class:n({content:!0})},yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},xt={key:1,class:n({content:!0})},St={key:0,class:`mb-4`},Ct={key:1,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},wt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={key:0},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},kt={key:2,class:n({content:!0})},At={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Nt={key:3,class:n({content:!0})},Pt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Ft(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(`application-icon`),O=l(`expand-icon`),k=l(`channel-icon`),A=l(`warning-icon`),j=l(`info-icon`);return g(),s(`div`,st,[e(`div`,ct,[a(h,{capability:`omni`,part:`avatar`,class:`avatar`})]),e(`div`,lt,[e(`div`,ut,[a(h,{capability:`omni`,part:`name`}),e(`span`,dt,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,ft)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,pt,[n.inputImage?(g(),s(`div`,mt,[a(y,{url:n.inputImage,name:`image`,closable:!1},null,8,[`url`])])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,ht,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.video?.state===`processing`||n.video?.state===`pending`?(g(),s(`span`,_t,` - (`+i(n.$t(`omni.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,gt,` - (`+i(n.$t(`omni.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,xt,[n.video?.video_url?(g(),s(`div`,St,[a(w,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Ct,[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(`omni.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(E,{path:`/gemini/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,wt,[a(D,{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`,Tt,[a(O,{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`,Et,` · `+i(n.modelValue?.request?.aspect_ratio),1)):o(``,!0)])):o(``,!0),e(`p`,$,[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`,Dt,[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`,Ot,[a(k,{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`,kt,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failure`)),1)]),default:p(()=>[e(`p`,At,[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`,jt,[a(j,{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`,Mt,[a(k,{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`,Nt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.status`)),1)]),default:p(()=>[e(`p`,Pt,[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`,vt,[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`,yt,[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`,bt,[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 It=v({name:`OmniRecentPanel`,components:{TaskPreview:R(ot,[[`render`,Ft],[`__scopeId`,`data-v-2f40a5a9`]]),BotPlaceholder:fe,NoTasks:ce,ScrollList:se},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?.()}}}),Lt={key:0},Rt={key:2,class:`w-full h-full flex items-center justify-center`};function zt(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`,Lt,[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`,Rt,[a(v)])):o(``,!0)],64)}var Bt=v({name:`OmniIndex`,components:{ConfigPanel:at,Layout:ve,RecentPanel:R(It,[[`render`,zt]])},mixins:[ne],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.omni?.status?.getApplications===W.Request},tasksLoading(){return this.$store.state.omni?.status?.getTasks===W.Request||this.fetchingTasks},credential(){return this.$store.state.omni?.credential},config(){return this.$store.state.omni?.config},tasks(){return this.$store.state.omni?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await le({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})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!V(this.uploadTracker,e=>this.$t(e),e=>B.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.image_urls)&&(e.image_urls=e.image_urls.filter(e=>typeof e==`string`&&e.trim()),e.image_urls.length||delete e.image_urls),Array.isArray(e?.video_urls)&&(e.video_urls=e.video_urls.filter(e=>typeof e==`string`&&e.trim()),e.video_urls.length||delete e.video_urls),!e?.prompt){B.warning(this.$t(`omni.message.promptRequired`));return}if(e?.video_urls&&!e?.image_urls){B.warning(this.$t(`omni.message.videoRequiresImage`));return}let t={...e,async:!0};if(!K())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}B.info(this.$t(`omni.message.startingTask`)),re(`omni`,te.generate(t,{token:n})).then(()=>{B.success(this.$t(`omni.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?B.error(this.$t(`omni.message.usedUp`)):B.error(this.$t(`omni.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Vt(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 Ht=R(Bt,[[`render`,Vt]]);export{Ht as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{n as v,r as y,t as b}from"./select-dFQR69yU.js";import{t as x}from"./upload-CfWJ5heB.js";import{t as S}from"./tooltip-DQRB5WQe.js";import{t as C}from"./alert-C16GyeJ_.js";import{t as w}from"./drawer-D_3Ux5r0.js";import{t as T}from"./input-number-mWiCY8x-.js";import{t as E}from"./switch-DvY2NqFp.js";import{t as D}from"./box-BT9y4YFN.js";import{t as O}from"./clock-BMPDGdzS.js";import{r as k,t as A}from"./PromptTextarea-DSF00J6p.js";import{t as j}from"./image-DRW5OCUW.js";import{t as M}from"./info-BqYsJSgm.js";import{t as N}from"./trash-2-DooQKonb.js";import{t as P}from"./triangle-alert-CFrX8gEt.js";import{t as F}from"./upload-Dc_bG_Na.js";import{t as I}from"./wand-sparkles-DCARF_Gq.js";import{t as ee}from"./zap-BmraLjdI.js";import{Bn as L,Fn as R,Gn as te,Ln as ne,Mn as re,Nn as ie,Pn as ae,Rn as oe,Un as se,Vn as z,Wn as B,zn as V}from"./constants-Dm-HitpB.js";import{An as H,E as U,Gt as W,Kt as G,Sr as K,Ti as q,Ut as ce,Wt as le,Yt as ue,ci as J,di as de,in as fe,qt as pe,wi as me,zi as Y}from"./index-CX5tT44B.js";import{t as he}from"./CopyToClipboard-DTo9jexV.js";import{t as X}from"./ImagePreview-C_R7broQ.js";import{n as ge}from"./taskDrawerMixin-DyAUhFEq.js";import{t as _e}from"./Consumption-BdZ1c3ei.js";import{a as Z,n as ve,r as ye,t as be}from"./pagination-BGdyJzOy.js";import{t as xe}from"./ApiCodeButton-BnhZ1r3c.js";import{t as Se}from"./BotPlaceholder-B6Y-k016.js";import{t as Ce}from"./ImageWrapper-BRkG-4ZC.js";var we=_({name:`LayoutNanobanana`,components:{MagicIcon:I,ElDrawer:w,ElButton:Y},mixins:[ge]}),Te={class:`main flex flex-row flex-1`},Ee={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)]`},De={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Oe(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,Te,[e(`div`,Ee,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,De,[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 ke=U(we,[[`render`,Oe],[`__scopeId`,`data-v-fa2172a6`]]),Ae=_({name:`PromptInput`,components:{PromptTextarea:A},computed:{prompt:{get(){return this.$store.state.openaiimage?.config?.prompt},set(e){this.$store.commit(`openaiimage/setConfig`,{...this.$store.state.openaiimage?.config,prompt:e})}}},mounted(){this.prompt||=``}});function je(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(`openaiimage.name.prompt`),info:e.$t(`openaiimage.description.prompt`),placeholder:e.$t(`openaiimage.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Me=U(Ae,[[`render`,je]]),Ne=_({name:`ImageUrlsInput`,components:{UploadIcon:F,ElUpload:x,ElButton:Y,InfoIcon:Z,ImagePreview:X},mixins:[pe,G,le],data(){return{fileList:[],uploadUrl:de()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.openaiimage?.config?.image_urls}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},mounted(){},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImageUrls()},onExceed(){q.warning(this.$t(`openaiimage.message.uploadImageExceed`))},onError(){q.error(this.$t(`openaiimage.message.uploadImageError`))},onSetImageUrls(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`openaiimage/setConfig`,{...this.$store.state.openaiimage?.config,image_urls:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImageUrls()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImageUrls()}}}),Pe={class:`field flex min-h-8 w-full items-center justify-between gap-3`},Fe={class:`flex min-w-0 items-center`},Ie={class:`title m-0 text-[14px] font-bold`},Le={class:`file-list flex flex-wrap gap-[10px]`};function Re(t,n,o,u,d,g){let _=l(`info-icon`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`image-preview`);return h(),s(`div`,null,[e(`div`,Pe,[e(`div`,Fe,[e(`h2`,Ie,i(t.$t(`openaiimage.name.imageUrls`)),1),a(_,{content:t.$t(`openaiimage.description.imageUrls`)},null,8,[`content`])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value shrink-0`,limit:5,multiple:!0,"show-file-list":!1,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(`openaiimage.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,Le,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),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 ze=U(Ne,[[`render`,Re]]),Be=_({name:`OpenAIImageModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[{value:ne,label:this.$t(`openaiimage.model.gptImage1`)},{value:oe,label:this.$t(`openaiimage.model.gptImage15`)},{value:V,label:this.$t(`openaiimage.model.gptImage2`)},{value:L,label:this.$t(`openaiimage.model.gptImage2Official`)}]}},computed:{value:{get(){return this.$store.state.openaiimage?.config?.model},set(e){this.$store.commit(`openaiimage/setConfig`,{...this.$store.state.openaiimage?.config,model:e})}},modelDescription(){return this.$t(`openaiimage.description.model`)}},mounted(){this.value||=R}}),Ve={class:`field`},He={class:`label`},Ue={class:`box`},We={class:`title font-bold`};function Ge(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Ve,[e(`div`,He,[e(`div`,Ue,[e(`h2`,We,i(t.$t(`openaiimage.name.model`)),1),a(g,{content:t.modelDescription,class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`openaiimage.placeholder.select`)},{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,[`modelValue`,`placeholder`])])}var Ke=U(Be,[[`render`,Ge],[`__scopeId`,`data-v-a42acad4`]]);function Q(e){if(!e)return;let t=/^(\d+)x(\d+)$/.exec(e);if(t)return{w:Number(t[1]),h:Number(t[2])}}var qe=_({name:`OpenAIImageSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,ElSwitch:E,ElInputNumber:T,InfoIcon:Z},data(){return{customMode:!1,customWidth:1024,customHeight:1024}},computed:{model(){return this.$store.state.openaiimage?.config?.model||`gpt-image-2`},storedSize(){return this.$store.state.openaiimage?.config?.size},emptySizeValue(){return``},customSupported(){return ae.includes(this.model)},presets(){return z[this.model]??z[`gpt-image-2`]??[]},presetGroups(){return this.model===`gpt-image-2`||this.model===`gpt-image-2:official`?[{label:this.$t(`openaiimage.sizeGroup.standard1k`),options:se},{label:this.$t(`openaiimage.sizeGroup.preset2k`),options:B},{label:this.$t(`openaiimage.sizeGroup.preset4k`),options:te}]:[{label:this.$t(`openaiimage.sizeGroup.standard1k`),options:this.presets}]},useCustom:{get(){return this.customSupported&&this.customMode},set(e){if(!(e&&!this.customSupported))if(this.customMode=e,e){if(this.customError)return;this.commitSize(`${this.customWidth}x${this.customHeight}`)}else this.commitSize()}},presetValue:{get(){let e=this.storedSize;return e&&this.presets.includes(e)?e:this.emptySizeValue},set(e){this.customMode=!1,this.commitSize(e||void 0)}},multiple(){return 16},minSide(){return 256},maxSide(){return re},customError(){let e=this.customWidth,t=this.customHeight;return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?this.$t(`openaiimage.error.customSizePositive`):e%this.multiple!==0||t%this.multiple!==0?this.$t(`openaiimage.error.customSizeMultiple`,{multiple:this.multiple}):e<this.minSide||t<this.minSide?this.$t(`openaiimage.error.customSizeMin`,{min:this.minSide}):Math.max(e,t)>this.maxSide?this.$t(`openaiimage.error.customSizeMax`,{max:this.maxSide}):e*t>8294400?this.$t(`openaiimage.error.customSizePixels`,{pixels:ie.toLocaleString()}):``}},watch:{model:{immediate:!1,handler(){this.customSupported||(this.customMode=!1);let e=this.storedSize;if(!e||this.presets.includes(e))return;let t=Q(e);t&&this.customSupported&&(this.customMode=!0,this.customWidth=t.w,this.customHeight=t.h,!this.customError)||this.commitSize()}},storedSize(e){if(!e){this.customMode=!1;return}if(this.presets.includes(e)){this.customMode=!1;return}let t=Q(e);t&&this.customSupported&&(this.customMode=!0,this.customWidth!==t.w&&(this.customWidth=t.w),this.customHeight!==t.h&&(this.customHeight=t.h))},customWidth(){this.syncCustomToStore()},customHeight(){this.syncCustomToStore()}},mounted(){let e=this.storedSize,t=Q(e);e&&t&&this.customSupported&&!this.presets.includes(e)&&(this.customMode=!0,this.customWidth=t.w,this.customHeight=t.h)},methods:{commitSize(e){let t={...this.$store.state.openaiimage?.config};e?t.size=e:delete t.size,this.$store.commit(`openaiimage/setConfig`,t)},syncCustomToStore(){this.useCustom&&(this.customError||this.commitSize(`${this.customWidth}x${this.customHeight}`))}}}),Je={class:`resolution`},Ye={class:`field`},Xe={class:`label`},Ze={class:`box`},Qe={class:`title font-bold`},$e={class:`field custom-toggle`},et={class:`label`},tt={class:`box`},nt={class:`title font-bold`},rt={key:0,class:`custom-inputs`},it={class:`row`},at={class:`row-label`},ot={class:`row`},st={class:`row-label`},ct={key:0,class:`error`};function lt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`),x=l(`el-switch`),S=l(`el-input-number`);return h(),s(`div`,Je,[e(`div`,Ye,[e(`div`,Xe,[e(`div`,Ze,[e(`h2`,Qe,i(t.$t(`openaiimage.name.size`)),1),a(_,{content:t.$t(`openaiimage.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.presetValue,"onUpdate:modelValue":n[0]||=e=>t.presetValue=e,class:`value`,placeholder:t.$t(`openaiimage.placeholder.select`),disabled:t.useCustom},{default:p(()=>[a(v,{label:t.$t(`suno.gender.auto`),value:t.emptySizeValue},null,8,[`label`,`value`]),(h(!0),s(c,null,m(t.presetGroups,e=>(h(),f(y,{key:e.label,label:e.label},{default:p(()=>[(h(!0),s(c,null,m(e.options,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:2},1032,[`label`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`])]),t.customSupported?(h(),s(c,{key:0},[e(`div`,$e,[e(`div`,et,[e(`div`,tt,[e(`h2`,nt,i(t.$t(`openaiimage.name.customSize`)),1),a(_,{content:t.$t(`openaiimage.description.customSize`),class:`info`},null,8,[`content`])])]),a(x,{modelValue:t.useCustom,"onUpdate:modelValue":n[1]||=e=>t.useCustom=e,class:`value-switch`},null,8,[`modelValue`])]),t.useCustom?(h(),s(`div`,rt,[e(`div`,it,[e(`span`,at,i(t.$t(`openaiimage.name.width`)),1),a(S,{modelValue:t.customWidth,"onUpdate:modelValue":n[2]||=e=>t.customWidth=e,class:`row-input`,min:t.minSide,max:t.maxSide,step:t.multiple,"step-strictly":!0,"controls-position":`right`},null,8,[`modelValue`,`min`,`max`,`step`])]),e(`div`,ot,[e(`span`,st,i(t.$t(`openaiimage.name.height`)),1),a(S,{modelValue:t.customHeight,"onUpdate:modelValue":n[3]||=e=>t.customHeight=e,class:`row-input`,min:t.minSide,max:t.maxSide,step:t.multiple,"step-strictly":!0,"controls-position":`right`},null,8,[`modelValue`,`min`,`max`,`step`])]),t.customError?(h(),s(`div`,ct,i(t.customError),1)):o(``,!0)])):o(``,!0)],64)):o(``,!0)])}var ut=_({name:`ConfigPanel`,components:{MagicIcon:I,ElButton:Y,PromptInput:Me,Consumption:_e,ImageUrlsInput:ze,ModelSelector:Ke,ResolutionSelector:U(qe,[[`render`,lt],[`__scopeId`,`data-v-dfce4922`]])},emits:[`generate`],computed:{config(){return this.$store.state.openaiimage?.config},consumption(){return ue({...this.config||{}},this.service?.cost)},service(){return this.$store.state.openaiimage?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),dt={class:`flex flex-col h-full`},ft={class:`flex-1 overflow-y-auto p-5`},pt={class:`flex flex-col items-center justify-center px-5 pb-5`};function mt(t,n,o,c,u,d){let f=l(`model-selector`),m=l(`resolution-selector`),g=l(`prompt-input`),_=l(`image-urls-input`),v=l(`consumption`),y=l(`magic-icon`),b=l(`el-button`);return h(),s(`div`,dt,[e(`div`,ft,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(g,{class:`mb-4`}),a(_,{class:`mb-4`})]),e(`div`,pt,[a(v,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(b,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(y,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`openaiimage.button.generate`)),1)]),_:1},8,[`onClick`])])])}var ht=U(ut,[[`render`,mt]]),gt=_({name:`TaskPreview`,components:{ApplicationIcon:D,ChannelIcon:k,DeleteIcon:N,ImageIcon:j,InfoIcon:M,LightningIcon:ee,MagicIcon:I,TimeIcon:O,WarningIcon:P,CopyToClipboard:he,ElAlert:C,ImageWrapper:Ce,ElButton:Y,ElTooltip:S,ImagePreview:X,ApiCodeButton:xe},props:{modelValue:{type:Object,required:!0}},computed:{isEditRequest(){let e=this.modelValue?.request;return this.modelValue?.type===`images_edits`||e?.action===`edit`||this.referenceImages.length>0},showTaskType(){return!!(this.modelValue?.request?.action||this.modelValue?.type||this.referenceImages.length>0)},taskTypeLabel(){return this.isEditRequest?this.$t(`openaiimage.name.edits`):this.$t(`openaiimage.name.generate`)},openaiimagePath(){return this.isEditRequest?`/openai/images/edits`:`/openai/images/generations`},openaiimageCodeBody(){let e=this.modelValue?.request;if(!e)return;let t={...e};if(delete t.action,delete t.callback_url,this.isEditRequest){delete t.image_urls,delete t.image;let e=this.referenceImages;e.length===1?t.image=e[0]:e.length>1&&(t.image=e)}else delete t.image_urls,delete t.image;return t},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{let n=t;if(n?.image_url||n?.url){e.push(n);return}n?.b64_json&&e.push({...n,url:`data:image/png;base64,${n.b64_json}`})}),e},referenceImages(){let e=this.modelValue?.request;if(!e)return[];let t=Array.isArray(e.image_urls)?e.image_urls:[];if(t.length>0)return t.filter(e=>typeof e==`string`&&e.length>0);let n=e.image;return Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.length>0):typeof n==`string`&&n.length>0?[n]:Array.isArray(e.images)?e.images.map(e=>{if(typeof e==`string`)return e;if(e&&typeof e==`object`)return e.image_url}).filter(e=>typeof e==`string`&&e.length>0):[]}},methods:{onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.openaiimage?.config||{}};t.image_urls=[e],this.$store.commit(`openaiimage/setConfig`,t)},async onDelete(){let e=this.modelValue?.id;if(e){try{await me.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(`openaiimage/deleteTask`,{id:e}),q.success(this.$t(`common.message.deleteTaskSuccess`))}catch{q.error(this.$t(`common.message.deleteTaskFailed`))}}}}}),_t={class:`preview`},vt={class:`left`},yt={class:`main`},bt={class:`bot`},xt={class:`datetime`},St=[`aria-label`],Ct={class:`info`},wt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Tt={key:1,class:`prompt mt-2`},Et={key:0},Dt={key:0,class:n({content:!0,failed:!0})},Ot={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},kt={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},At={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},It={key:1,class:n({content:!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:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Bt={class:`text-[var(--el-text-color-regular)] text-xs mb-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-2`},Ht={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ut={key:2,class:n({content:!0})},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-2`},Kt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`};function Jt(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-preview`),C=l(`image-wrapper`),w=l(`el-button`),T=l(`api-code-button`),E=l(`application-icon`),D=l(`image-icon`),O=l(`lightning-icon`),k=l(`magic-icon`),A=l(`copy-to-clipboard`),j=l(`time-icon`),M=l(`channel-icon`),N=l(`el-alert`),P=l(`warning-icon`),F=l(`info-icon`);return h(),s(`div`,_t,[e(`div`,vt,[a(y,{capability:`openaiimage`,part:`avatar`,class:`avatar`})]),e(`div`,yt,[e(`div`,bt,[a(y,{capability:`openaiimage`,part:`name`}),e(`span`,xt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default: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,St)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Ct,[n.referenceImages.length>0?(h(),s(`div`,wt,[(h(!0),s(c,null,m(n.referenceImages,(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`,Tt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,Et,` - (`+i(n.$t(`openaiimage.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,Dt,[e(`div`,Ot,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(C,{key:t,src:e?.image_url||e?.url||``,"raw-src":e?.image_url||e?.url||``},null,8,[`src`,`raw-src`]))),128))]),e(`div`,kt,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(w,{type:`info`,size:`small`,class:`btn-action`,onClick:u[1]||=t(e=>n.onEdit(n.images?.[0]?.image_url||n.images?.[0]?.url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(T,{path:n.openaiimagePath,body:n.openaiimageCodeBody},null,8,[`path`,`body`])]),a(N,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,At,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,jt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),n.showTaskType?(h(),s(`p`,Mt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.task`))+`: `+i(n.taskTypeLabel),1)])):o(``,!0),e(`p`,Nt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Pt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,Ft,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(A,{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`,It,[a(N,{closable:!1,class:`failure`},{template:p(()=>[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.failure`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,Lt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,Rt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),n.showTaskType?(h(),s(`p`,zt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.task`))+`: `+i(n.taskTypeLabel),1)])):o(``,!0),e(`p`,Bt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,$,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(A,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Vt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,Ht,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(A,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,Ut,[a(N,{closable:!1,class:`info`},{template:p(()=>[n.modelValue?.response?(h(),f(F,{key:1,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):(h(),f(j,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),r(` `+i(n.$t(n.modelValue?.response?`openaiimage.name.status`:`openaiimage.status.pending`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,Wt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,Gt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),n.showTaskType?(h(),s(`p`,Kt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.task`))+`: `+i(n.taskTypeLabel),1)])):o(``,!0),e(`p`,qt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})]))])])}var Yt=_({name:`RecentPanel`,components:{TaskPreview:U(gt,[[`render`,Jt],[`__scopeId`,`data-v-de37fde1`]]),BotPlaceholder:Se,NoTasks:ye,ScrollList:ve},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.openaiimage?.tasks,items:this.$store.state.openaiimage?.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`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Xt,[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`,Zt,[a(v)])):o(``,!0)],64)}var $t=_({name:`OpenAIImageIndex`,components:{ConfigPanel:ht,Layout:ke,RecentPanel:U(Yt,[[`render`,Qt]])},mixins:[W],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.openaiimage?.status?.getApplications===J.Request},tasksLoading(){return this.$store.state.openaiimage?.status?.getTasks===J.Request},credential(){return this.$store.state.openaiimage?.credential},config(){return this.$store.state.openaiimage?.config},application(){return this.$store.state.openaiimage?.application},tasks(){return this.$store.state.openaiimage?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await be({tasks:this.tasks,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(`openaiimage/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`openaiimage/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(`openaiimage/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!ce(this.uploadTracker,e=>this.$t(e),e=>q.warning(e)))return;let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;if(!this.hasText(e.prompt)){q.error(this.$t(`openaiimage.message.promptRequired`));return}e.prompt=e.prompt.trim(),!t&&`image_urls`in e&&delete e.image_urls,e.size||delete e.size;let n={...e,action:`generate`,async:!0},r={action:`edit`,model:e?.model,prompt:e?.prompt,size:e?.size,image_urls:e?.image_urls||[],async:!0};if(!fe())return;let i=this.credential?.token;if(!i){console.error(`no token specified`);return}q.info(this.$t(`openaiimage.message.startingTask`)),K(`openaiimage`,t?H.edit(r,{token:i}):H.generate(n,{token:i})).then(e=>{console.debug(`task accepted`,e.data?.task_id),q.success(this.$t(`openaiimage.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?q.error(this.$t(`openaiimage.message.usedUp`)):q.error(this.$t(`openaiimage.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0}}});function en(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var tn=U($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,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-DqVvQzGq.js";import{t as x}from"./upload-Dysa20WI.js";import{t as S}from"./tooltip-DowzbA2H.js";import{t as C}from"./alert-BmDhbY4N.js";import{t as w}from"./drawer-BgpN40Ig.js";import{t as T}from"./input-number-COp7UOII.js";import{t as E}from"./switch-Co1BiZ5s.js";import{t as D}from"./box-CXHZJ19d.js";import{t as O}from"./clock-CTJncUP-.js";import{r as k,t as A}from"./PromptTextarea-BPhoRMVI.js";import{t as j}from"./image-BLa4-1L7.js";import{t as M}from"./info-L0HoT29_.js";import{t as N}from"./trash-2-DY-Xs8eB.js";import{t as P}from"./triangle-alert-DIl0w9Tt.js";import{t as F}from"./upload-C2q57sfz.js";import{t as I}from"./wand-sparkles-bgHAAYDe.js";import{t as ee}from"./zap-CQ29DxkU.js";import{Bn as L,Fn as R,Gn as te,Ln as ne,Mn as re,Nn as ie,Pn as ae,Rn as oe,Un as se,Vn as z,Wn as B,zn as V}from"./constants-Dm-HitpB.js";import{An as H,E as U,Gt as W,Kt as G,Sr as K,Ti as q,Ut as ce,Wt as le,Yt as ue,ci as J,di as de,in as fe,qt as pe,wi as me,zi as Y}from"./index-X4H_LD85.js";import{t as he}from"./CopyToClipboard-BMaxYkX6.js";import{t as X}from"./ImagePreview-Dzwq5j1p.js";import{n as ge}from"./taskDrawerMixin-DyAUhFEq.js";import{t as _e}from"./Consumption-DL0zm78X.js";import{a as Z,n as ve,r as ye,t as be}from"./pagination-DpHxEI-k.js";import{t as xe}from"./ApiCodeButton-C_DtLteh.js";import{t as Se}from"./BotPlaceholder-miO90qGo.js";import{t as Ce}from"./ImageWrapper-B6kHPphW.js";var we=_({name:`LayoutNanobanana`,components:{MagicIcon:I,ElDrawer:w,ElButton:Y},mixins:[ge]}),Te={class:`main flex flex-row flex-1`},Ee={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)]`},De={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Oe(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,Te,[e(`div`,Ee,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,De,[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 ke=U(we,[[`render`,Oe],[`__scopeId`,`data-v-fa2172a6`]]),Ae=_({name:`PromptInput`,components:{PromptTextarea:A},computed:{prompt:{get(){return this.$store.state.openaiimage?.config?.prompt},set(e){this.$store.commit(`openaiimage/setConfig`,{...this.$store.state.openaiimage?.config,prompt:e})}}},mounted(){this.prompt||=``}});function je(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(`openaiimage.name.prompt`),info:e.$t(`openaiimage.description.prompt`),placeholder:e.$t(`openaiimage.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Me=U(Ae,[[`render`,je]]),Ne=_({name:`ImageUrlsInput`,components:{UploadIcon:F,ElUpload:x,ElButton:Y,InfoIcon:Z,ImagePreview:X},mixins:[pe,G,le],data(){return{fileList:[],uploadUrl:de()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.openaiimage?.config?.image_urls}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},mounted(){},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImageUrls()},onExceed(){q.warning(this.$t(`openaiimage.message.uploadImageExceed`))},onError(){q.error(this.$t(`openaiimage.message.uploadImageError`))},onSetImageUrls(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`openaiimage/setConfig`,{...this.$store.state.openaiimage?.config,image_urls:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImageUrls()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImageUrls()}}}),Pe={class:`field flex min-h-8 w-full items-center justify-between gap-3`},Fe={class:`flex min-w-0 items-center`},Ie={class:`title m-0 text-[14px] font-bold`},Le={class:`file-list flex flex-wrap gap-[10px]`};function Re(t,n,o,u,d,g){let _=l(`info-icon`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`image-preview`);return h(),s(`div`,null,[e(`div`,Pe,[e(`div`,Fe,[e(`h2`,Ie,i(t.$t(`openaiimage.name.imageUrls`)),1),a(_,{content:t.$t(`openaiimage.description.imageUrls`)},null,8,[`content`])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value shrink-0`,limit:5,multiple:!0,"show-file-list":!1,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(`openaiimage.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,Le,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),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 ze=U(Ne,[[`render`,Re]]),Be=_({name:`OpenAIImageModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[{value:ne,label:this.$t(`openaiimage.model.gptImage1`)},{value:oe,label:this.$t(`openaiimage.model.gptImage15`)},{value:V,label:this.$t(`openaiimage.model.gptImage2`)},{value:L,label:this.$t(`openaiimage.model.gptImage2Official`)}]}},computed:{value:{get(){return this.$store.state.openaiimage?.config?.model},set(e){this.$store.commit(`openaiimage/setConfig`,{...this.$store.state.openaiimage?.config,model:e})}},modelDescription(){return this.$t(`openaiimage.description.model`)}},mounted(){this.value||=R}}),Ve={class:`field`},He={class:`label`},Ue={class:`box`},We={class:`title font-bold`};function Ge(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Ve,[e(`div`,He,[e(`div`,Ue,[e(`h2`,We,i(t.$t(`openaiimage.name.model`)),1),a(g,{content:t.modelDescription,class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`openaiimage.placeholder.select`)},{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,[`modelValue`,`placeholder`])])}var Ke=U(Be,[[`render`,Ge],[`__scopeId`,`data-v-a42acad4`]]);function Q(e){if(!e)return;let t=/^(\d+)x(\d+)$/.exec(e);if(t)return{w:Number(t[1]),h:Number(t[2])}}var qe=_({name:`OpenAIImageSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,ElSwitch:E,ElInputNumber:T,InfoIcon:Z},data(){return{customMode:!1,customWidth:1024,customHeight:1024}},computed:{model(){return this.$store.state.openaiimage?.config?.model||`gpt-image-2`},storedSize(){return this.$store.state.openaiimage?.config?.size},emptySizeValue(){return``},customSupported(){return ae.includes(this.model)},presets(){return z[this.model]??z[`gpt-image-2`]??[]},presetGroups(){return this.model===`gpt-image-2`||this.model===`gpt-image-2:official`?[{label:this.$t(`openaiimage.sizeGroup.standard1k`),options:se},{label:this.$t(`openaiimage.sizeGroup.preset2k`),options:B},{label:this.$t(`openaiimage.sizeGroup.preset4k`),options:te}]:[{label:this.$t(`openaiimage.sizeGroup.standard1k`),options:this.presets}]},useCustom:{get(){return this.customSupported&&this.customMode},set(e){if(!(e&&!this.customSupported))if(this.customMode=e,e){if(this.customError)return;this.commitSize(`${this.customWidth}x${this.customHeight}`)}else this.commitSize()}},presetValue:{get(){let e=this.storedSize;return e&&this.presets.includes(e)?e:this.emptySizeValue},set(e){this.customMode=!1,this.commitSize(e||void 0)}},multiple(){return 16},minSide(){return 256},maxSide(){return re},customError(){let e=this.customWidth,t=this.customHeight;return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?this.$t(`openaiimage.error.customSizePositive`):e%this.multiple!==0||t%this.multiple!==0?this.$t(`openaiimage.error.customSizeMultiple`,{multiple:this.multiple}):e<this.minSide||t<this.minSide?this.$t(`openaiimage.error.customSizeMin`,{min:this.minSide}):Math.max(e,t)>this.maxSide?this.$t(`openaiimage.error.customSizeMax`,{max:this.maxSide}):e*t>8294400?this.$t(`openaiimage.error.customSizePixels`,{pixels:ie.toLocaleString()}):``}},watch:{model:{immediate:!1,handler(){this.customSupported||(this.customMode=!1);let e=this.storedSize;if(!e||this.presets.includes(e))return;let t=Q(e);t&&this.customSupported&&(this.customMode=!0,this.customWidth=t.w,this.customHeight=t.h,!this.customError)||this.commitSize()}},storedSize(e){if(!e){this.customMode=!1;return}if(this.presets.includes(e)){this.customMode=!1;return}let t=Q(e);t&&this.customSupported&&(this.customMode=!0,this.customWidth!==t.w&&(this.customWidth=t.w),this.customHeight!==t.h&&(this.customHeight=t.h))},customWidth(){this.syncCustomToStore()},customHeight(){this.syncCustomToStore()}},mounted(){let e=this.storedSize,t=Q(e);e&&t&&this.customSupported&&!this.presets.includes(e)&&(this.customMode=!0,this.customWidth=t.w,this.customHeight=t.h)},methods:{commitSize(e){let t={...this.$store.state.openaiimage?.config};e?t.size=e:delete t.size,this.$store.commit(`openaiimage/setConfig`,t)},syncCustomToStore(){this.useCustom&&(this.customError||this.commitSize(`${this.customWidth}x${this.customHeight}`))}}}),Je={class:`resolution`},Ye={class:`field`},Xe={class:`label`},Ze={class:`box`},Qe={class:`title font-bold`},$e={class:`field custom-toggle`},et={class:`label`},tt={class:`box`},nt={class:`title font-bold`},rt={key:0,class:`custom-inputs`},it={class:`row`},at={class:`row-label`},ot={class:`row`},st={class:`row-label`},ct={key:0,class:`error`};function lt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`),x=l(`el-switch`),S=l(`el-input-number`);return h(),s(`div`,Je,[e(`div`,Ye,[e(`div`,Xe,[e(`div`,Ze,[e(`h2`,Qe,i(t.$t(`openaiimage.name.size`)),1),a(_,{content:t.$t(`openaiimage.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.presetValue,"onUpdate:modelValue":n[0]||=e=>t.presetValue=e,class:`value`,placeholder:t.$t(`openaiimage.placeholder.select`),disabled:t.useCustom},{default:p(()=>[a(v,{label:t.$t(`suno.gender.auto`),value:t.emptySizeValue},null,8,[`label`,`value`]),(h(!0),s(c,null,m(t.presetGroups,e=>(h(),f(y,{key:e.label,label:e.label},{default:p(()=>[(h(!0),s(c,null,m(e.options,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:2},1032,[`label`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`])]),t.customSupported?(h(),s(c,{key:0},[e(`div`,$e,[e(`div`,et,[e(`div`,tt,[e(`h2`,nt,i(t.$t(`openaiimage.name.customSize`)),1),a(_,{content:t.$t(`openaiimage.description.customSize`),class:`info`},null,8,[`content`])])]),a(x,{modelValue:t.useCustom,"onUpdate:modelValue":n[1]||=e=>t.useCustom=e,class:`value-switch`},null,8,[`modelValue`])]),t.useCustom?(h(),s(`div`,rt,[e(`div`,it,[e(`span`,at,i(t.$t(`openaiimage.name.width`)),1),a(S,{modelValue:t.customWidth,"onUpdate:modelValue":n[2]||=e=>t.customWidth=e,class:`row-input`,min:t.minSide,max:t.maxSide,step:t.multiple,"step-strictly":!0,"controls-position":`right`},null,8,[`modelValue`,`min`,`max`,`step`])]),e(`div`,ot,[e(`span`,st,i(t.$t(`openaiimage.name.height`)),1),a(S,{modelValue:t.customHeight,"onUpdate:modelValue":n[3]||=e=>t.customHeight=e,class:`row-input`,min:t.minSide,max:t.maxSide,step:t.multiple,"step-strictly":!0,"controls-position":`right`},null,8,[`modelValue`,`min`,`max`,`step`])]),t.customError?(h(),s(`div`,ct,i(t.customError),1)):o(``,!0)])):o(``,!0)],64)):o(``,!0)])}var ut=_({name:`ConfigPanel`,components:{MagicIcon:I,ElButton:Y,PromptInput:Me,Consumption:_e,ImageUrlsInput:ze,ModelSelector:Ke,ResolutionSelector:U(qe,[[`render`,lt],[`__scopeId`,`data-v-dfce4922`]])},emits:[`generate`],computed:{config(){return this.$store.state.openaiimage?.config},consumption(){return ue({...this.config||{}},this.service?.cost)},service(){return this.$store.state.openaiimage?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),dt={class:`flex flex-col h-full`},ft={class:`flex-1 overflow-y-auto p-5`},pt={class:`flex flex-col items-center justify-center px-5 pb-5`};function mt(t,n,o,c,u,d){let f=l(`model-selector`),m=l(`resolution-selector`),g=l(`prompt-input`),_=l(`image-urls-input`),v=l(`consumption`),y=l(`magic-icon`),b=l(`el-button`);return h(),s(`div`,dt,[e(`div`,ft,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(g,{class:`mb-4`}),a(_,{class:`mb-4`})]),e(`div`,pt,[a(v,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(b,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(y,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`openaiimage.button.generate`)),1)]),_:1},8,[`onClick`])])])}var ht=U(ut,[[`render`,mt]]),gt=_({name:`TaskPreview`,components:{ApplicationIcon:D,ChannelIcon:k,DeleteIcon:N,ImageIcon:j,InfoIcon:M,LightningIcon:ee,MagicIcon:I,TimeIcon:O,WarningIcon:P,CopyToClipboard:he,ElAlert:C,ImageWrapper:Ce,ElButton:Y,ElTooltip:S,ImagePreview:X,ApiCodeButton:xe},props:{modelValue:{type:Object,required:!0}},computed:{isEditRequest(){let e=this.modelValue?.request;return this.modelValue?.type===`images_edits`||e?.action===`edit`||this.referenceImages.length>0},showTaskType(){return!!(this.modelValue?.request?.action||this.modelValue?.type||this.referenceImages.length>0)},taskTypeLabel(){return this.isEditRequest?this.$t(`openaiimage.name.edits`):this.$t(`openaiimage.name.generate`)},openaiimagePath(){return this.isEditRequest?`/openai/images/edits`:`/openai/images/generations`},openaiimageCodeBody(){let e=this.modelValue?.request;if(!e)return;let t={...e};if(delete t.action,delete t.callback_url,this.isEditRequest){delete t.image_urls,delete t.image;let e=this.referenceImages;e.length===1?t.image=e[0]:e.length>1&&(t.image=e)}else delete t.image_urls,delete t.image;return t},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{let n=t;if(n?.image_url||n?.url){e.push(n);return}n?.b64_json&&e.push({...n,url:`data:image/png;base64,${n.b64_json}`})}),e},referenceImages(){let e=this.modelValue?.request;if(!e)return[];let t=Array.isArray(e.image_urls)?e.image_urls:[];if(t.length>0)return t.filter(e=>typeof e==`string`&&e.length>0);let n=e.image;return Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.length>0):typeof n==`string`&&n.length>0?[n]:Array.isArray(e.images)?e.images.map(e=>{if(typeof e==`string`)return e;if(e&&typeof e==`object`)return e.image_url}).filter(e=>typeof e==`string`&&e.length>0):[]}},methods:{onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.openaiimage?.config||{}};t.image_urls=[e],this.$store.commit(`openaiimage/setConfig`,t)},async onDelete(){let e=this.modelValue?.id;if(e){try{await me.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(`openaiimage/deleteTask`,{id:e}),q.success(this.$t(`common.message.deleteTaskSuccess`))}catch{q.error(this.$t(`common.message.deleteTaskFailed`))}}}}}),_t={class:`preview`},vt={class:`left`},yt={class:`main`},bt={class:`bot`},xt={class:`datetime`},St=[`aria-label`],Ct={class:`info`},wt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Tt={key:1,class:`prompt mt-2`},Et={key:0},Dt={key:0,class:n({content:!0,failed:!0})},Ot={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},kt={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},At={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},It={key:1,class:n({content:!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:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Bt={class:`text-[var(--el-text-color-regular)] text-xs mb-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-2`},Ht={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ut={key:2,class:n({content:!0})},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-2`},Kt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`};function Jt(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-preview`),C=l(`image-wrapper`),w=l(`el-button`),T=l(`api-code-button`),E=l(`application-icon`),D=l(`image-icon`),O=l(`lightning-icon`),k=l(`magic-icon`),A=l(`copy-to-clipboard`),j=l(`time-icon`),M=l(`channel-icon`),N=l(`el-alert`),P=l(`warning-icon`),F=l(`info-icon`);return h(),s(`div`,_t,[e(`div`,vt,[a(y,{capability:`openaiimage`,part:`avatar`,class:`avatar`})]),e(`div`,yt,[e(`div`,bt,[a(y,{capability:`openaiimage`,part:`name`}),e(`span`,xt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default: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,St)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Ct,[n.referenceImages.length>0?(h(),s(`div`,wt,[(h(!0),s(c,null,m(n.referenceImages,(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`,Tt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,Et,` - (`+i(n.$t(`openaiimage.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,Dt,[e(`div`,Ot,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(C,{key:t,src:e?.image_url||e?.url||``,"raw-src":e?.image_url||e?.url||``},null,8,[`src`,`raw-src`]))),128))]),e(`div`,kt,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(w,{type:`info`,size:`small`,class:`btn-action`,onClick:u[1]||=t(e=>n.onEdit(n.images?.[0]?.image_url||n.images?.[0]?.url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(T,{path:n.openaiimagePath,body:n.openaiimageCodeBody},null,8,[`path`,`body`])]),a(N,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,At,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,jt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),n.showTaskType?(h(),s(`p`,Mt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.task`))+`: `+i(n.taskTypeLabel),1)])):o(``,!0),e(`p`,Nt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Pt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,Ft,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(A,{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`,It,[a(N,{closable:!1,class:`failure`},{template:p(()=>[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.failure`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,Lt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,Rt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),n.showTaskType?(h(),s(`p`,zt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.task`))+`: `+i(n.taskTypeLabel),1)])):o(``,!0),e(`p`,Bt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,$,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(A,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Vt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,Ht,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(A,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,Ut,[a(N,{closable:!1,class:`info`},{template:p(()=>[n.modelValue?.response?(h(),f(F,{key:1,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):(h(),f(j,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),r(` `+i(n.$t(n.modelValue?.response?`openaiimage.name.status`:`openaiimage.status.pending`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,Wt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,Gt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),n.showTaskType?(h(),s(`p`,Kt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.task`))+`: `+i(n.taskTypeLabel),1)])):o(``,!0),e(`p`,qt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})]))])])}var Yt=_({name:`RecentPanel`,components:{TaskPreview:U(gt,[[`render`,Jt],[`__scopeId`,`data-v-de37fde1`]]),BotPlaceholder:Se,NoTasks:ye,ScrollList:ve},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.openaiimage?.tasks,items:this.$store.state.openaiimage?.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`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Xt,[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`,Zt,[a(v)])):o(``,!0)],64)}var $t=_({name:`OpenAIImageIndex`,components:{ConfigPanel:ht,Layout:ke,RecentPanel:U(Yt,[[`render`,Qt]])},mixins:[W],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.openaiimage?.status?.getApplications===J.Request},tasksLoading(){return this.$store.state.openaiimage?.status?.getTasks===J.Request},credential(){return this.$store.state.openaiimage?.credential},config(){return this.$store.state.openaiimage?.config},application(){return this.$store.state.openaiimage?.application},tasks(){return this.$store.state.openaiimage?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await be({tasks:this.tasks,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(`openaiimage/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`openaiimage/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(`openaiimage/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!ce(this.uploadTracker,e=>this.$t(e),e=>q.warning(e)))return;let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;if(!this.hasText(e.prompt)){q.error(this.$t(`openaiimage.message.promptRequired`));return}e.prompt=e.prompt.trim(),!t&&`image_urls`in e&&delete e.image_urls,e.size||delete e.size;let n={...e,action:`generate`,async:!0},r={action:`edit`,model:e?.model,prompt:e?.prompt,size:e?.size,image_urls:e?.image_urls||[],async:!0};if(!fe())return;let i=this.credential?.token;if(!i){console.error(`no token specified`);return}q.info(this.$t(`openaiimage.message.startingTask`)),K(`openaiimage`,t?H.edit(r,{token:i}):H.generate(n,{token:i})).then(e=>{console.debug(`task accepted`,e.data?.task_id),q.success(this.$t(`openaiimage.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?q.error(this.$t(`openaiimage.message.usedUp`)):q.error(this.$t(`openaiimage.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0}}});function en(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var tn=U($t,[[`render`,en]]);export{tn as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,at as o,j as s,mt as c,tt as l,z as u}from"./vendor-chart-Dw-P17PN.js";import{n as d,t as f}from"./table-TGYHw4HJ.js";import{t as ee}from"./tooltip-DQRB5WQe.js";import{t as p}from"./card-D-4S-l7a.js";import{n as m,t as h}from"./row-CJFGEaUu.js";import{t as g}from"./divider-BNWJAaA2.js";import{t as _}from"./progress-bSUZvkfj.js";import{t as v}from"./skeleton-B3LIGUiE.js";import{t as y}from"./coins-BufMrWPi.js";import{t as b}from"./link-vzT89AJs.js";import{t as x}from"./user-BkFnDeCc.js";import{t as S}from"./wallet-tXZJhZb4.js";import{Ci as C,E as w,Q as T,Rt as E,Xt as D,et as O,ln as k,mr as A,nr as j,rr as M,tr as N,zi as P}from"./index-CX5tT44B.js";import{t as F}from"./CopyToClipboard-DTo9jexV.js";var I=u({name:`ConsoleDistributionList`,components:{CreditsIcon:y,LinkIcon:b,PercentIcon:C(`percent`,[[`line`,{x1:`19`,x2:`5`,y1:`5`,y2:`19`,key:`1x9vlm`}],[`circle`,{cx:`6.5`,cy:`6.5`,r:`2.5`,key:`4mh3h7`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`2.5`,key:`1mdrzq`}]]),UserIcon:x,WalletIcon:S,CopyToClipboard:F,QrCode:E,ElProgress:_,ElRow:h,ElCol:m,ElButton:P,ElDivider:g,ElCard:p,ElTooltip:ee,ElTable:f,ElTableColumn:d,ElSkeleton:v},data(){return{invitees:[],inviteesCount:void 0,distributionLevels:[],distributionLink:void 0,distributionStatus:void 0,loading:!1}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)},qrColor(){let e=document.documentElement.classList.contains(`dark`);return{dark:e?`#ffffff`:`#000000`,light:e?`#1e1e1e`:`#ffffff`}},distributionLevelMap(){let e={};return this.distributionLevels.forEach(t=>{e[t.level]=t}),e}},watch:{page:{handler(){this.onFetchData()}}},async mounted(){this.onFetchData(),this.onGenerateDistributionLink()},methods:{getPriceString:D,goHistory(){this.$router.push({name:T})},goInvitees(){this.$router.push({name:O})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{page:e}})},getPercentageForNextLevel(){let e=this.distributionLevelMap[this.distributionStatus?.level?.level]?.threshold,t=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor((this.distributionStatus?.price-e)/(t-e)*100)},getDeltaForNextLevel(){let e=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor(e-this.distributionStatus?.price)},async onFetchData(){this.loading=!0,await j.initialize(),Promise.all([this.onFetchDistributionStatus(),this.onFetchDistributionLevels(),this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onGenerateDistributionLink(){let e=`${window.location.origin}?inviter_id=${this.$store.getters.user.id}`;try{let t=(await M.create(e))?.data?.data?.url||e;this.distributionLink=k()?t.replace(`surl.id`,`share.acedata.cloud`):t}catch{this.distributionLink=e}},async onFetchDistributionStatus(){let{data:e}=await j.getAll({user_id:this.$store.getters.user.id});e.items&&e.items.length>0&&(this.distributionStatus=e.items[0])},async onFetchDistributionLevels(){let{data:e}=await N.getAll({limit:20,user_id:this.$store.getters.user.id});this.distributionLevels=e.items},async onFetchInvitees(){let{data:e}=await A.getInvitees({});this.invitees=e.items,this.inviteesCount=e.count}}}),L={class:`title`},R={key:1},z={class:`icon-wrapper`},B={class:`text-left`},V={class:`description`},H={class:`value`},U={key:1},W={class:`icon-wrapper`},G={class:`text-left`},K={class:`description`},q={class:`value`},J={key:1},Y={class:`icon-wrapper`},X={class:`text-left`},Z={class:`description`},te={class:`value`},Q={key:1},ne={class:`icon-wrapper`},re={class:`text-left`},ie={class:`description`},ae={class:`value`},oe={key:1},se={class:`title`},ce={class:`clear-both overflow-hidden`},le={class:`float-left description`},ue={class:`float-right description`},de={class:`description`},fe={class:`level`},pe={class:`level`},$={class:`level`},me={key:1},he={class:`title`},ge={class:`link-wrapper text-center`},_e=[`href`],ve={class:`qr-wrapper ml-auto mr-auto`},ye={class:`mt-0`},be={class:`description`},xe={class:`more`};function Se(u,d,f,ee,p,m){let h=o(`el-col`),g=o(`el-row`),_=o(`el-skeleton`),v=o(`wallet-icon`),y=o(`el-button`),b=o(`el-card`),x=o(`credits-icon`),S=o(`el-tooltip`),C=o(`percent-icon`),w=o(`user-icon`),T=o(`el-progress`),E=o(`el-divider`),D=o(`el-table-column`),O=o(`el-table`);o(`link-icon`);let k=o(`copy-to-clipboard`),A=o(`qr-code`);return l(),s(g,{class:`panel`},{default:c(()=>[r(h,{span:24},{default:c(()=>[r(g,null,{default:c(()=>[r(h,{span:24},{default:c(()=>[e(`h2`,L,n(u.$t(`common.title.distribution`)),1)]),_:1})]),_:1}),r(g,{gutter:15},{default:c(()=>[r(h,{md:6,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`item-mini mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,R,[e(`div`,z,[r(v,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`div`,B,[e(`p`,V,n(u.$t(`distribution.title.price`)),1),e(`p`,H,n(u.getPriceString({value:u.distributionStatus?.price})),1)]),r(y,{type:`primary`,round:``,size:`small`,class:`btn`,onClick:u.goHistory},{default:c(()=>[t(n(u.$t(`distribution.button.detail`)),1)]),_:1},8,[`onClick`])]))]),_:1})]),_:1}),r(h,{md:6,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`item-mini mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,U,[e(`div`,W,[r(x,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`div`,G,[e(`p`,K,n(u.$t(`distribution.title.reward`)),1),e(`p`,q,n(u.getPriceString({value:u.distributionStatus?.reward})),1)]),r(S,{effect:`dark`,content:u.$t(`distribution.message.developingWithDrawal`),placement:`top`},{default:c(()=>[r(y,{type:`primary`,round:``,size:`small`,class:`btn`},{default:c(()=>[t(n(u.$t(`distribution.button.withdrawal`)),1)]),_:1})]),_:1},8,[`content`])]))]),_:1})]),_:1}),r(h,{md:6,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`item-mini mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,J,[e(`div`,Y,[r(C,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`div`,X,[e(`p`,Z,n(u.$t(`distribution.title.percentage`)),1),e(`p`,te,n(u.distributionStatus?.level?.percentage)+`%`,1)])]))]),_:1})]),_:1}),r(h,{md:6,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`item-mini mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,Q,[e(`div`,ne,[r(w,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`div`,re,[e(`p`,ie,n(u.$t(`distribution.title.inviteesCount`)),1),e(`p`,ae,n(u.inviteesCount),1)]),r(y,{type:`primary`,round:``,size:`small`,class:`btn`,onClick:u.goInvitees},{default:c(()=>[t(n(u.$t(`distribution.button.detail`)),1)]),_:1},8,[`onClick`])]))]),_:1})]),_:1})]),_:1}),r(g,{gutter:15},{default:c(()=>[r(h,{md:12,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`level-info mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,oe,[e(`h4`,se,n(u.$t(`distribution.title.levelInfo`)),1),e(`div`,ce,[e(`div`,le,[e(`p`,null,n(u.$t(`distribution.title.currentLevel`))+`: L`+n(u.distributionStatus?.level?.level),1),e(`p`,null,n(u.$t(`distribution.title.currentPercentage`))+`: `+n(u.distributionLevelMap[u.distributionStatus?.level?.level]?.percentage)+`% `,1)]),e(`div`,ue,[e(`p`,null,n(u.$t(`distribution.title.nextLevel`))+`: L`+n(u.distributionStatus?.level?.level+1),1),e(`p`,null,n(u.$t(`distribution.title.nextPercentage`))+`: `+n(u.distributionLevelMap[u.distributionStatus?.level?.level+1]?.percentage)+`% `,1)])]),r(T,{"text-inside":!0,"stroke-width":20,percentage:u.getPercentageForNextLevel(),class:`mb-2`},null,8,[`percentage`]),e(`p`,de,n(u.$t(`distribution.message.deltaPriceForNextLevel`))+`: $`+n(u.getDeltaForNextLevel()),1),r(E),u.distributionLevels?(l(),s(O,{key:0,data:u.distributionLevels,stripe:``},{default:c(()=>[r(D,{label:u.$t(`distribution.field.level`)},{default:c(t=>[e(`span`,fe,`L`+n(t.row?.level),1)]),_:1},8,[`label`]),r(D,{label:u.$t(`distribution.field.threshold`)},{default:c(t=>[e(`span`,pe,`$`+n(t.row?.threshold),1)]),_:1},8,[`label`]),r(D,{label:u.$t(`distribution.field.percentage`)},{default:c(t=>[e(`span`,$,n(t.row?.percentage)+`%`,1)]),_:1},8,[`label`])]),_:1},8,[`data`])):i(``,!0)]))]),_:1})]),_:1}),r(h,{md:12,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`distribution-info mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,me,[e(`h4`,he,n(u.$t(`distribution.title.distributionLink`)),1),r(E),e(`div`,ge,[i(``,!0),e(`a`,{href:u.distributionLink,class:`link`},n(u.distributionLink),9,_e),r(k,{content:u.distributionLink},null,8,[`content`])]),e(`div`,ve,[u.distributionLink?(l(),s(A,{key:0,value:u.distributionLink,size:180,margin:2,class:`block mb-2 ml-auto mr-auto`,type:`image/png`,color:u.qrColor},null,8,[`value`,`color`])):i(``,!0),e(`p`,ye,n(u.$t(`distribution.message.distributionQrDescription`)),1)]),e(`p`,be,[t(n(u.$t(`distribution.message.distributionLinkDescription`))+` `,1),e(`span`,xe,[r(S,{effect:`dark`,content:u.$t(`distribution.message.distributionLinkDescription2`),placement:`top`},{default:c(()=>[t(n(u.$t(`distribution.message.technicalDetail`)),1)]),_:1},8,[`content`])])])]))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}var Ce=w(I,[[`render`,Se],[`__scopeId`,`data-v-3657f823`]]);export{Ce as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,at as o,j as s,mt as c,tt as l,z as u}from"./vendor-chart-Dw-P17PN.js";import{n as d,t as f}from"./table-BJBYrivw.js";import{t as ee}from"./tooltip-DowzbA2H.js";import{t as p}from"./card-D-4S-l7a.js";import{n as m,t as h}from"./row-B5owDjio.js";import{t as g}from"./divider-BNWJAaA2.js";import{t as _}from"./progress-bSUZvkfj.js";import{t as v}from"./skeleton-B3LIGUiE.js";import{t as y}from"./coins-Ccai4H-a.js";import{t as b}from"./link-CclstGdq.js";import{t as x}from"./user-DC1cJhr8.js";import{t as S}from"./wallet-DkDB80A7.js";import{Ci as C,E as w,Q as T,Rt as E,Xt as D,et as O,ln as k,mr as A,nr as j,rr as M,tr as N,zi as P}from"./index-X4H_LD85.js";import{t as F}from"./CopyToClipboard-BMaxYkX6.js";var I=u({name:`ConsoleDistributionList`,components:{CreditsIcon:y,LinkIcon:b,PercentIcon:C(`percent`,[[`line`,{x1:`19`,x2:`5`,y1:`5`,y2:`19`,key:`1x9vlm`}],[`circle`,{cx:`6.5`,cy:`6.5`,r:`2.5`,key:`4mh3h7`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`2.5`,key:`1mdrzq`}]]),UserIcon:x,WalletIcon:S,CopyToClipboard:F,QrCode:E,ElProgress:_,ElRow:h,ElCol:m,ElButton:P,ElDivider:g,ElCard:p,ElTooltip:ee,ElTable:f,ElTableColumn:d,ElSkeleton:v},data(){return{invitees:[],inviteesCount:void 0,distributionLevels:[],distributionLink:void 0,distributionStatus:void 0,loading:!1}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)},qrColor(){let e=document.documentElement.classList.contains(`dark`);return{dark:e?`#ffffff`:`#000000`,light:e?`#1e1e1e`:`#ffffff`}},distributionLevelMap(){let e={};return this.distributionLevels.forEach(t=>{e[t.level]=t}),e}},watch:{page:{handler(){this.onFetchData()}}},async mounted(){this.onFetchData(),this.onGenerateDistributionLink()},methods:{getPriceString:D,goHistory(){this.$router.push({name:T})},goInvitees(){this.$router.push({name:O})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{page:e}})},getPercentageForNextLevel(){let e=this.distributionLevelMap[this.distributionStatus?.level?.level]?.threshold,t=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor((this.distributionStatus?.price-e)/(t-e)*100)},getDeltaForNextLevel(){let e=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor(e-this.distributionStatus?.price)},async onFetchData(){this.loading=!0,await j.initialize(),Promise.all([this.onFetchDistributionStatus(),this.onFetchDistributionLevels(),this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onGenerateDistributionLink(){let e=`${window.location.origin}?inviter_id=${this.$store.getters.user.id}`;try{let t=(await M.create(e))?.data?.data?.url||e;this.distributionLink=k()?t.replace(`surl.id`,`share.acedata.cloud`):t}catch{this.distributionLink=e}},async onFetchDistributionStatus(){let{data:e}=await j.getAll({user_id:this.$store.getters.user.id});e.items&&e.items.length>0&&(this.distributionStatus=e.items[0])},async onFetchDistributionLevels(){let{data:e}=await N.getAll({limit:20,user_id:this.$store.getters.user.id});this.distributionLevels=e.items},async onFetchInvitees(){let{data:e}=await A.getInvitees({});this.invitees=e.items,this.inviteesCount=e.count}}}),L={class:`title`},R={key:1},z={class:`icon-wrapper`},B={class:`text-left`},V={class:`description`},H={class:`value`},U={key:1},W={class:`icon-wrapper`},G={class:`text-left`},K={class:`description`},q={class:`value`},J={key:1},Y={class:`icon-wrapper`},X={class:`text-left`},Z={class:`description`},te={class:`value`},Q={key:1},ne={class:`icon-wrapper`},re={class:`text-left`},ie={class:`description`},ae={class:`value`},oe={key:1},se={class:`title`},ce={class:`clear-both overflow-hidden`},le={class:`float-left description`},ue={class:`float-right description`},de={class:`description`},fe={class:`level`},pe={class:`level`},$={class:`level`},me={key:1},he={class:`title`},ge={class:`link-wrapper text-center`},_e=[`href`],ve={class:`qr-wrapper ml-auto mr-auto`},ye={class:`mt-0`},be={class:`description`},xe={class:`more`};function Se(u,d,f,ee,p,m){let h=o(`el-col`),g=o(`el-row`),_=o(`el-skeleton`),v=o(`wallet-icon`),y=o(`el-button`),b=o(`el-card`),x=o(`credits-icon`),S=o(`el-tooltip`),C=o(`percent-icon`),w=o(`user-icon`),T=o(`el-progress`),E=o(`el-divider`),D=o(`el-table-column`),O=o(`el-table`);o(`link-icon`);let k=o(`copy-to-clipboard`),A=o(`qr-code`);return l(),s(g,{class:`panel`},{default:c(()=>[r(h,{span:24},{default:c(()=>[r(g,null,{default:c(()=>[r(h,{span:24},{default:c(()=>[e(`h2`,L,n(u.$t(`common.title.distribution`)),1)]),_:1})]),_:1}),r(g,{gutter:15},{default:c(()=>[r(h,{md:6,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`item-mini mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,R,[e(`div`,z,[r(v,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`div`,B,[e(`p`,V,n(u.$t(`distribution.title.price`)),1),e(`p`,H,n(u.getPriceString({value:u.distributionStatus?.price})),1)]),r(y,{type:`primary`,round:``,size:`small`,class:`btn`,onClick:u.goHistory},{default:c(()=>[t(n(u.$t(`distribution.button.detail`)),1)]),_:1},8,[`onClick`])]))]),_:1})]),_:1}),r(h,{md:6,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`item-mini mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,U,[e(`div`,W,[r(x,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`div`,G,[e(`p`,K,n(u.$t(`distribution.title.reward`)),1),e(`p`,q,n(u.getPriceString({value:u.distributionStatus?.reward})),1)]),r(S,{effect:`dark`,content:u.$t(`distribution.message.developingWithDrawal`),placement:`top`},{default:c(()=>[r(y,{type:`primary`,round:``,size:`small`,class:`btn`},{default:c(()=>[t(n(u.$t(`distribution.button.withdrawal`)),1)]),_:1})]),_:1},8,[`content`])]))]),_:1})]),_:1}),r(h,{md:6,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`item-mini mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,J,[e(`div`,Y,[r(C,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`div`,X,[e(`p`,Z,n(u.$t(`distribution.title.percentage`)),1),e(`p`,te,n(u.distributionStatus?.level?.percentage)+`%`,1)])]))]),_:1})]),_:1}),r(h,{md:6,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`item-mini mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,Q,[e(`div`,ne,[r(w,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`div`,re,[e(`p`,ie,n(u.$t(`distribution.title.inviteesCount`)),1),e(`p`,ae,n(u.inviteesCount),1)]),r(y,{type:`primary`,round:``,size:`small`,class:`btn`,onClick:u.goInvitees},{default:c(()=>[t(n(u.$t(`distribution.button.detail`)),1)]),_:1},8,[`onClick`])]))]),_:1})]),_:1})]),_:1}),r(g,{gutter:15},{default:c(()=>[r(h,{md:12,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`level-info mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,oe,[e(`h4`,se,n(u.$t(`distribution.title.levelInfo`)),1),e(`div`,ce,[e(`div`,le,[e(`p`,null,n(u.$t(`distribution.title.currentLevel`))+`: L`+n(u.distributionStatus?.level?.level),1),e(`p`,null,n(u.$t(`distribution.title.currentPercentage`))+`: `+n(u.distributionLevelMap[u.distributionStatus?.level?.level]?.percentage)+`% `,1)]),e(`div`,ue,[e(`p`,null,n(u.$t(`distribution.title.nextLevel`))+`: L`+n(u.distributionStatus?.level?.level+1),1),e(`p`,null,n(u.$t(`distribution.title.nextPercentage`))+`: `+n(u.distributionLevelMap[u.distributionStatus?.level?.level+1]?.percentage)+`% `,1)])]),r(T,{"text-inside":!0,"stroke-width":20,percentage:u.getPercentageForNextLevel(),class:`mb-2`},null,8,[`percentage`]),e(`p`,de,n(u.$t(`distribution.message.deltaPriceForNextLevel`))+`: $`+n(u.getDeltaForNextLevel()),1),r(E),u.distributionLevels?(l(),s(O,{key:0,data:u.distributionLevels,stripe:``},{default:c(()=>[r(D,{label:u.$t(`distribution.field.level`)},{default:c(t=>[e(`span`,fe,`L`+n(t.row?.level),1)]),_:1},8,[`label`]),r(D,{label:u.$t(`distribution.field.threshold`)},{default:c(t=>[e(`span`,pe,`$`+n(t.row?.threshold),1)]),_:1},8,[`label`]),r(D,{label:u.$t(`distribution.field.percentage`)},{default:c(t=>[e(`span`,$,n(t.row?.percentage)+`%`,1)]),_:1},8,[`label`])]),_:1},8,[`data`])):i(``,!0)]))]),_:1})]),_:1}),r(h,{md:12,xs:24},{default:c(()=>[r(b,{shadow:`hover`,class:`distribution-info mb-4`},{default:c(()=>[u.loading?(l(),s(_,{key:0})):(l(),a(`div`,me,[e(`h4`,he,n(u.$t(`distribution.title.distributionLink`)),1),r(E),e(`div`,ge,[i(``,!0),e(`a`,{href:u.distributionLink,class:`link`},n(u.distributionLink),9,_e),r(k,{content:u.distributionLink},null,8,[`content`])]),e(`div`,ve,[u.distributionLink?(l(),s(A,{key:0,value:u.distributionLink,size:180,margin:2,class:`block mb-2 ml-auto mr-auto`,type:`image/png`,color:u.qrColor},null,8,[`value`,`color`])):i(``,!0),e(`p`,ye,n(u.$t(`distribution.message.distributionQrDescription`)),1)]),e(`p`,be,[t(n(u.$t(`distribution.message.distributionLinkDescription`))+` `,1),e(`span`,xe,[r(S,{effect:`dark`,content:u.$t(`distribution.message.distributionLinkDescription2`),placement:`top`},{default:c(()=>[t(n(u.$t(`distribution.message.technicalDetail`)),1)]),_:1},8,[`content`])])])]))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}var Ce=w(I,[[`render`,Se],[`__scopeId`,`data-v-3657f823`]]);export{Ce as default};