@acedatacloud/nexior 3.324.22 → 3.324.24
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.
- package/dist/assets/{ApiCodeButton-Damfiedy.js → ApiCodeButton-DTODAyG2.js} +1 -1
- package/dist/assets/{Artifacts-1DZpu4kM.js → Artifacts-Df7TMSbi.js} +1 -1
- package/dist/assets/{AskUserQuestionCard-CFOsuqAB.js → AskUserQuestionCard-GXoyYi8f.js} +1 -1
- package/dist/assets/{Auth-BBBnd-m1.js → Auth-6-LAbaCc.js} +1 -1
- package/dist/assets/{Bare-BXh5m5_I.js → Bare-D3WoPfL-.js} +1 -1
- package/dist/assets/{BotPlaceholder-ZqqbeNdM.js → BotPlaceholder-BxjZQnpl.js} +1 -1
- package/dist/assets/{BottomFooter-ruzEqFzM.js → BottomFooter-BB98nzio.js} +1 -1
- package/dist/assets/{Callback-OhNgKQvy.js → Callback-BmTBukx6.js} +1 -1
- package/dist/assets/{CodeSnippet-BLo_EryO.js → CodeSnippet-CNe9VoDW.js} +1 -1
- package/dist/assets/{Console-YTILg-4m.js → Console-CAE-gFeN.js} +1 -1
- package/dist/assets/{Consumption-D_LySLNy.js → Consumption-CYy4e1le.js} +1 -1
- package/dist/assets/{Conversation-BwGoISK2.js → Conversation-Cf4VNxFt.js} +1 -1
- package/dist/assets/{Conversation-C0dmZAZ3.js → Conversation-DkSlE_PN.js} +1 -1
- package/dist/assets/{CopyToClipboard-By5Vlmzk.js → CopyToClipboard-BxUQkbS4.js} +1 -1
- package/dist/assets/{Detail-xeb8gN-g.js → Detail-Dyi8qsLO.js} +2 -2
- package/dist/assets/{Extra-B2R0FnRk.css → Extra-BbDk53u2.css} +1 -1
- package/dist/assets/Extra-C1N5mhbZ.js +1 -0
- package/dist/assets/{FilePreview-C9aPkXSG.js → FilePreview-C37hwtNm.js} +1 -1
- package/dist/assets/{Hailuo-CYBxW3g9.js → Hailuo-D34VgelC.js} +1 -1
- package/dist/assets/{History-DjPoxWnF.js → History-CEpxMJOT.js} +1 -1
- package/dist/assets/History-Dkn2AgvP.css +1 -0
- package/dist/assets/{ImagePreview-DCYbrXDf.js → ImagePreview-BCZrB_sX.js} +1 -1
- package/dist/assets/{ImageWrapper-Cc_kTMCr.js → ImageWrapper-BlHjexof.js} +1 -1
- package/dist/assets/Index-4G6ZL9B3.js +1 -0
- package/dist/assets/{Index-DjsHGkZU.js → Index-5AxV822t.js} +1 -1
- package/dist/assets/{Index-Gd4rrJdu.js → Index-AUXz_0K9.js} +1 -1
- package/dist/assets/{Index-DyCkQHI3.js → Index-B050Id2E.js} +1 -1
- package/dist/assets/{Index-L-9REUWD.js → Index-B1kjw3Y8.js} +1 -1
- package/dist/assets/{Index-Db5RoK5g.js → Index-BJRhLExY.js} +1 -1
- package/dist/assets/{Index-DKq6pk5I.js → Index-BMZlFERo.js} +1 -1
- package/dist/assets/{Index-DOvBC5ls.js → Index-BXf2LVBF.js} +1 -1
- package/dist/assets/Index-BYnqTid-.js +1 -0
- package/dist/assets/Index-B__Wk2uD.js +1 -0
- package/dist/assets/{Index-BGC6Dtt2.js → Index-BfFW_lvU.js} +1 -1
- package/dist/assets/Index-BnC8WsP1.js +1 -0
- package/dist/assets/{Index-nY3-yH5t.js → Index-Br1XEANq.js} +1 -1
- package/dist/assets/{Index-CiMV2Skr.js → Index-BtzZfchK.js} +1 -1
- package/dist/assets/{Index-De8gD_7i.js → Index-BxExkVTh.js} +1 -1
- package/dist/assets/Index-CDdhPrAg.js +1 -0
- package/dist/assets/{Index-eTzEtNDn.js → Index-CFpyHMyH.js} +1 -1
- package/dist/assets/{Index-DNtl0QRZ.js → Index-C_Kjz1Ch.js} +1 -1
- package/dist/assets/{Index-BbrFoWYJ.js → Index-Chseowm3.js} +1 -1
- package/dist/assets/{Index-J3Gx8qxW.js → Index-Cw3QWhEo.js} +1 -1
- package/dist/assets/{Index-C42goTdC.js → Index-DIi8yPpW.js} +1 -1
- package/dist/assets/{Index-r1L2gcDK.js → Index-DO_H9CzY.js} +1 -1
- package/dist/assets/{Index-cFfnLDRo.js → Index-DunbH05G.js} +1 -1
- package/dist/assets/{Index-CaEJm4wh.js → Index-Dxm06_XH.js} +1 -1
- package/dist/assets/Index-TxIDd5WK.js +1 -0
- package/dist/assets/{Index-vyxdXktu.js → Index-fJzajLCV.js} +1 -1
- package/dist/assets/{Index-B8FZe0yk.js → Index-sVFofoKf.js} +2 -2
- package/dist/assets/{Index-BGMH18US.js → Index-tD68z8rk.js} +1 -1
- package/dist/assets/{Invitees-28IqP8U3.js → Invitees-CWW-_0GB.js} +1 -1
- package/dist/assets/Invitees-DXE80B4I.css +1 -0
- package/dist/assets/List-B_OxLGPC.css +1 -0
- package/dist/assets/List-BvQPliKP.css +1 -0
- package/dist/assets/List-CbM__pc5.js +1 -0
- package/dist/assets/{List-g44d60Lm.js → List-DyhIogsK.js} +1 -1
- package/dist/assets/List-UA9tp63W.js +1 -0
- package/dist/assets/List-XgponMNt.css +1 -0
- package/dist/assets/{LocalTools-Bcc8somD.js → LocalTools-96ApVLt3.js} +3 -3
- package/dist/assets/{LocalTools-DZp1P6wv.js → LocalTools-VtZQIpwV.js} +1 -1
- package/dist/assets/{Main-C2QJ_Tpx.js → Main-Bo2OKB-9.js} +1 -1
- package/dist/assets/{Message-B41GAfr5.js → Message-l-0OZ_iU.js} +2 -2
- package/dist/assets/Model-BqvnzQQb.js +1 -0
- package/dist/assets/Navigator-b0O38Nyi.js +5 -0
- package/dist/assets/{NoTasks-CBDPEOqn.js → NoTasks-NHnTSM5H.js} +1 -1
- package/dist/assets/{NotFound-wqrgj3Lw.js → NotFound-CwdRkgf9.js} +1 -1
- package/dist/assets/{Pay-wN_AN8Hq.js → Pay-CmfPFk7_.js} +1 -1
- package/dist/assets/{Player-CCKZy8x2.js → Player-Bpc219NN.js} +1 -1
- package/dist/assets/{PromptTextarea-BJHKwlQQ.js → PromptTextarea-D5c9w02b.js} +1 -1
- package/dist/assets/{RealtimeCall-5sfRtv0x.js → RealtimeCall-B5RW83SI.js} +1 -1
- package/dist/assets/ScheduledTasks-DwNvhgkz.js +2 -0
- package/dist/assets/ScheduledTasks-xPsbhIa2.css +1 -0
- package/dist/assets/{Status-Yp9N_Y9H.js → Status-BMj_5qXd.js} +1 -1
- package/dist/assets/Subscribe-DOCfGZRQ.js +1 -0
- package/dist/assets/Subscribe-n88aYwSj.css +1 -0
- package/dist/assets/{TabSwitcher-B1vD06Ii.js → TabSwitcher-B0iW9r-r.js} +1 -1
- package/dist/assets/{Tts-DC8baJwK.js → Tts-up4GZu-o.js} +1 -1
- package/dist/assets/{VideoPlayer-BEjp78dn.js → VideoPlayer-CkHFHCTB.js} +1 -1
- package/dist/assets/{VideoPreview-DpdN8ThZ.js → VideoPreview-BkUVfl_p.js} +1 -1
- package/dist/assets/{alert-CcCvkC2n.js → alert-CILdPemv.js} +1 -1
- package/dist/assets/{avatar-CDIn5FiC.js → avatar-BBKqiXop.js} +1 -1
- package/dist/assets/{basic-BPzyN70r.js → basic-C_VWdhce.js} +1 -1
- package/dist/assets/{chat-Bain_YfK.js → chat-ZCeOPuV9.js} +1 -1
- package/dist/assets/{codingBridge-xAXPoka4.js → codingBridge-DXLmUefV.js} +2 -2
- package/dist/assets/{codingBridgeNotify-B89KKtVJ.js → codingBridgeNotify-Bu9Y5F-k.js} +2 -2
- package/dist/assets/{collapse-BVWZ5QX_.js → collapse-D9YDP3FC.js} +1 -1
- package/dist/assets/{createTaskActions-B1JJZFtL.js → createTaskActions-BEi3KdzE.js} +1 -1
- package/dist/assets/{date-picker-B21RpeWL.js → date-picker-CKqlUjp0.js} +1 -1
- package/dist/assets/{digitalhuman-BB1HBIVI.js → digitalhuman-DVzDEiT5.js} +1 -1
- package/dist/assets/{drawer-BO9lkr2a.js → drawer-C1zUg5Fu.js} +1 -1
- package/dist/assets/{dropdown-BowFJGJd.js → dropdown-C9n_QlRF.js} +1 -1
- package/dist/assets/{dropdown-UgRjd9-t.js → dropdown-DDL_c0U_.js} +1 -1
- package/dist/assets/esm-0maJv80c.js +1 -0
- package/dist/assets/{esm-BulEIWJS.js → esm-BSm4ek8P.js} +3 -3
- package/dist/assets/{esm-CBHDNjpU.js → esm-BsMGgxDR.js} +2 -2
- package/dist/assets/{esm-C9SvdaNS.js → esm-DyTTIAQn.js} +1 -1
- package/dist/assets/{esm-LBYreRUC.js → esm-EVcjJ7SN.js} +1 -1
- package/dist/assets/{esm-CIEsaQyp.js → esm-r1DIX1hu.js} +2 -2
- package/dist/assets/{esm-BlXZX_rG.js → esm-syuBsnsd.js} +1 -1
- package/dist/assets/fish-BFX8V7mM.js +1 -0
- package/dist/assets/{flux-D9MJj1tQ.js → flux-BE284QKE.js} +1 -1
- package/dist/assets/{grokvideo-q7iOpj7M.js → grokvideo-DiPkxy1H.js} +1 -1
- package/dist/assets/{sora-DUgMPbxu.js → hailuo-BuTP782Y.js} +1 -1
- package/dist/assets/{headshots-CAjMR6um.js → headshots-ClRAlmry.js} +1 -1
- package/dist/assets/{image-C-7QAwi0.js → image-BMwdLSS_.js} +1 -1
- package/dist/assets/{index-DMIa0-eB.js → index-BJQ3dna_.js} +15 -15
- package/dist/assets/{index-CNkDH3Y6.css → index-DPCFU4nX.css} +1 -1
- package/dist/assets/{index.browser.esm-DUW66g_i.js → index.browser.esm-BULcSF2o.js} +1 -1
- package/dist/assets/{index.es-PVNgADTd.js → index.es-D-kzsGJh.js} +1 -1
- package/dist/assets/{input-number-Dtb2rACH.js → input-number-Cx4ggens.js} +1 -1
- package/dist/assets/{kling-DoboYQM7.js → kling-B4eO4odo.js} +1 -1
- package/dist/assets/{luma-DfKNGwEo.js → luma-91oSOS4Y.js} +1 -1
- package/dist/assets/{maestro-COFbCfsy.js → maestro-D1hHh2Q1.js} +1 -1
- package/dist/assets/{midjourney-CNVEpypp.js → midjourney-C13e3Sc_.js} +1 -1
- package/dist/assets/{mobileLocalExec-CuCSnUQ2.js → mobileLocalExec-DbHoHOgB.js} +2 -2
- package/dist/assets/{nanobanana-CapEAW2P.js → nanobanana-B6OsgsOu.js} +1 -1
- package/dist/assets/{openaiimage-BOaB_8P3.js → openaiimage-DHIxbKMq.js} +1 -1
- package/dist/assets/pagination-CtkIYVf3.js +1 -0
- package/dist/assets/{pagination-C1cI7ts-.js → pagination-RqAx2rJg.js} +2 -2
- package/dist/assets/{pika-CE1L9LV0.js → pika-Di3yDqps.js} +1 -1
- package/dist/assets/{hailuo-Dm62YuuZ.js → pixverse-Duen3tzc.js} +1 -1
- package/dist/assets/{popover-C-LTBi4M.js → popover-9M0KHCg8.js} +1 -1
- package/dist/assets/{producer-BZ5QL19Q.js → producer-CP3Ef6Al.js} +1 -1
- package/dist/assets/{qrart-D--x911F.js → qrart-D6E9eZaH.js} +1 -1
- package/dist/assets/realtime-X8kD1Y0C.js +1 -0
- package/dist/assets/{row-DXHy9enI.js → row-CM03cIW-.js} +1 -1
- package/dist/assets/{seedance-BvSgELZU.js → seedance-Bo-YNqKS.js} +1 -1
- package/dist/assets/{seedream-Bp_f7dz6.js → seedream-DM354JvK.js} +1 -1
- package/dist/assets/{select-jPGUTMZ7.js → select-BwvQE0y9.js} +1 -1
- package/dist/assets/serp-BkSvT1Eh.js +1 -0
- package/dist/assets/{slider-5UwARLPg.js → slider-xZk_6ReK.js} +1 -1
- package/dist/assets/{solana-wallets-DtioHJeC.js → solana-wallets-C_DT6w3T.js} +2 -2
- package/dist/assets/{solana-wallets-vue-BIEjkvLL.js → solana-wallets-vue-CNxozCr5.js} +1 -1
- package/dist/assets/sora-hOIZfwo0.js +1 -0
- package/dist/assets/{suno-DwKK9mlq.js → suno-D79uzIF_.js} +1 -1
- package/dist/assets/{switch-0d_kVYNd.js → switch-C7qQ5VvN.js} +1 -1
- package/dist/assets/{table-1ZKO340l.js → table-BWHekbIH.js} +1 -1
- package/dist/assets/{tabs-B-VTUgDg.js → tabs-BId-IBno.js} +1 -1
- package/dist/assets/{time-picker-CuYZkuhw.js → time-picker-CkFLI3Ra.js} +1 -1
- package/dist/assets/{tooltip-CBO5lbUF.js → tooltip-CHp2io7Q.js} +1 -1
- package/dist/assets/{upload-BshRu85E.js → upload-apWgQqFq.js} +1 -1
- package/dist/assets/{veo-BC78vDQv.js → veo-DoOChwvj.js} +1 -1
- package/dist/assets/{wan-D26McUe9.js → wan-C_A9NIf2.js} +1 -1
- package/dist/assets/{web-Bk7wyv5L.js → web-CZl1oTPx.js} +1 -1
- package/dist/assets/{web-C_xxSDSy.js → web-Co1v7VHP.js} +1 -1
- package/dist/assets/{web-u-wcv64i.js → web-DL1_TYKl.js} +1 -1
- package/dist/assets/{web-VzOybB1g.js → web-DTLiTXDf.js} +1 -1
- package/dist/assets/{web-CA8GGzfM.js → web-DpIYHMRR.js} +1 -1
- package/dist/assets/webextrator-DtJsh94r.js +1 -0
- package/dist/index.html +2 -2
- package/package.json +2 -2
- package/dist/assets/Extra-Cy4Ol3r5.js +0 -1
- package/dist/assets/History-Bc0ZQeaQ.css +0 -1
- package/dist/assets/Index-2VvqiCMd.js +0 -1
- package/dist/assets/Index-BT3lyffD.js +0 -1
- package/dist/assets/Index-BYVhA1WF.js +0 -1
- package/dist/assets/Index-C8p2YPhV.js +0 -1
- package/dist/assets/Index-C_XI_n8U.js +0 -1
- package/dist/assets/Index-tIAGugSD.js +0 -1
- package/dist/assets/Invitees-CiSK6cCg.css +0 -1
- package/dist/assets/List-C3ehITdz.css +0 -1
- package/dist/assets/List-Cq6cgqOd.js +0 -1
- package/dist/assets/List-DOJLotaA.css +0 -1
- package/dist/assets/List-Dmw1Gn0V.css +0 -1
- package/dist/assets/List-Dp2Z1-Ps.js +0 -1
- package/dist/assets/Model-Dzl6Kk-Q.js +0 -1
- package/dist/assets/Navigator-CZ-Mfsa5.js +0 -5
- package/dist/assets/Pagination-CnOUH4Ut.css +0 -1
- package/dist/assets/Pagination-tZr-r02R.js +0 -1
- package/dist/assets/ScheduledTasks-DXxXGrLw.css +0 -1
- package/dist/assets/ScheduledTasks-Lyon402Q.js +0 -2
- package/dist/assets/Subscribe-Ch9RUVjf.css +0 -1
- package/dist/assets/Subscribe-YBtp8bo6.js +0 -1
- package/dist/assets/esm-C2w44qCN.js +0 -1
- package/dist/assets/fish-DxRYp_eC.js +0 -1
- package/dist/assets/pixverse-C6pk1mlN.js +0 -1
- package/dist/assets/realtime-COVL1L_s.js +0 -1
- package/dist/assets/serp-BFnbCMAG.js +0 -1
- package/dist/assets/webextrator-f6NUdfM7.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{n as v,r as y,t as b}from"./select-jPGUTMZ7.js";import{t as x}from"./upload-BshRu85E.js";import{t as S}from"./tooltip-CBO5lbUF.js";import{t as C}from"./image-C-7QAwi0.js";import{t as w}from"./alert-CcCvkC2n.js";import{t as T}from"./drawer-BO9lkr2a.js";import{t as E}from"./input-number-Dtb2rACH.js";import{t as D}from"./switch-0d_kVYNd.js";import{dn as O,fn as k,gn as A,hn as j,ln as M,mn as N,on as P,pn as F,sn as I,un as L,vn as R,yn as z}from"./constants-C59L9TVQ.js";import{Gr as B,Ht as ee,Jr as te,Kt as ne,Ut as re,Vt as ie,Wt as V,ai as H,ar as U,bn as W,en as G,gi as K,ii as q,j as J}from"./index-DMIa0-eB.js";import{t as Y}from"./index.es-PVNgADTd.js";import{t as ae}from"./CopyToClipboard-By5Vlmzk.js";import{t as X}from"./ImagePreview-DCYbrXDf.js";import{n as oe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as se}from"./Consumption-D_LySLNy.js";import{i as Z,n as ce,t as le}from"./pagination-C1cI7ts-.js";import{t as ue}from"./ApiCodeButton-Damfiedy.js";import{t as de}from"./BotPlaceholder-ZqqbeNdM.js";import{t as fe}from"./NoTasks-CBDPEOqn.js";import{t as pe}from"./PromptTextarea-BJHKwlQQ.js";import{t as me}from"./ImageWrapper-Cc_kTMCr.js";var he=_({name:`LayoutSeedream`,components:{ElDrawer:T,ElButton:K,FontAwesomeIcon:Y},mixins:[oe]}),ge={class:`main flex flex-row flex-1`},_e={class:`config w-[320px] h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ve={class:`result h-full p-6 flex-1 flex flex-col bg-[var(--app-content-bg)]`};function ye(t,n,r,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,ge,[e(`div`,_e,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ve,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var be=J(he,[[`render`,ye],[`__scopeId`,`data-v-2a1715d6`]]),xe=_({name:`SeedreamPromptInput`,components:{PromptTextarea:pe},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Se(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ce=J(xe,[[`render`,Se]]),we={image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};function Q(e){switch(e){case F:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case k:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case O:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case L:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case M:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:I[M],outputFormat:!1,tools:!1};case N:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:I[N],outputFormat:!1,tools:!1};default:return we}}var Te=[`1K`,`2K`,`3K`,`4K`];function Ee(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Q(n),i=[];Array.isArray(e.image)&&e.image.length>0&&!r.image&&i.push({field:`image`,i18nLabel:`seedream.name.imageUrls`});let a=typeof e.size==`string`?e.size:void 0;if(a){let e=a.toUpperCase();(Te.includes(e)&&!r.sizeTiers.includes(e)||a===`adaptive`&&!r.sizeAdaptive)&&i.push({field:`size`,i18nLabel:`seedream.name.size`})}return e.sequential_image_generation===`auto`&&!r.groupGeneration&&i.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&e.seed!==null&&!r.seed&&i.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&e.guidance_scale!==null&&!r.guidanceScale&&i.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!r.outputFormat&&i.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),Array.isArray(e.tools)&&e.tools.length>0&&!r.tools&&i.push({field:`tools`,i18nLabel:`seedream.name.tools`}),i}function De(e,t,n){let r={...e},i=Q(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var Oe=_({name:`SeedreamImageInput`,components:{ElUpload:x,ElButton:K,InfoIcon:Z,ImagePreview:X,FontAwesomeIcon:Y},mixins:[V,ee],data(){return{fileList:[],uploadUrl:te()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.seedream?.config?.image},model(){return this.$store.state.seedream?.config?.model},supported(){return Q(this.model).image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){H.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){H.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),ke={key:0},Ae={class:`field`},je={class:`label`},Me={class:`box`},Ne={class:`title font-bold`},Pe={class:`value`},Fe={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ie(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`font-awesome-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return t.supported?(h(),s(`div`,ke,[e(`div`,Ae,[e(`div`,je,[e(`div`,Me,[e(`h2`,Ne,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Pe,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{icon:`fa-solid fa-upload`,class:`mr-1`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,Fe,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):o(``,!0)}var Le=J(Oe,[[`render`,Ie],[`__scopeId`,`data-v-6ef4c2e4`]]),Re=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{revertKey:0,options:[{value:F,label:this.$t(`seedream.model.seedream50pro`)},{value:k,label:this.$t(`seedream.model.seedream50`)},{value:O,label:this.$t(`seedream.model.seedream45`)},{value:L,label:this.$t(`seedream.model.seedream40`)},{value:M,label:this.$t(`seedream.model.seedream30t2i`)},{value:N,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(P)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Ee(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await q.confirm(this.$t(`seedream.message.featureNotSupportedBody`,{fields:r}),this.$t(`seedream.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`seedream.button.confirmContinue`),cancelButtonText:this.$t(`seedream.button.cancelSwitch`),type:`warning`});let i=De({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),H.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),ze={class:`field`},Be={class:`label`},Ve={class:`box`},He={class:`title font-bold`};function Ue(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,ze,[e(`div`,Be,[e(`div`,Ve,[e(`h2`,He,i(t.$t(`seedream.name.model`)),1),a(g,{content:t.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(h(),f(v,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`seedream.placeholder.select`),onChange:t.onChange},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var We=J(Re,[[`render`,Ue],[`__scopeId`,`data-v-6413c179`]]),Ge=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:Z},data(){return{SEEDREAM_SIZE_ADAPTIVE:R,pixelOptions:A}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Q(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),Ke={class:`field`},qe={class:`label`},Je={class:`box`},Ye={class:`title font-bold`};function Xe(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`);return h(),s(`div`,Ke,[e(`div`,qe,[e(`div`,Je,[e(`h2`,Ye,i(t.$t(`seedream.name.size`)),1),a(_,{content:t.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:p(()=>[t.capabilities.sizeTiers.length?(h(),f(y,{key:0,label:t.$t(`seedream.size.group.tier`)},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.sizeTiers,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),t.capabilities.sizeAdaptive?(h(),f(y,{key:1,label:t.$t(`seedream.size.group.adaptive`)},{default:p(()=>[(h(),f(v,{key:t.SEEDREAM_SIZE_ADAPTIVE,label:t.$t(`seedream.size.adaptive`),value:t.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:t.$t(`seedream.size.group.pixel`)},{default:p(()=>[(h(!0),s(c,null,m(t.pixelOptions,e=>(h(),f(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var Ze=J(Ge,[[`render`,Xe],[`__scopeId`,`data-v-dd7bd021`]]),Qe=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),$e={key:0,class:`field`},et={class:`label`},tt={class:`box`},nt={class:`title font-bold`},rt={class:`value`};function it(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,$e,[e(`div`,et,[e(`div`,tt,[e(`h2`,nt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,rt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:t.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var at=J(Qe,[[`render`,it],[`__scopeId`,`data-v-f079fd20`]]),ot=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[...j]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),st={key:0,class:`field`},ct={class:`label`},lt={class:`box`},ut={class:`title font-bold`};function dt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,st,[e(`div`,ct,[e(`div`,lt,[e(`h2`,ut,i(t.$t(`seedream.name.outputFormat`)),1),a(_,{content:t.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var ft=J(ot,[[`render`,dt],[`__scopeId`,`data-v-69ea4c07`]]),pt=_({name:`SeedreamSeedInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),mt={key:0,class:`field`},ht={class:`label`},gt={class:`box`},_t={class:`title font-bold`},vt={class:`value`};function yt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,mt,[e(`div`,ht,[e(`div`,gt,[e(`h2`,_t,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,vt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var bt=J(pt,[[`render`,yt],[`__scopeId`,`data-v-10cdc1e0`]]),xt=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).guidanceScale},defaultValue(){return Q(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),St={key:0,class:`field`},Ct={class:`label`},wt={class:`box`},Tt={class:`title font-bold`},Et={class:`value`};function Dt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,St,[e(`div`,Ct,[e(`div`,wt,[e(`h2`,Tt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Et,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Ot=J(xt,[[`render`,Dt],[`__scopeId`,`data-v-7386f064`]]),kt=_({name:`SeedreamWatermarkSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{value:{get(){let e=this.$store.state.seedream?.config?.watermark;return e===void 0?!1:!!e},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,watermark:e})}}}}),At={class:`field`},jt={class:`label`},Mt={class:`box`},Nt={class:`title font-bold`},Pt={class:`value`};function Ft(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,At,[e(`div`,jt,[e(`div`,Mt,[e(`h2`,Nt,i(t.$t(`seedream.name.watermark`)),1),a(d,{content:t.$t(`seedream.description.watermark`),class:`info`},null,8,[`content`])])]),e(`div`,Pt,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e},null,8,[`modelValue`])])])}var It=_({name:`SeedreamConfigPanel`,components:{ElButton:K,FontAwesomeIcon:Y,PromptInput:Ce,Consumption:se,ImageInput:Le,ModelSelector:We,SizeSelector:Ze,MaxImagesSelector:at,OutputFormatSelector:ft,SeedInput:bt,GuidanceScaleInput:Ot,WatermarkSwitch:J(kt,[[`render`,Ft],[`__scopeId`,`data-v-9e2abf0f`]])},emits:[`generate`],computed:{config(){return this.$store.state.seedream?.config},consumption(){let e={...this.config||{}},t=Array.isArray(e?.image)&&e.image.length>0,n=e?.sequential_image_generation===`auto`?Math.max(1,Math.floor(e?.sequential_image_generation_options?.max_images||1)):1;return ne({...e,action:t?`edit`:`generate`,model:z(e?.model),count:n},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Lt={class:`flex flex-col h-full`},Rt={class:`flex-1 overflow-y-auto p-5`},zt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Bt(t,n,o,c,u,d){let f=l(`model-selector`),m=l(`size-selector`),g=l(`max-images-selector`),_=l(`output-format-selector`),v=l(`seed-input`),y=l(`guidance-scale-input`),b=l(`watermark-switch`),x=l(`prompt-input`),S=l(`image-input`),C=l(`consumption`),w=l(`font-awesome-icon`),T=l(`el-button`);return h(),s(`div`,Lt,[e(`div`,Rt,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`})]),e(`div`,zt,[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,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Vt=J(It,[[`render`,Bt]]),Ht=_({name:`SeedreamTaskPreview`,components:{ElImage:C,CopyToClipboard:ae,FontAwesomeIcon:Y,ElAlert:w,ImageWrapper:me,ElButton:K,ElTooltip:S,ImagePreview:X,ApiCodeButton:ue},props:{modelValue:{type:Object,required:!0}},computed:{isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{shortModel(e){return z(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Ut={class:`preview`},Wt={class:`left`},Gt={class:`main`},Kt={class:`bot`},qt={class:`datetime`},Jt={class:`info`},Yt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Xt={key:1,class:`prompt mt-2`},Zt={key:0},Qt={key:0,class:n({content:!0})},$t={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},en={key:1,class:n({content:!0,failed:!0})},tn={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},nn={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},rn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ln={key:2,class:n({content:!0})},un={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},_n={key:3,class:n({content:!0})},vn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function bn(n,u,d,g,_,v){let y=l(`el-image`),b=l(`image-preview`),x=l(`font-awesome-icon`),S=l(`copy-to-clipboard`),C=l(`el-alert`),w=l(`image-wrapper`),T=l(`el-button`),E=l(`el-tooltip`),D=l(`api-code-button`);return h(),s(`div`,Ut,[e(`div`,Wt,[a(y,{src:`https://cdn.acedata.cloud/9egrbn.png`,class:`avatar`})]),e(`div`,Gt,[e(`div`,Kt,[r(i(n.$t(`seedream.name.seedreamBot`))+` `,1),e(`span`,qt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Jt,[Array.isArray(n.modelValue?.request?.image)&&n.modelValue?.request?.image.length>0?(h(),s(`div`,Yt,[(h(!0),s(c,null,m(n.modelValue?.request?.image,(e,t)=>(h(),f(b,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(h(),s(`p`,Xt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,Zt,` - (`+i(n.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(h(),s(`div`,en,[e(`div`,tn,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(w,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,nn,[a(E,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(T,{type:`info`,size:`small`,class:`btn-action`,onClick:u[0]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(D,{path:`/seedream/images`,body:n.modelValue?.request},null,8,[`body`])]),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,rn,[a(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,an,[a(x,{icon:`fa-solid fa-image`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,on,[a(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,sn,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,cn,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,$,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedream.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?(h(),s(`div`,ln,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.failure`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,un,[a(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,dn,[a(x,{icon:`fa-solid fa-image`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,fn,[a(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,pn,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(h(),s(`p`,mn,[a(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(S,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(h(),s(`p`,hn,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,gn,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,_n,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,vn,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(h(),s(`p`,yn,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,Qt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(x,{icon:`fa-regular fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,$t,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var xn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:J(Ht,[[`render`,bn],[`__scopeId`,`data-v-1b4654bc`]]),BotPlaceholder:de,NoTasks:fe,ScrollList:ce},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Sn={key:0},Cn={key:2,class:`w-full h-full flex items-center justify-center`};function wn(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`,Sn,[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`,Cn,[a(v)])):o(``,!0)],64)}var Tn=_({name:`SeedreamIndex`,components:{ConfigPanel:Vt,Layout:be,RecentPanel:J(xn,[[`render`,wn]])},mixins:[re],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===B.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===B.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await le({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!ie(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let e={...this.config||{}};!(Array.isArray(e?.image)&&e.image.length>0)&&`image`in e&&delete e.image,e?.size||delete e.size;let t={...e,async:!0};if(!G())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}H.info(this.$t(`seedream.message.startingTask`)),U(`seedream`,W.generate(t,{token:n})).then(()=>{H.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?H.error(this.$t(`seedream.message.usedUp`)):H.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function 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 Dn=J(Tn,[[`render`,En]]);export{Dn as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,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-BwvQE0y9.js";import{t as x}from"./upload-apWgQqFq.js";import{t as S}from"./tooltip-CHp2io7Q.js";import{t as C}from"./image-BMwdLSS_.js";import{t as w}from"./alert-CILdPemv.js";import{t as T}from"./drawer-C1zUg5Fu.js";import{t as E}from"./input-number-Cx4ggens.js";import{t as D}from"./switch-C7qQ5VvN.js";import{dn as O,fn as k,gn as A,hn as ee,ln as j,mn as M,on as N,pn as P,sn as F,un as I,vn as L,yn as R}from"./constants-C59L9TVQ.js";import{Ht as z,Kr as B,Kt as te,Ut as ne,Vt as re,Wt as ie,Yr as V,_i as H,ai as U,en as W,j as G,oi as K,or as q,xn as J}from"./index-BJQ3dna_.js";import{t as Y}from"./index.es-D-kzsGJh.js";import{t as ae}from"./CopyToClipboard-BxUQkbS4.js";import{t as X}from"./ImagePreview-BCZrB_sX.js";import{n as oe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as se}from"./Consumption-CYy4e1le.js";import{i as Z,n as ce,t as le}from"./pagination-RqAx2rJg.js";import{t as ue}from"./ApiCodeButton-DTODAyG2.js";import{t as de}from"./BotPlaceholder-BxjZQnpl.js";import{t as fe}from"./NoTasks-NHnTSM5H.js";import{t as pe}from"./PromptTextarea-D5c9w02b.js";import{t as me}from"./ImageWrapper-BlHjexof.js";var he=_({name:`LayoutSeedream`,components:{ElDrawer:T,ElButton:H,FontAwesomeIcon:Y},mixins:[oe]}),ge={class:`main flex flex-row flex-1`},_e={class:`config w-[320px] h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ve={class:`result h-full p-6 flex-1 flex flex-col bg-[var(--app-content-bg)]`};function ye(t,n,r,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,ge,[e(`div`,_e,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ve,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var be=G(he,[[`render`,ye],[`__scopeId`,`data-v-2a1715d6`]]),xe=_({name:`SeedreamPromptInput`,components:{PromptTextarea:pe},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Se(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ce=G(xe,[[`render`,Se]]),we={image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};function Q(e){switch(e){case P:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case k:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case O:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case I:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case j:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:F[j],outputFormat:!1,tools:!1};case M:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:F[M],outputFormat:!1,tools:!1};default:return we}}var Te=[`1K`,`2K`,`3K`,`4K`];function Ee(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Q(n),i=[];Array.isArray(e.image)&&e.image.length>0&&!r.image&&i.push({field:`image`,i18nLabel:`seedream.name.imageUrls`});let a=typeof e.size==`string`?e.size:void 0;if(a){let e=a.toUpperCase();(Te.includes(e)&&!r.sizeTiers.includes(e)||a===`adaptive`&&!r.sizeAdaptive)&&i.push({field:`size`,i18nLabel:`seedream.name.size`})}return e.sequential_image_generation===`auto`&&!r.groupGeneration&&i.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&e.seed!==null&&!r.seed&&i.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&e.guidance_scale!==null&&!r.guidanceScale&&i.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!r.outputFormat&&i.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),Array.isArray(e.tools)&&e.tools.length>0&&!r.tools&&i.push({field:`tools`,i18nLabel:`seedream.name.tools`}),i}function De(e,t,n){let r={...e},i=Q(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var Oe=_({name:`SeedreamImageInput`,components:{ElUpload:x,ElButton:H,InfoIcon:Z,ImagePreview:X,FontAwesomeIcon:Y},mixins:[ie,z],data(){return{fileList:[],uploadUrl:V()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.seedream?.config?.image},model(){return this.$store.state.seedream?.config?.model},supported(){return Q(this.model).image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){K.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){K.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),ke={key:0},Ae={class:`field`},je={class:`label`},Me={class:`box`},Ne={class:`title font-bold`},Pe={class:`value`},Fe={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ie(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`font-awesome-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return t.supported?(h(),s(`div`,ke,[e(`div`,Ae,[e(`div`,je,[e(`div`,Me,[e(`h2`,Ne,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Pe,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{icon:`fa-solid fa-upload`,class:`mr-1`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,Fe,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):o(``,!0)}var Le=G(Oe,[[`render`,Ie],[`__scopeId`,`data-v-6ef4c2e4`]]),Re=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{revertKey:0,options:[{value:P,label:this.$t(`seedream.model.seedream50pro`)},{value:k,label:this.$t(`seedream.model.seedream50`)},{value:O,label:this.$t(`seedream.model.seedream45`)},{value:I,label:this.$t(`seedream.model.seedream40`)},{value:j,label:this.$t(`seedream.model.seedream30t2i`)},{value:M,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(N)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Ee(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await U.confirm(this.$t(`seedream.message.featureNotSupportedBody`,{fields:r}),this.$t(`seedream.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`seedream.button.confirmContinue`),cancelButtonText:this.$t(`seedream.button.cancelSwitch`),type:`warning`});let i=De({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),K.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),ze={class:`field`},Be={class:`label`},Ve={class:`box`},He={class:`title font-bold`};function Ue(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,ze,[e(`div`,Be,[e(`div`,Ve,[e(`h2`,He,i(t.$t(`seedream.name.model`)),1),a(g,{content:t.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(h(),f(v,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`seedream.placeholder.select`),onChange:t.onChange},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var We=G(Re,[[`render`,Ue],[`__scopeId`,`data-v-6413c179`]]),Ge=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:Z},data(){return{SEEDREAM_SIZE_ADAPTIVE:L,pixelOptions:A}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Q(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),Ke={class:`field`},qe={class:`label`},Je={class:`box`},Ye={class:`title font-bold`};function Xe(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`);return h(),s(`div`,Ke,[e(`div`,qe,[e(`div`,Je,[e(`h2`,Ye,i(t.$t(`seedream.name.size`)),1),a(_,{content:t.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:p(()=>[t.capabilities.sizeTiers.length?(h(),f(y,{key:0,label:t.$t(`seedream.size.group.tier`)},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.sizeTiers,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),t.capabilities.sizeAdaptive?(h(),f(y,{key:1,label:t.$t(`seedream.size.group.adaptive`)},{default:p(()=>[(h(),f(v,{key:t.SEEDREAM_SIZE_ADAPTIVE,label:t.$t(`seedream.size.adaptive`),value:t.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:t.$t(`seedream.size.group.pixel`)},{default:p(()=>[(h(!0),s(c,null,m(t.pixelOptions,e=>(h(),f(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var Ze=G(Ge,[[`render`,Xe],[`__scopeId`,`data-v-dd7bd021`]]),Qe=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),$e={key:0,class:`field`},et={class:`label`},tt={class:`box`},nt={class:`title font-bold`},rt={class:`value`};function it(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,$e,[e(`div`,et,[e(`div`,tt,[e(`h2`,nt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,rt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:t.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var at=G(Qe,[[`render`,it],[`__scopeId`,`data-v-f079fd20`]]),ot=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[...ee]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),st={key:0,class:`field`},ct={class:`label`},lt={class:`box`},ut={class:`title font-bold`};function dt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,st,[e(`div`,ct,[e(`div`,lt,[e(`h2`,ut,i(t.$t(`seedream.name.outputFormat`)),1),a(_,{content:t.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var ft=G(ot,[[`render`,dt],[`__scopeId`,`data-v-69ea4c07`]]),pt=_({name:`SeedreamSeedInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),mt={key:0,class:`field`},ht={class:`label`},gt={class:`box`},_t={class:`title font-bold`},vt={class:`value`};function yt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,mt,[e(`div`,ht,[e(`div`,gt,[e(`h2`,_t,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,vt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var bt=G(pt,[[`render`,yt],[`__scopeId`,`data-v-10cdc1e0`]]),xt=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).guidanceScale},defaultValue(){return Q(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),St={key:0,class:`field`},Ct={class:`label`},wt={class:`box`},Tt={class:`title font-bold`},Et={class:`value`};function Dt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,St,[e(`div`,Ct,[e(`div`,wt,[e(`h2`,Tt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Et,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Ot=G(xt,[[`render`,Dt],[`__scopeId`,`data-v-7386f064`]]),kt=_({name:`SeedreamWatermarkSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{value:{get(){let e=this.$store.state.seedream?.config?.watermark;return e===void 0?!1:!!e},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,watermark:e})}}}}),At={class:`field`},jt={class:`label`},Mt={class:`box`},Nt={class:`title font-bold`},Pt={class:`value`};function Ft(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,At,[e(`div`,jt,[e(`div`,Mt,[e(`h2`,Nt,i(t.$t(`seedream.name.watermark`)),1),a(d,{content:t.$t(`seedream.description.watermark`),class:`info`},null,8,[`content`])])]),e(`div`,Pt,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e},null,8,[`modelValue`])])])}var It=_({name:`SeedreamConfigPanel`,components:{ElButton:H,FontAwesomeIcon:Y,PromptInput:Ce,Consumption:se,ImageInput:Le,ModelSelector:We,SizeSelector:Ze,MaxImagesSelector:at,OutputFormatSelector:ft,SeedInput:bt,GuidanceScaleInput:Ot,WatermarkSwitch:G(kt,[[`render`,Ft],[`__scopeId`,`data-v-9e2abf0f`]])},emits:[`generate`],computed:{config(){return this.$store.state.seedream?.config},consumption(){let e={...this.config||{}},t=Array.isArray(e?.image)&&e.image.length>0,n=e?.sequential_image_generation===`auto`?Math.max(1,Math.floor(e?.sequential_image_generation_options?.max_images||1)):1;return te({...e,action:t?`edit`:`generate`,model:R(e?.model),count:n},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Lt={class:`flex flex-col h-full`},Rt={class:`flex-1 overflow-y-auto p-5`},zt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Bt(t,n,o,c,u,d){let f=l(`model-selector`),m=l(`size-selector`),g=l(`max-images-selector`),_=l(`output-format-selector`),v=l(`seed-input`),y=l(`guidance-scale-input`),b=l(`watermark-switch`),x=l(`prompt-input`),S=l(`image-input`),C=l(`consumption`),w=l(`font-awesome-icon`),T=l(`el-button`);return h(),s(`div`,Lt,[e(`div`,Rt,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`})]),e(`div`,zt,[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,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Vt=G(It,[[`render`,Bt]]),Ht=_({name:`SeedreamTaskPreview`,components:{ElImage:C,CopyToClipboard:ae,FontAwesomeIcon:Y,ElAlert:w,ImageWrapper:me,ElButton:H,ElTooltip:S,ImagePreview:X,ApiCodeButton:ue},props:{modelValue:{type:Object,required:!0}},computed:{isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{shortModel(e){return R(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Ut={class:`preview`},Wt={class:`left`},Gt={class:`main`},Kt={class:`bot`},qt={class:`datetime`},Jt={class:`info`},Yt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Xt={key:1,class:`prompt mt-2`},Zt={key:0},Qt={key:0,class:n({content:!0})},$t={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},en={key:1,class:n({content:!0,failed:!0})},tn={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},nn={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},rn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ln={key:2,class:n({content:!0})},un={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},_n={key:3,class:n({content:!0})},vn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function bn(n,u,d,g,_,v){let y=l(`el-image`),b=l(`image-preview`),x=l(`font-awesome-icon`),S=l(`copy-to-clipboard`),C=l(`el-alert`),w=l(`image-wrapper`),T=l(`el-button`),E=l(`el-tooltip`),D=l(`api-code-button`);return h(),s(`div`,Ut,[e(`div`,Wt,[a(y,{src:`https://cdn.acedata.cloud/9egrbn.png`,class:`avatar`})]),e(`div`,Gt,[e(`div`,Kt,[r(i(n.$t(`seedream.name.seedreamBot`))+` `,1),e(`span`,qt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Jt,[Array.isArray(n.modelValue?.request?.image)&&n.modelValue?.request?.image.length>0?(h(),s(`div`,Yt,[(h(!0),s(c,null,m(n.modelValue?.request?.image,(e,t)=>(h(),f(b,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(h(),s(`p`,Xt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,Zt,` - (`+i(n.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(h(),s(`div`,en,[e(`div`,tn,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(w,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,nn,[a(E,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(T,{type:`info`,size:`small`,class:`btn-action`,onClick:u[0]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(D,{path:`/seedream/images`,body:n.modelValue?.request},null,8,[`body`])]),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,rn,[a(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,an,[a(x,{icon:`fa-solid fa-image`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,on,[a(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,sn,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,cn,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,$,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedream.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?(h(),s(`div`,ln,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.failure`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,un,[a(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,dn,[a(x,{icon:`fa-solid fa-image`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,fn,[a(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,pn,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(h(),s(`p`,mn,[a(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(S,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(h(),s(`p`,hn,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,gn,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,_n,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,vn,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(h(),s(`p`,yn,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,Qt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(x,{icon:`fa-regular fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,$t,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var xn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:G(Ht,[[`render`,bn],[`__scopeId`,`data-v-1b4654bc`]]),BotPlaceholder:de,NoTasks:fe,ScrollList:ce},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Sn={key:0},Cn={key:2,class:`w-full h-full flex items-center justify-center`};function wn(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`,Sn,[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`,Cn,[a(v)])):o(``,!0)],64)}var Tn=_({name:`SeedreamIndex`,components:{ConfigPanel:Vt,Layout:be,RecentPanel:G(xn,[[`render`,wn]])},mixins:[ne],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===B.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===B.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await le({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!re(this.uploadTracker,e=>this.$t(e),e=>K.warning(e)))return;let e={...this.config||{}};!(Array.isArray(e?.image)&&e.image.length>0)&&`image`in e&&delete e.image,e?.size||delete e.size;let t={...e,async:!0};if(!W())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}K.info(this.$t(`seedream.message.startingTask`)),q(`seedream`,J.generate(t,{token:n})).then(()=>{K.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?K.error(this.$t(`seedream.message.usedUp`)):K.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function 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 Dn=G(Tn,[[`render`,En]]);export{Dn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-jPGUTMZ7.js";import{t as x}from"./upload-BshRu85E.js";import{t as S}from"./tooltip-CBO5lbUF.js";import{t as C}from"./image-C-7QAwi0.js";import{t as w}from"./alert-CcCvkC2n.js";import{t as T}from"./drawer-BO9lkr2a.js";import{t as E}from"./input-number-Dtb2rACH.js";import{t as D}from"./switch-0d_kVYNd.js";import{$t as O,Gt as k,Ht as A,Jt as ee,Kt as te,Qt as ne,Rt as re,Ut as j,Vt as M,Wt as N,Xt as P,Yt as ie,Zt as ae,an as F,en as oe,nn as I,qt as se,rn as L,tn as R,zt as ce}from"./constants-C59L9TVQ.js";import{Gr as z,Ht as B,Jr as V,Kt as H,Ut as U,Vt as W,Wt as G,ai as K,ar as le,en as ue,gi as q,j as J,yn as de}from"./index-DMIa0-eB.js";import{t as Y}from"./index.es-PVNgADTd.js";import{t as fe}from"./CopyToClipboard-By5Vlmzk.js";import{t as X}from"./ImagePreview-DCYbrXDf.js";import{n as pe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as me}from"./Consumption-D_LySLNy.js";import{i as Z,n as he,t as ge}from"./pagination-C1cI7ts-.js";import{t as _e}from"./VideoPlayer-BEjp78dn.js";import{t as ve}from"./ApiCodeButton-Damfiedy.js";import{t as ye}from"./BotPlaceholder-ZqqbeNdM.js";import{t as be}from"./NoTasks-CBDPEOqn.js";import{t as xe}from"./PromptTextarea-BJHKwlQQ.js";import{t as Se}from"./ImageWrapper-Cc_kTMCr.js";import{n as Ce,t as we}from"./VideoPreview-DpdN8ThZ.js";var Te=v({name:`LayoutSeedance`,components:{ElDrawer:T,ElButton:q,FontAwesomeIcon:Y},mixins:[pe]}),Ee={class:`main flex flex-row flex-1`},De={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Oe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ke(t,n,r,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,Ee,[e(`div`,De,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Oe,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{icon:`fa-solid fa-magic`})]),_:1},512),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Ae=J(Te,[[`render`,ke],[`__scopeId`,`data-v-ec312952`]]),je=v({name:`SeedancePromptInput`,components:{PromptTextarea:xe},computed:{prompt:{get(){return this.$store.state.seedance?.config?.prompt},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Me(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(`seedance.name.prompt`),info:e.$t(`seedance.description.prompt`),placeholder:e.$t(`seedance.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ne=J(je,[[`render`,Me]]),Pe=v({name:`SeedanceModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[{value:se,label:this.$t(`seedance.model.seedance20`)},{value:ee,label:this.$t(`seedance.model.seedance20Fast`)},{value:ie,label:this.$t(`seedance.model.seedance20Mini`)},{value:te,label:this.$t(`seedance.model.seedance15pro`)},{value:N,label:this.$t(`seedance.model.seedance10pro`)},{value:k,label:this.$t(`seedance.model.seedance10proFast`)},{value:j,label:this.$t(`seedance.model.seedance10liteT2v`)},{value:A,label:this.$t(`seedance.model.seedance10liteI2v`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.model},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,model:e})}}},mounted(){this.value||=re}}),Fe={class:`field`},Ie={class:`label`},Le={class:`box`},Re={class:`title font-bold`};function ze(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Fe,[e(`div`,Ie,[e(`div`,Le,[e(`h2`,Re,i(t.$t(`seedance.name.model`)),1),a(m,{content:t.$t(`seedance.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(`seedance.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 Be=J(Pe,[[`render`,ze],[`__scopeId`,`data-v-deb4c429`]]),Ve=v({name:`SeedanceDurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},options(){let e=[];this.capability.supportsAutoDuration&&e.push({value:-1,label:`${this.$t(`seedance.placeholder.seed`)} (-1)`});for(let t=this.capability.minDuration;t<=this.capability.maxDuration;t++)e.push({value:t,label:`${t}s`});return e},value:{get(){return this.$store.state.seedance?.config?.duration},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,duration:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=5},methods:{clampValue(){let e=this.value;e!==void 0&&!(e===-1&&this.capability.supportsAutoDuration)&&(e<this.capability.minDuration||e>this.capability.maxDuration)&&(this.value=5)}}}),He={class:`field`},Ue={class:`label`},We={class:`box`},Ge={class:`title font-bold`};function Ke(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,He,[e(`div`,Ue,[e(`div`,We,[e(`h2`,Ge,i(t.$t(`seedance.name.duration`)),1),a(m,{content:t.$t(`seedance.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(`seedance.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 qe=J(Ve,[[`render`,Ke],[`__scopeId`,`data-v-d61cc21b`]]),Q={[I]:0,[L]:1,[R]:2,"4k":3},Je=v({name:`SeedanceResolutionSelector`,components:{InfoIcon:Z,ElTooltip:S},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},options(){let e=[{value:I,label:`480p`},{value:L,label:`720p`},{value:R,label:`1080p`},{value:`4k`,label:`4k`}],t=Q[this.capability.maxResolution]??Q[`1080p`];return e.map(e=>({...e,disabled:Q[e.value]>t}))},value:{get(){return this.$store.state.seedance?.config?.resolution},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,resolution:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=this.capability.defaultResolution||`720p`},methods:{onSelect(e){e.disabled||(this.value=e.value)},clampValue(){let e=this.value,t=this.options.find(t=>t.value===e);(!e||t&&t.disabled)&&(this.value=this.capability.defaultResolution||`720p`)}}}),Ye={class:`resolution`},Xe={class:`header`},Ze={class:`title font-bold`},Qe={class:`items`},$e=[`onClick`];function et(t,r,o,u,d,m){let _=l(`info-icon`),v=l(`el-tooltip`);return g(),s(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`seedance.name.resolution`)),1),a(_,{content:t.$t(`seedance.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,Qe,[(g(!0),s(c,null,h(t.options,r=>(g(),f(v,{key:r.value,content:t.$t(`seedance.message.resolutionNotSupported`),disabled:!r.disabled,placement:`top`},{default:p(()=>[e(`div`,{class:n([`item`,{active:t.value===r.value,disabled:r.disabled}]),onClick:e=>t.onSelect(r)},i(r.label),11,$e)]),_:2},1032,[`content`,`disabled`]))),128))])])}var tt=J(Je,[[`render`,et],[`__scopeId`,`data-v-db7e8aff`]]),nt=v({name:`SeedanceRatioSelector`,components:{InfoIcon:Z},computed:{options(){return[{value:ae,label:`16:9`,w:32,h:18},{value:O,label:`9:16`,w:18,h:32},{value:`4:3`,label:`4:3`,w:28,h:21},{value:`3:4`,label:`3:4`,w:21,h:28},{value:`1:1`,label:`1:1`,w:24,h:24},{value:ne,label:`21:9`,w:34,h:14},{value:oe,label:this.$t(`seedance.ratio.adaptive`),w:0,h:0}]},value:{get(){return this.$store.state.seedance?.config?.ratio},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,ratio:e})}}},mounted(){this.value||=ce}}),rt={class:`ratio`},it={class:`header`},at={class:`title font-bold`},ot={class:`items`},st=[`onClick`],ct={class:`preview`},lt={key:1,class:`rect rect-auto`},ut={class:`name`};function dt(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,rt,[e(`div`,it,[e(`h2`,at,i(t.$t(`seedance.name.ratio`)),1),a(p,{content:t.$t(`seedance.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,ot,[(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`,ct,[r.w&&r.h?(g(),s(`div`,{key:0,class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)):(g(),s(`div`,lt,`A`))]),e(`div`,ut,i(r.label),1)],10,st))),128))])])}var ft=J(nt,[[`render`,dt],[`__scopeId`,`data-v-8ddec2dd`]]),pt=v({name:`SeedanceGenerateAudioSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{isSupported(){let e=this.$store.state.seedance?.config?.model;return F(e).acceptsAudio},value:{get(){return this.$store.state.seedance?.config?.generate_audio??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,generate_audio:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),mt={key:0,class:`field`},ht={class:`label`},gt={class:`box`},_t={class:`title font-bold`},vt={class:`value`};function yt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-switch`);return t.isSupported?(g(),s(`div`,mt,[e(`div`,ht,[e(`div`,gt,[e(`h2`,_t,i(t.$t(`seedance.name.generateAudio`)),1),a(f,{content:t.$t(`seedance.description.generateAudio`),class:`info`},null,8,[`content`])])]),e(`div`,vt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):o(``,!0)}var bt=J(pt,[[`render`,yt],[`__scopeId`,`data-v-df51dfbd`]]),xt=v({name:`SeedanceCameraFixedSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{value:{get(){return this.$store.state.seedance?.config?.camerafixed??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,camerafixed:e})}}},mounted(){this.$store.state.seedance?.config?.camerafixed===void 0&&(this.value=!1)}}),St={class:`field`},Ct={class:`label`},wt={class:`box`},Tt={class:`title font-bold`},Et={class:`value`};function Dt(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,St,[e(`div`,Ct,[e(`div`,wt,[e(`h2`,Tt,i(t.$t(`seedance.name.cameraFixed`)),1),a(d,{content:t.$t(`seedance.description.cameraFixed`),class:`info`},null,8,[`content`])])]),e(`div`,Et,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])}var Ot=J(xt,[[`render`,Dt],[`__scopeId`,`data-v-ae777d61`]]),kt=v({name:`SeedanceFirstFrameImage`,components:{ElUpload:x,ElButton:q,InfoIcon:Z,FontAwesomeIcon:Y,ImagePreview:X},mixins:[G,B],data(){return{fileList:[],uploadUrl:V()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsImage"(e){e||(this.fileList=[],this.onSetFirstFrameUrl())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetFirstFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`first_frame`);e&&t.push({url:e,role:`first_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetFirstFrameUrl()},async onRemove(){this.onSetFirstFrameUrl()}}}),At={key:0,class:`relative`},jt={class:`flex justify-between`},Mt={class:`flex justify-start items-center`},Nt={class:`text-sm font-bold`},Pt={key:0,class:`required-badge`};function Ft(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsImage?(g(),s(`div`,At,[e(`div`,jt,[e(`div`,Mt,[e(`span`,Nt,i(t.$t(`seedance.name.firstFrame`)),1),t.capability.requiresImage?(g(),s(`span`,Pt,i(t.$t(`seedance.name.required`)),1)):o(``,!0),a(h,{content:t.$t(`seedance.description.firstFrame`)},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,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var It=J(kt,[[`render`,Ft],[`__scopeId`,`data-v-e2597f23`]]),Lt=v({name:`SeedanceLastFrameImage`,components:{ElUpload:x,ElButton:q,ImagePreview:X,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[G,B],data(){return{fileList:[],uploadUrl:V()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsLastFrame"(e){e||(this.fileList=[],this.onSetLastFrameUrl())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetLastFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`last_frame`);e&&t.push({url:e,role:`last_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetLastFrameUrl()},async onRemove(){this.onSetLastFrameUrl()}}}),Rt={key:0,class:`relative`},zt={class:`flex justify-between`},Bt={class:`flex justify-start items-center`},Vt={class:`text-sm font-bold`};function Ht(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsLastFrame?(g(),s(`div`,Rt,[e(`div`,zt,[e(`div`,Bt,[e(`span`,Vt,i(t.$t(`seedance.name.lastFrame`)),1),a(h,{content:t.$t(`seedance.description.lastFrame`)},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,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var Ut=J(Lt,[[`render`,Ht],[`__scopeId`,`data-v-3a191e51`]]),Wt=v({name:`SeedanceReferenceImage`,components:{ElUpload:x,ElButton:q,InfoIcon:Z,FontAwesomeIcon:Y,ImagePreview:X},mixins:[G,B],data(){return{fileList:[],uploadUrl:V()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceImage"(e){e||(this.fileList=[],this.onSetReferenceImageUrls())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetReferenceImageUrls(){let e=(this.urls||[]).filter(Boolean),t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`reference_image`);e.forEach(e=>t.push({url:e,role:`reference_image`})),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetReferenceImageUrls()},async onRemove(){this.onSetReferenceImageUrls()}}}),Gt={key:0,class:`relative`},Kt={class:`flex justify-between`},qt={class:`flex justify-start items-center`},Jt={class:`text-sm font-bold`};function Yt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsReferenceImage?(g(),s(`div`,Gt,[e(`div`,Kt,[e(`div`,qt,[e(`span`,Jt,i(t.$t(`seedance.name.referenceImage`)),1),a(h,{content:t.$t(`seedance.description.referenceImage`)},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,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var Xt=J(Wt,[[`render`,Yt],[`__scopeId`,`data-v-230a67f6`]]),Zt=v({name:`SeedanceReferenceAudio`,components:{ElUpload:x,ElButton:q,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[B],data(){return{fileList:[],uploadUrl:V()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceAudio"(e){e||(this.fileList=[],this.onSetReferenceAudios())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetReferenceAudios(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,audios:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceAudios()},async onRemove(){this.onSetReferenceAudios()}}}),Qt={key:0,class:`relative`},$t={class:`flex justify-between`},en={class:`flex justify-start items-center`},tn={class:`text-sm font-bold`};function nn(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`font-awesome-icon`),_=l(`el-button`),v=l(`el-upload`);return t.capability.acceptsReferenceAudio?(g(),s(`div`,Qt,[e(`div`,$t,[e(`div`,en,[e(`span`,tn,i(t.$t(`seedance.name.referenceAudio`)),1),a(m,{content:t.$t(`seedance.description.referenceAudio`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.mp3,.wav,.m4a,.aac,.ogg,.flac`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`text`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(h,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var rn=J(Zt,[[`render`,nn],[`__scopeId`,`data-v-49515675`]]),an=v({name:`SeedanceReferenceVideo`,components:{ElUpload:x,ElButton:q,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[B],data(){return{fileList:[],uploadUrl:V()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceVideo"(e){e||(this.fileList=[],this.onSetReferenceVideos())}},methods:{onExceed(){K.warning(this.$t(`seedance.message.uploadExceed`))},onError(){K.error(this.$t(`seedance.message.uploadError`))},onSetReferenceVideos(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,videos:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceVideos()},async onRemove(){this.onSetReferenceVideos()}}}),on={key:0,class:`relative`},sn={class:`flex justify-between`},cn={class:`flex justify-start items-center`},ln={class:`text-sm font-bold`};function un(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`font-awesome-icon`),_=l(`el-button`),v=l(`el-upload`);return t.capability.acceptsReferenceVideo?(g(),s(`div`,on,[e(`div`,sn,[e(`div`,cn,[e(`span`,ln,i(t.$t(`seedance.name.referenceVideo`)),1),a(m,{content:t.$t(`seedance.description.referenceVideo`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.mp4,.mov,.webm,.mkv,.avi`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`text`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(h,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var dn=J(an,[[`render`,un],[`__scopeId`,`data-v-b212c474`]]),fn=v({name:`SeedanceReturnLastFrameSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{model(){return this.$store.state.seedance?.config?.model},isSupported(){return F(this.model).acceptsReturnLastFrame},value:{get(){return this.$store.state.seedance?.config?.return_last_frame},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,return_last_frame:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),pn={key:0,class:`field`},mn={class:`label`},hn={class:`box`},gn={class:`title font-bold`},_n={class:`value`};function vn(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-switch`);return t.isSupported?(g(),s(`div`,pn,[e(`div`,mn,[e(`div`,hn,[e(`h2`,gn,i(t.$t(`seedance.name.returnLastFrame`)),1),a(f,{content:t.$t(`seedance.description.returnLastFrame`),class:`info`},null,8,[`content`])])]),e(`div`,_n,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):o(``,!0)}var yn=J(fn,[[`render`,vn],[`__scopeId`,`data-v-edea5451`]]),bn=v({name:`SeedanceSeedInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{value:{get(){let e=this.$store.state.seedance?.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.$store.state.seedance?.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedance/setConfig`,t)}}}}),xn={class:`field`},Sn={class:`label`},Cn={class:`box`},wn={class:`title font-bold`},Tn={class:`value`};function En(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`);return g(),s(`div`,xn,[e(`div`,Sn,[e(`div`,Cn,[e(`h2`,wn,i(t.$t(`seedance.name.seed`)),1),a(d,{content:t.$t(`seedance.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Tn,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])}var Dn=v({name:`SeedanceConfigPanel`,components:{ElButton:q,FontAwesomeIcon:Y,PromptInput:Ne,ModelSelector:Be,DurationSelector:qe,ResolutionSelector:tt,RatioSelector:ft,GenerateAudioSwitch:bt,CameraFixedSwitch:Ot,ReturnLastFrameSwitch:yn,SeedInput:J(bn,[[`render`,En],[`__scopeId`,`data-v-685a9869`]]),FirstFrameImage:It,LastFrameImage:Ut,ReferenceImage:Xt,ReferenceAudio:rn,ReferenceVideo:dn,Consumption:me},emits:[`generate`],computed:{config(){return this.$store.state.seedance?.config},consumption(){return H(this.config,this.service?.cost)},service(){return this.$store.state.seedance?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),On={class:`flex flex-col h-full`},kn={class:`flex-1 overflow-y-auto p-5`},An={class:`flex flex-col items-center justify-center px-5 pb-5`};function jn(t,n,o,c,u,d){let f=l(`prompt-input`),m=l(`model-selector`),h=l(`ratio-selector`),_=l(`resolution-selector`),v=l(`duration-selector`),y=l(`generate-audio-switch`),b=l(`camera-fixed-switch`),x=l(`return-last-frame-switch`),S=l(`seed-input`),C=l(`first-frame-image`),w=l(`last-frame-image`),T=l(`reference-image`),E=l(`reference-audio`),D=l(`reference-video`),O=l(`consumption`),k=l(`font-awesome-icon`),A=l(`el-button`);return g(),s(`div`,On,[e(`div`,kn,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),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`}),a(S,{class:`mb-4`}),a(C,{class:`mb-2`}),a(w,{class:`mb-2`}),a(T,{class:`mb-2`}),a(E,{class:`mb-2`}),a(D,{class:`mb-2`})]),e(`div`,An,[a(O,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(A,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(k,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`seedance.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Mn=J(Dn,[[`render`,jn]]),Nn=v({name:`SeedanceTaskPreview`,components:{ElImage:C,CopyToClipboard:fe,FontAwesomeIcon:Y,ElAlert:w,VideoPlayer:_e,ElTooltip:S,ElButton:q,ImageWrapper:Se,ImagePreview:X,AudioPreview:Ce,VideoPreview:we,ApiCodeButton:ve},props:{modelValue:{type:Object,required:!0}},data(){return{seedanceLogo:M}},computed:{video(){return this.modelValue?.response?.data},apiCodeBody(){let e=this.modelValue?.request;if(!e)return e;let{service_tier:t,...n}=e;return n},promptText(){let e=this.modelValue?.request;if(e?.prompt)return e.prompt;let t=e?.content?.find(e=>e?.type===`text`&&e?.text);return t?.text?t.text:this.video?.prompt},referenceImages(){let e=this.collectImages();if(e.length===0)return[];let t=[],n=e.find(e=>e?.role===`first_frame`);n?.url&&t.push({url:n.url,name:`first-frame`});let r=e.find(e=>e?.role===`last_frame`);return r?.url&&t.push({url:r.url,name:`last-frame`}),e.forEach((e,n)=>{e?.url&&e.role!==`first_frame`&&e.role!==`last_frame`&&t.push({url:e.url,name:e.role||`image-${n}`})}),t},referenceAudios(){let e=this.modelValue?.request,t=(e?.audios??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`audio_url`&&e?.audio_url?.url&&t.push(e.audio_url.url)}),t},referenceVideos(){let e=this.modelValue?.request,t=(e?.videos??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`video_url`&&e?.video_url?.url&&t.push(e.video_url.url)}),t}},methods:{collectImages(){let e=this.modelValue?.request,t=Array.isArray(e?.images)?[...e.images]:[];return(e?.content??[]).forEach(e=>{e?.type===`image_url`&&e?.image_url?.url&&t.push({url:e.image_url.url,role:e.role})}),t},onDownload(e){window.open(e,`_blank`)}}}),Pn={class:`preview`},Fn={class:`left`},In={class:`main`},Ln={class:`bot`},Rn={class:`datetime`},zn={class:`info`},Bn={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Vn={key:1,class:`prompt mt-2`},Hn={key:0},Un={key:1},Wn={key:0,class:n({content:!0})},Gn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Kn={key:1,class:n({content:!0})},qn={key:0,class:`mb-4`},Jn={key:1,class:`mb-4`},Yn={key:2,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},Xn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Zn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Qn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$n={key:0},er={key:1},$={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},nr={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},rr={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ir={key:2,class:n({content:!0})},ar={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},or={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cr={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},lr={key:3,class:n({content:!0})},ur={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function fr(n,u,d,m,_,v){let y=l(`el-image`),b=l(`image-preview`),x=l(`audio-preview`),S=l(`video-preview`),C=l(`font-awesome-icon`),w=l(`copy-to-clipboard`),T=l(`el-alert`),E=l(`video-player`),D=l(`image-wrapper`),O=l(`el-button`),k=l(`el-tooltip`),A=l(`api-code-button`);return g(),s(`div`,Pn,[e(`div`,Fn,[a(y,{src:n.seedanceLogo,class:`avatar`},null,8,[`src`])]),e(`div`,In,[e(`div`,Ln,[r(i(n.$t(`seedance.name.seedanceBot`))+` `,1),e(`span`,Rn,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,zn,[n.referenceImages.length>0||n.referenceAudios.length>0||n.referenceVideos.length>0?(g(),s(`div`,Bn,[(g(!0),s(c,null,h(n.referenceImages,(e,t)=>(g(),f(b,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceAudios,(e,t)=>(g(),f(x,{key:`audio-${t}`,url:e,name:`audio-${t+1}`},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceVideos,(e,t)=>(g(),f(S,{key:`video-${t}`,url:e,name:`video-${t+1}`},null,8,[`url`,`name`]))),128))])):o(``,!0),n.promptText?(g(),s(`p`,Vn,[r(i(n.promptText)+` `,1),n.modelValue?.response?n.video?.status===`processing`||n.video?.status===`pending`?(g(),s(`span`,Un,` - (`+i(n.$t(`seedance.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,Hn,` - (`+i(n.$t(`seedance.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,Kn,[n.video?.video_url?(g(),s(`div`,qn,[a(E,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.last_frame_url?(g(),s(`div`,Jn,[a(D,{src:n.video?.last_frame_url,"raw-src":n.video?.last_frame_url},null,8,[`src`,`raw-src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Yn,[a(k,{class:`box-item`,effect:`dark`,content:n.$t(`seedance.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(O,{type:`info`,size:`small`,class:`btn-action`,onClick:u[0]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`seedance.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(A,{path:`/seedance/videos`,body:n.apiCodeBody},null,8,[`body`])])):o(``,!0),a(T,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,Xn,[a(C,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.video?.duration?(g(),s(`p`,Zn,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.duration`))+`: `+i(n.video?.duration)+`s `,1)])):o(``,!0),n.video?.resolution?(g(),s(`p`,Qn,[a(C,{icon:`fa-solid fa-expand`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.resolution`))+`: `+i(n.video?.resolution)+` `,1),n.video?.ratio?(g(),s(`span`,$n,` · `+i(n.video?.ratio),1)):o(``,!0),n.video?.framespersecond?(g(),s(`span`,er,` · `+i(n.video?.framespersecond)+`fps`,1)):o(``,!0)])):o(``,!0),n.modelValue?.request?.generate_audio?(g(),s(`p`,$,[a(C,{icon:`fa-solid fa-volume-up`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.generateAudio`))+`: `+i(n.$t(`seedance.button.on`)),1)])):o(``,!0),e(`p`,tr,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,nr,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,rr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{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`,ir,[a(T,{closable:!1,class:`failure`},{template:p(()=>[a(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.failure`)),1)]),default:p(()=>[e(`p`,ar,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,or,[a(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(w,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(g(),s(`p`,sr,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,cr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,lr,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.status`)),1)]),default:p(()=>[e(`p`,ur,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(g(),s(`p`,dr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,Wn,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(C,{icon:`fa-regular fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.status.pending`)),1)]),default:p(()=>[e(`p`,Gn,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var pr=v({name:`SeedanceRecentPanel`,components:{TaskPreview:J(Nn,[[`render`,fr],[`__scopeId`,`data-v-f340ebf6`]]),BotPlaceholder:ye,NoTasks:be,ScrollList:he},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedance?.tasks,items:this.$store.state.seedance?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),mr={key:0},hr={key:2,class:`w-full h-full flex items-center justify-center`};function gr(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`,mr,[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`,hr,[a(v)])):o(``,!0)],64)}var _r=v({name:`SeedanceIndex`,components:{ConfigPanel:Mn,Layout:Ae,RecentPanel:J(pr,[[`render`,gr]])},mixins:[U],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.seedance?.status?.getApplications===z.Request},tasksLoading(){return this.$store.state.seedance?.status?.getTasks===z.Request||this.fetchingTasks},credential(){return this.$store.state.seedance?.credential},config(){return this.$store.state.seedance?.config},tasks(){return this.$store.state.seedance?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ge({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`seedance/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`seedance/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!W(this.uploadTracker,e=>this.$t(e),e=>K.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.images)){e.images=e.images.filter(e=>!!e?.url);let t=e.images.some(e=>e?.role===`first_frame`),n=e.images.some(e=>e?.role===`last_frame`);!t&&n&&(e.images=e.images.map(e=>e?.role===`last_frame`?{...e,role:`first_frame`}:e))}let t=Array.isArray(e?.images)&&e.images.length>0;if(!t&&`images`in e&&delete e.images,`service_tier`in e&&delete e.service_tier,e?.model&&!P[e.model]){K.warning(this.$t(`seedance.message.modelUnsupported`));return}let n=F(e?.model);if(n.requiresImage&&!t){K.warning(this.$t(`seedance.message.modelRequiresImage`));return}if(!n.acceptsImage&&t){K.warning(this.$t(`seedance.message.modelRejectsImage`));return}if(!n.acceptsText&&!t){K.warning(this.$t(`seedance.message.modelRequiresImage`));return}!n.acceptsAudio&&e.generate_audio&&(e.generate_audio=!1),!n.acceptsReturnLastFrame&&e.return_last_frame&&(e.return_last_frame=!1),!n.acceptsLastFrame&&t&&(e.images=e.images.filter(e=>e?.role!==`last_frame`)),n.acceptsReferenceAudio&&Array.isArray(e?.audios)&&(e.audios=e.audios.filter(e=>e?.url)),(!n.acceptsReferenceAudio||!Array.isArray(e?.audios)||e.audios.length===0)&&delete e.audios,n.acceptsReferenceVideo&&Array.isArray(e?.videos)&&(e.videos=e.videos.filter(e=>e?.url)),(!n.acceptsReferenceVideo||!Array.isArray(e?.videos)||e.videos.length===0)&&delete e.videos,!n.acceptsReferenceImage&&Array.isArray(e?.images)&&(e.images=e.images.filter(e=>e?.role!==`reference_image`),e.images.length===0&&delete e.images);let r=Array.isArray(e?.images)&&e.images.some(e=>e?.role===`reference_image`);if(Array.isArray(e?.audios)&&e.audios.length>0&&!r){K.warning(this.$t(`seedance.message.audioRequiresReferenceImage`));return}let i={...e,async:!0};if(!ue())return;let a=this.credential?.token;if(!a){console.error(`no token specified`);return}K.info(this.$t(`seedance.message.startingTask`)),le(`seedance`,de.generate(i,{token:a})).then(()=>{K.success(this.$t(`seedance.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?K.error(this.$t(`seedance.message.usedUp`)):K.error(this.$t(`seedance.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function vr(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 yr=J(_r,[[`render`,vr]]);export{yr 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-BwvQE0y9.js";import{t as x}from"./upload-apWgQqFq.js";import{t as S}from"./tooltip-CHp2io7Q.js";import{t as C}from"./image-BMwdLSS_.js";import{t as w}from"./alert-CILdPemv.js";import{t as T}from"./drawer-C1zUg5Fu.js";import{t as E}from"./input-number-Cx4ggens.js";import{t as D}from"./switch-C7qQ5VvN.js";import{$t as O,Gt as k,Ht as A,Jt as ee,Kt as te,Qt as ne,Rt as re,Ut as j,Vt as M,Wt as N,Xt as P,Yt as ie,Zt as ae,an as F,en as oe,nn as I,qt as se,rn as L,tn as R,zt as ce}from"./constants-C59L9TVQ.js";import{Ht as z,Kr as B,Kt as V,Ut as H,Vt as U,Wt as W,Yr as G,_i as K,bn as le,en as ue,j as q,oi as J,or as de}from"./index-BJQ3dna_.js";import{t as Y}from"./index.es-D-kzsGJh.js";import{t as fe}from"./CopyToClipboard-BxUQkbS4.js";import{t as X}from"./ImagePreview-BCZrB_sX.js";import{n as pe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as me}from"./Consumption-CYy4e1le.js";import{i as Z,n as he,t as ge}from"./pagination-RqAx2rJg.js";import{t as _e}from"./VideoPlayer-CkHFHCTB.js";import{t as ve}from"./ApiCodeButton-DTODAyG2.js";import{t as ye}from"./BotPlaceholder-BxjZQnpl.js";import{t as be}from"./NoTasks-NHnTSM5H.js";import{t as xe}from"./PromptTextarea-D5c9w02b.js";import{t as Se}from"./ImageWrapper-BlHjexof.js";import{n as Ce,t as we}from"./VideoPreview-BkUVfl_p.js";var Te=v({name:`LayoutSeedance`,components:{ElDrawer:T,ElButton:K,FontAwesomeIcon:Y},mixins:[pe]}),Ee={class:`main flex flex-row flex-1`},De={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Oe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ke(t,n,r,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,Ee,[e(`div`,De,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Oe,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{icon:`fa-solid fa-magic`})]),_:1},512),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Ae=q(Te,[[`render`,ke],[`__scopeId`,`data-v-ec312952`]]),je=v({name:`SeedancePromptInput`,components:{PromptTextarea:xe},computed:{prompt:{get(){return this.$store.state.seedance?.config?.prompt},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Me(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(`seedance.name.prompt`),info:e.$t(`seedance.description.prompt`),placeholder:e.$t(`seedance.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ne=q(je,[[`render`,Me]]),Pe=v({name:`SeedanceModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[{value:se,label:this.$t(`seedance.model.seedance20`)},{value:ee,label:this.$t(`seedance.model.seedance20Fast`)},{value:ie,label:this.$t(`seedance.model.seedance20Mini`)},{value:te,label:this.$t(`seedance.model.seedance15pro`)},{value:N,label:this.$t(`seedance.model.seedance10pro`)},{value:k,label:this.$t(`seedance.model.seedance10proFast`)},{value:j,label:this.$t(`seedance.model.seedance10liteT2v`)},{value:A,label:this.$t(`seedance.model.seedance10liteI2v`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.model},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,model:e})}}},mounted(){this.value||=re}}),Fe={class:`field`},Ie={class:`label`},Le={class:`box`},Re={class:`title font-bold`};function ze(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Fe,[e(`div`,Ie,[e(`div`,Le,[e(`h2`,Re,i(t.$t(`seedance.name.model`)),1),a(m,{content:t.$t(`seedance.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(`seedance.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 Be=q(Pe,[[`render`,ze],[`__scopeId`,`data-v-deb4c429`]]),Ve=v({name:`SeedanceDurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},options(){let e=[];this.capability.supportsAutoDuration&&e.push({value:-1,label:`${this.$t(`seedance.placeholder.seed`)} (-1)`});for(let t=this.capability.minDuration;t<=this.capability.maxDuration;t++)e.push({value:t,label:`${t}s`});return e},value:{get(){return this.$store.state.seedance?.config?.duration},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,duration:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=5},methods:{clampValue(){let e=this.value;e!==void 0&&!(e===-1&&this.capability.supportsAutoDuration)&&(e<this.capability.minDuration||e>this.capability.maxDuration)&&(this.value=5)}}}),He={class:`field`},Ue={class:`label`},We={class:`box`},Ge={class:`title font-bold`};function Ke(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,He,[e(`div`,Ue,[e(`div`,We,[e(`h2`,Ge,i(t.$t(`seedance.name.duration`)),1),a(m,{content:t.$t(`seedance.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(`seedance.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 qe=q(Ve,[[`render`,Ke],[`__scopeId`,`data-v-d61cc21b`]]),Q={[I]:0,[L]:1,[R]:2,"4k":3},Je=v({name:`SeedanceResolutionSelector`,components:{InfoIcon:Z,ElTooltip:S},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},options(){let e=[{value:I,label:`480p`},{value:L,label:`720p`},{value:R,label:`1080p`},{value:`4k`,label:`4k`}],t=Q[this.capability.maxResolution]??Q[`1080p`];return e.map(e=>({...e,disabled:Q[e.value]>t}))},value:{get(){return this.$store.state.seedance?.config?.resolution},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,resolution:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=this.capability.defaultResolution||`720p`},methods:{onSelect(e){e.disabled||(this.value=e.value)},clampValue(){let e=this.value,t=this.options.find(t=>t.value===e);(!e||t&&t.disabled)&&(this.value=this.capability.defaultResolution||`720p`)}}}),Ye={class:`resolution`},Xe={class:`header`},Ze={class:`title font-bold`},Qe={class:`items`},$e=[`onClick`];function et(t,r,o,u,d,m){let _=l(`info-icon`),v=l(`el-tooltip`);return g(),s(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`seedance.name.resolution`)),1),a(_,{content:t.$t(`seedance.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,Qe,[(g(!0),s(c,null,h(t.options,r=>(g(),f(v,{key:r.value,content:t.$t(`seedance.message.resolutionNotSupported`),disabled:!r.disabled,placement:`top`},{default:p(()=>[e(`div`,{class:n([`item`,{active:t.value===r.value,disabled:r.disabled}]),onClick:e=>t.onSelect(r)},i(r.label),11,$e)]),_:2},1032,[`content`,`disabled`]))),128))])])}var tt=q(Je,[[`render`,et],[`__scopeId`,`data-v-db7e8aff`]]),nt=v({name:`SeedanceRatioSelector`,components:{InfoIcon:Z},computed:{options(){return[{value:ae,label:`16:9`,w:32,h:18},{value:O,label:`9:16`,w:18,h:32},{value:`4:3`,label:`4:3`,w:28,h:21},{value:`3:4`,label:`3:4`,w:21,h:28},{value:`1:1`,label:`1:1`,w:24,h:24},{value:ne,label:`21:9`,w:34,h:14},{value:oe,label:this.$t(`seedance.ratio.adaptive`),w:0,h:0}]},value:{get(){return this.$store.state.seedance?.config?.ratio},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,ratio:e})}}},mounted(){this.value||=ce}}),rt={class:`ratio`},it={class:`header`},at={class:`title font-bold`},ot={class:`items`},st=[`onClick`],ct={class:`preview`},lt={key:1,class:`rect rect-auto`},ut={class:`name`};function dt(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,rt,[e(`div`,it,[e(`h2`,at,i(t.$t(`seedance.name.ratio`)),1),a(p,{content:t.$t(`seedance.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,ot,[(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`,ct,[r.w&&r.h?(g(),s(`div`,{key:0,class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)):(g(),s(`div`,lt,`A`))]),e(`div`,ut,i(r.label),1)],10,st))),128))])])}var ft=q(nt,[[`render`,dt],[`__scopeId`,`data-v-8ddec2dd`]]),pt=v({name:`SeedanceGenerateAudioSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{isSupported(){let e=this.$store.state.seedance?.config?.model;return F(e).acceptsAudio},value:{get(){return this.$store.state.seedance?.config?.generate_audio??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,generate_audio:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),mt={key:0,class:`field`},ht={class:`label`},gt={class:`box`},_t={class:`title font-bold`},vt={class:`value`};function yt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-switch`);return t.isSupported?(g(),s(`div`,mt,[e(`div`,ht,[e(`div`,gt,[e(`h2`,_t,i(t.$t(`seedance.name.generateAudio`)),1),a(f,{content:t.$t(`seedance.description.generateAudio`),class:`info`},null,8,[`content`])])]),e(`div`,vt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):o(``,!0)}var bt=q(pt,[[`render`,yt],[`__scopeId`,`data-v-df51dfbd`]]),xt=v({name:`SeedanceCameraFixedSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{value:{get(){return this.$store.state.seedance?.config?.camerafixed??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,camerafixed:e})}}},mounted(){this.$store.state.seedance?.config?.camerafixed===void 0&&(this.value=!1)}}),St={class:`field`},Ct={class:`label`},wt={class:`box`},Tt={class:`title font-bold`},Et={class:`value`};function Dt(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,St,[e(`div`,Ct,[e(`div`,wt,[e(`h2`,Tt,i(t.$t(`seedance.name.cameraFixed`)),1),a(d,{content:t.$t(`seedance.description.cameraFixed`),class:`info`},null,8,[`content`])])]),e(`div`,Et,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])}var Ot=q(xt,[[`render`,Dt],[`__scopeId`,`data-v-ae777d61`]]),kt=v({name:`SeedanceFirstFrameImage`,components:{ElUpload:x,ElButton:K,InfoIcon:Z,FontAwesomeIcon:Y,ImagePreview:X},mixins:[W,z],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsImage"(e){e||(this.fileList=[],this.onSetFirstFrameUrl())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetFirstFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`first_frame`);e&&t.push({url:e,role:`first_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetFirstFrameUrl()},async onRemove(){this.onSetFirstFrameUrl()}}}),At={key:0,class:`relative`},jt={class:`flex justify-between`},Mt={class:`flex justify-start items-center`},Nt={class:`text-sm font-bold`},Pt={key:0,class:`required-badge`};function Ft(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsImage?(g(),s(`div`,At,[e(`div`,jt,[e(`div`,Mt,[e(`span`,Nt,i(t.$t(`seedance.name.firstFrame`)),1),t.capability.requiresImage?(g(),s(`span`,Pt,i(t.$t(`seedance.name.required`)),1)):o(``,!0),a(h,{content:t.$t(`seedance.description.firstFrame`)},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,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var It=q(kt,[[`render`,Ft],[`__scopeId`,`data-v-e2597f23`]]),Lt=v({name:`SeedanceLastFrameImage`,components:{ElUpload:x,ElButton:K,ImagePreview:X,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[W,z],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsLastFrame"(e){e||(this.fileList=[],this.onSetLastFrameUrl())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetLastFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`last_frame`);e&&t.push({url:e,role:`last_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetLastFrameUrl()},async onRemove(){this.onSetLastFrameUrl()}}}),Rt={key:0,class:`relative`},zt={class:`flex justify-between`},Bt={class:`flex justify-start items-center`},Vt={class:`text-sm font-bold`};function Ht(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsLastFrame?(g(),s(`div`,Rt,[e(`div`,zt,[e(`div`,Bt,[e(`span`,Vt,i(t.$t(`seedance.name.lastFrame`)),1),a(h,{content:t.$t(`seedance.description.lastFrame`)},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,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var Ut=q(Lt,[[`render`,Ht],[`__scopeId`,`data-v-3a191e51`]]),Wt=v({name:`SeedanceReferenceImage`,components:{ElUpload:x,ElButton:K,InfoIcon:Z,FontAwesomeIcon:Y,ImagePreview:X},mixins:[W,z],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceImage"(e){e||(this.fileList=[],this.onSetReferenceImageUrls())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetReferenceImageUrls(){let e=(this.urls||[]).filter(Boolean),t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`reference_image`);e.forEach(e=>t.push({url:e,role:`reference_image`})),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetReferenceImageUrls()},async onRemove(){this.onSetReferenceImageUrls()}}}),Gt={key:0,class:`relative`},Kt={class:`flex justify-between`},qt={class:`flex justify-start items-center`},Jt={class:`text-sm font-bold`};function Yt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsReferenceImage?(g(),s(`div`,Gt,[e(`div`,Kt,[e(`div`,qt,[e(`span`,Jt,i(t.$t(`seedance.name.referenceImage`)),1),a(h,{content:t.$t(`seedance.description.referenceImage`)},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,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var Xt=q(Wt,[[`render`,Yt],[`__scopeId`,`data-v-230a67f6`]]),Zt=v({name:`SeedanceReferenceAudio`,components:{ElUpload:x,ElButton:K,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[z],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceAudio"(e){e||(this.fileList=[],this.onSetReferenceAudios())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetReferenceAudios(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,audios:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceAudios()},async onRemove(){this.onSetReferenceAudios()}}}),Qt={key:0,class:`relative`},$t={class:`flex justify-between`},en={class:`flex justify-start items-center`},tn={class:`text-sm font-bold`};function nn(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`font-awesome-icon`),_=l(`el-button`),v=l(`el-upload`);return t.capability.acceptsReferenceAudio?(g(),s(`div`,Qt,[e(`div`,$t,[e(`div`,en,[e(`span`,tn,i(t.$t(`seedance.name.referenceAudio`)),1),a(m,{content:t.$t(`seedance.description.referenceAudio`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.mp3,.wav,.m4a,.aac,.ogg,.flac`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`text`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(h,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var rn=q(Zt,[[`render`,nn],[`__scopeId`,`data-v-49515675`]]),an=v({name:`SeedanceReferenceVideo`,components:{ElUpload:x,ElButton:K,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[z],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return F(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceVideo"(e){e||(this.fileList=[],this.onSetReferenceVideos())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetReferenceVideos(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,videos:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceVideos()},async onRemove(){this.onSetReferenceVideos()}}}),on={key:0,class:`relative`},sn={class:`flex justify-between`},cn={class:`flex justify-start items-center`},ln={class:`text-sm font-bold`};function un(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`font-awesome-icon`),_=l(`el-button`),v=l(`el-upload`);return t.capability.acceptsReferenceVideo?(g(),s(`div`,on,[e(`div`,sn,[e(`div`,cn,[e(`span`,ln,i(t.$t(`seedance.name.referenceVideo`)),1),a(m,{content:t.$t(`seedance.description.referenceVideo`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.mp4,.mov,.webm,.mkv,.avi`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`text`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(h,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var dn=q(an,[[`render`,un],[`__scopeId`,`data-v-b212c474`]]),fn=v({name:`SeedanceReturnLastFrameSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{model(){return this.$store.state.seedance?.config?.model},isSupported(){return F(this.model).acceptsReturnLastFrame},value:{get(){return this.$store.state.seedance?.config?.return_last_frame},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,return_last_frame:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),pn={key:0,class:`field`},mn={class:`label`},hn={class:`box`},gn={class:`title font-bold`},_n={class:`value`};function vn(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-switch`);return t.isSupported?(g(),s(`div`,pn,[e(`div`,mn,[e(`div`,hn,[e(`h2`,gn,i(t.$t(`seedance.name.returnLastFrame`)),1),a(f,{content:t.$t(`seedance.description.returnLastFrame`),class:`info`},null,8,[`content`])])]),e(`div`,_n,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):o(``,!0)}var yn=q(fn,[[`render`,vn],[`__scopeId`,`data-v-edea5451`]]),bn=v({name:`SeedanceSeedInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{value:{get(){let e=this.$store.state.seedance?.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.$store.state.seedance?.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedance/setConfig`,t)}}}}),xn={class:`field`},Sn={class:`label`},Cn={class:`box`},wn={class:`title font-bold`},Tn={class:`value`};function En(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`);return g(),s(`div`,xn,[e(`div`,Sn,[e(`div`,Cn,[e(`h2`,wn,i(t.$t(`seedance.name.seed`)),1),a(d,{content:t.$t(`seedance.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Tn,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])}var Dn=v({name:`SeedanceConfigPanel`,components:{ElButton:K,FontAwesomeIcon:Y,PromptInput:Ne,ModelSelector:Be,DurationSelector:qe,ResolutionSelector:tt,RatioSelector:ft,GenerateAudioSwitch:bt,CameraFixedSwitch:Ot,ReturnLastFrameSwitch:yn,SeedInput:q(bn,[[`render`,En],[`__scopeId`,`data-v-685a9869`]]),FirstFrameImage:It,LastFrameImage:Ut,ReferenceImage:Xt,ReferenceAudio:rn,ReferenceVideo:dn,Consumption:me},emits:[`generate`],computed:{config(){return this.$store.state.seedance?.config},consumption(){return V(this.config,this.service?.cost)},service(){return this.$store.state.seedance?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),On={class:`flex flex-col h-full`},kn={class:`flex-1 overflow-y-auto p-5`},An={class:`flex flex-col items-center justify-center px-5 pb-5`};function jn(t,n,o,c,u,d){let f=l(`prompt-input`),m=l(`model-selector`),h=l(`ratio-selector`),_=l(`resolution-selector`),v=l(`duration-selector`),y=l(`generate-audio-switch`),b=l(`camera-fixed-switch`),x=l(`return-last-frame-switch`),S=l(`seed-input`),C=l(`first-frame-image`),w=l(`last-frame-image`),T=l(`reference-image`),E=l(`reference-audio`),D=l(`reference-video`),O=l(`consumption`),k=l(`font-awesome-icon`),A=l(`el-button`);return g(),s(`div`,On,[e(`div`,kn,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),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`}),a(S,{class:`mb-4`}),a(C,{class:`mb-2`}),a(w,{class:`mb-2`}),a(T,{class:`mb-2`}),a(E,{class:`mb-2`}),a(D,{class:`mb-2`})]),e(`div`,An,[a(O,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(A,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(k,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`seedance.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Mn=q(Dn,[[`render`,jn]]),Nn=v({name:`SeedanceTaskPreview`,components:{ElImage:C,CopyToClipboard:fe,FontAwesomeIcon:Y,ElAlert:w,VideoPlayer:_e,ElTooltip:S,ElButton:K,ImageWrapper:Se,ImagePreview:X,AudioPreview:Ce,VideoPreview:we,ApiCodeButton:ve},props:{modelValue:{type:Object,required:!0}},data(){return{seedanceLogo:M}},computed:{video(){return this.modelValue?.response?.data},apiCodeBody(){let e=this.modelValue?.request;if(!e)return e;let{service_tier:t,...n}=e;return n},promptText(){let e=this.modelValue?.request;if(e?.prompt)return e.prompt;let t=e?.content?.find(e=>e?.type===`text`&&e?.text);return t?.text?t.text:this.video?.prompt},referenceImages(){let e=this.collectImages();if(e.length===0)return[];let t=[],n=e.find(e=>e?.role===`first_frame`);n?.url&&t.push({url:n.url,name:`first-frame`});let r=e.find(e=>e?.role===`last_frame`);return r?.url&&t.push({url:r.url,name:`last-frame`}),e.forEach((e,n)=>{e?.url&&e.role!==`first_frame`&&e.role!==`last_frame`&&t.push({url:e.url,name:e.role||`image-${n}`})}),t},referenceAudios(){let e=this.modelValue?.request,t=(e?.audios??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`audio_url`&&e?.audio_url?.url&&t.push(e.audio_url.url)}),t},referenceVideos(){let e=this.modelValue?.request,t=(e?.videos??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`video_url`&&e?.video_url?.url&&t.push(e.video_url.url)}),t}},methods:{collectImages(){let e=this.modelValue?.request,t=Array.isArray(e?.images)?[...e.images]:[];return(e?.content??[]).forEach(e=>{e?.type===`image_url`&&e?.image_url?.url&&t.push({url:e.image_url.url,role:e.role})}),t},onDownload(e){window.open(e,`_blank`)}}}),Pn={class:`preview`},Fn={class:`left`},In={class:`main`},Ln={class:`bot`},Rn={class:`datetime`},zn={class:`info`},Bn={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Vn={key:1,class:`prompt mt-2`},Hn={key:0},Un={key:1},Wn={key:0,class:n({content:!0})},Gn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Kn={key:1,class:n({content:!0})},qn={key:0,class:`mb-4`},Jn={key:1,class:`mb-4`},Yn={key:2,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},Xn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Zn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Qn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$n={key:0},er={key:1},$={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},nr={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},rr={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ir={key:2,class:n({content:!0})},ar={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},or={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cr={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},lr={key:3,class:n({content:!0})},ur={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function fr(n,u,d,m,_,v){let y=l(`el-image`),b=l(`image-preview`),x=l(`audio-preview`),S=l(`video-preview`),C=l(`font-awesome-icon`),w=l(`copy-to-clipboard`),T=l(`el-alert`),E=l(`video-player`),D=l(`image-wrapper`),O=l(`el-button`),k=l(`el-tooltip`),A=l(`api-code-button`);return g(),s(`div`,Pn,[e(`div`,Fn,[a(y,{src:n.seedanceLogo,class:`avatar`},null,8,[`src`])]),e(`div`,In,[e(`div`,Ln,[r(i(n.$t(`seedance.name.seedanceBot`))+` `,1),e(`span`,Rn,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,zn,[n.referenceImages.length>0||n.referenceAudios.length>0||n.referenceVideos.length>0?(g(),s(`div`,Bn,[(g(!0),s(c,null,h(n.referenceImages,(e,t)=>(g(),f(b,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceAudios,(e,t)=>(g(),f(x,{key:`audio-${t}`,url:e,name:`audio-${t+1}`},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceVideos,(e,t)=>(g(),f(S,{key:`video-${t}`,url:e,name:`video-${t+1}`},null,8,[`url`,`name`]))),128))])):o(``,!0),n.promptText?(g(),s(`p`,Vn,[r(i(n.promptText)+` `,1),n.modelValue?.response?n.video?.status===`processing`||n.video?.status===`pending`?(g(),s(`span`,Un,` - (`+i(n.$t(`seedance.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,Hn,` - (`+i(n.$t(`seedance.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,Kn,[n.video?.video_url?(g(),s(`div`,qn,[a(E,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.last_frame_url?(g(),s(`div`,Jn,[a(D,{src:n.video?.last_frame_url,"raw-src":n.video?.last_frame_url},null,8,[`src`,`raw-src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Yn,[a(k,{class:`box-item`,effect:`dark`,content:n.$t(`seedance.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(O,{type:`info`,size:`small`,class:`btn-action`,onClick:u[0]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`seedance.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(A,{path:`/seedance/videos`,body:n.apiCodeBody},null,8,[`body`])])):o(``,!0),a(T,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,Xn,[a(C,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.video?.duration?(g(),s(`p`,Zn,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.duration`))+`: `+i(n.video?.duration)+`s `,1)])):o(``,!0),n.video?.resolution?(g(),s(`p`,Qn,[a(C,{icon:`fa-solid fa-expand`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.resolution`))+`: `+i(n.video?.resolution)+` `,1),n.video?.ratio?(g(),s(`span`,$n,` · `+i(n.video?.ratio),1)):o(``,!0),n.video?.framespersecond?(g(),s(`span`,er,` · `+i(n.video?.framespersecond)+`fps`,1)):o(``,!0)])):o(``,!0),n.modelValue?.request?.generate_audio?(g(),s(`p`,$,[a(C,{icon:`fa-solid fa-volume-up`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.generateAudio`))+`: `+i(n.$t(`seedance.button.on`)),1)])):o(``,!0),e(`p`,tr,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,nr,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,rr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{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`,ir,[a(T,{closable:!1,class:`failure`},{template:p(()=>[a(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.failure`)),1)]),default:p(()=>[e(`p`,ar,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,or,[a(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(w,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(g(),s(`p`,sr,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,cr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,lr,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.status`)),1)]),default:p(()=>[e(`p`,ur,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(g(),s(`p`,dr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,Wn,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(C,{icon:`fa-regular fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.status.pending`)),1)]),default:p(()=>[e(`p`,Gn,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var pr=v({name:`SeedanceRecentPanel`,components:{TaskPreview:q(Nn,[[`render`,fr],[`__scopeId`,`data-v-f340ebf6`]]),BotPlaceholder:ye,NoTasks:be,ScrollList:he},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedance?.tasks,items:this.$store.state.seedance?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),mr={key:0},hr={key:2,class:`w-full h-full flex items-center justify-center`};function gr(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`,mr,[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`,hr,[a(v)])):o(``,!0)],64)}var _r=v({name:`SeedanceIndex`,components:{ConfigPanel:Mn,Layout:Ae,RecentPanel:q(pr,[[`render`,gr]])},mixins:[H],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.seedance?.status?.getApplications===B.Request},tasksLoading(){return this.$store.state.seedance?.status?.getTasks===B.Request||this.fetchingTasks},credential(){return this.$store.state.seedance?.credential},config(){return this.$store.state.seedance?.config},tasks(){return this.$store.state.seedance?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ge({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`seedance/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`seedance/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!U(this.uploadTracker,e=>this.$t(e),e=>J.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.images)){e.images=e.images.filter(e=>!!e?.url);let t=e.images.some(e=>e?.role===`first_frame`),n=e.images.some(e=>e?.role===`last_frame`);!t&&n&&(e.images=e.images.map(e=>e?.role===`last_frame`?{...e,role:`first_frame`}:e))}let t=Array.isArray(e?.images)&&e.images.length>0;if(!t&&`images`in e&&delete e.images,`service_tier`in e&&delete e.service_tier,e?.model&&!P[e.model]){J.warning(this.$t(`seedance.message.modelUnsupported`));return}let n=F(e?.model);if(n.requiresImage&&!t){J.warning(this.$t(`seedance.message.modelRequiresImage`));return}if(!n.acceptsImage&&t){J.warning(this.$t(`seedance.message.modelRejectsImage`));return}if(!n.acceptsText&&!t){J.warning(this.$t(`seedance.message.modelRequiresImage`));return}!n.acceptsAudio&&e.generate_audio&&(e.generate_audio=!1),!n.acceptsReturnLastFrame&&e.return_last_frame&&(e.return_last_frame=!1),!n.acceptsLastFrame&&t&&(e.images=e.images.filter(e=>e?.role!==`last_frame`)),n.acceptsReferenceAudio&&Array.isArray(e?.audios)&&(e.audios=e.audios.filter(e=>e?.url)),(!n.acceptsReferenceAudio||!Array.isArray(e?.audios)||e.audios.length===0)&&delete e.audios,n.acceptsReferenceVideo&&Array.isArray(e?.videos)&&(e.videos=e.videos.filter(e=>e?.url)),(!n.acceptsReferenceVideo||!Array.isArray(e?.videos)||e.videos.length===0)&&delete e.videos,!n.acceptsReferenceImage&&Array.isArray(e?.images)&&(e.images=e.images.filter(e=>e?.role!==`reference_image`),e.images.length===0&&delete e.images);let r=Array.isArray(e?.images)&&e.images.some(e=>e?.role===`reference_image`);if(Array.isArray(e?.audios)&&e.audios.length>0&&!r){J.warning(this.$t(`seedance.message.audioRequiresReferenceImage`));return}let i={...e,async:!0};if(!ue())return;let a=this.credential?.token;if(!a){console.error(`no token specified`);return}J.info(this.$t(`seedance.message.startingTask`)),de(`seedance`,le.generate(i,{token:a})).then(()=>{J.success(this.$t(`seedance.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?J.error(this.$t(`seedance.message.usedUp`)):J.error(this.$t(`seedance.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function vr(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 yr=q(_r,[[`render`,vr]]);export{yr as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,j as u,mt as d,rt as f,tt as p,z as m}from"./vendor-chart-Dw-P17PN.js";import{r as h,t as g}from"./select-BwvQE0y9.js";import{t as _}from"./upload-apWgQqFq.js";import{t as v}from"./tooltip-CHp2io7Q.js";import{t as y}from"./image-BMwdLSS_.js";import{t as b}from"./alert-CILdPemv.js";import{Jn as x}from"./constants-C59L9TVQ.js";import{Ht as S,Kr as C,Kt as w,Ut as ee,Vt as T,Wt as E,Yr as D,_i as O,en as te,j as k,jn as A,oi as j,or as M}from"./index-BJQ3dna_.js";import{t as N}from"./index.es-D-kzsGJh.js";import{t as P}from"./CopyToClipboard-BxUQkbS4.js";import{t as F}from"./ImagePreview-BCZrB_sX.js";import{t as I}from"./Consumption-CYy4e1le.js";import{i as L,n as R,t as z}from"./pagination-RqAx2rJg.js";import{t as B}from"./VideoPlayer-CkHFHCTB.js";import{t as V}from"./ApiCodeButton-DTODAyG2.js";import{t as H}from"./BotPlaceholder-BxjZQnpl.js";import{t as U}from"./NoTasks-NHnTSM5H.js";import{t as W}from"./Hailuo-D34VgelC.js";import{t as G}from"./PromptTextarea-D5c9w02b.js";var K=m({name:`ModelSelector`,components:{ElSelect:h,ElOption:g},data(){return{}},computed:{options(){return[{value:`minimax-t2v`,label:this.$t(`hailuo.button.model1`)},{value:`minimax-i2v`,label:this.$t(`hailuo.button.model2`)},{value:`minimax-i2v-director`,label:this.$t(`hailuo.button.model3`)}]},value:{get(){return this.$store.state.hailuo?.config?.model},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,model:e})}}},mounted(){this.value||=x}}),q={class:`field`},J={class:`title font-bold`},Y={class:`float-left`};function X(t,n,r,o,m,h){let g=l(`el-option`),_=l(`el-select`);return p(),s(`div`,q,[e(`h2`,J,i(t.$t(`hailuo.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`hailuo.placeholder.select`),clearable:``},{default:d(()=>[(p(!0),s(c,null,f(t.options,t=>(p(),u(g,{key:t.value,label:t.label,value:t.value},{default:d(()=>[e(`span`,Y,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Z=k(K,[[`render`,X],[`__scopeId`,`data-v-a768fbd9`]]),Q=m({name:`StartImageUrlInput`,components:{ElUpload:_,ElButton:O,InfoIcon:L,ImagePreview:F},mixins:[E,S],data(){return{fileList:[],uploadUrl:D()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.hailuo?.config?.first_image_url},set(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){j.warning(this.$t(`hailuo.message.uploadStartImageExceed`))},onError(){j.error(this.$t(`hailuo.message.uploadStartImageError`))},async onRemove(){j.error(this.$t(`hailuo.message.uploadStartImageError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),ne={class:`relative`},re={class:`flex justify-between`},ie={class:`flex justify-start items-center`},ae={class:`text-sm font-bold`};function oe(t,n,c,f,m,h){let g=l(`info-icon`),_=l(`image-preview`),v=l(`el-button`),y=l(`el-upload`);return p(),s(`div`,ne,[e(`div`,re,[e(`div`,ie,[e(`span`,ae,i(t.$t(`hailuo.name.startImageUrl`)),1),a(g,{content:t.$t(`hailuo.description.startImageUrl`),class:`info`},null,8,[`content`])])]),a(y,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,"show-file-list":!0,limit:1,multiple:!1,"list-type":`picture`,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-remove":t.onRemove,"on-success":t.onSuccess,headers:t.headers},{file:d(({file:e})=>[e.url&&e.percentage!==void 0?(p(),u(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:d(()=>[a(v,{size:`small`,type:`primary`,class:`btn btn-upload`,round:``},{default:d(()=>[r(i(t.$t(`hailuo.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])])}var se=k(Q,[[`render`,oe],[`__scopeId`,`data-v-fbf49b06`]]),ce=m({name:`PromptInput`,components:{PromptTextarea:G},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function le(e,t,n,r,i,a){let o=l(`prompt-textarea`);return p(),u(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`hailuo.name.prompt`),info:e.$t(`hailuo.description.prompt`),placeholder:e.$t(`hailuo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ue=m({name:`PresetPanel`,components:{ElButton:O,FontAwesomeIcon:N,PromptInput:k(ce,[[`render`,le]]),StartImageUrlInput:se,ModelSelector:Z,Consumption:I},emits:[`generate`],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return w(this.config,this.service?.cost)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),de={class:`flex flex-col h-full`},fe={class:`flex-1 overflow-y-auto p-5`},pe={class:`flex flex-col items-center justify-center px-5 pb-5`};function me(t,n,c,f,m,h){let g=l(`prompt-input`),_=l(`model-selector`),v=l(`start-image-url-input`),y=l(`consumption`),b=l(`font-awesome-icon`),x=l(`el-button`);return p(),s(`div`,de,[e(`div`,fe,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),t.config?.model===`minimax-i2v`?(p(),u(v,{key:0,class:`mb-2`})):o(``,!0)]),e(`div`,pe,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(p(),u(x,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:d(()=>[a(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`hailuo.button.extend`)),1)]),_:1},8,[`onClick`])):(p(),u(x,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:d(()=>[a(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`hailuo.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var he=k(ue,[[`render`,me]]),ge=m({name:`TaskPreview`,components:{ElImage:y,CopyToClipboard:P,FontAwesomeIcon:N,ElAlert:b,VideoPlayer:B,ElTooltip:v,ElButton:O,ApiCodeButton:V},props:{modelValue:{type:Object,required:!0}},computed:{application(){return this.$store.state.hailuo?.application},config(){return this.$store.state.hailuo?.config},video(){return this.modelValue?.response?.data?.[0]}},methods:{onDownload(e){console.debug(`on download hailuo video`,e),window.open(e,`_blank`)}}}),_e={class:`preview`},ve={class:`left`},ye={class:`main`},be={class:`bot`},xe={class:`datetime`},Se={class:`info`},Ce={key:0,class:`prompt mt-2`},we={key:0},Te={key:1},Ee={key:0,class:n({content:!0,failed:!0})},De={key:0,class:`mb-4`},Oe={key:1,class:n({operations:!0,"mt-2":!0})},ke={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ae={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},je={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Me={key:1,class:n({content:!0})},Ne={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pe={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Fe={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ie={key:2,class:n({content:!0})},Le={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Re(n,c,f,m,h,g){let _=l(`el-image`),v=l(`video-player`),y=l(`el-button`),b=l(`el-tooltip`),x=l(`api-code-button`),S=l(`font-awesome-icon`),C=l(`copy-to-clipboard`),w=l(`el-alert`);return p(),s(`div`,_e,[e(`div`,ve,[a(_,{src:`https://cdn.acedata.cloud/0qg4gp.png`,class:`avatar`})]),e(`div`,ye,[e(`div`,be,[r(i(n.$t(`hailuo.name.hailuoBot`))+` `,1),e(`span`,xe,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Se,[n.modelValue?.request?.prompt?(p(),s(`p`,Ce,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(p(),s(`span`,we,` - (`+i(n.$t(`hailuo.status.pending`))+`) `,1)),n.video?.state===`processing`||n.video?.state===`pending`||n.video?.state===`running`?(p(),s(`span`,Te,` - (`+i(n.$t(`hailuo.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0?(p(),s(`div`,Ee,[n.video?.video_url?(p(),s(`div`,De,[a(v,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?(p(),s(`div`,Oe,[a(b,{class:`box-item`,effect:`dark`,content:n.$t(`hailuo.message.downloadVideo`),placement:`top-start`},{default:d(()=>[n.video?.video_url?(p(),u(y,{key:0,type:`info`,size:`small`,class:`mb-2`,onClick:c[0]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:d(()=>[r(i(n.$t(`hailuo.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(x,{path:`/hailuo/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(w,{closable:!1,class:`mt-2 success`},{default:d(()=>[n.modelValue?.request?.model?(p(),s(`p`,ke,[a(S,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`hailuo.name.model`))+`: `+i(n.modelValue?.request?.model)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])])):o(``,!0),e(`p`,Ae,[a(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(p(),s(`p`,je,[a(S,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`hailuo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.success===!1?(p(),s(`div`,Me,[a(w,{closable:!1,class:`failure`},{template:d(()=>[a(S,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`hailuo.name.failure`)),1)]),default:d(()=>[e(`p`,Ne,[a(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Pe,[a(S,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`hailuo.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(C,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(p(),s(`p`,$,[a(S,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`hailuo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,Fe,[a(S,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`hailuo.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(C,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),n.modelValue?.response?.success===void 0?(p(),s(`div`,Ie,[a(w,{closable:!1,class:`info`},{template:d(()=>[a(S,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`hailuo.name.failure`)),1)]),default:d(()=>[e(`p`,Le,[a(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var ze=m({name:`RecentPanel`,components:{TaskPreview:k(ge,[[`render`,Re],[`__scopeId`,`data-v-53d13da4`]]),BotPlaceholder:H,NoTasks:U,ScrollList:R},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.hailuo?.tasks,items:this.$store.state.hailuo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Be={key:0},Ve={key:2,class:`w-full h-full flex items-center justify-center`};function He(e,t,n,r,i,m){let h=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return p(),s(c,null,[e.tasks?.items===void 0?(p(),s(`div`,Be,[a(h)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(p(),u(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:d(()=>[(p(!0),s(c,null,f(e.tasks?.items,e=>(p(),u(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(p(),s(`div`,Ve,[a(v)])):o(``,!0)],64)}var Ue=m({name:`HailuoIndex`,components:{ConfigPanel:he,Layout:W,RecentPanel:k(ze,[[`render`,He]])},mixins:[ee],inject:[`initialized`],data(){return{task:void 0,job:0,timer:void 0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.hailuo?.status?.getApplications===C.Request},tasksLoading(){return this.$store.state.hailuo?.status?.getTasks===C.Request||this.fetchingTasks},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},application(){return this.$store.state.hailuo.application},tasks(){return this.$store.state.hailuo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await z({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`hailuo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`hailuo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`hailuo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!T(this.uploadTracker,e=>this.$t(e),e=>j.warning(e)))return;let e={...this.config,async:!0};if(!te())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}j.info(this.$t(`hailuo.message.startingTask`)),M(`hailuo`,A.generate(e,{token:t})).then(()=>{j.success(this.$t(`hailuo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?j.error(this.$t(`hailuo.message.usedUp`)):j.error(this.$t(`hailuo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function We(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),f=l(`layout`);return p(),u(f,null,{config:d(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:d(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Ge=k(Ue,[[`render`,We]]);export{Ge as default};
|