@acedatacloud/nexior 3.205.0 → 3.206.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/{Auth-Btt6pTzH.js → Auth-CSfb56OH.js} +1 -1
- package/dist/assets/{BotPlaceholder-GbwaSlCU.js → BotPlaceholder-Dy1gr-9h.js} +1 -1
- package/dist/assets/{Callback-6bnjihNg.js → Callback-BYME1VlY.js} +1 -1
- package/dist/assets/{Console-Bn90NCY-.js → Console-lBWrcjsC.js} +1 -1
- package/dist/assets/{Consumption-u-UR3f-q.js → Consumption-DVkwcyaB.js} +1 -1
- package/dist/assets/{Conversation-B236gz7t.js → Conversation-10zfI04-.js} +1 -1
- package/dist/assets/{CopyToClipboard-D2Ga1c-u.js → CopyToClipboard-UnYO6hAq.js} +1 -1
- package/dist/assets/{Detail-oNEtAZgY.js → Detail-DZKtD8io.js} +2 -2
- package/dist/assets/{Extra-CMvAIjee.js → Extra-DPpMWois.js} +1 -1
- package/dist/assets/{FilePreview-Yk89uJgC.js → FilePreview-B7MnxDfU.js} +1 -1
- package/dist/assets/{History-DO_r5ZBS.js → History-D6dr3Hov.js} +1 -1
- package/dist/assets/{IconPark.vue_vue_type_script_setup_true_lang-nuNysgL0.js → IconPark.vue_vue_type_script_setup_true_lang-SDs1IsFL.js} +1 -1
- package/dist/assets/{ImagePreview-D1oWKxPX.js → ImagePreview-C4OiWDg9.js} +1 -1
- package/dist/assets/{ImageWrapper-Dbzrv2-m.js → ImageWrapper-DcqueDH9.js} +1 -1
- package/dist/assets/{Index-B3FK7MLi.js → Index-B4AhoY-s.js} +1 -1
- package/dist/assets/{Index-CANAzSKl.js → Index-B8ME-u_E.js} +1 -1
- package/dist/assets/{Index-NrPbPLrH.js → Index-BMuqpm_q.js} +1 -1
- package/dist/assets/{Index-A_818KJU.js → Index-Baghl01K.js} +1 -1
- package/dist/assets/{Index-qaq-7Ral.js → Index-Bv2s_27T.js} +1 -1
- package/dist/assets/{Index-intZBKTu.js → Index-Bz3ITLtF.js} +1 -1
- package/dist/assets/{Index-BEYXqwoX.js → Index-C9Wrha4U.js} +1 -1
- package/dist/assets/{Index-DuSZYydg.js → Index-CBATDK9E.js} +1 -1
- package/dist/assets/{Index-BU42x1W5.js → Index-CMesc4Xc.js} +1 -1
- package/dist/assets/{Index-zY-gqgEu.js → Index-CVeZRx01.js} +1 -1
- package/dist/assets/{Index-Dnhq1F1O.js → Index-CeBv8r8l.js} +1 -1
- package/dist/assets/{Index-CxTnIz2F.js → Index-CiRWgQ-2.js} +1 -1
- package/dist/assets/{Index-CCt4FkN_.css → Index-D1p4IK9F.css} +1 -1
- package/dist/assets/{Index-BA6dCZyp.js → Index-D5DYhXUV.js} +1 -1
- package/dist/assets/{Index-D3UpAz6H.js → Index-DCN9OZCF.js} +1 -1
- package/dist/assets/{Index-guCuU9Rs.js → Index-DL2N84Ds.js} +1 -1
- package/dist/assets/{Index-D4esh723.js → Index-DaA0NCra.js} +1 -1
- package/dist/assets/{Index-CzYaOkvn.js → Index-Dasz5Em7.js} +1 -1
- package/dist/assets/{Index-Bog-6D8K.js → Index-DirH7cSv.js} +1 -1
- package/dist/assets/{Index-BaHzFWAO.js → Index-SFPWTqVD.js} +1 -1
- package/dist/assets/{Index-DQdtAMmP.js → Index-XE6kq-2M.js} +1 -1
- package/dist/assets/{Index-CMjs-Qul.js → Index-YfBUyTR2.js} +1 -1
- package/dist/assets/{Index-o_IsP2YJ.js → Index-__LWV3GV.js} +1 -1
- package/dist/assets/{Index-maB8zCCx.js → Index-iggsMn50.js} +1 -1
- package/dist/assets/{Index-DFsyexVb.js → Index-qcVZJBdC.js} +1 -1
- package/dist/assets/{Invitees-C80sJA3k.js → Invitees-DmseEV64.js} +1 -1
- package/dist/assets/{List-pzJh_k1y.js → List-D0koPLXY.js} +1 -1
- package/dist/assets/{List-I9SkQS_G.js → List-Dr3s27uo.js} +1 -1
- package/dist/assets/{List-BOh2SJ43.js → List-M5uwWU2x.js} +1 -1
- package/dist/assets/{Main-CRYuEUBO.js → Main-DJzR9yMb.js} +1 -1
- package/dist/assets/{Navigator-Dc6k1r-K.js → Navigator-CjIGA6hj.js} +1 -1
- package/dist/assets/{NoTasks-COwD2YRA.js → NoTasks-Dpcud_u4.js} +1 -1
- package/dist/assets/{NotFound-BMpwg9qq.js → NotFound-Cq0QMOF0.js} +1 -1
- package/dist/assets/{OAuthCallback-PTvOC1Gl.js → OAuthCallback--H6yOQ5o.js} +1 -1
- package/dist/assets/{Pagination-C-hIzPuE.js → Pagination-DMLrbyDg.js} +1 -1
- package/dist/assets/{Status-BYtt2-8H.js → Status-C3OMqSVk.js} +1 -1
- package/dist/assets/{Subscribe-B8s-qAbr.js → Subscribe-BFaBhkN-.js} +1 -1
- package/dist/assets/{VideoPlayer-BOBrupFS.js → VideoPlayer-B-GlKJVH.js} +1 -1
- package/dist/assets/{_Uint8Array-DiKiqj6b.js → _Uint8Array-Dhv101dV.js} +1 -1
- package/dist/assets/{_baseClone-C7mAsPbg.js → _baseClone-D4Hl6Ymo.js} +1 -1
- package/dist/assets/{_baseIteratee-CCcx0UCd.js → _baseIteratee-URGnejHV.js} +1 -1
- package/dist/assets/{_initCloneObject-DHUwupd_.js → _initCloneObject-QV4IIV31.js} +1 -1
- package/dist/assets/{add-CSsqG6iy.js → add-DiZxRfyv.js} +1 -1
- package/dist/assets/{all-wallets-1OJm3jva.js → all-wallets-CA9kjtPr.js} +1 -1
- package/dist/assets/{app-store-DwcBjzfw.js → app-store-BCdBcz5B.js} +1 -1
- package/dist/assets/{apple-Capy_-dR.js → apple-D2H-LpvN.js} +1 -1
- package/dist/assets/{arrow-bottom-q2UE3M6K.js → arrow-bottom-D7Saw1wE.js} +1 -1
- package/dist/assets/{arrow-bottom-circle-jqUJnDqL.js → arrow-bottom-circle-qnXeaRx8.js} +1 -1
- package/dist/assets/{arrow-left-CerC92Jn.js → arrow-left-BCE22ALC.js} +1 -1
- package/dist/assets/{arrow-right-sSGRyesI.js → arrow-right-SsSFJ46C.js} +1 -1
- package/dist/assets/{arrow-top-CyE3s4u-.js → arrow-top-PyB9YJIL.js} +1 -1
- package/dist/assets/{avatar-DpWKzwfa.js → avatar-C9Pg0w_c.js} +1 -1
- package/dist/assets/{bank-5oUKAhup.js → bank-CyTn1N8k.js} +1 -1
- package/dist/assets/{basic-CWywewhV.js → basic-B30XfaoD.js} +1 -1
- package/dist/assets/{browser-yYidcVNO.js → browser-h2vsWFJr.js} +1 -1
- package/dist/assets/{byokCredential-BcQvQTIB.js → byokCredential-BhS7uMA-.js} +1 -1
- package/dist/assets/{card-DHXL-Qg2.js → card-DKehLwUY.js} +1 -1
- package/dist/assets/{castArray-DbfVevQg.js → castArray-DD0p5-P9.js} +1 -1
- package/dist/assets/{chat-z19dTmYH.js → chat-L6m5LCyf.js} +1 -1
- package/dist/assets/{checkmark-CRou_fdo.js → checkmark-DCCGge-I.js} +1 -1
- package/dist/assets/{checkmark-bold--Izc2Ajz.js → checkmark-bold-BjtXpXNX.js} +1 -1
- package/dist/assets/{chevron-bottom-CZmGJFDf.js → chevron-bottom-CmdeH3YF.js} +1 -1
- package/dist/assets/{chevron-left-HROvGwkU.js → chevron-left-jekdBZYG.js} +1 -1
- package/dist/assets/{chevron-right-C9KoNV5n.js → chevron-right-LfqT_ogg.js} +1 -1
- package/dist/assets/{chevron-top-DTdArReJ.js → chevron-top-CEAm5to6.js} +1 -1
- package/dist/assets/{chrome-store-BoA_e9cR.js → chrome-store-BR7UKoMo.js} +1 -1
- package/dist/assets/{clock-yRQK7DSS.js → clock-DB9rcQyy.js} +1 -1
- package/dist/assets/{close-BcIEenO0.js → close-CDLiDwhi.js} +1 -1
- package/dist/assets/{coinPlaceholder-EORJQyP2.js → coinPlaceholder-BSe6THBQ.js} +1 -1
- package/dist/assets/{compass-f-RMWYy7.js → compass-DzdDf23d.js} +1 -1
- package/dist/assets/{copy-Cn5Tw6Rm.js → copy-B5-OW2a2.js} +1 -1
- package/dist/assets/{createTaskActions-Slgod3XK.js → createTaskActions-2NM5wfUJ.js} +1 -1
- package/dist/assets/{cursor-Df5BNRuc.js → cursor-C6Ujgj3H.js} +1 -1
- package/dist/assets/{cursor-transparent-DK7kEr72.js → cursor-transparent-DikOUPZ7.js} +1 -1
- package/dist/assets/{debounce-B-jn60n6.js → debounce-CQuM7WhN.js} +1 -1
- package/dist/assets/{desktop-C0WJURcd.js → desktop-BKDvEQGr.js} +1 -1
- package/dist/assets/{disconnect-H9Q2ggqk.js → disconnect-yMe0chPA.js} +1 -1
- package/dist/assets/{discord-IeB0eQXY.js → discord-BqdL6YRL.js} +1 -1
- package/dist/assets/{distribution-BtThzIIU.js → distribution-CdFl_HYM.js} +1 -1
- package/dist/assets/{dropdown-C7n2JFJ_.js → dropdown-Be9A6Q1U.js} +1 -1
- package/dist/assets/{etherscan-DmPkk5ZH.js → etherscan-VSRxJAHz.js} +1 -1
- package/dist/assets/{exclamation-triangle-CaSPxuc8.js → exclamation-triangle-C4ZeuUXe.js} +1 -1
- package/dist/assets/{extension-D_lQmWk_.js → extension-CYSGh5Ps.js} +1 -1
- package/dist/assets/{external-link-BPp-vd1d.js → external-link-C2t48ySQ.js} +1 -1
- package/dist/assets/{facebook-DU8HW7fL.js → facebook-DX84uKaw.js} +1 -1
- package/dist/assets/{farcaster-BCDodja_.js → farcaster-D7krxIjZ.js} +1 -1
- package/dist/assets/{filters-CAQNbjLT.js → filters-_NOp5ZNB.js} +1 -1
- package/dist/assets/{github-BRBavveb.js → github-IswwPpZb.js} +1 -1
- package/dist/assets/{google-BTV7MOZy.js → google-ha9xfgLN.js} +1 -1
- package/dist/assets/{help-circle-CXPct6kV.js → help-circle-Dq5mSEXw.js} +1 -1
- package/dist/assets/{id-CWX0WcMk.js → id-m1VjxbRl.js} +1 -1
- package/dist/assets/{image-CEgaw_wF.js → image-BeNPNxJW.js} +1 -1
- package/dist/assets/{index-D4Nfwhot.js → index-0bs-5Squ.js} +1 -1
- package/dist/assets/{index-BcNn3Owf.js → index-1diQ6JT1.js} +1 -1
- package/dist/assets/{index-B0Cwb-D-.js → index-3c5oSDnc.js} +1 -1
- package/dist/assets/{index-BxqWObY-.js → index-5QUi5jMP.js} +1 -1
- package/dist/assets/{index-8PxRxOr7.js → index-6RhQMvFk.js} +1 -1
- package/dist/assets/{index-XldQDSvy.js → index-7i1RSn5L.js} +1 -1
- package/dist/assets/{index-CC1GYYiO.js → index-9yJ1N7L6.js} +1 -1
- package/dist/assets/{index-CkfWRF3i.js → index-B1DLX4Fc.js} +1 -1
- package/dist/assets/{index-CJ8YZq-e.js → index-B1msaBme.js} +1 -1
- package/dist/assets/{index-CfLu_-DC.js → index-B5O-vJei.js} +1 -1
- package/dist/assets/{index-D-SiG2bP.js → index-B5vjdbxo.js} +1 -1
- package/dist/assets/{index-CrHljC3L.js → index-B6qEofLE.js} +1 -1
- package/dist/assets/{index-Bj_l3YE1.js → index-B9UWj95d.js} +1 -1
- package/dist/assets/{index-Dh9cN3MT.js → index-BDF48iTM.js} +1 -1
- package/dist/assets/{index-BPk2ZoOA.js → index-BHtuVUFl.js} +1 -1
- package/dist/assets/{index-DEzoxp4P.js → index-BLYgMn4W.js} +1 -1
- package/dist/assets/{index-DhEXa3rl.js → index-BXLA00YT.js} +5 -5
- package/dist/assets/{index--wj6jIMm.js → index-BY_Hhm9s.js} +1 -1
- package/dist/assets/{index-CJU1rzzV.js → index-Bbh6HVkj.js} +1 -1
- package/dist/assets/{index-E1-z9_FO.js → index-BbjLkNT5.js} +1 -1
- package/dist/assets/{index-Czr8KjFL.js → index-Bcw8SuLC.js} +1 -1
- package/dist/assets/{index-BexlGeiF.js → index-BfSiZO1Q.js} +1 -1
- package/dist/assets/{index-BRkjZCA9.js → index-BlFREO4o.js} +1 -1
- package/dist/assets/{index-DwdzCCvr.js → index-Bq9ls24b.js} +1 -1
- package/dist/assets/{index-Db5A7UiS.js → index-BwEtWche.js} +1 -1
- package/dist/assets/{index-1ShHusMJ.js → index-C9dS1Vww.js} +1 -1
- package/dist/assets/{index-DDJccgho.js → index-CCfnxGYg.js} +14 -14
- package/dist/assets/{index-NKZy8Kup.js → index-CNJJpejN.js} +1 -1
- package/dist/assets/{index-CYNlas3C.js → index-CQzk_lha.js} +2 -2
- package/dist/assets/{index-DRml_940.js → index-CWRXZUk7.js} +1 -1
- package/dist/assets/{index-jDtcXBDh.js → index-CWu2cUvK.js} +1 -1
- package/dist/assets/{index-jfd6yJXw.js → index-Cgotms-9.js} +1 -1
- package/dist/assets/{index-CrrjzMcm.js → index-CjbcI5gK.js} +1 -1
- package/dist/assets/{index-DtUQgyoo.js → index-CoYnpgkX.js} +1 -1
- package/dist/assets/{index-BjCVlRvR.js → index-CpWcFmdT.js} +1 -1
- package/dist/assets/{index-BLpimmhu.js → index-CqLRzQZy.js} +1 -1
- package/dist/assets/{index-CoxAL6cY.js → index-D2dNGLLf.js} +1 -1
- package/dist/assets/{index-DK4DFfU5.js → index-DM6P3x3N.js} +1 -1
- package/dist/assets/{index-DvAK66cN.js → index-DPHGUkiZ.js} +3 -3
- package/dist/assets/{index-D-KZRZPp.js → index-DU5biqWK.js} +1 -1
- package/dist/assets/{index-vXv88WGu.js → index-DdTPL-Mv.js} +1 -1
- package/dist/assets/{index-KTCvYGRT.js → index-DdrN6aYX.js} +1 -1
- package/dist/assets/{index-CF3WiTXj.js → index-DgJP0RTq.js} +1 -1
- package/dist/assets/{index-BiY8NhQz.js → index-DlCMkuoQ.js} +1 -1
- package/dist/assets/{index-AY_a57-2.js → index-DoifIIRJ.js} +1 -1
- package/dist/assets/{index-B3rcDSvw.js → index-DpJj9HmB.js} +1 -1
- package/dist/assets/{index-DkEDXKbD.js → index-Dwk0fHJ3.js} +1 -1
- package/dist/assets/{index-CL16wKMg.js → index-Dxq53QkJ.js} +1 -1
- package/dist/assets/{index-BNnRgS-m.js → index-DzM45IpD.js} +1 -1
- package/dist/assets/{index-BXRm1Wkj.js → index-F6di8YRk.js} +1 -1
- package/dist/assets/{index-tp_8uoOw.js → index-MuxMnGqS.js} +1 -1
- package/dist/assets/{index-CvXuDec2.js → index-Pm_NNVry.js} +1 -1
- package/dist/assets/{index-BezIKGY2.js → index-TGK76xjl.js} +1 -1
- package/dist/assets/{index-WR344acd.js → index-TQ6wokdY.js} +1 -1
- package/dist/assets/{index-BRqmY-RG.css → index-TamUeM_6.css} +1 -1
- package/dist/assets/{index-Barfweya.js → index-Z7FqG7qm.js} +1 -1
- package/dist/assets/{index-DBQvlqm3.js → index-mTDdtUSQ.js} +1 -1
- package/dist/assets/{index-wrqbgHKw.js → index-oRUvw3Ui.js} +1 -1
- package/dist/assets/{index-DPTJ434_.js → index-oXSgzRw8.js} +1 -1
- package/dist/assets/{index-BbSliDK4.js → index-sF_c-ZTZ.js} +1 -1
- package/dist/assets/{index-Fsk4KlF3.js → index-yQOfqDCz.js} +1 -1
- package/dist/assets/{index.browser.esm-BL2Ey0-n.js → index.browser.esm-Ec1sdTPa.js} +1 -1
- package/dist/assets/{index.es-rfDbxZpm.js → index.es-D5toi_yB.js} +1 -1
- package/dist/assets/{info-D2l7QzjY.js → info-CbPpfCBR.js} +1 -1
- package/dist/assets/{info-circle-BxIOOm5L.js → info-circle-C7LMv3wy.js} +1 -1
- package/dist/assets/{isEqual-CC5LQv_R.js → isEqual-1RENOQre.js} +1 -1
- package/dist/assets/{isPlainObject-CJWHXdHh.js → isPlainObject-CS0cmpQf.js} +1 -1
- package/dist/assets/{lightbulb-BSeFOGXJ.js → lightbulb-CRhf61JD.js} +1 -1
- package/dist/assets/{mail-DpqsFv2K.js → mail-Ciy-_QID.js} +1 -1
- package/dist/assets/{midjourney-l-1NrC29.js → midjourney-HC3LAlrs.js} +1 -1
- package/dist/assets/{mobile-Ds7c2ZWr.js → mobile-CPVh5p5n.js} +1 -1
- package/dist/assets/{more-C68tjgQk.js → more-B_z-uJxf.js} +1 -1
- package/dist/assets/{network-placeholder-CwtTGGhG.js → network-placeholder-DFTSuhGH.js} +1 -1
- package/dist/assets/{nftPlaceholder-BgF5Rv2q.js → nftPlaceholder-DiM6ZvWl.js} +1 -1
- package/dist/assets/{off-DMfVr4lB.js → off-Dv23VNZK.js} +1 -1
- package/dist/assets/{order-CpYUdg6S.js → order-DSUfJcNS.js} +1 -1
- package/dist/assets/{pagination-CDk6ho1i.js → pagination-BO6RV-kc.js} +1 -1
- package/dist/assets/{play-store-_lTFJbfW.js → play-store-DXERZsFT.js} +1 -1
- package/dist/assets/{plus-esh9-Ccz.js → plus-Dem0uVoZ.js} +1 -1
- package/dist/assets/{price-C2VbzPrG.js → price-DPkoP0YP.js} +1 -1
- package/dist/assets/{producer-CsUqKcEm.js → producer-CBZL3Tt8.js} +1 -1
- package/dist/assets/{qr-code-DJTYtaHd.js → qr-code-C6MN6eiv.js} +1 -1
- package/dist/assets/{recycle-horizontal-gDTg51lY.js → recycle-horizontal-e7OAO3BB.js} +1 -1
- package/dist/assets/{refresh-CkcCQL4X.js → refresh-BZL6-I1K.js} +1 -1
- package/dist/assets/{reown-logo-DhnFwfFL.js → reown-logo-D2M2JHp4.js} +1 -1
- package/dist/assets/{search-B2klky-Z.js → search-CZzguwmn.js} +1 -1
- package/dist/assets/{secp256k1-fj9osoWp.js → secp256k1-9xwshtD-.js} +1 -1
- package/dist/assets/{secp256k1-Dw7MKfuz.js → secp256k1-CuUMuaUz.js} +1 -1
- package/dist/assets/{seedream-BbmlG6zu.js → seedream-Bb4LS1xp.js} +1 -1
- package/dist/assets/{send-ssAMcrG8.js → send-ChJZTEP2.js} +1 -1
- package/dist/assets/{service-DtKFC7nd.js → service-dszq0yWz.js} +1 -1
- package/dist/assets/{solana-wallets-CK9PVGbr.js → solana-wallets-DHA44qD6.js} +2 -2
- package/dist/assets/{solana-wallets-vue-Cmevmy6S.js → solana-wallets-vue-Dy7_7s0F.js} +1 -1
- package/dist/assets/{suno-DGo39dBP.js → suno-DZUIu5iQ.js} +1 -1
- package/dist/assets/{swapHorizontal-BsiptE8y.js → swapHorizontal-Bs1loZJ0.js} +1 -1
- package/dist/assets/{swapHorizontalBold-CGHH4dd4.js → swapHorizontalBold-DesPLud9.js} +1 -1
- package/dist/assets/{swapHorizontalMedium-Clk0CMTO.js → swapHorizontalMedium-rCDxIvRe.js} +1 -1
- package/dist/assets/{swapHorizontalRoundedBold-DrAICN4o.js → swapHorizontalRoundedBold-CqJlLgjd.js} +1 -1
- package/dist/assets/{swapVertical-QPfaf4dn.js → swapVertical-DzdY--dV.js} +1 -1
- package/dist/assets/{telegram-B0jmmXS4.js → telegram-B25J3wn3.js} +1 -1
- package/dist/assets/{three-dots-DoBM-RdY.js → three-dots-BxpOjm5v.js} +1 -1
- package/dist/assets/{twitch-5b4vnuPN.js → twitch-ClxYbBcn.js} +1 -1
- package/dist/assets/{twitterIcon-CEdcIRtK.js → twitterIcon-czoCz_op.js} +1 -1
- package/dist/assets/{typescript-CCF0uyn2.js → typescript-DYVOpHug.js} +1 -1
- package/dist/assets/{use-form-item-1C5uFRHv.js → use-form-item-BdyDMPU-.js} +1 -1
- package/dist/assets/validator-B70qvqYD.js +1 -0
- package/dist/assets/{verify-D-axKCsE.js → verify-D7EJG1ou.js} +1 -1
- package/dist/assets/{verify-filled-CuVnLSqO.js → verify-filled-d0eV_EPV.js} +1 -1
- package/dist/assets/{w3m-modal-vGq_64Af.js → w3m-modal-CBwHoVyK.js} +1 -1
- package/dist/assets/{wallet-BH7EYkWk.js → wallet-BI8hd63W.js} +1 -1
- package/dist/assets/{wallet-placeholder-B0IdRDyC.js → wallet-placeholder--PgzZ8AB.js} +1 -1
- package/dist/assets/{walletconnect-SLf0tztt.js → walletconnect-CbbQ1JOe.js} +1 -1
- package/dist/assets/{warning-circle-XnAyhDSJ.js → warning-circle-DnyZS71o.js} +1 -1
- package/dist/assets/{web-DbKxzxyW.js → web-DLCZq3oI.js} +1 -1
- package/dist/assets/{web-U6fQOFKs.js → web-Nk2aCv1V.js} +1 -1
- package/dist/assets/{x-DJuIDGAr.js → x-Dk_bD2dZ.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/validator-BmyjrUCG.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as E}from"./index.es-rfDbxZpm.js";import{E as L}from"./index-DBQvlqm3.js";import{E as re}from"./index-D-KZRZPp.js";import{d as b,H as m,E as i,z as N,C as n,y as h,D as o,q as l,F as r,x as C,O as V,N as T,Q as U,J as v,R as ve,I as w,M as be}from"./vendor-vue-NSDaktjZ.js";import{G as y,bj as G,ag as ye,H as we,co as ee,aF as te,S as oe,cp as Ce}from"./index-DDJccgho.js";import{b as Se,c as ne,d as F,e as D,f as Ve,g as Ie,h as Te}from"./kling-CtoPhhA9.js";import{E as A,a as P}from"./index-CJ8YZq-e.js";import{E as q}from"./index-jDtcXBDh.js";import{E as S}from"./index-DtUQgyoo.js";import{I,S as Ee,l as Le}from"./pagination-CDk6ho1i.js";import{p as H}from"./pasteUploadMixin-BurWbGNQ.js";import{I as K}from"./ImagePreview-D1oWKxPX.js";import{E as W}from"./index-DK4DFfU5.js";import{E as O}from"./index-Db5A7UiS.js";import{C as ce}from"./Consumption-u-UR3f-q.js";import{E as de}from"./index-BexlGeiF.js";import{E as me}from"./index-8PxRxOr7.js";import{E as ue}from"./index-XldQDSvy.js";import{P as Me,N as Re}from"./NoTasks-COwD2YRA.js";import{E as pe}from"./index-D-SiG2bP.js";import{a as ge}from"./price-C2VbzPrG.js";import{F as Ue}from"./FilePreview-Yk89uJgC.js";import{E as De,a as Ae}from"./index-CL16wKMg.js";import{E as Pe,a as Ge}from"./index-BbSliDK4.js";import{b as se}from"./errorCode-Cqj9Td_Z.js";import{C as Ke}from"./CopyToClipboard-D2Ga1c-u.js";import{V as Oe}from"./VideoPlayer-BOBrupFS.js";import{E as je}from"./index-wrqbgHKw.js";import{E as Ne}from"./index-CkfWRF3i.js";import{B as Be}from"./BotPlaceholder-GbwaSlCU.js";import"./use-form-item-1C5uFRHv.js";import"./index-BuyEbX8F.js";import"./vendor-axios-B8_nURbH.js";import"./vendor-dayjs-v0j1UNZp.js";import"./vendor-vue-router-Df5ITouH.js";import"./index-DkEDXKbD.js";import"./typescript-CCF0uyn2.js";import"./index-BPk2ZoOA.js";import"./strings-beZM2Y-f.js";import"./isEqual-CC5LQv_R.js";import"./_Uint8Array-DiKiqj6b.js";import"./castArray-DbfVevQg.js";import"./debounce-B-jn60n6.js";import"./_baseIteratee-CCcx0UCd.js";import"./index-B0Cwb-D-.js";import"./validator-BmyjrUCG.js";import"./index-BjCVlRvR.js";import"./_baseClone-C7mAsPbg.js";import"./_initCloneObject-DHUwupd_.js";import"./index-Cu41y2Fl.js";import"./index-E1-z9_FO.js";import"./isPlainObject-CJWHXdHh.js";import"./vue-plyr-BO2nlN4c.js";import"./index-BcNn3Owf.js";const ze=b({name:"LayoutKling",components:{ElDrawer:re,ElButton:L,FontAwesomeIcon:E},data(){return{drawer:!1}}}),Fe={class:"main flex flex-row flex-1 min-h-0"},qe={class:"config w-[320px] flex-none h-full flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},He={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,t,s,a,u,$){const d=o("font-awesome-icon"),p=o("el-button"),f=o("el-drawer");return l(),m("div",Fe,[i("div",qe,[N(e.$slots,"config",{},void 0,!0)]),i("div",He,[N(e.$slots,"result",{},void 0,!0)]),n(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=c=>e.drawer=!0)},{default:h(()=>[n(d,{icon:"fa-solid fa-magic"})]),_:1}),n(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=c=>e.drawer=c),direction:"ltr","with-header":!1,size:"350px"},{default:h(()=>[N(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const Je=y(ze,[["render",We],["__scopeId","data-v-be4bb0df"]]),Qe={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};function J(e,t,s){const a=t||"std",u=s??5;switch(e){case"kling-v1":return{text2video:!0,image2video:!0,endImage:u===5,audio:!1,motionControl:u===5};case"kling-v1-6":case"kling-v2-5-turbo":return{text2video:!0,image2video:!0,endImage:a==="pro",audio:!1,motionControl:!1};case"kling-v2-6":return{text2video:!0,image2video:!0,endImage:a==="pro",audio:a==="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:a!=="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 Qe}}function Q(e,t){if(!e)return[];const s=t.model??e.model,a=t.mode??e.mode,u=t.duration??e.duration;if(!s)return[];const $=J(s,a,u),d=[];return e.end_image_url&&!$.endImage&&d.push({field:"end_image_url",i18nLabel:"kling.name.endImage"}),e.generate_audio&&!$.audio&&d.push({field:"generate_audio",i18nLabel:"kling.name.generateAudio"}),e.camera_control?.type&&(!$.motionControl||e.start_image_url)&&d.push({field:"camera_control",i18nLabel:"kling.name.cameraControl"}),d}function Y(e,t){const s={...e};for(const a of t)a.field==="end_image_url"&&(s.end_image_url=void 0),a.field==="generate_audio"&&(s.generate_audio=!1),a.field==="camera_control"&&(s.camera_control=void 0);return s}const Ye=b({name:"ModelSelector",components:{ElSelect:P,ElOption:A},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(Se)},methods:{async onChange(e){const t=this.$store.state.kling?.config||{},s=Q(t,{model:e});if(s.length===0){this.applyModel(e);return}const a=s.map(u=>this.$t(u.i18nLabel)).join("、");try{await q.confirm(this.$t("kling.message.featureNotSupportedBody",{fields:a}),this.$t("kling.message.featureNotSupportedTitle"),{confirmButtonText:this.$t("kling.button.confirmContinue"),cancelButtonText:this.$t("kling.button.cancelSwitch"),type:"warning"});const u=Y({...t,model:e},s);this.$store.commit("kling/setConfig",u),S.success(this.$t("kling.message.featureRemovedNotice",{fields:a}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}}),Xe={class:"field"},Ze={class:"title font-bold"};function xe(e,t,s,a,u,$){const d=o("el-option"),p=o("el-select");return l(),m("div",Xe,[i("h2",Ze,r(e.$t("pika.name.model")),1),(l(),C(p,{key:e.revertKey,"model-value":e.value,class:"value",placeholder:e.$t("pika.placeholder.select"),onChange:e.onChange},{default:h(()=>[(l(!0),m(V,null,T(e.options,f=>(l(),C(d,{key:f.value,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","onChange"]))])}const et=y(Ye,[["render",xe],["__scopeId","data-v-04059875"]]),tt=b({name:"ModeSelector",components:{ElSelect:P,ElOption:A,InfoIcon:I},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 F.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(ne)}},mounted(){this.value||this.applyMode(ne)},methods:{async onChange(e){const t=this.$store.state.kling?.config||{},s=Q(t,{mode:e});if(s.length===0){this.applyMode(e);return}const a=s.map(u=>this.$t(u.i18nLabel)).join("、");try{await q.confirm(this.$t("kling.message.featureNotSupportedBody",{fields:a}),this.$t("kling.message.featureNotSupportedTitle"),{confirmButtonText:this.$t("kling.button.confirmContinue"),cancelButtonText:this.$t("kling.button.cancelSwitch"),type:"warning"});const u=Y({...t,mode:e},s);this.$store.commit("kling/setConfig",u),S.success(this.$t("kling.message.featureRemovedNotice",{fields:a}))}catch{this.revertKey+=1}},applyMode(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}}),ot={class:"field"},nt={class:"header"},st={class:"title font-bold"},it={key:0,class:"opt-tip"};function lt(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-option"),f=o("el-select");return l(),m("div",ot,[i("div",nt,[i("h2",st,r(e.$t("kling.name.mode")),1),n(d,{content:e.$t("kling.description.mode"),class:"info-icon"},null,8,["content"])]),(l(),C(f,{key:e.revertKey,"model-value":e.value,class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0,onChange:e.onChange},{default:h(()=>[(l(!0),m(V,null,T(e.options,c=>(l(),C(p,{key:c.value,label:c.label,value:c.value,disabled:c.disabled},{default:h(()=>[i("span",{class:U({"opt-disabled":c.disabled})},r(c.label),3),c.disabled&&c.disabledReason?(l(),m("span",it,r(c.disabledReason),1)):v("",!0)]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["model-value","placeholder","onChange"]))])}const at=y(tt,[["render",lt],["__scopeId","data-v-9a8fa3c5"]]),rt=[3,5,8,10,12,15],ct=[5,10],dt=b({name:"DurationSelector",components:{ElSelect:P,ElOption:A,InfoIcon:I},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||""},isV3Model(){return F.includes(this.selectedModel)},allowedDurations(){return this.isV3Model?rt:ct},value(){return this.$store.state.kling?.config?.duration??D},selectValue(){const e=this.allowedDurations;return e.includes(this.value)?this.value:e.includes(D)?D:e[0]}},watch:{isV3Model(){this.allowedDurations.includes(this.value)||this.applyDuration(D)}},mounted(){this.$store.state.kling?.config?.duration||this.applyDuration(D)},methods:{async onChange(e){const t=this.$store.state.kling?.config||{},s=Q(t,{duration:e});if(s.length===0){this.applyDuration(e);return}const a=s.map(u=>this.$t(u.i18nLabel)).join("、");try{await q.confirm(this.$t("kling.message.featureNotSupportedBody",{fields:a}),this.$t("kling.message.featureNotSupportedTitle"),{confirmButtonText:this.$t("kling.button.confirmContinue"),cancelButtonText:this.$t("kling.button.cancelSwitch"),type:"warning"});const u=Y({...t,duration:e},s);this.$store.commit("kling/setConfig",u),S.success(this.$t("kling.message.featureRemovedNotice",{fields:a}))}catch{this.revertKey+=1}},applyDuration(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}}),mt={class:"field"},ut={class:"control"},pt={class:"label"},gt={class:"title font-bold"};function ft(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-option"),f=o("el-select");return l(),m("div",mt,[i("div",ut,[i("div",pt,[i("h2",gt,r(e.$t("kling.name.duration")),1),n(d,{content:e.$t("kling.description.duration"),class:"info-icon ml-1"},null,8,["content"])]),(l(),C(f,{key:e.revertKey,"model-value":e.selectValue,class:"value",placeholder:e.$t("kling.placeholder.select"),onChange:e.onChange},{default:h(()=>[(l(!0),m(V,null,T(e.allowedDurations,c=>(l(),C(p,{key:c,label:`${c}s`,value:c},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","onChange"]))])])}const ht=y(dt,[["render",ft],["__scopeId","data-v-5ae55e28"]]),_t=b({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||(this.value=Ve)}}),$t={class:"text-sm font-bold mb-2 block"},kt={class:"items"},vt=["onClick"],bt={class:"name"};function yt(e,t,s,a,u,$){return l(),m("div",null,[i("span",$t,r(e.$t("kling.name.ratio")),1),i("div",kt,[(l(!0),m(V,null,T(e.options,(d,p)=>(l(),m("div",{key:p,class:U({active:e.active===p,item:!0}),onClick:f=>e.value=d.value},[i("div",{class:U(["preview",d.label])},[i("div",{class:"rect",style:ve({width:d.width+"px",height:d.height+"px"})},null,4)],2),i("p",bt,r(d.label),1)],10,vt))),128))])])}const wt=y(_t,[["render",yt],["__scopeId","data-v-cdb14b2f"]]),Ct=b({name:"StartImage",components:{ElUpload:O,ElButton:L,ElTooltip:W,InfoIcon:I,FontAwesomeIcon:E,ImagePreview:K},mixins:[H],emits:["change"],data(){return{fileList:[],uploadUrl:G()+"/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||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){S.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){S.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),St={class:"relative"},Vt={class:"flex justify-between"},It={class:"flex justify-start items-center"},Tt={class:"text-sm font-bold"};function Et(e,t,s,a,u,$){const d=o("info-icon"),p=o("image-preview"),f=o("font-awesome-icon"),c=o("el-button"),k=o("el-tooltip"),g=o("el-upload");return l(),m("div",St,[i("div",Vt,[i("div",It,[i("span",Tt,r(e.$t("kling.name.startImage")),1),n(d,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),n(g,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=_=>e.fileList=_),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:h(({file:_})=>[_.url&&_.percentage!==void 0?(l(),C(p,{key:0,url:_.url,name:_.name,percentage:_.percentage,onRemove:M=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:h(()=>[n(k,{content:e.$t("kling.message.uploadReferencesExceed"),disabled:!e.reachedLimit,placement:"top"},{default:h(()=>[i("span",null,[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload",disabled:e.reachedLimit},{default:h(()=>[n(f,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+r(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"])])}const Lt=y(Ct,[["render",Et],["__scopeId","data-v-68cf38f5"]]),Mt=b({name:"EndImage",components:{ElUpload:O,ElButton:L,ElTooltip:W,ImagePreview:K,InfoIcon:I,FontAwesomeIcon:E},mixins:[H],data(){return{fileList:[],uploadUrl:G()+"/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||(this.value=void 0),this.onSetEndImageUrl()},methods:{onBeforeUpload(){return this.endImageSupported?this.hasStartImage?!0:(S.warning(this.$t("kling.message.endImageRequiresStart")),!1):(S.warning(this.$t("kling.message.endImageNotSupported")),!1)},onExceed(){S.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){S.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Rt={class:"relative"},Ut={class:"flex justify-between"},Dt={class:"flex justify-start items-center"},At={class:"text-sm font-bold"};function Pt(e,t,s,a,u,$){const d=o("info-icon"),p=o("image-preview"),f=o("font-awesome-icon"),c=o("el-button"),k=o("el-tooltip"),g=o("el-upload");return l(),m("div",Rt,[i("div",Ut,[i("div",Dt,[i("span",At,r(e.$t("kling.name.endImage")),1),n(d,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),n(g,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=_=>e.fileList=_),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:h(({file:_})=>[_.url&&_.percentage!==void 0?(l(),C(p,{key:0,url:_.url,name:_.name,percentage:_.percentage,onRemove:M=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:h(()=>[n(k,{content:e.uploadTooltip,disabled:!e.uploadDisabled,placement:"top"},{default:h(()=>[i("span",null,[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload",disabled:e.uploadDisabled},{default:h(()=>[n(f,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+r(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"])])}const Gt=y(Mt,[["render",Pt],["__scopeId","data-v-593c3bde"]]),Kt=b({name:"CfgScaleSelector",components:{ElSlider:me,InfoIcon:I,ElInputNumber:de},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||(this.value=Ie)}}),Ot={class:"flex justify-between"},jt={class:"flex justify-start items-center"},Nt={class:"text-sm font-bold"},Bt={class:"flex justify-end items-center"},zt={class:"w-full"};function Ft(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-input-number"),f=o("el-slider");return l(),m("div",null,[i("div",Ot,[i("div",jt,[i("span",Nt,r(e.$t("kling.name.cfgScale")),1),n(d,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),i("div",Bt,[n(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),"controls-position":"right"},null,8,["modelValue"])])]),i("div",zt,[n(f,{modelValue:e.value,"onUpdate:modelValue":t[1]||(t[1]=c=>e.value=c),min:0,max:1,step:.1},null,8,["modelValue"])])])}const qt=y(Kt,[["render",Ft]]),Ht=b({name:"GenerateAudioSelector",components:{ElSwitch:ue,InfoIcon:I},computed:{selectedModel(){return this.$store.state.kling?.config?.model||""},selectedMode(){return this.$store.state.kling?.config?.mode||""},supported(){return!!(F.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??Te:!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"},Jt={class:"flex justify-between items-center"},Qt={class:"flex justify-start items-center"},Yt={class:"text-sm font-bold"};function Xt(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-switch");return l(),m("div",Wt,[i("div",Jt,[i("div",Qt,[i("span",Yt,r(e.$t("kling.name.generateAudio")),1),n(d,{content:e.tooltipContent},null,8,["content"])]),n(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),class:"value",disabled:!e.supported},null,8,["modelValue","disabled"])])])}const Zt=y(Ht,[["render",Xt]]),xt=["horizontal","vertical","pan","tilt","roll","zoom"],eo=b({name:"CameraControlSelector",components:{ElSelect:P,ElOption:A,ElSlider:me,ElInputNumber:de,InfoIcon:I},data(){return{configKeys:xt}},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){const t=this.$store.state.kling?.config||{};if(!e){const a={...t};delete a.camera_control,this.$store.commit("kling/setConfig",a);return}const s=e;this.$store.commit("kling/setConfig",{...t,camera_control:{type:s,config:s==="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){const s=this.$store.state.kling?.config||{},a=s.camera_control||{type:"simple"},u={...a.config||{}};t==null?delete u[e]:u[e]=t,this.$store.commit("kling/setConfig",{...s,camera_control:{...a,type:"simple",config:u}})},onSliderChange(e,t){this.writeConfig(e,t)},onNumberChange(e,t){this.writeConfig(e,t)}}}),to={class:"field"},oo={class:"header"},no={class:"text-sm font-bold"},so={key:0,class:"config-grid"},io={class:"cfg-row-head"},lo={class:"cfg-name"};function ao(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-option"),f=o("el-select"),c=o("el-input-number"),k=o("el-slider");return l(),m("div",to,[i("div",oo,[i("span",no,r(e.$t("kling.name.cameraControl")),1),n(d,{content:e.tooltipContent},null,8,["content"])]),n(f,{modelValue:e.selectedTypeRaw,"onUpdate:modelValue":t[0]||(t[0]=g=>e.selectedTypeRaw=g),class:"value",placeholder:e.$t("kling.placeholder.cameraType"),clearable:!0,disabled:e.disabled},{default:h(()=>[(l(!0),m(V,null,T(e.typeOptions,g=>(l(),C(p,{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"]),e.selectedType==="simple"&&!e.disabled?(l(),m("div",so,[(l(!0),m(V,null,T(e.configKeys,g=>(l(),m("div",{key:g,class:"cfg-row"},[i("div",io,[i("span",lo,r(e.$t(`kling.name.cc_${g}`)),1),n(c,{modelValue:e.configValues[g],"onUpdate:modelValue":_=>e.configValues[g]=_,min:-1,max:1,step:.1,precision:1,"controls-position":"right",size:"small",class:"cfg-num",onChange:_=>e.onNumberChange(g,_)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),n(k,{"model-value":e.configValues[g]??0,min:-1,max:1,step:.1,onInput:_=>e.onSliderChange(g,_)},null,8,["model-value","onInput"])]))),128))])):v("",!0)])}const ro=y(eo,[["render",ao],["__scopeId","data-v-cd896060"]]),fe=[{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"]}],B=", ";function co(e,t){const s=(e||"").trim();return s?s.includes(t)?s:`${s}${B}${t}`:t}function z(e,t){if(!e||!t)return e||"";const s=[`${t}${B}`,`${B}${t}`,t];let a=e;for(const u of s)if(a.includes(u)){a=a.replace(u,"");break}return a.replace(/(?:,\s*)+$/,"").replace(/^(?:,\s*)+/,"")}const mo=b({name:"InspirationPills",components:{FontAwesomeIcon:E},computed:{prompt(){return this.$store.state.kling?.config?.prompt||""},allChipTexts(){return fe.flatMap(e=>e.chipKeys.map(t=>this.$t(`kling.inspiration.chip.${t}`)))},selected(){const e=this.prompt;if(!e)return[];const t=[];for(const s of this.allChipTexts){const a=e.indexOf(s);a!==-1&&t.push({text:s,idx:a})}return t.sort((s,a)=>s.idx-a.idx).map(s=>s.text)}},methods:{onRemove(e){const t=z(this.prompt,e);this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:t})}}}),uo={key:0,class:"pills",role:"list"},po={class:"pill-text"},go=["aria-label","onClick"];function fo(e,t,s,a,u,$){const d=o("font-awesome-icon");return e.selected.length>0?(l(),m("div",uo,[(l(!0),m(V,null,T(e.selected,p=>(l(),m("div",{key:p,class:"pill",role:"listitem"},[i("span",po,r(p),1),i("button",{type:"button",class:"pill-remove","aria-label":e.$t("kling.inspiration.removeChip"),onClick:be(f=>e.onRemove(p),["stop"])},[n(d,{icon:"fa-solid fa-xmark"})],8,go)]))),128))])):v("",!0)}const ho=y(mo,[["render",fo],["__scopeId","data-v-5fc4fa65"]]),_o="",$o=b({name:"PromptInput",components:{ElButton:L,FontAwesomeIcon:E,PromptTextarea:Me,InspirationPills:ho},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||(this.prompt=_o)}});function ko(e,t,s,a,u,$){const d=o("font-awesome-icon"),p=o("el-button"),f=o("inspiration-pills"),c=o("prompt-textarea");return l(),C(c,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=k=>e.prompt=k),title:e.$t("kling.name.prompt"),info:e.$t("kling.description.prompt"),placeholder:e.$t("kling.placeholder.prompt")},{actions:h(()=>[n(p,{text:"",size:"small",class:"inspiration-btn",onClick:t[0]||(t[0]=k=>e.$emit("open-inspiration"))},{default:h(()=>[n(d,{icon:"fa-regular fa-lightbulb",class:"mr-1"}),w(" "+r(e.$t("kling.inspiration.openButton")),1)]),_:1})]),before:h(()=>[n(f)]),_:1},8,["modelValue","title","info","placeholder"])}const vo=y($o,[["render",ko],["__scopeId","data-v-c01fc1a6"]]),bo="",yo=b({name:"NegativePromptInput",components:{ElInput:pe,InfoIcon:I},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||(this.prompt=bo)}}),wo={class:"field"},Co={class:"box"},So={class:"title font-bold"};function Vo(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-input");return l(),m("div",wo,[i("div",Co,[i("h2",So,r(e.$t("kling.name.negativePrompt")),1),n(d,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),n(p,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=f=>e.prompt=f),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt")},null,8,["modelValue","placeholder"])])}const Io=y(yo,[["render",Vo],["__scopeId","data-v-de98cf01"]]),To=b({name:"InspirationDrawer",components:{ElDrawer:re,ElButton:L,FontAwesomeIcon:E},props:{modelValue:{type:Boolean,default:!1}},emits:["update:modelValue"],data(){return{groups:fe,Close:ye}},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(t=>this.$t(`kling.inspiration.chip.${t}`)))},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(z(this.prompt,e)):this.setPrompt(co(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(const t of this.allChipTexts)for(;e.includes(t);)e=z(e,t);this.setPrompt(e)}}}),Eo={class:"drawer-content"},Lo={class:"drawer-header"},Mo={class:"title-row"},Ro={class:"title"},Uo={class:"hint"},Do={key:0,class:"selected-bar"},Ao={class:"selected-text"},Po={class:"groups"},Go={class:"group-title"},Ko={class:"chip-grid"},Oo=["onClick"];function jo(e,t,s,a,u,$){const d=o("font-awesome-icon"),p=o("el-button"),f=o("el-drawer");return l(),C(f,{modelValue:e.visible,"onUpdate:modelValue":t[1]||(t[1]=c=>e.visible=c),direction:"rtl","with-header":!1,size:e.drawerSize,"custom-class":"kling-inspiration-drawer","destroy-on-close":!1},{default:h(()=>[i("div",Eo,[i("div",Lo,[i("div",Mo,[n(d,{icon:"fa-regular fa-lightbulb",class:"mr-2"}),i("span",Ro,r(e.$t("kling.inspiration.title")),1)]),n(p,{text:"",icon:e.Close,class:"close-btn",onClick:t[0]||(t[0]=c=>e.visible=!1)},null,8,["icon"])]),i("div",Uo,r(e.$t("kling.inspiration.hint")),1),e.selectedCount>0?(l(),m("div",Do,[i("span",Ao,r(e.$t("kling.inspiration.selectedSummary",{count:e.selectedCount})),1),n(p,{text:"",size:"small",class:"clear-btn",onClick:e.onClearSelected},{default:h(()=>[w(r(e.$t("kling.inspiration.clearSelected")),1)]),_:1},8,["onClick"])])):v("",!0),i("div",Po,[(l(!0),m(V,null,T(e.groups,c=>(l(),m("div",{key:c.groupKey,class:"group"},[i("div",Go,r(e.$t(`kling.inspiration.group.${c.groupKey}`)),1),i("div",Ko,[(l(!0),m(V,null,T(c.chipKeys,k=>(l(),m("button",{key:k,type:"button",class:U({chip:!0,active:e.isSelected(e.chipText(k))}),onClick:g=>e.onToggle(e.chipText(k))},r(e.chipText(k)),11,Oo))),128))])]))),128))])])]),_:1},8,["modelValue","size"])}const No=y(To,[["render",jo],["__scopeId","data-v-7d457a69"]]),Bo={"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"},zo={std:"720p",pro:"1080p","4k":"4K"},Fo=b({name:"SummaryChip",components:{FontAwesomeIcon:E},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){const e=this.config?.model||"kling-v2-5-turbo";return Bo[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||""},modeLabel(){const e=this.config?.mode||"std";return zo[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),qo={class:"summary-chip"},Ho=["title"],Wo=["title"],Jo=["title"],Qo=["title"],Yo=["title"];function Xo(e,t,s,a,u,$){const d=o("font-awesome-icon");return l(),m("div",qo,[i("span",{class:"part",title:e.$t("kling.name.model")},r(e.modelLabel),9,Ho),t[0]||(t[0]=i("span",{class:"dot"},"·",-1)),i("span",{class:"part",title:e.$t("kling.name.duration")},r(e.durationLabel),9,Wo),t[1]||(t[1]=i("span",{class:"dot"},"·",-1)),i("span",{class:"part",title:e.$t("kling.name.ratio")},r(e.aspectRatio||"16:9"),9,Jo),t[2]||(t[2]=i("span",{class:"dot"},"·",-1)),i("span",{class:"part",title:e.$t("kling.name.mode")},r(e.modeLabel),9,Qo),e.generateAudio?(l(),m("span",{key:0,class:"audio",title:e.$t("kling.name.generateAudio")},[n(d,{icon:"fa-solid fa-headphones"})],8,Yo)):v("",!0)])}const Zo=y(Fo,[["render",Xo],["__scopeId","data-v-418a6733"]]),xo=b({name:"ConfigPanel",components:{ElButton:L,Consumption:ce,FontAwesomeIcon:E,PromptInput:vo,NegativePromptInput:Io,ModelSelector:et,ModeSelector:at,DurationSelector:ht,RatioSelector:wt,StartImage:Lt,CfgScaleSelector:qt,GenerateAudioSelector:Zt,CameraControlSelector:ro,InspirationDrawer:No,SummaryChip:Zo,EndImage:Gt},emits:["generate"],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},consumption(){return ge(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),en={class:"flex flex-col h-full"},tn={class:"flex-1 overflow-y-auto p-5"},on={class:"flex flex-col items-center justify-center px-5 pb-5"};function nn(e,t,s,a,u,$){const d=o("prompt-input"),p=o("model-selector"),f=o("ratio-selector"),c=o("start-image"),k=o("end-image"),g=o("duration-selector"),_=o("mode-selector"),M=o("generate-audio-selector"),R=o("camera-control-selector"),j=o("cfg-scale-selector"),he=o("negative-prompt-input"),_e=o("summary-chip"),$e=o("consumption"),X=o("font-awesome-icon"),Z=o("el-button"),ke=o("inspiration-drawer");return l(),m("div",en,[i("div",tn,[n(d,{class:"mb-4",onOpenInspiration:t[0]||(t[0]=x=>e.inspirationOpen=!0)}),n(p,{class:"mb-4"}),n(f,{class:"mb-4"}),n(c,{class:"mb-2"}),n(k,{class:"mb-2"}),n(g,{class:"mb-4"}),n(_,{class:"mb-4"}),n(M,{class:"mb-4"}),n(R,{class:"mb-4"}),n(j,{class:"mb-4"}),n(he,{class:"mb-4"})]),i("div",on,[n(_e),n($e,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(l(),C(Z,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[n(X,{icon:"fa-solid fa-magic",class:"mr-2"}),w(" "+r(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(l(),C(Z,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[n(X,{icon:"fa-solid fa-magic",class:"mr-2"}),w(" "+r(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))]),n(ke,{modelValue:e.inspirationOpen,"onUpdate:modelValue":t[1]||(t[1]=x=>e.inspirationOpen=x)},null,8,["modelValue"])])}const sn=y(xo,[["render",nn]]),ln=b({name:"MotionImage",components:{ElUpload:O,ElButton:L,InfoIcon:I,FontAwesomeIcon:E,ImagePreview:K},mixins:[H],data(){return{fileList:[],uploadUrl:G()+"/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(){S.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){S.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(){const e=this.urls?.[0];this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,image_url:e})},async onSuccess(){this.onSetImageUrl()}}}),an={class:"relative"},rn={class:"flex justify-between"},cn={class:"flex justify-start items-center"},dn={class:"text-sm font-bold"};function mn(e,t,s,a,u,$){const d=o("info-icon"),p=o("image-preview"),f=o("font-awesome-icon"),c=o("el-button"),k=o("el-upload");return l(),m("div",an,[i("div",rn,[i("div",cn,[i("span",dn,r(e.$t("kling.name.motionImage")),1),n(d,{content:e.$t("kling.description.motionImage")},null,8,["content"])])]),n(k,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=g=>e.fileList=g),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:h(({file:g})=>[g.url&&g.percentage!==void 0?(l(),C(p,{key:0,url:g.url,name:g.name,percentage:g.percentage,onRemove:_=>e.onRemove(g)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:h(()=>[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:h(()=>[n(f,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+r(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const un=y(ln,[["render",mn],["__scopeId","data-v-37d42da7"]]),pn=b({name:"MotionVideo",components:{ElUpload:O,ElButton:L,InfoIcon:I,FilePreview:Ue,FontAwesomeIcon:E},data(){return{fileList:[],uploadUrl:G()+"/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(){S.warning(this.$t("kling.message.uploadVideoExceed"))},onError(){S.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){const t=e.type==="video/mp4"||e.type==="video/quicktime",s=e.size/1024/1024<100;return t?s?!0:(S.error(this.$t("kling.message.uploadVideoSizeExceed")),!1):(S.error(this.$t("kling.message.uploadVideoTypeFailed")),!1)},onSetVideoUrl(){const e=this.urls?.[0];this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,video_url:e})},async onSuccess(){this.onSetVideoUrl()}}}),gn={class:"relative"},fn={class:"flex justify-between"},hn={class:"flex justify-start items-center"},_n={class:"text-sm font-bold"};function $n(e,t,s,a,u,$){const d=o("info-icon"),p=o("file-preview"),f=o("font-awesome-icon"),c=o("el-button"),k=o("el-upload");return l(),m("div",gn,[i("div",fn,[i("div",hn,[i("span",_n,r(e.$t("kling.name.motionVideo")),1),n(d,{content:e.$t("kling.description.motionVideo")},null,8,["content"])])]),n(k,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=g=>e.fileList=g),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:h(({file:g})=>[g.percentage!==void 0?(l(),C(p,{key:0,url:g.url||g.response?.file_url,name:g.name,percentage:g.percentage,onRemove:_=>e.onRemove(g)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:h(()=>[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:h(()=>[n(f,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+r(e.$t("kling.button.uploadVideoUrl")),1)]),_:1})]),_:1},8,["file-list","action","before-upload","on-exceed","on-error","on-success","headers"])])}const kn=y(pn,[["render",$n],["__scopeId","data-v-5cf93212"]]),vn=b({name:"MotionPromptInput",components:{ElInput:pe,InfoIcon:I},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||""},set(e){this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),bn={class:"field"},yn={class:"box"},wn={class:"title font-bold"};function Cn(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-input");return l(),m("div",bn,[i("div",yn,[i("h2",wn,r(e.$t("kling.name.motionPrompt")),1),n(d,{content:e.$t("kling.description.motionPrompt"),class:"info"},null,8,["content"])]),n(p,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=f=>e.prompt=f),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.motionPrompt")},null,8,["modelValue","placeholder"])])}const Sn=y(vn,[["render",Cn],["__scopeId","data-v-ca9fdbe5"]]),ie="video",Vn=b({name:"CharacterOrientationSelector",components:{ElRadioGroup:Ae,ElRadioButton:De,InfoIcon:I},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||ie},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=ie)}}),In={class:"field"},Tn={class:"header"},En={class:"text-sm font-bold"};function Ln(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-radio-button"),f=o("el-radio-group");return l(),m("div",In,[i("div",Tn,[i("span",En,r(e.$t("kling.name.characterOrientation")),1),n(d,{content:e.$t("kling.description.characterOrientation")},null,8,["content"])]),n(f,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),size:"small",class:"value"},{default:h(()=>[n(p,{label:"image"},{default:h(()=>[w(r(e.$t("kling.name.orientationImage")),1)]),_:1}),n(p,{label:"video"},{default:h(()=>[w(r(e.$t("kling.name.orientationVideo")),1)]),_:1})]),_:1},8,["modelValue"])])}const Mn=y(Vn,[["render",Ln],["__scopeId","data-v-7a91195b"]]),le="std",Rn=b({name:"MotionModeSelector",components:{ElSelect:P,ElOption:A,InfoIcon:I},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||le},set(e){this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=le)}}),Un={class:"field"},Dn={class:"header"},An={class:"title font-bold"};function Pn(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-option"),f=o("el-select");return l(),m("div",Un,[i("div",Dn,[i("h2",An,r(e.$t("kling.name.mode")),1),n(d,{content:e.$t("kling.description.motionMode")},null,8,["content"])]),n(f,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:h(()=>[(l(!0),m(V,null,T(e.options,c=>(l(),C(p,{key:c.value,label:c.label,value:c.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Gn=y(Rn,[["render",Pn],["__scopeId","data-v-1295688c"]]),Kn=b({name:"KeepOriginalSoundSelector",components:{ElSwitch:ue,InfoIcon:I},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"})}}}}),On={class:"relative"},jn={class:"flex justify-between items-center"},Nn={class:"flex justify-start items-center"},Bn={class:"text-sm font-bold"};function zn(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-switch");return l(),m("div",On,[i("div",jn,[i("div",Nn,[i("span",Bn,r(e.$t("kling.name.keepOriginalSound")),1),n(d,{content:e.$t("kling.description.keepOriginalSound")},null,8,["content"])]),n(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f)},null,8,["modelValue"])])])}const Fn=y(Kn,[["render",zn]]),qn=b({name:"MotionPanel",components:{ElButton:L,FontAwesomeIcon:E,Consumption:ce,MotionImage:un,MotionVideo:kn,MotionPromptInput:Sn,CharacterOrientationSelector:Mn,MotionModeSelector:Gn,KeepOriginalSoundSelector:Fn},emits:["generate"],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return ge(this.motionConfig,this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){const e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit("generate")}}}),Hn={class:"flex flex-col h-full"},Wn={class:"flex-1 overflow-y-auto p-5"},Jn={class:"flex flex-col items-center justify-center px-5 pb-5"};function Qn(e,t,s,a,u,$){const d=o("motion-image"),p=o("motion-video"),f=o("motion-prompt-input"),c=o("character-orientation-selector"),k=o("motion-mode-selector"),g=o("keep-original-sound-selector"),_=o("consumption"),M=o("font-awesome-icon"),R=o("el-button");return l(),m("div",Hn,[i("div",Wn,[n(d,{class:"mb-3"}),n(p,{class:"mb-3"}),n(f,{class:"mb-4"}),n(c,{class:"mb-4"}),n(k,{class:"mb-4"}),n(g,{class:"mb-4"})]),i("div",Jn,[n(_,{value:e.consumption,service:e.service},null,8,["value","service"]),n(R,{type:"primary",class:"btn w-full",round:"",disabled:!e.canGenerate,onClick:e.onGenerate},{default:h(()=>[n(M,{icon:"fa-solid fa-magic",class:"mr-2"}),w(" "+r(e.$t("kling.button.generateMotion")),1)]),_:1},8,["disabled","onClick"])])])}const Yn=y(qn,[["render",Qn]]),Xn=b({name:"KlingTabSwitcher",components:{ElTabs:Ge,ElTabPane:Pe,ElTag:we},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")}]}},methods:{onUpdate(e){this.$emit("update:modelValue",e)}}}),Zn=["title"],xn={class:"text"};function es(e,t,s,a,u,$){const d=o("el-tag"),p=o("el-tab-pane"),f=o("el-tabs");return l(),C(f,{"model-value":e.modelValue,class:"kling-tabs",stretch:"","onUpdate:modelValue":e.onUpdate},{default:h(()=>[(l(!0),m(V,null,T(e.tabs,c=>(l(),C(p,{key:c.value,name:c.value,disabled:c.disabled},{label:h(()=>[i("span",{class:"tab-label",title:c.disabled?c.disabledReason:void 0},[i("span",xn,r(c.label),1),c.badge?(l(),C(d,{key:0,size:"small",type:"warning",class:"badge"},{default:h(()=>[w(r(c.badge),1)]),_:2},1024)):v("",!0)],8,Zn)]),_:2},1032,["name","disabled"]))),128))]),_:1},8,["model-value","onUpdate:modelValue"])}const ts=y(Xn,[["render",es],["__scopeId","data-v-bf00c27e"]]),os=b({name:"TaskPreview",components:{ElImage:Ne,CopyToClipboard:Ke,FontAwesomeIcon:E,ElAlert:je,VideoPlayer:Oe,ElTooltip:W,ElButton:L,ImagePreview:K},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config},referenceImages(){const e=[],t=this.modelValue?.request?.start_image_url,s=this.modelValue?.request?.end_image_url;return t&&e.push({url:t,name:"start-image"}),s&&e.push({url:s,name:"end-image"}),e}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),ns={class:"preview"},ss={class:"left"},is={class:"main"},ls={class:"bot"},as={class:"datetime"},rs={class:"info"},cs={key:0,class:"flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto"},ds={key:1,class:"prompt mt-2"},ms={key:0},us={key:1},ps={key:0,class:U({content:!0,failed:!0})},gs={key:0,class:"mb-4"},fs={key:1,class:U({operations:!0,"mt-2":!0})},hs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},_s={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},$s={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ks={key:1,class:U({content:!0})},vs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},bs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ys={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ws={key:1,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Cs={key:2,class:U({content:!0})},Ss={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Vs={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Is(e,t,s,a,u,$){const d=o("el-image"),p=o("image-preview"),f=o("video-player"),c=o("el-button"),k=o("el-tooltip"),g=o("font-awesome-icon"),_=o("copy-to-clipboard"),M=o("el-alert");return l(),m("div",ns,[i("div",ss,[n(d,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),i("div",is,[i("div",ls,[w(r(e.$t("kling.name.klingBot"))+" ",1),i("span",as,r(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),i("div",rs,[e.referenceImages.length>0?(l(),m("div",cs,[(l(!0),m(V,null,T(e.referenceImages,(R,j)=>(l(),C(p,{key:j,url:R.url,name:R.name,closable:!1},null,8,["url","name"]))),128))])):v("",!0),e.modelValue?.request?.prompt?(l(),m("p",ds,[w(r(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?v("",!0):(l(),m("span",ms," - ("+r(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(l(),m("span",us," - ("+r(e.$t("kling.status.processing"))+") ",1)):v("",!0)])):v("",!0)]),e.modelValue?.response?.success===!0?(l(),m("div",ps,[e.modelValue?.response.video_url?(l(),m("div",gs,[n(f,{src:e.modelValue?.response.video_url},null,8,["src"])])):v("",!0),e.modelValue?.response.success?(l(),m("div",fs,[n(k,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:h(()=>[e.modelValue?.response.video_url?(l(),C(c,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=R=>e.onDownload(R,e.modelValue?.response.video_url))},{default:h(()=>[w(r(e.$t("kling.button.download")),1)]),_:1})):v("",!0)]),_:1},8,["content"])])):v("",!0),n(M,{closable:!1,class:"mt-2 success"},{default:h(()=>[i("p",hs,[n(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+r(e.$t("kling.name.model"))+": "+r(e.modelValue?.request?.model),1)]),i("p",_s,[n(g,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+r(e.$t("kling.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),n(_,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.elapsed?(l(),m("p",$s,[n(g,{icon:"fa-solid fa-clock",class:"mr-1"}),w(" "+r(e.$t("kling.name.elapsed"))+": "+r(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):v("",!0)]),_:1})])):v("",!0),e.modelValue?.response?.success===!1?(l(),m("div",ks,[n(M,{closable:!1,class:"failure"},{template:h(()=>[n(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),w(" "+r(e.$t("kling.name.failure")),1)]),default:h(()=>[i("p",vs,[n(g,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+r(e.$t("kling.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),n(_,{content:e.modelValue?.id},null,8,["content"])]),i("p",bs,[n(g,{icon:"fa-solid fa-circle-info",class:"mr-1"}),w(" "+r(e.$t("kling.name.failureReason"))+": "+r(e.modelValue?.response?.error?.message)+" ",1),n(_,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.elapsed?(l(),m("p",ys,[n(g,{icon:"fa-solid fa-clock",class:"mr-1"}),w(" "+r(e.$t("kling.name.elapsed"))+": "+r(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):v("",!0),e.modelValue?.response?.trace_id?(l(),m("p",ws,[n(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+r(e.$t("kling.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),n(_,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):v("",!0)]),_:1})])):v("",!0),e.modelValue?.response?.success===void 0?(l(),m("div",Cs,[n(M,{closable:!1,class:"info"},{template:h(()=>[n(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),w(" "+r(e.$t("kling.name.failure")),1)]),default:h(()=>[i("p",Ss,[n(g,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+r(e.$t("kling.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),n(_,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(l(),m("p",Vs,[n(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+r(e.$t("kling.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),n(_,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):v("",!0)]),_:1})])):v("",!0)])])}const Ts=y(os,[["render",Is],["__scopeId","data-v-e8e87659"]]),Es=b({name:"RecentPanel",components:{TaskPreview:Ts,NoTasks:Re,BotPlaceholder:Be,ScrollList:Ee},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?.()}}}),Ls={key:0},Ms={key:2,class:"w-full h-full flex items-center justify-center"};function Rs(e,t,s,a,u,$){const d=o("bot-placeholder"),p=o("task-preview"),f=o("scroll-list"),c=o("no-tasks");return l(),m(V,null,[e.tasks?.items===void 0?(l(),m("div",Ls,[n(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),C(f,{key:1,ref:"scrollList",class:"h-full w-full overflow-y-auto tasks",loading:e.loading,onReachTop:t[0]||(t[0]=k=>e.$emit("reach-top"))},{default:h(()=>[(l(!0),m(V,null,T(e.tasks?.items,k=>(l(),C(p,{key:k.id,"model-value":k},null,8,["model-value"]))),128))]),_:1},8,["loading"])):v("",!0),e.tasks?.items?.length===0?(l(),m("div",Ms,[n(c)])):v("",!0)],64)}const Us=y(Es,[["render",Rs]]),ae=Ce("kling"),Ds=b({name:"KlingIndex",components:{ConfigPanel:sn,MotionPanel:Yn,TabSwitcher:ts,Layout:Je,RecentPanel:Us},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===oe.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===oe.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},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 Le({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){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();const 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);const{limit:t=5,createdAtMin:s,createdAtMax:a}=e||{};console.debug("limit",t,"createdAtMin",s,"createdAtMax",a),this.fetchingTasks=!0;try{await this.$store.dispatch("kling/getTasks",{limit:t,createdAtMin:s,createdAtMax:a})}finally{this.fetchingTasks=!1}},async onGenerate(){const{camera_control:e,...t}=this.config||{},s={...t,callback_url:ae};if(!s.video_id&&!t.video_url&&!s.start_image_url&&s.end_image_url){S.warning(this.$t("kling.message.endImageRequiresStart"));return}s.action||(s.video_id||t.video_url?s.action="extend":s.start_image_url?s.action="image2video":s.action="text2video"),s.action==="text2video"&&s.end_image_url&&delete s.end_image_url,e?.type&&(s.camera_control={type:e.type,...e.type==="simple"&&e.config?{config:Object.fromEntries(Object.entries(e.config).filter(([,u])=>u!=null))}:{}});const a=this.credential?.token;if(!a){console.error("no token specified");return}S.info(this.$t("kling.message.startingTask")),ee("kling",te.generate(s,{token:a})).then(()=>{S.success(this.$t("kling.message.startTaskSuccess"))}).catch(u=>{u?.response?.data?.error?.code===se?S.error(this.$t("kling.message.usedUp")):S.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(){const e=this.motionConfig||{};if(!e.image_url||!e.video_url){S.warning(this.$t("kling.message.motionMissingInputs"));return}const 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:ae},s=this.credential?.token;if(!s){console.error("no token specified");return}S.info(this.$t("kling.message.startingTask")),ee("kling",te.motion(t,{token:s})).then(()=>{S.success(this.$t("kling.message.startTaskSuccess"))}).catch(a=>{a?.response?.data?.error?.code===se?S.error(this.$t("kling.message.usedUp")):S.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),As={class:"flex flex-col h-full"},Ps={class:"flex-1 min-h-0"};function Gs(e,t,s,a,u,$){const d=o("tab-switcher"),p=o("config-panel"),f=o("motion-panel"),c=o("recent-panel"),k=o("layout");return l(),C(k,null,{config:h(()=>[i("div",As,[n(d,{"model-value":e.taskType,"onUpdate:modelValue":e.onTabChange},null,8,["model-value","onUpdate:modelValue"]),i("div",Ps,[e.taskType==="videos"?(l(),C(p,{key:0,onGenerate:e.onGenerate},null,8,["onGenerate"])):e.taskType==="motion"?(l(),C(f,{key:1,onGenerate:e.onGenerateMotion},null,8,["onGenerate"])):v("",!0)])])]),result:h(()=>[n(c,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Ki=y(Ds,[["render",Gs]]);export{Ki as default};
|
|
1
|
+
import{F as E}from"./index.es-D5toi_yB.js";import{E as L}from"./index-mTDdtUSQ.js";import{E as re}from"./index-DU5biqWK.js";import{d as b,H as m,E as i,z as N,C as n,y as h,D as o,q as l,F as r,x as C,O as V,N as T,Q as U,J as v,R as ve,I as w,M as be}from"./vendor-vue-NSDaktjZ.js";import{G as y,bj as G,ag as ye,H as we,co as ee,aF as te,S as oe,cp as Ce}from"./index-CCfnxGYg.js";import{b as Se,c as ne,d as F,e as D,f as Ve,g as Ie,h as Te}from"./kling-CtoPhhA9.js";import{E as A,a as P}from"./index-B1msaBme.js";import{E as q}from"./index-CWu2cUvK.js";import{E as S}from"./index-CoYnpgkX.js";import{I,S as Ee,l as Le}from"./pagination-BO6RV-kc.js";import{p as H}from"./pasteUploadMixin-BurWbGNQ.js";import{I as K}from"./ImagePreview-C4OiWDg9.js";import{E as W}from"./index-DM6P3x3N.js";import{E as O}from"./index-BwEtWche.js";import{C as ce}from"./Consumption-DVkwcyaB.js";import{E as de}from"./index-BfSiZO1Q.js";import{E as me}from"./index-6RhQMvFk.js";import{E as ue}from"./index-7i1RSn5L.js";import{P as Me,N as Re}from"./NoTasks-Dpcud_u4.js";import{E as pe}from"./index-B5vjdbxo.js";import{a as ge}from"./price-DPkoP0YP.js";import{F as Ue}from"./FilePreview-B7MnxDfU.js";import{E as De,a as Ae}from"./index-Dxq53QkJ.js";import{E as Pe,a as Ge}from"./index-sF_c-ZTZ.js";import{b as se}from"./errorCode-Cqj9Td_Z.js";import{C as Ke}from"./CopyToClipboard-UnYO6hAq.js";import{V as Oe}from"./VideoPlayer-B-GlKJVH.js";import{E as je}from"./index-oRUvw3Ui.js";import{E as Ne}from"./index-B1DLX4Fc.js";import{B as Be}from"./BotPlaceholder-Dy1gr-9h.js";import"./use-form-item-BdyDMPU-.js";import"./index-BuyEbX8F.js";import"./vendor-axios-B8_nURbH.js";import"./vendor-dayjs-v0j1UNZp.js";import"./vendor-vue-router-Df5ITouH.js";import"./index-Dwk0fHJ3.js";import"./typescript-DYVOpHug.js";import"./index-BHtuVUFl.js";import"./strings-beZM2Y-f.js";import"./isEqual-1RENOQre.js";import"./_Uint8Array-Dhv101dV.js";import"./castArray-DD0p5-P9.js";import"./debounce-CQuM7WhN.js";import"./_baseIteratee-URGnejHV.js";import"./index-3c5oSDnc.js";import"./validator-B70qvqYD.js";import"./index-CpWcFmdT.js";import"./_baseClone-D4Hl6Ymo.js";import"./_initCloneObject-QV4IIV31.js";import"./index-Cu41y2Fl.js";import"./index-BbjLkNT5.js";import"./isPlainObject-CS0cmpQf.js";import"./vue-plyr-BO2nlN4c.js";import"./index-1diQ6JT1.js";const ze=b({name:"LayoutKling",components:{ElDrawer:re,ElButton:L,FontAwesomeIcon:E},data(){return{drawer:!1}}}),Fe={class:"main flex flex-row flex-1 min-h-0"},qe={class:"config w-[320px] flex-none h-full flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},He={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,t,s,a,u,$){const d=o("font-awesome-icon"),p=o("el-button"),f=o("el-drawer");return l(),m("div",Fe,[i("div",qe,[N(e.$slots,"config",{},void 0,!0)]),i("div",He,[N(e.$slots,"result",{},void 0,!0)]),n(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=c=>e.drawer=!0)},{default:h(()=>[n(d,{icon:"fa-solid fa-magic"})]),_:1}),n(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=c=>e.drawer=c),direction:"ltr","with-header":!1,size:"350px"},{default:h(()=>[N(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const Je=y(ze,[["render",We],["__scopeId","data-v-be4bb0df"]]),Qe={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};function J(e,t,s){const a=t||"std",u=s??5;switch(e){case"kling-v1":return{text2video:!0,image2video:!0,endImage:u===5,audio:!1,motionControl:u===5};case"kling-v1-6":case"kling-v2-5-turbo":return{text2video:!0,image2video:!0,endImage:a==="pro",audio:!1,motionControl:!1};case"kling-v2-6":return{text2video:!0,image2video:!0,endImage:a==="pro",audio:a==="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:a!=="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 Qe}}function Q(e,t){if(!e)return[];const s=t.model??e.model,a=t.mode??e.mode,u=t.duration??e.duration;if(!s)return[];const $=J(s,a,u),d=[];return e.end_image_url&&!$.endImage&&d.push({field:"end_image_url",i18nLabel:"kling.name.endImage"}),e.generate_audio&&!$.audio&&d.push({field:"generate_audio",i18nLabel:"kling.name.generateAudio"}),e.camera_control?.type&&(!$.motionControl||e.start_image_url)&&d.push({field:"camera_control",i18nLabel:"kling.name.cameraControl"}),d}function Y(e,t){const s={...e};for(const a of t)a.field==="end_image_url"&&(s.end_image_url=void 0),a.field==="generate_audio"&&(s.generate_audio=!1),a.field==="camera_control"&&(s.camera_control=void 0);return s}const Ye=b({name:"ModelSelector",components:{ElSelect:P,ElOption:A},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(Se)},methods:{async onChange(e){const t=this.$store.state.kling?.config||{},s=Q(t,{model:e});if(s.length===0){this.applyModel(e);return}const a=s.map(u=>this.$t(u.i18nLabel)).join("、");try{await q.confirm(this.$t("kling.message.featureNotSupportedBody",{fields:a}),this.$t("kling.message.featureNotSupportedTitle"),{confirmButtonText:this.$t("kling.button.confirmContinue"),cancelButtonText:this.$t("kling.button.cancelSwitch"),type:"warning"});const u=Y({...t,model:e},s);this.$store.commit("kling/setConfig",u),S.success(this.$t("kling.message.featureRemovedNotice",{fields:a}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}}),Xe={class:"field"},Ze={class:"title font-bold"};function xe(e,t,s,a,u,$){const d=o("el-option"),p=o("el-select");return l(),m("div",Xe,[i("h2",Ze,r(e.$t("pika.name.model")),1),(l(),C(p,{key:e.revertKey,"model-value":e.value,class:"value",placeholder:e.$t("pika.placeholder.select"),onChange:e.onChange},{default:h(()=>[(l(!0),m(V,null,T(e.options,f=>(l(),C(d,{key:f.value,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","onChange"]))])}const et=y(Ye,[["render",xe],["__scopeId","data-v-04059875"]]),tt=b({name:"ModeSelector",components:{ElSelect:P,ElOption:A,InfoIcon:I},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 F.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(ne)}},mounted(){this.value||this.applyMode(ne)},methods:{async onChange(e){const t=this.$store.state.kling?.config||{},s=Q(t,{mode:e});if(s.length===0){this.applyMode(e);return}const a=s.map(u=>this.$t(u.i18nLabel)).join("、");try{await q.confirm(this.$t("kling.message.featureNotSupportedBody",{fields:a}),this.$t("kling.message.featureNotSupportedTitle"),{confirmButtonText:this.$t("kling.button.confirmContinue"),cancelButtonText:this.$t("kling.button.cancelSwitch"),type:"warning"});const u=Y({...t,mode:e},s);this.$store.commit("kling/setConfig",u),S.success(this.$t("kling.message.featureRemovedNotice",{fields:a}))}catch{this.revertKey+=1}},applyMode(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}}),ot={class:"field"},nt={class:"header"},st={class:"title font-bold"},it={key:0,class:"opt-tip"};function lt(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-option"),f=o("el-select");return l(),m("div",ot,[i("div",nt,[i("h2",st,r(e.$t("kling.name.mode")),1),n(d,{content:e.$t("kling.description.mode"),class:"info-icon"},null,8,["content"])]),(l(),C(f,{key:e.revertKey,"model-value":e.value,class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0,onChange:e.onChange},{default:h(()=>[(l(!0),m(V,null,T(e.options,c=>(l(),C(p,{key:c.value,label:c.label,value:c.value,disabled:c.disabled},{default:h(()=>[i("span",{class:U({"opt-disabled":c.disabled})},r(c.label),3),c.disabled&&c.disabledReason?(l(),m("span",it,r(c.disabledReason),1)):v("",!0)]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["model-value","placeholder","onChange"]))])}const at=y(tt,[["render",lt],["__scopeId","data-v-9a8fa3c5"]]),rt=[3,5,8,10,12,15],ct=[5,10],dt=b({name:"DurationSelector",components:{ElSelect:P,ElOption:A,InfoIcon:I},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||""},isV3Model(){return F.includes(this.selectedModel)},allowedDurations(){return this.isV3Model?rt:ct},value(){return this.$store.state.kling?.config?.duration??D},selectValue(){const e=this.allowedDurations;return e.includes(this.value)?this.value:e.includes(D)?D:e[0]}},watch:{isV3Model(){this.allowedDurations.includes(this.value)||this.applyDuration(D)}},mounted(){this.$store.state.kling?.config?.duration||this.applyDuration(D)},methods:{async onChange(e){const t=this.$store.state.kling?.config||{},s=Q(t,{duration:e});if(s.length===0){this.applyDuration(e);return}const a=s.map(u=>this.$t(u.i18nLabel)).join("、");try{await q.confirm(this.$t("kling.message.featureNotSupportedBody",{fields:a}),this.$t("kling.message.featureNotSupportedTitle"),{confirmButtonText:this.$t("kling.button.confirmContinue"),cancelButtonText:this.$t("kling.button.cancelSwitch"),type:"warning"});const u=Y({...t,duration:e},s);this.$store.commit("kling/setConfig",u),S.success(this.$t("kling.message.featureRemovedNotice",{fields:a}))}catch{this.revertKey+=1}},applyDuration(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}}),mt={class:"field"},ut={class:"control"},pt={class:"label"},gt={class:"title font-bold"};function ft(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-option"),f=o("el-select");return l(),m("div",mt,[i("div",ut,[i("div",pt,[i("h2",gt,r(e.$t("kling.name.duration")),1),n(d,{content:e.$t("kling.description.duration"),class:"info-icon ml-1"},null,8,["content"])]),(l(),C(f,{key:e.revertKey,"model-value":e.selectValue,class:"value",placeholder:e.$t("kling.placeholder.select"),onChange:e.onChange},{default:h(()=>[(l(!0),m(V,null,T(e.allowedDurations,c=>(l(),C(p,{key:c,label:`${c}s`,value:c},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","onChange"]))])])}const ht=y(dt,[["render",ft],["__scopeId","data-v-5ae55e28"]]),_t=b({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||(this.value=Ve)}}),$t={class:"text-sm font-bold mb-2 block"},kt={class:"items"},vt=["onClick"],bt={class:"name"};function yt(e,t,s,a,u,$){return l(),m("div",null,[i("span",$t,r(e.$t("kling.name.ratio")),1),i("div",kt,[(l(!0),m(V,null,T(e.options,(d,p)=>(l(),m("div",{key:p,class:U({active:e.active===p,item:!0}),onClick:f=>e.value=d.value},[i("div",{class:U(["preview",d.label])},[i("div",{class:"rect",style:ve({width:d.width+"px",height:d.height+"px"})},null,4)],2),i("p",bt,r(d.label),1)],10,vt))),128))])])}const wt=y(_t,[["render",yt],["__scopeId","data-v-cdb14b2f"]]),Ct=b({name:"StartImage",components:{ElUpload:O,ElButton:L,ElTooltip:W,InfoIcon:I,FontAwesomeIcon:E,ImagePreview:K},mixins:[H],emits:["change"],data(){return{fileList:[],uploadUrl:G()+"/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||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){S.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){S.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),St={class:"relative"},Vt={class:"flex justify-between"},It={class:"flex justify-start items-center"},Tt={class:"text-sm font-bold"};function Et(e,t,s,a,u,$){const d=o("info-icon"),p=o("image-preview"),f=o("font-awesome-icon"),c=o("el-button"),k=o("el-tooltip"),g=o("el-upload");return l(),m("div",St,[i("div",Vt,[i("div",It,[i("span",Tt,r(e.$t("kling.name.startImage")),1),n(d,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),n(g,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=_=>e.fileList=_),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:h(({file:_})=>[_.url&&_.percentage!==void 0?(l(),C(p,{key:0,url:_.url,name:_.name,percentage:_.percentage,onRemove:M=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:h(()=>[n(k,{content:e.$t("kling.message.uploadReferencesExceed"),disabled:!e.reachedLimit,placement:"top"},{default:h(()=>[i("span",null,[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload",disabled:e.reachedLimit},{default:h(()=>[n(f,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+r(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"])])}const Lt=y(Ct,[["render",Et],["__scopeId","data-v-68cf38f5"]]),Mt=b({name:"EndImage",components:{ElUpload:O,ElButton:L,ElTooltip:W,ImagePreview:K,InfoIcon:I,FontAwesomeIcon:E},mixins:[H],data(){return{fileList:[],uploadUrl:G()+"/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||(this.value=void 0),this.onSetEndImageUrl()},methods:{onBeforeUpload(){return this.endImageSupported?this.hasStartImage?!0:(S.warning(this.$t("kling.message.endImageRequiresStart")),!1):(S.warning(this.$t("kling.message.endImageNotSupported")),!1)},onExceed(){S.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){S.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Rt={class:"relative"},Ut={class:"flex justify-between"},Dt={class:"flex justify-start items-center"},At={class:"text-sm font-bold"};function Pt(e,t,s,a,u,$){const d=o("info-icon"),p=o("image-preview"),f=o("font-awesome-icon"),c=o("el-button"),k=o("el-tooltip"),g=o("el-upload");return l(),m("div",Rt,[i("div",Ut,[i("div",Dt,[i("span",At,r(e.$t("kling.name.endImage")),1),n(d,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),n(g,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=_=>e.fileList=_),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:h(({file:_})=>[_.url&&_.percentage!==void 0?(l(),C(p,{key:0,url:_.url,name:_.name,percentage:_.percentage,onRemove:M=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:h(()=>[n(k,{content:e.uploadTooltip,disabled:!e.uploadDisabled,placement:"top"},{default:h(()=>[i("span",null,[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload",disabled:e.uploadDisabled},{default:h(()=>[n(f,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+r(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"])])}const Gt=y(Mt,[["render",Pt],["__scopeId","data-v-593c3bde"]]),Kt=b({name:"CfgScaleSelector",components:{ElSlider:me,InfoIcon:I,ElInputNumber:de},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||(this.value=Ie)}}),Ot={class:"flex justify-between"},jt={class:"flex justify-start items-center"},Nt={class:"text-sm font-bold"},Bt={class:"flex justify-end items-center"},zt={class:"w-full"};function Ft(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-input-number"),f=o("el-slider");return l(),m("div",null,[i("div",Ot,[i("div",jt,[i("span",Nt,r(e.$t("kling.name.cfgScale")),1),n(d,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),i("div",Bt,[n(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),"controls-position":"right"},null,8,["modelValue"])])]),i("div",zt,[n(f,{modelValue:e.value,"onUpdate:modelValue":t[1]||(t[1]=c=>e.value=c),min:0,max:1,step:.1},null,8,["modelValue"])])])}const qt=y(Kt,[["render",Ft]]),Ht=b({name:"GenerateAudioSelector",components:{ElSwitch:ue,InfoIcon:I},computed:{selectedModel(){return this.$store.state.kling?.config?.model||""},selectedMode(){return this.$store.state.kling?.config?.mode||""},supported(){return!!(F.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??Te:!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"},Jt={class:"flex justify-between items-center"},Qt={class:"flex justify-start items-center"},Yt={class:"text-sm font-bold"};function Xt(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-switch");return l(),m("div",Wt,[i("div",Jt,[i("div",Qt,[i("span",Yt,r(e.$t("kling.name.generateAudio")),1),n(d,{content:e.tooltipContent},null,8,["content"])]),n(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),class:"value",disabled:!e.supported},null,8,["modelValue","disabled"])])])}const Zt=y(Ht,[["render",Xt]]),xt=["horizontal","vertical","pan","tilt","roll","zoom"],eo=b({name:"CameraControlSelector",components:{ElSelect:P,ElOption:A,ElSlider:me,ElInputNumber:de,InfoIcon:I},data(){return{configKeys:xt}},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){const t=this.$store.state.kling?.config||{};if(!e){const a={...t};delete a.camera_control,this.$store.commit("kling/setConfig",a);return}const s=e;this.$store.commit("kling/setConfig",{...t,camera_control:{type:s,config:s==="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){const s=this.$store.state.kling?.config||{},a=s.camera_control||{type:"simple"},u={...a.config||{}};t==null?delete u[e]:u[e]=t,this.$store.commit("kling/setConfig",{...s,camera_control:{...a,type:"simple",config:u}})},onSliderChange(e,t){this.writeConfig(e,t)},onNumberChange(e,t){this.writeConfig(e,t)}}}),to={class:"field"},oo={class:"header"},no={class:"text-sm font-bold"},so={key:0,class:"config-grid"},io={class:"cfg-row-head"},lo={class:"cfg-name"};function ao(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-option"),f=o("el-select"),c=o("el-input-number"),k=o("el-slider");return l(),m("div",to,[i("div",oo,[i("span",no,r(e.$t("kling.name.cameraControl")),1),n(d,{content:e.tooltipContent},null,8,["content"])]),n(f,{modelValue:e.selectedTypeRaw,"onUpdate:modelValue":t[0]||(t[0]=g=>e.selectedTypeRaw=g),class:"value",placeholder:e.$t("kling.placeholder.cameraType"),clearable:!0,disabled:e.disabled},{default:h(()=>[(l(!0),m(V,null,T(e.typeOptions,g=>(l(),C(p,{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"]),e.selectedType==="simple"&&!e.disabled?(l(),m("div",so,[(l(!0),m(V,null,T(e.configKeys,g=>(l(),m("div",{key:g,class:"cfg-row"},[i("div",io,[i("span",lo,r(e.$t(`kling.name.cc_${g}`)),1),n(c,{modelValue:e.configValues[g],"onUpdate:modelValue":_=>e.configValues[g]=_,min:-1,max:1,step:.1,precision:1,"controls-position":"right",size:"small",class:"cfg-num",onChange:_=>e.onNumberChange(g,_)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),n(k,{"model-value":e.configValues[g]??0,min:-1,max:1,step:.1,onInput:_=>e.onSliderChange(g,_)},null,8,["model-value","onInput"])]))),128))])):v("",!0)])}const ro=y(eo,[["render",ao],["__scopeId","data-v-cd896060"]]),fe=[{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"]}],B=", ";function co(e,t){const s=(e||"").trim();return s?s.includes(t)?s:`${s}${B}${t}`:t}function z(e,t){if(!e||!t)return e||"";const s=[`${t}${B}`,`${B}${t}`,t];let a=e;for(const u of s)if(a.includes(u)){a=a.replace(u,"");break}return a.replace(/(?:,\s*)+$/,"").replace(/^(?:,\s*)+/,"")}const mo=b({name:"InspirationPills",components:{FontAwesomeIcon:E},computed:{prompt(){return this.$store.state.kling?.config?.prompt||""},allChipTexts(){return fe.flatMap(e=>e.chipKeys.map(t=>this.$t(`kling.inspiration.chip.${t}`)))},selected(){const e=this.prompt;if(!e)return[];const t=[];for(const s of this.allChipTexts){const a=e.indexOf(s);a!==-1&&t.push({text:s,idx:a})}return t.sort((s,a)=>s.idx-a.idx).map(s=>s.text)}},methods:{onRemove(e){const t=z(this.prompt,e);this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:t})}}}),uo={key:0,class:"pills",role:"list"},po={class:"pill-text"},go=["aria-label","onClick"];function fo(e,t,s,a,u,$){const d=o("font-awesome-icon");return e.selected.length>0?(l(),m("div",uo,[(l(!0),m(V,null,T(e.selected,p=>(l(),m("div",{key:p,class:"pill",role:"listitem"},[i("span",po,r(p),1),i("button",{type:"button",class:"pill-remove","aria-label":e.$t("kling.inspiration.removeChip"),onClick:be(f=>e.onRemove(p),["stop"])},[n(d,{icon:"fa-solid fa-xmark"})],8,go)]))),128))])):v("",!0)}const ho=y(mo,[["render",fo],["__scopeId","data-v-5fc4fa65"]]),_o="",$o=b({name:"PromptInput",components:{ElButton:L,FontAwesomeIcon:E,PromptTextarea:Me,InspirationPills:ho},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||(this.prompt=_o)}});function ko(e,t,s,a,u,$){const d=o("font-awesome-icon"),p=o("el-button"),f=o("inspiration-pills"),c=o("prompt-textarea");return l(),C(c,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=k=>e.prompt=k),title:e.$t("kling.name.prompt"),info:e.$t("kling.description.prompt"),placeholder:e.$t("kling.placeholder.prompt")},{actions:h(()=>[n(p,{text:"",size:"small",class:"inspiration-btn",onClick:t[0]||(t[0]=k=>e.$emit("open-inspiration"))},{default:h(()=>[n(d,{icon:"fa-regular fa-lightbulb",class:"mr-1"}),w(" "+r(e.$t("kling.inspiration.openButton")),1)]),_:1})]),before:h(()=>[n(f)]),_:1},8,["modelValue","title","info","placeholder"])}const vo=y($o,[["render",ko],["__scopeId","data-v-c01fc1a6"]]),bo="",yo=b({name:"NegativePromptInput",components:{ElInput:pe,InfoIcon:I},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||(this.prompt=bo)}}),wo={class:"field"},Co={class:"box"},So={class:"title font-bold"};function Vo(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-input");return l(),m("div",wo,[i("div",Co,[i("h2",So,r(e.$t("kling.name.negativePrompt")),1),n(d,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),n(p,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=f=>e.prompt=f),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt")},null,8,["modelValue","placeholder"])])}const Io=y(yo,[["render",Vo],["__scopeId","data-v-de98cf01"]]),To=b({name:"InspirationDrawer",components:{ElDrawer:re,ElButton:L,FontAwesomeIcon:E},props:{modelValue:{type:Boolean,default:!1}},emits:["update:modelValue"],data(){return{groups:fe,Close:ye}},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(t=>this.$t(`kling.inspiration.chip.${t}`)))},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(z(this.prompt,e)):this.setPrompt(co(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(const t of this.allChipTexts)for(;e.includes(t);)e=z(e,t);this.setPrompt(e)}}}),Eo={class:"drawer-content"},Lo={class:"drawer-header"},Mo={class:"title-row"},Ro={class:"title"},Uo={class:"hint"},Do={key:0,class:"selected-bar"},Ao={class:"selected-text"},Po={class:"groups"},Go={class:"group-title"},Ko={class:"chip-grid"},Oo=["onClick"];function jo(e,t,s,a,u,$){const d=o("font-awesome-icon"),p=o("el-button"),f=o("el-drawer");return l(),C(f,{modelValue:e.visible,"onUpdate:modelValue":t[1]||(t[1]=c=>e.visible=c),direction:"rtl","with-header":!1,size:e.drawerSize,"custom-class":"kling-inspiration-drawer","destroy-on-close":!1},{default:h(()=>[i("div",Eo,[i("div",Lo,[i("div",Mo,[n(d,{icon:"fa-regular fa-lightbulb",class:"mr-2"}),i("span",Ro,r(e.$t("kling.inspiration.title")),1)]),n(p,{text:"",icon:e.Close,class:"close-btn",onClick:t[0]||(t[0]=c=>e.visible=!1)},null,8,["icon"])]),i("div",Uo,r(e.$t("kling.inspiration.hint")),1),e.selectedCount>0?(l(),m("div",Do,[i("span",Ao,r(e.$t("kling.inspiration.selectedSummary",{count:e.selectedCount})),1),n(p,{text:"",size:"small",class:"clear-btn",onClick:e.onClearSelected},{default:h(()=>[w(r(e.$t("kling.inspiration.clearSelected")),1)]),_:1},8,["onClick"])])):v("",!0),i("div",Po,[(l(!0),m(V,null,T(e.groups,c=>(l(),m("div",{key:c.groupKey,class:"group"},[i("div",Go,r(e.$t(`kling.inspiration.group.${c.groupKey}`)),1),i("div",Ko,[(l(!0),m(V,null,T(c.chipKeys,k=>(l(),m("button",{key:k,type:"button",class:U({chip:!0,active:e.isSelected(e.chipText(k))}),onClick:g=>e.onToggle(e.chipText(k))},r(e.chipText(k)),11,Oo))),128))])]))),128))])])]),_:1},8,["modelValue","size"])}const No=y(To,[["render",jo],["__scopeId","data-v-7d457a69"]]),Bo={"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"},zo={std:"720p",pro:"1080p","4k":"4K"},Fo=b({name:"SummaryChip",components:{FontAwesomeIcon:E},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){const e=this.config?.model||"kling-v2-5-turbo";return Bo[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||""},modeLabel(){const e=this.config?.mode||"std";return zo[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),qo={class:"summary-chip"},Ho=["title"],Wo=["title"],Jo=["title"],Qo=["title"],Yo=["title"];function Xo(e,t,s,a,u,$){const d=o("font-awesome-icon");return l(),m("div",qo,[i("span",{class:"part",title:e.$t("kling.name.model")},r(e.modelLabel),9,Ho),t[0]||(t[0]=i("span",{class:"dot"},"·",-1)),i("span",{class:"part",title:e.$t("kling.name.duration")},r(e.durationLabel),9,Wo),t[1]||(t[1]=i("span",{class:"dot"},"·",-1)),i("span",{class:"part",title:e.$t("kling.name.ratio")},r(e.aspectRatio||"16:9"),9,Jo),t[2]||(t[2]=i("span",{class:"dot"},"·",-1)),i("span",{class:"part",title:e.$t("kling.name.mode")},r(e.modeLabel),9,Qo),e.generateAudio?(l(),m("span",{key:0,class:"audio",title:e.$t("kling.name.generateAudio")},[n(d,{icon:"fa-solid fa-headphones"})],8,Yo)):v("",!0)])}const Zo=y(Fo,[["render",Xo],["__scopeId","data-v-418a6733"]]),xo=b({name:"ConfigPanel",components:{ElButton:L,Consumption:ce,FontAwesomeIcon:E,PromptInput:vo,NegativePromptInput:Io,ModelSelector:et,ModeSelector:at,DurationSelector:ht,RatioSelector:wt,StartImage:Lt,CfgScaleSelector:qt,GenerateAudioSelector:Zt,CameraControlSelector:ro,InspirationDrawer:No,SummaryChip:Zo,EndImage:Gt},emits:["generate"],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},consumption(){return ge(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),en={class:"flex flex-col h-full"},tn={class:"flex-1 overflow-y-auto p-5"},on={class:"flex flex-col items-center justify-center px-5 pb-5"};function nn(e,t,s,a,u,$){const d=o("prompt-input"),p=o("model-selector"),f=o("ratio-selector"),c=o("start-image"),k=o("end-image"),g=o("duration-selector"),_=o("mode-selector"),M=o("generate-audio-selector"),R=o("camera-control-selector"),j=o("cfg-scale-selector"),he=o("negative-prompt-input"),_e=o("summary-chip"),$e=o("consumption"),X=o("font-awesome-icon"),Z=o("el-button"),ke=o("inspiration-drawer");return l(),m("div",en,[i("div",tn,[n(d,{class:"mb-4",onOpenInspiration:t[0]||(t[0]=x=>e.inspirationOpen=!0)}),n(p,{class:"mb-4"}),n(f,{class:"mb-4"}),n(c,{class:"mb-2"}),n(k,{class:"mb-2"}),n(g,{class:"mb-4"}),n(_,{class:"mb-4"}),n(M,{class:"mb-4"}),n(R,{class:"mb-4"}),n(j,{class:"mb-4"}),n(he,{class:"mb-4"})]),i("div",on,[n(_e),n($e,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(l(),C(Z,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[n(X,{icon:"fa-solid fa-magic",class:"mr-2"}),w(" "+r(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(l(),C(Z,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[n(X,{icon:"fa-solid fa-magic",class:"mr-2"}),w(" "+r(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))]),n(ke,{modelValue:e.inspirationOpen,"onUpdate:modelValue":t[1]||(t[1]=x=>e.inspirationOpen=x)},null,8,["modelValue"])])}const sn=y(xo,[["render",nn]]),ln=b({name:"MotionImage",components:{ElUpload:O,ElButton:L,InfoIcon:I,FontAwesomeIcon:E,ImagePreview:K},mixins:[H],data(){return{fileList:[],uploadUrl:G()+"/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(){S.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){S.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(){const e=this.urls?.[0];this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,image_url:e})},async onSuccess(){this.onSetImageUrl()}}}),an={class:"relative"},rn={class:"flex justify-between"},cn={class:"flex justify-start items-center"},dn={class:"text-sm font-bold"};function mn(e,t,s,a,u,$){const d=o("info-icon"),p=o("image-preview"),f=o("font-awesome-icon"),c=o("el-button"),k=o("el-upload");return l(),m("div",an,[i("div",rn,[i("div",cn,[i("span",dn,r(e.$t("kling.name.motionImage")),1),n(d,{content:e.$t("kling.description.motionImage")},null,8,["content"])])]),n(k,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=g=>e.fileList=g),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:h(({file:g})=>[g.url&&g.percentage!==void 0?(l(),C(p,{key:0,url:g.url,name:g.name,percentage:g.percentage,onRemove:_=>e.onRemove(g)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:h(()=>[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:h(()=>[n(f,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+r(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const un=y(ln,[["render",mn],["__scopeId","data-v-37d42da7"]]),pn=b({name:"MotionVideo",components:{ElUpload:O,ElButton:L,InfoIcon:I,FilePreview:Ue,FontAwesomeIcon:E},data(){return{fileList:[],uploadUrl:G()+"/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(){S.warning(this.$t("kling.message.uploadVideoExceed"))},onError(){S.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){const t=e.type==="video/mp4"||e.type==="video/quicktime",s=e.size/1024/1024<100;return t?s?!0:(S.error(this.$t("kling.message.uploadVideoSizeExceed")),!1):(S.error(this.$t("kling.message.uploadVideoTypeFailed")),!1)},onSetVideoUrl(){const e=this.urls?.[0];this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,video_url:e})},async onSuccess(){this.onSetVideoUrl()}}}),gn={class:"relative"},fn={class:"flex justify-between"},hn={class:"flex justify-start items-center"},_n={class:"text-sm font-bold"};function $n(e,t,s,a,u,$){const d=o("info-icon"),p=o("file-preview"),f=o("font-awesome-icon"),c=o("el-button"),k=o("el-upload");return l(),m("div",gn,[i("div",fn,[i("div",hn,[i("span",_n,r(e.$t("kling.name.motionVideo")),1),n(d,{content:e.$t("kling.description.motionVideo")},null,8,["content"])])]),n(k,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=g=>e.fileList=g),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:h(({file:g})=>[g.percentage!==void 0?(l(),C(p,{key:0,url:g.url||g.response?.file_url,name:g.name,percentage:g.percentage,onRemove:_=>e.onRemove(g)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:h(()=>[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:h(()=>[n(f,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+r(e.$t("kling.button.uploadVideoUrl")),1)]),_:1})]),_:1},8,["file-list","action","before-upload","on-exceed","on-error","on-success","headers"])])}const kn=y(pn,[["render",$n],["__scopeId","data-v-5cf93212"]]),vn=b({name:"MotionPromptInput",components:{ElInput:pe,InfoIcon:I},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||""},set(e){this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),bn={class:"field"},yn={class:"box"},wn={class:"title font-bold"};function Cn(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-input");return l(),m("div",bn,[i("div",yn,[i("h2",wn,r(e.$t("kling.name.motionPrompt")),1),n(d,{content:e.$t("kling.description.motionPrompt"),class:"info"},null,8,["content"])]),n(p,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=f=>e.prompt=f),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.motionPrompt")},null,8,["modelValue","placeholder"])])}const Sn=y(vn,[["render",Cn],["__scopeId","data-v-ca9fdbe5"]]),ie="video",Vn=b({name:"CharacterOrientationSelector",components:{ElRadioGroup:Ae,ElRadioButton:De,InfoIcon:I},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||ie},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=ie)}}),In={class:"field"},Tn={class:"header"},En={class:"text-sm font-bold"};function Ln(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-radio-button"),f=o("el-radio-group");return l(),m("div",In,[i("div",Tn,[i("span",En,r(e.$t("kling.name.characterOrientation")),1),n(d,{content:e.$t("kling.description.characterOrientation")},null,8,["content"])]),n(f,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),size:"small",class:"value"},{default:h(()=>[n(p,{label:"image"},{default:h(()=>[w(r(e.$t("kling.name.orientationImage")),1)]),_:1}),n(p,{label:"video"},{default:h(()=>[w(r(e.$t("kling.name.orientationVideo")),1)]),_:1})]),_:1},8,["modelValue"])])}const Mn=y(Vn,[["render",Ln],["__scopeId","data-v-7a91195b"]]),le="std",Rn=b({name:"MotionModeSelector",components:{ElSelect:P,ElOption:A,InfoIcon:I},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||le},set(e){this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=le)}}),Un={class:"field"},Dn={class:"header"},An={class:"title font-bold"};function Pn(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-option"),f=o("el-select");return l(),m("div",Un,[i("div",Dn,[i("h2",An,r(e.$t("kling.name.mode")),1),n(d,{content:e.$t("kling.description.motionMode")},null,8,["content"])]),n(f,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:h(()=>[(l(!0),m(V,null,T(e.options,c=>(l(),C(p,{key:c.value,label:c.label,value:c.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Gn=y(Rn,[["render",Pn],["__scopeId","data-v-1295688c"]]),Kn=b({name:"KeepOriginalSoundSelector",components:{ElSwitch:ue,InfoIcon:I},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"})}}}}),On={class:"relative"},jn={class:"flex justify-between items-center"},Nn={class:"flex justify-start items-center"},Bn={class:"text-sm font-bold"};function zn(e,t,s,a,u,$){const d=o("info-icon"),p=o("el-switch");return l(),m("div",On,[i("div",jn,[i("div",Nn,[i("span",Bn,r(e.$t("kling.name.keepOriginalSound")),1),n(d,{content:e.$t("kling.description.keepOriginalSound")},null,8,["content"])]),n(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f)},null,8,["modelValue"])])])}const Fn=y(Kn,[["render",zn]]),qn=b({name:"MotionPanel",components:{ElButton:L,FontAwesomeIcon:E,Consumption:ce,MotionImage:un,MotionVideo:kn,MotionPromptInput:Sn,CharacterOrientationSelector:Mn,MotionModeSelector:Gn,KeepOriginalSoundSelector:Fn},emits:["generate"],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return ge(this.motionConfig,this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){const e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit("generate")}}}),Hn={class:"flex flex-col h-full"},Wn={class:"flex-1 overflow-y-auto p-5"},Jn={class:"flex flex-col items-center justify-center px-5 pb-5"};function Qn(e,t,s,a,u,$){const d=o("motion-image"),p=o("motion-video"),f=o("motion-prompt-input"),c=o("character-orientation-selector"),k=o("motion-mode-selector"),g=o("keep-original-sound-selector"),_=o("consumption"),M=o("font-awesome-icon"),R=o("el-button");return l(),m("div",Hn,[i("div",Wn,[n(d,{class:"mb-3"}),n(p,{class:"mb-3"}),n(f,{class:"mb-4"}),n(c,{class:"mb-4"}),n(k,{class:"mb-4"}),n(g,{class:"mb-4"})]),i("div",Jn,[n(_,{value:e.consumption,service:e.service},null,8,["value","service"]),n(R,{type:"primary",class:"btn w-full",round:"",disabled:!e.canGenerate,onClick:e.onGenerate},{default:h(()=>[n(M,{icon:"fa-solid fa-magic",class:"mr-2"}),w(" "+r(e.$t("kling.button.generateMotion")),1)]),_:1},8,["disabled","onClick"])])])}const Yn=y(qn,[["render",Qn]]),Xn=b({name:"KlingTabSwitcher",components:{ElTabs:Ge,ElTabPane:Pe,ElTag:we},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")}]}},methods:{onUpdate(e){this.$emit("update:modelValue",e)}}}),Zn=["title"],xn={class:"text"};function es(e,t,s,a,u,$){const d=o("el-tag"),p=o("el-tab-pane"),f=o("el-tabs");return l(),C(f,{"model-value":e.modelValue,class:"kling-tabs",stretch:"","onUpdate:modelValue":e.onUpdate},{default:h(()=>[(l(!0),m(V,null,T(e.tabs,c=>(l(),C(p,{key:c.value,name:c.value,disabled:c.disabled},{label:h(()=>[i("span",{class:"tab-label",title:c.disabled?c.disabledReason:void 0},[i("span",xn,r(c.label),1),c.badge?(l(),C(d,{key:0,size:"small",type:"warning",class:"badge"},{default:h(()=>[w(r(c.badge),1)]),_:2},1024)):v("",!0)],8,Zn)]),_:2},1032,["name","disabled"]))),128))]),_:1},8,["model-value","onUpdate:modelValue"])}const ts=y(Xn,[["render",es],["__scopeId","data-v-bf00c27e"]]),os=b({name:"TaskPreview",components:{ElImage:Ne,CopyToClipboard:Ke,FontAwesomeIcon:E,ElAlert:je,VideoPlayer:Oe,ElTooltip:W,ElButton:L,ImagePreview:K},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config},referenceImages(){const e=[],t=this.modelValue?.request?.start_image_url,s=this.modelValue?.request?.end_image_url;return t&&e.push({url:t,name:"start-image"}),s&&e.push({url:s,name:"end-image"}),e}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),ns={class:"preview"},ss={class:"left"},is={class:"main"},ls={class:"bot"},as={class:"datetime"},rs={class:"info"},cs={key:0,class:"flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto"},ds={key:1,class:"prompt mt-2"},ms={key:0},us={key:1},ps={key:0,class:U({content:!0,failed:!0})},gs={key:0,class:"mb-4"},fs={key:1,class:U({operations:!0,"mt-2":!0})},hs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},_s={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},$s={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ks={key:1,class:U({content:!0})},vs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},bs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ys={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ws={key:1,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Cs={key:2,class:U({content:!0})},Ss={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Vs={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Is(e,t,s,a,u,$){const d=o("el-image"),p=o("image-preview"),f=o("video-player"),c=o("el-button"),k=o("el-tooltip"),g=o("font-awesome-icon"),_=o("copy-to-clipboard"),M=o("el-alert");return l(),m("div",ns,[i("div",ss,[n(d,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),i("div",is,[i("div",ls,[w(r(e.$t("kling.name.klingBot"))+" ",1),i("span",as,r(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),i("div",rs,[e.referenceImages.length>0?(l(),m("div",cs,[(l(!0),m(V,null,T(e.referenceImages,(R,j)=>(l(),C(p,{key:j,url:R.url,name:R.name,closable:!1},null,8,["url","name"]))),128))])):v("",!0),e.modelValue?.request?.prompt?(l(),m("p",ds,[w(r(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?v("",!0):(l(),m("span",ms," - ("+r(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(l(),m("span",us," - ("+r(e.$t("kling.status.processing"))+") ",1)):v("",!0)])):v("",!0)]),e.modelValue?.response?.success===!0?(l(),m("div",ps,[e.modelValue?.response.video_url?(l(),m("div",gs,[n(f,{src:e.modelValue?.response.video_url},null,8,["src"])])):v("",!0),e.modelValue?.response.success?(l(),m("div",fs,[n(k,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:h(()=>[e.modelValue?.response.video_url?(l(),C(c,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=R=>e.onDownload(R,e.modelValue?.response.video_url))},{default:h(()=>[w(r(e.$t("kling.button.download")),1)]),_:1})):v("",!0)]),_:1},8,["content"])])):v("",!0),n(M,{closable:!1,class:"mt-2 success"},{default:h(()=>[i("p",hs,[n(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+r(e.$t("kling.name.model"))+": "+r(e.modelValue?.request?.model),1)]),i("p",_s,[n(g,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+r(e.$t("kling.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),n(_,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.elapsed?(l(),m("p",$s,[n(g,{icon:"fa-solid fa-clock",class:"mr-1"}),w(" "+r(e.$t("kling.name.elapsed"))+": "+r(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):v("",!0)]),_:1})])):v("",!0),e.modelValue?.response?.success===!1?(l(),m("div",ks,[n(M,{closable:!1,class:"failure"},{template:h(()=>[n(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),w(" "+r(e.$t("kling.name.failure")),1)]),default:h(()=>[i("p",vs,[n(g,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+r(e.$t("kling.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),n(_,{content:e.modelValue?.id},null,8,["content"])]),i("p",bs,[n(g,{icon:"fa-solid fa-circle-info",class:"mr-1"}),w(" "+r(e.$t("kling.name.failureReason"))+": "+r(e.modelValue?.response?.error?.message)+" ",1),n(_,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.elapsed?(l(),m("p",ys,[n(g,{icon:"fa-solid fa-clock",class:"mr-1"}),w(" "+r(e.$t("kling.name.elapsed"))+": "+r(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):v("",!0),e.modelValue?.response?.trace_id?(l(),m("p",ws,[n(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+r(e.$t("kling.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),n(_,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):v("",!0)]),_:1})])):v("",!0),e.modelValue?.response?.success===void 0?(l(),m("div",Cs,[n(M,{closable:!1,class:"info"},{template:h(()=>[n(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),w(" "+r(e.$t("kling.name.failure")),1)]),default:h(()=>[i("p",Ss,[n(g,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+r(e.$t("kling.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),n(_,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(l(),m("p",Vs,[n(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+r(e.$t("kling.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),n(_,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):v("",!0)]),_:1})])):v("",!0)])])}const Ts=y(os,[["render",Is],["__scopeId","data-v-e8e87659"]]),Es=b({name:"RecentPanel",components:{TaskPreview:Ts,NoTasks:Re,BotPlaceholder:Be,ScrollList:Ee},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?.()}}}),Ls={key:0},Ms={key:2,class:"w-full h-full flex items-center justify-center"};function Rs(e,t,s,a,u,$){const d=o("bot-placeholder"),p=o("task-preview"),f=o("scroll-list"),c=o("no-tasks");return l(),m(V,null,[e.tasks?.items===void 0?(l(),m("div",Ls,[n(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),C(f,{key:1,ref:"scrollList",class:"h-full w-full overflow-y-auto tasks",loading:e.loading,onReachTop:t[0]||(t[0]=k=>e.$emit("reach-top"))},{default:h(()=>[(l(!0),m(V,null,T(e.tasks?.items,k=>(l(),C(p,{key:k.id,"model-value":k},null,8,["model-value"]))),128))]),_:1},8,["loading"])):v("",!0),e.tasks?.items?.length===0?(l(),m("div",Ms,[n(c)])):v("",!0)],64)}const Us=y(Es,[["render",Rs]]),ae=Ce("kling"),Ds=b({name:"KlingIndex",components:{ConfigPanel:sn,MotionPanel:Yn,TabSwitcher:ts,Layout:Je,RecentPanel:Us},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===oe.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===oe.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},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 Le({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){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();const 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);const{limit:t=5,createdAtMin:s,createdAtMax:a}=e||{};console.debug("limit",t,"createdAtMin",s,"createdAtMax",a),this.fetchingTasks=!0;try{await this.$store.dispatch("kling/getTasks",{limit:t,createdAtMin:s,createdAtMax:a})}finally{this.fetchingTasks=!1}},async onGenerate(){const{camera_control:e,...t}=this.config||{},s={...t,callback_url:ae};if(!s.video_id&&!t.video_url&&!s.start_image_url&&s.end_image_url){S.warning(this.$t("kling.message.endImageRequiresStart"));return}s.action||(s.video_id||t.video_url?s.action="extend":s.start_image_url?s.action="image2video":s.action="text2video"),s.action==="text2video"&&s.end_image_url&&delete s.end_image_url,e?.type&&(s.camera_control={type:e.type,...e.type==="simple"&&e.config?{config:Object.fromEntries(Object.entries(e.config).filter(([,u])=>u!=null))}:{}});const a=this.credential?.token;if(!a){console.error("no token specified");return}S.info(this.$t("kling.message.startingTask")),ee("kling",te.generate(s,{token:a})).then(()=>{S.success(this.$t("kling.message.startTaskSuccess"))}).catch(u=>{u?.response?.data?.error?.code===se?S.error(this.$t("kling.message.usedUp")):S.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(){const e=this.motionConfig||{};if(!e.image_url||!e.video_url){S.warning(this.$t("kling.message.motionMissingInputs"));return}const 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:ae},s=this.credential?.token;if(!s){console.error("no token specified");return}S.info(this.$t("kling.message.startingTask")),ee("kling",te.motion(t,{token:s})).then(()=>{S.success(this.$t("kling.message.startTaskSuccess"))}).catch(a=>{a?.response?.data?.error?.code===se?S.error(this.$t("kling.message.usedUp")):S.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),As={class:"flex flex-col h-full"},Ps={class:"flex-1 min-h-0"};function Gs(e,t,s,a,u,$){const d=o("tab-switcher"),p=o("config-panel"),f=o("motion-panel"),c=o("recent-panel"),k=o("layout");return l(),C(k,null,{config:h(()=>[i("div",As,[n(d,{"model-value":e.taskType,"onUpdate:modelValue":e.onTabChange},null,8,["model-value","onUpdate:modelValue"]),i("div",Ps,[e.taskType==="videos"?(l(),C(p,{key:0,onGenerate:e.onGenerate},null,8,["onGenerate"])):e.taskType==="motion"?(l(),C(f,{key:1,onGenerate:e.onGenerateMotion},null,8,["onGenerate"])):v("",!0)])])]),result:h(()=>[n(c,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Ki=y(Ds,[["render",Gs]]);export{Ki as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as C}from"./index.es-rfDbxZpm.js";import{E as G}from"./index-DBQvlqm3.js";import{E as L}from"./index-D-KZRZPp.js";import{d as v,H as l,E as r,z as A,C as s,y as d,D as n,q as o,F as a,I as g,O as I,N as T,x as E,Q as S,c as U,J as $}from"./vendor-vue-NSDaktjZ.js";import{G as b,bj as D,co as j,bb as z,n as M,S as V,cp as O}from"./index-DDJccgho.js";import{p as B}from"./pasteUploadMixin-BurWbGNQ.js";import{I as q,S as F,l as N}from"./pagination-CDk6ho1i.js";import{I as H}from"./ImagePreview-D1oWKxPX.js";import{E as J}from"./index-Db5A7UiS.js";import{E as w}from"./index-DtUQgyoo.js";import{a as Q,E as W}from"./index-CL16wKMg.js";import{E as R}from"./index-CkfWRF3i.js";import{E as K,a as X}from"./index-BbSliDK4.js";import{b as Y,a as Z}from"./errorCode-Cqj9Td_Z.js";import{A as x}from"./Status-BYtt2-8H.js";import{C as ee}from"./CopyToClipboard-D2Ga1c-u.js";import{E as se}from"./index-wrqbgHKw.js";import{E as te,a as oe}from"./index-BcNn3Owf.js";import"./use-form-item-1C5uFRHv.js";import"./index-BuyEbX8F.js";import"./vendor-axios-B8_nURbH.js";import"./vendor-dayjs-v0j1UNZp.js";import"./vendor-vue-router-Df5ITouH.js";import"./index-DK4DFfU5.js";import"./index-BPk2ZoOA.js";import"./typescript-CCF0uyn2.js";import"./index-BjCVlRvR.js";import"./_baseClone-C7mAsPbg.js";import"./_Uint8Array-DiKiqj6b.js";import"./_initCloneObject-DHUwupd_.js";import"./isEqual-CC5LQv_R.js";import"./debounce-B-jn60n6.js";import"./index-E1-z9_FO.js";import"./strings-beZM2Y-f.js";import"./isPlainObject-CJWHXdHh.js";const ae=v({name:"LayoutHeadshots",components:{ElDrawer:L,ElButton:G,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ne={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)]"},le={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function re(e,t,m,h,k,y){const p=n("font-awesome-icon"),u=n("el-button"),i=n("el-drawer");return o(),l("div",ne,[r("div",ie,[A(e.$slots,"config",{},void 0,!0)]),r("div",le,[A(e.$slots,"result",{},void 0,!0)]),s(u,{circle:"",class:"menu",onClick:t[0]||(t[0]=c=>e.drawer=!0)},{default:d(()=>[s(p,{icon:"fa-solid fa-gear"})]),_:1}),s(i,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=c=>e.drawer=c),"with-header":!1,size:"340px",class:"drawer"},{default:d(()=>[A(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ce=b(ae,[["render",re],["__scopeId","data-v-ada6b2d1"]]),de=v({name:"ImageUrlsInput",components:{ElUpload:J,ElButton:G,InfoIcon:q,ImagePreview:H,FontAwesomeIcon:C},mixins:[B],data(){return{fileList:[],uploadUrl:D()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){w.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){w.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),pe={class:"field"},me={class:"title font-bold"},he={class:"upload-wrapper"};function ue(e,t,m,h,k,y){const p=n("image-preview"),u=n("font-awesome-icon"),i=n("el-button"),c=n("el-upload"),f=n("info-icon");return o(),l("div",pe,[r("h2",me,a(e.$t("headshots.name.endImageUrls")),1),r("div",he,[s(c,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=_=>e.fileList=_),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:d(({file:_})=>[s(p,{url:_.url||_.response?.file_url,name:_.name,percentage:_.percentage,onRemove:P=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])]),default:d(()=>[s(i,{size:"small",type:"primary",round:""},{default:d(()=>[s(u,{icon:"fa-solid fa-upload",class:"mr-1"}),g(" "+a(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),s(f,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const fe=b(de,[["render",ue],["__scopeId","data-v-ca56051e"]]),ge="fast",_e=v({name:"ModeSelector",components:{ElRadioButton:W,ElRadioGroup:Q},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||(this.value=ge)}}),$e={class:"field"},ve={class:"title font-bold"};function be(e,t,m,h,k,y){const p=n("el-radio-button"),u=n("el-radio-group");return o(),l("div",$e,[r("h2",ve,a(e.$t("headshots.name.mode")),1),s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=i=>e.value=i),class:"mode"},{default:d(()=>[(o(!0),l(I,null,T(e.options,i=>(o(),E(p,{key:i.value,label:i.value},{default:d(()=>[g(a(i.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const ke=b(_e,[["render",be],["__scopeId","data-v-e7702494"]]),ye=v({name:"StylizeSelector",components:{ElTabs:X,ElTabPane:K,ElImage:R},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||(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})}}}),we={class:"field"},Ie=["onClick"],Te={class:"name"};function Ee(e,t,m,h,k,y){const p=n("el-image"),u=n("el-tab-pane"),i=n("el-tabs");return o(),l("div",we,[s(i,{modelValue:e.tab,"onUpdate:modelValue":t[0]||(t[0]=c=>e.tab=c)},{default:d(()=>[(o(!0),l(I,null,T(e.elements,(c,f)=>(o(),E(u,{key:f,label:c.displayName,name:f,class:"pane"},{default:d(()=>[(o(!0),l(I,null,T(c.items,(_,P)=>(o(),l("div",{key:P,class:S({item:!0,active:e.value===_.value}),onClick:ys=>e.onToggle(_.value)},[s(p,{src:_.image,fit:"fill",class:"preview"},null,8,["src"]),r("span",Te,a(_.label),1)],10,Ie))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const Se=b(ye,[["render",Ee],["__scopeId","data-v-be4bd25d"]]),Ve=v({name:"PresetPanel",components:{ModeSelector:ke,ImageUrlsInput:fe,ElButton:G,FontAwesomeIcon:C,ElementsSelector:Se},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),Ce={class:"panel"},Ae={class:"config"},Ge={class:"actions"};function Pe(e,t,m,h,k,y){const p=n("elements-selector"),u=n("mode-selector"),i=n("image-urls-input"),c=n("font-awesome-icon"),f=n("el-button");return o(),l("div",Ce,[r("div",Ae,[s(p,{class:"mb-4"}),s(u,{class:"mb-4"}),s(i,{class:"mb-4"}),r("div",Ge,[s(f,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[s(c,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+a(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Re=b(Ve,[["render",Pe],["__scopeId","data-v-848739f6"]]),Le=v({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:U(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:h=>{window.open(h,"_blank")}}}}),Ue={class:"image-gallery"},De=["src"],je=["onClick"];function ze(e,t,m,h,k,y){return o(),l("div",Ue,[(o(!0),l(I,null,T(e.images,(p,u)=>(o(),l("div",{key:u,class:"image-container"},[r("img",{src:p.image_url,alt:"Image"},null,8,De),p.image_url?(o(),l("button",{key:0,class:"view-button",onClick:i=>e.viewImage(p.image_url)},a(e.$t("headshots.button.viewImage")),9,je)):$("",!0)]))),128))])}const Me=b(Le,[["render",ze],["__scopeId","data-v-42f0a7be"]]),Oe=v({name:"TaskPreview",components:{ElImage:R,CopyToClipboard:ee,FontAwesomeIcon:C,ElAlert:se,ImageGallery:Me},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){const t=e.target,m=new URL(t.src),h=m.searchParams.get("retry");if(!h)m.searchParams.set("retry","1");else if(parseInt(h)<2)m.searchParams.set("retry",(parseInt(h)+1).toString());else return;t.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),Be={class:"preview"},qe={class:"left"},Fe={class:"main"},Ne={class:"bot"},He={class:"datetime"},Je={class:"info"},Qe={key:0,class:"prompt mt-2"},We={key:0},Ke={key:1},Xe={key:0,class:S({content:!0,failed:!0})},Ye={class:"image-wrapper"},Ze={class:"description"},xe={key:0,class:"description"},es={key:1,class:S({content:!0})},ss={class:"description"},ts={class:"description"},os={key:0,class:"description"},as={class:"description"},ns={key:2,class:S({content:!0})},is={class:"description"},ls={key:3,class:S({content:!0})},rs={class:"description"};function cs(e,t,m,h,k,y){const p=n("el-image"),u=n("image-gallery"),i=n("font-awesome-icon"),c=n("copy-to-clipboard"),f=n("el-alert");return o(),l("div",Be,[r("div",qe,[s(p,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),r("div",Fe,[r("div",Ne,[g(a(e.$t("headshots.name.headshotsBot"))+" ",1),r("span",He,a(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),r("div",Je,[e.modelValue?.request?.template?(o(),l("p",Qe,[g(a(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?$("",!0):(o(),l("span",We," - ("+a(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(o(),l("span",Ke," - ("+a(e.$t("headshots.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(o(),l("div",Xe,[r("div",Ye,[s(u,{"model-value":e.modelValue},null,8,["model-value"])]),s(f,{closable:!1,class:"mt-2 success"},{default:d(()=>[r("p",Ze,[s(i,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+a(e.$t("headshots.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),e.modelValue?.elapsed?(o(),l("p",xe,[s(i,{icon:"fa-solid fa-clock",class:"mr-1"}),g(" "+a(e.$t("headshots.name.elapsed"))+": "+a(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):$("",!0)]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(o(),l("div",es,[s(f,{closable:!1,class:"failure"},{template:d(()=>[s(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+a(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",ss,[s(i,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+a(e.$t("headshots.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),r("p",ts,[s(i,{icon:"fa-solid fa-circle-info",class:"mr-1"}),g(" "+a(e.$t("headshots.name.failureReason"))+": "+a(e.modelValue?.response?.error?.message)+" ",1),s(c,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),e.modelValue?.elapsed?(o(),l("p",os,[s(i,{icon:"fa-solid fa-clock",class:"mr-1"}),g(" "+a(e.$t("headshots.name.elapsed"))+": "+a(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):$("",!0),r("p",as,[s(i,{icon:"fa-solid fa-hashtag",class:"mr-1"}),g(" "+a(e.$t("headshots.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),s(c,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?$("",!0):(o(),l("div",ns,[s(f,{closable:!1,class:"info"},{template:d(()=>[s(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+a(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",is,[s(i,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+a(e.$t("headshots.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(o(),l("div",ls,[s(f,{closable:!1,class:"info"},{template:d(()=>[s(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+a(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",rs,[s(i,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+a(e.$t("headshots.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0)])])}const ds=b(Oe,[["render",cs],["__scopeId","data-v-d286678e"]]),ps=v({name:"RecentPanel",components:{TaskPreview:ds,ElSkeleton:oe,ElSkeletonItem:te,ScrollList:F},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?.()}}}),ms={key:0,class:"tasks"},hs={class:"left"},us={class:"main"},fs={key:1,class:"tasks"},gs={key:2,class:"description"};function _s(e,t,m,h,k,y){const p=n("el-skeleton-item"),u=n("el-skeleton"),i=n("task-preview"),c=n("scroll-list");return o(),E(c,{ref:"scrollList",class:"panel recent",loading:e.loading,onReachTop:t[0]||(t[0]=f=>e.$emit("reach-top"))},{default:d(()=>[e.tasks?.items===void 0?(o(),l("div",ms,[(o(),l(I,null,T(3,f=>r("div",{key:f,class:"task placeholder"},[r("div",hs,[s(u,{animated:""},{template:d(()=>[s(p,{variant:"image",class:"avatar"})]),_:1})]),r("div",us,[s(u,{animated:""},{template:d(()=>[s(p,{variant:"p",class:"title"}),s(p,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(o(),l("div",fs,[(o(!0),l(I,null,T(e.tasks?.items,(f,_)=>(o(),E(i,{key:_,"model-value":f,class:"preview"},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(o(),l("p",gs,a(e.$t("headshots.message.noTasks")),1)):$("",!0)]),_:1},8,["loading"])}const $s=b(ps,[["render",_s],["__scopeId","data-v-ffd55c16"]]),vs=O("headshots"),bs=v({name:"HeadshotsIndex",components:{ConfigPanel:Re,Layout:ce,ApplicationStatus:x,RecentPanel:$s},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.headshots?.status?.getApplications===V.Request},tasksLoading(){return this.$store.state.headshots?.status?.getTasks===V.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===V.Request},needApply(){return this.$store.state.headshots.status.getApplications===V.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 N({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(){M.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Z&&w.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const 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);const{limit:t=5,createdAtMin:m,createdAtMax:h}=e||{};console.debug("limit",t,"createdAtMin",m,"createdAtMax",h),this.fetchingTasks=!0;try{await this.$store.dispatch("headshots/getTasks",{limit:t,createdAtMin:m,createdAtMax:h})}finally{this.fetchingTasks=!1}},async onGeneratePicture(){const e={...this.config,callback_url:vs},t=this.credential?.token;if(!t){console.error("no token specified");return}w.info(this.$t("headshots.message.startingTask")),j("headshots",z.generate(e,{token:t})).then(()=>{w.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===Y?w.error(this.$t("headshots.message.usedUp")):w.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function ks(e,t,m,h,k,y){const p=n("config-panel"),u=n("application-status"),i=n("recent-panel"),c=n("layout");return o(),E(c,null,{config:d(()=>[s(p,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:d(()=>[s(u,{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[0]=f=>e.$store.dispatch("headshots/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),s(i,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const at=b(bs,[["render",ks],["__scopeId","data-v-0af228d8"]]);export{at as default};
|
|
1
|
+
import{F as C}from"./index.es-D5toi_yB.js";import{E as G}from"./index-mTDdtUSQ.js";import{E as L}from"./index-DU5biqWK.js";import{d as v,H as l,E as r,z as A,C as s,y as d,D as n,q as o,F as a,I as g,O as I,N as T,x as E,Q as S,c as U,J as $}from"./vendor-vue-NSDaktjZ.js";import{G as b,bj as D,co as j,bb as z,n as M,S as V,cp as O}from"./index-CCfnxGYg.js";import{p as B}from"./pasteUploadMixin-BurWbGNQ.js";import{I as q,S as F,l as N}from"./pagination-BO6RV-kc.js";import{I as H}from"./ImagePreview-C4OiWDg9.js";import{E as J}from"./index-BwEtWche.js";import{E as w}from"./index-CoYnpgkX.js";import{a as Q,E as W}from"./index-Dxq53QkJ.js";import{E as R}from"./index-B1DLX4Fc.js";import{E as K,a as X}from"./index-sF_c-ZTZ.js";import{b as Y,a as Z}from"./errorCode-Cqj9Td_Z.js";import{A as x}from"./Status-C3OMqSVk.js";import{C as ee}from"./CopyToClipboard-UnYO6hAq.js";import{E as se}from"./index-oRUvw3Ui.js";import{E as te,a as oe}from"./index-1diQ6JT1.js";import"./use-form-item-BdyDMPU-.js";import"./index-BuyEbX8F.js";import"./vendor-axios-B8_nURbH.js";import"./vendor-dayjs-v0j1UNZp.js";import"./vendor-vue-router-Df5ITouH.js";import"./index-DM6P3x3N.js";import"./index-BHtuVUFl.js";import"./typescript-DYVOpHug.js";import"./index-CpWcFmdT.js";import"./_baseClone-D4Hl6Ymo.js";import"./_Uint8Array-Dhv101dV.js";import"./_initCloneObject-QV4IIV31.js";import"./isEqual-1RENOQre.js";import"./debounce-CQuM7WhN.js";import"./index-BbjLkNT5.js";import"./strings-beZM2Y-f.js";import"./isPlainObject-CS0cmpQf.js";const ae=v({name:"LayoutHeadshots",components:{ElDrawer:L,ElButton:G,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ne={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)]"},le={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function re(e,t,m,h,k,y){const p=n("font-awesome-icon"),u=n("el-button"),i=n("el-drawer");return o(),l("div",ne,[r("div",ie,[A(e.$slots,"config",{},void 0,!0)]),r("div",le,[A(e.$slots,"result",{},void 0,!0)]),s(u,{circle:"",class:"menu",onClick:t[0]||(t[0]=c=>e.drawer=!0)},{default:d(()=>[s(p,{icon:"fa-solid fa-gear"})]),_:1}),s(i,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=c=>e.drawer=c),"with-header":!1,size:"340px",class:"drawer"},{default:d(()=>[A(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ce=b(ae,[["render",re],["__scopeId","data-v-ada6b2d1"]]),de=v({name:"ImageUrlsInput",components:{ElUpload:J,ElButton:G,InfoIcon:q,ImagePreview:H,FontAwesomeIcon:C},mixins:[B],data(){return{fileList:[],uploadUrl:D()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){w.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){w.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),pe={class:"field"},me={class:"title font-bold"},he={class:"upload-wrapper"};function ue(e,t,m,h,k,y){const p=n("image-preview"),u=n("font-awesome-icon"),i=n("el-button"),c=n("el-upload"),f=n("info-icon");return o(),l("div",pe,[r("h2",me,a(e.$t("headshots.name.endImageUrls")),1),r("div",he,[s(c,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=_=>e.fileList=_),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:d(({file:_})=>[s(p,{url:_.url||_.response?.file_url,name:_.name,percentage:_.percentage,onRemove:P=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])]),default:d(()=>[s(i,{size:"small",type:"primary",round:""},{default:d(()=>[s(u,{icon:"fa-solid fa-upload",class:"mr-1"}),g(" "+a(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),s(f,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const fe=b(de,[["render",ue],["__scopeId","data-v-ca56051e"]]),ge="fast",_e=v({name:"ModeSelector",components:{ElRadioButton:W,ElRadioGroup:Q},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||(this.value=ge)}}),$e={class:"field"},ve={class:"title font-bold"};function be(e,t,m,h,k,y){const p=n("el-radio-button"),u=n("el-radio-group");return o(),l("div",$e,[r("h2",ve,a(e.$t("headshots.name.mode")),1),s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=i=>e.value=i),class:"mode"},{default:d(()=>[(o(!0),l(I,null,T(e.options,i=>(o(),E(p,{key:i.value,label:i.value},{default:d(()=>[g(a(i.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const ke=b(_e,[["render",be],["__scopeId","data-v-e7702494"]]),ye=v({name:"StylizeSelector",components:{ElTabs:X,ElTabPane:K,ElImage:R},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||(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})}}}),we={class:"field"},Ie=["onClick"],Te={class:"name"};function Ee(e,t,m,h,k,y){const p=n("el-image"),u=n("el-tab-pane"),i=n("el-tabs");return o(),l("div",we,[s(i,{modelValue:e.tab,"onUpdate:modelValue":t[0]||(t[0]=c=>e.tab=c)},{default:d(()=>[(o(!0),l(I,null,T(e.elements,(c,f)=>(o(),E(u,{key:f,label:c.displayName,name:f,class:"pane"},{default:d(()=>[(o(!0),l(I,null,T(c.items,(_,P)=>(o(),l("div",{key:P,class:S({item:!0,active:e.value===_.value}),onClick:ys=>e.onToggle(_.value)},[s(p,{src:_.image,fit:"fill",class:"preview"},null,8,["src"]),r("span",Te,a(_.label),1)],10,Ie))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const Se=b(ye,[["render",Ee],["__scopeId","data-v-be4bd25d"]]),Ve=v({name:"PresetPanel",components:{ModeSelector:ke,ImageUrlsInput:fe,ElButton:G,FontAwesomeIcon:C,ElementsSelector:Se},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),Ce={class:"panel"},Ae={class:"config"},Ge={class:"actions"};function Pe(e,t,m,h,k,y){const p=n("elements-selector"),u=n("mode-selector"),i=n("image-urls-input"),c=n("font-awesome-icon"),f=n("el-button");return o(),l("div",Ce,[r("div",Ae,[s(p,{class:"mb-4"}),s(u,{class:"mb-4"}),s(i,{class:"mb-4"}),r("div",Ge,[s(f,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[s(c,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+a(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Re=b(Ve,[["render",Pe],["__scopeId","data-v-848739f6"]]),Le=v({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:U(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:h=>{window.open(h,"_blank")}}}}),Ue={class:"image-gallery"},De=["src"],je=["onClick"];function ze(e,t,m,h,k,y){return o(),l("div",Ue,[(o(!0),l(I,null,T(e.images,(p,u)=>(o(),l("div",{key:u,class:"image-container"},[r("img",{src:p.image_url,alt:"Image"},null,8,De),p.image_url?(o(),l("button",{key:0,class:"view-button",onClick:i=>e.viewImage(p.image_url)},a(e.$t("headshots.button.viewImage")),9,je)):$("",!0)]))),128))])}const Me=b(Le,[["render",ze],["__scopeId","data-v-42f0a7be"]]),Oe=v({name:"TaskPreview",components:{ElImage:R,CopyToClipboard:ee,FontAwesomeIcon:C,ElAlert:se,ImageGallery:Me},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){const t=e.target,m=new URL(t.src),h=m.searchParams.get("retry");if(!h)m.searchParams.set("retry","1");else if(parseInt(h)<2)m.searchParams.set("retry",(parseInt(h)+1).toString());else return;t.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),Be={class:"preview"},qe={class:"left"},Fe={class:"main"},Ne={class:"bot"},He={class:"datetime"},Je={class:"info"},Qe={key:0,class:"prompt mt-2"},We={key:0},Ke={key:1},Xe={key:0,class:S({content:!0,failed:!0})},Ye={class:"image-wrapper"},Ze={class:"description"},xe={key:0,class:"description"},es={key:1,class:S({content:!0})},ss={class:"description"},ts={class:"description"},os={key:0,class:"description"},as={class:"description"},ns={key:2,class:S({content:!0})},is={class:"description"},ls={key:3,class:S({content:!0})},rs={class:"description"};function cs(e,t,m,h,k,y){const p=n("el-image"),u=n("image-gallery"),i=n("font-awesome-icon"),c=n("copy-to-clipboard"),f=n("el-alert");return o(),l("div",Be,[r("div",qe,[s(p,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),r("div",Fe,[r("div",Ne,[g(a(e.$t("headshots.name.headshotsBot"))+" ",1),r("span",He,a(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),r("div",Je,[e.modelValue?.request?.template?(o(),l("p",Qe,[g(a(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?$("",!0):(o(),l("span",We," - ("+a(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(o(),l("span",Ke," - ("+a(e.$t("headshots.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(o(),l("div",Xe,[r("div",Ye,[s(u,{"model-value":e.modelValue},null,8,["model-value"])]),s(f,{closable:!1,class:"mt-2 success"},{default:d(()=>[r("p",Ze,[s(i,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+a(e.$t("headshots.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),e.modelValue?.elapsed?(o(),l("p",xe,[s(i,{icon:"fa-solid fa-clock",class:"mr-1"}),g(" "+a(e.$t("headshots.name.elapsed"))+": "+a(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):$("",!0)]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(o(),l("div",es,[s(f,{closable:!1,class:"failure"},{template:d(()=>[s(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+a(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",ss,[s(i,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+a(e.$t("headshots.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),r("p",ts,[s(i,{icon:"fa-solid fa-circle-info",class:"mr-1"}),g(" "+a(e.$t("headshots.name.failureReason"))+": "+a(e.modelValue?.response?.error?.message)+" ",1),s(c,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),e.modelValue?.elapsed?(o(),l("p",os,[s(i,{icon:"fa-solid fa-clock",class:"mr-1"}),g(" "+a(e.$t("headshots.name.elapsed"))+": "+a(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):$("",!0),r("p",as,[s(i,{icon:"fa-solid fa-hashtag",class:"mr-1"}),g(" "+a(e.$t("headshots.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),s(c,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?$("",!0):(o(),l("div",ns,[s(f,{closable:!1,class:"info"},{template:d(()=>[s(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+a(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",is,[s(i,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+a(e.$t("headshots.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(o(),l("div",ls,[s(f,{closable:!1,class:"info"},{template:d(()=>[s(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+a(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",rs,[s(i,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+a(e.$t("headshots.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0)])])}const ds=b(Oe,[["render",cs],["__scopeId","data-v-d286678e"]]),ps=v({name:"RecentPanel",components:{TaskPreview:ds,ElSkeleton:oe,ElSkeletonItem:te,ScrollList:F},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?.()}}}),ms={key:0,class:"tasks"},hs={class:"left"},us={class:"main"},fs={key:1,class:"tasks"},gs={key:2,class:"description"};function _s(e,t,m,h,k,y){const p=n("el-skeleton-item"),u=n("el-skeleton"),i=n("task-preview"),c=n("scroll-list");return o(),E(c,{ref:"scrollList",class:"panel recent",loading:e.loading,onReachTop:t[0]||(t[0]=f=>e.$emit("reach-top"))},{default:d(()=>[e.tasks?.items===void 0?(o(),l("div",ms,[(o(),l(I,null,T(3,f=>r("div",{key:f,class:"task placeholder"},[r("div",hs,[s(u,{animated:""},{template:d(()=>[s(p,{variant:"image",class:"avatar"})]),_:1})]),r("div",us,[s(u,{animated:""},{template:d(()=>[s(p,{variant:"p",class:"title"}),s(p,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(o(),l("div",fs,[(o(!0),l(I,null,T(e.tasks?.items,(f,_)=>(o(),E(i,{key:_,"model-value":f,class:"preview"},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(o(),l("p",gs,a(e.$t("headshots.message.noTasks")),1)):$("",!0)]),_:1},8,["loading"])}const $s=b(ps,[["render",_s],["__scopeId","data-v-ffd55c16"]]),vs=O("headshots"),bs=v({name:"HeadshotsIndex",components:{ConfigPanel:Re,Layout:ce,ApplicationStatus:x,RecentPanel:$s},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.headshots?.status?.getApplications===V.Request},tasksLoading(){return this.$store.state.headshots?.status?.getTasks===V.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===V.Request},needApply(){return this.$store.state.headshots.status.getApplications===V.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 N({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(){M.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Z&&w.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const 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);const{limit:t=5,createdAtMin:m,createdAtMax:h}=e||{};console.debug("limit",t,"createdAtMin",m,"createdAtMax",h),this.fetchingTasks=!0;try{await this.$store.dispatch("headshots/getTasks",{limit:t,createdAtMin:m,createdAtMax:h})}finally{this.fetchingTasks=!1}},async onGeneratePicture(){const e={...this.config,callback_url:vs},t=this.credential?.token;if(!t){console.error("no token specified");return}w.info(this.$t("headshots.message.startingTask")),j("headshots",z.generate(e,{token:t})).then(()=>{w.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===Y?w.error(this.$t("headshots.message.usedUp")):w.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function ks(e,t,m,h,k,y){const p=n("config-panel"),u=n("application-status"),i=n("recent-panel"),c=n("layout");return o(),E(c,null,{config:d(()=>[s(p,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:d(()=>[s(u,{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[0]=f=>e.$store.dispatch("headshots/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),s(i,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const at=b(bs,[["render",ks],["__scopeId","data-v-0af228d8"]]);export{at as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as L}from"./index.es-rfDbxZpm.js";import{E as R}from"./index-DBQvlqm3.js";import{E as O}from"./index-D-KZRZPp.js";import{d as $,H as i,E as c,z as P,C as s,y as d,D as o,q as n,F as l,O as w,N as x,x as V,Q as T,R as q,I as k,J as h}from"./vendor-vue-NSDaktjZ.js";import{G as g,bj as B,co as z,aL as N,S as A,cp as X}from"./index-DDJccgho.js";import{a as Q,b as H,c as Y,d as J,e as W,f as K}from"./pixverse-g-p4CgDy.js";import{E as I,a as C}from"./index-CJ8YZq-e.js";import{I as D,S as Z,l as ee}from"./pagination-CDk6ho1i.js";import{E as te}from"./index-BexlGeiF.js";import{E as se}from"./index-8PxRxOr7.js";import{p as oe}from"./pasteUploadMixin-BurWbGNQ.js";import{I as ae}from"./ImagePreview-D1oWKxPX.js";import{E as ne}from"./index-Db5A7UiS.js";import{E as S}from"./index-DtUQgyoo.js";import{P as le,N as ie}from"./NoTasks-COwD2YRA.js";import{C as re}from"./Consumption-u-UR3f-q.js";import{a as ce}from"./price-C2VbzPrG.js";import{b as pe}from"./errorCode-Cqj9Td_Z.js";import{C as de}from"./CopyToClipboard-D2Ga1c-u.js";import{V as ue}from"./VideoPlayer-BOBrupFS.js";import{E as me}from"./index-DK4DFfU5.js";import{E as ve}from"./index-wrqbgHKw.js";import{E as fe}from"./index-CkfWRF3i.js";import{B as _e}from"./BotPlaceholder-GbwaSlCU.js";import"./use-form-item-1C5uFRHv.js";import"./index-BuyEbX8F.js";import"./vendor-axios-B8_nURbH.js";import"./vendor-dayjs-v0j1UNZp.js";import"./vendor-vue-router-Df5ITouH.js";import"./index-DkEDXKbD.js";import"./typescript-CCF0uyn2.js";import"./index-BPk2ZoOA.js";import"./strings-beZM2Y-f.js";import"./isEqual-CC5LQv_R.js";import"./_Uint8Array-DiKiqj6b.js";import"./castArray-DbfVevQg.js";import"./index-D-SiG2bP.js";import"./index-E1-z9_FO.js";import"./debounce-B-jn60n6.js";import"./_baseIteratee-CCcx0UCd.js";import"./index-B0Cwb-D-.js";import"./index-Cu41y2Fl.js";import"./index-BjCVlRvR.js";import"./_baseClone-C7mAsPbg.js";import"./_initCloneObject-DHUwupd_.js";import"./vue-plyr-BO2nlN4c.js";import"./index-BcNn3Owf.js";const he=$({name:"LayoutPixverse",components:{ElDrawer:O,ElButton:R,FontAwesomeIcon:L},data(){return{drawer:!1}}}),$e={class:"main flex flex-row flex-1"},ge={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},be={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function ye(e,t,u,m,b,y){const r=o("font-awesome-icon"),p=o("el-button"),a=o("el-drawer");return n(),i("div",$e,[c("div",ge,[P(e.$slots,"config",{},void 0,!0)]),c("div",be,[P(e.$slots,"result",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=_=>e.drawer=!0)},{default:d(()=>[s(r,{icon:"fa-solid fa-magic"})]),_:1}),s(a,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px"},{default:d(()=>[P(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ke=g(he,[["render",ye],["__scopeId","data-v-ea5fe174"]]),Ve=$({name:"ModelSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"v3.5",label:"v3.5"},{value:"v4",label:"v4"},{value:"v4.5",label:"v4.5"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.model},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,model:e})}}},mounted(){this.value||(this.value=Q)}}),we={class:"field"},xe={class:"title font-bold"};function Se(e,t,u,m,b,y){const r=o("el-option"),p=o("el-select");return n(),i("div",we,[c("h2",xe,l(e.$t("pixverse.name.model")),1),s(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(n(!0),i(w,null,x(e.options,a=>(n(),V(r,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(Ve,[["render",Se],["__scopeId","data-v-e8f337ca"]]),Te=$({name:"QualitySelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"360p",label:"360p"},{value:"540p",label:"540p"},{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.quality},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,quality:e})}}},mounted(){this.value||(this.value=H)}}),Ie={class:"field"},Ce={class:"title font-bold"};function Le(e,t,u,m,b,y){const r=o("el-option"),p=o("el-select");return n(),i("div",Ie,[c("h2",Ce,l(e.$t("pixverse.name.quality")),1),s(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(n(!0),i(w,null,x(e.options,a=>(n(),V(r,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Re=g(Te,[["render",Le],["__scopeId","data-v-64aeaae9"]]),Ue=$({name:"MotionSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"normal",label:this.$t("pixverse.name.motion1")},{value:"fast",label:this.$t("pixverse.name.motion2")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.motion},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,motion:e})}}},mounted(){this.value||(this.value=Y)}}),Pe={class:"field"},Ae={class:"title font-bold"};function De(e,t,u,m,b,y){const r=o("el-option"),p=o("el-select");return n(),i("div",Pe,[c("h2",Ae,l(e.$t("pixverse.name.motion")),1),s(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(n(!0),i(w,null,x(e.options,a=>(n(),V(r,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ge=g(Ue,[["render",De],["__scopeId","data-v-94237408"]]),je=$({name:"StyleSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"cyberpunk",label:this.$t("pixverse.name.style1")},{value:"anime",label:this.$t("pixverse.name.style2")},{value:"comic",label:this.$t("pixverse.name.style3")},{value:"clay",label:this.$t("pixverse.name.style4")},{value:"3d_animation",label:this.$t("pixverse.name.style5")},{value:"realistic",label:this.$t("pixverse.name.style6")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.style},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,style:e})}}},mounted(){this.value||(this.value=J)}}),Me={class:"field"},Fe={class:"title font-bold"};function Oe(e,t,u,m,b,y){const r=o("el-option"),p=o("el-select");return n(),i("div",Me,[c("h2",Fe,l(e.$t("pixverse.name.style")),1),s(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(n(!0),i(w,null,x(e.options,a=>(n(),V(r,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const qe=g(je,[["render",Oe],["__scopeId","data-v-64e17b3c"]]),Be=$({name:"SeedSelector",components:{ElSlider:se,InfoIcon:D,ElInputNumber:te},computed:{value:{get(){return this.$store.state?.pixverse?.config?.seed},set(e){console.debug("set seed",e),this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,seed:e})}}},mounted(){this.value||(this.value=void 0)}}),ze={class:"flex justify-between"},Ne={class:"flex justify-start items-center"},Xe={class:"text-sm font-bold"},Qe={class:"flex justify-end items-center"},He={class:"w-full"};function Ye(e,t,u,m,b,y){const r=o("info-icon"),p=o("el-input-number"),a=o("el-slider");return n(),i("div",null,[c("div",ze,[c("div",Ne,[c("span",Xe,l(e.$t("pixverse.name.seed")),1),s(r,{content:e.$t("pixverse.description.seed")},null,8,["content"])]),c("div",Qe,[s(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=_=>e.value=_),"controls-position":"right"},null,8,["modelValue"])])]),c("div",He,[s(a,{modelValue:e.value,"onUpdate:modelValue":t[1]||(t[1]=_=>e.value=_),min:0,max:1e3,step:1},null,8,["modelValue"])])])}const Je=g(Be,[["render",Ye]]),We=$({name:"DurationSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5s"},{value:8,label:"8s"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.duration},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,duration:e})}}},mounted(){this.value||(this.value=W)}}),Ke={class:"field"},Ze={class:"title font-bold"};function et(e,t,u,m,b,y){const r=o("el-option"),p=o("el-select");return n(),i("div",Ke,[c("h2",Ze,l(e.$t("pixverse.name.duration")),1),s(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(n(!0),i(w,null,x(e.options,a=>(n(),V(r,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const tt=g(We,[["render",et],["__scopeId","data-v-065c77ef"]]),st=$({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,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.pixverse.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=K)}}),ot={class:"text-sm font-bold mb-2 block"},at={class:"items"},nt=["onClick"],lt={class:"name"};function it(e,t,u,m,b,y){return n(),i("div",null,[c("span",ot,l(e.$t("pixverse.name.aspectRatio")),1),c("div",at,[(n(!0),i(w,null,x(e.options,(r,p)=>(n(),i("div",{key:p,class:T({active:e.active===p,item:!0}),onClick:a=>e.value=r.value},[c("div",{class:T(["preview",r.label])},[c("div",{class:"rect",style:q({width:r.width+"px",height:r.height+"px"})},null,4)],2),c("p",lt,l(r.label),1)],10,nt))),128))])])}const rt=g(st,[["render",it],["__scopeId","data-v-53038264"]]),ct=$({name:"StartImage",components:{ElUpload:ne,ElButton:R,InfoIcon:D,FontAwesomeIcon:L,ImagePreview:ae},mixins:[oe],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?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){S.warning(this.$t("pixverse.message.uploadReferencesExceed"))},onError(){S.error(this.$t("pixverse.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),pt={class:"relative"},dt={class:"flex justify-between"},ut={class:"flex justify-start items-center"},mt={class:"text-sm font-bold"};function vt(e,t,u,m,b,y){const r=o("info-icon"),p=o("image-preview"),a=o("font-awesome-icon"),_=o("el-button"),f=o("el-upload");return n(),i("div",pt,[c("div",dt,[c("div",ut,[c("span",mt,l(e.$t("pixverse.name.startImage")),1),s(r,{content:e.$t("pixverse.description.uploadStartImage")},null,8,["content"])])]),s(f,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=v=>e.fileList=v),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,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:d(({file:v})=>[v.url&&v.percentage!==void 0?(n(),V(p,{key:0,url:v.url,name:v.name,percentage:v.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(v),1)},null,8,["url","name","percentage","onRemove"])):h("",!0)]),default:d(()=>[s(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:d(()=>[s(a,{icon:"fa-solid fa-upload",class:"icon mr-1"}),k(" "+l(e.$t("pixverse.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ft=g(ct,[["render",vt],["__scopeId","data-v-bc133fd2"]]),_t="",ht=$({name:"PromptInput",components:{PromptTextarea:le},computed:{prompt:{get(){return this.$store.state.pixverse?.config?.prompt},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=_t)}});function $t(e,t,u,m,b,y){const r=o("prompt-textarea");return n(),V(r,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=p=>e.prompt=p),title:e.$t("pixverse.name.prompt"),info:e.$t("pixverse.description.prompt"),placeholder:e.$t("pixverse.placeholder.prompt")},null,8,["modelValue","title","info","placeholder"])}const gt=g(ht,[["render",$t]]),bt=$({name:"ConfigPanel",components:{ElButton:R,FontAwesomeIcon:L,PromptInput:gt,ModelSelector:Ee,QualitySelector:Re,MotionSelector:Ge,StyleSelector:qe,DurationSelector:tt,StartImage:ft,SeedSelector:Je,RatioSelector:rt,Consumption:re},emits:["generate"],computed:{config(){return this.$store.state.pixverse?.config},consumption(){return ce(this.config,this.service?.cost)},service(){return this.$store.state.pixverse?.service}},methods:{onGenerate(){this.$emit("generate")}}}),yt={class:"flex flex-col h-full"},kt={class:"flex-1 overflow-y-auto p-5"},Vt={class:"flex flex-col items-center justify-center px-5 pb-5"};function wt(e,t,u,m,b,y){const r=o("prompt-input"),p=o("model-selector"),a=o("style-selector"),_=o("ratio-selector"),f=o("motion-selector"),v=o("quality-selector"),E=o("start-image"),U=o("seed-selector"),G=o("duration-selector"),j=o("consumption"),M=o("font-awesome-icon"),F=o("el-button");return n(),i("div",yt,[c("div",kt,[s(r,{class:"mb-4"}),s(p,{class:"mb-4"}),s(a,{class:"mb-4"}),s(_,{class:"mb-4"}),s(f,{class:"mb-4"}),s(v,{class:"mb-4"}),s(E,{class:"mb-2"}),s(U,{class:"mb-4"}),s(G,{class:"mb-4"})]),c("div",Vt,[s(j,{value:e.consumption,service:e.service},null,8,["value","service"]),s(F,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[s(M,{icon:"fa-solid fa-magic",class:"mr-2"}),k(" "+l(e.$t("pixverse.button.generate")),1)]),_:1},8,["onClick"])])])}const xt=g(bt,[["render",wt]]),St=$({name:"TaskPreview",components:{ElImage:fe,CopyToClipboard:de,FontAwesomeIcon:L,ElAlert:ve,VideoPlayer:ue,ElTooltip:me,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pixverse?.application},config(){return this.$store.state.pixverse?.config}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Et={class:"preview"},Tt={class:"left"},It={class:"main"},Ct={class:"bot"},Lt={class:"datetime"},Rt={class:"info"},Ut={key:0,class:"prompt mt-2"},Pt={key:0},At={key:1},Dt={key:0,class:T({content:!0,failed:!0})},Gt={key:0,class:"mb-4"},jt={key:1,class:T({operations:!0,"mt-2":!0})},Mt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},qt={key:1,class:T({content:!0})},Bt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Nt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Xt={key:1,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Qt(e,t,u,m,b,y){const r=o("el-image"),p=o("video-player"),a=o("el-button"),_=o("el-tooltip"),f=o("font-awesome-icon"),v=o("copy-to-clipboard"),E=o("el-alert");return n(),i("div",Et,[c("div",Tt,[s(r,{src:"https://cdn.acedata.cloud/viy61r.jpg",class:"avatar"})]),c("div",It,[c("div",Ct,[k(l(e.$t("pixverse.name.pixverseBot"))+" ",1),c("span",Lt,l(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",Rt,[e.modelValue?.request?.prompt?(n(),i("p",Ut,[k(l(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?h("",!0):(n(),i("span",Pt," - ("+l(e.$t("pixverse.status.pending"))+") ",1)),e.modelValue?.response?.data&&(e.modelValue?.response?.data[0]?.state==="processing"||e.modelValue?.response?.data[0]?.state==="pending")?(n(),i("span",At," - ("+l(e.$t("pixverse.status.processing"))+") ",1)):h("",!0)])):h("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),i("div",Dt,[e.modelValue?.response?.data[0]?.video_url?(n(),i("div",Gt,[s(p,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):h("",!0),e.modelValue?.response.success?(n(),i("div",jt,[s(_,{class:"box-item",effect:"dark",content:e.$t("pixverse.message.downloadVideo"),placement:"top-start"},{default:d(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),V(a,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=U=>e.onDownload(U,e.modelValue?.response?.data[0]?.video_url))},{default:d(()=>[k(l(e.$t("pixverse.button.download")),1)]),_:1})):h("",!0)]),_:1},8,["content"])])):h("",!0),s(E,{closable:!1,class:"mt-2 success"},{default:d(()=>[c("p",Mt,[s(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.model"))+": "+l(e.modelValue?.request?.model),1)]),c("p",Ft,[s(f,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),s(v,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.elapsed?(n(),i("p",Ot,[s(f,{icon:"fa-solid fa-clock",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.elapsed"))+": "+l(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):h("",!0)]),_:1})])):h("",!0),e.modelValue?.response?.success===!1?(n(),i("div",qt,[s(E,{closable:!1,class:"info"},{template:d(()=>[s(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.failure")),1)]),default:d(()=>[c("p",Bt,[s(f,{icon:"fa-solid fa-circle-info",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.failureReason"))+": "+l(e.modelValue?.response?.error?.message)+" ",1),s(v,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),c("p",zt,[s(f,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),s(v,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.elapsed?(n(),i("p",Nt,[s(f,{icon:"fa-solid fa-clock",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.elapsed"))+": "+l(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):h("",!0),e.modelValue?.response?.trace_id?(n(),i("p",Xt,[s(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.traceId"))+": "+l(e.modelValue?.response?.trace_id)+" ",1),s(v,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):h("",!0)]),_:1})])):h("",!0)])])}const Ht=g(St,[["render",Qt],["__scopeId","data-v-f98906e5"]]),Yt=$({name:"RecentPanel",components:{TaskPreview:Ht,NoTasks:ie,BotPlaceholder:_e,ScrollList:Z},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pixverse?.tasks,items:this.$store.state.pixverse?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Jt={key:0},Wt={key:2,class:"w-full h-full flex items-center justify-center"};function Kt(e,t,u,m,b,y){const r=o("bot-placeholder"),p=o("task-preview"),a=o("scroll-list"),_=o("no-tasks");return n(),i(w,null,[e.tasks?.items===void 0?(n(),i("div",Jt,[s(r)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),V(a,{key:1,ref:"scrollList",class:"h-full w-full overflow-y-auto tasks",loading:e.loading,onReachTop:t[0]||(t[0]=f=>e.$emit("reach-top"))},{default:d(()=>[(n(!0),i(w,null,x(e.tasks?.items,(f,v)=>(n(),V(p,{key:v,"model-value":f},null,8,["model-value"]))),128))]),_:1},8,["loading"])):h("",!0),e.tasks?.items?.length===0?(n(),i("div",Wt,[s(_)])):h("",!0)],64)}const Zt=g(Yt,[["render",Kt]]),es=X("pixverse"),ts=$({name:"PixverseIndex",components:{ConfigPanel:xt,Layout:ke,RecentPanel:Zt},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pixverse?.status?.getApplications===A.Request},tasksLoading(){return this.$store.state.pixverse?.status?.getTasks===A.Request||this.fetchingTasks},credential(){return this.$store.state.pixverse.credential},config(){return this.$store.state.pixverse.config},tasks(){return this.$store.state.pixverse.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 ee({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("pixverse/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pixverse/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();const 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);const{limit:t=5,createdAtMin:u,createdAtMax:m}=e||{};console.debug("limit",t,"createdAtMin",u,"createdAtMax",m),this.fetchingTasks=!0;try{await this.$store.dispatch("pixverse/getTasks",{limit:t,createdAtMin:u,createdAtMax:m})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:es},t=this.credential?.token;if(!t){console.error("no token specified");return}S.info(this.$t("pixverse.message.startingTask")),z("pixverse",N.generate(e,{token:t})).then(()=>{S.success(this.$t("pixverse.message.startTaskSuccess"))}).catch(u=>{u?.response?.data?.error?.code===pe?S.error(this.$t("pixverse.message.usedUp")):S.error(this.$t("pixverse.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function ss(e,t,u,m,b,y){const r=o("config-panel"),p=o("recent-panel"),a=o("layout");return n(),V(a,null,{config:d(()=>[s(r,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:d(()=>[s(p,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Js=g(ts,[["render",ss]]);export{Js as default};
|
|
1
|
+
import{F as L}from"./index.es-D5toi_yB.js";import{E as R}from"./index-mTDdtUSQ.js";import{E as O}from"./index-DU5biqWK.js";import{d as $,H as i,E as c,z as P,C as s,y as d,D as o,q as n,F as l,O as w,N as x,x as V,Q as T,R as q,I as k,J as h}from"./vendor-vue-NSDaktjZ.js";import{G as g,bj as B,co as z,aL as N,S as A,cp as X}from"./index-CCfnxGYg.js";import{a as Q,b as H,c as Y,d as J,e as W,f as K}from"./pixverse-g-p4CgDy.js";import{E as I,a as C}from"./index-B1msaBme.js";import{I as D,S as Z,l as ee}from"./pagination-BO6RV-kc.js";import{E as te}from"./index-BfSiZO1Q.js";import{E as se}from"./index-6RhQMvFk.js";import{p as oe}from"./pasteUploadMixin-BurWbGNQ.js";import{I as ae}from"./ImagePreview-C4OiWDg9.js";import{E as ne}from"./index-BwEtWche.js";import{E as S}from"./index-CoYnpgkX.js";import{P as le,N as ie}from"./NoTasks-Dpcud_u4.js";import{C as re}from"./Consumption-DVkwcyaB.js";import{a as ce}from"./price-DPkoP0YP.js";import{b as pe}from"./errorCode-Cqj9Td_Z.js";import{C as de}from"./CopyToClipboard-UnYO6hAq.js";import{V as ue}from"./VideoPlayer-B-GlKJVH.js";import{E as me}from"./index-DM6P3x3N.js";import{E as ve}from"./index-oRUvw3Ui.js";import{E as fe}from"./index-B1DLX4Fc.js";import{B as _e}from"./BotPlaceholder-Dy1gr-9h.js";import"./use-form-item-BdyDMPU-.js";import"./index-BuyEbX8F.js";import"./vendor-axios-B8_nURbH.js";import"./vendor-dayjs-v0j1UNZp.js";import"./vendor-vue-router-Df5ITouH.js";import"./index-Dwk0fHJ3.js";import"./typescript-DYVOpHug.js";import"./index-BHtuVUFl.js";import"./strings-beZM2Y-f.js";import"./isEqual-1RENOQre.js";import"./_Uint8Array-Dhv101dV.js";import"./castArray-DD0p5-P9.js";import"./index-B5vjdbxo.js";import"./index-BbjLkNT5.js";import"./debounce-CQuM7WhN.js";import"./_baseIteratee-URGnejHV.js";import"./index-3c5oSDnc.js";import"./index-Cu41y2Fl.js";import"./index-CpWcFmdT.js";import"./_baseClone-D4Hl6Ymo.js";import"./_initCloneObject-QV4IIV31.js";import"./vue-plyr-BO2nlN4c.js";import"./index-1diQ6JT1.js";const he=$({name:"LayoutPixverse",components:{ElDrawer:O,ElButton:R,FontAwesomeIcon:L},data(){return{drawer:!1}}}),$e={class:"main flex flex-row flex-1"},ge={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},be={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function ye(e,t,u,m,b,y){const r=o("font-awesome-icon"),p=o("el-button"),a=o("el-drawer");return n(),i("div",$e,[c("div",ge,[P(e.$slots,"config",{},void 0,!0)]),c("div",be,[P(e.$slots,"result",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=_=>e.drawer=!0)},{default:d(()=>[s(r,{icon:"fa-solid fa-magic"})]),_:1}),s(a,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px"},{default:d(()=>[P(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ke=g(he,[["render",ye],["__scopeId","data-v-ea5fe174"]]),Ve=$({name:"ModelSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"v3.5",label:"v3.5"},{value:"v4",label:"v4"},{value:"v4.5",label:"v4.5"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.model},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,model:e})}}},mounted(){this.value||(this.value=Q)}}),we={class:"field"},xe={class:"title font-bold"};function Se(e,t,u,m,b,y){const r=o("el-option"),p=o("el-select");return n(),i("div",we,[c("h2",xe,l(e.$t("pixverse.name.model")),1),s(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(n(!0),i(w,null,x(e.options,a=>(n(),V(r,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(Ve,[["render",Se],["__scopeId","data-v-e8f337ca"]]),Te=$({name:"QualitySelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"360p",label:"360p"},{value:"540p",label:"540p"},{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.quality},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,quality:e})}}},mounted(){this.value||(this.value=H)}}),Ie={class:"field"},Ce={class:"title font-bold"};function Le(e,t,u,m,b,y){const r=o("el-option"),p=o("el-select");return n(),i("div",Ie,[c("h2",Ce,l(e.$t("pixverse.name.quality")),1),s(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(n(!0),i(w,null,x(e.options,a=>(n(),V(r,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Re=g(Te,[["render",Le],["__scopeId","data-v-64aeaae9"]]),Ue=$({name:"MotionSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"normal",label:this.$t("pixverse.name.motion1")},{value:"fast",label:this.$t("pixverse.name.motion2")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.motion},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,motion:e})}}},mounted(){this.value||(this.value=Y)}}),Pe={class:"field"},Ae={class:"title font-bold"};function De(e,t,u,m,b,y){const r=o("el-option"),p=o("el-select");return n(),i("div",Pe,[c("h2",Ae,l(e.$t("pixverse.name.motion")),1),s(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(n(!0),i(w,null,x(e.options,a=>(n(),V(r,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ge=g(Ue,[["render",De],["__scopeId","data-v-94237408"]]),je=$({name:"StyleSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"cyberpunk",label:this.$t("pixverse.name.style1")},{value:"anime",label:this.$t("pixverse.name.style2")},{value:"comic",label:this.$t("pixverse.name.style3")},{value:"clay",label:this.$t("pixverse.name.style4")},{value:"3d_animation",label:this.$t("pixverse.name.style5")},{value:"realistic",label:this.$t("pixverse.name.style6")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.style},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,style:e})}}},mounted(){this.value||(this.value=J)}}),Me={class:"field"},Fe={class:"title font-bold"};function Oe(e,t,u,m,b,y){const r=o("el-option"),p=o("el-select");return n(),i("div",Me,[c("h2",Fe,l(e.$t("pixverse.name.style")),1),s(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(n(!0),i(w,null,x(e.options,a=>(n(),V(r,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const qe=g(je,[["render",Oe],["__scopeId","data-v-64e17b3c"]]),Be=$({name:"SeedSelector",components:{ElSlider:se,InfoIcon:D,ElInputNumber:te},computed:{value:{get(){return this.$store.state?.pixverse?.config?.seed},set(e){console.debug("set seed",e),this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,seed:e})}}},mounted(){this.value||(this.value=void 0)}}),ze={class:"flex justify-between"},Ne={class:"flex justify-start items-center"},Xe={class:"text-sm font-bold"},Qe={class:"flex justify-end items-center"},He={class:"w-full"};function Ye(e,t,u,m,b,y){const r=o("info-icon"),p=o("el-input-number"),a=o("el-slider");return n(),i("div",null,[c("div",ze,[c("div",Ne,[c("span",Xe,l(e.$t("pixverse.name.seed")),1),s(r,{content:e.$t("pixverse.description.seed")},null,8,["content"])]),c("div",Qe,[s(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=_=>e.value=_),"controls-position":"right"},null,8,["modelValue"])])]),c("div",He,[s(a,{modelValue:e.value,"onUpdate:modelValue":t[1]||(t[1]=_=>e.value=_),min:0,max:1e3,step:1},null,8,["modelValue"])])])}const Je=g(Be,[["render",Ye]]),We=$({name:"DurationSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5s"},{value:8,label:"8s"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.duration},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,duration:e})}}},mounted(){this.value||(this.value=W)}}),Ke={class:"field"},Ze={class:"title font-bold"};function et(e,t,u,m,b,y){const r=o("el-option"),p=o("el-select");return n(),i("div",Ke,[c("h2",Ze,l(e.$t("pixverse.name.duration")),1),s(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(n(!0),i(w,null,x(e.options,a=>(n(),V(r,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const tt=g(We,[["render",et],["__scopeId","data-v-065c77ef"]]),st=$({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,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.pixverse.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=K)}}),ot={class:"text-sm font-bold mb-2 block"},at={class:"items"},nt=["onClick"],lt={class:"name"};function it(e,t,u,m,b,y){return n(),i("div",null,[c("span",ot,l(e.$t("pixverse.name.aspectRatio")),1),c("div",at,[(n(!0),i(w,null,x(e.options,(r,p)=>(n(),i("div",{key:p,class:T({active:e.active===p,item:!0}),onClick:a=>e.value=r.value},[c("div",{class:T(["preview",r.label])},[c("div",{class:"rect",style:q({width:r.width+"px",height:r.height+"px"})},null,4)],2),c("p",lt,l(r.label),1)],10,nt))),128))])])}const rt=g(st,[["render",it],["__scopeId","data-v-53038264"]]),ct=$({name:"StartImage",components:{ElUpload:ne,ElButton:R,InfoIcon:D,FontAwesomeIcon:L,ImagePreview:ae},mixins:[oe],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?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){S.warning(this.$t("pixverse.message.uploadReferencesExceed"))},onError(){S.error(this.$t("pixverse.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),pt={class:"relative"},dt={class:"flex justify-between"},ut={class:"flex justify-start items-center"},mt={class:"text-sm font-bold"};function vt(e,t,u,m,b,y){const r=o("info-icon"),p=o("image-preview"),a=o("font-awesome-icon"),_=o("el-button"),f=o("el-upload");return n(),i("div",pt,[c("div",dt,[c("div",ut,[c("span",mt,l(e.$t("pixverse.name.startImage")),1),s(r,{content:e.$t("pixverse.description.uploadStartImage")},null,8,["content"])])]),s(f,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=v=>e.fileList=v),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,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:d(({file:v})=>[v.url&&v.percentage!==void 0?(n(),V(p,{key:0,url:v.url,name:v.name,percentage:v.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(v),1)},null,8,["url","name","percentage","onRemove"])):h("",!0)]),default:d(()=>[s(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:d(()=>[s(a,{icon:"fa-solid fa-upload",class:"icon mr-1"}),k(" "+l(e.$t("pixverse.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ft=g(ct,[["render",vt],["__scopeId","data-v-bc133fd2"]]),_t="",ht=$({name:"PromptInput",components:{PromptTextarea:le},computed:{prompt:{get(){return this.$store.state.pixverse?.config?.prompt},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=_t)}});function $t(e,t,u,m,b,y){const r=o("prompt-textarea");return n(),V(r,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=p=>e.prompt=p),title:e.$t("pixverse.name.prompt"),info:e.$t("pixverse.description.prompt"),placeholder:e.$t("pixverse.placeholder.prompt")},null,8,["modelValue","title","info","placeholder"])}const gt=g(ht,[["render",$t]]),bt=$({name:"ConfigPanel",components:{ElButton:R,FontAwesomeIcon:L,PromptInput:gt,ModelSelector:Ee,QualitySelector:Re,MotionSelector:Ge,StyleSelector:qe,DurationSelector:tt,StartImage:ft,SeedSelector:Je,RatioSelector:rt,Consumption:re},emits:["generate"],computed:{config(){return this.$store.state.pixverse?.config},consumption(){return ce(this.config,this.service?.cost)},service(){return this.$store.state.pixverse?.service}},methods:{onGenerate(){this.$emit("generate")}}}),yt={class:"flex flex-col h-full"},kt={class:"flex-1 overflow-y-auto p-5"},Vt={class:"flex flex-col items-center justify-center px-5 pb-5"};function wt(e,t,u,m,b,y){const r=o("prompt-input"),p=o("model-selector"),a=o("style-selector"),_=o("ratio-selector"),f=o("motion-selector"),v=o("quality-selector"),E=o("start-image"),U=o("seed-selector"),G=o("duration-selector"),j=o("consumption"),M=o("font-awesome-icon"),F=o("el-button");return n(),i("div",yt,[c("div",kt,[s(r,{class:"mb-4"}),s(p,{class:"mb-4"}),s(a,{class:"mb-4"}),s(_,{class:"mb-4"}),s(f,{class:"mb-4"}),s(v,{class:"mb-4"}),s(E,{class:"mb-2"}),s(U,{class:"mb-4"}),s(G,{class:"mb-4"})]),c("div",Vt,[s(j,{value:e.consumption,service:e.service},null,8,["value","service"]),s(F,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[s(M,{icon:"fa-solid fa-magic",class:"mr-2"}),k(" "+l(e.$t("pixverse.button.generate")),1)]),_:1},8,["onClick"])])])}const xt=g(bt,[["render",wt]]),St=$({name:"TaskPreview",components:{ElImage:fe,CopyToClipboard:de,FontAwesomeIcon:L,ElAlert:ve,VideoPlayer:ue,ElTooltip:me,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pixverse?.application},config(){return this.$store.state.pixverse?.config}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Et={class:"preview"},Tt={class:"left"},It={class:"main"},Ct={class:"bot"},Lt={class:"datetime"},Rt={class:"info"},Ut={key:0,class:"prompt mt-2"},Pt={key:0},At={key:1},Dt={key:0,class:T({content:!0,failed:!0})},Gt={key:0,class:"mb-4"},jt={key:1,class:T({operations:!0,"mt-2":!0})},Mt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},qt={key:1,class:T({content:!0})},Bt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Nt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Xt={key:1,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Qt(e,t,u,m,b,y){const r=o("el-image"),p=o("video-player"),a=o("el-button"),_=o("el-tooltip"),f=o("font-awesome-icon"),v=o("copy-to-clipboard"),E=o("el-alert");return n(),i("div",Et,[c("div",Tt,[s(r,{src:"https://cdn.acedata.cloud/viy61r.jpg",class:"avatar"})]),c("div",It,[c("div",Ct,[k(l(e.$t("pixverse.name.pixverseBot"))+" ",1),c("span",Lt,l(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",Rt,[e.modelValue?.request?.prompt?(n(),i("p",Ut,[k(l(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?h("",!0):(n(),i("span",Pt," - ("+l(e.$t("pixverse.status.pending"))+") ",1)),e.modelValue?.response?.data&&(e.modelValue?.response?.data[0]?.state==="processing"||e.modelValue?.response?.data[0]?.state==="pending")?(n(),i("span",At," - ("+l(e.$t("pixverse.status.processing"))+") ",1)):h("",!0)])):h("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),i("div",Dt,[e.modelValue?.response?.data[0]?.video_url?(n(),i("div",Gt,[s(p,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):h("",!0),e.modelValue?.response.success?(n(),i("div",jt,[s(_,{class:"box-item",effect:"dark",content:e.$t("pixverse.message.downloadVideo"),placement:"top-start"},{default:d(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),V(a,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=U=>e.onDownload(U,e.modelValue?.response?.data[0]?.video_url))},{default:d(()=>[k(l(e.$t("pixverse.button.download")),1)]),_:1})):h("",!0)]),_:1},8,["content"])])):h("",!0),s(E,{closable:!1,class:"mt-2 success"},{default:d(()=>[c("p",Mt,[s(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.model"))+": "+l(e.modelValue?.request?.model),1)]),c("p",Ft,[s(f,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),s(v,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.elapsed?(n(),i("p",Ot,[s(f,{icon:"fa-solid fa-clock",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.elapsed"))+": "+l(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):h("",!0)]),_:1})])):h("",!0),e.modelValue?.response?.success===!1?(n(),i("div",qt,[s(E,{closable:!1,class:"info"},{template:d(()=>[s(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.failure")),1)]),default:d(()=>[c("p",Bt,[s(f,{icon:"fa-solid fa-circle-info",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.failureReason"))+": "+l(e.modelValue?.response?.error?.message)+" ",1),s(v,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),c("p",zt,[s(f,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),s(v,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.elapsed?(n(),i("p",Nt,[s(f,{icon:"fa-solid fa-clock",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.elapsed"))+": "+l(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):h("",!0),e.modelValue?.response?.trace_id?(n(),i("p",Xt,[s(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+l(e.$t("pixverse.name.traceId"))+": "+l(e.modelValue?.response?.trace_id)+" ",1),s(v,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):h("",!0)]),_:1})])):h("",!0)])])}const Ht=g(St,[["render",Qt],["__scopeId","data-v-f98906e5"]]),Yt=$({name:"RecentPanel",components:{TaskPreview:Ht,NoTasks:ie,BotPlaceholder:_e,ScrollList:Z},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pixverse?.tasks,items:this.$store.state.pixverse?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Jt={key:0},Wt={key:2,class:"w-full h-full flex items-center justify-center"};function Kt(e,t,u,m,b,y){const r=o("bot-placeholder"),p=o("task-preview"),a=o("scroll-list"),_=o("no-tasks");return n(),i(w,null,[e.tasks?.items===void 0?(n(),i("div",Jt,[s(r)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),V(a,{key:1,ref:"scrollList",class:"h-full w-full overflow-y-auto tasks",loading:e.loading,onReachTop:t[0]||(t[0]=f=>e.$emit("reach-top"))},{default:d(()=>[(n(!0),i(w,null,x(e.tasks?.items,(f,v)=>(n(),V(p,{key:v,"model-value":f},null,8,["model-value"]))),128))]),_:1},8,["loading"])):h("",!0),e.tasks?.items?.length===0?(n(),i("div",Wt,[s(_)])):h("",!0)],64)}const Zt=g(Yt,[["render",Kt]]),es=X("pixverse"),ts=$({name:"PixverseIndex",components:{ConfigPanel:xt,Layout:ke,RecentPanel:Zt},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pixverse?.status?.getApplications===A.Request},tasksLoading(){return this.$store.state.pixverse?.status?.getTasks===A.Request||this.fetchingTasks},credential(){return this.$store.state.pixverse.credential},config(){return this.$store.state.pixverse.config},tasks(){return this.$store.state.pixverse.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 ee({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("pixverse/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pixverse/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();const 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);const{limit:t=5,createdAtMin:u,createdAtMax:m}=e||{};console.debug("limit",t,"createdAtMin",u,"createdAtMax",m),this.fetchingTasks=!0;try{await this.$store.dispatch("pixverse/getTasks",{limit:t,createdAtMin:u,createdAtMax:m})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:es},t=this.credential?.token;if(!t){console.error("no token specified");return}S.info(this.$t("pixverse.message.startingTask")),z("pixverse",N.generate(e,{token:t})).then(()=>{S.success(this.$t("pixverse.message.startTaskSuccess"))}).catch(u=>{u?.response?.data?.error?.code===pe?S.error(this.$t("pixverse.message.usedUp")):S.error(this.$t("pixverse.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function ss(e,t,u,m,b,y){const r=o("config-panel"),p=o("recent-panel"),a=o("layout");return n(),V(a,null,{config:d(()=>[s(r,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:d(()=>[s(p,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Js=g(ts,[["render",ss]]);export{Js as default};
|