@acedatacloud/nexior 3.277.9 → 3.278.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/ApiCodeButton-CXoLQXC2.js +1 -0
- package/dist/assets/{AskUserQuestionCard-BO__kKe-.js → AskUserQuestionCard-CJ6FK-eQ.js} +2 -2
- package/dist/assets/Auth-oy_cDrjB.js +1 -0
- package/dist/assets/Bare-BjzQECGk.js +1 -0
- package/dist/assets/BotPlaceholder-BpLIwwxA.js +1 -0
- package/dist/assets/BottomFooter-CPL1TUJk.js +1 -0
- package/dist/assets/{Callback-Ds0Qhhfa.js → Callback-DZA2XoEn.js} +1 -1
- package/dist/assets/{Console-BvjrA-Id.js → Console-lGda8cJF.js} +1 -1
- package/dist/assets/Consumption-D_CAQaSB.js +1 -0
- package/dist/assets/Conversation-BBLuEQqB.js +3 -0
- package/dist/assets/CopyToClipboard-DG5cx0Ex.js +1 -0
- package/dist/assets/{Detail-Cl54B-QS.js → Detail-LUdxtiDf.js} +2 -2
- package/dist/assets/Extra-C51gCPia.js +1 -0
- package/dist/assets/{FilePreview-CEk-YWC4.js → FilePreview-BFkQVXth.js} +1 -1
- package/dist/assets/Hailuo-DIHiST1a.js +1 -0
- package/dist/assets/History-BGPVkHOY.js +1 -0
- package/dist/assets/ImagePreview-CeyNx3jd.js +1 -0
- package/dist/assets/ImageWrapper-C6BTBymE.js +1 -0
- package/dist/assets/Index-B4luoYiJ.js +1 -0
- package/dist/assets/Index-BFpKx82w.js +1 -0
- package/dist/assets/Index-BIi8lQVb.js +1 -0
- package/dist/assets/{Index-BsuuQ9Qp.js → Index-BJ7bU2Ap.js} +1 -1
- package/dist/assets/Index-BUutMSDI.js +1 -0
- package/dist/assets/Index-Bk_tFQBc.js +2 -0
- package/dist/assets/Index-BpIXOTSD.js +1 -0
- package/dist/assets/Index-BwIw__H4.js +1 -0
- package/dist/assets/Index-C4hy7nVp.js +1 -0
- package/dist/assets/Index-C8N6BHY-.js +1 -0
- package/dist/assets/Index-CPJu847J.js +1 -0
- package/dist/assets/Index-Cc-RhfD0.js +1 -0
- package/dist/assets/Index-CxLS2qO0.js +1 -0
- package/dist/assets/Index-Cz1SEEJn.js +1 -0
- package/dist/assets/Index-D4VgA6LH.js +1 -0
- package/dist/assets/Index-D6ein8tv.js +1 -0
- package/dist/assets/Index-DVoOVUco.js +1 -0
- package/dist/assets/Index-DWMFhERT.js +1 -0
- package/dist/assets/Index-DZZdzKP6.js +1 -0
- package/dist/assets/Index-DaSVJxjM.js +1 -0
- package/dist/assets/Index-DcccGmiE.js +1 -0
- package/dist/assets/Index-DiBqXC2W.js +1 -0
- package/dist/assets/Index-HS9ewrHk.js +1 -0
- package/dist/assets/Index-KKuLrOV7.js +1 -0
- package/dist/assets/{Index-V_h8KuLe.js → Index-aNTiBE8l.js} +1 -1
- package/dist/assets/Index-zXeYOts6.js +1 -0
- package/dist/assets/Invitees-CDdin_zl.js +1 -0
- package/dist/assets/List-C358Vzd4.js +1 -0
- package/dist/assets/{List-BCTIkbqi.js → List-CMovwYjB.js} +1 -1
- package/dist/assets/List-aru9FNfS.js +1 -0
- package/dist/assets/{Login-D8lHpp8_.js → Login-ZkRB_fWm.js} +1 -1
- package/dist/assets/Main-B5RiswqX.js +1 -0
- package/dist/assets/Main-DC6pe9Hl.css +1 -0
- package/dist/assets/Model-CtN4cAoL.js +1 -0
- package/dist/assets/Navigator-DjUbPnUI.js +4 -0
- package/dist/assets/NoTasks-BOopjPtL.js +1 -0
- package/dist/assets/NotFound-m-5oeC2J.js +1 -0
- package/dist/assets/Pagination-CbbWdJIl.js +1 -0
- package/dist/assets/Pay-CgS135WT.js +1 -0
- package/dist/assets/{Player-C-7R8A5A.js → Player-DvgjC7c5.js} +1 -1
- package/dist/assets/Seedance-cdIlG9x0.js +1 -0
- package/dist/assets/Status-CeZgC2Ye.js +1 -0
- package/dist/assets/{Subscribe-Cxb0qpvf.js → Subscribe-Ci-2Fv2D.js} +1 -1
- package/dist/assets/TabSwitcher-be-vKwWY.js +1 -0
- package/dist/assets/{Tts-C-6DTKCA.js → Tts-D28gFP1B.js} +1 -1
- package/dist/assets/VideoPlayer-CD9PlOS8.js +1 -0
- package/dist/assets/{_Uint8Array-0UxlbjS_.js → _Uint8Array-3-KsyGhc.js} +1 -1
- package/dist/assets/{_baseClone-7uTPqT6Z.js → _baseClone-BG8qyJTx.js} +1 -1
- package/dist/assets/{_baseIteratee-Bt4PVrpe.js → _baseIteratee-jiBmvyYc.js} +1 -1
- package/dist/assets/{_initCloneObject-BJVAPsyT.js → _initCloneObject-ClDbGB1c.js} +1 -1
- package/dist/assets/alert-OvnfgMB-.js +1 -0
- package/dist/assets/avatar-BK3H5LlO.js +1 -0
- package/dist/assets/avatar-CTHa5OEM.js +1 -0
- package/dist/assets/{basic-qB2zBf_T.js → basic-D2PYpKX5.js} +1 -1
- package/dist/assets/button-DfsQodL-.js +1 -0
- package/dist/assets/card-DjyfNde2.js +1 -0
- package/dist/assets/castArray-BbtsObcD.js +1 -0
- package/dist/assets/{chat-DnQdfCwY.js → chat-C1EUkJXK.js} +1 -1
- package/dist/assets/checkbox-BAeQdLeW.js +1 -0
- package/dist/assets/{click-outside-DSZqOY28.js → click-outside-Bc_xOTXp.js} +1 -1
- package/dist/assets/{codingBridge-N0BY_pbA.js → codingBridge-DEvwc0PR.js} +1 -1
- package/dist/assets/{codingBridgeNotify-jR2fwnrs.js → codingBridgeNotify-DKoA2JP9.js} +2 -2
- package/dist/assets/collapse-BxNTm00O.js +1 -0
- package/dist/assets/collapse-transition-C9jp2nDh.js +1 -0
- package/dist/assets/{constants-BvG5EAGh.js → constants-DwFseFmM.js} +2 -2
- package/dist/assets/container-BgEH5azS.js +1 -0
- package/dist/assets/{createTaskActions-H9Ak_ksZ.js → createTaskActions-CvBFHmmD.js} +1 -1
- package/dist/assets/date-picker-CiLjAJPo.js +1 -0
- package/dist/assets/{debounce-BY7z7rFy.js → debounce-DDZaE3JE.js} +1 -1
- package/dist/assets/divider-LA__Fty9.js +1 -0
- package/dist/assets/drawer-Dpuj2uIl.js +1 -0
- package/dist/assets/dropdown-CG4l8dKx.js +1 -0
- package/dist/assets/empty-DA4nlQUv.js +1 -0
- package/dist/assets/{esm-BWKCQlE-.js → esm-BqiBebi7.js} +1 -1
- package/dist/assets/esm-CDp0Qf7i.js +1 -0
- package/dist/assets/{esm-C3UFPwEA.js → esm-CWP9r0G2.js} +1 -1
- package/dist/assets/{esm-YSQHICP5.js → esm-CWSmgMpA.js} +3 -3
- package/dist/assets/{esm-DrjL-zKA.js → esm-Cj99PCoU.js} +1 -1
- package/dist/assets/esm-D2sFB5nS.js +2 -0
- package/dist/assets/{esm-DtiDy7oQ.js → esm-DRxku3NW.js} +2 -2
- package/dist/assets/{fish-Dtp6I8Fd.js → fish-BP62Jr0O.js} +1 -1
- package/dist/assets/{flux-Dg2kTyMv.js → flux-CDZygm05.js} +1 -1
- package/dist/assets/{form-D0aSFxDK.js → form-DnBQT-zH.js} +2 -2
- package/dist/assets/{grokvideo-C6jRvGkV.js → grokvideo-C53uzPoZ.js} +1 -1
- package/dist/assets/{hailuo-BBLTKTAc.js → hailuo-CWOkLsy0.js} +1 -1
- package/dist/assets/{headshots-Clf9mqgV.js → headshots-C7l2OtHq.js} +1 -1
- package/dist/assets/image-r_Sil4Yc.js +1 -0
- package/dist/assets/index-1hhw9POE.js +570 -0
- package/dist/assets/{index.browser.esm-D2oXUHNB.js → index.browser.esm-BXdtHnHu.js} +1 -1
- package/dist/assets/{index.es-DInZDd-8.js → index.es-Ds6M0PuH.js} +2 -2
- package/dist/assets/input-number-Bg1zmr12.js +1 -0
- package/dist/assets/{install-ClulZuUd.js → install-CmiepWqE.js} +1 -1
- package/dist/assets/{isEqual-XQKSKR3y.js → isEqual-CE_hv887.js} +1 -1
- package/dist/assets/isPlainObject-Bo35bFi4.js +1 -0
- package/dist/assets/{kling-CIq0k3a9.js → kling-DvkijwuP.js} +1 -1
- package/dist/assets/{luma-BTc_oEx8.js → luma-DC40B8tL.js} +1 -1
- package/dist/assets/{midjourney-CGSfGnTI.js → midjourney-XBP74pFR.js} +1 -1
- package/dist/assets/{nanobanana-Co7IvZDU.js → nanobanana-DHolv0td.js} +1 -1
- package/dist/assets/{openaiimage-CiYgF1oS.js → openaiimage-COmDdgg9.js} +1 -1
- package/dist/assets/{pagination-sho_4mvI.js → pagination-DH5leY8A.js} +3 -3
- package/dist/assets/{pika-DFeGWhry.js → pika--x6r8JlL.js} +1 -1
- package/dist/assets/{pixverse-DPpyC5XF.js → pixverse-B5tqJ_b9.js} +1 -1
- package/dist/assets/popover-Cpr0N2Z1.js +1 -0
- package/dist/assets/{producer-joKKn6M4.js → producer-CrblN48L.js} +1 -1
- package/dist/assets/progress-C3UHYIHi.js +6 -0
- package/dist/assets/{qrart-DmLZ7wWd.js → qrart-Dfku4NkR.js} +1 -1
- package/dist/assets/radio-BmBXySlN.js +1 -0
- package/dist/assets/raf-NSjkkBtT.js +1 -0
- package/dist/assets/{repeat-click-bdfKzhUt.js → repeat-click-DbK3DhkT.js} +1 -1
- package/dist/assets/row-bfsY0Sup.js +1 -0
- package/dist/assets/{runtime-Cvku-lF9.js → runtime-B1Eal4u3.js} +1 -1
- package/dist/assets/{scroll-Dk1pKbmY.js → scroll-ChHyik37.js} +1 -1
- package/dist/assets/scrollbar-DcyQ_b2c.js +1 -0
- package/dist/assets/{seedance-BPVDnit8.js → seedance-BvTouhw7.js} +1 -1
- package/dist/assets/{seedream-1PZNci1g.js → seedream-C0OkbFis.js} +1 -1
- package/dist/assets/select-CxvkoR_I.js +1 -0
- package/dist/assets/{serp-u19n44y7.js → serp-DKGjlmaC.js} +1 -1
- package/dist/assets/skeleton-C4sltx62.js +1 -0
- package/dist/assets/slider-CfcYZR4R.js +1 -0
- package/dist/assets/solana-wallets-CrItVnUL.js +2 -0
- package/dist/assets/solana-wallets-vue-Cfl3r9NB.js +16 -0
- package/dist/assets/{sora-DL1Eu3V_.js → sora-Bk3RvCXZ.js} +1 -1
- package/dist/assets/strings-CaTtp-gD.js +1 -0
- package/dist/assets/{suno-D0R4gb6S.js → suno-Bbnp6P4i.js} +1 -1
- package/dist/assets/switch-BUEiwneZ.js +1 -0
- package/dist/assets/table-lRQt4LGt.js +1 -0
- package/dist/assets/tabs-dRngkdRx.js +1 -0
- package/dist/assets/{taskDrawerMixin-Cr17Yxqk.js → taskDrawerMixin-DEgO_R5H.js} +1 -1
- package/dist/assets/teleport-CVHCI9MK.js +1 -0
- package/dist/assets/{tooltip-C3PYfh8V.js → tooltip-BLwTovWL.js} +1 -1
- package/dist/assets/upload-cn_TUU3N.js +1 -0
- package/dist/assets/{use-aria-B1wQLdcx.js → use-aria-ldhUoRRB.js} +1 -1
- package/dist/assets/use-deprecated-BzKQGDXN.js +1 -0
- package/dist/assets/use-dialog-CLGp3CMB.js +1 -0
- package/dist/assets/{vendor-chart-mdwpew_o.js → vendor-chart-BJCvKk8-.js} +1 -1
- package/dist/assets/{vendor-vue-router-ChMPprnO.js → vendor-vue-router-WDnlh53U.js} +1 -1
- package/dist/assets/{veo-CYfZPVE4.js → veo-Cunbs9e5.js} +1 -1
- package/dist/assets/vnode-BC_9e2sB.js +1 -0
- package/dist/assets/{wan-dwlkdz78.js → wan-GH45xAZP.js} +1 -1
- package/dist/assets/{web-CiJfTemP.js → web-C9aK-R5v.js} +1 -1
- package/dist/assets/{web-_Pa-5yYB.js → web-CG6DXPr0.js} +1 -1
- package/dist/assets/{web-CqJ0KFOe.js → web-CXzkL4Px.js} +1 -1
- package/dist/assets/{web-BNYAxux2.js → web-C_klyBjH.js} +1 -1
- package/dist/assets/{web-BCYCv9_i.js → web-Cx3VD86e.js} +1 -1
- package/dist/assets/{webextrator-CxXqfJm3.js → webextrator-CI0OahQs.js} +1 -1
- package/dist/assets/wechat-CBB0_nqe.js +1 -0
- package/dist/index.html +13 -13
- package/package.json +5 -2
- package/dist/assets/ApiCodeButton-C6gLCf-Z.js +0 -1
- package/dist/assets/Auth-rjG5v1Zu.js +0 -1
- package/dist/assets/Bare-Bv4yJF2-.js +0 -1
- package/dist/assets/BotPlaceholder-C_RrL6-x.js +0 -1
- package/dist/assets/BottomFooter-DYHEXkR8.js +0 -1
- package/dist/assets/Consumption-sxyES3IM.js +0 -1
- package/dist/assets/Conversation-B1LkXj8C.js +0 -3
- package/dist/assets/CopyToClipboard-D8uYio89.js +0 -1
- package/dist/assets/Extra-Bph1prs-.js +0 -1
- package/dist/assets/Hailuo-Du-s8XoS.js +0 -1
- package/dist/assets/History-CehzioRT.js +0 -1
- package/dist/assets/ImagePreview-A5Uxs7St.js +0 -1
- package/dist/assets/ImageWrapper-q6dGYlku.js +0 -1
- package/dist/assets/Index--SVe2gf_.js +0 -1
- package/dist/assets/Index-B7ye1jps.js +0 -1
- package/dist/assets/Index-BFRB5Ecn.js +0 -1
- package/dist/assets/Index-BMZ7QDn4.js +0 -1
- package/dist/assets/Index-BVgjeXqY.js +0 -1
- package/dist/assets/Index-BWmJj-Ec.js +0 -1
- package/dist/assets/Index-BoY2-aI0.js +0 -1
- package/dist/assets/Index-C3FIbYj_.js +0 -1
- package/dist/assets/Index-CMp0mfWb.js +0 -1
- package/dist/assets/Index-CSvFys2c.js +0 -1
- package/dist/assets/Index-CmmpTMc1.js +0 -1
- package/dist/assets/Index-CuP83G9I.js +0 -1
- package/dist/assets/Index-CwCpcpVC.js +0 -1
- package/dist/assets/Index-DAwffrvQ.js +0 -1
- package/dist/assets/Index-DHWhU527.js +0 -1
- package/dist/assets/Index-DY12tQiR.js +0 -1
- package/dist/assets/Index-DlHycozQ.js +0 -1
- package/dist/assets/Index-DpOrn0vY.js +0 -1
- package/dist/assets/Index-DqOVMWDG.js +0 -1
- package/dist/assets/Index-Dqq9aZ6K.js +0 -2
- package/dist/assets/Index-Tsvr1KQ_.js +0 -1
- package/dist/assets/Index-cvsVkl66.js +0 -1
- package/dist/assets/Index-ocSH7ZvZ.js +0 -1
- package/dist/assets/Index-t0Cs_RZ8.js +0 -1
- package/dist/assets/Invitees-RCGTpw5d.js +0 -1
- package/dist/assets/List-BzAI-ui9.js +0 -1
- package/dist/assets/List-Cr7s548x.js +0 -1
- package/dist/assets/Main-BqfD4til.js +0 -1
- package/dist/assets/Main-y41dJXZG.css +0 -1
- package/dist/assets/Model-Bekj6zqJ.js +0 -1
- package/dist/assets/Navigator-dkWMjJ7c.js +0 -4
- package/dist/assets/NoTasks-Ze_beGGE.js +0 -1
- package/dist/assets/NotFound-DdFf8s7r.js +0 -1
- package/dist/assets/Pagination-uSqRcf5u.js +0 -1
- package/dist/assets/Pay-CJG9KOs8.js +0 -1
- package/dist/assets/Seedance-BThH9nJK.js +0 -1
- package/dist/assets/Status-BEBUGjir.js +0 -1
- package/dist/assets/TabSwitcher-fa4ctxOn.js +0 -1
- package/dist/assets/VideoPlayer-DDKrB3TS.js +0 -1
- package/dist/assets/alert-BJj7gY4q.js +0 -1
- package/dist/assets/avatar-B-r-EyXw.js +0 -1
- package/dist/assets/avatar-DJGt2zYX.js +0 -1
- package/dist/assets/button-DWzbdjZV.js +0 -1
- package/dist/assets/card-B1OoUKT4.js +0 -1
- package/dist/assets/castArray-BFcmUPBb.js +0 -1
- package/dist/assets/checkbox-hfJFSY6z.js +0 -1
- package/dist/assets/collapse-ldIH3UFR.js +0 -1
- package/dist/assets/collapse-transition-C7m30vMg.js +0 -1
- package/dist/assets/container-DUnSq7iO.js +0 -1
- package/dist/assets/date-picker-DU59CcgU.js +0 -1
- package/dist/assets/divider-Ba_Z3oBh.js +0 -1
- package/dist/assets/drawer-BvYPSxXh.js +0 -1
- package/dist/assets/dropdown-Dbdq5MEd.js +0 -1
- package/dist/assets/empty-D5eN5M0S.js +0 -1
- package/dist/assets/esm-BNNSASAI.js +0 -2
- package/dist/assets/esm-BWW4nO7I.js +0 -1
- package/dist/assets/image-BIhkq-3S.js +0 -1
- package/dist/assets/index-BbCaZ5EZ.js +0 -570
- package/dist/assets/input-number-B63gxX1G.js +0 -1
- package/dist/assets/isPlainObject-2p88HvQz.js +0 -1
- package/dist/assets/popover-CUhgirVQ.js +0 -1
- package/dist/assets/progress-Djs_fbqu.js +0 -6
- package/dist/assets/radio-IJQsW93X.js +0 -1
- package/dist/assets/raf-Bo8-dFzL.js +0 -1
- package/dist/assets/row-CaRpmAhk.js +0 -1
- package/dist/assets/scrollbar-BkgtdYMt.js +0 -1
- package/dist/assets/select-BxVmNFP6.js +0 -1
- package/dist/assets/skeleton-Cn4UY-T8.js +0 -1
- package/dist/assets/slider-CZsrZNiU.js +0 -1
- package/dist/assets/solana-wallets-Dvz6LEc2.js +0 -2
- package/dist/assets/solana-wallets-vue-nV27NBhX.js +0 -16
- package/dist/assets/strings-DaYxHDzK.js +0 -1
- package/dist/assets/switch-qy9A_eGr.js +0 -1
- package/dist/assets/table-fY8LUehs.js +0 -1
- package/dist/assets/tabs-DwY1eAPe.js +0 -1
- package/dist/assets/teleport-B3tPbGeJ.js +0 -1
- package/dist/assets/upload-B6XSKv2u.js +0 -1
- package/dist/assets/use-deprecated-CPfQu7wa.js +0 -1
- package/dist/assets/use-dialog-Daprv7SC.js +0 -1
- package/dist/assets/vnode-BMVwTmkF.js +0 -1
- package/dist/assets/wechat-iv-pzVEX.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Ut as c,Vt as l,Wt as u,Z as d,dt as f,et as p,k as m,tt as h,ut as g,v as _}from"./vendor-chart-BJCvKk8-.js";import{t as v}from"./button-DfsQodL-.js";import{r as y,t as b}from"./select-CxvkoR_I.js";import{t as x}from"./upload-cn_TUU3N.js";import{t as S}from"./tooltip-BLwTovWL.js";import{t as C}from"./image-r_Sil4Yc.js";import{t as w}from"./alert-OvnfgMB-.js";import{t as T}from"./drawer-Dpuj2uIl.js";import{t as E}from"./switch-BUEiwneZ.js";import{_i as D,cr as O,dr as k,fr as A,gr as j,lr as M,mr as N,pr as ee,ur as P,vr as F}from"./constants-DwFseFmM.js";import{At as I,E as L,Fn as te,Ir as R,Nt as ne,Ot as z,Sr as B,fn as V,jt as H,kr as U,kt as W,yr as G}from"./index-1hhw9POE.js";import{t as K}from"./index.es-Ds6M0PuH.js";import{t as q}from"./CopyToClipboard-DG5cx0Ex.js";import{t as J}from"./ImagePreview-CeyNx3jd.js";import{n as Y}from"./taskDrawerMixin-DEgO_R5H.js";import{t as X}from"./BotPlaceholder-BpLIwwxA.js";import{i as Z,n as re,t as ie}from"./pagination-DH5leY8A.js";import{n as ae,t as oe}from"./NoTasks-BOopjPtL.js";import{t as se}from"./Consumption-D_CAQaSB.js";import{t as ce}from"./ApiCodeButton-CXoLQXC2.js";import{t as Q}from"./VideoPlayer-CD9PlOS8.js";var le=r({name:`LayoutVeo`,components:{ElDrawer:T,ElButton:v,FontAwesomeIcon:K},mixins:[Y]}),ue={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)]`},fe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function pe(e,r,i,a,s,c){let l=h(`font-awesome-icon`),u=h(`el-button`),m=h(`el-drawer`);return d(),t(`div`,ue,[n(`div`,de,[p(e.$slots,`config`,{},void 0,!0)]),n(`div`,fe,[p(e.$slots,`result`,{},void 0,!0)]),f(o(u,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:g(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[_,!e.tasksEmpty]]),o(m,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`350px`},{default:g(()=>[p(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var me=L(le,[[`render`,pe],[`__scopeId`,`data-v-12b82bc3`]]),he=r({name:`ModelSelector`,components:{ElSelect:y,ElOption:b},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`veo2`,label:`veo2`},{value:`veo2-fast`,label:`veo2-fast`},{value:`veo3`,label:`veo3`},{value:`veo3-fast`,label:`veo3-fast`},{value:`veo31-fast`,label:`veo31-fast`},{value:`veo31`,label:`veo31`},{value:`veo31-fast-ingredients`,label:`veo31-fast-ingredients`}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=k}}),ge={class:`field`},_e={class:`title font-bold`};function ve(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,ge,[n(`h2`,_e,u(r.$t(`veo.name.model`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`)},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ye=L(he,[[`render`,ve],[`__scopeId`,`data-v-a59d89c9`]]),be=r({name:`ActionSelector`,components:{ElSelect:y,ElOption:b},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)},{value:`upsample`,label:this.$t(`veo.button.actionUpsample`)},{value:`extend`,label:this.$t(`veo.button.actionExtend`)},{value:`reshoot`,label:this.$t(`veo.button.actionReshoot`)},{value:`object_insert`,label:this.$t(`veo.button.actionObjectInsert`)},{value:`object_remove`,label:this.$t(`veo.button.actionObjectRemove`)}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||=O}}),xe={class:`field`},Se={class:`title font-bold`},Ce={class:`float-left`};function we(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,xe,[n(`h2`,Se,u(r.$t(`veo.name.action`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`),clearable:``},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},{default:g(()=>[n(`span`,Ce,u(e.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Te=L(be,[[`render`,we],[`__scopeId`,`data-v-f4d8785c`]]),Ee=r({name:`TranslationSelector`,components:{ElSwitch:E,InfoIcon:Z},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),De={class:`relative`},Oe={class:`flex justify-between`},ke={class:`flex justify-start items-center`},Ae={class:`text-sm font-bold`},je={class:`flex justify-end items-center`};function Me(e,r,i,a,s,c){let l=h(`info-icon`),f=h(`el-switch`);return d(),t(`div`,De,[n(`div`,Oe,[n(`div`,ke,[n(`span`,Ae,u(e.$t(`veo.name.translation`)),1),o(l,{content:e.$t(`veo.description.translation`)},null,8,[`content`])]),n(`div`,je,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`},null,8,[`modelValue`])])])])}var Ne=L(Ee,[[`render`,Me]]),Pe=r({name:`AspectRatioSelector`,data(){return{options:[{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=M}}),Fe={class:`text-sm font-bold mb-2 block`},Ie={class:`items`},Le=[`onClick`],Re={class:`name`};function ze(r,i,a,o,f,p){return d(),t(`div`,null,[n(`span`,Fe,u(r.$t(`veo.name.ratio`)),1),n(`div`,Ie,[(d(!0),t(s,null,e(r.options,(e,i)=>(d(),t(`div`,{key:i,class:l({active:r.active===i,item:!0}),onClick:t=>r.value=e.value},[n(`div`,{class:l([`preview`,e.label])},[n(`div`,{class:`rect`,style:c({width:e.width+`px`,height:e.height+`px`})},null,4)],2),n(`p`,Re,u(e.label),1)],10,Le))),128))])])}var Be=L(Pe,[[`render`,ze],[`__scopeId`,`data-v-28c472c4`]]),Ve=r({name:`VideoFromInput`,components:{VideoPlayer:Q},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.veo?.config}}}),He={class:`relative`},Ue={class:`flex mb-2`},We={class:`text-sm font-bold`};function Ge(e,r,i,o,s,c){let l=h(`video-player`);return d(),t(`div`,He,[n(`div`,Ue,[n(`span`,We,u(e.$t(`veo.name.action3`)),1)]),n(`div`,null,[e.config?.video_url?(d(),a(l,{key:0,src:e.config?.video_url},null,8,[`src`])):m(``,!0)])])}var Ke=L(Ve,[[`render`,Ge]]),qe=r({name:`VideoIdInput`,components:{ElInput:R},computed:{value:{get(){return this.$store.state.veo?.config?.video_id},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,video_id:e})}}}}),Je={class:`field`},Ye={class:`title font-bold`};function Xe(e,r,i,a,s,c){let l=h(`el-input`);return d(),t(`div`,Je,[n(`h2`,Ye,u(e.$t(`veo.name.videoId`)),1),o(l,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`,type:`text`,placeholder:e.$t(`veo.placeholder.videoId`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var Ze=L(qe,[[`render`,Xe],[`__scopeId`,`data-v-6eba4026`]]),Qe=r({name:`StartEndImage`,components:{ElUpload:x,ElButton:v,InfoIcon:Z,FontAwesomeIcon:K,ImagePreview:J},mixins:[H,W],emits:[`change`],data(){return{fileList:[],uploadUrl:B()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){U.warning(this.$t(`veo.message.uploadReferencesExceed`))},onError(){U.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),$e={class:`relative`},et={class:`flex justify-between`},tt={class:`flex justify-start items-center`},nt={class:`text-sm font-bold`};function rt(e,r,s,c,l,f){let p=h(`info-icon`),_=h(`image-preview`),v=h(`font-awesome-icon`),y=h(`el-button`),b=h(`el-upload`);return d(),t(`div`,$e,[n(`div`,et,[n(`div`,tt,[n(`span`,nt,u(e.$t(`veo.name.startEndImage`)),1),o(p,{content:e.$t(`veo.description.uploadStartEndImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:g(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):m(``,!0)]),default:g(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:g(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var it=L(Qe,[[`render`,rt],[`__scopeId`,`data-v-f9a79b4a`]]),at=r({name:`UpsampleActionSelector`,components:{ElSelect:y,ElOption:b},computed:{options(){return F.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.upsample_action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,upsample_action:e})}}},mounted(){this.value||=ee}}),ot={class:`field`},st={class:`title font-bold`};function ct(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,ot,[n(`h2`,st,u(r.$t(`veo.name.upsampleAction`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`)},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var lt=L(at,[[`render`,ct],[`__scopeId`,`data-v-8b74a7ae`]]),ut=r({name:`ExtendModelSelector`,components:{ElSelect:y,ElOption:b},computed:{options(){return N.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){(!this.value||!N.includes(this.value))&&(this.value=P)}}),dt={class:`field`},ft={class:`title font-bold`};function pt(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,dt,[n(`h2`,ft,u(r.$t(`veo.name.model`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`)},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var mt=L(ut,[[`render`,pt],[`__scopeId`,`data-v-cc3f9355`]]),ht=r({name:`MotionTypeSelector`,components:{ElSelect:y,ElOption:b},computed:{options(){return j.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.motion_type},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,motion_type:e})}}},mounted(){this.value||=A}}),gt={class:`field`},_t={class:`title font-bold`};function vt(r,i,c,l,f,p){let m=h(`el-option`),_=h(`el-select`);return d(),t(`div`,gt,[n(`h2`,_t,u(r.$t(`veo.name.motionType`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`veo.placeholder.select`),filterable:``},{default:g(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var yt=L(ht,[[`render`,vt],[`__scopeId`,`data-v-3affff3c`]]),bt=r({name:`ImageMaskInput`,components:{ElInput:R},computed:{value:{get(){return this.$store.state.veo?.config?.image_mask},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,image_mask:e})}}}}),xt={class:`field`},St={class:`title font-bold`};function Ct(e,r,i,a,s,c){let l=h(`el-input`);return d(),t(`div`,xt,[n(`h2`,St,u(e.$t(`veo.name.imageMask`)),1),o(l,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`,type:`text`,placeholder:e.$t(`veo.placeholder.imageMask`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var wt=L(bt,[[`render`,Ct],[`__scopeId`,`data-v-6cc27c68`]]),Tt=r({name:`PromptInput`,components:{PromptTextarea:ae},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Et(e,t,n,r,i,o){let s=h(`prompt-textarea`);return d(),a(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Dt=L(Tt,[[`render`,Et]]),Ot=[`upsample`,`extend`,`reshoot`,`object_insert`,`object_remove`,`get1080p`],kt=[`text2video`,`image2video`,`ingredients2video`],At=r({name:`ConfigPanel`,components:{ElButton:v,Consumption:se,FontAwesomeIcon:K,PromptInput:Dt,ModelSelector:ye,StartEndImage:it,ActionSelector:Te,VideoFromInput:Ke,VideoIdInput:Ze,UpsampleActionSelector:lt,ExtendModelSelector:mt,MotionTypeSelector:yt,ImageMaskInput:wt,TranslationSelector:Ne,AspectRatioSelector:Be},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},consumption(){return ne(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service},isPostProcessing(){return Ot.includes(this.config?.action??``)},isGeneration(){return kt.includes(this.config?.action??``)}},methods:{onGenerate(){this.$emit(`generate`)}}}),jt={class:`flex flex-col h-full`},Mt={class:`flex-1 overflow-y-auto p-5`},Nt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Pt(e,r,c,l,f,p){let _=h(`action-selector`),v=h(`video-from-input`),y=h(`video-id-input`),b=h(`upsample-action-selector`),x=h(`extend-model-selector`),S=h(`prompt-input`),C=h(`motion-type-selector`),w=h(`image-mask-input`),T=h(`translation-selector`),E=h(`aspect-ratio-selector`),D=h(`model-selector`),O=h(`start-end-image`),k=h(`consumption`),A=h(`font-awesome-icon`),j=h(`el-button`);return d(),t(`div`,jt,[n(`div`,Mt,[o(_,{class:`mb-4`}),e.isPostProcessing?(d(),t(s,{key:0},[e.config?.video_url?(d(),a(v,{key:0,class:`mb-4`})):m(``,!0),o(y,{class:`mb-4`})],64)):m(``,!0),e.config?.action===`upsample`?(d(),a(b,{key:1,class:`mb-4`})):m(``,!0),e.config?.action===`extend`?(d(),a(x,{key:2,class:`mb-4`})):m(``,!0),e.config?.action===`extend`?(d(),a(S,{key:3,class:`mb-4`})):m(``,!0),e.config?.action===`reshoot`?(d(),a(C,{key:4,class:`mb-4`})):m(``,!0),e.config?.action===`object_insert`?(d(),a(S,{key:5,class:`mb-4`})):m(``,!0),e.config?.action===`object_insert`||e.config?.action===`object_remove`?(d(),a(w,{key:6,class:`mb-4`})):m(``,!0),e.config?.action===`object_remove`?(d(),a(S,{key:7,class:`mb-4`})):m(``,!0),e.isGeneration?(d(),t(s,{key:8},[o(T,{class:`mb-4`}),o(E,{class:`mb-4`}),o(S,{class:`mb-4`}),e.config?.action===`ingredients2video`?m(``,!0):(d(),a(D,{key:0,class:`mb-4`})),e.config?.action===`image2video`||e.config?.action===`ingredients2video`?(d(),a(O,{key:1,class:`mb-2`})):m(``,!0)],64)):m(``,!0)]),n(`div`,Nt,[o(k,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(j,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:g(()=>[o(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ft=L(At,[[`render`,Pt]]),It=r({name:`TaskPreview`,components:{ElImage:C,CopyToClipboard:q,FontAwesomeIcon:K,ElAlert:w,VideoPlayer:Q,ElTooltip:S,ElButton:v,ApiCodeButton:ce},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onPickAction(e,t,n,r){console.debug(`seed config from preview`,{action:n,upsampleAction:r,response:t}),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:n,video_id:t?.data?.[0]?.id,video_url:t?.data?.[0]?.video_url,...r?{upsample_action:r}:{}})},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Lt={class:`preview`},Rt={class:`left`},zt={class:`main`},Bt={class:`bot`},Vt={class:`datetime`},Ht={class:`info`},Ut={key:0,class:`prompt mt-2`},Wt={key:0},Gt={key:1},Kt={key:0,class:l({content:!0,failed:!0})},qt={key:0,class:`mb-4`},Jt={key:1,class:l({operations:!0,"mt-2":!0})},Yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Xt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Zt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Qt={key:1,class:l({content:!0})},$t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},en={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},nn={key:2,class:l({content:!0})},rn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function on(e,r,s,c,l,f){let p=h(`el-image`),_=h(`video-player`),v=h(`el-button`),y=h(`el-tooltip`),b=h(`api-code-button`),x=h(`font-awesome-icon`),S=h(`copy-to-clipboard`),C=h(`el-alert`);return d(),t(`div`,Lt,[n(`div`,Rt,[o(p,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),n(`div`,zt,[n(`div`,Bt,[i(u(e.$t(`veo.name.veoBot`))+` `,1),n(`span`,Vt,u(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,Ht,[e.modelValue?.request?.prompt?(d(),t(`p`,Ut,[i(u(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?m(``,!0):(d(),t(`span`,Wt,` - (`+u(e.$t(`veo.status.pending`))+`) `,1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state===`running`?(d(),t(`span`,Gt,` - (`+u(e.$t(`veo.status.processing`))+`) `,1)):m(``,!0)])):m(``,!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(d(),t(`div`,Kt,[e.modelValue?.response?.data[0]?.video_url?(d(),t(`div`,qt,[o(_,{src:e.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):m(``,!0),e.modelValue?.response.success?(d(),t(`div`,Jt,[e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:r[0]||=t=>e.onPickAction(t,e.modelValue?.response,`upsample`,`1080p`)},{default:g(()=>[i(u(e.$t(`veo.button.actionUpsample1080p`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:1,type:`info`,size:`small`,class:`btn-action`,onClick:r[1]||=t=>e.onPickAction(t,e.modelValue?.response,`upsample`,`4k`)},{default:g(()=>[i(u(e.$t(`veo.button.actionUpsample4k`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:2,type:`info`,size:`small`,class:`btn-action`,onClick:r[2]||=t=>e.onPickAction(t,e.modelValue?.response,`upsample`,`gif`)},{default:g(()=>[i(u(e.$t(`veo.button.actionUpsampleGif`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:3,type:`info`,size:`small`,class:`btn-action`,onClick:r[3]||=t=>e.onPickAction(t,e.modelValue?.response,`extend`)},{default:g(()=>[i(u(e.$t(`veo.button.actionExtend`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:4,type:`info`,size:`small`,class:`btn-action`,onClick:r[4]||=t=>e.onPickAction(t,e.modelValue?.response,`reshoot`)},{default:g(()=>[i(u(e.$t(`veo.button.actionReshoot`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:5,type:`info`,size:`small`,class:`btn-action`,onClick:r[5]||=t=>e.onPickAction(t,e.modelValue?.response,`object_insert`)},{default:g(()=>[i(u(e.$t(`veo.button.actionObjectInsert`)),1)]),_:1})):m(``,!0),e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:6,type:`info`,size:`small`,class:`btn-action`,onClick:r[6]||=t=>e.onPickAction(t,e.modelValue?.response,`object_remove`)},{default:g(()=>[i(u(e.$t(`veo.button.actionObjectRemove`)),1)]),_:1})):m(``,!0),o(y,{class:`box-item`,effect:`dark`,content:e.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:g(()=>[e.modelValue?.response?.data[0]?.video_url?(d(),a(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:r[7]||=t=>e.onDownload(t,e.modelValue?.response?.data[0]?.video_url)},{default:g(()=>[i(u(e.$t(`veo.button.download`)),1)]),_:1})):m(``,!0)]),_:1},8,[`content`]),o(b,{path:`/veo/videos`,body:e.modelValue?.request},null,8,[`body`])])):m(``,!0),o(C,{closable:!1,class:`mt-2 success`},{default:g(()=>[n(`p`,Yt,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.model`))+`: `+u(e.modelValue?.request?.model),1)]),n(`p`,Xt,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(S,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.elapsed?(d(),t(`p`,Zt,[o(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):m(``,!0)]),_:1})])):m(``,!0),e.modelValue?.response?.success===!1?(d(),t(`div`,Qt,[o(C,{closable:!1,class:`failure`},{template:g(()=>[o(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.failure`)),1)]),default:g(()=>[n(`p`,$t,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(S,{content:e.modelValue?.id},null,8,[`content`])]),n(`p`,en,[o(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.failureReason`))+`: `+u(e.modelValue?.response?.error?.message)+` `,1),o(S,{content:e.modelValue?.response?.error?.message},null,8,[`content`])]),e.modelValue?.elapsed?(d(),t(`p`,$,[o(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):m(``,!0),e.modelValue?.response?.trace_id?(d(),t(`p`,tn,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(S,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):m(``,!0)]),_:1})])):m(``,!0),e.modelValue?.response?.success===void 0?(d(),t(`div`,nn,[o(C,{closable:!1,class:`info`},{template:g(()=>[o(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.failure`)),1)]),default:g(()=>[n(`p`,rn,[o(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(S,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.response?.trace_id?(d(),t(`p`,an,[o(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(e.$t(`veo.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(S,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):m(``,!0)]),_:1})])):m(``,!0)])])}var sn=r({name:`RecentPanel`,components:{TaskPreview:L(It,[[`render`,on],[`__scopeId`,`data-v-9698fe5f`]]),NoTasks:oe,BotPlaceholder:X,ScrollList:re},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),cn={key:0},ln={key:2,class:`w-full h-full flex items-center justify-center`};function un(n,r,i,c,l,u){let f=h(`bot-placeholder`),p=h(`task-preview`),_=h(`scroll-list`),v=h(`no-tasks`);return d(),t(s,null,[n.tasks?.items===void 0?(d(),t(`div`,cn,[o(f)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(d(),a(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:g(()=>[(d(!0),t(s,null,e(n.tasks?.items,(e,t)=>(d(),a(p,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):m(``,!0),n.tasks?.items?.length===0?(d(),t(`div`,ln,[o(v)])):m(``,!0)],64)}var dn=L(sn,[[`render`,un]]),fn=D(`veo`),pn=r({name:`VeoIndex`,components:{ConfigPanel:Ft,Layout:me,RecentPanel:dn},mixins:[I],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===G.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===G.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.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 ie({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(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/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(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!z(this.uploadTracker,e=>this.$t(e),e=>U.warning(e)))return;let e={...this.config,callback_url:fn},t=this.credential?.token;if(!t){console.error(`no token specified`);return}if(e.action===`image2video`&&!(e.image_urls&&e.image_urls.length>0)){U.warning(this.$t(`veo.message.imageRequired`));return}(!e.image_urls||e.image_urls.length===0)&&delete e.image_urls,U.info(this.$t(`veo.message.startingTask`)),te(`veo`,V.generate(e,{token:t})).then(()=>{U.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`veo.message.usedUp`)):U.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function mn(e,t,n,r,i,s){let c=h(`config-panel`),l=h(`recent-panel`),u=h(`layout`);return d(),a(u,null,{config:g(()=>[o(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:g(()=>[o(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var hn=L(pn,[[`render`,mn]]);export{hn as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Ut as c,Vt as l,Wt as u,Z as d,b as f,dt as p,et as m,k as h,tt as g,ut as _,v}from"./vendor-chart-BJCvKk8-.js";import{t as y}from"./button-DfsQodL-.js";import{E as b}from"./use-deprecated-BzKQGDXN.js";import{r as x,t as S}from"./select-CxvkoR_I.js";import{n as C,t as w}from"./tabs-dRngkdRx.js";import{t as T}from"./upload-cn_TUU3N.js";import{t as E}from"./tooltip-BLwTovWL.js";import{t as ee}from"./image-r_Sil4Yc.js";import{t as D}from"./alert-OvnfgMB-.js";import{n as O,r as te}from"./radio-BmBXySlN.js";import{t as ne}from"./drawer-Dpuj2uIl.js";import{t as k}from"./input-number-Bg1zmr12.js";import{t as A}from"./slider-CfcYZR4R.js";import{t as j}from"./switch-BUEiwneZ.js";import{Cr as re,Sr as ie,_i as ae,wr as M,yr as oe}from"./constants-DwFseFmM.js";import{At as se,E as N,Fn as P,Ir as F,Nt as I,Or as L,Ot as R,Pr as ce,Sr as z,jt as B,kr as V,kt as H,pn as U,yr as le}from"./index-1hhw9POE.js";import{t as W}from"./index.es-Ds6M0PuH.js";import{t as ue}from"./CopyToClipboard-DG5cx0Ex.js";import{t as de}from"./FilePreview-BFkQVXth.js";import{t as G}from"./ImagePreview-CeyNx3jd.js";import{n as fe}from"./taskDrawerMixin-DEgO_R5H.js";import{t as pe}from"./BotPlaceholder-BpLIwwxA.js";import{i as K,n as me,t as he}from"./pagination-DH5leY8A.js";import{n as ge,t as _e}from"./NoTasks-BOopjPtL.js";import{t as q}from"./Consumption-D_CAQaSB.js";import{t as ve}from"./ApiCodeButton-CXoLQXC2.js";import{t as ye}from"./VideoPlayer-CD9PlOS8.js";var be=r({name:`LayoutKling`,components:{ElDrawer:ne,ElButton:y,FontAwesomeIcon:W},mixins:[fe]}),xe={class:`main flex flex-row flex-1 min-h-0`},Se={class:`config w-[320px] flex-none h-full flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ce={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function we(e,r,i,a,s,c){let l=g(`font-awesome-icon`),u=g(`el-button`),f=g(`el-drawer`);return d(),t(`div`,xe,[n(`div`,Se,[m(e.$slots,`config`,{},void 0,!0)]),n(`div`,Ce,[m(e.$slots,`result`,{},void 0,!0)]),p(o(u,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:_(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[v,!e.tasksEmpty]]),o(f,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`350px`},{default:_(()=>[m(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Te=N(be,[[`render`,we],[`__scopeId`,`data-v-b87958dc`]]),Ee={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};function J(e,t,n){let r=t||`std`,i=n??5;switch(e){case`kling-v1`:return{text2video:!0,image2video:!0,endImage:i===5,audio:!1,motionControl:i===5};case`kling-v1-6`:case`kling-v2-5-turbo`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:!1,motionControl:!1};case`kling-v2-6`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:r===`pro`,motionControl:!1};case`kling-v2-master`:case`kling-v2-1-master`:return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};case`kling-v3`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:r!==`4k`};case`kling-v3-omni`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1};case`kling-video-o1`:return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1};default:return Ee}}function Y(e,t){if(!e)return[];let n=t.model??e.model,r=t.mode??e.mode,i=t.duration??e.duration;if(!n)return[];let a=J(n,r,i),o=[];return e.end_image_url&&!a.endImage&&o.push({field:`end_image_url`,i18nLabel:`kling.name.endImage`}),e.generate_audio&&!a.audio&&o.push({field:`generate_audio`,i18nLabel:`kling.name.generateAudio`}),e.camera_control?.type&&(!a.motionControl||e.start_image_url)&&o.push({field:`camera_control`,i18nLabel:`kling.name.cameraControl`}),o}function X(e,t){let n={...e};for(let e of t)e.field===`end_image_url`&&(n.end_image_url=void 0),e.field===`generate_audio`&&(n.generate_audio=!1),e.field===`camera_control`&&(n.camera_control=void 0);return n}var De=r({name:`ModelSelector`,components:{ElSelect:x,ElOption:S},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{revertKey:0,options:[{value:`kling-v3`,label:`v3`},{value:`kling-v3-omni`,label:`v3-Omni`},{value:`kling-v2-6`,label:`v2.6`},{value:`kling-v2-5-turbo`,label:`v2.5-Turbo`},{value:`kling-v2-1-master`,label:`v2.1-Master`},{value:`kling-v2-master`,label:`v2-Master`},{value:`kling-v1-6`,label:`v1.6`},{value:`kling-v1`,label:`v1`},{value:`kling-video-o1`,label:`Video-o1`}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(oe)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=Y(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await L.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=X({...t,model:e},n);this.$store.commit(`kling/setConfig`,i),V.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,model:e})}}}),Oe={class:`field`},ke={class:`title font-bold`};function Ae(r,i,o,c,l,f){let p=g(`el-option`),m=g(`el-select`);return d(),t(`div`,Oe,[n(`h2`,ke,u(r.$t(`pika.name.model`)),1),(d(),a(m,{key:r.revertKey,"model-value":r.value,class:`value`,placeholder:r.$t(`pika.placeholder.select`),onChange:r.onChange},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(p,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var je=N(De,[[`render`,Ae],[`__scopeId`,`data-v-04059875`]]),Me=r({name:`ModeSelector`,components:{ElSelect:x,ElOption:S,InfoIcon:K},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},cameraControlSet(){return!!this.$store.state.kling?.config?.camera_control?.type},fourKReason(){return M.includes(this.selectedModel)?this.cameraControlSet?this.$t(`kling.description.mode4kIncompatibleCamera`):``:this.$t(`kling.description.mode4kRequiresV3`)},options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`),disabled:!1,disabledReason:``},{value:`pro`,label:this.$t(`kling.name.modePro`),disabled:!1,disabledReason:``},{value:`4k`,label:this.$t(`kling.name.mode4k`),disabled:!!this.fourKReason,disabledReason:this.fourKReason}]},value(){return this.$store.state.kling?.config?.mode}},watch:{fourKReason(e){e&&this.value===`4k`&&this.applyMode(`std`)}},mounted(){this.value||this.applyMode(`std`)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=Y(t,{mode:e});if(n.length===0){this.applyMode(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await L.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=X({...t,mode:e},n);this.$store.commit(`kling/setConfig`,i),V.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyMode(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,mode:e})}}}),Ne={class:`field`},Pe={class:`header`},Fe={class:`title font-bold`},Ie={key:0,class:`opt-tip`};function Le(r,i,c,f,p,m){let v=g(`info-icon`),y=g(`el-option`),b=g(`el-select`);return d(),t(`div`,Ne,[n(`div`,Pe,[n(`h2`,Fe,u(r.$t(`kling.name.mode`)),1),o(v,{content:r.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(d(),a(b,{key:r.revertKey,"model-value":r.value,class:`value`,placeholder:r.$t(`kling.placeholder.select`),clearable:!0,onChange:r.onChange},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(y,{key:e.value,label:e.label,value:e.value,disabled:e.disabled},{default:_(()=>[n(`span`,{class:l({"opt-disabled":e.disabled})},u(e.label),3),e.disabled&&e.disabledReason?(d(),t(`span`,Ie,u(e.disabledReason),1)):h(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Re=N(Me,[[`render`,Le],[`__scopeId`,`data-v-9a8fa3c5`]]),ze=[3,5,8,10,12,15],Be=[5,10],Ve=r({name:`DurationSelector`,components:{ElSelect:x,ElOption:S,InfoIcon:K},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return M.includes(this.selectedModel)},allowedDurations(){return this.isV3Model?ze:Be},value(){return this.$store.state.kling?.config?.duration??5},selectValue(){let e=this.allowedDurations;return e.includes(this.value)?this.value:e.includes(5)?5:e[0]}},watch:{isV3Model(){this.allowedDurations.includes(this.value)||this.applyDuration(5)}},mounted(){this.$store.state.kling?.config?.duration||this.applyDuration(5)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=Y(t,{duration:e});if(n.length===0){this.applyDuration(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await L.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=X({...t,duration:e},n);this.$store.commit(`kling/setConfig`,i),V.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyDuration(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,duration:e})}}}),He={class:`field`},Ue={class:`control`},We={class:`label`},Ge={class:`title font-bold`};function Ke(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,He,[n(`div`,Ue,[n(`div`,We,[n(`h2`,Ge,u(r.$t(`kling.name.duration`)),1),o(m,{content:r.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(d(),a(v,{key:r.revertKey,"model-value":r.selectValue,class:`value`,placeholder:r.$t(`kling.placeholder.select`),onChange:r.onChange},{default:_(()=>[(d(!0),t(s,null,e(r.allowedDurations,e=>(d(),a(h,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var qe=N(Ve,[[`render`,Ke],[`__scopeId`,`data-v-5ae55e28`]]),Je=r({name:`RatioSelector`,data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug(`set ratio`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||=`1:1`}}),Ye={class:`text-sm font-bold mb-2 block`},Xe={class:`items`},Ze=[`onClick`],Qe={class:`name`};function $e(r,i,a,o,f,p){return d(),t(`div`,null,[n(`span`,Ye,u(r.$t(`kling.name.ratio`)),1),n(`div`,Xe,[(d(!0),t(s,null,e(r.options,(e,i)=>(d(),t(`div`,{key:i,class:l({active:r.active===i,item:!0}),onClick:t=>r.value=e.value},[n(`div`,{class:l([`preview`,e.label])},[n(`div`,{class:`rect`,style:c({width:e.width+`px`,height:e.height+`px`})},null,4)],2),n(`p`,Qe,u(e.label),1)],10,Ze))),128))])])}var et=N(Je,[[`render`,$e],[`__scopeId`,`data-v-cdb14b2f`]]),tt=r({name:`StartImage`,components:{ElUpload:T,ElButton:y,ElTooltip:E,InfoIcon:K,FontAwesomeIcon:W,ImagePreview:G},mixins:[B,H],emits:[`change`],data(){return{fileList:[],uploadUrl:z()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){V.error(this.$t(`kling.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),nt={class:`relative`},rt={class:`flex justify-between`},it={class:`flex justify-start items-center`},at={class:`text-sm font-bold`};function ot(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-tooltip`),x=g(`el-upload`);return d(),t(`div`,nt,[n(`div`,rt,[n(`div`,it,[n(`span`,at,u(e.$t(`kling.name.startImage`)),1),o(p,{content:e.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.reachedLimit,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(b,{content:e.$t(`kling.message.uploadReferencesExceed`),disabled:!e.reachedLimit,placement:`top`},{default:_(()=>[n(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.reachedLimit},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var st=N(tt,[[`render`,ot],[`__scopeId`,`data-v-756dc269`]]),ct=r({name:`EndImage`,components:{ElUpload:T,ElButton:y,ElTooltip:E,ImagePreview:G,InfoIcon:K,FontAwesomeIcon:W},mixins:[B,H],data(){return{fileList:[],uploadUrl:z()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},klingConfig(){return this.$store.state?.kling?.config||{}},endImageSupported(){return J(this.klingConfig.model,this.klingConfig.mode,this.klingConfig.duration).endImage},hasStartImage(){return!!this.klingConfig.start_image_url},uploadDisabled(){return this.reachedLimit||!this.endImageSupported||!this.hasStartImage},uploadTooltip(){return this.endImageSupported?this.hasStartImage?this.reachedLimit?this.$t(`kling.message.uploadReferencesExceed`):``:this.$t(`kling.message.endImageRequiresStart`):this.$t(`kling.message.endImageNotSupported`)},storeValue(){return this.klingConfig.end_image_url},value:{get(){return this.storeValue},set(){}}},watch:{storeValue(e){!e&&this.fileList.length>0&&(this.fileList=[])},hasStartImage(e){!e&&this.storeValue&&(this.fileList=[],this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:void 0}))}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onBeforeUpload(){return this.endImageSupported?this.hasStartImage?!0:(V.warning(this.$t(`kling.message.endImageRequiresStart`)),!1):(V.warning(this.$t(`kling.message.endImageNotSupported`)),!1)},onExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){V.error(this.$t(`kling.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),lt={class:`relative`},ut={class:`flex justify-between`},dt={class:`flex justify-start items-center`},ft={class:`text-sm font-bold`};function pt(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-tooltip`),x=g(`el-upload`);return d(),t(`div`,lt,[n(`div`,ut,[n(`div`,dt,[n(`span`,ft,u(e.$t(`kling.name.endImage`)),1),o(p,{content:e.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"before-upload":e.onBeforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(b,{content:e.uploadTooltip,disabled:!e.uploadDisabled,placement:`top`},{default:_(()=>[n(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.uploadDisabled},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var mt=N(ct,[[`render`,pt],[`__scopeId`,`data-v-c1b257e5`]]),ht=r({name:`CfgScaleSelector`,components:{ElSlider:A,InfoIcon:K,ElInputNumber:k},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug(`set cfg_scale`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||=0}}),gt={class:`flex justify-between`},_t={class:`flex justify-start items-center`},vt={class:`text-sm font-bold`},yt={class:`flex justify-end items-center`},bt={class:`w-full`};function xt(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-input-number`),p=g(`el-slider`);return d(),t(`div`,null,[n(`div`,gt,[n(`div`,_t,[n(`span`,vt,u(e.$t(`kling.name.cfgScale`)),1),o(l,{content:e.$t(`kling.description.cfgScale`)},null,8,[`content`])]),n(`div`,yt,[o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,"controls-position":`right`},null,8,[`modelValue`])])]),n(`div`,bt,[o(p,{modelValue:e.value,"onUpdate:modelValue":r[1]||=t=>e.value=t,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var St=N(ht,[[`render`,xt]]),Ct=r({name:`GenerateAudioSelector`,components:{ElSwitch:j,InfoIcon:K},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},supported(){return!!(M.includes(this.selectedModel)||this.selectedModel===`kling-v2-6`&&this.selectedMode===`pro`)},tooltipContent(){return this.supported?this.$t(`kling.description.generateAudio`):this.$t(`kling.description.generateAudioUnsupported`)},value:{get(){return this.supported?this.$store.state.kling?.config?.generate_audio??!1:!1},set(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,generate_audio:e})}}},watch:{supported(e){!e&&this.$store.state.kling?.config?.generate_audio&&this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,generate_audio:!1})}}}),wt={class:`relative`},Tt={class:`flex justify-between items-center`},Et={class:`flex justify-start items-center`},Dt={class:`text-sm font-bold`};function Ot(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return d(),t(`div`,wt,[n(`div`,Tt,[n(`div`,Et,[n(`span`,Dt,u(e.$t(`kling.name.generateAudio`)),1),o(l,{content:e.tooltipContent},null,8,[`content`])]),o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`,disabled:!e.supported},null,8,[`modelValue`,`disabled`])])])}var kt=N(Ct,[[`render`,Ot]]),At=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],jt=r({name:`CameraControlSelector`,components:{ElSelect:x,ElOption:S,ElSlider:A,ElInputNumber:k,InfoIcon:K},data(){return{configKeys:At}},computed:{typeOptions(){return[{value:``,label:this.$t(`kling.name.cameraTypeNone`)},{value:`simple`,label:this.$t(`kling.name.cameraTypeSimple`)},{value:`down_back`,label:this.$t(`kling.name.cameraTypeDownBack`)},{value:`forward_up`,label:this.$t(`kling.name.cameraTypeForwardUp`)},{value:`left_turn_forward`,label:this.$t(`kling.name.cameraTypeLeftTurnForward`)},{value:`right_turn_forward`,label:this.$t(`kling.name.cameraTypeRightTurnForward`)}]},selectedMode(){return this.$store.state.kling?.config?.mode||``},selectedModel(){return this.$store.state.kling?.config?.model||``},selectedDuration(){return this.$store.state.kling?.config?.duration},motionControlSupported(){return J(this.selectedModel,this.selectedMode,this.selectedDuration).motionControl},hasStartImage(){return!!this.$store.state.kling?.config?.start_image_url},disabled(){return!this.motionControlSupported||this.hasStartImage},tooltipContent(){return this.motionControlSupported?this.hasStartImage?this.$t(`kling.description.cameraControlDisabledImage2Video`):this.$t(`kling.description.cameraControl`):this.$t(`kling.description.cameraControlNotSupported`)},selectedType(){return this.$store.state.kling?.config?.camera_control?.type},selectedTypeRaw:{get(){return this.selectedType??``},set(e){let t=this.$store.state.kling?.config||{};if(!e){let e={...t};delete e.camera_control,this.$store.commit(`kling/setConfig`,e);return}let n=e;this.$store.commit(`kling/setConfig`,{...t,camera_control:{type:n,config:n===`simple`?t.camera_control?.config||{}:void 0}})}},configValues(){return this.$store.state.kling?.config?.camera_control?.config||{}}},watch:{disabled(e){e&&this.selectedType!==void 0&&(this.selectedTypeRaw=``)}},methods:{writeConfig(e,t){let n=this.$store.state.kling?.config||{},r=n.camera_control||{type:`simple`},i={...r.config||{}};t==null?delete i[e]:i[e]=t,this.$store.commit(`kling/setConfig`,{...n,camera_control:{...r,type:`simple`,config:i}})},onSliderChange(e,t){this.writeConfig(e,t)},onNumberChange(e,t){this.writeConfig(e,t)}}}),Mt={class:`field`},Nt={class:`header`},Pt={class:`text-sm font-bold`},Ft={key:0,class:`config-grid`},It={class:`cfg-row-head`},Lt={class:`cfg-name`};function Rt(r,i,c,l,f,p){let m=g(`info-icon`),v=g(`el-option`),y=g(`el-select`),b=g(`el-input-number`),x=g(`el-slider`);return d(),t(`div`,Mt,[n(`div`,Nt,[n(`span`,Pt,u(r.$t(`kling.name.cameraControl`)),1),o(m,{content:r.tooltipContent},null,8,[`content`])]),o(y,{modelValue:r.selectedTypeRaw,"onUpdate:modelValue":i[0]||=e=>r.selectedTypeRaw=e,class:`value`,placeholder:r.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:r.disabled},{default:_(()=>[(d(!0),t(s,null,e(r.typeOptions,e=>(d(),a(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),r.selectedType===`simple`&&!r.disabled?(d(),t(`div`,Ft,[(d(!0),t(s,null,e(r.configKeys,e=>(d(),t(`div`,{key:e,class:`cfg-row`},[n(`div`,It,[n(`span`,Lt,u(r.$t(`kling.name.cc_${e}`)),1),o(b,{modelValue:r.configValues[e],"onUpdate:modelValue":t=>r.configValues[e]=t,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:t=>r.onNumberChange(e,t)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),o(x,{"model-value":r.configValues[e]??0,min:-1,max:1,step:.1,onInput:t=>r.onSliderChange(e,t)},null,8,[`model-value`,`onInput`])]))),128))])):h(``,!0)])}var zt=N(jt,[[`render`,Rt],[`__scopeId`,`data-v-cd896060`]]),Bt=[{groupKey:`cameraMovements`,chipKeys:[`rotateAround`,`stationary`,`handheld`,`zoomOut`,`zoomIn`,`follow`,`panRight`,`tiltUp`,`tiltDown`,`orbit`]},{groupKey:`cameraSpeed`,chipKeys:[`speedSlow`,`speedMedium`,`speedFast`]},{groupKey:`shotType`,chipKeys:[`shotClose`,`shotMedium`,`shotLong`,`shotLowAngle`,`shotHighAngle`,`shotShallowDof`,`shotFront`,`shotProfile`,`shotCloseUp`,`shotDrone`]},{groupKey:`light`,chipKeys:[`lightSunlight`,`lightSoft`,`lightNeon`,`lightWarm`,`lightNature`,`lightCandle`,`lightCityNight`]},{groupKey:`frame`,chipKeys:[`frameRichDetails`,`frameSimpleBg`]},{groupKey:`atmosphere`,chipKeys:[`atmosphereMysterious`,`atmospherePeaceful`,`atmosphereHeartwarming`,`atmosphereVivid`,`atmosphereColorful`]}],Z=`, `;function Vt(e,t){let n=(e||``).trim();return n?n.includes(t)?n:`${n}${Z}${t}`:t}function Q(e,t){if(!e||!t)return e||``;let n=[`${t}${Z}`,`${Z}${t}`,t],r=e;for(let e of n)if(r.includes(e)){r=r.replace(e,``);break}return r.replace(/(?:,\s*)+$/,``).replace(/^(?:,\s*)+/,``)}var Ht=r({name:`InspirationPills`,components:{FontAwesomeIcon:W},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return Bt.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selected(){let e=this.prompt;if(!e)return[];let t=[];for(let n of this.allChipTexts){let r=e.indexOf(n);r!==-1&&t.push({text:n,idx:r})}return t.sort((e,t)=>e.idx-t.idx).map(e=>e.text)}},methods:{onRemove(e){let t=Q(this.prompt,e);this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:t})}}}),Ut={key:0,class:`pills`,role:`list`},Wt={class:`pill-text`},Gt=[`aria-label`,`onClick`];function Kt(r,i,a,c,l,p){let m=g(`font-awesome-icon`);return r.selected.length>0?(d(),t(`div`,Ut,[(d(!0),t(s,null,e(r.selected,e=>(d(),t(`div`,{key:e,class:`pill`,role:`listitem`},[n(`span`,Wt,u(e),1),n(`button`,{type:`button`,class:`pill-remove`,"aria-label":r.$t(`kling.inspiration.removeChip`),onClick:f(t=>r.onRemove(e),[`stop`])},[o(m,{icon:`fa-solid fa-xmark`})],8,Gt)]))),128))])):h(``,!0)}var qt=r({name:`PromptInput`,components:{ElButton:y,FontAwesomeIcon:W,PromptTextarea:ge,InspirationPills:N(Ht,[[`render`,Kt],[`__scopeId`,`data-v-5fc4fa65`]])},emits:[`open-inspiration`],computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Jt(e,t,n,r,s,c){let l=g(`font-awesome-icon`),f=g(`el-button`),p=g(`inspiration-pills`),m=g(`prompt-textarea`);return d(),a(m,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`kling.name.prompt`),info:e.$t(`kling.description.prompt`),placeholder:e.$t(`kling.placeholder.prompt`)},{actions:_(()=>[o(f,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:_(()=>[o(l,{icon:`fa-regular fa-lightbulb`,class:`mr-1`}),i(` `+u(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:_(()=>[o(p)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var Yt=N(qt,[[`render`,Jt],[`__scopeId`,`data-v-c01fc1a6`]]),Xt=r({name:`NegativePromptInput`,components:{ElInput:F,InfoIcon:K},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug(`set prompt`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||=``}}),Zt={class:`field`},Qt={class:`box`},$t={class:`title font-bold`};function en(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-input`);return d(),t(`div`,Zt,[n(`div`,Qt,[n(`h2`,$t,u(e.$t(`kling.name.negativePrompt`)),1),o(l,{content:e.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),o(f,{modelValue:e.prompt,"onUpdate:modelValue":r[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var tn=N(Xt,[[`render`,en],[`__scopeId`,`data-v-de98cf01`]]),nn=r({name:`InspirationDrawer`,components:{ElDrawer:ne,ElButton:y,FontAwesomeIcon:W},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:Bt,Close:b}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit(`update:modelValue`,e)}},drawerSize(){return window.innerWidth<768?`100%`:`380px`},prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return this.groups.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selectedCount(){return this.allChipTexts.filter(e=>this.isSelected(e)).length}},methods:{chipText(e){return this.$t(`kling.inspiration.chip.${e}`)},isSelected(e){return e?this.prompt.includes(e):!1},setPrompt(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})},onToggle(e){e&&(this.isSelected(e)?this.setPrompt(Q(this.prompt,e)):this.setPrompt(Vt(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=Q(e,t);this.setPrompt(e)}}}),rn={class:`drawer-content`},an={class:`drawer-header`},on={class:`title-row`},sn={class:`title`},cn={class:`hint`},ln={key:0,class:`selected-bar`},un={class:`selected-text`},dn={class:`groups`},fn={class:`group-title`},pn={class:`chip-grid`},mn=[`onClick`];function hn(r,c,f,p,m,v){let y=g(`font-awesome-icon`),b=g(`el-button`),x=g(`el-drawer`);return d(),a(x,{modelValue:r.visible,"onUpdate:modelValue":c[1]||=e=>r.visible=e,direction:`rtl`,"with-header":!1,size:r.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:_(()=>[n(`div`,rn,[n(`div`,an,[n(`div`,on,[o(y,{icon:`fa-regular fa-lightbulb`,class:`mr-2`}),n(`span`,sn,u(r.$t(`kling.inspiration.title`)),1)]),o(b,{text:``,icon:r.Close,class:`close-btn`,onClick:c[0]||=e=>r.visible=!1},null,8,[`icon`])]),n(`div`,cn,u(r.$t(`kling.inspiration.hint`)),1),r.selectedCount>0?(d(),t(`div`,ln,[n(`span`,un,u(r.$t(`kling.inspiration.selectedSummary`,{count:r.selectedCount})),1),o(b,{text:``,size:`small`,class:`clear-btn`,onClick:r.onClearSelected},{default:_(()=>[i(u(r.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):h(``,!0),n(`div`,dn,[(d(!0),t(s,null,e(r.groups,i=>(d(),t(`div`,{key:i.groupKey,class:`group`},[n(`div`,fn,u(r.$t(`kling.inspiration.group.${i.groupKey}`)),1),n(`div`,pn,[(d(!0),t(s,null,e(i.chipKeys,e=>(d(),t(`button`,{key:e,type:`button`,class:l({chip:!0,active:r.isSelected(r.chipText(e))}),onClick:t=>r.onToggle(r.chipText(e))},u(r.chipText(e)),11,mn))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var gn=N(nn,[[`render`,hn],[`__scopeId`,`data-v-7d457a69`]]),_n={"kling-v3":`v3`,"kling-v3-omni":`v3-Omni`,"kling-v2-6":`v2.6`,"kling-v2-5-turbo":`v2.5-Turbo`,"kling-v2-1-master":`v2.1-Master`,"kling-v2-master":`v2-Master`,"kling-v1-6":`v1.6`,"kling-v1":`v1`,"kling-video-o1":`Video-o1`},vn={std:`720p`,pro:`1080p`,"4k":`4K`},yn=r({name:`SummaryChip`,components:{FontAwesomeIcon:W},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return _n[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return vn[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),bn={class:`summary-chip`},xn=[`title`],Sn=[`title`],Cn=[`title`],wn=[`title`],Tn=[`title`];function En(e,r,i,a,s,c){let l=g(`font-awesome-icon`);return d(),t(`div`,bn,[n(`span`,{class:`part`,title:e.$t(`kling.name.model`)},u(e.modelLabel),9,xn),r[0]||=n(`span`,{class:`dot`},`·`,-1),n(`span`,{class:`part`,title:e.$t(`kling.name.duration`)},u(e.durationLabel),9,Sn),r[1]||=n(`span`,{class:`dot`},`·`,-1),n(`span`,{class:`part`,title:e.$t(`kling.name.ratio`)},u(e.aspectRatio||`16:9`),9,Cn),r[2]||=n(`span`,{class:`dot`},`·`,-1),n(`span`,{class:`part`,title:e.$t(`kling.name.mode`)},u(e.modeLabel),9,wn),e.generateAudio?(d(),t(`span`,{key:0,class:`audio`,title:e.$t(`kling.name.generateAudio`)},[o(l,{icon:`fa-solid fa-headphones`})],8,Tn)):h(``,!0)])}var Dn=r({name:`ConfigPanel`,components:{ElButton:y,Consumption:q,FontAwesomeIcon:W,PromptInput:Yt,NegativePromptInput:tn,ModelSelector:je,ModeSelector:Re,DurationSelector:qe,RatioSelector:et,StartImage:st,CfgScaleSelector:St,GenerateAudioSelector:kt,CameraControlSelector:zt,InspirationDrawer:gn,SummaryChip:N(yn,[[`render`,En],[`__scopeId`,`data-v-418a6733`]]),EndImage:mt},emits:[`generate`],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},consumption(){return I(this.config,this.service?.cost)},service(){return this.$store.state.kling?.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(e,r,s,c,l,f){let p=g(`prompt-input`),m=g(`model-selector`),h=g(`ratio-selector`),v=g(`start-image`),y=g(`end-image`),b=g(`duration-selector`),x=g(`mode-selector`),S=g(`generate-audio-selector`),C=g(`camera-control-selector`),w=g(`cfg-scale-selector`),T=g(`negative-prompt-input`),E=g(`summary-chip`),ee=g(`consumption`),D=g(`font-awesome-icon`),O=g(`el-button`),te=g(`inspiration-drawer`);return d(),t(`div`,On,[n(`div`,kn,[o(p,{class:`mb-4`,onOpenInspiration:r[0]||=t=>e.inspirationOpen=!0}),o(m,{class:`mb-4`}),o(h,{class:`mb-4`}),o(v,{class:`mb-2`}),o(y,{class:`mb-2`}),o(b,{class:`mb-4`}),o(x,{class:`mb-4`}),o(S,{class:`mb-4`}),o(C,{class:`mb-4`}),o(w,{class:`mb-4`}),o(T,{class:`mb-4`})]),n(`div`,An,[o(E),o(ee,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),e.config?.video_url!==void 0||e.config?.custom?(d(),a(O,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:_(()=>[o(D,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`kling.button.extend`)),1)]),_:1},8,[`onClick`])):(d(),a(O,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:_(()=>[o(D,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`kling.button.generate`)),1)]),_:1},8,[`onClick`]))]),o(te,{modelValue:e.inspirationOpen,"onUpdate:modelValue":r[1]||=t=>e.inspirationOpen=t},null,8,[`modelValue`])])}var Mn=N(Dn,[[`render`,jn]]),Nn=r({name:`MotionImage`,components:{ElUpload:T,ElButton:y,InfoIcon:K,FontAwesomeIcon:W,ImagePreview:G},mixins:[B,H],data(){return{fileList:[],uploadUrl:z()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},mounted(){this.onSetImageUrl()},methods:{onExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){V.error(this.$t(`kling.message.uploadReferencesError`))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,image_url:void 0})},onSetImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,image_url:e})},async onSuccess(){this.onSetImageUrl()}}}),Pn={class:`relative`},Fn={class:`flex justify-between`},In={class:`flex justify-start items-center`},Ln={class:`text-sm font-bold`};function Rn(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`image-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return d(),t(`div`,Pn,[n(`div`,Fn,[n(`div`,In,[n(`span`,Ln,u(e.$t(`kling.name.motionImage`)),1),o(p,{content:e.$t(`kling.description.motionImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(m,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var zn=N(Nn,[[`render`,Rn],[`__scopeId`,`data-v-e52eaf2f`]]),Bn=r({name:`MotionVideo`,components:{ElUpload:T,ElButton:y,InfoIcon:K,FilePreview:de,FontAwesomeIcon:W},mixins:[H],data(){return{fileList:[],uploadUrl:z()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},mounted(){this.onSetVideoUrl()},methods:{onExceed(){V.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){V.error(this.$t(`kling.message.uploadVideoError`))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,video_url:void 0})},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<100;return t?n?!0:(V.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(V.error(this.$t(`kling.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,video_url:e})},async onSuccess(){this.onSetVideoUrl()}}}),Vn={class:`relative`},Hn={class:`flex justify-between`},Un={class:`flex justify-start items-center`},Wn={class:`text-sm font-bold`};function Gn(e,r,s,c,l,f){let p=g(`info-icon`),m=g(`file-preview`),v=g(`font-awesome-icon`),y=g(`el-button`),b=g(`el-upload`);return d(),t(`div`,Vn,[n(`div`,Hn,[n(`div`,Un,[n(`span`,Wn,u(e.$t(`kling.name.motionVideo`)),1),o(p,{content:e.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),o(b,{"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:_(({file:t})=>[t.percentage===void 0?h(``,!0):(d(),a(m,{key:0,url:t.url||t.response?.file_url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:_(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Kn=N(Bn,[[`render`,Gn],[`__scopeId`,`data-v-7019a8d2`]]),qn=r({name:`MotionPromptInput`,components:{ElInput:F,InfoIcon:K},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||``},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),Jn={class:`field`},Yn={class:`box`},Xn={class:`title font-bold`};function Zn(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-input`);return d(),t(`div`,Jn,[n(`div`,Yn,[n(`h2`,Xn,u(e.$t(`kling.name.motionPrompt`)),1),o(l,{content:e.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),o(f,{modelValue:e.prompt,"onUpdate:modelValue":r[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Qn=N(qn,[[`render`,Zn],[`__scopeId`,`data-v-ca9fdbe5`]]),$n=`video`,er=r({name:`CharacterOrientationSelector`,components:{ElRadioGroup:te,ElRadioButton:O,InfoIcon:K},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||$n},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,character_orientation:e})}}},mounted(){this.$store.state.kling?.motionConfig?.character_orientation||(this.value=$n)}}),tr={class:`field`},nr={class:`header`},rr={class:`text-sm font-bold`};function ir(e,r,a,s,c,l){let f=g(`info-icon`),p=g(`el-radio-button`),m=g(`el-radio-group`);return d(),t(`div`,tr,[n(`div`,nr,[n(`span`,rr,u(e.$t(`kling.name.characterOrientation`)),1),o(f,{content:e.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),o(m,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,size:`small`,class:`value`},{default:_(()=>[o(p,{label:`image`},{default:_(()=>[i(u(e.$t(`kling.name.orientationImage`)),1)]),_:1}),o(p,{label:`video`},{default:_(()=>[i(u(e.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var ar=N(er,[[`render`,ir],[`__scopeId`,`data-v-7a91195b`]]),or=`std`,sr=r({name:`MotionModeSelector`,components:{ElSelect:x,ElOption:S,InfoIcon:K},computed:{options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`)},{value:`pro`,label:this.$t(`kling.name.modePro`)}]},value:{get(){return this.$store.state.kling?.motionConfig?.mode||or},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=or)}}),cr={class:`field`},lr={class:`header`},ur={class:`title font-bold`};function dr(r,i,c,l,f,p){let m=g(`info-icon`),h=g(`el-option`),v=g(`el-select`);return d(),t(`div`,cr,[n(`div`,lr,[n(`h2`,ur,u(r.$t(`kling.name.mode`)),1),o(m,{content:r.$t(`kling.description.motionMode`)},null,8,[`content`])]),o(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`kling.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var fr=N(sr,[[`render`,dr],[`__scopeId`,`data-v-1295688c`]]),pr=r({name:`KeepOriginalSoundSelector`,components:{ElSwitch:j,InfoIcon:K},computed:{value:{get(){return(this.$store.state.kling?.motionConfig?.keep_original_sound??`yes`)===`yes`},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,keep_original_sound:e?`yes`:`no`})}}}}),mr={class:`relative`},hr={class:`flex justify-between items-center`},gr={class:`flex justify-start items-center`},_r={class:`text-sm font-bold`};function vr(e,r,i,a,s,c){let l=g(`info-icon`),f=g(`el-switch`);return d(),t(`div`,mr,[n(`div`,hr,[n(`div`,gr,[n(`span`,_r,u(e.$t(`kling.name.keepOriginalSound`)),1),o(l,{content:e.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),o(f,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t},null,8,[`modelValue`])])])}var yr=r({name:`MotionPanel`,components:{ElButton:y,FontAwesomeIcon:W,Consumption:q,MotionImage:zn,MotionVideo:Kn,MotionPromptInput:Qn,CharacterOrientationSelector:ar,MotionModeSelector:fr,KeepOriginalSoundSelector:N(pr,[[`render`,vr]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return I(this.motionConfig,this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){let e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit(`generate`)}}}),br={class:`flex flex-col h-full`},xr={class:`flex-1 overflow-y-auto p-5`},Sr={class:`flex flex-col items-center justify-center px-5 pb-5`};function Cr(e,r,a,s,c,l){let f=g(`motion-image`),p=g(`motion-video`),m=g(`motion-prompt-input`),h=g(`character-orientation-selector`),v=g(`motion-mode-selector`),y=g(`keep-original-sound-selector`),b=g(`consumption`),x=g(`font-awesome-icon`),S=g(`el-button`);return d(),t(`div`,br,[n(`div`,xr,[o(f,{class:`mb-3`}),o(p,{class:`mb-3`}),o(m,{class:`mb-4`}),o(h,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`})]),n(`div`,Sr,[o(b,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(S,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canGenerate,onClick:e.onGenerate},{default:_(()=>[o(x,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var wr=N(yr,[[`render`,Cr]]),Tr=r({name:`KlingTabSwitcher`,components:{ElTabs:C,ElTabPane:w,ElTag:ce},props:{modelValue:{type:String,default:`videos`}},emits:[`update:modelValue`],computed:{tabs(){return[{value:`videos`,label:this.$t(`kling.tab.videoGeneration`)},{value:`motion`,label:this.$t(`kling.tab.motionControl`)},{value:`talking-photo`,label:this.$t(`kling.tab.talkingPhoto`)}]}},methods:{onUpdate(e){this.$emit(`update:modelValue`,e)}}}),Er=[`title`],Dr={class:`text`};function Or(r,o,c,l,f,p){let m=g(`el-tag`),v=g(`el-tab-pane`),y=g(`el-tabs`);return d(),a(y,{"model-value":r.modelValue,class:`kling-tabs`,stretch:``,"onUpdate:modelValue":r.onUpdate},{default:_(()=>[(d(!0),t(s,null,e(r.tabs,e=>(d(),a(v,{key:e.value,name:e.value,disabled:e.disabled},{label:_(()=>[n(`span`,{class:`tab-label`,title:e.disabled?e.disabledReason:void 0},[n(`span`,Dr,u(e.label),1),e.badge?(d(),a(m,{key:0,size:`small`,type:`warning`,class:`badge`},{default:_(()=>[i(u(e.badge),1)]),_:2},1024)):h(``,!0)],8,Er)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var kr=N(Tr,[[`render`,Or],[`__scopeId`,`data-v-fda33e4c`]]),Ar={"kling-v2-6":`v2.6`,"kling-v2-5-turbo":`v2.5-Turbo`,"kling-v2-1-master":`v2.1-Master`,"kling-v2-master":`v2-Master`,"kling-v1-6":`v1.6`,"kling-v1":`v1`},jr=r({name:`TalkingPhotoModelSelector`,components:{ElSelect:x,ElOption:S},data(){return{options:re.map(e=>({value:e,label:Ar[e]||e}))}},computed:{value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.model||`kling-v2-1-master`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,model:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.model||(this.value=ie)}}),Mr={class:`field`},Nr={class:`title font-bold`};function Pr(r,i,c,l,f,p){let m=g(`el-option`),h=g(`el-select`);return d(),t(`div`,Mr,[n(`h2`,Nr,u(r.$t(`kling.name.model`)),1),o(h,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`kling.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Fr=N(jr,[[`render`,Pr],[`__scopeId`,`data-v-cbc83d11`]]),Ir=r({name:`TalkingPhotoModeSelector`,components:{ElSelect:x,ElOption:S},computed:{options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`)},{value:`pro`,label:this.$t(`kling.name.modePro`)}]},value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.mode||`pro`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,mode:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.mode||(this.value=`pro`)}}),Lr={class:`field`},Rr={class:`title font-bold`};function zr(r,i,c,l,f,p){let m=g(`el-option`),h=g(`el-select`);return d(),t(`div`,Lr,[n(`h2`,Rr,u(r.$t(`kling.name.mode`)),1),o(h,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`kling.placeholder.select`)},{default:_(()=>[(d(!0),t(s,null,e(r.options,e=>(d(),a(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Br=r({name:`TalkingPhotoPanel`,components:{ElUpload:T,ElButton:y,ElInput:F,FontAwesomeIcon:W,Consumption:q,InfoIcon:K,ImagePreview:G,ModelSelector:Fr,ModeSelector:N(Ir,[[`render`,zr],[`__scopeId`,`data-v-92525a1d`]])},mixins:[H],emits:[`generate`],data(){return{imageFiles:[],audioFiles:[],uploadUrl:z()+`/api/v1/files/`}},computed:{config(){return this.$store.state.kling?.talkingPhotoConfig||{}},audioUrl(){return this.config.audio_url},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},service(){return this.$store.state.kling?.service},consumption(){return I({...this.config,action:`talking-photo`},this.service?.cost)},canGenerate(){return!!(this.config.image_url&&this.config.audio_url)}},methods:{commit(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.config,...e})},onPromptChange(e){this.commit({prompt:e})},onImageExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onImageError(){V.error(this.$t(`kling.message.uploadReferencesError`))},onImageSuccess(e){this.commit({image_url:e?.file_url})},onImageRemove(e){this.imageFiles.splice(this.imageFiles.indexOf(e),1),this.commit({image_url:void 0})},onAudioExceed(){V.warning(this.$t(`kling.message.uploadAudioExceed`))},onAudioError(){V.error(this.$t(`kling.message.uploadAudioError`))},onAudioSuccess(e){this.commit({audio_url:e?.file_url})},onAudioRemove(){this.commit({audio_url:void 0})},onGenerate(){this.$emit(`generate`)}}}),Vr={class:`flex flex-col h-full`},Hr={class:`flex-1 overflow-y-auto p-5`},Ur={class:`relative mb-4`},Wr={class:`flex justify-start items-center`},Gr={class:`text-sm font-bold`},Kr={class:`relative mb-4`},qr={class:`flex justify-start items-center`},Jr={class:`text-sm font-bold`},Yr=[`src`],Xr={class:`mb-4`},Zr={class:`flex justify-start items-center`},Qr={class:`text-sm font-bold`},$r={class:`flex flex-col items-center justify-center px-5 pb-5`};function ei(e,r,s,c,l,f){let p=g(`model-selector`),m=g(`mode-selector`),v=g(`info-icon`),y=g(`image-preview`),b=g(`font-awesome-icon`),x=g(`el-button`),S=g(`el-upload`),C=g(`el-input`),w=g(`consumption`);return d(),t(`div`,Vr,[n(`div`,Hr,[o(p,{class:`mb-4`}),o(m,{class:`mb-4`}),n(`div`,Ur,[n(`div`,Wr,[n(`span`,Gr,u(e.$t(`kling.name.talkingPhotoImage`)),1),o(v,{content:e.$t(`kling.description.talkingPhotoImage`)},null,8,[`content`])]),o(S,{ref:`imageUploader`,"file-list":e.imageFiles,"onUpdate:fileList":r[0]||=t=>e.imageFiles=t,name:`file`,accept:`.png,.jpg,.jpeg,.webp,.bmp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,headers:e.headers,"on-exceed":e.onImageExceed,"on-error":e.onImageError,"on-success":e.onImageSuccess},{file:_(({file:t})=>[t.url&&t.percentage!==void 0?(d(),a(y,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.onImageRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`])):h(``,!0)]),default:_(()=>[o(x,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:_(()=>[o(b,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`])]),n(`div`,Kr,[n(`div`,qr,[n(`span`,Jr,u(e.$t(`kling.name.talkingPhotoAudio`)),1),o(v,{content:e.$t(`kling.description.talkingPhotoAudio`)},null,8,[`content`])]),o(S,{ref:`audioUploader`,"file-list":e.audioFiles,"onUpdate:fileList":r[1]||=t=>e.audioFiles=t,name:`file`,accept:`.mp3,.wav,.m4a,.aac`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,headers:e.headers,"on-exceed":e.onAudioExceed,"on-error":e.onAudioError,"on-success":e.onAudioSuccess,"on-remove":e.onAudioRemove},{default:_(()=>[o(x,{round:``,type:`primary`,size:`small`,class:`btn`},{default:_(()=>[o(b,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+u(e.$t(`kling.button.uploadAudio`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`]),e.audioUrl?(d(),t(`audio`,{key:0,src:e.audioUrl,controls:``,class:`w-full mt-2`},null,8,Yr)):h(``,!0)]),n(`div`,Xr,[n(`div`,Zr,[n(`span`,Qr,u(e.$t(`kling.name.talkingPhotoPrompt`)),1),o(v,{content:e.$t(`kling.description.talkingPhotoPrompt`)},null,8,[`content`])]),o(C,{"model-value":e.config.prompt,type:`textarea`,rows:2,placeholder:e.$t(`kling.placeholder.talkingPhotoPrompt`),class:`mt-1`,"onUpdate:modelValue":e.onPromptChange},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])])]),n(`div`,$r,[o(w,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(x,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canGenerate,onClick:e.onGenerate},{default:_(()=>[o(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+u(e.$t(`kling.button.generateTalkingPhoto`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var ti=N(Br,[[`render`,ei],[`__scopeId`,`data-v-27261e35`]]),ni=r({name:`TaskPreview`,components:{ElImage:ee,CopyToClipboard:ue,FontAwesomeIcon:W,ElAlert:D,VideoPlayer:ye,ElTooltip:E,ElButton:y,ImagePreview:G,ApiCodeButton:ve},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config},referenceImages(){let e=[],t=this.modelValue?.request?.start_image_url,n=this.modelValue?.request?.end_image_url;return t&&e.push({url:t,name:`start-image`}),n&&e.push({url:n,name:`end-image`}),e}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),ri={class:`preview`},ii={class:`left`},ai={class:`main`},oi={class:`bot`},si={class:`datetime`},ci={class:`info`},li={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},ui={key:1,class:`prompt mt-2`},di={key:0},fi={key:1},pi={key:0,class:l({content:!0,failed:!0})},mi={key:0,class:`mb-4`},hi={key:1,class:l({operations:!0,"mt-2":!0})},gi={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_i={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vi={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},yi={key:1,class:l({content:!0})},bi={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xi={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Si={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ci={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},wi={key:2,class:l({content:!0})},Ti={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ei={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Di(r,c,l,f,p,m){let v=g(`el-image`),y=g(`image-preview`),b=g(`video-player`),x=g(`el-button`),S=g(`el-tooltip`),C=g(`api-code-button`),w=g(`font-awesome-icon`),T=g(`copy-to-clipboard`),E=g(`el-alert`);return d(),t(`div`,ri,[n(`div`,ii,[o(v,{src:`https://cdn.acedata.cloud/qpbbbb.jpg`,class:`avatar`})]),n(`div`,ai,[n(`div`,oi,[i(u(r.$t(`kling.name.klingBot`))+` `,1),n(`span`,si,u(r.$dayjs.format(``+new Date(parseFloat((r.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,ci,[r.referenceImages.length>0?(d(),t(`div`,li,[(d(!0),t(s,null,e(r.referenceImages,(e,t)=>(d(),a(y,{key:t,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128))])):h(``,!0),r.modelValue?.request?.prompt?(d(),t(`p`,ui,[i(u(r.modelValue?.request?.prompt)+` `,1),r.modelValue?.response?h(``,!0):(d(),t(`span`,di,` - (`+u(r.$t(`kling.status.pending`))+`) `,1)),r.modelValue?.response?.state===`submitted`||r.modelValue?.response?.state===`processing`||r.modelValue?.response?.state===`pending`||r.modelValue?.response?.state===`completed`?(d(),t(`span`,fi,` - (`+u(r.$t(`kling.status.processing`))+`) `,1)):h(``,!0)])):h(``,!0)]),r.modelValue?.response?.success===!0?(d(),t(`div`,pi,[r.modelValue?.response.video_url?(d(),t(`div`,mi,[o(b,{src:r.modelValue?.response.video_url},null,8,[`src`])])):h(``,!0),r.modelValue?.response.success?(d(),t(`div`,hi,[o(S,{class:`box-item`,effect:`dark`,content:r.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:_(()=>[r.modelValue?.response.video_url?(d(),a(x,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=e=>r.onDownload(e,r.modelValue?.response.video_url)},{default:_(()=>[i(u(r.$t(`kling.button.download`)),1)]),_:1})):h(``,!0)]),_:1},8,[`content`]),o(C,{path:`/kling/videos`,body:r.modelValue?.request},null,8,[`body`])])):h(``,!0),o(E,{closable:!1,class:`mt-2 success`},{default:_(()=>[n(`p`,gi,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.model`))+`: `+u(r.modelValue?.request?.model),1)]),n(`p`,_i,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(T,{content:r.modelValue?.id},null,8,[`content`])]),r.modelValue?.elapsed?(d(),t(`p`,vi,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0)]),_:1})])):h(``,!0),r.modelValue?.response?.success===!1?(d(),t(`div`,yi,[o(E,{closable:!1,class:`failure`},{template:_(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.failure`)),1)]),default:_(()=>[n(`p`,bi,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(T,{content:r.modelValue?.id},null,8,[`content`])]),n(`p`,xi,[o(w,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.failureReason`))+`: `+u(r.modelValue?.response?.error?.message)+` `,1),o(T,{content:r.modelValue?.response?.error?.message},null,8,[`content`])]),r.modelValue?.elapsed?(d(),t(`p`,Si,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.elapsed`))+`: `+u(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):h(``,!0),r.modelValue?.response?.trace_id?(d(),t(`p`,Ci,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(T,{content:r.modelValue?.response?.trace_id},null,8,[`content`])])):h(``,!0)]),_:1})])):h(``,!0),r.modelValue?.response?.success===void 0?(d(),t(`div`,wi,[o(E,{closable:!1,class:`info`},{template:_(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.failure`)),1)]),default:_(()=>[n(`p`,Ti,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.taskId`))+`: `+u(r.modelValue?.id)+` `,1),o(T,{content:r.modelValue?.id},null,8,[`content`])]),r.modelValue?.response?.trace_id?(d(),t(`p`,Ei,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+u(r.$t(`kling.name.traceId`))+`: `+u(r.modelValue?.response?.trace_id)+` `,1),o(T,{content:r.modelValue?.response?.trace_id},null,8,[`content`])])):h(``,!0)]),_:1})])):h(``,!0)])])}var Oi=r({name:`RecentPanel`,components:{TaskPreview:N(ni,[[`render`,Di],[`__scopeId`,`data-v-c36bfd7f`]]),NoTasks:_e,BotPlaceholder:pe,ScrollList:me},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),ki={key:0},Ai={key:2,class:`w-full h-full flex items-center justify-center`};function ji(n,r,i,c,l,u){let f=g(`bot-placeholder`),p=g(`task-preview`),m=g(`scroll-list`),v=g(`no-tasks`);return d(),t(s,null,[n.tasks?.items===void 0?(d(),t(`div`,ki,[o(f)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(d(),a(m,{key:1,ref:`scrollList`,class:`h-full w-full overflow-y-auto tasks`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:_(()=>[(d(!0),t(s,null,e(n.tasks?.items,e=>(d(),a(p,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):h(``,!0),n.tasks?.items?.length===0?(d(),t(`div`,Ai,[o(v)])):h(``,!0)],64)}var Mi=N(Oi,[[`render`,ji]]),$=ae(`kling`),Ni=r({name:`KlingIndex`,components:{ConfigPanel:Mn,MotionPanel:wr,TalkingPhotoPanel:ti,TabSwitcher:kr,Layout:Te,RecentPanel:Mi},mixins:[se],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===le.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===le.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},talkingPhotoConfig(){return this.$store.state.kling.talkingPhotoConfig},taskType(){return this.$store.state.kling.taskType||`videos`},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await he({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`kling/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`kling/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`kling/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!R(this.uploadTracker,e=>this.$t(e),e=>V.warning(e)))return;let{camera_control:e,...t}=this.config||{},n={...t,callback_url:$};if(!n.video_id&&!t.video_url&&!n.start_image_url&&n.end_image_url){V.warning(this.$t(`kling.message.endImageRequiresStart`));return}n.action||(n.video_id||t.video_url?n.action=`extend`:n.start_image_url?n.action=`image2video`:n.action=`text2video`),n.action===`text2video`&&n.end_image_url&&delete n.end_image_url,e?.type&&(n.camera_control={type:e.type,...e.type===`simple`&&e.config?{config:Object.fromEntries(Object.entries(e.config).filter(([,e])=>e!=null))}:{}});let r=this.credential?.token;if(!r){console.error(`no token specified`);return}V.info(this.$t(`kling.message.startingTask`)),P(`kling`,U.generate(n,{token:r})).then(()=>{V.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?V.error(this.$t(`kling.message.usedUp`)):V.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},async onTabChange(e){e!==this.taskType&&(await this.$store.dispatch(`kling/setTaskType`,e),await this.onGetTasks(),await this.onScrollDown())},async onGenerateMotion(){if(!R(this.uploadTracker,e=>this.$t(e),e=>V.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){V.warning(this.$t(`kling.message.motionMissingInputs`));return}let t={image_url:e.image_url,video_url:e.video_url,character_orientation:e.character_orientation||`video`,mode:e.mode||`std`,keep_original_sound:e.keep_original_sound??`yes`,...e.prompt?{prompt:e.prompt}:{},callback_url:$},n=this.credential?.token;if(!n){console.error(`no token specified`);return}V.info(this.$t(`kling.message.startingTask`)),P(`kling`,U.motion(t,{token:n})).then(()=>{V.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?V.error(this.$t(`kling.message.usedUp`)):V.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},async onGenerateTalkingPhoto(){if(!R(this.uploadTracker,e=>this.$t(e),e=>V.warning(e)))return;let e=this.talkingPhotoConfig||{};if(!e.image_url||!e.audio_url){V.warning(this.$t(`kling.message.talkingPhotoMissingInputs`));return}let t={image_url:e.image_url,audio_url:e.audio_url,model:e.model||`kling-v2-1-master`,mode:e.mode||`pro`,...e.prompt?{prompt:e.prompt}:{},...e.duration?{duration:e.duration}:{},callback_url:$},n=this.credential?.token;if(!n){console.error(`no token specified`);return}V.info(this.$t(`kling.message.startingTask`)),P(`kling`,U.talkingPhoto(t,{token:n})).then(()=>{V.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?V.error(this.$t(`kling.message.usedUp`)):V.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),Pi={class:`flex flex-col h-full`},Fi={class:`flex-1 min-h-0`};function Ii(e,t,r,i,s,c){let l=g(`tab-switcher`),u=g(`config-panel`),f=g(`motion-panel`),p=g(`talking-photo-panel`),m=g(`recent-panel`),v=g(`layout`);return d(),a(v,null,{config:_(()=>[n(`div`,Pi,[o(l,{"model-value":e.taskType,"onUpdate:modelValue":e.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),n(`div`,Fi,[e.taskType===`videos`?(d(),a(u,{key:0,onGenerate:e.onGenerate},null,8,[`onGenerate`])):e.taskType===`motion`?(d(),a(f,{key:1,onGenerate:e.onGenerateMotion},null,8,[`onGenerate`])):e.taskType===`talking-photo`?(d(),a(p,{key:2,onGenerate:e.onGenerateTalkingPhoto},null,8,[`onGenerate`])):h(``,!0)])])]),result:_(()=>[o(m,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Li=N(Ni,[[`render`,Ii]]);export{Li as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Vt as c,Wt as l,Z as u,dt as d,et as f,k as p,tt as m,ut as h,v as g}from"./vendor-chart-BJCvKk8-.js";import{t as _}from"./button-DfsQodL-.js";import{r as v,t as y}from"./select-CxvkoR_I.js";import{t as b}from"./upload-cn_TUU3N.js";import{t as x}from"./tooltip-BLwTovWL.js";import{t as S}from"./image-r_Sil4Yc.js";import{t as C}from"./alert-OvnfgMB-.js";import{n as w,r as T}from"./radio-BmBXySlN.js";import{t as ee}from"./drawer-Dpuj2uIl.js";import{t as E}from"./switch-BUEiwneZ.js";import{Tr as D,_i as O}from"./constants-DwFseFmM.js";import{An as k,At as te,E as A,Fn as j,Nt as M,Ot as N,Sr as P,jt as F,kr as I,kt as L,mn as R,yr as z}from"./index-1hhw9POE.js";import{t as B}from"./index.es-Ds6M0PuH.js";import{t as V}from"./CopyToClipboard-DG5cx0Ex.js";import{t as H}from"./ImagePreview-CeyNx3jd.js";import{n as U}from"./taskDrawerMixin-DEgO_R5H.js";import{t as W}from"./BotPlaceholder-BpLIwwxA.js";import{i as G,n as K,t as q}from"./pagination-DH5leY8A.js";import{n as J,t as Y}from"./NoTasks-BOopjPtL.js";import{t as X}from"./Consumption-D_CAQaSB.js";import{t as Z}from"./ApiCodeButton-CXoLQXC2.js";import{t as Q}from"./vue-plyr-wiIKa-zl.js";var ne=r({name:`LayoutPika`,components:{ElDrawer:ee,ElButton:_,FontAwesomeIcon:B},mixins:[U]}),re={class:`main flex flex-row flex-1`},ie={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function oe(e,r,i,a,s,c){let l=m(`font-awesome-icon`),p=m(`el-button`),_=m(`el-drawer`);return u(),t(`div`,re,[n(`div`,ie,[f(e.$slots,`config`,{},void 0,!0)]),n(`div`,ae,[f(e.$slots,`result`,{},void 0,!0)]),d(o(p,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:h(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!e.tasksEmpty]]),o(_,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`350px`},{default:h(()=>[f(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var se=A(ne,[[`render`,oe],[`__scopeId`,`data-v-cbfdbeb3`]]),ce=r({name:`IngredientsSelector`,components:{ElSwitch:E,InfoIcon:G},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients},set(e){console.debug(`set ingredients`,e),e||this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients:e,ingredients_mode:void 0,image_url:void 0}),this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients:e,model:`2.0`})}}},mounted(){this.value===void 0&&(this.value=!1)}}),le={class:`field`},ue={class:`title font-bold`};function de(e,r,i,a,s,c){let d=m(`el-switch`),f=m(`info-icon`);return u(),t(`div`,le,[n(`h2`,ue,l(e.$t(`pika.name.ingredients`)),1),o(d,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`},null,8,[`modelValue`]),o(f,{content:e.$t(`pika.description.ingredients`),class:`info`},null,8,[`content`])])}var fe=A(ce,[[`render`,de],[`__scopeId`,`data-v-17c0af5c`]]),pe=r({name:`EffectSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`Levitate`,label:this.$t(`pika.style.effect1`)},{value:`Decapitate`,label:this.$t(`pika.style.effect2`)},{value:`Eye-pop`,label:this.$t(`pika.style.effect3`)},{value:`Ta-da`,label:this.$t(`pika.style.effect4`)},{value:`Deflate`,label:this.$t(`pika.style.effect5`)},{value:`Crumble`,label:this.$t(`pika.style.effect6`)},{value:`Dissolve`,label:this.$t(`pika.style.effect7`)},{value:`Squish`,label:this.$t(`pika.style.effect8`)},{value:`Inflate`,label:this.$t(`pika.style.effect9`)},{value:`Melt`,label:this.$t(`pika.style.effect10`)},{value:`Cake-ify`,label:this.$t(`pika.style.effect11`)},{value:`Crush`,label:this.$t(`pika.style.effect12`)},{value:`Explode`,label:this.$t(`pika.style.effect13`)}]},value:{get(){return this.$store.state.pika?.config?.effect},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,effect:e})}}}}),me={class:`field`},he={class:`title font-bold`},ge={class:`float-left`};function _e(r,i,c,d,f,p){let g=m(`el-option`),_=m(`el-select`);return u(),t(`div`,me,[n(`h2`,he,l(r.$t(`pika.name.effect`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`pika.placeholder.select`),clearable:``},{default:h(()=>[(u(!0),t(s,null,e(r.options,e=>(u(),a(g,{key:e.value,label:e.label,value:e.value},{default:h(()=>[n(`span`,ge,l(e.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ve=A(pe,[[`render`,_e],[`__scopeId`,`data-v-d1c54475`]]),ye=r({name:`IngredientsModelSelector`,components:{ElRadioButton:w,ElRadioGroup:T},data(){return{options:[{label:this.$t(`pika.button.precise`),value:`precise`},{label:this.$t(`pika.button.creative`),value:`creative`}]}},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients_mode},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients_mode:e})}}},mounted(){this.value||=D}}),be={class:`field`},xe={class:`title font-bold`};function Se(r,c,d,f,p,g){let _=m(`el-radio-button`),v=m(`el-radio-group`);return u(),t(`div`,be,[n(`h2`,xe,l(r.$t(`pika.name.ingredientsModel`)),1),o(v,{modelValue:r.value,"onUpdate:modelValue":c[0]||=e=>r.value=e,class:`quality`},{default:h(()=>[(u(!0),t(s,null,e(r.options,e=>(u(),a(_,{key:e.value,label:e.value},{default:h(()=>[i(l(e.label),1)]),_:2},1032,[`label`]))),128))]),_:1},8,[`modelValue`])])}var Ce=A(ye,[[`render`,Se],[`__scopeId`,`data-v-b72865fa`]]),we=r({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`2.0`,label:`2.0`},{value:`1.5`,label:`1.5`}]}},computed:{value:{get(){return this.$store.state.pika?.config?.model},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||=`2.0`}}),Te={class:`field`},Ee={class:`title font-bold`};function De(r,i,c,d,f,p){let g=m(`el-option`),_=m(`el-select`);return u(),t(`div`,Te,[n(`h2`,Ee,l(r.$t(`pika.name.model`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`pika.placeholder.select`)},{default:h(()=>[(u(!0),t(s,null,e(r.options,e=>(u(),a(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Oe=A(we,[[`render`,De],[`__scopeId`,`data-v-7b2e870a`]]),ke=r({name:`ImageUrlInput`,components:{ElUpload:b,ElButton:_,InfoIcon:G,ImagePreview:H,FontAwesomeIcon:B},mixins:[F,L],data(){return{fileList:[],uploadUrl:P()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.pika?.config?.image_url},set(){let e=this.urls?.[0];this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,image_url:e})}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){I.warning(this.$t(`pika.message.uploadStartImageExceed`))},onError(){I.error(this.$t(`pika.message.uploadStartImageError`))},async onRemove(){I.error(this.$t(`pika.message.uploadStartImageError`))},onSetStartImageUrl(){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,image_url:this.urls})},async onSuccess(){this.onSetStartImageUrl()}}}),Ae={class:`field`},je={class:`title font-bold`},Me={class:`upload-wrapper`};function Ne(e,r,a,s,c,d){let f=m(`image-preview`),p=m(`font-awesome-icon`),g=m(`el-button`),_=m(`el-upload`),v=m(`info-icon`);return u(),t(`div`,Ae,[n(`h2`,je,l(e.$t(`pika.name.imageUrl`)),1),n(`div`,Me,[o(_,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value upload-wrapper`,limit:3,multiple:!0,"list-type":`picture`,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{file:h(({file:t})=>[o(f,{url:t.url||t.response?.file_url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])]),default:h(()=>[o(g,{size:`small`,type:`primary`,round:``},{default:h(()=>[o(p,{icon:`fa-solid fa-upload`,class:`mr-1`}),i(` `+l(e.$t(`pika.button.uploadImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])]),o(v,{content:e.$t(`pika.description.imageUrl`),class:`info`},null,8,[`content`])])}var Pe=A(ke,[[`render`,Ne],[`__scopeId`,`data-v-25cefe78`]]),Fe=r({name:`PromptInput`,components:{PromptTextarea:J},computed:{prompt:{get(){return this.$store.state.pika?.config?.prompt},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ie(e,t,n,r,i,o){let s=m(`prompt-textarea`);return u(),a(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`pika.name.prompt`),info:e.$t(`pika.description.prompt`),placeholder:e.$t(`pika.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Le=r({name:`PresetPanel`,components:{ImageUrlInput:Pe,ElButton:_,FontAwesomeIcon:B,Consumption:X,PromptInput:A(Fe,[[`render`,Ie]]),IngredientsSelector:fe,IngredientsModelSelector:Ce,ModelSelector:Oe,EffectSelector:ve},emits:[`generate`],computed:{config(){return this.$store.state.pika?.config},consumption(){return M(this.config,this.service?.cost)},service(){return this.$store.state.pika?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Re={class:`flex flex-col h-full`},ze={class:`flex-1 overflow-y-auto p-5`},Be={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ve(e,r,s,c,d,f){let g=m(`prompt-input`),_=m(`model-selector`),v=m(`ingredients-selector`),y=m(`effect-selector`),b=m(`image-url-input`),x=m(`ingredients-model-selector`),S=m(`consumption`),C=m(`font-awesome-icon`),w=m(`el-button`);return u(),t(`div`,Re,[n(`div`,ze,[o(g,{class:`mb-4`}),o(_,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`}),e.config?.ingredients?(u(),a(b,{key:0,class:`mb-4`})):p(``,!0),e.config?.ingredients?(u(),a(x,{key:1,class:`mb-4`})):p(``,!0)]),n(`div`,Be,[o(S,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(w,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:h(()=>[o(C,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.$t(`pika.button.generate`)),1)]),_:1},8,[`onClick`])])])}var He=A(Le,[[`render`,Ve]]),Ue=r({name:`VideoPlayer`,components:{VuePlyr:Q},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:1080,options:[1080]}}}}}),We=[`data-poster`],Ge=[`src`];function Ke(e,r,i,a,s,c){let l=m(`vue-plyr`);return u(),t(`div`,null,[o(l,{options:e.options,class:`video`},{default:h(()=>[n(`video`,{controls:``,playsinline:``,preload:`metadata`,"data-poster":e.modelValue?.image_url},[n(`source`,{size:`1080`,src:e.modelValue?.video_url,type:`video/mp4`},null,8,Ge)],8,We)]),_:1},8,[`options`])])}var qe=r({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:V,FontAwesomeIcon:B,ElAlert:C,VideoPlayer:A(Ue,[[`render`,Ke],[`__scopeId`,`data-v-897d9fe0`]]),ElTooltip:x,ElButton:_,ApiCodeButton:Z},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pika?.application},config(){return this.$store.state.pika?.config},videos(){let e=[],t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(n=>{let r=n;t&&(r.action=t),e.push(r)}),e}},methods:{onDownload(e){console.log(`on download`),window.open(e,`_blank`)},onReload(e){let t=e.target,n=new URL(t.src),r=n.searchParams.get(`retry`);if(!r)n.searchParams.set(`retry`,`1`);else if(parseInt(r)<2)n.searchParams.set(`retry`,(parseInt(r)+1).toString());else return;t.src=n.toString()},onOpenVideo(e){window.open(e,`_blank`)}}}),Je={class:`left`},Ye={class:`main`},Xe={class:`bot`},Ze={class:`datetime`},Qe={class:`info`},$e={key:0,class:`prompt mt-2`},et={key:0},tt={key:1},nt={key:0,class:c({content:!0,failed:!0})},rt={class:`image-wrapper`},it={key:0,class:c({operations:!0,"mt-2":!0})},at={key:0,class:`description`},ot={class:`description`},st={key:1,class:`description`},ct={key:1,class:c({content:!0})},lt={class:`description`},ut={class:`description`},dt={key:0,class:`description`},ft={class:`description`},$={key:2,class:c({content:!0})},pt={class:`description`};function mt(r,c,d,f,g,_){let v=m(`el-image`),y=m(`VideoPlayer`),b=m(`el-button`),x=m(`el-tooltip`),S=m(`api-code-button`),C=m(`font-awesome-icon`),w=m(`copy-to-clipboard`),T=m(`el-alert`);return u(!0),t(s,null,e(r.videos,(e,s)=>(u(),t(`div`,{key:s,class:`preview`},[n(`div`,Je,[o(v,{src:`https://cdn.acedata.cloud/i80tgn.png`,class:`avatar`})]),n(`div`,Ye,[n(`div`,Xe,[i(l(r.$t(`pika.name.pikaBot`))+` `,1),n(`span`,Ze,l(r.$dayjs.format(``+new Date(parseFloat((r.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,Qe,[r.modelValue?.request?.prompt?(u(),t(`p`,$e,[i(l(r.modelValue?.request?.prompt)+` `,1),r.modelValue?.response?p(``,!0):(u(),t(`span`,et,` - (`+l(r.$t(`pika.status.pending`))+`) `,1)),e?.state===`processing`||e?.state===`pending`?(u(),t(`span`,tt,` - (`+l(r.$t(`pika.status.processing`))+`) `,1)):p(``,!0)])):p(``,!0)]),r.modelValue?.response?.success===!0?(u(),t(`div`,nt,[n(`div`,rt,[o(y,{"model-value":e},null,8,[`model-value`])]),e?(u(),t(`div`,it,[o(x,{class:`box-item`,effect:`dark`,content:r.$t(`pika.message.downloadVideo`),placement:`top-start`},{default:h(()=>[e?.video_url?(u(),a(b,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:t=>r.onDownload(e?.video_url)},{default:h(()=>[i(l(r.$t(`pika.button.download`)),1)]),_:1},8,[`onClick`])):p(``,!0)]),_:2},1032,[`content`]),o(S,{path:`/pika/videos`,body:r.modelValue?.request},null,8,[`body`])])):p(``,!0),o(T,{closable:!1,class:`mt-2 success`},{default:h(()=>[r.modelValue?.request?.model?(u(),t(`p`,at,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(r.$t(`pika.name.model`))+`: `+l(r.modelValue?.request?.model),1)])):p(``,!0),n(`p`,ot,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(r.$t(`pika.name.taskId`))+`: `+l(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),r.modelValue?.elapsed?(u(),t(`p`,st,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(r.$t(`pika.name.elapsed`))+`: `+l(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):p(``,!0)]),_:1})])):p(``,!0),r.modelValue?.response?.success===!1?(u(),t(`div`,ct,[o(T,{closable:!1,class:`failure`},{template:h(()=>[o(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(r.$t(`pika.name.failure`)),1)]),default:h(()=>[n(`p`,lt,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(r.$t(`pika.name.taskId`))+`: `+l(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n(`p`,ut,[o(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+l(r.$t(`pika.name.failureReason`))+`: `+l(r.modelValue?.response?.error?.message)+` `,1),o(w,{content:r.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),r.modelValue?.elapsed?(u(),t(`p`,dt,[o(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(r.$t(`pika.name.elapsed`))+`: `+l(r.modelValue?.elapsed?.toFixed(2))+`s `,1)])):p(``,!0),n(`p`,ft,[o(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(r.$t(`pika.name.traceId`))+`: `+l(r.modelValue?.response?.trace_id)+` `,1),o(w,{content:r.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):p(``,!0),!r.modelValue?.response||e?.state===`processing`||e?.state===`pending`?(u(),t(`div`,$,[o(T,{closable:!1,class:`info`},{template:h(()=>[o(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(r.$t(`pika.name.failure`)),1)]),default:h(()=>[n(`p`,pt,[o(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(r.$t(`pika.name.taskId`))+`: `+l(r.modelValue?.id)+` `,1),o(w,{content:r.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):p(``,!0)])]))),128)}var ht=r({name:`RecentPanel`,components:{TaskPreview:A(qe,[[`render`,mt],[`__scopeId`,`data-v-52856c99`]]),BotPlaceholder:W,NoTasks:Y,ScrollList:K},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pika?.tasks,items:this.$store.state.pika?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),gt={key:0},_t={key:2,class:`w-full h-full flex items-center justify-center`};function vt(n,r,i,c,l,d){let f=m(`bot-placeholder`),g=m(`task-preview`),_=m(`scroll-list`),v=m(`no-tasks`);return u(),t(s,null,[n.tasks?.items===void 0?(u(),t(`div`,gt,[o(f)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(u(),a(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:h(()=>[(u(!0),t(s,null,e(n.tasks?.items,(e,t)=>(u(),a(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):p(``,!0),n.tasks?.items?.length===0?(u(),t(`div`,_t,[o(v)])):p(``,!0)],64)}var yt=A(ht,[[`render`,vt]]),bt=O(`pika`),xt=r({name:`PikaIndex`,components:{ConfigPanel:He,Layout:se,RecentPanel:yt},mixins:[te],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pika?.status?.getApplications===z.Request},tasksLoading(){return this.$store.state.pika?.status?.getTasks===z.Request||this.fetchingTasks},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===z.Request},needApply(){return this.$store.state.pika.status.getApplications===z.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.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 q({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(`pika/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`pika/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},onApply(){k.create({application:this.application}).then(({data:e})=>{this.application=e,I.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&I.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`pika/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!N(this.uploadTracker,e=>this.$t(e),e=>I.warning(e)))return;let e={...this.config,callback_url:bt},t=this.credential?.token;if(!t){console.error(`no token specified`);return}I.info(this.$t(`pika.message.startingTask`)),j(`pika`,R.generate(e,{token:t})).then(()=>{I.success(this.$t(`pika.message.startTaskSuccess`)),this.$store.commit(`pika/setConfig`,{config:void 0})}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?I.error(this.$t(`pika.message.usedUp`)):I.error(this.$t(`pika.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function St(e,t,n,r,i,s){let c=m(`config-panel`),l=m(`recent-panel`),d=m(`layout`);return u(),a(d,null,{config:h(()=>[o(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:h(()=>[o(l,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Ct=A(xt,[[`render`,St],[`__scopeId`,`data-v-eae39ce1`]]);export{Ct as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Vt as c,Wt as l,Z as u,b as d,k as f,tt as p,ut as m}from"./vendor-chart-BJCvKk8-.js";import{t as h}from"./button-DfsQodL-.js";import{r as g,t as _}from"./select-CxvkoR_I.js";import{t as v}from"./upload-cn_TUU3N.js";import{t as y}from"./tooltip-BLwTovWL.js";import{t as b}from"./image-r_Sil4Yc.js";import{t as x}from"./alert-OvnfgMB-.js";import{_i as S,zn as C}from"./constants-DwFseFmM.js";import{At as w,E as T,Fn as E,Nt as D,Ot as O,Sr as ee,cn as te,jt as k,kr as A,kt as j,yr as M}from"./index-1hhw9POE.js";import{t as N}from"./index.es-Ds6M0PuH.js";import{t as P}from"./CopyToClipboard-DG5cx0Ex.js";import{t as F}from"./ImagePreview-CeyNx3jd.js";import{t as I}from"./Hailuo-DIHiST1a.js";import{t as L}from"./BotPlaceholder-BpLIwwxA.js";import{i as R,n as z,t as B}from"./pagination-DH5leY8A.js";import{n as V,t as H}from"./NoTasks-BOopjPtL.js";import{t as U}from"./Consumption-D_CAQaSB.js";import{t as W}from"./ApiCodeButton-CXoLQXC2.js";import{t as G}from"./VideoPlayer-CD9PlOS8.js";var K=r({name:`ModelSelector`,components:{ElSelect:g,ElOption:_},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||=C}}),q={class:`field`},J={class:`title font-bold`},Y={class:`float-left`};function X(r,i,c,d,f,h){let g=p(`el-option`),_=p(`el-select`);return u(),t(`div`,q,[n(`h2`,J,l(r.$t(`hailuo.name.model`)),1),o(_,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`value`,placeholder:r.$t(`hailuo.placeholder.select`),clearable:``},{default:m(()=>[(u(!0),t(s,null,e(r.options,e=>(u(),a(g,{key:e.value,label:e.label,value:e.value},{default:m(()=>[n(`span`,Y,l(e.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Z=T(K,[[`render`,X],[`__scopeId`,`data-v-a768fbd9`]]),Q=r({name:`StartImageUrlInput`,components:{ElUpload:v,ElButton:h,InfoIcon:R,ImagePreview:F},mixins:[k,j],data(){return{fileList:[],uploadUrl:ee()+`/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(){A.warning(this.$t(`hailuo.message.uploadStartImageExceed`))},onError(){A.error(this.$t(`hailuo.message.uploadStartImageError`))},async onRemove(){A.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(e,r,s,c,d,h){let g=p(`info-icon`),_=p(`image-preview`),v=p(`el-button`),y=p(`el-upload`);return u(),t(`div`,ne,[n(`div`,re,[n(`div`,ie,[n(`span`,ae,l(e.$t(`hailuo.name.startImageUrl`)),1),o(g,{content:e.$t(`hailuo.description.startImageUrl`),class:`info`},null,8,[`content`])])]),o(y,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,"show-file-list":!0,limit:1,multiple:!1,"list-type":`picture`,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:t})=>[t.url&&t.percentage!==void 0?(u(),a(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):f(``,!0)]),default:m(()=>[o(v,{size:`small`,type:`primary`,class:`btn btn-upload`,round:``},{default:m(()=>[i(l(e.$t(`hailuo.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])])}var se=T(Q,[[`render`,oe],[`__scopeId`,`data-v-fbf49b06`]]),ce=r({name:`PromptInput`,components:{PromptTextarea:V},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,o){let s=p(`prompt-textarea`);return u(),a(s,{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=r({name:`PresetPanel`,components:{ElButton:h,FontAwesomeIcon:N,PromptInput:T(ce,[[`render`,le]]),StartImageUrlInput:se,ModelSelector:Z,Consumption:U},emits:[`generate`],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return D(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(e,r,s,c,d,h){let g=p(`prompt-input`),_=p(`model-selector`),v=p(`start-image-url-input`),y=p(`consumption`),b=p(`font-awesome-icon`),x=p(`el-button`);return u(),t(`div`,de,[n(`div`,fe,[o(g,{class:`mb-4`}),o(_,{class:`mb-4`}),e.config?.model===`minimax-i2v`?(u(),a(v,{key:0,class:`mb-2`})):f(``,!0)]),n(`div`,pe,[o(y,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),e.config?.video_url!==void 0||e.config?.custom?(u(),a(x,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:m(()=>[o(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.$t(`hailuo.button.extend`)),1)]),_:1},8,[`onClick`])):(u(),a(x,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:m(()=>[o(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.$t(`hailuo.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var he=T(ue,[[`render`,me]]),ge=r({name:`TaskPreview`,components:{ElImage:b,CopyToClipboard:P,FontAwesomeIcon:N,ElAlert:x,VideoPlayer:G,ElTooltip:y,ElButton:h,ApiCodeButton:W},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:c({content:!0,failed:!0})},De={key:0,class:`mb-4`},Oe={key:1,class:c({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:c({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:c({content:!0})},Le={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Re(e,r,s,c,h,g){let _=p(`el-image`),v=p(`video-player`),y=p(`el-button`),b=p(`el-tooltip`),x=p(`api-code-button`),S=p(`font-awesome-icon`),C=p(`copy-to-clipboard`),w=p(`el-alert`);return u(),t(`div`,_e,[n(`div`,ve,[o(_,{src:`https://cdn.acedata.cloud/0qg4gp.png`,class:`avatar`})]),n(`div`,ye,[n(`div`,be,[i(l(e.$t(`hailuo.name.hailuoBot`))+` `,1),n(`span`,xe,l(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,Se,[e.modelValue?.request?.prompt?(u(),t(`p`,Ce,[i(l(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?f(``,!0):(u(),t(`span`,we,` - (`+l(e.$t(`hailuo.status.pending`))+`) `,1)),e.video?.state===`processing`||e.video?.state===`pending`||e.video?.state===`running`?(u(),t(`span`,Te,` - (`+l(e.$t(`hailuo.status.processing`))+`) `,1)):f(``,!0)])):f(``,!0)]),e.modelValue?.response?.success===!0?(u(),t(`div`,Ee,[e.video?.video_url?(u(),t(`div`,De,[o(v,{src:e.video?.video_url},null,8,[`src`])])):f(``,!0),e.video?(u(),t(`div`,Oe,[o(b,{class:`box-item`,effect:`dark`,content:e.$t(`hailuo.message.downloadVideo`),placement:`top-start`},{default:m(()=>[e.video?.video_url?(u(),a(y,{key:0,type:`info`,size:`small`,class:`mb-2`,onClick:r[0]||=d(t=>e.onDownload(e.video?.video_url),[`stop`])},{default:m(()=>[i(l(e.$t(`hailuo.button.download`)),1)]),_:1})):f(``,!0)]),_:1},8,[`content`]),o(x,{path:`/hailuo/videos`,body:e.modelValue?.request},null,8,[`body`])])):f(``,!0),o(w,{closable:!1,class:`mt-2 success`},{default:m(()=>[e.modelValue?.request?.model?(u(),t(`p`,ke,[o(S,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.model`))+`: `+l(e.modelValue?.request?.model)+` `,1),o(C,{content:e.modelValue?.id},null,8,[`content`])])):f(``,!0),n(`p`,Ae,[o(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),o(C,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.elapsed?(u(),t(`p`,je,[o(S,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.elapsed`))+`: `+l(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):f(``,!0)]),_:1})])):f(``,!0),e.modelValue?.response?.success===!1?(u(),t(`div`,Me,[o(w,{closable:!1,class:`failure`},{template:m(()=>[o(S,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.failure`)),1)]),default:m(()=>[n(`p`,Ne,[o(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),o(C,{content:e.modelValue?.id},null,8,[`content`])]),n(`p`,Pe,[o(S,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.failureReason`))+`: `+l(e.modelValue?.response?.error?.message)+` `,1),o(C,{content:e.modelValue?.response?.error?.message},null,8,[`content`])]),e.modelValue?.elapsed?(u(),t(`p`,$,[o(S,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.elapsed`))+`: `+l(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):f(``,!0),n(`p`,Fe,[o(S,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.traceId`))+`: `+l(e.modelValue?.response?.trace_id)+` `,1),o(C,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):f(``,!0),e.modelValue?.response?.success===void 0?(u(),t(`div`,Ie,[o(w,{closable:!1,class:`info`},{template:m(()=>[o(S,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.failure`)),1)]),default:m(()=>[n(`p`,Le,[o(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`hailuo.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),o(C,{content:e.modelValue?.id},null,8,[`content`])])]),_:1})])):f(``,!0)])])}var ze=r({name:`RecentPanel`,components:{TaskPreview:T(ge,[[`render`,Re],[`__scopeId`,`data-v-53d13da4`]]),BotPlaceholder:L,NoTasks:H,ScrollList:z},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(n,r,i,c,l,d){let h=p(`bot-placeholder`),g=p(`task-preview`),_=p(`scroll-list`),v=p(`no-tasks`);return u(),t(s,null,[n.tasks?.items===void 0?(u(),t(`div`,Be,[o(h)])):n.tasks?.items?.length&&n.tasks?.items?.length>0?(u(),a(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:n.loading,onReachTop:r[0]||=e=>n.$emit(`reach-top`)},{default:m(()=>[(u(!0),t(s,null,e(n.tasks?.items,e=>(u(),a(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):f(``,!0),n.tasks?.items?.length===0?(u(),t(`div`,Ve,[o(v)])):f(``,!0)],64)}var Ue=T(ze,[[`render`,He]]),We=S(`hailuo`),Ge=r({name:`HailuoIndex`,components:{ConfigPanel:he,Layout:I,RecentPanel:Ue},mixins:[w],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===M.Request},tasksLoading(){return this.$store.state.hailuo?.status?.getTasks===M.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 B({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(!O(this.uploadTracker,e=>this.$t(e),e=>A.warning(e)))return;let e={...this.config,callback_url:We},t=this.credential?.token;if(!t){console.error(`no token specified`);return}A.info(this.$t(`hailuo.message.startingTask`)),E(`hailuo`,te.generate(e,{token:t})).then(()=>{A.success(this.$t(`hailuo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?A.error(this.$t(`hailuo.message.usedUp`)):A.error(this.$t(`hailuo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ke(e,t,n,r,i,s){let c=p(`config-panel`),l=p(`recent-panel`),d=p(`layout`);return u(),a(d,null,{config:m(()=>[o(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[o(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var qe=T(Ge,[[`render`,Ke]]);export{qe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,D as t,F as n,N as r,O as i,P as a,Wt as o,Z as s,dt as c,k as l,nt as u,tt as d,ut as f}from"./vendor-chart-BJCvKk8-.js";import{t as p}from"./button-DfsQodL-.js";import{n as m,t as h}from"./row-bfsY0Sup.js";import{i as g,n as _,r as v,t as y}from"./container-BgEH5azS.js";import{n as b,t as x}from"./dropdown-CG4l8dKx.js";import{a as S,i as C,n as w,r as T,t as E}from"./avatar-BK3H5LlO.js";import{Bt as D,D as O,Dr as k,E as A,K as j,O as M,rt as N,xr as P,z as F}from"./index-1hhw9POE.js";import{t as I}from"./BottomFooter-CPL1TUJk.js";var L=n({name:`TopHeader`,components:{ElCol:m,Logo:w,ElRow:h,ElDropdown:x,ElMenu:T,ElMenuItem:C,ElDropdownItem:b,ElButton:p,ElSubMenu:S},data(){return{defaultAvatar:E,products:`chat`}},computed:{site(){return this.$store.state?.site},dark(){return this.$store.getters?.dark},active(){return this.$route.matched?.[0]?.path},user(){return this.$store.getters?.user},authenticated(){return this.$store.getters?.authenticated}},methods:{openTab(e){if(k()){O.open({url:e}).catch(t=>{console.warn(`Browser.open failed, falling back to window.open`,t),window.open(e,`_blank`)});return}window.open(e,`_blank`)},onSelect(e){e&&this.$router.push(e)},onHome(){this.$router.push({name:N})},onLogin(){this.$router.push({name:M})},onDownload(){this.$router.push({name:j})},onProfile(){let e=P();this.openTab(D(`${e}/user/profile`))},onVerify(){let e=P();this.openTab(D(`${e}/user/verify`))},onConsole(){this.$router.push({name:F})},async onLogout(){this.$store.dispatch(`logout`)}}}),R={key:0,class:`mt-4 pr-10`},z={key:1,class:`float-right`},B=[`src`];function V(n,p,m,h,g,_){let v=d(`logo`),y=d(`el-col`),b=d(`el-menu-item`),x=d(`el-sub-menu`),S=d(`el-menu`),C=d(`el-button`),w=d(`language-selector`),T=d(`dark-selector`),E=d(`el-dropdown-item`),D=d(`el-dropdown-menu`),O=d(`el-dropdown`),k=d(`el-row`),A=u(`t`);return s(),i(k,{class:`header`},{default:f(()=>[a(y,{md:4,xs:24,class:`brand-col`},{default:f(()=>[a(v,{onClick:n.onHome},null,8,[`onClick`])]),_:1}),a(y,{md:16,xs:13},{default:f(()=>[a(S,{"default-active":n.active,mode:`horizontal`,class:`menu`,ellipsis:!0,onSelect:n.onSelect},{default:f(()=>[a(x,{index:n.products},{title:f(()=>[r(o(n.$t(`common.nav.products`)),1)]),default:f(()=>[n.site?.features?.chatgpt?.enabled?c((s(),i(b,{key:0,index:`/chat`},null,512)),[[A,`index.title.chat`]]):l(``,!0),n.site?.features?.midjourney?.enabled?c((s(),i(b,{key:1,index:`/midjourney`},null,512)),[[A,`index.title.midjourney`]]):l(``,!0),n.site?.features?.qrart?.enabled?c((s(),i(b,{key:2,index:`/qrart`},null,512)),[[A,`index.title.qrart`]]):l(``,!0),n.site?.features?.suno?.enabled?c((s(),i(b,{key:3,index:`/suno`},null,512)),[[A,`index.title.suno`]]):l(``,!0),n.site?.features?.luma?.enabled?c((s(),i(b,{key:4,index:`/luma`},null,512)),[[A,`index.title.luma`]]):l(``,!0),n.site?.features?.headshots?.enabled?c((s(),i(b,{key:5,index:`/headshots`},null,512)),[[A,`index.title.headshots`]]):l(``,!0)]),_:1},8,[`index`]),c(a(b,{onRoute:e=>void 0,onClick:n.onDownload},null,8,[`onClick`]),[[A,`common.nav.mobileApp`]]),c(a(b,{onRoute:e=>void 0,onClick:p[0]||=e=>n.openTab(`https://platform.acedata.cloud`)},null,512),[[A,`common.nav.apiPlatform`]]),c(a(b,{onRoute:e=>void 0,onClick:p[1]||=e=>n.openTab(`https://platform.acedata.cloud/support`)},null,512),[[A,`common.nav.support`]]),c(a(b,{onRoute:e=>void 0,onClick:p[2]||=e=>n.openTab(`https://platform.acedata.cloud/earning`)},null,512),[[A,`common.nav.referral`]])]),_:1},8,[`default-active`,`onSelect`])]),_:1}),a(y,{md:4,xs:11},{default:f(()=>[n.authenticated?(s(),e(`div`,z,[t(`div`,{class:`console`,onClick:p[3]||=(...e)=>n.onConsole&&n.onConsole(...e)},o(n.$t(`common.button.console`)),1),a(O,{trigger:`click`},{dropdown:f(()=>[a(D,null,{default:f(()=>[a(E,{onClick:n.onProfile},{default:f(()=>[r(o(n.$t(`common.button.profile`)),1)]),_:1},8,[`onClick`]),a(E,{onClick:n.onLogout},{default:f(()=>[r(o(n.$t(`common.button.logout`)),1)]),_:1},8,[`onClick`])]),_:1})]),default:f(()=>[t(`img`,{src:n.user?.avatar||n.defaultAvatar,class:`avatar`},null,8,B)]),_:1})])):(s(),e(`div`,R,[a(C,{type:`primary`,class:`float-right`,size:`small`,round:``,onClick:n.onLogin},{default:f(()=>[r(o(n.$t(`common.button.login`)),1)]),_:1},8,[`onClick`]),a(w,{class:`locale float-right mr-4`}),a(T,{class:`float-right mr-4`})]))]),_:1})]),_:1})}var H=n({name:`LayoutIndex`,components:{TopHeader:A(L,[[`render`,V]]),BottomFooter:I,ElContainer:y,ElMain:g,ElFooter:_,ElHeader:v}});function U(e,t,n,r,o,c){let l=d(`top-header`),u=d(`el-header`),p=d(`router-view`),m=d(`el-main`),h=d(`bottom-footer`),g=d(`el-footer`),_=d(`el-container`);return s(),i(_,{class:`wrapper min-h-[100vh]`},{default:f(()=>[a(u,{class:`header p-0 h-auto`},{default:f(()=>[a(l)]),_:1}),a(m,{class:`main`},{default:f(()=>[a(p)]),_:1}),a(g,{class:`footer p-0 h-auto`},{default:f(()=>[a(h)]),_:1})]),_:1})}var W=A(H,[[`render`,U]]);export{W as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,E as r,F as i,N as a,O as o,P as s,S as c,Vt as l,Wt as u,Z as d,et as f,k as p,tt as m,ut as h}from"./vendor-chart-BJCvKk8-.js";import{t as g}from"./button-DfsQodL-.js";import{n as _,t as v}from"./tabs-dRngkdRx.js";import{t as y}from"./upload-cn_TUU3N.js";import{t as b}from"./image-r_Sil4Yc.js";import{t as x}from"./alert-OvnfgMB-.js";import{n as S,r as C}from"./radio-BmBXySlN.js";import{t as w}from"./drawer-Dpuj2uIl.js";import{n as ee,t as te}from"./skeleton-C4sltx62.js";import{_i as T}from"./constants-DwFseFmM.js";import{An as E,At as D,E as O,Fn as k,Ot as A,Sr as j,jt as M,kr as N,kt as P,sn as F,yr as I}from"./index-1hhw9POE.js";import{t as L}from"./index.es-Ds6M0PuH.js";import{t as R}from"./CopyToClipboard-DG5cx0Ex.js";import{t as z}from"./Status-CeZgC2Ye.js";import{t as B}from"./ImagePreview-CeyNx3jd.js";import{i as V,n as H,t as U}from"./pagination-DH5leY8A.js";import{t as W}from"./ApiCodeButton-CXoLQXC2.js";var G=i({name:`LayoutHeadshots`,components:{ElDrawer:w,ElButton:g,FontAwesomeIcon:L},data(){return{drawer:!1}}}),K={class:`main flex flex-row flex-1`},q={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},J={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Y(e,r,i,a,o,c){let l=m(`font-awesome-icon`),u=m(`el-button`),p=m(`el-drawer`);return d(),t(`div`,K,[n(`div`,q,[f(e.$slots,`config`,{},void 0,!0)]),n(`div`,J,[f(e.$slots,`result`,{},void 0,!0)]),s(u,{circle:``,class:`menu`,onClick:r[0]||=t=>e.drawer=!0},{default:h(()=>[s(l,{icon:`fa-solid fa-gear`})]),_:1}),s(p,{modelValue:e.drawer,"onUpdate:modelValue":r[1]||=t=>e.drawer=t,"with-header":!1,size:`340px`,class:`drawer`},{default:h(()=>[f(e.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var X=O(G,[[`render`,Y],[`__scopeId`,`data-v-ada6b2d1`]]),Z=i({name:`ImageUrlsInput`,components:{ElUpload:y,ElButton:g,InfoIcon:V,ImagePreview:B,FontAwesomeIcon:L},mixins:[M,P],data(){return{fileList:[],uploadUrl:j()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){let e=this.urls;this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||=void 0,this.onSetImageUrls()},methods:{onExceed(){N.warning(this.$t(`headshots.message.uploadImageExceed`))},onError(){N.error(this.$t(`headshots.message.uploadImageError`))},onSetImageUrls(){let e=this.urls;this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),Q={class:`field`},ne={class:`title font-bold`},re={class:`upload-wrapper`};function ie(e,r,i,o,c,l){let f=m(`image-preview`),p=m(`font-awesome-icon`),g=m(`el-button`),_=m(`el-upload`),v=m(`info-icon`);return d(),t(`div`,Q,[n(`h2`,ne,u(e.$t(`headshots.name.endImageUrls`)),1),n(`div`,re,[s(_,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":r[0]||=t=>e.fileList=t,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value upload-wrapper`,limit:2,multiple:!0,"list-type":`picture`,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:h(({file:t})=>[s(f,{url:t.url||t.response?.file_url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])]),default:h(()=>[s(g,{size:`small`,type:`primary`,round:``},{default:h(()=>[s(p,{icon:`fa-solid fa-upload`,class:`mr-1`}),a(` `+u(e.$t(`headshots.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])]),s(v,{content:e.$t(`headshots.description.endImageUrls`),class:`info`},null,8,[`content`])])}var ae=O(Z,[[`render`,ie],[`__scopeId`,`data-v-d468812a`]]),oe=`fast`,se=i({name:`ModeSelector`,components:{ElRadioButton:S,ElRadioGroup:C},data(){return{options:[{label:this.$t(`headshots.button.fast`),value:`fast`},{label:this.$t(`headshots.button.relax`),value:`relax`}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug(`set mode`,e),this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||=oe}}),ce={class:`field`},le={class:`title font-bold`};function ue(r,i,l,f,p,g){let _=m(`el-radio-button`),v=m(`el-radio-group`);return d(),t(`div`,ce,[n(`h2`,le,u(r.$t(`headshots.name.mode`)),1),s(v,{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`mode`},{default:h(()=>[(d(!0),t(c,null,e(r.options,e=>(d(),o(_,{key:e.value,label:e.value},{default:h(()=>[a(u(e.label),1)]),_:2},1032,[`label`]))),128))]),_:1},8,[`modelValue`])])}var de=O(se,[[`render`,ue],[`__scopeId`,`data-v-e7702494`]]),fe=i({name:`StylizeSelector`,components:{ElTabs:_,ElTabPane:v,ElImage:b},data(){return{tab:`styles`,value:``,elements:{styles:{displayName:this.$t(`headshots.styleCategory.styles`),items:[{image:`https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png`,label:this.$t(`headshots.styleTag.malePportrait`),value:`male_portrait`},{image:`https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png`,label:this.$t(`headshots.styleTag.malePportrait2`),value:`male_portrait2`},{image:`https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png`,label:this.$t(`headshots.styleTag.kindergarten`),value:`kindergarten`},{image:`https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp`,label:this.$t(`headshots.styleTag.logoTshirt`),value:`logo_tshirt`},{image:`https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg`,label:this.$t(`headshots.styleTag.wedding`),value:`wedding`},{image:`https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp`,label:this.$t(`headshots.styleTag.businessPphoto`),value:`business_photo`},{image:`https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg`,label:this.$t(`headshots.styleTag.bobSuit`),value:`bob_suit`},{image:`https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp`,label:this.$t(`headshots.styleTag.femalePortrait`),value:`female_portrait`}]}}}},watch:{value(e){console.debug(`set template`,e),this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||=``,console.debug(`set template`,this.value),this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value=``:this.value=e,console.debug(`set template`,this.value),this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,template:this.value})}}}),pe={class:`field`},me=[`onClick`],he={class:`name`};function ge(r,i,a,f,p,g){let _=m(`el-image`),v=m(`el-tab-pane`),y=m(`el-tabs`);return d(),t(`div`,pe,[s(y,{modelValue:r.tab,"onUpdate:modelValue":i[0]||=e=>r.tab=e},{default:h(()=>[(d(!0),t(c,null,e(r.elements,(i,a)=>(d(),o(v,{key:a,label:i.displayName,name:a,class:`pane`},{default:h(()=>[(d(!0),t(c,null,e(i.items,(e,i)=>(d(),t(`div`,{key:i,class:l({item:!0,active:r.value===e.value}),onClick:t=>r.onToggle(e.value)},[s(_,{src:e.image,fit:`fill`,class:`preview`},null,8,[`src`]),n(`span`,he,u(e.label),1)],10,me))),128))]),_:2},1032,[`label`,`name`]))),128))]),_:1},8,[`modelValue`])])}var _e=i({name:`PresetPanel`,components:{ModeSelector:de,ImageUrlsInput:ae,ElButton:g,FontAwesomeIcon:L,ElementsSelector:O(fe,[[`render`,ge],[`__scopeId`,`data-v-be4bd25d`]])},emits:[`generate`],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit(`generate`)}}}),ve={class:`panel`},ye={class:`config`},be={class:`actions`};function xe(e,r,i,o,c,l){let f=m(`elements-selector`),p=m(`mode-selector`),g=m(`image-urls-input`),_=m(`font-awesome-icon`),v=m(`el-button`);return d(),t(`div`,ve,[n(`div`,ye,[s(f,{class:`mb-4`}),s(p,{class:`mb-4`}),s(g,{class:`mb-4`}),n(`div`,be,[s(v,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:h(()=>[s(_,{icon:`fa-solid fa-magic`,class:`mr-2`}),a(` `+u(e.$t(`headshots.button.generate`)),1)]),_:1},8,[`onClick`])])])])}var Se=O(_e,[[`render`,xe],[`__scopeId`,`data-v-848739f6`]]),Ce=i({name:`ImageGallery`,props:{modelValue:{type:Object,required:!0}},setup(e){return{images:r(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:e=>{window.open(e,`_blank`)}}}}),we={class:`image-gallery`},Te=[`src`],Ee=[`onClick`];function De(r,i,a,o,s,l){return d(),t(`div`,we,[(d(!0),t(c,null,e(r.images,(e,i)=>(d(),t(`div`,{key:i,class:`image-container`},[n(`img`,{src:e.image_url,alt:`Image`},null,8,Te),e.image_url?(d(),t(`button`,{key:0,class:`view-button`,onClick:t=>r.viewImage(e.image_url)},u(r.$t(`headshots.button.viewImage`)),9,Ee)):p(``,!0)]))),128))])}var Oe=i({name:`TaskPreview`,components:{ElImage:b,CopyToClipboard:R,FontAwesomeIcon:L,ElAlert:x,ImageGallery:O(Ce,[[`render`,De],[`__scopeId`,`data-v-42f0a7be`]]),ApiCodeButton:W},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onReload(e){let t=e.target,n=new URL(t.src),r=n.searchParams.get(`retry`);if(!r)n.searchParams.set(`retry`,`1`);else if(parseInt(r)<2)n.searchParams.set(`retry`,(parseInt(r)+1).toString());else return;t.src=n.toString()},onOpenVideo(e){window.open(e,`_blank`)}}}),ke={class:`preview`},Ae={class:`left`},je={class:`main`},Me={class:`bot`},Ne={class:`datetime`},Pe={class:`info`},Fe={key:0,class:`prompt mt-2`},Ie={key:0},Le={key:1},Re={key:0,class:l({content:!0,failed:!0})},ze={class:`image-wrapper`},Be={class:l({operations:!0,"mt-2":!0,"mb-2":!0})},Ve={class:`description`},He={key:0,class:`description`},Ue={key:1,class:l({content:!0})},We={class:`description`},Ge={class:`description`},Ke={key:0,class:`description`},qe={class:`description`},Je={key:2,class:l({content:!0})},$={class:`description`},Ye={key:3,class:l({content:!0})},Xe={class:`description`};function Ze(e,r,i,o,c,l){let f=m(`el-image`),g=m(`image-gallery`),_=m(`api-code-button`),v=m(`font-awesome-icon`),y=m(`copy-to-clipboard`),b=m(`el-alert`);return d(),t(`div`,ke,[n(`div`,Ae,[s(f,{src:`https://cdn.acedata.cloud/isxyfw.png`,class:`avatar`})]),n(`div`,je,[n(`div`,Me,[a(u(e.$t(`headshots.name.headshotsBot`))+` `,1),n(`span`,Ne,u(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,Pe,[e.modelValue?.request?.template?(d(),t(`p`,Fe,[a(u(e.modelValue?.request?.template)+` `,1),e.modelValue?.response?p(``,!0):(d(),t(`span`,Ie,` - (`+u(e.$t(`headshots.status.pending`))+`) `,1)),e.modelValue?.response?.status===`unknown`?(d(),t(`span`,Le,` - (`+u(e.$t(`headshots.status.processing`))+`) `,1)):p(``,!0)])):p(``,!0)]),e.modelValue?.response?.success===!0?(d(),t(`div`,Re,[n(`div`,ze,[s(g,{"model-value":e.modelValue},null,8,[`model-value`])]),n(`div`,Be,[s(_,{path:`/headshots/images`,body:e.modelValue?.request},null,8,[`body`])]),s(b,{closable:!1,class:`mt-2 success`},{default:h(()=>[n(`p`,Ve,[s(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`headshots.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),s(y,{content:e.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e.modelValue?.elapsed?(d(),t(`p`,He,[s(v,{icon:`fa-solid fa-clock`,class:`mr-1`}),a(` `+u(e.$t(`headshots.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):p(``,!0)]),_:1})])):p(``,!0),e.modelValue?.response?.success===!1?(d(),t(`div`,Ue,[s(b,{closable:!1,class:`failure`},{template:h(()=>[s(v,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),a(` `+u(e.$t(`headshots.name.failure`)),1)]),default:h(()=>[n(`p`,We,[s(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`headshots.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),s(y,{content:e.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n(`p`,Ge,[s(v,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),a(` `+u(e.$t(`headshots.name.failureReason`))+`: `+u(e.modelValue?.response?.error?.message)+` `,1),s(y,{content:e.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),e.modelValue?.elapsed?(d(),t(`p`,Ke,[s(v,{icon:`fa-solid fa-clock`,class:`mr-1`}),a(` `+u(e.$t(`headshots.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):p(``,!0),n(`p`,qe,[s(v,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),a(` `+u(e.$t(`headshots.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),s(y,{content:e.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):p(``,!0),e.modelValue?.response?p(``,!0):(d(),t(`div`,Je,[s(b,{closable:!1,class:`info`},{template:h(()=>[s(v,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),a(` `+u(e.$t(`headshots.name.failure`)),1)]),default:h(()=>[n(`p`,$,[s(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`headshots.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),s(y,{content:e.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])),e.modelValue?.response?.status===`unknown`?(d(),t(`div`,Ye,[s(b,{closable:!1,class:`info`},{template:h(()=>[s(v,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),a(` `+u(e.$t(`headshots.name.failure`)),1)]),default:h(()=>[n(`p`,Xe,[s(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`headshots.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),s(y,{content:e.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):p(``,!0)])])}var Qe=i({name:`RecentPanel`,components:{TaskPreview:O(Oe,[[`render`,Ze],[`__scopeId`,`data-v-0e921c0c`]]),ElSkeleton:te,ElSkeletonItem:ee,ScrollList:H},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),$e={key:0,class:`tasks`},et={class:`left`},tt={class:`main`},nt={key:1,class:`tasks`},rt={key:2,class:`description`};function it(r,i,a,l,f,g){let _=m(`el-skeleton-item`),v=m(`el-skeleton`),y=m(`task-preview`),b=m(`scroll-list`);return d(),o(b,{ref:`scrollList`,class:`panel recent`,loading:r.loading,onReachTop:i[0]||=e=>r.$emit(`reach-top`)},{default:h(()=>[r.tasks?.items===void 0?(d(),t(`div`,$e,[(d(),t(c,null,e(3,e=>n(`div`,{key:e,class:`task placeholder`},[n(`div`,et,[s(v,{animated:``},{template:h(()=>[s(_,{variant:`image`,class:`avatar`})]),_:1})]),n(`div`,tt,[s(v,{animated:``},{template:h(()=>[s(_,{variant:`p`,class:`title`}),s(_,{variant:`image`,class:`icon`})]),_:1})])])),64))])):r.tasks?.items?.length&&r.tasks?.items?.length>0?(d(),t(`div`,nt,[(d(!0),t(c,null,e(r.tasks?.items,(e,t)=>(d(),o(y,{key:t,"model-value":e,class:`preview`},null,8,[`model-value`]))),128))])):p(``,!0),r.tasks?.items?.length===0?(d(),t(`p`,rt,u(r.$t(`headshots.message.noTasks`)),1)):p(``,!0)]),_:1},8,[`loading`])}var at=O(Qe,[[`render`,it],[`__scopeId`,`data-v-ffd55c16`]]),ot=T(`headshots`),st=i({name:`HeadshotsIndex`,components:{ConfigPanel:Se,Layout:X,ApplicationStatus:z,RecentPanel:at},mixins:[D],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.headshots?.status?.getApplications===I.Request},tasksLoading(){return this.$store.state.headshots?.status?.getTasks===I.Request||this.fetchingTasks},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===I.Request},needApply(){return this.$store.state.headshots.status.getApplications===I.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.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 U({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(`headshots/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`headshots/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},onApply(){E.create({application:this.application}).then(({data:e})=>{this.application=e,N.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&N.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`headshots/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGeneratePicture(){if(!A(this.uploadTracker,e=>this.$t(e),e=>N.warning(e)))return;let e={...this.config,callback_url:ot},t=this.credential?.token;if(!t){console.error(`no token specified`);return}N.info(this.$t(`headshots.message.startingTask`)),k(`headshots`,F.generate(e,{token:t})).then(()=>{N.success(this.$t(`headshots.message.startTaskSuccess`)),this.$store.commit(`headshots/setConfig`,{config:void 0})}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?N.error(this.$t(`headshots.message.usedUp`)):N.error(this.$t(`headshots.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function ct(e,t,n,r,i,a){let c=m(`config-panel`),l=m(`application-status`),u=m(`recent-panel`),f=m(`layout`);return d(),o(f,null,{config:h(()=>[s(c,{onGenerate:e.onGeneratePicture},null,8,[`onGenerate`])]),result:h(()=>[s(l,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:`mb-4`,onRefresh:e.onGetApplication,onSelect:t[0]||=t=>e.$store.dispatch(`headshots/setApplication`,t)},null,8,[`initializing`,`application`,`applications`,`service`,`need-apply`,`onRefresh`]),s(u,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var lt=O(st,[[`render`,ct],[`__scopeId`,`data-v-c707e859`]]);export{lt as default};
|