@acedatacloud/nexior 3.349.1 → 3.349.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/dist/assets/{ApiCodeButton-DQfIqta7.js → ApiCodeButton-Ck-LkZnA.js} +1 -1
  2. package/dist/assets/{Artifacts-kWL9Riji.js → Artifacts-BgIY0V5w.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-F6QltHc7.js → AskUserQuestionCard-BHIzmvpA.js} +1 -1
  4. package/dist/assets/{AudioPreview-64v3DHym.js → AudioPreview-B-vGM5ZE.js} +1 -1
  5. package/dist/assets/{Auth-D6M98il0.js → Auth-BSB5j2IR.js} +1 -1
  6. package/dist/assets/{Bare-lk4XPATw.js → Bare-CGpzlaiP.js} +1 -1
  7. package/dist/assets/{BotPlaceholder-DUy5q_lY.js → BotPlaceholder-SAI3U7Vk.js} +1 -1
  8. package/dist/assets/{BottomFooter-Djj35Gv6.js → BottomFooter-BPu8gJnO.js} +1 -1
  9. package/dist/assets/{Callback-CUicfzzX.js → Callback-DI7I7e9o.js} +1 -1
  10. package/dist/assets/{CodeSnippet-C6IMRLP5.js → CodeSnippet-nfL3VN6b.js} +1 -1
  11. package/dist/assets/{Console-tm3KZ31s.js → Console-C1p-WtRP.js} +1 -1
  12. package/dist/assets/{Consumption-Bwtr-oKm.js → Consumption-JN0X0f8c.js} +1 -1
  13. package/dist/assets/{Conversation-BR2OsN-v.js → Conversation-C2YzpBK3.js} +1 -1
  14. package/dist/assets/{Conversation-Cx2puCv5.js → Conversation-C348UZiO.js} +1 -1
  15. package/dist/assets/{CopyToClipboard-BC8MgUTU.js → CopyToClipboard-DOx2-KTG.js} +1 -1
  16. package/dist/assets/{Detail-BT1KV9_K.js → Detail-MUwXxjGI.js} +2 -2
  17. package/dist/assets/{Extra-BrfHDlNl.js → Extra-DefQxg0y.js} +1 -1
  18. package/dist/assets/{FilePreview-BsvcYriG.js → FilePreview-CibPHhpy.js} +1 -1
  19. package/dist/assets/{Hailuo-CXcL-krx.js → Hailuo-CE5R8cCt.js} +1 -1
  20. package/dist/assets/{History-BZjDOAbi.js → History-CQt5uXkC.js} +1 -1
  21. package/dist/assets/{ImagePreview-COWWmcN6.js → ImagePreview-CSSReHgL.js} +1 -1
  22. package/dist/assets/{ImageWrapper-Cm2rWx3d.js → ImageWrapper-DkF7PVGL.js} +1 -1
  23. package/dist/assets/{Index-Cw5emgdO.js → Index-B5TInMYN.js} +1 -1
  24. package/dist/assets/{Index-wIABtMV9.js → Index-B7vEEPhg.js} +1 -1
  25. package/dist/assets/{Index-BjNd8nJ_2.js → Index-BDnHLDfB2.js} +1 -1
  26. package/dist/assets/{Index-B3NFE_m2.js → Index-BIEqYgeq.js} +1 -1
  27. package/dist/assets/{Index-D_m4uHK92.js → Index-B_o8lp612.js} +1 -1
  28. package/dist/assets/{Index-CqskEb2x.js → Index-BmXYmlZt.js} +1 -1
  29. package/dist/assets/{Index-DT_HG8rV.js → Index-Bo9HAK0V.js} +1 -1
  30. package/dist/assets/{Index-Y5988nG3.js → Index-BxkXq-kP.js} +1 -1
  31. package/dist/assets/{Index-D2B6uJ-h.js → Index-ByI27Xqj.js} +1 -1
  32. package/dist/assets/{Index-jM4hJZCH.js → Index-C82TTXNf.js} +1 -1
  33. package/dist/assets/{Index-Bsr0Y0-7.js → Index-CBRHBLT-.js} +1 -1
  34. package/dist/assets/{Index-D6YsyB-8.js → Index-CCfbH63M.js} +1 -1
  35. package/dist/assets/{Index-DyI3f68Y.js → Index-CETeiJqR.js} +1 -1
  36. package/dist/assets/{Index-CM_dFqwv.js → Index-Cg-dC_Jb.js} +1 -1
  37. package/dist/assets/{Index-BKixWAdW.js → Index-Cr4TQ-xE.js} +1 -1
  38. package/dist/assets/{Index-CGMLyKiA.js → Index-DDUzpZ0O.js} +1 -1
  39. package/dist/assets/{Index-CDrAXXyt.js → Index-DNo4I4BL.js} +1 -1
  40. package/dist/assets/{Index-Dxfy1h192.js → Index-DYteu8It2.js} +1 -1
  41. package/dist/assets/{Index-a6RmlG1c.js → Index-DZx0iwsI.js} +1 -1
  42. package/dist/assets/{Index-lHrMgoRp.js → Index-DaXmhISA.js} +1 -1
  43. package/dist/assets/{Index-CCTvgJ6F.js → Index-DfVd1UkS.js} +1 -1
  44. package/dist/assets/{Index-WHvyEe86.js → Index-Do3syugm.js} +1 -1
  45. package/dist/assets/{Index-RIz17uAA.js → Index-DpbjqT2k.js} +1 -1
  46. package/dist/assets/{Index-CPCPDvtj.js → Index-DxD497tW.js} +1 -1
  47. package/dist/assets/{Index-pP7LKfCF.js → Index-FNMBrHbM.js} +1 -1
  48. package/dist/assets/{Index-B2mhxxRK.js → Index-FQ4q5-hl.js} +1 -1
  49. package/dist/assets/{Index-ROnaQL-D.js → Index-G-IlVG_I.js} +1 -1
  50. package/dist/assets/{Index-Bl91_uC82.js → Index-NTeyVOvk2.js} +1 -1
  51. package/dist/assets/{Index-BjOkqHzx.js → Index-i5okuoPn.js} +1 -1
  52. package/dist/assets/{Index-DoNGPVE6.js → Index-iKaft8ke.js} +1 -1
  53. package/dist/assets/{Index-DTLbeAxS.js → Index-q8_pYIR6.js} +1 -1
  54. package/dist/assets/{Index-9Ay0leMc.js → Index-wD6dVDos.js} +1 -1
  55. package/dist/assets/{Invitees-BILT3z2_.js → Invitees-DS4bwsvn.js} +1 -1
  56. package/dist/assets/{List-npLXSfbK.js → List-Bpu2Pidt.js} +1 -1
  57. package/dist/assets/{List-C3nDlEjr.js → List-C9Z8Wip0.js} +1 -1
  58. package/dist/assets/{List-B2Ch3yc5.js → List-DAeJuNL1.js} +1 -1
  59. package/dist/assets/{LocalTools-C3A7PNEU.js → LocalTools-CDaNo5_1.js} +1 -1
  60. package/dist/assets/{LocalTools-8kExdDm8.js → LocalTools-CHjjKZLq.js} +1 -1
  61. package/dist/assets/{Logo-BQHbeQsM.js → Logo-DdeUQOfD.js} +1 -1
  62. package/dist/assets/{Main-BdJ6YdEi.js → Main-DwWx37vb.js} +1 -1
  63. package/dist/assets/{Message-DtsaQttD.js → Message-HtQyFDWX.js} +1 -1
  64. package/dist/assets/{Model-K5ShzHzz.js → Model-BVtu2MqI.js} +1 -1
  65. package/dist/assets/{Navigator-Bv_MscZu.js → Navigator-D4znkCq3.js} +3 -3
  66. package/dist/assets/{NotFound-CuZnXKE2.js → NotFound-DUFo-kbQ.js} +1 -1
  67. package/dist/assets/{Pay-CgY8eRaL.js → Pay-BGp7Pc6d.js} +1 -1
  68. package/dist/assets/{Player-C0lraAbb.js → Player-DPDc2wPX.js} +1 -1
  69. package/dist/assets/{Poivelle-dw68Js7k.js → Poivelle-DYy7nBfz.js} +1 -1
  70. package/dist/assets/{PromptTextarea-DIx8KWwe.js → PromptTextarea-O8KxwMGn.js} +1 -1
  71. package/dist/assets/{RealtimeCall-CQB14u7k.js → RealtimeCall-BamozLji.js} +1 -1
  72. package/dist/assets/{ScheduledTasks-zGZ0ySiy.js → ScheduledTasks-DawIJs2a.js} +1 -1
  73. package/dist/assets/{Status-D-sl3ntz.js → Status-DIFSbgzO.js} +1 -1
  74. package/dist/assets/{Subscribe-DhdmXmRy.js → Subscribe-DBMALSdv.js} +1 -1
  75. package/dist/assets/{TabSwitcher-p-qcmsep.js → TabSwitcher-BtIo_WJk.js} +1 -1
  76. package/dist/assets/{Tts-DpGGF8dP.js → Tts-BFhwi7Nm.js} +1 -1
  77. package/dist/assets/{VideoPlayer-CYq2VZJJ.js → VideoPlayer-BnwIjt1E.js} +1 -1
  78. package/dist/assets/{alert-DIqm-Kad.js → alert-G37GiXIg.js} +1 -1
  79. package/dist/assets/arrow-down-B47oLEZg.js +1 -0
  80. package/dist/assets/{arrow-down-wide-narrow-sZbuga-c.js → arrow-down-wide-narrow-Bw3-m9uw.js} +1 -1
  81. package/dist/assets/arrow-left-xCa4y53k.js +1 -0
  82. package/dist/assets/arrow-right-ZB-S5Hdw.js +1 -0
  83. package/dist/assets/arrow-up-BeYMyDMK.js +1 -0
  84. package/dist/assets/{avatar-C1vjMCSH.js → avatar-BsiZaXKt.js} +1 -1
  85. package/dist/assets/{basic-Cc41Fhmw.js → basic-CUD9ixpS.js} +1 -1
  86. package/dist/assets/{book-open-BbaTABUc.js → book-open-VOA-qRz-.js} +1 -1
  87. package/dist/assets/{box-DzrSsXb8.js → box-BTYdpeSs.js} +1 -1
  88. package/dist/assets/{boxes-CbI3ri12.js → boxes-wDC71gk_.js} +1 -1
  89. package/dist/assets/{brain-yOHAoTDj.js → brain-CVKUI3Ty.js} +1 -1
  90. package/dist/assets/{chart-no-axes-combined-FKmtdBaZ.js → chart-no-axes-combined-Css_xsI4.js} +1 -1
  91. package/dist/assets/{chat-DWuPz9vw.js → chat-Cluz0DyK.js} +1 -1
  92. package/dist/assets/check-D47LmiyR.js +1 -0
  93. package/dist/assets/chevron-down-BumkMWkr.js +1 -0
  94. package/dist/assets/chevron-right-DJAkv6gb.js +1 -0
  95. package/dist/assets/circle-check-D5h_jiB2.js +1 -0
  96. package/dist/assets/{circle-question-mark-DE0O8vxY.js → circle-question-mark-PRKtc95j.js} +1 -1
  97. package/dist/assets/{clipboard-list-Rsq5M2Nz.js → clipboard-list-DS2oQz8T.js} +1 -1
  98. package/dist/assets/clock-BbOTrjoQ.js +1 -0
  99. package/dist/assets/code-DIu2zrn0.js +1 -0
  100. package/dist/assets/{codingBridge-B10viDZh.js → codingBridge-Bfu7FDAD.js} +1 -1
  101. package/dist/assets/{codingBridgeNotify-BNlDtT0c.js → codingBridgeNotify--CrnyiFc.js} +2 -2
  102. package/dist/assets/{coins-MP0mZyiq.js → coins-CbJVFUNa.js} +1 -1
  103. package/dist/assets/{collapse-0Kxpo1XO.js → collapse-D-Az5Y1x.js} +1 -1
  104. package/dist/assets/{copy-BuBuMUSy.js → copy-BV2l4S4i.js} +1 -1
  105. package/dist/assets/{createTaskActions-HLn9rRlN.js → createTaskActions-Dc-9CHrk.js} +1 -1
  106. package/dist/assets/{digitalhuman-B88DD4iR.js → digitalhuman-Dz67yLQj.js} +1 -1
  107. package/dist/assets/{dollar-sign-atK6VBbL.js → dollar-sign-C1g65vkD.js} +1 -1
  108. package/dist/assets/{download-BfG9EpAP.js → download-DH4XAzhp.js} +1 -1
  109. package/dist/assets/{drawer-DcAaZIVn.js → drawer-BF8tPGkj.js} +1 -1
  110. package/dist/assets/{dropdown-CsUCrZAZ.js → dropdown-BPFUku-f.js} +1 -1
  111. package/dist/assets/{dropdown-BK55ixdu.js → dropdown-Dxiw3zEy.js} +1 -1
  112. package/dist/assets/{ellipsis-In1Yb9VJ.js → ellipsis-Dne0PaxK.js} +1 -1
  113. package/dist/assets/{esm-CS65Xs2R.js → esm-BLmcHm-_.js} +1 -1
  114. package/dist/assets/{esm-Br7a3VFs.js → esm-D2EUd9-p.js} +2 -2
  115. package/dist/assets/{esm-C06KdT5r.js → esm-D3RGWycH.js} +1 -1
  116. package/dist/assets/{esm-CJSkUzDW.js → esm-D48kK9Ia.js} +3 -3
  117. package/dist/assets/{esm-JkKD4-F_.js → esm-DcMLRHGU.js} +1 -1
  118. package/dist/assets/{esm-D4oWOswP.js → esm-VF3xOK5d.js} +2 -2
  119. package/dist/assets/esm-VeU-Svd3.js +1 -0
  120. package/dist/assets/{external-link-BEIhmD26.js → external-link-Y1fuqa_d.js} +1 -1
  121. package/dist/assets/{eye-C1bTVOBo.js → eye-uumNqt6F.js} +1 -1
  122. package/dist/assets/{file-DD9Lna7S.js → file-B6BY8JCh.js} +1 -1
  123. package/dist/assets/{file-output-bhQpbo5l.js → file-output-BRGppmHm.js} +1 -1
  124. package/dist/assets/{file-text-BN1gU3ZM.js → file-text-BD_ZgyAJ.js} +1 -1
  125. package/dist/assets/{fish-Dpe8gRq6.js → fish-D0SCi3ei.js} +1 -1
  126. package/dist/assets/{flux-BuA3BIs0.js → flux-QvdaqKdp.js} +1 -1
  127. package/dist/assets/{folder-rv9DxoE4.js → folder-D8OqMpU-.js} +1 -1
  128. package/dist/assets/gauge-kqBdc9W1.js +1 -0
  129. package/dist/assets/{globe-PJ9sTZNb.js → globe-DogeYs6l.js} +1 -1
  130. package/dist/assets/{grokvideo-fqvMBEh2.js → grokvideo-DyWrWpO4.js} +1 -1
  131. package/dist/assets/{hailuo-BOh0rePI.js → hailuo-m02yWO8T.js} +1 -1
  132. package/dist/assets/{headphones-CR_6T7Wm.js → headphones-B24PnKmj.js} +1 -1
  133. package/dist/assets/{history-ba0-pw0K.js → history-hh_iVs0t.js} +1 -1
  134. package/dist/assets/{house-BnLmSfxc.js → house-DMuPgP0K.js} +1 -1
  135. package/dist/assets/{image-B13GFkdr.js → image-4hDRDwRY.js} +1 -1
  136. package/dist/assets/{index-S2D3KxIN.js → index-dzU0SACS.js} +3 -3
  137. package/dist/assets/{index.browser.esm-9DXoovs-.js → index.browser.esm-DEBg8Czw.js} +1 -1
  138. package/dist/assets/{index.es-CR3OWAv9.js → index.es-B_JRhb1z.js} +1 -1
  139. package/dist/assets/{info-B5kD0bjW.js → info-C7eq8W70.js} +1 -1
  140. package/dist/assets/{input-number-bfnLLHoF.js → input-number-DwjoHB_t.js} +1 -1
  141. package/dist/assets/{key-round-Cu7RQ2TD.js → key-round-CbX1QjS3.js} +1 -1
  142. package/dist/assets/{kling-2hKUY8Vt.js → kling-Uz16T18I.js} +1 -1
  143. package/dist/assets/{languages-DyqDD_jY.js → languages-kMgQhORN.js} +1 -1
  144. package/dist/assets/{laptop-CkBPu-wQ.js → laptop--KTFz907.js} +1 -1
  145. package/dist/assets/{lightbulb-Bt0-3_2v.js → lightbulb-Btwo92TP.js} +1 -1
  146. package/dist/assets/{link-B2fUiu3P.js → link-BHUi4UzQ.js} +1 -1
  147. package/dist/assets/loader-circle-Chlmw50N.js +1 -0
  148. package/dist/assets/{lock-BN9HCeSw.js → lock-HFF7LqQ6.js} +1 -1
  149. package/dist/assets/{luma-DfCvm1--.js → luma-B8gBcwfK.js} +1 -1
  150. package/dist/assets/{maestro-Dwk7RTTU.js → maestro-DtHatUjf.js} +1 -1
  151. package/dist/assets/{mail-rIZF6fYg.js → mail-Cf8LFguX.js} +1 -1
  152. package/dist/assets/{message-circle-BwF7ok3T.js → message-circle-75uDV2HU.js} +1 -1
  153. package/dist/assets/{mic-hCKzZgRm.js → mic-U9HFofCv.js} +1 -1
  154. package/dist/assets/{midjourney-D9afYoFk.js → midjourney-DLsZDLHN.js} +1 -1
  155. package/dist/assets/{mobileLocalExec-B5JnmUhl.js → mobileLocalExec-Jy6peL1O.js} +2 -2
  156. package/dist/assets/{monitor-DwUIFVs4.js → monitor-CaLaxqsl.js} +1 -1
  157. package/dist/assets/{mouse-pointer-2-DhUGQ7ZH.js → mouse-pointer-2-OdaCocrT.js} +1 -1
  158. package/dist/assets/music-2-Bntsr1pc.js +1 -0
  159. package/dist/assets/{nanobanana-DA2GduwI.js → nanobanana-Dl-ipICX.js} +1 -1
  160. package/dist/assets/{omni-xmJPCNtQ.js → omni-CI7RALc3.js} +1 -1
  161. package/dist/assets/{openaiimage-2fQ-9rfR.js → openaiimage-x5VnybkH.js} +1 -1
  162. package/dist/assets/{pagination-DtHw8A6D.js → pagination-Bzi2EMHv.js} +1 -1
  163. package/dist/assets/{pagination-V-HQo9KR.js → pagination-C5nrzUF9.js} +1 -1
  164. package/dist/assets/{pagination-C60kxWZe.js → pagination-DZKa3-YT.js} +1 -1
  165. package/dist/assets/{palette-B6_cijkw.js → palette-Dcz8R07T.js} +1 -1
  166. package/dist/assets/{paperclip-CFrO-Wn5.js → paperclip-C9CPT-QH.js} +1 -1
  167. package/dist/assets/{pause-DaFJqaMW.js → pause-B7nZk56m.js} +1 -1
  168. package/dist/assets/{pencil-B9copLoS.js → pencil-DjYsRqzY.js} +1 -1
  169. package/dist/assets/{pika-CN3tdiBe.js → pika-JthT3pXY.js} +1 -1
  170. package/dist/assets/{pixverse-BAFM6H2P.js → pixverse-BdQw9oon.js} +1 -1
  171. package/dist/assets/play-D4UKBipL.js +1 -0
  172. package/dist/assets/{plug-CJn2rNBP.js → plug-Pqr_YrfP.js} +1 -1
  173. package/dist/assets/plus-Yte47cek.js +1 -0
  174. package/dist/assets/{poivelle-ChIyy-EH.js → poivelle-BhoxBCwR.js} +1 -1
  175. package/dist/assets/{popover-Dii1mMtm.js → popover-vu3TWrhj.js} +1 -1
  176. package/dist/assets/{producer-a40YkPpg.js → producer-DqmOMlav.js} +1 -1
  177. package/dist/assets/{qrart-CVYY3JqO.js → qrart-wpmoj2Md.js} +1 -1
  178. package/dist/assets/{realtime-D-hgT5rf.js → realtime-Ce9utybp.js} +1 -1
  179. package/dist/assets/{refresh-cw-Dexs11YW.js → refresh-cw-CfsQ44rr.js} +1 -1
  180. package/dist/assets/rotate-ccw-C2vE6W20.js +1 -0
  181. package/dist/assets/rotate-cw-B3ZTq3Bo.js +1 -0
  182. package/dist/assets/{row-DJjKecw-.js → row-ig5nVOkc.js} +1 -1
  183. package/dist/assets/search-Dd9GL0kL.js +1 -0
  184. package/dist/assets/{seedance-Bkhqwyxg.js → seedance-tg7fYegi.js} +1 -1
  185. package/dist/assets/{seedream-XE2D-OF0.js → seedream-BN7uBnTq.js} +1 -1
  186. package/dist/assets/{select-wPYO0KL0.js → select--z-fac6_.js} +1 -1
  187. package/dist/assets/{serp-ISzYa1VG.js → serp-B6cjTPwx.js} +1 -1
  188. package/dist/assets/{shield-ltlAnxJj.js → shield-DTxeqQnl.js} +1 -1
  189. package/dist/assets/{shuffle-DmJvfh5Q.js → shuffle-BGv-o6iw.js} +1 -1
  190. package/dist/assets/{slider-y-dr3F-C.js → slider-7iC9uVCH.js} +1 -1
  191. package/dist/assets/{sliders-horizontal-CI4HLf6g.js → sliders-horizontal-BJThi7W3.js} +1 -1
  192. package/dist/assets/{solana-wallets-BlV5vs9p.js → solana-wallets-BOOwBWgF.js} +2 -2
  193. package/dist/assets/{solana-wallets-vue-IyI9vQtZ.js → solana-wallets-vue-CeTGdA4N.js} +1 -1
  194. package/dist/assets/{sora-H7mbBzEU.js → sora-CmhEupYX.js} +1 -1
  195. package/dist/assets/{sparkles-DTtL3_VY.js → sparkles-BXttUKHs.js} +1 -1
  196. package/dist/assets/square-DUN4iYgL.js +1 -0
  197. package/dist/assets/{store-plcsEF7T.js → store-f5a0TlJm.js} +1 -1
  198. package/dist/assets/{suno-B9NnVc_f.js → suno-CMpuwwKN.js} +1 -1
  199. package/dist/assets/{switch-CGc7vZAq.js → switch-CU7Lbydn.js} +1 -1
  200. package/dist/assets/{table-BUZvX-Et.js → table-B1ktVOIV.js} +1 -1
  201. package/dist/assets/{tabs-CeP4BX60.js → tabs-CMeHhbQd.js} +1 -1
  202. package/dist/assets/{tag-Brs_vqpG.js → tag-D88Sfg4N.js} +1 -1
  203. package/dist/assets/terminal-BXyA_hw_.js +1 -0
  204. package/dist/assets/{time-picker-DcBgjET5.js → time-picker-D3G4t_oE.js} +1 -1
  205. package/dist/assets/{tooltip-DjLl_Tv9.js → tooltip-CVVApYjJ.js} +1 -1
  206. package/dist/assets/{trash-2-jm25a3wz.js → trash-2-B7h9iX5Q.js} +1 -1
  207. package/dist/assets/{triangle-alert-RGg8X9Hu.js → triangle-alert-C_NcfP7e.js} +1 -1
  208. package/dist/assets/{upload-CIMqvT63.js → upload-DRjQvPEd.js} +1 -1
  209. package/dist/assets/{upload-D-5KHpRy.js → upload-GC5EGmwp.js} +1 -1
  210. package/dist/assets/user-DAcxFEzJ.js +1 -0
  211. package/dist/assets/{veo-DrzkEdnG.js → veo-aFwNCFqW.js} +1 -1
  212. package/dist/assets/{video-CeuAAsEB.js → video-DzECS7d8.js} +1 -1
  213. package/dist/assets/{volume-2-eVailN2d.js → volume-2-P5c2kRYc.js} +1 -1
  214. package/dist/assets/{wallet-CX9SKZRT.js → wallet-Dx1JWzUk.js} +1 -1
  215. package/dist/assets/{wan-C0mdV9Rz.js → wan-BSz5Kzfp.js} +1 -1
  216. package/dist/assets/{wand-sparkles-DIimd5K-.js → wand-sparkles-BQfGRD0P.js} +1 -1
  217. package/dist/assets/{web-BVpxeVn9.js → web-Bd7fTTXa.js} +1 -1
  218. package/dist/assets/{web-BO8Wllv3.js → web-CQd8Y7AZ.js} +1 -1
  219. package/dist/assets/{web-BO5Pdh_K.js → web-Jqmx6K36.js} +1 -1
  220. package/dist/assets/{web-wBLWPFcq.js → web-bobTX3fT.js} +1 -1
  221. package/dist/assets/{web-B7xnbizz.js → web-sGhtaPRt.js} +1 -1
  222. package/dist/assets/{webextrator-aanjbblU.js → webextrator-Blj-ynVW.js} +1 -1
  223. package/dist/assets/{zap-BsvIhLIz.js → zap-BAyq1MAX.js} +1 -1
  224. package/dist/index.html +1 -1
  225. package/package.json +1 -1
  226. package/dist/assets/arrow-down-Dh452YIC.js +0 -1
  227. package/dist/assets/arrow-left-Ch_lXtQi.js +0 -1
  228. package/dist/assets/arrow-right-wyaZljl1.js +0 -1
  229. package/dist/assets/arrow-up-lL0oPCkq.js +0 -1
  230. package/dist/assets/check-pR3vm7Fd.js +0 -1
  231. package/dist/assets/chevron-down-CjOUzYER.js +0 -1
  232. package/dist/assets/chevron-right-hQDGFAdA.js +0 -1
  233. package/dist/assets/circle-check-BRrtyFQR.js +0 -1
  234. package/dist/assets/clock-CYQS4x6R.js +0 -1
  235. package/dist/assets/code-BW5Yks2E.js +0 -1
  236. package/dist/assets/esm-DJikXHl0.js +0 -1
  237. package/dist/assets/gauge-B1-tdKSR.js +0 -1
  238. package/dist/assets/loader-circle-CVdEfzJY.js +0 -1
  239. package/dist/assets/music-2-Dt2ZUjFq.js +0 -1
  240. package/dist/assets/play-V3reP3Bw.js +0 -1
  241. package/dist/assets/plus-C0Y7fZjt.js +0 -1
  242. package/dist/assets/rotate-ccw-CtkUdLFt.js +0 -1
  243. package/dist/assets/rotate-cw-B5OvUSKK.js +0 -1
  244. package/dist/assets/search-gH7NbLUO.js +0 -1
  245. package/dist/assets/square-9zBx8cT8.js +0 -1
  246. package/dist/assets/terminal-Bk-Dcy9N.js +0 -1
  247. package/dist/assets/user-CWDZ6e_c.js +0 -1
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,K as a,L as o,M as s,N as c,S as l,T as u,at as d,b as f,ht as p,j as m,mt as h,ot as g,qt as _,rt as v,st as y,tt as b,z as x}from"./vendor-chart-Dw-P17PN.js";import{r as S,t as C}from"./select-wPYO0KL0.js";import{n as w,t as T}from"./tabs-CeP4BX60.js";import{t as E}from"./tooltip-DjLl_Tv9.js";import{n as D,r as O,t as k}from"./dropdown-BK55ixdu.js";import{t as A}from"./pagination-DtHw8A6D.js";import{t as j}from"./switch-CGc7vZAq.js";import{t as M}from"./arrow-down-Dh452YIC.js";import{t as N}from"./arrow-left-Ch_lXtQi.js";import{t as P}from"./book-open-BbaTABUc.js";import{t as F}from"./chevron-down-CjOUzYER.js";import{t as I}from"./chevron-right-hQDGFAdA.js";import{t as L}from"./circle-check-BRrtyFQR.js";import{t as ee}from"./circle-question-mark-DE0O8vxY.js";import{t as te}from"./clipboard-list-Rsq5M2Nz.js";import{t as ne}from"./code-BW5Yks2E.js";import{t as R}from"./copy-BuBuMUSy.js";import{t as re}from"./ellipsis-In1Yb9VJ.js";import{t as ie}from"./eye-C1bTVOBo.js";import{t as ae}from"./file-text-BN1gU3ZM.js";import{t as z}from"./file-DD9Lna7S.js";import{t as B}from"./folder-rv9DxoE4.js";import{t as oe}from"./image-B13GFkdr.js";import{t as se}from"./lock-BN9HCeSw.js";import{t as ce}from"./plus-C0Y7fZjt.js";import{n as le,t as ue}from"./store-plcsEF7T.js";import{t as de}from"./search-gH7NbLUO.js";import{t as fe}from"./trash-2-jm25a3wz.js";import{t as pe}from"./triangle-alert-RGg8X9Hu.js";import{t as me}from"./upload-CIMqvT63.js";import{t as he}from"./wand-sparkles-DIimd5K-.js";import{Ai as V,Ci as H,E as U,Ei as W,Ji as G,Li as ge,Si as _e,Ti as K,bi as ve,fi as ye,gi as be,gr as q,hi as xe,mi as Se,ui as Ce,wi as we,zi as J}from"./index-S2D3KxIN.js";import{a as Te,c as Ee,d as De,f as Oe,i as ke,l as Ae,m as Y,n as je,o as Me,p as Ne,r as Pe,s as Fe,t as Ie,u as Le}from"./vendor-highlight-BHrfT4-E.js";import{t as Re}from"./index.es-CR3OWAv9.js";import{t as ze}from"./VueMarkdown-CiiRjbWs.js";var Be=H(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),Ve=H(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),He=H(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),Ue=H(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),We=H(`square-plus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),X=()=>({baseURL:`${Ce()}/api/v1`}),Z=new class{key=`skills/installed`;async list(){return q.get(`/${this.key}/`,X())}async get(e){return q.get(`/${this.key}/${e}/`,X())}async createMarkdown(e){return q.post(`/${this.key}/`,e,X())}async createTarball(e){let t=new FormData;return t.append(`tarball`,e),q.post(`/${this.key}/`,t,{...X(),headers:{"Content-Type":`multipart/form-data`}})}async update(e,t){return q.patch(`/${this.key}/${e}/`,t,X())}async remove(e){return q.delete(`/${this.key}/${e}/`,X())}async enable(e){return q.post(`/${this.key}/${e}/enable/`,void 0,X())}async disable(e){return q.post(`/${this.key}/${e}/disable/`,void 0,X())}async fetchFile(e,t){let n=await q.get(`/${this.key}/${e}/files/`,{...X(),params:{path:t},responseType:`arraybuffer`}),r=n.headers[`content-type`]||`application/octet-stream`;return{blob:new Blob([n.data],{type:r}),contentType:r}}},Q=new class{key=`skills`;async list(e={}){return q.get(`/${this.key}/`,{...X(),params:e})}async get(e){return q.get(`/${this.key}/${e}/`,X())}async categories(){return q.get(`/${this.key}/categories/`,X())}async install(e,t={}){return q.post(`/${this.key}/${e}/install/`,t,X())}};function Ge(){let e=new Set;xe()&&e.add(`desktop`),be()&&e.add(`ios`),Se()&&e.add(`android`),ve()&&e.add(`web`);let t=ye();if(t===`mac`)e.add(`mac`);else if(t===`windows`)e.add(`windows`);else if(typeof navigator<`u`){let t=navigator.userAgent||``,n=navigator.userAgentData?.platform,r=/macintosh/i.test(t)&&(navigator.maxTouchPoints||0)>1;!be()&&!r&&(n===`macOS`||/mac os x|macintosh/i.test(t))&&e.add(`mac`),(n===`Windows`||/windows nt/i.test(t))&&e.add(`windows`)}return e}var Ke=new Set([`mac`,`windows`,`desktop`,`web`,`ios`,`android`]);function qe(e){let t=e.filter(e=>Ke.has(e));if(!t.length)return!0;let n=Ge();return t.some(e=>n.has(e))}Y.registerLanguage(`bash`,Ne),Y.registerLanguage(`json`,Oe),Y.registerLanguage(`markdown`,De),Y.registerLanguage(`python`,Le),Y.registerLanguage(`shell`,Ae),Y.registerLanguage(`yaml`,Ee),Y.registerAliases([`yml`],{languageName:`yaml`}),Y.registerAliases([`py`],{languageName:`python`}),Y.registerAliases([`sh`,`zsh`],{languageName:`bash`});var Je=12,Ye=x({name:`BrowseSkillsDialog`,components:{VueMarkdown:ze,ElDialog:V,ElInput:G,ElButton:J,ElPagination:A,ElSelect:S,ElOption:C,FontAwesomeIcon:Re,AddIcon:ce,BackIcon:N,DownIcon:M,InstallIcon:Be,LockIcon:se,SearchIcon:de,SuccessIcon:L},directives:{loading:W},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`installed`],data(){return{loading:!1,installing:!1,items:[],total:0,currentPage:1,searchQuery:``,namespaceFilter:``,sortBy:`popular`,selectedItem:null,searchTimer:null,knownNamespaces:[],publisherByNamespace:{}}},computed:{pageSize(){return Je},namespaceOptions(){let e=new Set(this.knownNamespaces);for(let t of this.items)e.add(t.namespace);return Array.from(e).sort().map(e=>({value:e,label:this.publisherForNamespace(e)}))},detailBody(){return this.selectedItem?this.selectedItem.content.replace(/^---\n[\s\S]*?\n---\n?/,``):``}},methods:{onOpen(){this.selectedItem=null,this.searchQuery=``,this.namespaceFilter=``,this.sortBy=`popular`,this.currentPage=1,this.knownNamespaces=[],this.publisherByNamespace={},this.loadFacets(),this.reload()},openDetail(e){this.selectedItem=e},async loadFacets(){try{let{data:e}=await Q.categories(),t=new Set;for(let n of e.namespaces)t.add(n.namespace);this.knownNamespaces=Array.from(t).sort()}catch(e){console.warn(`failed to load skill catalog facets`,e)}},reloadFromFirstPage(){this.currentPage=1,this.reload()},onPageChange(e){this.currentPage=e,this.reload(),this.$nextTick(()=>{let e=this.$el.querySelector(`.directory-grid-wrapper`);e&&(e.scrollTop=0)})},onSearchInput(){this.searchTimer!==null&&window.clearTimeout(this.searchTimer),this.searchTimer=window.setTimeout(()=>{this.searchTimer=null,this.reloadFromFirstPage()},250)},async reload(){this.loading=!0;try{let{data:e}=await Q.list({q:this.searchQuery.trim()||void 0,namespace:this.namespaceFilter||void 0,sort:this.sortBy,limit:this.pageSize,offset:(this.currentPage-1)*this.pageSize});this.items=e.items,this.total=e.total;for(let t of e.items)t.publisher&&(this.publisherByNamespace[t.namespace]=t.publisher)}catch(e){console.error(e),K.error(this.$t(`skill.directory.loadFailed`))}finally{this.loading=!1}},async onInstall(e){if(!this.installing&&!e.installed){if(!this.canInstallOnSurface(e)){K.warning(this.$t(`skill.directory.surfaceBlocked`,{platforms:this.surfaceLabels(e)}));return}this.installing=!0;try{let{data:t}=await Q.install(e.id);K.success(this.$t(`skill.directory.installSuccess`,{name:e.slug})),this.$emit(`installed`,t.id),e.installed=!0,e.install_count+=1}catch(t){let n=this.extractError(t);n.includes(`already exists`)?(e.installed=!0,K.warning(this.$t(`skill.directory.alreadyInstalled`,{name:e.slug}))):K.error(this.$t(`skill.directory.installFailed`,{detail:n}))}finally{this.installing=!1}}},extractError(e){return e?.response?.data?.detail||String(e)||`unknown error`},formatCount(e){return e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)},publisherForNamespace(e){if(this.publisherByNamespace[e])return this.publisherByNamespace[e];let t=this.items.find(t=>t.namespace===e);return t?t.publisher:e},restrictedSurfaces(e){let t=e.frontmatter?.surfaces;return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim().toLowerCase()):[]},surfaceLabel(e){let t=`skill.directory.surface.${e}`,n=this.$t(t);return n===t?e:n},surfaceLabels(e){return this.restrictedSurfaces(e).map(e=>this.surfaceLabel(e)).join(` / `)},canInstallOnSurface(e){return qe(this.restrictedSurfaces(e))}}}),Xe={class:`directory`},Ze={class:`directory-main`},Qe={class:`directory-header`},$e={class:`directory-controls`},et={class:`directory-grid-wrapper`},tt={key:0,class:`directory-empty`},nt={key:1,class:`directory-grid`},rt=[`onClick`],it={class:`directory-card-head`},at={class:`directory-card-title`},ot=[`title`],st=[`title`],ct=[`aria-label`,`title`,`onClick`],lt=[`title`],ut={class:`directory-card-meta`},dt={class:`directory-card-publisher`},ft={key:0,class:`directory-card-count`},pt=[`title`],mt={class:`directory-card-desc`},ht={key:0,class:`directory-footer`},gt={class:`directory-detail-head`},_t={class:`directory-detail-actions`},vt=[`href`],yt={class:`directory-detail-body`},bt={class:`directory-detail-title`},xt={class:`directory-detail-meta`},St={key:0},Ct={key:1},wt=[`title`],Tt={class:`directory-detail-desc`};function Et(a,l,f,_,y,x){let S=d(`search-icon`),C=d(`el-input`),w=d(`el-option`),T=d(`el-select`),E=d(`success-icon`),D=d(`lock-icon`),O=d(`add-icon`),k=d(`down-icon`),A=d(`el-pagination`),j=d(`back-icon`),M=d(`font-awesome-icon`),N=d(`el-button`),P=d(`install-icon`),F=d(`vue-markdown`),I=d(`el-dialog`),L=g(`loading`);return b(),m(I,{"model-value":a.modelValue,title:a.$t(`skill.dialog.directoryTitle`),width:`min(960px, 94vw)`,"align-center":``,class:`directory-dialog`,"close-on-click-modal":!a.installing,"show-close":!a.installing,"onUpdate:modelValue":l[5]||=e=>a.$emit(`update:modelValue`,e),onOpen:a.onOpen},{default:h(()=>[e(`div`,Xe,[e(`main`,Ze,[a.selectedItem?(b(),c(u,{key:1},[e(`header`,gt,[e(`button`,{class:`directory-back-btn`,onClick:l[3]||=e=>a.selectedItem=null},[o(j,{size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.back`)),1)]),e(`div`,_t,[a.selectedItem.source_url?(b(),c(`a`,{key:0,href:a.selectedItem.source_url,target:`_blank`,class:`directory-link`},[o(M,{icon:`fa-brands fa-github`}),r(` `+i(a.$t(`skill.directory.viewSource`)),1)],8,vt)):s(``,!0),a.selectedItem.installed?(b(),m(N,{key:1,disabled:``,type:`success`,plain:``},{default:h(()=>[o(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.installed`)),1)]),_:1})):a.selectedItem.installable&&!a.canInstallOnSurface(a.selectedItem)?(b(),m(N,{key:2,disabled:``,title:a.$t(`skill.directory.surfaceBlocked`,{platforms:a.surfaceLabels(a.selectedItem)})},{default:h(()=>[o(D,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.surfaceUnavailable`)),1)]),_:1},8,[`title`])):a.selectedItem.installable?(b(),m(N,{key:3,type:`primary`,loading:a.installing,onClick:l[4]||=e=>a.onInstall(a.selectedItem)},{default:h(()=>[o(P,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.install`)),1)]),_:1},8,[`loading`])):(b(),m(N,{key:4,disabled:``,title:a.selectedItem.license},{default:h(()=>[o(D,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.selectedItem.license||a.$t(`skill.directory.notInstallable`)),1)]),_:1},8,[`title`]))])]),e(`div`,yt,[e(`h2`,bt,`/`+i(a.selectedItem.slug),1),e(`div`,xt,[e(`span`,null,[e(`strong`,null,i(a.$t(`skill.meta.addedBy`))+`:`,1),r(` `+i(a.selectedItem.publisher),1)]),a.selectedItem.license?(b(),c(`span`,St,[e(`strong`,null,i(a.$t(`skill.directory.license`))+`:`,1),r(` `+i(a.selectedItem.license),1)])):s(``,!0),a.selectedItem.version?(b(),c(`span`,Ct,`v`+i(a.selectedItem.version),1)):s(``,!0),a.surfaceLabels(a.selectedItem)?(b(),c(`span`,{key:2,class:`directory-detail-surface`,title:a.$t(`skill.directory.surfaceHint`)},i(a.$t(`skill.directory.surfaceOnly`,{platforms:a.surfaceLabels(a.selectedItem)})),9,wt)):s(``,!0)]),e(`p`,Tt,i(a.selectedItem.description),1),o(F,{class:`directory-detail-content`,source:a.detailBody,sanitize:``},null,8,[`source`])])],64)):(b(),c(u,{key:0},[e(`header`,Qe,[o(C,{modelValue:a.searchQuery,"onUpdate:modelValue":l[0]||=e=>a.searchQuery=e,class:`directory-search`,size:`default`,clearable:``,placeholder:a.$t(`skill.directory.searchPlaceholder`),onInput:a.onSearchInput},{prefix:h(()=>[o(S,{size:14,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`,`onInput`]),e(`div`,$e,[o(T,{modelValue:a.namespaceFilter,"onUpdate:modelValue":l[1]||=e=>a.namespaceFilter=e,class:`directory-select`,placeholder:a.$t(`skill.directory.allPublishers`),clearable:``,size:`default`,onChange:a.reloadFromFirstPage},{default:h(()=>[(b(!0),c(u,null,v(a.namespaceOptions,e=>(b(),m(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),o(T,{modelValue:a.sortBy,"onUpdate:modelValue":l[2]||=e=>a.sortBy=e,class:`directory-select directory-select-sm`,size:`default`,onChange:a.reloadFromFirstPage},{default:h(()=>[o(w,{label:a.$t(`skill.directory.sort.popular`),value:`popular`},null,8,[`label`]),o(w,{label:a.$t(`skill.directory.sort.recent`),value:`recent`},null,8,[`label`]),o(w,{label:a.$t(`skill.directory.sort.name`),value:`name`},null,8,[`label`])]),_:1},8,[`modelValue`,`onChange`])])]),p((b(),c(`div`,et,[!a.loading&&a.total===0?(b(),c(`p`,tt,i(a.$t(`skill.directory.empty`)),1)):(b(),c(`div`,nt,[(b(!0),c(u,null,v(a.items,l=>(b(),c(`article`,{key:l.id,class:n([`directory-card`,{"is-installed":l.installed}]),onClick:e=>a.openDetail(l)},[e(`div`,it,[e(`span`,at,`/`+i(l.slug),1),l.installed?(b(),c(`span`,{key:0,class:`directory-card-action is-installed`,title:a.$t(`skill.directory.installed`)},[o(E,{size:16,"aria-hidden":`true`,focusable:`false`})],8,ot)):l.installable&&!a.canInstallOnSurface(l)?(b(),c(`span`,{key:1,class:`directory-card-locked`,title:a.$t(`skill.directory.surfaceBlocked`,{platforms:a.surfaceLabels(l)})},[o(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,st)):l.installable?(b(),c(`button`,{key:2,class:`directory-card-action`,"aria-label":a.$t(`skill.directory.install`),title:a.$t(`skill.directory.install`),onClick:t(e=>a.onInstall(l),[`stop`])},[o(O,{size:16,"aria-hidden":`true`,focusable:`false`})],8,ct)):(b(),c(`span`,{key:3,class:`directory-card-locked`,title:l.license},[o(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,lt))]),e(`div`,ut,[e(`span`,dt,i(l.publisher),1),l.install_count>0?(b(),c(`span`,ft,[o(k,{size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.formatCount(l.install_count)),1)])):s(``,!0),a.surfaceLabels(l)?(b(),c(`span`,{key:1,class:`directory-card-surface`,title:a.$t(`skill.directory.surfaceHint`)},i(a.surfaceLabels(l)),9,pt)):s(``,!0)]),e(`p`,mt,i(l.description),1)],10,rt))),128))]))])),[[L,a.loading]]),a.total>a.pageSize?(b(),c(`footer`,ht,[o(A,{"current-page":a.currentPage,"page-size":a.pageSize,total:a.total,"pager-count":5,background:``,layout:`prev, pager, next, total`,onCurrentChange:a.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onCurrentChange`])])):s(``,!0)],64))])])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`show-close`,`onOpen`])}var Dt=U(Ye,[[`render`,Et],[`__scopeId`,`data-v-d346d23f`]]);Y.registerLanguage(`bash`,Ne),Y.registerLanguage(`css`,Fe),Y.registerLanguage(`go`,Me),Y.registerLanguage(`javascript`,Te),Y.registerLanguage(`json`,Oe),Y.registerLanguage(`markdown`,De),Y.registerLanguage(`python`,Le),Y.registerLanguage(`rust`,ke),Y.registerLanguage(`shell`,Ae),Y.registerLanguage(`sql`,Pe),Y.registerLanguage(`typescript`,je),Y.registerLanguage(`xml`,Ie),Y.registerLanguage(`html`,Ie),Y.registerLanguage(`yaml`,Ee),Y.registerAliases([`yml`],{languageName:`yaml`}),Y.registerAliases([`ts`,`tsx`],{languageName:`typescript`}),Y.registerAliases([`js`,`jsx`],{languageName:`javascript`}),Y.registerAliases([`py`],{languageName:`python`}),Y.registerAliases([`rs`],{languageName:`rust`}),Y.registerAliases([`sh`,`zsh`],{languageName:`bash`});var $=1e6;function Ot(e,t){let n=(e.split(`.`).pop()||``).toLowerCase();return n===`md`||t.startsWith(`text/markdown`)?`markdown`:n===`html`||n===`htm`||t.startsWith(`text/html`)?`html`:t.startsWith(`image/`)||[`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`].includes(n)?`image`:t.startsWith(`text/`)||[`json`,`application/json`].includes(t.split(`;`)[0])?n?`code`:`text`:`binary`}function kt(e){let t=(e.split(`.`).pop()||``).toLowerCase();return Y.getLanguage(t)?t:`plain`}var At=x({name:`SkillFilePreview`,components:{ElButton:J,ElTooltip:E,ElTabs:w,ElTabPane:T,CodeIcon:ne,CopyIcon:R,FileIcon:z,SaveIcon:Ue,ViewIcon:ie,WarningIcon:pe,VueMarkdown:ze},directives:{loading:W},props:{skillId:{type:String,required:!0},path:{type:String,required:!0},editable:{type:Boolean,default:!1}},emits:[`save`],data(){return{MAX_PREVIEW_BYTES:$,loading:!1,error:``,contentType:``,size:0,textContent:``,imageUrl:``,truncated:!1,viewMode:`rendered`,dirty:!1,saving:!1}},computed:{kind(){return this.path?Ot(this.path,this.contentType):`text`},canRender(){return this.kind===`markdown`||this.kind===`html`},hljsLang(){return`language-${kt(this.path)}`},truncatedText(){return this.textContent}},watch:{path:{handler(){this.fetch()},immediate:!0}},beforeUnmount(){this.imageUrl&&URL.revokeObjectURL(this.imageUrl)},methods:{humanSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`},async fetch(){if(this.path){this.loading=!0,this.error=``,this.textContent=``,this.truncated=!1,this.dirty=!1,this.imageUrl&&=(URL.revokeObjectURL(this.imageUrl),``);try{let{blob:e,contentType:t}=await Z.fetchFile(this.skillId,this.path);this.contentType=t,this.size=e.size;let n=Ot(this.path,t);if(n===`image`)this.imageUrl=URL.createObjectURL(e);else if(n!==`binary`){let t=await e.text();t.length>$&&(t=t.slice(0,$),this.truncated=!0),this.textContent=t,this.viewMode=n===`markdown`||n===`html`?`rendered`:`source`}}catch(e){let t=e,n=t?.response?.status,r=t?.response?.data?.detail||String(e);this.error=n?`(${n}) ${r}`:r}finally{this.loading=!1,this.$nextTick(()=>this.applyHighlight())}}},applyHighlight(){let e=this.$refs.codeEl;e&&this.kind===`code`&&this.viewMode!==`rendered`&&(delete e.dataset.highlighted,Y.highlightElement(e))},async onCopy(){if(this.textContent)try{await navigator.clipboard.writeText(this.textContent),K.success(this.$t(`skill.preview.copied`))}catch{K.error(this.$t(`skill.preview.copyFailed`))}},async onSave(){this.saving=!0;try{await new Promise((e,t)=>{this.$emit(`save`,this.textContent,{resolve:e,reject:t})}),this.dirty=!1}catch{}finally{this.saving=!1}}}}),jt={class:`preview-root`},Mt={class:`toolbar`},Nt={class:`path-display`},Pt={key:0,class:`size-display`},Ft={class:`body`},It={key:0,class:`error`},Lt=[`srcdoc`],Rt={key:3,class:`image-pane`},zt=[`src`,`alt`],Bt={key:4,class:`binary`},Vt=[`placeholder`],Ht={key:6,class:`source-pane`},Ut={key:7,class:`truncated-warning`};function Wt(t,a,l,u,_,v){let y=d(`save-icon`),x=d(`el-button`),S=d(`copy-icon`),C=d(`el-tooltip`),w=d(`view-icon`),T=d(`el-tab-pane`),E=d(`code-icon`),D=d(`el-tabs`),O=d(`warning-icon`),k=d(`vue-markdown`),A=d(`file-icon`),j=g(`loading`);return p((b(),c(`div`,jt,[e(`div`,Mt,[e(`span`,Nt,i(t.path||`—`),1),t.size?(b(),c(`span`,Pt,i(t.humanSize(t.size)),1)):s(``,!0),a[3]||=e(`span`,{class:`toolbar-spacer`},null,-1),t.editable?(b(),m(x,{key:1,type:`primary`,size:`small`,disabled:!t.dirty||t.saving,loading:t.saving,onClick:t.onSave},{default:h(()=>[o(y,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.save`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])):s(``,!0),o(C,{content:t.$t(`skill.preview.copy`),placement:`bottom`},{default:h(()=>[o(x,{size:`small`,circle:``,disabled:!t.textContent,"aria-label":t.$t(`skill.preview.copy`),title:t.$t(`skill.preview.copy`),onClick:t.onCopy},{default:h(()=>[o(S,{size:16,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`disabled`,`aria-label`,`title`,`onClick`])]),_:1},8,[`content`])]),t.canRender?(b(),m(D,{key:0,modelValue:t.viewMode,"onUpdate:modelValue":a[0]||=e=>t.viewMode=e,class:`view-tabs`},{default:h(()=>[o(T,{name:`rendered`},{label:h(()=>[o(w,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewRendered`)),1)]),_:1}),o(T,{name:`source`},{label:h(()=>[o(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewSource`)),1)]),_:1})]),_:1},8,[`modelValue`])):s(``,!0),e(`div`,Ft,[t.error?(b(),c(`div`,It,[o(O,{class:`mr-2`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.error),1)])):t.kind===`markdown`&&t.viewMode===`rendered`?(b(),m(k,{key:1,class:`markdown-rendered`,source:t.textContent,sanitize:``},null,8,[`source`])):t.kind===`html`&&t.viewMode===`rendered`?(b(),c(`iframe`,{key:2,ref:`htmlFrame`,class:`html-frame`,sandbox:``,srcdoc:t.textContent},null,8,Lt)):t.kind===`image`?(b(),c(`div`,Rt,[e(`img`,{src:t.imageUrl,alt:t.path,class:`image-content`},null,8,zt)])):t.kind===`binary`?(b(),c(`div`,Bt,[o(A,{class:`binary-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.binary`,{type:t.contentType})),1)])):t.editable?p((b(),c(`textarea`,{key:5,"onUpdate:modelValue":a[1]||=e=>t.textContent=e,class:`source-editor`,spellcheck:`false`,placeholder:t.$t(`skill.placeholder.content`),onInput:a[2]||=e=>t.dirty=!0},null,40,Vt)),[[f,t.textContent]]):(b(),c(`pre`,Ht,[e(`code`,{ref:`codeEl`,class:n(t.hljsLang)},i(t.truncatedText),3)])),t.truncated?(b(),c(`p`,Ut,i(t.$t(`skill.preview.truncated`,{size:t.humanSize(t.MAX_PREVIEW_BYTES)})),1)):s(``,!0)])])),[[j,t.loading]])}var Gt=U(At,[[`render`,Wt],[`__scopeId`,`data-v-ec0a447e`]]),Kt=new Set([`py`,`ts`,`tsx`,`js`,`jsx`,`json`,`yaml`,`yml`,`sh`,`bash`,`zsh`,`css`,`html`,`sql`,`go`,`rs`,`rb`,`java`,`cpp`,`c`,`h`,`toml`]),qt=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function Jt(e){let t=e.split(`/`).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();return t===`SKILL.md`?P:n===`md`?ae:qt.has(n)?oe:Kt.has(n)?He:z}function Yt(e){let t=new Map;t.set(``,new Map);let n=(e,n)=>{let r=t.get(e);r||(r=new Map,t.set(e,r));let i=e?`${e}/${n}`:n,a=r.get(n);return a||(a={label:n,path:i,isLeaf:!1,children:[]},r.set(n,a),t.set(i,new Map)),a};for(let r of e){let e=r.split(`/`).filter(Boolean);if(e.length===0)continue;let i=e[e.length-1],a=e.slice(0,-1),o=``;for(let e of a)o=n(o,e).path;let s={label:i,path:r,isLeaf:!0},c=t.get(o);c||(c=new Map,t.set(o,c)),c.set(i,s)}let r=e=>{let n=t.get(e);if(!n)return[];let i=Array.from(n.values());for(let e of i)e.isLeaf||(e.children=r(e.path));return i.sort((e,t)=>e.path===`SKILL.md`?-1:t.path===`SKILL.md`?1:e.isLeaf===t.isLeaf?e.label.localeCompare(t.label):e.isLeaf?1:-1)};return r(``)}var Xt=x({name:`FileNode`,components:{ExpandDownIcon:F,ExpandRightIcon:I,FontAwesomeIcon:Re},props:{node:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},skill:{type:Object,required:!0},depth:{type:Number,default:1}},emits:[`select-file`],data(){return{open:!0}},computed:{indent(){return 8+this.depth*16},isActive(){return this.node.isLeaf&&this.selectedSkillId===this.skill.id&&this.selectedPath===this.node.path}},methods:{isHtmlFile(e){return e.isLeaf&&e.path.toLowerCase().endsWith(`.html`)},iconFor(e){return e.isLeaf?Jt(e.path):B},onClick(){this.node.isLeaf?this.$emit(`select-file`,this.node.path):this.open=!this.open}}}),Zt=[`aria-label`,`title`],Qt={key:1,class:`node-chevron-spacer`},$t={class:`node-label`},en={key:0,class:`children`};function tn(r,a,o,l,f,p){let h=d(`expand-down-icon`),g=d(`expand-right-icon`),x=d(`font-awesome-icon`),S=d(`file-node`,!0);return b(),c(`li`,null,[e(`div`,{class:n([`file-node`,{active:r.isActive}]),style:_({paddingLeft:r.indent+`px`}),onClick:a[1]||=(...e)=>r.onClick&&r.onClick(...e)},[r.node.isLeaf?(b(),c(`span`,Qt)):(b(),c(`button`,{key:0,class:`node-chevron`,"aria-label":r.$t(r.open?`common.button.collapse`:`common.button.expand`),title:r.$t(r.open?`common.button.collapse`:`common.button.expand`),onClick:a[0]||=t(e=>r.open=!r.open,[`stop`])},[r.open?(b(),m(h,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(b(),m(g,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,Zt)),r.isHtmlFile(r.node)?(b(),m(x,{key:2,icon:`fa-brands fa-html5`,class:`node-icon`})):(b(),m(y(r.iconFor(r.node)),{key:3,class:`node-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),e(`span`,$t,i(r.node.label),1)],6),!r.node.isLeaf&&r.open?(b(),c(`ul`,en,[(b(!0),c(u,null,v(r.node.children||[],e=>(b(),m(S,{key:e.path,node:e,"selected-skill-id":r.selectedSkillId,"selected-path":r.selectedPath,skill:r.skill,depth:r.depth+1,onSelectFile:a[2]||=e=>r.$emit(`select-file`,e)},null,8,[`node`,`selected-skill-id`,`selected-path`,`skill`,`depth`]))),128))])):s(``,!0)])}var nn=x({name:`SkillRow`,components:{ExpandDownIcon:F,ExpandRightIcon:I,SkillIcon:le,FileNode:U(Xt,[[`render`,tn],[`__scopeId`,`data-v-5240087b`]])},props:{skill:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},expanded:{type:Boolean,default:!1}},emits:[`toggle-expand`,`select-skill`,`select-file`],computed:{tree(){return Yt(this.skill.asset_bundle_files)},hasChildren(){return this.skill.asset_bundle_files.length>1},isSkillSelected(){return this.selectedSkillId===this.skill.id&&!this.selectedPath}},methods:{onSelectFile(e){this.$emit(`select-file`,this.skill,e)}}}),rn={class:`skill-row-wrapper`},an=[`aria-label`,`title`],on={key:1,class:`row-chevron-spacer`},sn=[`title`],cn={key:0,class:`file-list`};function ln(r,a,l,f,p,h){let g=d(`expand-down-icon`),_=d(`expand-right-icon`),y=d(`skill-icon`),x=d(`file-node`);return b(),c(`li`,rn,[e(`div`,{class:n([`skill-row`,{active:r.isSkillSelected}]),onClick:a[1]||=e=>r.$emit(`select-skill`,r.skill)},[r.hasChildren?(b(),c(`button`,{key:0,class:`row-chevron`,"aria-label":r.$t(r.expanded?`common.button.collapse`:`common.button.expand`),title:r.$t(r.expanded?`common.button.collapse`:`common.button.expand`),onClick:a[0]||=t(e=>r.$emit(`toggle-expand`,r.skill),[`stop`])},[r.expanded?(b(),m(g,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(b(),m(_,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,an)):(b(),c(`span`,on)),o(y,{class:`row-icon`,size:16,"aria-hidden":`true`,focusable:`false`}),e(`span`,{class:`row-label`,title:r.skill.name},i(r.skill.slug),9,sn)],2),r.expanded&&r.hasChildren?(b(),c(`ul`,cn,[(b(!0),c(u,null,v(r.tree,e=>(b(),m(x,{key:e.path,node:e,"selected-skill-id":r.selectedSkillId,"selected-path":r.selectedPath,skill:r.skill,depth:1,onSelectFile:r.onSelectFile},null,8,[`node`,`selected-skill-id`,`selected-path`,`skill`,`onSelectFile`]))),128))])):s(``,!0)])}var un=U(nn,[[`render`,ln],[`__scopeId`,`data-v-231c2ce1`]]),dn=10*1024*1024,fn=/\.(tar\.gz|tgz|tar|zip|md)$/i,pn=x({name:`UploadSkillDialog`,components:{ElDialog:V,ElButton:J,AddFileIcon:We,CloudUploadIcon:Ve},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{file:null,isDragging:!1,uploading:!1}},methods:{onVisibleChange(e){this.$emit(`update:modelValue`,e)},onClose(){this.uploading||this.$emit(`update:modelValue`,!1)},reset(){this.file=null,this.isDragging=!1;let e=this.$refs.fileInput;e&&(e.value=``)},humanSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`},onPickFile(){this.uploading||this.$refs.fileInput?.click()},onFilePicked(e){let t=e.target.files?.[0]||null;this.acceptFile(t)},onDrop(e){this.isDragging=!1;let t=e.dataTransfer?.files?.[0]||null;this.acceptFile(t)},acceptFile(e){if(!e){this.file=null;return}if(e.size>dn){K.error(this.$t(`skill.message.fileTooLarge`));return}if(!fn.test(e.name)){K.error(this.$t(`skill.message.fileTypeWrong`));return}this.file=e},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},async onSubmit(){if(this.file){this.uploading=!0;try{if(/\.md$/i.test(this.file.name)){let e=await this.file.text(),{data:t}=await Z.createMarkdown({content:e});K.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,t.id)}else{let{data:e}=await Z.createTarball(this.file);K.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,e.id)}this.$emit(`update:modelValue`,!1)}catch(e){K.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)}))}finally{this.uploading=!1}}}}}),mn={key:0,class:`dropzone-hint`},hn={key:1,class:`dropzone-file`},gn={class:`dropzone-file-name`},_n={class:`dropzone-file-size`},vn={class:`requirements`},yn={class:`requirements-title`};function bn(a,s,l,u,f,p){let g=d(`add-file-icon`),_=d(`el-button`),v=d(`cloud-upload-icon`),y=d(`el-dialog`);return b(),m(y,{"model-value":a.modelValue,title:a.$t(`skill.dialog.uploadTitle`),width:`min(520px, 94vw)`,"align-center":``,"close-on-click-modal":!a.uploading,"close-on-press-escape":!a.uploading,"show-close":!a.uploading,"onUpdate:modelValue":a.onVisibleChange,onClosed:a.reset},{footer:h(()=>[o(_,{disabled:a.uploading,onClick:a.onClose},{default:h(()=>[r(i(a.$t(`skill.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`]),o(_,{type:`primary`,loading:a.uploading,disabled:!a.file,onClick:a.onSubmit},{default:h(()=>[o(v,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.button.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:h(()=>[e(`input`,{ref:`fileInput`,type:`file`,accept:`.tar.gz,.tgz,.tar,.zip,.md,application/gzip,application/zip,application/x-tar,text/markdown`,hidden:``,onChange:s[0]||=(...e)=>a.onFilePicked&&a.onFilePicked(...e)},null,544),e(`div`,{class:n([`dropzone`,{"is-dragging":a.isDragging,"has-file":!!a.file}]),onClick:s[1]||=(...e)=>a.onPickFile&&a.onPickFile(...e),onDragover:s[2]||=t(e=>a.isDragging=!0,[`prevent`]),onDragleave:s[3]||=t(e=>a.isDragging=!1,[`prevent`]),onDrop:s[4]||=t((...e)=>a.onDrop&&a.onDrop(...e),[`prevent`])},[o(g,{class:`dropzone-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),a.file?(b(),c(`p`,hn,[e(`span`,gn,i(a.file.name),1),e(`span`,_n,i(a.humanSize(a.file.size)),1)])):(b(),c(`p`,mn,i(a.$t(`skill.dialog.uploadDrop`)),1))],34),e(`div`,vn,[e(`p`,yn,i(a.$t(`skill.dialog.fileRequirements`)),1),e(`ul`,null,[e(`li`,null,i(a.$t(`skill.dialog.requirementMd`)),1),e(`li`,null,i(a.$t(`skill.dialog.requirementArchive`)),1)])])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`show-close`,`onUpdate:modelValue`,`onClosed`])}var xn=U(pn,[[`render`,bn],[`__scopeId`,`data-v-01ead824`]]),Sn=x({name:`WriteSkillDialog`,components:{ElDialog:V,ElButton:J,ElInput:G,CloudUploadIcon:Ve},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{content:``,saving:!1}},methods:{onVisibleChange(e){this.$emit(`update:modelValue`,e)},onClose(){this.saving||this.$emit(`update:modelValue`,!1)},reset(){this.content=``},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},async onSubmit(){if(this.content.trim()){this.saving=!0;try{let{data:e}=await Z.createMarkdown({content:this.content});K.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,e.id),this.$emit(`update:modelValue`,!1)}catch(e){K.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)}))}finally{this.saving=!1}}}}}),Cn={class:`hint`};function wn(t,n,a,s,c,l){let u=d(`el-input`),f=d(`el-button`),p=d(`cloud-upload-icon`),g=d(`el-dialog`);return b(),m(g,{"model-value":t.modelValue,title:t.$t(`skill.dialog.writeTitle`),width:`min(720px, 94vw)`,"align-center":``,"close-on-click-modal":!t.saving,"close-on-press-escape":!t.saving,"show-close":!t.saving,"onUpdate:modelValue":t.onVisibleChange,onClosed:t.reset},{footer:h(()=>[o(f,{disabled:t.saving,onClick:t.onClose},{default:h(()=>[r(i(t.$t(`skill.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`]),o(f,{type:`primary`,loading:t.saving,disabled:!t.content.trim(),onClick:t.onSubmit},{default:h(()=>[o(p,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:h(()=>[e(`p`,Cn,i(t.$t(`skill.dialog.writeHint`)),1),o(u,{modelValue:t.content,"onUpdate:modelValue":n[0]||=e=>t.content=e,type:`textarea`,rows:18,placeholder:t.$t(`skill.placeholder.content`),spellcheck:`false`,class:`editor`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`show-close`,`onUpdate:modelValue`,`onClosed`])}var Tn=x({name:`UserSkills`,components:{ElInput:G,ElSwitch:j,ElTag:ge,ElTooltip:E,ElDropdown:k,ElDropdownMenu:O,ElDropdownItem:D,AddIcon:ce,AiCreateIcon:he,CloseIcon:_e,DeleteIcon:fe,ExpandDownIcon:F,ExpandRightIcon:I,HelpIcon:ee,MarketplaceIcon:ue,MoreIcon:re,SearchIcon:de,SkillIcon:le,UploadIcon:me,WriteIcon:te,BrowseSkillsDialog:Dt,SkillFilePreview:Gt,SkillRow:un,UploadSkillDialog:xn,WriteSkillDialog:U(Sn,[[`render`,wn],[`__scopeId`,`data-v-f39aab5d`]])},directives:{loading:W},data(){return{loading:!1,skills:[],togglingId:null,selectedSkillId:``,selectedPath:``,expandedSkillIds:[],personalOpen:!0,globalsOpen:!0,searchOpen:!1,searchQuery:``,uploadVisible:!1,writeVisible:!1,browseVisible:!1}},computed:{personalSkills(){return this.skills.filter(e=>e.source!==`global`)},globalSkills(){return this.skills.filter(e=>e.source===`global`)},filteredPersonal(){return this.applyFilter(this.personalSkills)},filteredGlobal(){return this.applyFilter(this.globalSkills)},selectedSkill(){return this.skills.find(e=>e.id===this.selectedSkillId)||null}},mounted(){this.fetchSkills()},methods:{applyFilter(e){let t=this.searchQuery.trim().toLowerCase();return t?e.filter(e=>e.slug.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)):e},async fetchSkills(){this.loading=!0;try{let{data:e}=await Z.list();if(this.skills=e||[],!this.selectedSkillId&&this.skills.length){let e=this.personalSkills[0]||this.skills[0];this.selectedSkillId=e.id}else this.selectedSkillId&&!this.skills.find(e=>e.id===this.selectedSkillId)&&(this.selectedSkillId=``,this.selectedPath=``)}catch(e){console.error(e),K.error(this.$t(`skill.message.loadFailed`))}finally{this.loading=!1}},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},selectSkill(e){this.selectedSkillId=e.id,this.selectedPath=``},selectFile(e,t){this.selectedSkillId=e.id,this.selectedPath=t},toggleExpand(e){let t=this.expandedSkillIds.indexOf(e.id);t>=0?this.expandedSkillIds.splice(t,1):this.expandedSkillIds.push(e.id)},openSearch(){this.searchOpen=!0,a(()=>{this.$refs.searchInput?.focus?.()})},closeSearch(){this.searchOpen=!1,this.searchQuery=``},openUpload(){this.uploadVisible=!0},openWrite(){this.writeVisible=!0},onBrowse(){this.browseVisible=!0},async onCreated(e){await this.fetchSkills();let t=this.skills.find(t=>t.id===e);t&&(this.selectedSkillId=t.id,this.selectedPath=``,this.personalOpen=!0)},async onSaveContent(e,t){if(!this.selectedSkill){t.reject();return}try{let{data:n}=await Z.update(this.selectedSkill.id,{content:e});K.success(this.$t(`skill.message.updateSuccess`));let r=this.skills.findIndex(e=>e.id===n.id);r>=0&&this.skills.splice(r,1,n),t.resolve()}catch(e){K.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)})),t.reject(e)}},async onDelete(e){try{await we.confirm(this.$t(`skill.message.deleteConfirm`,{slug:e.slug}),this.$t(`skill.button.delete`),{type:`warning`})}catch{return}try{await Z.remove(e.id),K.success(this.$t(`skill.message.deleteSuccess`)),this.selectedSkillId===e.id&&(this.selectedSkillId=``,this.selectedPath=``),await this.fetchSkills()}catch(e){K.error(this.extractError(e))}},async onToggleSkill(e,t){this.togglingId=e.id;try{t?(await Z.enable(e.id),K.success(this.$t(`skill.message.enableSuccess`))):(await Z.disable(e.id),K.success(this.$t(`skill.message.disableSuccess`))),e.enabled=t}catch(e){K.error(this.extractError(e))}finally{this.togglingId=null}}}}),En={class:`page-shell`},Dn={class:`page-heading`},On={class:`page-title`},kn={class:`page-subtitle`},An={class:`skills-shell`},jn={class:`left-pane`},Mn={class:`left-header`},Nn={class:`left-actions`},Pn=[`aria-label`,`title`],Fn=[`aria-label`,`title`],In={class:`submenu-trigger`},Ln={class:`badge-soon`},Rn={key:0,class:`search-row`},zn=[`aria-label`,`title`],Bn={class:`left-body`},Vn={class:`section`},Hn={key:0,class:`skill-list`},Un={key:0,class:`empty-row`},Wn={key:0,class:`section`},Gn={key:0,class:`skill-list`},Kn={class:`right-pane`},qn={class:`right-header`},Jn={class:`right-title`},Yn={class:`right-actions`},Xn=[`aria-label`,`title`],Zn={class:`meta-card`},Qn={class:`meta-grid`},$n={class:`meta-cell`},er={class:`meta-label`},tr={class:`meta-value`},nr={class:`meta-cell`},rr={class:`meta-label`},ir={class:`meta-value`},ar={key:0,class:`meta-cell`},or={class:`meta-label`},sr={class:`meta-tags`},cr={key:0,class:`meta-description`},lr={class:`meta-description-label`},ur={class:`meta-label`},dr={class:`preview-card`},fr={key:2,class:`right-empty`};function pr(t,n,a,f,_,y){let x=d(`search-icon`),S=d(`add-icon`),C=d(`marketplace-icon`),w=d(`el-dropdown-item`),T=d(`expand-right-icon`),E=d(`ai-create-icon`),D=d(`write-icon`),O=d(`upload-icon`),k=d(`el-dropdown-menu`),A=d(`el-dropdown`),j=d(`el-input`),M=d(`close-icon`),N=d(`expand-down-icon`),P=d(`skill-row`),F=d(`el-switch`),I=d(`more-icon`),L=d(`delete-icon`),ee=d(`el-tag`),te=d(`help-icon`),ne=d(`el-tooltip`),R=d(`skill-file-preview`),re=d(`skill-icon`),ie=d(`upload-skill-dialog`),ae=d(`write-skill-dialog`),z=d(`browse-skills-dialog`),B=g(`loading`);return b(),c(`div`,En,[e(`div`,Dn,[e(`h2`,On,i(t.$t(`skill.title.skills`)),1),e(`p`,kn,i(t.$t(`skill.message.pageDescription`)),1)]),e(`div`,An,[e(`aside`,jn,[e(`header`,Mn,[e(`div`,Nn,[t.searchOpen?s(``,!0):(b(),c(`button`,{key:0,class:`icon-btn`,"aria-label":t.$t(`skill.button.search`),title:t.$t(`skill.button.search`),onClick:n[0]||=(...e)=>t.openSearch&&t.openSearch(...e)},[o(x,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Pn)),o(A,{trigger:`click`,placement:`bottom-end`,"hide-on-click":!1},{dropdown:h(()=>[o(k,{class:`add-menu`},{default:h(()=>[o(w,{onClick:t.onBrowse},{default:h(()=>[o(C,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.browse`)),1)]),_:1},8,[`onClick`]),o(w,{divided:``},{default:h(()=>[o(A,{trigger:`hover`,placement:`left-start`,"hide-on-click":!0},{dropdown:h(()=>[o(k,{class:`add-menu`},{default:h(()=>[o(w,{disabled:``},{default:h(()=>[o(E,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.createWithClaude`))+` `,1),e(`span`,Ln,i(t.$t(`skill.menu.soon`)),1)]),_:1}),o(w,{onClick:t.openWrite},{default:h(()=>[o(D,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.write`)),1)]),_:1},8,[`onClick`]),o(w,{onClick:t.openUpload},{default:h(()=>[o(O,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.upload`)),1)]),_:1},8,[`onClick`])]),_:1})]),default:h(()=>[e(`span`,In,[o(S,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.create`))+` `,1),o(T,{class:`submenu-arrow`,size:14,"aria-hidden":`true`,focusable:`false`})])]),_:1})]),_:1})]),_:1})]),default:h(()=>[e(`button`,{class:`icon-btn`,"aria-label":t.$t(`skill.button.add`),title:t.$t(`skill.button.add`)},[o(S,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Fn)]),_:1})])]),t.searchOpen?(b(),c(`div`,Rn,[o(j,{ref:`searchInput`,modelValue:t.searchQuery,"onUpdate:modelValue":n[1]||=e=>t.searchQuery=e,class:`search-input`,size:`default`,placeholder:t.$t(`skill.placeholder.search`),onKeydown:l(t.closeSearch,[`escape`])},{prefix:h(()=>[o(x,{size:13,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`,`onKeydown`]),e(`button`,{class:`icon-btn icon-btn-sm`,"aria-label":t.$t(`common.button.close`),title:t.$t(`common.button.close`),onClick:n[2]||=(...e)=>t.closeSearch&&t.closeSearch(...e)},[o(M,{size:14,"aria-hidden":`true`,focusable:`false`})],8,zn)])):s(``,!0),p((b(),c(`div`,Bn,[e(`section`,Vn,[e(`button`,{class:`section-header`,onClick:n[3]||=e=>t.personalOpen=!t.personalOpen},[t.personalOpen?(b(),m(N,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(b(),m(T,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.personal`)),1)]),t.personalOpen?(b(),c(`ul`,Hn,[!t.loading&&t.filteredPersonal.length===0?(b(),c(`li`,Un,i(t.searchQuery?t.$t(`skill.empty.search`):t.$t(`skill.message.noSkills`)),1)):s(``,!0),(b(!0),c(u,null,v(t.filteredPersonal,e=>(b(),m(P,{key:e.id,skill:e,"selected-skill-id":t.selectedSkillId,"selected-path":t.selectedPath,expanded:t.expandedSkillIds.includes(e.id),onToggleExpand:t.toggleExpand,onSelectSkill:t.selectSkill,onSelectFile:t.selectFile},null,8,[`skill`,`selected-skill-id`,`selected-path`,`expanded`,`onToggleExpand`,`onSelectSkill`,`onSelectFile`]))),128))])):s(``,!0)]),t.globalSkills.length>0?(b(),c(`section`,Wn,[e(`button`,{class:`section-header`,onClick:n[4]||=e=>t.globalsOpen=!t.globalsOpen},[t.globalsOpen?(b(),m(N,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(b(),m(T,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.platform`)),1)]),t.globalsOpen?(b(),c(`ul`,Gn,[(b(!0),c(u,null,v(t.filteredGlobal,e=>(b(),m(P,{key:e.id,skill:e,"selected-skill-id":t.selectedSkillId,"selected-path":t.selectedPath,expanded:t.expandedSkillIds.includes(e.id),onToggleExpand:t.toggleExpand,onSelectSkill:t.selectSkill,onSelectFile:t.selectFile},null,8,[`skill`,`selected-skill-id`,`selected-path`,`expanded`,`onToggleExpand`,`onSelectSkill`,`onSelectFile`]))),128))])):s(``,!0)])):s(``,!0)])),[[B,t.loading]])]),e(`main`,Kn,[t.selectedSkill&&!t.selectedPath?(b(),c(u,{key:0},[e(`header`,qn,[e(`h3`,Jn,i(t.selectedSkill.slug),1),e(`div`,Yn,[o(F,{"model-value":t.selectedSkill.enabled,size:`default`,loading:t.togglingId===t.selectedSkill.id,onChange:n[5]||=e=>t.onToggleSkill(t.selectedSkill,!!e)},null,8,[`model-value`,`loading`]),t.selectedSkill.source===`global`?s(``,!0):(b(),m(A,{key:0,trigger:`click`,placement:`bottom-end`},{dropdown:h(()=>[o(k,null,{default:h(()=>[o(w,{onClick:n[6]||=e=>t.onDelete(t.selectedSkill)},{default:h(()=>[o(L,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.delete`)),1)]),_:1})]),_:1})]),default:h(()=>[e(`button`,{class:`icon-btn`,"aria-label":t.$t(`skill.button.more`),title:t.$t(`skill.button.more`)},[o(I,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Xn)]),_:1}))])]),e(`div`,Zn,[e(`div`,Qn,[e(`div`,$n,[e(`span`,er,i(t.$t(`skill.meta.addedBy`)),1),e(`span`,tr,i(t.selectedSkill.source===`global`?t.$t(`skill.meta.platform`):t.$t(`skill.meta.you`)),1)]),e(`div`,nr,[e(`span`,rr,i(t.$t(`skill.meta.lastUpdated`)),1),e(`span`,ir,i(t.$dayjs.format(t.selectedSkill.updated_at)),1)]),t.selectedSkill.required_connections.length?(b(),c(`div`,ar,[e(`span`,or,i(t.$t(`skill.field.requiredConnections`)),1),e(`div`,sr,[(b(!0),c(u,null,v(t.selectedSkill.required_connections,e=>(b(),m(ee,{key:e,size:`small`,type:`info`},{default:h(()=>[r(i(e),1)]),_:2},1024))),128))])])):s(``,!0)]),t.selectedSkill.description?(b(),c(`div`,cr,[e(`div`,lr,[e(`span`,ur,i(t.$t(`skill.field.description`)),1),t.selectedSkill.when_to_use?(b(),m(ne,{key:0,content:t.selectedSkill.when_to_use,placement:`top`},{default:h(()=>[o(te,{class:`meta-info-icon`,size:12,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`content`])):s(``,!0)]),e(`p`,null,i(t.selectedSkill.description),1)])):s(``,!0)]),e(`div`,dr,[(b(),m(R,{key:`${t.selectedSkill.id}:SKILL.md`,"skill-id":t.selectedSkill.id,path:`SKILL.md`,editable:t.selectedSkill.source===`upload`,onSave:t.onSaveContent},null,8,[`skill-id`,`editable`,`onSave`]))])],64)):t.selectedSkill&&t.selectedPath?(b(),m(R,{key:`${t.selectedSkill.id}:${t.selectedPath}`,"skill-id":t.selectedSkill.id,path:t.selectedPath,editable:!1},null,8,[`skill-id`,`path`])):(b(),c(`div`,fr,[o(re,{class:`right-empty-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.selectSkill`)),1)]))])]),o(ie,{modelValue:t.uploadVisible,"onUpdate:modelValue":n[7]||=e=>t.uploadVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),o(ae,{modelValue:t.writeVisible,"onUpdate:modelValue":n[8]||=e=>t.writeVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),o(z,{modelValue:t.browseVisible,"onUpdate:modelValue":n[9]||=e=>t.browseVisible=e,onInstalled:t.onCreated},null,8,[`modelValue`,`onInstalled`])])}var mr=U(Tn,[[`render`,pr],[`__scopeId`,`data-v-da68d0c2`]]);export{mr as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,K as a,L as o,M as s,N as c,S as l,T as u,at as d,b as f,ht as p,j as m,mt as h,ot as g,qt as _,rt as v,st as y,tt as b,z as x}from"./vendor-chart-Dw-P17PN.js";import{r as S,t as C}from"./select--z-fac6_.js";import{n as w,t as T}from"./tabs-CMeHhbQd.js";import{t as E}from"./tooltip-CVVApYjJ.js";import{n as D,r as O,t as k}from"./dropdown-Dxiw3zEy.js";import{t as A}from"./pagination-Bzi2EMHv.js";import{t as j}from"./switch-CU7Lbydn.js";import{t as M}from"./arrow-down-B47oLEZg.js";import{t as N}from"./arrow-left-xCa4y53k.js";import{t as P}from"./book-open-VOA-qRz-.js";import{t as F}from"./chevron-down-BumkMWkr.js";import{t as I}from"./chevron-right-DJAkv6gb.js";import{t as L}from"./circle-check-D5h_jiB2.js";import{t as ee}from"./circle-question-mark-PRKtc95j.js";import{t as te}from"./clipboard-list-DS2oQz8T.js";import{t as ne}from"./code-DIu2zrn0.js";import{t as R}from"./copy-BV2l4S4i.js";import{t as re}from"./ellipsis-Dne0PaxK.js";import{t as ie}from"./eye-uumNqt6F.js";import{t as ae}from"./file-text-BD_ZgyAJ.js";import{t as z}from"./file-B6BY8JCh.js";import{t as B}from"./folder-D8OqMpU-.js";import{t as oe}from"./image-4hDRDwRY.js";import{t as se}from"./lock-HFF7LqQ6.js";import{t as ce}from"./plus-Yte47cek.js";import{n as le,t as ue}from"./store-f5a0TlJm.js";import{t as de}from"./search-Dd9GL0kL.js";import{t as fe}from"./trash-2-B7h9iX5Q.js";import{t as pe}from"./triangle-alert-C_NcfP7e.js";import{t as me}from"./upload-DRjQvPEd.js";import{t as he}from"./wand-sparkles-BQfGRD0P.js";import{Ai as V,Ci as H,E as U,Ei as W,Ji as G,Li as ge,Si as _e,Ti as K,bi as ve,fi as ye,gi as be,gr as q,hi as xe,mi as Se,ui as Ce,wi as we,zi as J}from"./index-dzU0SACS.js";import{a as Te,c as Ee,d as De,f as Oe,i as ke,l as Ae,m as Y,n as je,o as Me,p as Ne,r as Pe,s as Fe,t as Ie,u as Le}from"./vendor-highlight-BHrfT4-E.js";import{t as Re}from"./index.es-B_JRhb1z.js";import{t as ze}from"./VueMarkdown-CiiRjbWs.js";var Be=H(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),Ve=H(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),He=H(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),Ue=H(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),We=H(`square-plus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),X=()=>({baseURL:`${Ce()}/api/v1`}),Z=new class{key=`skills/installed`;async list(){return q.get(`/${this.key}/`,X())}async get(e){return q.get(`/${this.key}/${e}/`,X())}async createMarkdown(e){return q.post(`/${this.key}/`,e,X())}async createTarball(e){let t=new FormData;return t.append(`tarball`,e),q.post(`/${this.key}/`,t,{...X(),headers:{"Content-Type":`multipart/form-data`}})}async update(e,t){return q.patch(`/${this.key}/${e}/`,t,X())}async remove(e){return q.delete(`/${this.key}/${e}/`,X())}async enable(e){return q.post(`/${this.key}/${e}/enable/`,void 0,X())}async disable(e){return q.post(`/${this.key}/${e}/disable/`,void 0,X())}async fetchFile(e,t){let n=await q.get(`/${this.key}/${e}/files/`,{...X(),params:{path:t},responseType:`arraybuffer`}),r=n.headers[`content-type`]||`application/octet-stream`;return{blob:new Blob([n.data],{type:r}),contentType:r}}},Q=new class{key=`skills`;async list(e={}){return q.get(`/${this.key}/`,{...X(),params:e})}async get(e){return q.get(`/${this.key}/${e}/`,X())}async categories(){return q.get(`/${this.key}/categories/`,X())}async install(e,t={}){return q.post(`/${this.key}/${e}/install/`,t,X())}};function Ge(){let e=new Set;xe()&&e.add(`desktop`),be()&&e.add(`ios`),Se()&&e.add(`android`),ve()&&e.add(`web`);let t=ye();if(t===`mac`)e.add(`mac`);else if(t===`windows`)e.add(`windows`);else if(typeof navigator<`u`){let t=navigator.userAgent||``,n=navigator.userAgentData?.platform,r=/macintosh/i.test(t)&&(navigator.maxTouchPoints||0)>1;!be()&&!r&&(n===`macOS`||/mac os x|macintosh/i.test(t))&&e.add(`mac`),(n===`Windows`||/windows nt/i.test(t))&&e.add(`windows`)}return e}var Ke=new Set([`mac`,`windows`,`desktop`,`web`,`ios`,`android`]);function qe(e){let t=e.filter(e=>Ke.has(e));if(!t.length)return!0;let n=Ge();return t.some(e=>n.has(e))}Y.registerLanguage(`bash`,Ne),Y.registerLanguage(`json`,Oe),Y.registerLanguage(`markdown`,De),Y.registerLanguage(`python`,Le),Y.registerLanguage(`shell`,Ae),Y.registerLanguage(`yaml`,Ee),Y.registerAliases([`yml`],{languageName:`yaml`}),Y.registerAliases([`py`],{languageName:`python`}),Y.registerAliases([`sh`,`zsh`],{languageName:`bash`});var Je=12,Ye=x({name:`BrowseSkillsDialog`,components:{VueMarkdown:ze,ElDialog:V,ElInput:G,ElButton:J,ElPagination:A,ElSelect:S,ElOption:C,FontAwesomeIcon:Re,AddIcon:ce,BackIcon:N,DownIcon:M,InstallIcon:Be,LockIcon:se,SearchIcon:de,SuccessIcon:L},directives:{loading:W},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`installed`],data(){return{loading:!1,installing:!1,items:[],total:0,currentPage:1,searchQuery:``,namespaceFilter:``,sortBy:`popular`,selectedItem:null,searchTimer:null,knownNamespaces:[],publisherByNamespace:{}}},computed:{pageSize(){return Je},namespaceOptions(){let e=new Set(this.knownNamespaces);for(let t of this.items)e.add(t.namespace);return Array.from(e).sort().map(e=>({value:e,label:this.publisherForNamespace(e)}))},detailBody(){return this.selectedItem?this.selectedItem.content.replace(/^---\n[\s\S]*?\n---\n?/,``):``}},methods:{onOpen(){this.selectedItem=null,this.searchQuery=``,this.namespaceFilter=``,this.sortBy=`popular`,this.currentPage=1,this.knownNamespaces=[],this.publisherByNamespace={},this.loadFacets(),this.reload()},openDetail(e){this.selectedItem=e},async loadFacets(){try{let{data:e}=await Q.categories(),t=new Set;for(let n of e.namespaces)t.add(n.namespace);this.knownNamespaces=Array.from(t).sort()}catch(e){console.warn(`failed to load skill catalog facets`,e)}},reloadFromFirstPage(){this.currentPage=1,this.reload()},onPageChange(e){this.currentPage=e,this.reload(),this.$nextTick(()=>{let e=this.$el.querySelector(`.directory-grid-wrapper`);e&&(e.scrollTop=0)})},onSearchInput(){this.searchTimer!==null&&window.clearTimeout(this.searchTimer),this.searchTimer=window.setTimeout(()=>{this.searchTimer=null,this.reloadFromFirstPage()},250)},async reload(){this.loading=!0;try{let{data:e}=await Q.list({q:this.searchQuery.trim()||void 0,namespace:this.namespaceFilter||void 0,sort:this.sortBy,limit:this.pageSize,offset:(this.currentPage-1)*this.pageSize});this.items=e.items,this.total=e.total;for(let t of e.items)t.publisher&&(this.publisherByNamespace[t.namespace]=t.publisher)}catch(e){console.error(e),K.error(this.$t(`skill.directory.loadFailed`))}finally{this.loading=!1}},async onInstall(e){if(!this.installing&&!e.installed){if(!this.canInstallOnSurface(e)){K.warning(this.$t(`skill.directory.surfaceBlocked`,{platforms:this.surfaceLabels(e)}));return}this.installing=!0;try{let{data:t}=await Q.install(e.id);K.success(this.$t(`skill.directory.installSuccess`,{name:e.slug})),this.$emit(`installed`,t.id),e.installed=!0,e.install_count+=1}catch(t){let n=this.extractError(t);n.includes(`already exists`)?(e.installed=!0,K.warning(this.$t(`skill.directory.alreadyInstalled`,{name:e.slug}))):K.error(this.$t(`skill.directory.installFailed`,{detail:n}))}finally{this.installing=!1}}},extractError(e){return e?.response?.data?.detail||String(e)||`unknown error`},formatCount(e){return e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)},publisherForNamespace(e){if(this.publisherByNamespace[e])return this.publisherByNamespace[e];let t=this.items.find(t=>t.namespace===e);return t?t.publisher:e},restrictedSurfaces(e){let t=e.frontmatter?.surfaces;return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim().toLowerCase()):[]},surfaceLabel(e){let t=`skill.directory.surface.${e}`,n=this.$t(t);return n===t?e:n},surfaceLabels(e){return this.restrictedSurfaces(e).map(e=>this.surfaceLabel(e)).join(` / `)},canInstallOnSurface(e){return qe(this.restrictedSurfaces(e))}}}),Xe={class:`directory`},Ze={class:`directory-main`},Qe={class:`directory-header`},$e={class:`directory-controls`},et={class:`directory-grid-wrapper`},tt={key:0,class:`directory-empty`},nt={key:1,class:`directory-grid`},rt=[`onClick`],it={class:`directory-card-head`},at={class:`directory-card-title`},ot=[`title`],st=[`title`],ct=[`aria-label`,`title`,`onClick`],lt=[`title`],ut={class:`directory-card-meta`},dt={class:`directory-card-publisher`},ft={key:0,class:`directory-card-count`},pt=[`title`],mt={class:`directory-card-desc`},ht={key:0,class:`directory-footer`},gt={class:`directory-detail-head`},_t={class:`directory-detail-actions`},vt=[`href`],yt={class:`directory-detail-body`},bt={class:`directory-detail-title`},xt={class:`directory-detail-meta`},St={key:0},Ct={key:1},wt=[`title`],Tt={class:`directory-detail-desc`};function Et(a,l,f,_,y,x){let S=d(`search-icon`),C=d(`el-input`),w=d(`el-option`),T=d(`el-select`),E=d(`success-icon`),D=d(`lock-icon`),O=d(`add-icon`),k=d(`down-icon`),A=d(`el-pagination`),j=d(`back-icon`),M=d(`font-awesome-icon`),N=d(`el-button`),P=d(`install-icon`),F=d(`vue-markdown`),I=d(`el-dialog`),L=g(`loading`);return b(),m(I,{"model-value":a.modelValue,title:a.$t(`skill.dialog.directoryTitle`),width:`min(960px, 94vw)`,"align-center":``,class:`directory-dialog`,"close-on-click-modal":!a.installing,"show-close":!a.installing,"onUpdate:modelValue":l[5]||=e=>a.$emit(`update:modelValue`,e),onOpen:a.onOpen},{default:h(()=>[e(`div`,Xe,[e(`main`,Ze,[a.selectedItem?(b(),c(u,{key:1},[e(`header`,gt,[e(`button`,{class:`directory-back-btn`,onClick:l[3]||=e=>a.selectedItem=null},[o(j,{size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.back`)),1)]),e(`div`,_t,[a.selectedItem.source_url?(b(),c(`a`,{key:0,href:a.selectedItem.source_url,target:`_blank`,class:`directory-link`},[o(M,{icon:`fa-brands fa-github`}),r(` `+i(a.$t(`skill.directory.viewSource`)),1)],8,vt)):s(``,!0),a.selectedItem.installed?(b(),m(N,{key:1,disabled:``,type:`success`,plain:``},{default:h(()=>[o(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.installed`)),1)]),_:1})):a.selectedItem.installable&&!a.canInstallOnSurface(a.selectedItem)?(b(),m(N,{key:2,disabled:``,title:a.$t(`skill.directory.surfaceBlocked`,{platforms:a.surfaceLabels(a.selectedItem)})},{default:h(()=>[o(D,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.surfaceUnavailable`)),1)]),_:1},8,[`title`])):a.selectedItem.installable?(b(),m(N,{key:3,type:`primary`,loading:a.installing,onClick:l[4]||=e=>a.onInstall(a.selectedItem)},{default:h(()=>[o(P,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.install`)),1)]),_:1},8,[`loading`])):(b(),m(N,{key:4,disabled:``,title:a.selectedItem.license},{default:h(()=>[o(D,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.selectedItem.license||a.$t(`skill.directory.notInstallable`)),1)]),_:1},8,[`title`]))])]),e(`div`,yt,[e(`h2`,bt,`/`+i(a.selectedItem.slug),1),e(`div`,xt,[e(`span`,null,[e(`strong`,null,i(a.$t(`skill.meta.addedBy`))+`:`,1),r(` `+i(a.selectedItem.publisher),1)]),a.selectedItem.license?(b(),c(`span`,St,[e(`strong`,null,i(a.$t(`skill.directory.license`))+`:`,1),r(` `+i(a.selectedItem.license),1)])):s(``,!0),a.selectedItem.version?(b(),c(`span`,Ct,`v`+i(a.selectedItem.version),1)):s(``,!0),a.surfaceLabels(a.selectedItem)?(b(),c(`span`,{key:2,class:`directory-detail-surface`,title:a.$t(`skill.directory.surfaceHint`)},i(a.$t(`skill.directory.surfaceOnly`,{platforms:a.surfaceLabels(a.selectedItem)})),9,wt)):s(``,!0)]),e(`p`,Tt,i(a.selectedItem.description),1),o(F,{class:`directory-detail-content`,source:a.detailBody,sanitize:``},null,8,[`source`])])],64)):(b(),c(u,{key:0},[e(`header`,Qe,[o(C,{modelValue:a.searchQuery,"onUpdate:modelValue":l[0]||=e=>a.searchQuery=e,class:`directory-search`,size:`default`,clearable:``,placeholder:a.$t(`skill.directory.searchPlaceholder`),onInput:a.onSearchInput},{prefix:h(()=>[o(S,{size:14,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`,`onInput`]),e(`div`,$e,[o(T,{modelValue:a.namespaceFilter,"onUpdate:modelValue":l[1]||=e=>a.namespaceFilter=e,class:`directory-select`,placeholder:a.$t(`skill.directory.allPublishers`),clearable:``,size:`default`,onChange:a.reloadFromFirstPage},{default:h(()=>[(b(!0),c(u,null,v(a.namespaceOptions,e=>(b(),m(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),o(T,{modelValue:a.sortBy,"onUpdate:modelValue":l[2]||=e=>a.sortBy=e,class:`directory-select directory-select-sm`,size:`default`,onChange:a.reloadFromFirstPage},{default:h(()=>[o(w,{label:a.$t(`skill.directory.sort.popular`),value:`popular`},null,8,[`label`]),o(w,{label:a.$t(`skill.directory.sort.recent`),value:`recent`},null,8,[`label`]),o(w,{label:a.$t(`skill.directory.sort.name`),value:`name`},null,8,[`label`])]),_:1},8,[`modelValue`,`onChange`])])]),p((b(),c(`div`,et,[!a.loading&&a.total===0?(b(),c(`p`,tt,i(a.$t(`skill.directory.empty`)),1)):(b(),c(`div`,nt,[(b(!0),c(u,null,v(a.items,l=>(b(),c(`article`,{key:l.id,class:n([`directory-card`,{"is-installed":l.installed}]),onClick:e=>a.openDetail(l)},[e(`div`,it,[e(`span`,at,`/`+i(l.slug),1),l.installed?(b(),c(`span`,{key:0,class:`directory-card-action is-installed`,title:a.$t(`skill.directory.installed`)},[o(E,{size:16,"aria-hidden":`true`,focusable:`false`})],8,ot)):l.installable&&!a.canInstallOnSurface(l)?(b(),c(`span`,{key:1,class:`directory-card-locked`,title:a.$t(`skill.directory.surfaceBlocked`,{platforms:a.surfaceLabels(l)})},[o(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,st)):l.installable?(b(),c(`button`,{key:2,class:`directory-card-action`,"aria-label":a.$t(`skill.directory.install`),title:a.$t(`skill.directory.install`),onClick:t(e=>a.onInstall(l),[`stop`])},[o(O,{size:16,"aria-hidden":`true`,focusable:`false`})],8,ct)):(b(),c(`span`,{key:3,class:`directory-card-locked`,title:l.license},[o(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,lt))]),e(`div`,ut,[e(`span`,dt,i(l.publisher),1),l.install_count>0?(b(),c(`span`,ft,[o(k,{size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.formatCount(l.install_count)),1)])):s(``,!0),a.surfaceLabels(l)?(b(),c(`span`,{key:1,class:`directory-card-surface`,title:a.$t(`skill.directory.surfaceHint`)},i(a.surfaceLabels(l)),9,pt)):s(``,!0)]),e(`p`,mt,i(l.description),1)],10,rt))),128))]))])),[[L,a.loading]]),a.total>a.pageSize?(b(),c(`footer`,ht,[o(A,{"current-page":a.currentPage,"page-size":a.pageSize,total:a.total,"pager-count":5,background:``,layout:`prev, pager, next, total`,onCurrentChange:a.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onCurrentChange`])])):s(``,!0)],64))])])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`show-close`,`onOpen`])}var Dt=U(Ye,[[`render`,Et],[`__scopeId`,`data-v-d346d23f`]]);Y.registerLanguage(`bash`,Ne),Y.registerLanguage(`css`,Fe),Y.registerLanguage(`go`,Me),Y.registerLanguage(`javascript`,Te),Y.registerLanguage(`json`,Oe),Y.registerLanguage(`markdown`,De),Y.registerLanguage(`python`,Le),Y.registerLanguage(`rust`,ke),Y.registerLanguage(`shell`,Ae),Y.registerLanguage(`sql`,Pe),Y.registerLanguage(`typescript`,je),Y.registerLanguage(`xml`,Ie),Y.registerLanguage(`html`,Ie),Y.registerLanguage(`yaml`,Ee),Y.registerAliases([`yml`],{languageName:`yaml`}),Y.registerAliases([`ts`,`tsx`],{languageName:`typescript`}),Y.registerAliases([`js`,`jsx`],{languageName:`javascript`}),Y.registerAliases([`py`],{languageName:`python`}),Y.registerAliases([`rs`],{languageName:`rust`}),Y.registerAliases([`sh`,`zsh`],{languageName:`bash`});var $=1e6;function Ot(e,t){let n=(e.split(`.`).pop()||``).toLowerCase();return n===`md`||t.startsWith(`text/markdown`)?`markdown`:n===`html`||n===`htm`||t.startsWith(`text/html`)?`html`:t.startsWith(`image/`)||[`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`].includes(n)?`image`:t.startsWith(`text/`)||[`json`,`application/json`].includes(t.split(`;`)[0])?n?`code`:`text`:`binary`}function kt(e){let t=(e.split(`.`).pop()||``).toLowerCase();return Y.getLanguage(t)?t:`plain`}var At=x({name:`SkillFilePreview`,components:{ElButton:J,ElTooltip:E,ElTabs:w,ElTabPane:T,CodeIcon:ne,CopyIcon:R,FileIcon:z,SaveIcon:Ue,ViewIcon:ie,WarningIcon:pe,VueMarkdown:ze},directives:{loading:W},props:{skillId:{type:String,required:!0},path:{type:String,required:!0},editable:{type:Boolean,default:!1}},emits:[`save`],data(){return{MAX_PREVIEW_BYTES:$,loading:!1,error:``,contentType:``,size:0,textContent:``,imageUrl:``,truncated:!1,viewMode:`rendered`,dirty:!1,saving:!1}},computed:{kind(){return this.path?Ot(this.path,this.contentType):`text`},canRender(){return this.kind===`markdown`||this.kind===`html`},hljsLang(){return`language-${kt(this.path)}`},truncatedText(){return this.textContent}},watch:{path:{handler(){this.fetch()},immediate:!0}},beforeUnmount(){this.imageUrl&&URL.revokeObjectURL(this.imageUrl)},methods:{humanSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`},async fetch(){if(this.path){this.loading=!0,this.error=``,this.textContent=``,this.truncated=!1,this.dirty=!1,this.imageUrl&&=(URL.revokeObjectURL(this.imageUrl),``);try{let{blob:e,contentType:t}=await Z.fetchFile(this.skillId,this.path);this.contentType=t,this.size=e.size;let n=Ot(this.path,t);if(n===`image`)this.imageUrl=URL.createObjectURL(e);else if(n!==`binary`){let t=await e.text();t.length>$&&(t=t.slice(0,$),this.truncated=!0),this.textContent=t,this.viewMode=n===`markdown`||n===`html`?`rendered`:`source`}}catch(e){let t=e,n=t?.response?.status,r=t?.response?.data?.detail||String(e);this.error=n?`(${n}) ${r}`:r}finally{this.loading=!1,this.$nextTick(()=>this.applyHighlight())}}},applyHighlight(){let e=this.$refs.codeEl;e&&this.kind===`code`&&this.viewMode!==`rendered`&&(delete e.dataset.highlighted,Y.highlightElement(e))},async onCopy(){if(this.textContent)try{await navigator.clipboard.writeText(this.textContent),K.success(this.$t(`skill.preview.copied`))}catch{K.error(this.$t(`skill.preview.copyFailed`))}},async onSave(){this.saving=!0;try{await new Promise((e,t)=>{this.$emit(`save`,this.textContent,{resolve:e,reject:t})}),this.dirty=!1}catch{}finally{this.saving=!1}}}}),jt={class:`preview-root`},Mt={class:`toolbar`},Nt={class:`path-display`},Pt={key:0,class:`size-display`},Ft={class:`body`},It={key:0,class:`error`},Lt=[`srcdoc`],Rt={key:3,class:`image-pane`},zt=[`src`,`alt`],Bt={key:4,class:`binary`},Vt=[`placeholder`],Ht={key:6,class:`source-pane`},Ut={key:7,class:`truncated-warning`};function Wt(t,a,l,u,_,v){let y=d(`save-icon`),x=d(`el-button`),S=d(`copy-icon`),C=d(`el-tooltip`),w=d(`view-icon`),T=d(`el-tab-pane`),E=d(`code-icon`),D=d(`el-tabs`),O=d(`warning-icon`),k=d(`vue-markdown`),A=d(`file-icon`),j=g(`loading`);return p((b(),c(`div`,jt,[e(`div`,Mt,[e(`span`,Nt,i(t.path||`—`),1),t.size?(b(),c(`span`,Pt,i(t.humanSize(t.size)),1)):s(``,!0),a[3]||=e(`span`,{class:`toolbar-spacer`},null,-1),t.editable?(b(),m(x,{key:1,type:`primary`,size:`small`,disabled:!t.dirty||t.saving,loading:t.saving,onClick:t.onSave},{default:h(()=>[o(y,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.save`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])):s(``,!0),o(C,{content:t.$t(`skill.preview.copy`),placement:`bottom`},{default:h(()=>[o(x,{size:`small`,circle:``,disabled:!t.textContent,"aria-label":t.$t(`skill.preview.copy`),title:t.$t(`skill.preview.copy`),onClick:t.onCopy},{default:h(()=>[o(S,{size:16,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`disabled`,`aria-label`,`title`,`onClick`])]),_:1},8,[`content`])]),t.canRender?(b(),m(D,{key:0,modelValue:t.viewMode,"onUpdate:modelValue":a[0]||=e=>t.viewMode=e,class:`view-tabs`},{default:h(()=>[o(T,{name:`rendered`},{label:h(()=>[o(w,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewRendered`)),1)]),_:1}),o(T,{name:`source`},{label:h(()=>[o(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewSource`)),1)]),_:1})]),_:1},8,[`modelValue`])):s(``,!0),e(`div`,Ft,[t.error?(b(),c(`div`,It,[o(O,{class:`mr-2`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.error),1)])):t.kind===`markdown`&&t.viewMode===`rendered`?(b(),m(k,{key:1,class:`markdown-rendered`,source:t.textContent,sanitize:``},null,8,[`source`])):t.kind===`html`&&t.viewMode===`rendered`?(b(),c(`iframe`,{key:2,ref:`htmlFrame`,class:`html-frame`,sandbox:``,srcdoc:t.textContent},null,8,Lt)):t.kind===`image`?(b(),c(`div`,Rt,[e(`img`,{src:t.imageUrl,alt:t.path,class:`image-content`},null,8,zt)])):t.kind===`binary`?(b(),c(`div`,Bt,[o(A,{class:`binary-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.binary`,{type:t.contentType})),1)])):t.editable?p((b(),c(`textarea`,{key:5,"onUpdate:modelValue":a[1]||=e=>t.textContent=e,class:`source-editor`,spellcheck:`false`,placeholder:t.$t(`skill.placeholder.content`),onInput:a[2]||=e=>t.dirty=!0},null,40,Vt)),[[f,t.textContent]]):(b(),c(`pre`,Ht,[e(`code`,{ref:`codeEl`,class:n(t.hljsLang)},i(t.truncatedText),3)])),t.truncated?(b(),c(`p`,Ut,i(t.$t(`skill.preview.truncated`,{size:t.humanSize(t.MAX_PREVIEW_BYTES)})),1)):s(``,!0)])])),[[j,t.loading]])}var Gt=U(At,[[`render`,Wt],[`__scopeId`,`data-v-ec0a447e`]]),Kt=new Set([`py`,`ts`,`tsx`,`js`,`jsx`,`json`,`yaml`,`yml`,`sh`,`bash`,`zsh`,`css`,`html`,`sql`,`go`,`rs`,`rb`,`java`,`cpp`,`c`,`h`,`toml`]),qt=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function Jt(e){let t=e.split(`/`).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();return t===`SKILL.md`?P:n===`md`?ae:qt.has(n)?oe:Kt.has(n)?He:z}function Yt(e){let t=new Map;t.set(``,new Map);let n=(e,n)=>{let r=t.get(e);r||(r=new Map,t.set(e,r));let i=e?`${e}/${n}`:n,a=r.get(n);return a||(a={label:n,path:i,isLeaf:!1,children:[]},r.set(n,a),t.set(i,new Map)),a};for(let r of e){let e=r.split(`/`).filter(Boolean);if(e.length===0)continue;let i=e[e.length-1],a=e.slice(0,-1),o=``;for(let e of a)o=n(o,e).path;let s={label:i,path:r,isLeaf:!0},c=t.get(o);c||(c=new Map,t.set(o,c)),c.set(i,s)}let r=e=>{let n=t.get(e);if(!n)return[];let i=Array.from(n.values());for(let e of i)e.isLeaf||(e.children=r(e.path));return i.sort((e,t)=>e.path===`SKILL.md`?-1:t.path===`SKILL.md`?1:e.isLeaf===t.isLeaf?e.label.localeCompare(t.label):e.isLeaf?1:-1)};return r(``)}var Xt=x({name:`FileNode`,components:{ExpandDownIcon:F,ExpandRightIcon:I,FontAwesomeIcon:Re},props:{node:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},skill:{type:Object,required:!0},depth:{type:Number,default:1}},emits:[`select-file`],data(){return{open:!0}},computed:{indent(){return 8+this.depth*16},isActive(){return this.node.isLeaf&&this.selectedSkillId===this.skill.id&&this.selectedPath===this.node.path}},methods:{isHtmlFile(e){return e.isLeaf&&e.path.toLowerCase().endsWith(`.html`)},iconFor(e){return e.isLeaf?Jt(e.path):B},onClick(){this.node.isLeaf?this.$emit(`select-file`,this.node.path):this.open=!this.open}}}),Zt=[`aria-label`,`title`],Qt={key:1,class:`node-chevron-spacer`},$t={class:`node-label`},en={key:0,class:`children`};function tn(r,a,o,l,f,p){let h=d(`expand-down-icon`),g=d(`expand-right-icon`),x=d(`font-awesome-icon`),S=d(`file-node`,!0);return b(),c(`li`,null,[e(`div`,{class:n([`file-node`,{active:r.isActive}]),style:_({paddingLeft:r.indent+`px`}),onClick:a[1]||=(...e)=>r.onClick&&r.onClick(...e)},[r.node.isLeaf?(b(),c(`span`,Qt)):(b(),c(`button`,{key:0,class:`node-chevron`,"aria-label":r.$t(r.open?`common.button.collapse`:`common.button.expand`),title:r.$t(r.open?`common.button.collapse`:`common.button.expand`),onClick:a[0]||=t(e=>r.open=!r.open,[`stop`])},[r.open?(b(),m(h,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(b(),m(g,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,Zt)),r.isHtmlFile(r.node)?(b(),m(x,{key:2,icon:`fa-brands fa-html5`,class:`node-icon`})):(b(),m(y(r.iconFor(r.node)),{key:3,class:`node-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),e(`span`,$t,i(r.node.label),1)],6),!r.node.isLeaf&&r.open?(b(),c(`ul`,en,[(b(!0),c(u,null,v(r.node.children||[],e=>(b(),m(S,{key:e.path,node:e,"selected-skill-id":r.selectedSkillId,"selected-path":r.selectedPath,skill:r.skill,depth:r.depth+1,onSelectFile:a[2]||=e=>r.$emit(`select-file`,e)},null,8,[`node`,`selected-skill-id`,`selected-path`,`skill`,`depth`]))),128))])):s(``,!0)])}var nn=x({name:`SkillRow`,components:{ExpandDownIcon:F,ExpandRightIcon:I,SkillIcon:le,FileNode:U(Xt,[[`render`,tn],[`__scopeId`,`data-v-5240087b`]])},props:{skill:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},expanded:{type:Boolean,default:!1}},emits:[`toggle-expand`,`select-skill`,`select-file`],computed:{tree(){return Yt(this.skill.asset_bundle_files)},hasChildren(){return this.skill.asset_bundle_files.length>1},isSkillSelected(){return this.selectedSkillId===this.skill.id&&!this.selectedPath}},methods:{onSelectFile(e){this.$emit(`select-file`,this.skill,e)}}}),rn={class:`skill-row-wrapper`},an=[`aria-label`,`title`],on={key:1,class:`row-chevron-spacer`},sn=[`title`],cn={key:0,class:`file-list`};function ln(r,a,l,f,p,h){let g=d(`expand-down-icon`),_=d(`expand-right-icon`),y=d(`skill-icon`),x=d(`file-node`);return b(),c(`li`,rn,[e(`div`,{class:n([`skill-row`,{active:r.isSkillSelected}]),onClick:a[1]||=e=>r.$emit(`select-skill`,r.skill)},[r.hasChildren?(b(),c(`button`,{key:0,class:`row-chevron`,"aria-label":r.$t(r.expanded?`common.button.collapse`:`common.button.expand`),title:r.$t(r.expanded?`common.button.collapse`:`common.button.expand`),onClick:a[0]||=t(e=>r.$emit(`toggle-expand`,r.skill),[`stop`])},[r.expanded?(b(),m(g,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(b(),m(_,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,an)):(b(),c(`span`,on)),o(y,{class:`row-icon`,size:16,"aria-hidden":`true`,focusable:`false`}),e(`span`,{class:`row-label`,title:r.skill.name},i(r.skill.slug),9,sn)],2),r.expanded&&r.hasChildren?(b(),c(`ul`,cn,[(b(!0),c(u,null,v(r.tree,e=>(b(),m(x,{key:e.path,node:e,"selected-skill-id":r.selectedSkillId,"selected-path":r.selectedPath,skill:r.skill,depth:1,onSelectFile:r.onSelectFile},null,8,[`node`,`selected-skill-id`,`selected-path`,`skill`,`onSelectFile`]))),128))])):s(``,!0)])}var un=U(nn,[[`render`,ln],[`__scopeId`,`data-v-231c2ce1`]]),dn=10*1024*1024,fn=/\.(tar\.gz|tgz|tar|zip|md)$/i,pn=x({name:`UploadSkillDialog`,components:{ElDialog:V,ElButton:J,AddFileIcon:We,CloudUploadIcon:Ve},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{file:null,isDragging:!1,uploading:!1}},methods:{onVisibleChange(e){this.$emit(`update:modelValue`,e)},onClose(){this.uploading||this.$emit(`update:modelValue`,!1)},reset(){this.file=null,this.isDragging=!1;let e=this.$refs.fileInput;e&&(e.value=``)},humanSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`},onPickFile(){this.uploading||this.$refs.fileInput?.click()},onFilePicked(e){let t=e.target.files?.[0]||null;this.acceptFile(t)},onDrop(e){this.isDragging=!1;let t=e.dataTransfer?.files?.[0]||null;this.acceptFile(t)},acceptFile(e){if(!e){this.file=null;return}if(e.size>dn){K.error(this.$t(`skill.message.fileTooLarge`));return}if(!fn.test(e.name)){K.error(this.$t(`skill.message.fileTypeWrong`));return}this.file=e},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},async onSubmit(){if(this.file){this.uploading=!0;try{if(/\.md$/i.test(this.file.name)){let e=await this.file.text(),{data:t}=await Z.createMarkdown({content:e});K.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,t.id)}else{let{data:e}=await Z.createTarball(this.file);K.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,e.id)}this.$emit(`update:modelValue`,!1)}catch(e){K.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)}))}finally{this.uploading=!1}}}}}),mn={key:0,class:`dropzone-hint`},hn={key:1,class:`dropzone-file`},gn={class:`dropzone-file-name`},_n={class:`dropzone-file-size`},vn={class:`requirements`},yn={class:`requirements-title`};function bn(a,s,l,u,f,p){let g=d(`add-file-icon`),_=d(`el-button`),v=d(`cloud-upload-icon`),y=d(`el-dialog`);return b(),m(y,{"model-value":a.modelValue,title:a.$t(`skill.dialog.uploadTitle`),width:`min(520px, 94vw)`,"align-center":``,"close-on-click-modal":!a.uploading,"close-on-press-escape":!a.uploading,"show-close":!a.uploading,"onUpdate:modelValue":a.onVisibleChange,onClosed:a.reset},{footer:h(()=>[o(_,{disabled:a.uploading,onClick:a.onClose},{default:h(()=>[r(i(a.$t(`skill.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`]),o(_,{type:`primary`,loading:a.uploading,disabled:!a.file,onClick:a.onSubmit},{default:h(()=>[o(v,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.button.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:h(()=>[e(`input`,{ref:`fileInput`,type:`file`,accept:`.tar.gz,.tgz,.tar,.zip,.md,application/gzip,application/zip,application/x-tar,text/markdown`,hidden:``,onChange:s[0]||=(...e)=>a.onFilePicked&&a.onFilePicked(...e)},null,544),e(`div`,{class:n([`dropzone`,{"is-dragging":a.isDragging,"has-file":!!a.file}]),onClick:s[1]||=(...e)=>a.onPickFile&&a.onPickFile(...e),onDragover:s[2]||=t(e=>a.isDragging=!0,[`prevent`]),onDragleave:s[3]||=t(e=>a.isDragging=!1,[`prevent`]),onDrop:s[4]||=t((...e)=>a.onDrop&&a.onDrop(...e),[`prevent`])},[o(g,{class:`dropzone-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),a.file?(b(),c(`p`,hn,[e(`span`,gn,i(a.file.name),1),e(`span`,_n,i(a.humanSize(a.file.size)),1)])):(b(),c(`p`,mn,i(a.$t(`skill.dialog.uploadDrop`)),1))],34),e(`div`,vn,[e(`p`,yn,i(a.$t(`skill.dialog.fileRequirements`)),1),e(`ul`,null,[e(`li`,null,i(a.$t(`skill.dialog.requirementMd`)),1),e(`li`,null,i(a.$t(`skill.dialog.requirementArchive`)),1)])])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`show-close`,`onUpdate:modelValue`,`onClosed`])}var xn=U(pn,[[`render`,bn],[`__scopeId`,`data-v-01ead824`]]),Sn=x({name:`WriteSkillDialog`,components:{ElDialog:V,ElButton:J,ElInput:G,CloudUploadIcon:Ve},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{content:``,saving:!1}},methods:{onVisibleChange(e){this.$emit(`update:modelValue`,e)},onClose(){this.saving||this.$emit(`update:modelValue`,!1)},reset(){this.content=``},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},async onSubmit(){if(this.content.trim()){this.saving=!0;try{let{data:e}=await Z.createMarkdown({content:this.content});K.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,e.id),this.$emit(`update:modelValue`,!1)}catch(e){K.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)}))}finally{this.saving=!1}}}}}),Cn={class:`hint`};function wn(t,n,a,s,c,l){let u=d(`el-input`),f=d(`el-button`),p=d(`cloud-upload-icon`),g=d(`el-dialog`);return b(),m(g,{"model-value":t.modelValue,title:t.$t(`skill.dialog.writeTitle`),width:`min(720px, 94vw)`,"align-center":``,"close-on-click-modal":!t.saving,"close-on-press-escape":!t.saving,"show-close":!t.saving,"onUpdate:modelValue":t.onVisibleChange,onClosed:t.reset},{footer:h(()=>[o(f,{disabled:t.saving,onClick:t.onClose},{default:h(()=>[r(i(t.$t(`skill.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`]),o(f,{type:`primary`,loading:t.saving,disabled:!t.content.trim(),onClick:t.onSubmit},{default:h(()=>[o(p,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:h(()=>[e(`p`,Cn,i(t.$t(`skill.dialog.writeHint`)),1),o(u,{modelValue:t.content,"onUpdate:modelValue":n[0]||=e=>t.content=e,type:`textarea`,rows:18,placeholder:t.$t(`skill.placeholder.content`),spellcheck:`false`,class:`editor`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`show-close`,`onUpdate:modelValue`,`onClosed`])}var Tn=x({name:`UserSkills`,components:{ElInput:G,ElSwitch:j,ElTag:ge,ElTooltip:E,ElDropdown:k,ElDropdownMenu:O,ElDropdownItem:D,AddIcon:ce,AiCreateIcon:he,CloseIcon:_e,DeleteIcon:fe,ExpandDownIcon:F,ExpandRightIcon:I,HelpIcon:ee,MarketplaceIcon:ue,MoreIcon:re,SearchIcon:de,SkillIcon:le,UploadIcon:me,WriteIcon:te,BrowseSkillsDialog:Dt,SkillFilePreview:Gt,SkillRow:un,UploadSkillDialog:xn,WriteSkillDialog:U(Sn,[[`render`,wn],[`__scopeId`,`data-v-f39aab5d`]])},directives:{loading:W},data(){return{loading:!1,skills:[],togglingId:null,selectedSkillId:``,selectedPath:``,expandedSkillIds:[],personalOpen:!0,globalsOpen:!0,searchOpen:!1,searchQuery:``,uploadVisible:!1,writeVisible:!1,browseVisible:!1}},computed:{personalSkills(){return this.skills.filter(e=>e.source!==`global`)},globalSkills(){return this.skills.filter(e=>e.source===`global`)},filteredPersonal(){return this.applyFilter(this.personalSkills)},filteredGlobal(){return this.applyFilter(this.globalSkills)},selectedSkill(){return this.skills.find(e=>e.id===this.selectedSkillId)||null}},mounted(){this.fetchSkills()},methods:{applyFilter(e){let t=this.searchQuery.trim().toLowerCase();return t?e.filter(e=>e.slug.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)):e},async fetchSkills(){this.loading=!0;try{let{data:e}=await Z.list();if(this.skills=e||[],!this.selectedSkillId&&this.skills.length){let e=this.personalSkills[0]||this.skills[0];this.selectedSkillId=e.id}else this.selectedSkillId&&!this.skills.find(e=>e.id===this.selectedSkillId)&&(this.selectedSkillId=``,this.selectedPath=``)}catch(e){console.error(e),K.error(this.$t(`skill.message.loadFailed`))}finally{this.loading=!1}},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},selectSkill(e){this.selectedSkillId=e.id,this.selectedPath=``},selectFile(e,t){this.selectedSkillId=e.id,this.selectedPath=t},toggleExpand(e){let t=this.expandedSkillIds.indexOf(e.id);t>=0?this.expandedSkillIds.splice(t,1):this.expandedSkillIds.push(e.id)},openSearch(){this.searchOpen=!0,a(()=>{this.$refs.searchInput?.focus?.()})},closeSearch(){this.searchOpen=!1,this.searchQuery=``},openUpload(){this.uploadVisible=!0},openWrite(){this.writeVisible=!0},onBrowse(){this.browseVisible=!0},async onCreated(e){await this.fetchSkills();let t=this.skills.find(t=>t.id===e);t&&(this.selectedSkillId=t.id,this.selectedPath=``,this.personalOpen=!0)},async onSaveContent(e,t){if(!this.selectedSkill){t.reject();return}try{let{data:n}=await Z.update(this.selectedSkill.id,{content:e});K.success(this.$t(`skill.message.updateSuccess`));let r=this.skills.findIndex(e=>e.id===n.id);r>=0&&this.skills.splice(r,1,n),t.resolve()}catch(e){K.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)})),t.reject(e)}},async onDelete(e){try{await we.confirm(this.$t(`skill.message.deleteConfirm`,{slug:e.slug}),this.$t(`skill.button.delete`),{type:`warning`})}catch{return}try{await Z.remove(e.id),K.success(this.$t(`skill.message.deleteSuccess`)),this.selectedSkillId===e.id&&(this.selectedSkillId=``,this.selectedPath=``),await this.fetchSkills()}catch(e){K.error(this.extractError(e))}},async onToggleSkill(e,t){this.togglingId=e.id;try{t?(await Z.enable(e.id),K.success(this.$t(`skill.message.enableSuccess`))):(await Z.disable(e.id),K.success(this.$t(`skill.message.disableSuccess`))),e.enabled=t}catch(e){K.error(this.extractError(e))}finally{this.togglingId=null}}}}),En={class:`page-shell`},Dn={class:`page-heading`},On={class:`page-title`},kn={class:`page-subtitle`},An={class:`skills-shell`},jn={class:`left-pane`},Mn={class:`left-header`},Nn={class:`left-actions`},Pn=[`aria-label`,`title`],Fn=[`aria-label`,`title`],In={class:`submenu-trigger`},Ln={class:`badge-soon`},Rn={key:0,class:`search-row`},zn=[`aria-label`,`title`],Bn={class:`left-body`},Vn={class:`section`},Hn={key:0,class:`skill-list`},Un={key:0,class:`empty-row`},Wn={key:0,class:`section`},Gn={key:0,class:`skill-list`},Kn={class:`right-pane`},qn={class:`right-header`},Jn={class:`right-title`},Yn={class:`right-actions`},Xn=[`aria-label`,`title`],Zn={class:`meta-card`},Qn={class:`meta-grid`},$n={class:`meta-cell`},er={class:`meta-label`},tr={class:`meta-value`},nr={class:`meta-cell`},rr={class:`meta-label`},ir={class:`meta-value`},ar={key:0,class:`meta-cell`},or={class:`meta-label`},sr={class:`meta-tags`},cr={key:0,class:`meta-description`},lr={class:`meta-description-label`},ur={class:`meta-label`},dr={class:`preview-card`},fr={key:2,class:`right-empty`};function pr(t,n,a,f,_,y){let x=d(`search-icon`),S=d(`add-icon`),C=d(`marketplace-icon`),w=d(`el-dropdown-item`),T=d(`expand-right-icon`),E=d(`ai-create-icon`),D=d(`write-icon`),O=d(`upload-icon`),k=d(`el-dropdown-menu`),A=d(`el-dropdown`),j=d(`el-input`),M=d(`close-icon`),N=d(`expand-down-icon`),P=d(`skill-row`),F=d(`el-switch`),I=d(`more-icon`),L=d(`delete-icon`),ee=d(`el-tag`),te=d(`help-icon`),ne=d(`el-tooltip`),R=d(`skill-file-preview`),re=d(`skill-icon`),ie=d(`upload-skill-dialog`),ae=d(`write-skill-dialog`),z=d(`browse-skills-dialog`),B=g(`loading`);return b(),c(`div`,En,[e(`div`,Dn,[e(`h2`,On,i(t.$t(`skill.title.skills`)),1),e(`p`,kn,i(t.$t(`skill.message.pageDescription`)),1)]),e(`div`,An,[e(`aside`,jn,[e(`header`,Mn,[e(`div`,Nn,[t.searchOpen?s(``,!0):(b(),c(`button`,{key:0,class:`icon-btn`,"aria-label":t.$t(`skill.button.search`),title:t.$t(`skill.button.search`),onClick:n[0]||=(...e)=>t.openSearch&&t.openSearch(...e)},[o(x,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Pn)),o(A,{trigger:`click`,placement:`bottom-end`,"hide-on-click":!1},{dropdown:h(()=>[o(k,{class:`add-menu`},{default:h(()=>[o(w,{onClick:t.onBrowse},{default:h(()=>[o(C,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.browse`)),1)]),_:1},8,[`onClick`]),o(w,{divided:``},{default:h(()=>[o(A,{trigger:`hover`,placement:`left-start`,"hide-on-click":!0},{dropdown:h(()=>[o(k,{class:`add-menu`},{default:h(()=>[o(w,{disabled:``},{default:h(()=>[o(E,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.createWithClaude`))+` `,1),e(`span`,Ln,i(t.$t(`skill.menu.soon`)),1)]),_:1}),o(w,{onClick:t.openWrite},{default:h(()=>[o(D,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.write`)),1)]),_:1},8,[`onClick`]),o(w,{onClick:t.openUpload},{default:h(()=>[o(O,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.upload`)),1)]),_:1},8,[`onClick`])]),_:1})]),default:h(()=>[e(`span`,In,[o(S,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.create`))+` `,1),o(T,{class:`submenu-arrow`,size:14,"aria-hidden":`true`,focusable:`false`})])]),_:1})]),_:1})]),_:1})]),default:h(()=>[e(`button`,{class:`icon-btn`,"aria-label":t.$t(`skill.button.add`),title:t.$t(`skill.button.add`)},[o(S,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Fn)]),_:1})])]),t.searchOpen?(b(),c(`div`,Rn,[o(j,{ref:`searchInput`,modelValue:t.searchQuery,"onUpdate:modelValue":n[1]||=e=>t.searchQuery=e,class:`search-input`,size:`default`,placeholder:t.$t(`skill.placeholder.search`),onKeydown:l(t.closeSearch,[`escape`])},{prefix:h(()=>[o(x,{size:13,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`,`onKeydown`]),e(`button`,{class:`icon-btn icon-btn-sm`,"aria-label":t.$t(`common.button.close`),title:t.$t(`common.button.close`),onClick:n[2]||=(...e)=>t.closeSearch&&t.closeSearch(...e)},[o(M,{size:14,"aria-hidden":`true`,focusable:`false`})],8,zn)])):s(``,!0),p((b(),c(`div`,Bn,[e(`section`,Vn,[e(`button`,{class:`section-header`,onClick:n[3]||=e=>t.personalOpen=!t.personalOpen},[t.personalOpen?(b(),m(N,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(b(),m(T,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.personal`)),1)]),t.personalOpen?(b(),c(`ul`,Hn,[!t.loading&&t.filteredPersonal.length===0?(b(),c(`li`,Un,i(t.searchQuery?t.$t(`skill.empty.search`):t.$t(`skill.message.noSkills`)),1)):s(``,!0),(b(!0),c(u,null,v(t.filteredPersonal,e=>(b(),m(P,{key:e.id,skill:e,"selected-skill-id":t.selectedSkillId,"selected-path":t.selectedPath,expanded:t.expandedSkillIds.includes(e.id),onToggleExpand:t.toggleExpand,onSelectSkill:t.selectSkill,onSelectFile:t.selectFile},null,8,[`skill`,`selected-skill-id`,`selected-path`,`expanded`,`onToggleExpand`,`onSelectSkill`,`onSelectFile`]))),128))])):s(``,!0)]),t.globalSkills.length>0?(b(),c(`section`,Wn,[e(`button`,{class:`section-header`,onClick:n[4]||=e=>t.globalsOpen=!t.globalsOpen},[t.globalsOpen?(b(),m(N,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(b(),m(T,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.platform`)),1)]),t.globalsOpen?(b(),c(`ul`,Gn,[(b(!0),c(u,null,v(t.filteredGlobal,e=>(b(),m(P,{key:e.id,skill:e,"selected-skill-id":t.selectedSkillId,"selected-path":t.selectedPath,expanded:t.expandedSkillIds.includes(e.id),onToggleExpand:t.toggleExpand,onSelectSkill:t.selectSkill,onSelectFile:t.selectFile},null,8,[`skill`,`selected-skill-id`,`selected-path`,`expanded`,`onToggleExpand`,`onSelectSkill`,`onSelectFile`]))),128))])):s(``,!0)])):s(``,!0)])),[[B,t.loading]])]),e(`main`,Kn,[t.selectedSkill&&!t.selectedPath?(b(),c(u,{key:0},[e(`header`,qn,[e(`h3`,Jn,i(t.selectedSkill.slug),1),e(`div`,Yn,[o(F,{"model-value":t.selectedSkill.enabled,size:`default`,loading:t.togglingId===t.selectedSkill.id,onChange:n[5]||=e=>t.onToggleSkill(t.selectedSkill,!!e)},null,8,[`model-value`,`loading`]),t.selectedSkill.source===`global`?s(``,!0):(b(),m(A,{key:0,trigger:`click`,placement:`bottom-end`},{dropdown:h(()=>[o(k,null,{default:h(()=>[o(w,{onClick:n[6]||=e=>t.onDelete(t.selectedSkill)},{default:h(()=>[o(L,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.delete`)),1)]),_:1})]),_:1})]),default:h(()=>[e(`button`,{class:`icon-btn`,"aria-label":t.$t(`skill.button.more`),title:t.$t(`skill.button.more`)},[o(I,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Xn)]),_:1}))])]),e(`div`,Zn,[e(`div`,Qn,[e(`div`,$n,[e(`span`,er,i(t.$t(`skill.meta.addedBy`)),1),e(`span`,tr,i(t.selectedSkill.source===`global`?t.$t(`skill.meta.platform`):t.$t(`skill.meta.you`)),1)]),e(`div`,nr,[e(`span`,rr,i(t.$t(`skill.meta.lastUpdated`)),1),e(`span`,ir,i(t.$dayjs.format(t.selectedSkill.updated_at)),1)]),t.selectedSkill.required_connections.length?(b(),c(`div`,ar,[e(`span`,or,i(t.$t(`skill.field.requiredConnections`)),1),e(`div`,sr,[(b(!0),c(u,null,v(t.selectedSkill.required_connections,e=>(b(),m(ee,{key:e,size:`small`,type:`info`},{default:h(()=>[r(i(e),1)]),_:2},1024))),128))])])):s(``,!0)]),t.selectedSkill.description?(b(),c(`div`,cr,[e(`div`,lr,[e(`span`,ur,i(t.$t(`skill.field.description`)),1),t.selectedSkill.when_to_use?(b(),m(ne,{key:0,content:t.selectedSkill.when_to_use,placement:`top`},{default:h(()=>[o(te,{class:`meta-info-icon`,size:12,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`content`])):s(``,!0)]),e(`p`,null,i(t.selectedSkill.description),1)])):s(``,!0)]),e(`div`,dr,[(b(),m(R,{key:`${t.selectedSkill.id}:SKILL.md`,"skill-id":t.selectedSkill.id,path:`SKILL.md`,editable:t.selectedSkill.source===`upload`,onSave:t.onSaveContent},null,8,[`skill-id`,`editable`,`onSave`]))])],64)):t.selectedSkill&&t.selectedPath?(b(),m(R,{key:`${t.selectedSkill.id}:${t.selectedPath}`,"skill-id":t.selectedSkill.id,path:t.selectedPath,editable:!1},null,8,[`skill-id`,`path`])):(b(),c(`div`,fr,[o(re,{class:`right-empty-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.selectSkill`)),1)]))])]),o(ie,{modelValue:t.uploadVisible,"onUpdate:modelValue":n[7]||=e=>t.uploadVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),o(ae,{modelValue:t.writeVisible,"onUpdate:modelValue":n[8]||=e=>t.writeVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),o(z,{modelValue:t.browseVisible,"onUpdate:modelValue":n[9]||=e=>t.browseVisible=e,onInstalled:t.onCreated},null,8,[`modelValue`,`onInstalled`])])}var mr=U(Tn,[[`render`,pr],[`__scopeId`,`data-v-da68d0c2`]]);export{mr as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{t as y}from"./upload-D-5KHpRy.js";import{t as b}from"./tooltip-DjLl_Tv9.js";import{t as x}from"./alert-DIqm-Kad.js";import{t as S}from"./drawer-DcAaZIVn.js";import{t as C}from"./box-DzrSsXb8.js";import{t as w}from"./clock-CYQS4x6R.js";import{n as T,r as E,t as D}from"./PromptTextarea-DIx8KWwe.js";import{t as O}from"./info-B5kD0bjW.js";import{t as k}from"./trash-2-jm25a3wz.js";import{t as A}from"./triangle-alert-RGg8X9Hu.js";import{t as j}from"./upload-CIMqvT63.js";import{t as M}from"./wand-sparkles-DIimd5K-.js";import{Ct as N,Dt as ee,Et as P,Ot as F,kt as I,wt as L}from"./constants-7uZLiijT.js";import{E as R,En as te,Gt as ne,Kt as z,Sr as re,Ti as B,Ut as V,Wt as H,Yt as U,ci as W,di as G,in as K,qt as q,wi as J,zi as Y}from"./index-S2D3KxIN.js";import{t as X}from"./CopyToClipboard-BC8MgUTU.js";import{t as ie}from"./FilePreview-BsvcYriG.js";import{t as Z}from"./ImagePreview-COWWmcN6.js";import{n as ae}from"./taskDrawerMixin-DyAUhFEq.js";import{t as oe}from"./Consumption-Bwtr-oKm.js";import{a as Q,n as se,r as ce,t as le}from"./pagination-C60kxWZe.js";import{t as ue}from"./VideoPlayer-CYq2VZJJ.js";import{t as de}from"./ApiCodeButton-DQfIqta7.js";import{t as fe}from"./BotPlaceholder-DUy5q_lY.js";var pe=v({name:`LayoutOmni`,components:{MagicIcon:M,ElDrawer:S,ElButton:Y},mixins:[ae]}),me={class:`main flex flex-row flex-1`},he={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ge={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function _e(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,me,[e(`div`,he,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ge,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ve=R(pe,[[`render`,_e],[`__scopeId`,`data-v-b76ffabf`]]),ye=v({name:`OmniPromptInput`,components:{PromptTextarea:D},computed:{prompt:{get(){return this.$store.state.omni?.config?.prompt},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,prompt:e})}}},mounted(){this.prompt||=``}});function be(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`omni.name.prompt`),info:e.$t(`omni.description.prompt`),placeholder:e.$t(`omni.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var xe=R(ye,[[`render`,be]]),Se=v({name:`OmniResolutionSelector`,components:{InfoIcon:Q},data(){return{options:[{value:I,label:`720p`},{value:F,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.omni?.config?.resolution},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,resolution:e})}}},mounted(){this.value||=L}}),Ce={class:`resolution`},we={class:`header`},Te={class:`title font-bold`},Ee={class:`items`},De=[`onClick`];function Oe(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Ce,[e(`div`,we,[e(`h2`,Te,i(t.$t(`omni.name.resolution`)),1),a(p,{content:t.$t(`omni.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,Ee,[(g(!0),s(c,null,h(t.options,e=>(g(),s(`div`,{key:e.value,class:n([`item`,{active:t.value===e.value}]),onClick:n=>t.value=e.value},i(e.label),11,De))),128))])])}var ke=R(Se,[[`render`,Oe],[`__scopeId`,`data-v-1f9abe29`]]),Ae=v({name:`OmniRatioSelector`,components:{InfoIcon:Q},computed:{options(){return[{value:P,label:`16:9`,w:32,h:18},{value:ee,label:`9:16`,w:18,h:32}]},value:{get(){return this.$store.state.omni?.config?.aspect_ratio},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,aspect_ratio:e})}}},mounted(){this.value||=N}}),je={class:`ratio`},Me={class:`header`},Ne={class:`title font-bold`},Pe={class:`items`},Fe=[`onClick`],Ie={class:`preview`},Le={class:`name`};function Re(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,je,[e(`div`,Me,[e(`h2`,Ne,i(t.$t(`omni.name.ratio`)),1),a(p,{content:t.$t(`omni.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,Pe,[(g(!0),s(c,null,h(t.options,r=>(g(),s(`div`,{key:r.value,class:n([`item`,{active:t.value===r.value}]),onClick:e=>t.value=r.value},[e(`div`,Ie,[e(`div`,{class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)]),e(`div`,Le,i(r.label),1)],10,Fe))),128))])])}var ze=R(Ae,[[`render`,Re],[`__scopeId`,`data-v-1c0c1511`]]),Be=4,Ve=v({name:`OmniReferenceImagesInput`,components:{ElUpload:y,ElButton:Y,InfoIcon:Q,ImagePreview:Z,UploadIcon:j},mixins:[q,z,H],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`,limit:Be,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)||[]},value(){return this.$store.state.omni?.config?.image_urls}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetReferenceImages()},onExceed(){B.warning(this.$t(`omni.message.uploadReferenceExceed`))},onError(){B.error(this.$t(`omni.message.uploadError`))},onSetReferenceImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,image_urls:e.length?e:void 0}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetReferenceImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetReferenceImages()}}}),He={class:`field mb-[10px] flex min-h-8 w-full items-center justify-between gap-3`},Ue={class:`flex min-w-0 items-center`},We={class:`title m-0 text-[14px] font-bold`},Ge={class:`file-list flex flex-wrap gap-[10px]`};function Ke(t,n,o,u,d,m){let _=l(`info-icon`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`image-preview`);return g(),s(`div`,null,[e(`div`,He,[e(`div`,Ue,[e(`h2`,We,i(t.$t(`omni.name.referenceImages`)),1),a(_,{content:t.$t(`omni.description.referenceImages`)},null,8,[`content`])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value shrink-0`,limit:t.limit,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(y,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(v,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,Ge,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])}var qe=R(Ve,[[`render`,Ke]]),Je=v({name:`OmniVideoInput`,components:{ElUpload:y,ElButton:Y,InfoIcon:Q,FilePreview:ie,UploadIcon:j},mixins:[z,H],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},videoUrl(){return this.$store.state.omni?.config?.video_urls?.[0]},videoName(){let e=this.videoUrl||``;return e.split(`/`).pop()||e}},methods:{onExceed(){B.warning(this.$t(`omni.message.uploadVideoExceed`))},onError(){B.error(this.$t(`omni.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<200;return t?n?!0:(B.error(this.$t(`omni.message.uploadVideoSizeExceed`)),!1):(B.error(this.$t(`omni.message.uploadVideoTypeFailed`)),!1)},setVideoUrls(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,video_urls:e?[e]:void 0})},onRemove(){this.fileList=[],this.setVideoUrls(void 0)},async onSuccess(e,t){let n=e?.file_url||t?.response?.file_url;this.setVideoUrls(n||void 0)}}}),Ye={class:`field flex min-h-8 w-full items-center justify-between gap-3`},Xe={class:`flex min-w-0 items-center`},Ze={class:`title m-0 text-[14px] font-bold`},Qe={key:0,class:`file-list flex flex-wrap gap-[10px]`};function $e(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`),y=l(`file-preview`);return g(),s(`div`,null,[e(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`omni.name.referenceVideo`)),1),a(m,{content:t.$t(`omni.description.referenceVideo`)},null,8,[`content`])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value shrink-0`,"show-file-list":!1,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{default:p(()=>[a(_,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(h,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.uploadVideo`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.videoUrl?(g(),s(`div`,Qe,[a(y,{url:t.videoUrl,name:t.videoName,percentage:100,onRemove:t.onRemove},null,8,[`url`,`name`,`onRemove`])])):o(``,!0)])}var et=v({name:`OmniConfigPanel`,components:{ElButton:Y,MagicIcon:M,PromptInput:xe,ResolutionSelector:ke,RatioSelector:ze,ReferenceImagesInput:qe,VideoInput:R(Je,[[`render`,$e],[`__scopeId`,`data-v-bec16553`]]),Consumption:oe},emits:[`generate`],computed:{config(){return this.$store.state.omni?.config},consumption(){return U(this.config,this.service?.cost)},service(){return this.$store.state.omni?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),tt={class:`flex flex-col h-full`},nt={class:`flex-1 overflow-y-auto p-5`},rt={class:`flex flex-col items-center justify-center px-5 pb-5`};function it(t,n,o,c,u,d){let f=l(`prompt-input`),m=l(`ratio-selector`),h=l(`resolution-selector`),_=l(`reference-images-input`),v=l(`video-input`),y=l(`consumption`),b=l(`magic-icon`),x=l(`el-button`);return g(),s(`div`,tt,[e(`div`,nt,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`})]),e(`div`,rt,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.generate`)),1)]),_:1},8,[`onClick`])])])}var at=R(et,[[`render`,it]]),ot=v({name:`OmniTaskPreview`,components:{DeleteIcon:k,ApplicationIcon:C,ChannelIcon:E,CopyToClipboard:X,ExpandIcon:T,InfoIcon:O,MagicIcon:M,TimeIcon:w,WarningIcon:A,ElAlert:x,VideoPlayer:ue,ElTooltip:b,ElButton:Y,ImagePreview:Z,ApiCodeButton:de},props:{modelValue:{type:Object,required:!0}},data(){return{nowTs:Date.now(),timer:0}},computed:{video(){return this.modelValue?.response?.data?.[0]},inputImage(){return this.modelValue?.request?.image_urls?.[0]},pendingElapsed(){let e=parseFloat((this.modelValue?.created_at||``).toString());if(e)return Math.max(0,Math.floor(this.nowTs/1e3-e))}},watch:{"modelValue.response":{handler(e){e&&this.stopTimer()}}},mounted(){this.modelValue?.response||(this.timer=window.setInterval(()=>{this.nowTs=Date.now()},1e3))},beforeUnmount(){this.stopTimer()},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await J.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`omni/deleteTask`,{id:e}),B.success(this.$t(`common.message.deleteTaskSuccess`))}catch{B.error(this.$t(`common.message.deleteTaskFailed`))}}},stopTimer(){this.timer&&=(window.clearInterval(this.timer),0)},onDownload(e){window.open(e,`_blank`)}}}),st={class:`preview`},ct={class:`left`},lt={class:`main`},ut={class:`bot`},dt={class:`datetime`},ft=[`aria-label`],pt={class:`info`},mt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},ht={key:1,class:`prompt mt-2`},gt={key:0},_t={key:1},vt={key:0,class:n({content:!0})},yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},xt={key:1,class:n({content:!0})},St={key:0,class:`mb-4`},Ct={key:1,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},wt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={key:0},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},kt={key:2,class:n({content:!0})},At={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Nt={key:3,class:n({content:!0})},Pt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Ft(n,c,u,d,f,m){let h=l(`capability-presentation`),_=l(`delete-icon`),v=l(`el-tooltip`),y=l(`image-preview`),b=l(`time-icon`),x=l(`magic-icon`),S=l(`copy-to-clipboard`),C=l(`el-alert`),w=l(`video-player`),T=l(`el-button`),E=l(`api-code-button`),D=l(`application-icon`),O=l(`expand-icon`),k=l(`channel-icon`),A=l(`warning-icon`),j=l(`info-icon`);return g(),s(`div`,st,[e(`div`,ct,[a(h,{capability:`omni`,part:`avatar`,class:`avatar`})]),e(`div`,lt,[e(`div`,ut,[a(h,{capability:`omni`,part:`name`}),e(`span`,dt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(v,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(g(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(_,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,ft)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,pt,[n.inputImage?(g(),s(`div`,mt,[a(y,{url:n.inputImage,name:`image`,closable:!1},null,8,[`url`])])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,ht,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.video?.state===`processing`||n.video?.state===`pending`?(g(),s(`span`,_t,` - (`+i(n.$t(`omni.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,gt,` - (`+i(n.$t(`omni.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,xt,[n.video?.video_url?(g(),s(`div`,St,[a(w,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Ct,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`omni.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(T,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`omni.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(E,{path:`/gemini/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,wt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(g(),s(`p`,Tt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.resolution`))+`: `+i(n.modelValue?.request?.resolution)+` `,1),n.modelValue?.request?.aspect_ratio?(g(),s(`span`,Et,` · `+i(n.modelValue?.request?.aspect_ratio),1)):o(``,!0)])):o(``,!0),e(`p`,$,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,Dt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Ot,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(g(),s(`div`,kt,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failure`)),1)]),default:p(()=>[e(`p`,At,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,jt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(S,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Mt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,Nt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.status`)),1)]),default:p(()=>[e(`p`,Pt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})])):(g(),s(`div`,vt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.status.pending`)),1)]),default:p(()=>[e(`p`,yt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.pendingElapsed===void 0?o(``,!0):(g(),s(`p`,bt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.pendingElapsed)+`s `,1)]))]),_:1})]))])])}var It=v({name:`OmniRecentPanel`,components:{TaskPreview:R(ot,[[`render`,Ft],[`__scopeId`,`data-v-2f40a5a9`]]),BotPlaceholder:fe,NoTasks:ce,ScrollList:se},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.omni?.tasks,items:this.$store.state.omni?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Lt={key:0},Rt={key:2,class:`w-full h-full flex items-center justify-center`};function zt(e,t,n,r,i,u){let d=l(`bot-placeholder`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,Lt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,e=>(g(),f(m,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,Rt,[a(v)])):o(``,!0)],64)}var Bt=v({name:`OmniIndex`,components:{ConfigPanel:at,Layout:ve,RecentPanel:R(It,[[`render`,zt]])},mixins:[ne],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.omni?.status?.getApplications===W.Request},tasksLoading(){return this.$store.state.omni?.status?.getTasks===W.Request||this.fetchingTasks},credential(){return this.$store.state.omni?.credential},config(){return this.$store.state.omni?.config},tasks(){return this.$store.state.omni?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await le({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`omni/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`omni/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!V(this.uploadTracker,e=>this.$t(e),e=>B.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.image_urls)&&(e.image_urls=e.image_urls.filter(e=>typeof e==`string`&&e.trim()),e.image_urls.length||delete e.image_urls),Array.isArray(e?.video_urls)&&(e.video_urls=e.video_urls.filter(e=>typeof e==`string`&&e.trim()),e.video_urls.length||delete e.video_urls),!e?.prompt){B.warning(this.$t(`omni.message.promptRequired`));return}if(e?.video_urls&&!e?.image_urls){B.warning(this.$t(`omni.message.videoRequiresImage`));return}let t={...e,async:!0};if(!K())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}B.info(this.$t(`omni.message.startingTask`)),re(`omni`,te.generate(t,{token:n})).then(()=>{B.success(this.$t(`omni.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?B.error(this.$t(`omni.message.usedUp`)):B.error(this.$t(`omni.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Vt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Ht=R(Bt,[[`render`,Vt]]);export{Ht as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{t as y}from"./upload-GC5EGmwp.js";import{t as b}from"./tooltip-CVVApYjJ.js";import{t as x}from"./alert-G37GiXIg.js";import{t as S}from"./drawer-BF8tPGkj.js";import{t as C}from"./box-BTYdpeSs.js";import{t as w}from"./clock-BbOTrjoQ.js";import{n as T,r as E,t as D}from"./PromptTextarea-O8KxwMGn.js";import{t as O}from"./info-C7eq8W70.js";import{t as k}from"./trash-2-B7h9iX5Q.js";import{t as A}from"./triangle-alert-C_NcfP7e.js";import{t as j}from"./upload-DRjQvPEd.js";import{t as M}from"./wand-sparkles-BQfGRD0P.js";import{Ct as N,Dt as ee,Et as P,Ot as F,kt as I,wt as L}from"./constants-7uZLiijT.js";import{E as R,En as te,Gt as ne,Kt as z,Sr as re,Ti as B,Ut as V,Wt as H,Yt as U,ci as W,di as G,in as K,qt as q,wi as J,zi as Y}from"./index-dzU0SACS.js";import{t as X}from"./CopyToClipboard-DOx2-KTG.js";import{t as ie}from"./FilePreview-CibPHhpy.js";import{t as Z}from"./ImagePreview-CSSReHgL.js";import{n as ae}from"./taskDrawerMixin-DyAUhFEq.js";import{t as oe}from"./Consumption-JN0X0f8c.js";import{a as Q,n as se,r as ce,t as le}from"./pagination-DZKa3-YT.js";import{t as ue}from"./VideoPlayer-BnwIjt1E.js";import{t as de}from"./ApiCodeButton-Ck-LkZnA.js";import{t as fe}from"./BotPlaceholder-SAI3U7Vk.js";var pe=v({name:`LayoutOmni`,components:{MagicIcon:M,ElDrawer:S,ElButton:Y},mixins:[ae]}),me={class:`main flex flex-row flex-1`},he={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ge={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function _e(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,me,[e(`div`,he,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ge,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ve=R(pe,[[`render`,_e],[`__scopeId`,`data-v-b76ffabf`]]),ye=v({name:`OmniPromptInput`,components:{PromptTextarea:D},computed:{prompt:{get(){return this.$store.state.omni?.config?.prompt},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,prompt:e})}}},mounted(){this.prompt||=``}});function be(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`omni.name.prompt`),info:e.$t(`omni.description.prompt`),placeholder:e.$t(`omni.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var xe=R(ye,[[`render`,be]]),Se=v({name:`OmniResolutionSelector`,components:{InfoIcon:Q},data(){return{options:[{value:I,label:`720p`},{value:F,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.omni?.config?.resolution},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,resolution:e})}}},mounted(){this.value||=L}}),Ce={class:`resolution`},we={class:`header`},Te={class:`title font-bold`},Ee={class:`items`},De=[`onClick`];function Oe(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Ce,[e(`div`,we,[e(`h2`,Te,i(t.$t(`omni.name.resolution`)),1),a(p,{content:t.$t(`omni.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,Ee,[(g(!0),s(c,null,h(t.options,e=>(g(),s(`div`,{key:e.value,class:n([`item`,{active:t.value===e.value}]),onClick:n=>t.value=e.value},i(e.label),11,De))),128))])])}var ke=R(Se,[[`render`,Oe],[`__scopeId`,`data-v-1f9abe29`]]),Ae=v({name:`OmniRatioSelector`,components:{InfoIcon:Q},computed:{options(){return[{value:P,label:`16:9`,w:32,h:18},{value:ee,label:`9:16`,w:18,h:32}]},value:{get(){return this.$store.state.omni?.config?.aspect_ratio},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,aspect_ratio:e})}}},mounted(){this.value||=N}}),je={class:`ratio`},Me={class:`header`},Ne={class:`title font-bold`},Pe={class:`items`},Fe=[`onClick`],Ie={class:`preview`},Le={class:`name`};function Re(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,je,[e(`div`,Me,[e(`h2`,Ne,i(t.$t(`omni.name.ratio`)),1),a(p,{content:t.$t(`omni.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,Pe,[(g(!0),s(c,null,h(t.options,r=>(g(),s(`div`,{key:r.value,class:n([`item`,{active:t.value===r.value}]),onClick:e=>t.value=r.value},[e(`div`,Ie,[e(`div`,{class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)]),e(`div`,Le,i(r.label),1)],10,Fe))),128))])])}var ze=R(Ae,[[`render`,Re],[`__scopeId`,`data-v-1c0c1511`]]),Be=4,Ve=v({name:`OmniReferenceImagesInput`,components:{ElUpload:y,ElButton:Y,InfoIcon:Q,ImagePreview:Z,UploadIcon:j},mixins:[q,z,H],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`,limit:Be,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)||[]},value(){return this.$store.state.omni?.config?.image_urls}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetReferenceImages()},onExceed(){B.warning(this.$t(`omni.message.uploadReferenceExceed`))},onError(){B.error(this.$t(`omni.message.uploadError`))},onSetReferenceImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,image_urls:e.length?e:void 0}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetReferenceImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetReferenceImages()}}}),He={class:`field mb-[10px] flex min-h-8 w-full items-center justify-between gap-3`},Ue={class:`flex min-w-0 items-center`},We={class:`title m-0 text-[14px] font-bold`},Ge={class:`file-list flex flex-wrap gap-[10px]`};function Ke(t,n,o,u,d,m){let _=l(`info-icon`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`image-preview`);return g(),s(`div`,null,[e(`div`,He,[e(`div`,Ue,[e(`h2`,We,i(t.$t(`omni.name.referenceImages`)),1),a(_,{content:t.$t(`omni.description.referenceImages`)},null,8,[`content`])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value shrink-0`,limit:t.limit,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(y,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(v,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,Ge,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])}var qe=R(Ve,[[`render`,Ke]]),Je=v({name:`OmniVideoInput`,components:{ElUpload:y,ElButton:Y,InfoIcon:Q,FilePreview:ie,UploadIcon:j},mixins:[z,H],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},videoUrl(){return this.$store.state.omni?.config?.video_urls?.[0]},videoName(){let e=this.videoUrl||``;return e.split(`/`).pop()||e}},methods:{onExceed(){B.warning(this.$t(`omni.message.uploadVideoExceed`))},onError(){B.error(this.$t(`omni.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<200;return t?n?!0:(B.error(this.$t(`omni.message.uploadVideoSizeExceed`)),!1):(B.error(this.$t(`omni.message.uploadVideoTypeFailed`)),!1)},setVideoUrls(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,video_urls:e?[e]:void 0})},onRemove(){this.fileList=[],this.setVideoUrls(void 0)},async onSuccess(e,t){let n=e?.file_url||t?.response?.file_url;this.setVideoUrls(n||void 0)}}}),Ye={class:`field flex min-h-8 w-full items-center justify-between gap-3`},Xe={class:`flex min-w-0 items-center`},Ze={class:`title m-0 text-[14px] font-bold`},Qe={key:0,class:`file-list flex flex-wrap gap-[10px]`};function $e(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`),y=l(`file-preview`);return g(),s(`div`,null,[e(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`omni.name.referenceVideo`)),1),a(m,{content:t.$t(`omni.description.referenceVideo`)},null,8,[`content`])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value shrink-0`,"show-file-list":!1,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{default:p(()=>[a(_,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(h,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.uploadVideo`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.videoUrl?(g(),s(`div`,Qe,[a(y,{url:t.videoUrl,name:t.videoName,percentage:100,onRemove:t.onRemove},null,8,[`url`,`name`,`onRemove`])])):o(``,!0)])}var et=v({name:`OmniConfigPanel`,components:{ElButton:Y,MagicIcon:M,PromptInput:xe,ResolutionSelector:ke,RatioSelector:ze,ReferenceImagesInput:qe,VideoInput:R(Je,[[`render`,$e],[`__scopeId`,`data-v-bec16553`]]),Consumption:oe},emits:[`generate`],computed:{config(){return this.$store.state.omni?.config},consumption(){return U(this.config,this.service?.cost)},service(){return this.$store.state.omni?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),tt={class:`flex flex-col h-full`},nt={class:`flex-1 overflow-y-auto p-5`},rt={class:`flex flex-col items-center justify-center px-5 pb-5`};function it(t,n,o,c,u,d){let f=l(`prompt-input`),m=l(`ratio-selector`),h=l(`resolution-selector`),_=l(`reference-images-input`),v=l(`video-input`),y=l(`consumption`),b=l(`magic-icon`),x=l(`el-button`);return g(),s(`div`,tt,[e(`div`,nt,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`})]),e(`div`,rt,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.generate`)),1)]),_:1},8,[`onClick`])])])}var at=R(et,[[`render`,it]]),ot=v({name:`OmniTaskPreview`,components:{DeleteIcon:k,ApplicationIcon:C,ChannelIcon:E,CopyToClipboard:X,ExpandIcon:T,InfoIcon:O,MagicIcon:M,TimeIcon:w,WarningIcon:A,ElAlert:x,VideoPlayer:ue,ElTooltip:b,ElButton:Y,ImagePreview:Z,ApiCodeButton:de},props:{modelValue:{type:Object,required:!0}},data(){return{nowTs:Date.now(),timer:0}},computed:{video(){return this.modelValue?.response?.data?.[0]},inputImage(){return this.modelValue?.request?.image_urls?.[0]},pendingElapsed(){let e=parseFloat((this.modelValue?.created_at||``).toString());if(e)return Math.max(0,Math.floor(this.nowTs/1e3-e))}},watch:{"modelValue.response":{handler(e){e&&this.stopTimer()}}},mounted(){this.modelValue?.response||(this.timer=window.setInterval(()=>{this.nowTs=Date.now()},1e3))},beforeUnmount(){this.stopTimer()},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await J.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`omni/deleteTask`,{id:e}),B.success(this.$t(`common.message.deleteTaskSuccess`))}catch{B.error(this.$t(`common.message.deleteTaskFailed`))}}},stopTimer(){this.timer&&=(window.clearInterval(this.timer),0)},onDownload(e){window.open(e,`_blank`)}}}),st={class:`preview`},ct={class:`left`},lt={class:`main`},ut={class:`bot`},dt={class:`datetime`},ft=[`aria-label`],pt={class:`info`},mt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},ht={key:1,class:`prompt mt-2`},gt={key:0},_t={key:1},vt={key:0,class:n({content:!0})},yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},xt={key:1,class:n({content:!0})},St={key:0,class:`mb-4`},Ct={key:1,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},wt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={key:0},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},kt={key:2,class:n({content:!0})},At={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Nt={key:3,class:n({content:!0})},Pt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Ft(n,c,u,d,f,m){let h=l(`capability-presentation`),_=l(`delete-icon`),v=l(`el-tooltip`),y=l(`image-preview`),b=l(`time-icon`),x=l(`magic-icon`),S=l(`copy-to-clipboard`),C=l(`el-alert`),w=l(`video-player`),T=l(`el-button`),E=l(`api-code-button`),D=l(`application-icon`),O=l(`expand-icon`),k=l(`channel-icon`),A=l(`warning-icon`),j=l(`info-icon`);return g(),s(`div`,st,[e(`div`,ct,[a(h,{capability:`omni`,part:`avatar`,class:`avatar`})]),e(`div`,lt,[e(`div`,ut,[a(h,{capability:`omni`,part:`name`}),e(`span`,dt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(v,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(g(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(_,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,ft)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,pt,[n.inputImage?(g(),s(`div`,mt,[a(y,{url:n.inputImage,name:`image`,closable:!1},null,8,[`url`])])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,ht,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.video?.state===`processing`||n.video?.state===`pending`?(g(),s(`span`,_t,` - (`+i(n.$t(`omni.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,gt,` - (`+i(n.$t(`omni.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,xt,[n.video?.video_url?(g(),s(`div`,St,[a(w,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Ct,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`omni.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(T,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`omni.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(E,{path:`/gemini/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,wt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(g(),s(`p`,Tt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.resolution`))+`: `+i(n.modelValue?.request?.resolution)+` `,1),n.modelValue?.request?.aspect_ratio?(g(),s(`span`,Et,` · `+i(n.modelValue?.request?.aspect_ratio),1)):o(``,!0)])):o(``,!0),e(`p`,$,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,Dt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Ot,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(g(),s(`div`,kt,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failure`)),1)]),default:p(()=>[e(`p`,At,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,jt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(S,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Mt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,Nt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.status`)),1)]),default:p(()=>[e(`p`,Pt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})])):(g(),s(`div`,vt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.status.pending`)),1)]),default:p(()=>[e(`p`,yt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.pendingElapsed===void 0?o(``,!0):(g(),s(`p`,bt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.pendingElapsed)+`s `,1)]))]),_:1})]))])])}var It=v({name:`OmniRecentPanel`,components:{TaskPreview:R(ot,[[`render`,Ft],[`__scopeId`,`data-v-2f40a5a9`]]),BotPlaceholder:fe,NoTasks:ce,ScrollList:se},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.omni?.tasks,items:this.$store.state.omni?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Lt={key:0},Rt={key:2,class:`w-full h-full flex items-center justify-center`};function zt(e,t,n,r,i,u){let d=l(`bot-placeholder`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,Lt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,e=>(g(),f(m,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,Rt,[a(v)])):o(``,!0)],64)}var Bt=v({name:`OmniIndex`,components:{ConfigPanel:at,Layout:ve,RecentPanel:R(It,[[`render`,zt]])},mixins:[ne],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.omni?.status?.getApplications===W.Request},tasksLoading(){return this.$store.state.omni?.status?.getTasks===W.Request||this.fetchingTasks},credential(){return this.$store.state.omni?.credential},config(){return this.$store.state.omni?.config},tasks(){return this.$store.state.omni?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await le({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`omni/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`omni/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!V(this.uploadTracker,e=>this.$t(e),e=>B.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.image_urls)&&(e.image_urls=e.image_urls.filter(e=>typeof e==`string`&&e.trim()),e.image_urls.length||delete e.image_urls),Array.isArray(e?.video_urls)&&(e.video_urls=e.video_urls.filter(e=>typeof e==`string`&&e.trim()),e.video_urls.length||delete e.video_urls),!e?.prompt){B.warning(this.$t(`omni.message.promptRequired`));return}if(e?.video_urls&&!e?.image_urls){B.warning(this.$t(`omni.message.videoRequiresImage`));return}let t={...e,async:!0};if(!K())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}B.info(this.$t(`omni.message.startingTask`)),re(`omni`,te.generate(t,{token:n})).then(()=>{B.success(this.$t(`omni.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?B.error(this.$t(`omni.message.usedUp`)):B.error(this.$t(`omni.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Vt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Ht=R(Bt,[[`render`,Vt]]);export{Ht as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-wPYO0KL0.js";import{n as x,t as S}from"./tabs-CeP4BX60.js";import{t as C}from"./upload-D-5KHpRy.js";import{t as w}from"./tooltip-DjLl_Tv9.js";import{t as T}from"./alert-DIqm-Kad.js";import{t as E}from"./drawer-DcAaZIVn.js";import{t as D}from"./switch-CGc7vZAq.js";import{t as O}from"./box-DzrSsXb8.js";import{t as k}from"./clock-CYQS4x6R.js";import{n as A,r as j,t as M}from"./PromptTextarea-DIx8KWwe.js";import{t as N}from"./info-B5kD0bjW.js";import{t as P}from"./languages-DyqDD_jY.js";import{t as F}from"./trash-2-jm25a3wz.js";import{t as I}from"./triangle-alert-RGg8X9Hu.js";import{t as L}from"./upload-CIMqvT63.js";import{t as R}from"./wand-sparkles-DIimd5K-.js";import{t as z}from"./zap-BsvIhLIz.js";import{ai as ee,oi as te,si as B}from"./constants-7uZLiijT.js";import{E as V,Gt as ne,Kt as re,Sr as ie,Ti as H,Ut as ae,Wt as oe,Yt as U,ci as W,di as G,in as K,qn as q,qt as se,wi as ce,zi as J}from"./index-S2D3KxIN.js";import{t as le}from"./CopyToClipboard-BC8MgUTU.js";import{t as Y}from"./ImagePreview-COWWmcN6.js";import{n as ue}from"./taskDrawerMixin-DyAUhFEq.js";import{t as de}from"./Consumption-Bwtr-oKm.js";import{a as X,n as fe,r as pe,t as me}from"./pagination-C60kxWZe.js";import{t as he}from"./VideoPlayer-CYq2VZJJ.js";import{t as ge}from"./ApiCodeButton-DQfIqta7.js";import{t as _e}from"./BotPlaceholder-DUy5q_lY.js";var ve=v({name:`LayoutVeo`,components:{MagicIcon:R,ElDrawer:E,ElButton:J},mixins:[ue]}),ye={class:`main flex flex-row flex-1`},be={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},xe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Se(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,ye,[e(`div`,be,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,xe,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Ce=V(ve,[[`render`,Se],[`__scopeId`,`data-v-293c9493`]]),Z=`veo31-fast-ingredients`,we=[{value:`veo31-fast`,label:`Veo 3.1 Fast`},{value:`veo3-fast`,label:`Veo 3 Fast`},{value:`veo31`,label:`Veo 3.1`},{value:`veo3`,label:`Veo 3`}],Q=(e,t)=>{let n=!!(e?.action&&e.action!==t),r={...e,action:t};return t===`text2video`?(r.model=r.model===`veo31-fast-ingredients`?B:r.model||`veo31-fast`,delete r.image_urls,r):t===`ingredients2video`?(r.model=Z,n?delete r.image_urls:r.image_urls=r.image_urls?.slice(0,3),r):(r.model=r.model===`veo31-fast-ingredients`?B:r.model||`veo31-fast`,n?delete r.image_urls:r.image_urls=r.image_urls?.slice(0,2),r)},Te=e=>{let t={...Q(e,e?.action||`text2video`),async:!0};return t.image_urls?.length||delete t.image_urls,t},Ee=v({name:`ModelSelector`,components:{ElSelect:y,ElOption:b},computed:{isModelLocked(){return this.$store.state.veo?.config?.action===`ingredients2video`},options(){return this.isModelLocked?[{value:Z,label:`Veo 3.1 Fast`}]:we},value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=B}}),De={class:`field`},Oe={class:`title font-bold`};function ke(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,De,[e(`h2`,Oe,i(t.$t(`veo.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),disabled:t.isModelLocked},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`])])}var Ae=V(Ee,[[`render`,ke],[`__scopeId`,`data-v-90ed8cff`]]),je=v({name:`ActionSelector`,components:{ElTabs:x,ElTabPane:S},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)}]},value(){return this.$store.state.veo?.config?.action||`text2video`}},mounted(){this.$store.state.veo?.config?.action||this.onUpdate(ee)},methods:{onUpdate(e){this.$store.commit(`veo/setConfig`,Q(this.$store.state.veo?.config,e))}}}),Me={class:`tab-label`},Ne={class:`text`};function Pe(t,n,r,a,o,u){let d=l(`el-tab-pane`),m=l(`el-tabs`);return g(),f(m,{"model-value":t.value,class:`action-tabs scenario-tabs scenario-tabs--divided`,"onUpdate:modelValue":t.onUpdate},{default:p(()=>[(g(!0),s(c,null,h(t.options,t=>(g(),f(d,{key:t.value,name:t.value},{label:p(()=>[e(`span`,Me,[e(`span`,Ne,i(t.label),1)])]),_:2},1032,[`name`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Fe=V(je,[[`render`,Pe],[`__scopeId`,`data-v-c72fb85c`]]),Ie=v({name:`TranslationSelector`,components:{ElSwitch:D,InfoIcon:X},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),Le={class:`relative`},Re={class:`flex justify-between`},ze={class:`flex justify-start items-center`},Be={class:`text-sm font-bold`},Ve={class:`flex justify-end items-center`};function He(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,Le,[e(`div`,Re,[e(`div`,ze,[e(`span`,Be,i(t.$t(`veo.name.translation`)),1),a(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,Ve,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ue=V(Ie,[[`render`,He]]),We=v({name:`AspectRatioSelector`,data(){return{options:[{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=te}}),Ge={class:`text-sm font-bold mb-2 block`},Ke={class:`items`},qe=[`onClick`],Je={class:`name`};function Ye(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,Ge,i(t.$t(`veo.name.ratio`)),1),e(`div`,Ke,[(g(!0),s(c,null,h(t.options,(r,a)=>(g(),s(`div`,{key:a,class:n({active:t.active===a,item:!0}),onClick:e=>t.value=r.value},[e(`div`,{class:n([`preview`,r.label])},[e(`div`,{class:`rect`,style:m({width:r.width+`px`,height:r.height+`px`})},null,4)],2),e(`p`,Je,i(r.label),1)],10,qe))),128))])])}var Xe=V(We,[[`render`,Ye],[`__scopeId`,`data-v-28c472c4`]]),Ze=v({name:`StartEndImage`,components:{UploadIcon:L,ElUpload:C,ElButton:J,InfoIcon:X,ImagePreview:Y},mixins:[se,re,oe],props:{limit:{type:Number,default:2},ingredients:{type:Boolean,default:!1}},emits:[`change`],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},title(){return this.ingredients?this.$t(`veo.button.actionIngredients`):this.$t(`veo.name.startEndImage`)},description(){return this.ingredients?this.$t(`veo.description.imageUrl`):this.$t(`veo.description.uploadStartEndImage`)},urls(){return this.fileList.map(e=>e.response?.file_url||e.url).filter(e=>!!e)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},watch:{limit(){this.fileList.length>this.limit&&(this.fileList=this.fileList.slice(0,this.limit),this.onSetStartEndImageUrl())}},mounted(){this.fileList=(this.value||[]).map((e,t)=>({name:`reference-${t+1}`,percentage:100,response:{file_url:e},status:`success`,uid:Date.now()+t,url:e}))},methods:{onExceed(){H.warning(this.$t(`veo.message.uploadReferencesLimit`,{limit:this.limit}))},onError(){H.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()},onRemove(e){let t=this.fileList.indexOf(e);t>=0&&this.fileList.splice(t,1),this.onSetStartEndImageUrl()}}}),Qe={class:`relative`},$e={class:`flex justify-between`},et={class:`flex justify-start items-center`},tt={class:`text-sm font-bold`};function nt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,Qe,[e(`div`,$e,[e(`div`,et,[e(`span`,tt,i(t.title),1),a(h,{content:t.description},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:t.limit,class:`upload-wrapper`,multiple:!0,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var rt=V(Ze,[[`render`,nt],[`__scopeId`,`data-v-7312fe97`]]),it=v({name:`PromptInput`,components:{PromptTextarea:M},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function at(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ot=v({name:`ConfigPanel`,components:{MagicIcon:R,ElButton:J,Consumption:de,PromptInput:V(it,[[`render`,at]]),ModelSelector:Ae,StartEndImage:rt,ActionSelector:Fe,TranslationSelector:Ue,AspectRatioSelector:Xe},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},showsImages(){return this.config?.action===`image2video`||this.config?.action===`ingredients2video`},imageLimit(){return this.config?.action===`ingredients2video`?3:2},consumption(){return U(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),st={class:`flex flex-col h-full`},ct={class:`flex-1 overflow-y-auto p-5`},lt={class:`flex flex-col items-center justify-center px-5 pb-5`};function ut(t,n,c,u,d,m){let h=l(`action-selector`),_=l(`model-selector`),v=l(`start-end-image`),y=l(`prompt-input`),b=l(`aspect-ratio-selector`),x=l(`translation-selector`),S=l(`consumption`),C=l(`magic-icon`),w=l(`el-button`);return g(),s(`div`,st,[e(`div`,ct,[a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),t.showsImages?(g(),f(v,{key:t.config?.action,class:`mb-4`,limit:t.imageLimit,ingredients:t.config?.action===`ingredients2video`},null,8,[`limit`,`ingredients`])):o(``,!0),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`})]),e(`div`,lt,[a(S,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(w,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(C,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var dt=V(ot,[[`render`,ut]]),ft=v({name:`TaskPreview`,components:{DeleteIcon:F,ApplicationIcon:O,ChannelIcon:j,ExpandIcon:A,InfoIcon:N,LanguageIcon:P,LightningIcon:z,MagicIcon:R,TimeIcon:k,WarningIcon:I,CopyToClipboard:le,ElAlert:T,VideoPlayer:he,ImagePreview:Y,ElTooltip:w,ElButton:J,ApiCodeButton:ge},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{referenceImages(){let e=this.modelValue?.request?.image_urls;return Array.isArray(e)?e.filter(e=>typeof e==`string`&&!!e):[]},actionLabel(){let e=this.modelValue?.request,t=e?.model===`veo31-fast-ingredients`||this.referenceImages.length>2?`ingredients2video`:this.referenceImages.length>0?`image2video`:`text2video`,n=e?.action||t;return this.$t({text2video:`veo.button.action1`,image2video:`veo.button.action2`,ingredients2video:`veo.button.actionIngredients`}[n]||`veo.name.action`)},traceId(){return this.modelValue?.response?.trace_id||this.modelValue?.trace_id},taskInfoClass(){return this.modelValue?.response?.success===!0?`success`:this.modelValue?.response?.success===!1?`failure`:`info`}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await ce.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`veo/deleteTask`,{id:e}),H.success(this.$t(`common.message.deleteTaskSuccess`))}catch{H.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),pt={class:`preview`},mt={class:`left`},ht={class:`main`},gt={class:`bot`},_t={class:`datetime`},vt=[`aria-label`],yt={class:`info`},bt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},xt={key:1,class:`prompt mt-2`},St={key:0},Ct={key:1},wt={key:0,class:n({content:!0,failed:!0})},Tt={key:0,class:`mb-4`},Et={key:1,class:n({operations:!0,"mt-2":!0})},Dt={key:1,class:n({content:!0})},Ot={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},kt={class:n({content:!0})},At={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function It(u,d,m,_,v,y){let b=l(`capability-presentation`),x=l(`delete-icon`),S=l(`el-tooltip`),C=l(`image-preview`),w=l(`video-player`),T=l(`el-button`),E=l(`api-code-button`),D=l(`warning-icon`),O=l(`info-icon`),k=l(`copy-to-clipboard`),A=l(`el-alert`),j=l(`application-icon`),M=l(`lightning-icon`),N=l(`expand-icon`),P=l(`language-icon`),F=l(`magic-icon`),I=l(`time-icon`),L=l(`channel-icon`);return g(),s(`div`,pt,[e(`div`,mt,[a(b,{capability:`veo`,part:`avatar`,class:`avatar`})]),e(`div`,ht,[e(`div`,gt,[a(b,{capability:`veo`,part:`name`}),e(`span`,_t,i(u.$dayjs.format(``+new Date(parseFloat((u.modelValue?.created_at||``).toString())*1e3))),1),a(S,{effect:`dark`,content:u.$t(`common.button.delete`),placement:`top`},{default:p(()=>[u.modelValue?.id?(g(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":u.$t(`common.button.delete`),onClick:d[0]||=t((...e)=>u.onDelete&&u.onDelete(...e),[`stop`])},[a(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,vt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,yt,[u.referenceImages.length>0?(g(),s(`div`,bt,[(g(!0),s(c,null,h(u.referenceImages,(e,t)=>(g(),f(C,{key:`${t}-${e}`,url:e,name:`reference-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),u.modelValue?.request?.prompt?(g(),s(`p`,xt,[r(i(u.modelValue?.request?.prompt)+` `,1),u.modelValue?.response?o(``,!0):(g(),s(`span`,St,` - (`+i(u.$t(`veo.status.pending`))+`) `,1)),Array.isArray(u.modelValue?.response?.data)&&u.modelValue?.response?.data[0]?.state===`running`?(g(),s(`span`,Ct,` - (`+i(u.$t(`veo.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),u.modelValue?.response?.success===!0&&u.modelValue?.response?.data?(g(),s(`div`,wt,[u.modelValue?.response?.data[0]?.video_url?(g(),s(`div`,Tt,[a(w,{src:u.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):o(``,!0),u.modelValue?.response.success?(g(),s(`div`,Et,[a(S,{class:`box-item`,effect:`dark`,content:u.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:p(()=>[u.modelValue?.response?.data[0]?.video_url?(g(),f(T,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:d[1]||=e=>u.onDownload(e,u.modelValue?.response?.data[0]?.video_url)},{default:p(()=>[r(i(u.$t(`veo.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(E,{path:`/veo/videos`,body:u.modelValue?.request},null,8,[`body`])])):o(``,!0)])):o(``,!0),u.modelValue?.response?.success===!1?(g(),s(`div`,Dt,[a(A,{closable:!1,class:`failure`},{template:p(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.failure`)),1)]),default:p(()=>[e(`p`,Ot,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.failureReason`))+`: `+i(u.modelValue?.response?.error?.message)+` `,1),a(k,{content:u.modelValue?.response?.error?.message},null,8,[`content`])])]),_:1})])):o(``,!0),e(`div`,kt,[a(A,{closable:!1,class:n([`mt-2`,`task-metadata`,u.taskInfoClass])},{default:p(()=>[u.modelValue?.request?.model?(g(),s(`p`,At,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.model`))+`: `+i(u.modelValue?.request?.model),1)])):o(``,!0),e(`p`,jt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.action`))+`: `+i(u.actionLabel),1)]),u.modelValue?.request?.aspect_ratio?(g(),s(`p`,Mt,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.ratio`))+`: `+i(u.modelValue?.request?.aspect_ratio),1)])):o(``,!0),u.modelValue?.request?.translation===void 0?o(``,!0):(g(),s(`p`,Nt,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.translation`))+`: `+i(u.$t(u.modelValue?.request?.translation?`seedance.button.on`:`seedance.button.off`)),1)])),e(`p`,$,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(k,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),u.modelValue?.elapsed?(g(),s(`p`,Pt,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.traceId?(g(),s(`p`,Ft,[a(L,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.traceId`))+`: `+i(u.traceId)+` `,1),a(k,{content:u.traceId,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1},8,[`class`])])])])}var Lt=v({name:`RecentPanel`,components:{TaskPreview:V(ft,[[`render`,It],[`__scopeId`,`data-v-d1a27ce4`]]),NoTasks:pe,BotPlaceholder:_e,ScrollList:fe},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Rt={key:0},zt={key:2,class:`w-full h-full flex items-center justify-center`};function Bt(e,t,n,r,i,u){let d=l(`bot-placeholder`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,Rt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,(e,t)=>(g(),f(m,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,zt,[a(v)])):o(``,!0)],64)}var Vt=v({name:`VeoIndex`,components:{ConfigPanel:dt,Layout:Ce,RecentPanel:V(Lt,[[`render`,Bt]])},mixins:[ne],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===W.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===W.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await me({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!ae(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let e=Te(this.config);if(!K())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if((e.action===`image2video`||e.action===`ingredients2video`)&&!(e.image_urls&&e.image_urls.length>0)){H.warning(this.$t(`veo.message.imageRequired`));return}H.info(this.$t(`veo.message.startingTask`)),ie(`veo`,q.generate(e,{token:t})).then(()=>{H.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?H.error(this.$t(`veo.message.usedUp`)):H.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ht(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Ut=V(Vt,[[`render`,Ht]]);export{Ut as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select--z-fac6_.js";import{n as x,t as S}from"./tabs-CMeHhbQd.js";import{t as C}from"./upload-GC5EGmwp.js";import{t as w}from"./tooltip-CVVApYjJ.js";import{t as T}from"./alert-G37GiXIg.js";import{t as E}from"./drawer-BF8tPGkj.js";import{t as D}from"./switch-CU7Lbydn.js";import{t as O}from"./box-BTYdpeSs.js";import{t as k}from"./clock-BbOTrjoQ.js";import{n as A,r as j,t as M}from"./PromptTextarea-O8KxwMGn.js";import{t as N}from"./info-C7eq8W70.js";import{t as P}from"./languages-kMgQhORN.js";import{t as F}from"./trash-2-B7h9iX5Q.js";import{t as I}from"./triangle-alert-C_NcfP7e.js";import{t as L}from"./upload-DRjQvPEd.js";import{t as R}from"./wand-sparkles-BQfGRD0P.js";import{t as z}from"./zap-BAyq1MAX.js";import{ai as ee,oi as te,si as B}from"./constants-7uZLiijT.js";import{E as V,Gt as ne,Kt as re,Sr as ie,Ti as H,Ut as ae,Wt as oe,Yt as U,ci as W,di as G,in as K,qn as q,qt as se,wi as ce,zi as J}from"./index-dzU0SACS.js";import{t as le}from"./CopyToClipboard-DOx2-KTG.js";import{t as Y}from"./ImagePreview-CSSReHgL.js";import{n as ue}from"./taskDrawerMixin-DyAUhFEq.js";import{t as de}from"./Consumption-JN0X0f8c.js";import{a as X,n as fe,r as pe,t as me}from"./pagination-DZKa3-YT.js";import{t as he}from"./VideoPlayer-BnwIjt1E.js";import{t as ge}from"./ApiCodeButton-Ck-LkZnA.js";import{t as _e}from"./BotPlaceholder-SAI3U7Vk.js";var ve=v({name:`LayoutVeo`,components:{MagicIcon:R,ElDrawer:E,ElButton:J},mixins:[ue]}),ye={class:`main flex flex-row flex-1`},be={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},xe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Se(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,ye,[e(`div`,be,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,xe,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Ce=V(ve,[[`render`,Se],[`__scopeId`,`data-v-293c9493`]]),Z=`veo31-fast-ingredients`,we=[{value:`veo31-fast`,label:`Veo 3.1 Fast`},{value:`veo3-fast`,label:`Veo 3 Fast`},{value:`veo31`,label:`Veo 3.1`},{value:`veo3`,label:`Veo 3`}],Q=(e,t)=>{let n=!!(e?.action&&e.action!==t),r={...e,action:t};return t===`text2video`?(r.model=r.model===`veo31-fast-ingredients`?B:r.model||`veo31-fast`,delete r.image_urls,r):t===`ingredients2video`?(r.model=Z,n?delete r.image_urls:r.image_urls=r.image_urls?.slice(0,3),r):(r.model=r.model===`veo31-fast-ingredients`?B:r.model||`veo31-fast`,n?delete r.image_urls:r.image_urls=r.image_urls?.slice(0,2),r)},Te=e=>{let t={...Q(e,e?.action||`text2video`),async:!0};return t.image_urls?.length||delete t.image_urls,t},Ee=v({name:`ModelSelector`,components:{ElSelect:y,ElOption:b},computed:{isModelLocked(){return this.$store.state.veo?.config?.action===`ingredients2video`},options(){return this.isModelLocked?[{value:Z,label:`Veo 3.1 Fast`}]:we},value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=B}}),De={class:`field`},Oe={class:`title font-bold`};function ke(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,De,[e(`h2`,Oe,i(t.$t(`veo.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),disabled:t.isModelLocked},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`])])}var Ae=V(Ee,[[`render`,ke],[`__scopeId`,`data-v-90ed8cff`]]),je=v({name:`ActionSelector`,components:{ElTabs:x,ElTabPane:S},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)}]},value(){return this.$store.state.veo?.config?.action||`text2video`}},mounted(){this.$store.state.veo?.config?.action||this.onUpdate(ee)},methods:{onUpdate(e){this.$store.commit(`veo/setConfig`,Q(this.$store.state.veo?.config,e))}}}),Me={class:`tab-label`},Ne={class:`text`};function Pe(t,n,r,a,o,u){let d=l(`el-tab-pane`),m=l(`el-tabs`);return g(),f(m,{"model-value":t.value,class:`action-tabs scenario-tabs scenario-tabs--divided`,"onUpdate:modelValue":t.onUpdate},{default:p(()=>[(g(!0),s(c,null,h(t.options,t=>(g(),f(d,{key:t.value,name:t.value},{label:p(()=>[e(`span`,Me,[e(`span`,Ne,i(t.label),1)])]),_:2},1032,[`name`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Fe=V(je,[[`render`,Pe],[`__scopeId`,`data-v-c72fb85c`]]),Ie=v({name:`TranslationSelector`,components:{ElSwitch:D,InfoIcon:X},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),Le={class:`relative`},Re={class:`flex justify-between`},ze={class:`flex justify-start items-center`},Be={class:`text-sm font-bold`},Ve={class:`flex justify-end items-center`};function He(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,Le,[e(`div`,Re,[e(`div`,ze,[e(`span`,Be,i(t.$t(`veo.name.translation`)),1),a(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,Ve,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ue=V(Ie,[[`render`,He]]),We=v({name:`AspectRatioSelector`,data(){return{options:[{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=te}}),Ge={class:`text-sm font-bold mb-2 block`},Ke={class:`items`},qe=[`onClick`],Je={class:`name`};function Ye(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,Ge,i(t.$t(`veo.name.ratio`)),1),e(`div`,Ke,[(g(!0),s(c,null,h(t.options,(r,a)=>(g(),s(`div`,{key:a,class:n({active:t.active===a,item:!0}),onClick:e=>t.value=r.value},[e(`div`,{class:n([`preview`,r.label])},[e(`div`,{class:`rect`,style:m({width:r.width+`px`,height:r.height+`px`})},null,4)],2),e(`p`,Je,i(r.label),1)],10,qe))),128))])])}var Xe=V(We,[[`render`,Ye],[`__scopeId`,`data-v-28c472c4`]]),Ze=v({name:`StartEndImage`,components:{UploadIcon:L,ElUpload:C,ElButton:J,InfoIcon:X,ImagePreview:Y},mixins:[se,re,oe],props:{limit:{type:Number,default:2},ingredients:{type:Boolean,default:!1}},emits:[`change`],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},title(){return this.ingredients?this.$t(`veo.button.actionIngredients`):this.$t(`veo.name.startEndImage`)},description(){return this.ingredients?this.$t(`veo.description.imageUrl`):this.$t(`veo.description.uploadStartEndImage`)},urls(){return this.fileList.map(e=>e.response?.file_url||e.url).filter(e=>!!e)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},watch:{limit(){this.fileList.length>this.limit&&(this.fileList=this.fileList.slice(0,this.limit),this.onSetStartEndImageUrl())}},mounted(){this.fileList=(this.value||[]).map((e,t)=>({name:`reference-${t+1}`,percentage:100,response:{file_url:e},status:`success`,uid:Date.now()+t,url:e}))},methods:{onExceed(){H.warning(this.$t(`veo.message.uploadReferencesLimit`,{limit:this.limit}))},onError(){H.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()},onRemove(e){let t=this.fileList.indexOf(e);t>=0&&this.fileList.splice(t,1),this.onSetStartEndImageUrl()}}}),Qe={class:`relative`},$e={class:`flex justify-between`},et={class:`flex justify-start items-center`},tt={class:`text-sm font-bold`};function nt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,Qe,[e(`div`,$e,[e(`div`,et,[e(`span`,tt,i(t.title),1),a(h,{content:t.description},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:t.limit,class:`upload-wrapper`,multiple:!0,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var rt=V(Ze,[[`render`,nt],[`__scopeId`,`data-v-7312fe97`]]),it=v({name:`PromptInput`,components:{PromptTextarea:M},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function at(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ot=v({name:`ConfigPanel`,components:{MagicIcon:R,ElButton:J,Consumption:de,PromptInput:V(it,[[`render`,at]]),ModelSelector:Ae,StartEndImage:rt,ActionSelector:Fe,TranslationSelector:Ue,AspectRatioSelector:Xe},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},showsImages(){return this.config?.action===`image2video`||this.config?.action===`ingredients2video`},imageLimit(){return this.config?.action===`ingredients2video`?3:2},consumption(){return U(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),st={class:`flex flex-col h-full`},ct={class:`flex-1 overflow-y-auto p-5`},lt={class:`flex flex-col items-center justify-center px-5 pb-5`};function ut(t,n,c,u,d,m){let h=l(`action-selector`),_=l(`model-selector`),v=l(`start-end-image`),y=l(`prompt-input`),b=l(`aspect-ratio-selector`),x=l(`translation-selector`),S=l(`consumption`),C=l(`magic-icon`),w=l(`el-button`);return g(),s(`div`,st,[e(`div`,ct,[a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),t.showsImages?(g(),f(v,{key:t.config?.action,class:`mb-4`,limit:t.imageLimit,ingredients:t.config?.action===`ingredients2video`},null,8,[`limit`,`ingredients`])):o(``,!0),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`})]),e(`div`,lt,[a(S,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(w,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(C,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var dt=V(ot,[[`render`,ut]]),ft=v({name:`TaskPreview`,components:{DeleteIcon:F,ApplicationIcon:O,ChannelIcon:j,ExpandIcon:A,InfoIcon:N,LanguageIcon:P,LightningIcon:z,MagicIcon:R,TimeIcon:k,WarningIcon:I,CopyToClipboard:le,ElAlert:T,VideoPlayer:he,ImagePreview:Y,ElTooltip:w,ElButton:J,ApiCodeButton:ge},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{referenceImages(){let e=this.modelValue?.request?.image_urls;return Array.isArray(e)?e.filter(e=>typeof e==`string`&&!!e):[]},actionLabel(){let e=this.modelValue?.request,t=e?.model===`veo31-fast-ingredients`||this.referenceImages.length>2?`ingredients2video`:this.referenceImages.length>0?`image2video`:`text2video`,n=e?.action||t;return this.$t({text2video:`veo.button.action1`,image2video:`veo.button.action2`,ingredients2video:`veo.button.actionIngredients`}[n]||`veo.name.action`)},traceId(){return this.modelValue?.response?.trace_id||this.modelValue?.trace_id},taskInfoClass(){return this.modelValue?.response?.success===!0?`success`:this.modelValue?.response?.success===!1?`failure`:`info`}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await ce.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`veo/deleteTask`,{id:e}),H.success(this.$t(`common.message.deleteTaskSuccess`))}catch{H.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),pt={class:`preview`},mt={class:`left`},ht={class:`main`},gt={class:`bot`},_t={class:`datetime`},vt=[`aria-label`],yt={class:`info`},bt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},xt={key:1,class:`prompt mt-2`},St={key:0},Ct={key:1},wt={key:0,class:n({content:!0,failed:!0})},Tt={key:0,class:`mb-4`},Et={key:1,class:n({operations:!0,"mt-2":!0})},Dt={key:1,class:n({content:!0})},Ot={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},kt={class:n({content:!0})},At={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function It(u,d,m,_,v,y){let b=l(`capability-presentation`),x=l(`delete-icon`),S=l(`el-tooltip`),C=l(`image-preview`),w=l(`video-player`),T=l(`el-button`),E=l(`api-code-button`),D=l(`warning-icon`),O=l(`info-icon`),k=l(`copy-to-clipboard`),A=l(`el-alert`),j=l(`application-icon`),M=l(`lightning-icon`),N=l(`expand-icon`),P=l(`language-icon`),F=l(`magic-icon`),I=l(`time-icon`),L=l(`channel-icon`);return g(),s(`div`,pt,[e(`div`,mt,[a(b,{capability:`veo`,part:`avatar`,class:`avatar`})]),e(`div`,ht,[e(`div`,gt,[a(b,{capability:`veo`,part:`name`}),e(`span`,_t,i(u.$dayjs.format(``+new Date(parseFloat((u.modelValue?.created_at||``).toString())*1e3))),1),a(S,{effect:`dark`,content:u.$t(`common.button.delete`),placement:`top`},{default:p(()=>[u.modelValue?.id?(g(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":u.$t(`common.button.delete`),onClick:d[0]||=t((...e)=>u.onDelete&&u.onDelete(...e),[`stop`])},[a(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,vt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,yt,[u.referenceImages.length>0?(g(),s(`div`,bt,[(g(!0),s(c,null,h(u.referenceImages,(e,t)=>(g(),f(C,{key:`${t}-${e}`,url:e,name:`reference-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),u.modelValue?.request?.prompt?(g(),s(`p`,xt,[r(i(u.modelValue?.request?.prompt)+` `,1),u.modelValue?.response?o(``,!0):(g(),s(`span`,St,` - (`+i(u.$t(`veo.status.pending`))+`) `,1)),Array.isArray(u.modelValue?.response?.data)&&u.modelValue?.response?.data[0]?.state===`running`?(g(),s(`span`,Ct,` - (`+i(u.$t(`veo.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),u.modelValue?.response?.success===!0&&u.modelValue?.response?.data?(g(),s(`div`,wt,[u.modelValue?.response?.data[0]?.video_url?(g(),s(`div`,Tt,[a(w,{src:u.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):o(``,!0),u.modelValue?.response.success?(g(),s(`div`,Et,[a(S,{class:`box-item`,effect:`dark`,content:u.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:p(()=>[u.modelValue?.response?.data[0]?.video_url?(g(),f(T,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:d[1]||=e=>u.onDownload(e,u.modelValue?.response?.data[0]?.video_url)},{default:p(()=>[r(i(u.$t(`veo.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(E,{path:`/veo/videos`,body:u.modelValue?.request},null,8,[`body`])])):o(``,!0)])):o(``,!0),u.modelValue?.response?.success===!1?(g(),s(`div`,Dt,[a(A,{closable:!1,class:`failure`},{template:p(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.failure`)),1)]),default:p(()=>[e(`p`,Ot,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.failureReason`))+`: `+i(u.modelValue?.response?.error?.message)+` `,1),a(k,{content:u.modelValue?.response?.error?.message},null,8,[`content`])])]),_:1})])):o(``,!0),e(`div`,kt,[a(A,{closable:!1,class:n([`mt-2`,`task-metadata`,u.taskInfoClass])},{default:p(()=>[u.modelValue?.request?.model?(g(),s(`p`,At,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.model`))+`: `+i(u.modelValue?.request?.model),1)])):o(``,!0),e(`p`,jt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.action`))+`: `+i(u.actionLabel),1)]),u.modelValue?.request?.aspect_ratio?(g(),s(`p`,Mt,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.ratio`))+`: `+i(u.modelValue?.request?.aspect_ratio),1)])):o(``,!0),u.modelValue?.request?.translation===void 0?o(``,!0):(g(),s(`p`,Nt,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.translation`))+`: `+i(u.$t(u.modelValue?.request?.translation?`seedance.button.on`:`seedance.button.off`)),1)])),e(`p`,$,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(k,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),u.modelValue?.elapsed?(g(),s(`p`,Pt,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.traceId?(g(),s(`p`,Ft,[a(L,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.traceId`))+`: `+i(u.traceId)+` `,1),a(k,{content:u.traceId,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1},8,[`class`])])])])}var Lt=v({name:`RecentPanel`,components:{TaskPreview:V(ft,[[`render`,It],[`__scopeId`,`data-v-d1a27ce4`]]),NoTasks:pe,BotPlaceholder:_e,ScrollList:fe},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Rt={key:0},zt={key:2,class:`w-full h-full flex items-center justify-center`};function Bt(e,t,n,r,i,u){let d=l(`bot-placeholder`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,Rt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,(e,t)=>(g(),f(m,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,zt,[a(v)])):o(``,!0)],64)}var Vt=v({name:`VeoIndex`,components:{ConfigPanel:dt,Layout:Ce,RecentPanel:V(Lt,[[`render`,Bt]])},mixins:[ne],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===W.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===W.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await me({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!ae(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let e=Te(this.config);if(!K())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if((e.action===`image2video`||e.action===`ingredients2video`)&&!(e.image_urls&&e.image_urls.length>0)){H.warning(this.$t(`veo.message.imageRequired`));return}H.info(this.$t(`veo.message.startingTask`)),ie(`veo`,q.generate(e,{token:t})).then(()=>{H.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?H.error(this.$t(`veo.message.usedUp`)):H.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ht(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Ut=V(Vt,[[`render`,Ht]]);export{Ut as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,rt as p,tt as m,x as h,z as g}from"./vendor-chart-Dw-P17PN.js";import{r as _,t as v}from"./select-wPYO0KL0.js";import{t as y}from"./upload-D-5KHpRy.js";import{t as b}from"./tooltip-DjLl_Tv9.js";import{t as x}from"./alert-DIqm-Kad.js";import{n as S,r as C}from"./radio-DgDgyT2l.js";import{t as w}from"./drawer-DcAaZIVn.js";import{t as T}from"./progress-bSUZvkfj.js";import{t as E}from"./check-pR3vm7Fd.js";import{t as D}from"./clock-CYQS4x6R.js";import{t as O}from"./image-B13GFkdr.js";import{t as k}from"./info-B5kD0bjW.js";import{t as A}from"./mic-hCKzZgRm.js";import{t as j}from"./music-2-Dt2ZUjFq.js";import{t as M}from"./sliders-horizontal-CI4HLf6g.js";import{t as N}from"./trash-2-jm25a3wz.js";import{t as P}from"./triangle-alert-RGg8X9Hu.js";import{t as ee}from"./upload-CIMqvT63.js";import{t as F}from"./user-CWDZ6e_c.js";import{t as I}from"./video-CeuAAsEB.js";import{t as L}from"./wand-sparkles-DIimd5K-.js";import{Or as R,Sr as z,Tr as te,br as ne,xr as re,yr as B}from"./constants-7uZLiijT.js";import{E as V,Ji as H,Kt as U,Sr as W,Ti as G,Un as K,Yt as q,ci as J,di as Y,in as X,wi as ie,zi as Z}from"./index-S2D3KxIN.js";import{t as ae}from"./CopyToClipboard-BC8MgUTU.js";import{n as oe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as se}from"./Consumption-Bwtr-oKm.js";import{a as ce,n as le,r as ue,t as de}from"./pagination-C60kxWZe.js";import{t as fe}from"./VideoPlayer-CYq2VZJJ.js";import{t as pe}from"./ApiCodeButton-DQfIqta7.js";import{t as me}from"./BotPlaceholder-DUy5q_lY.js";var he=g({name:`LayoutDigitalHuman`,components:{UserIcon:F,ElDrawer:w,ElButton:Z},mixins:[oe]}),ge={class:`main flex flex-row flex-1`},_e={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ve={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ye(t,n,r,a,s,d){let p=c(`user-icon`),g=c(`el-button`),_=c(`el-drawer`);return m(),o(`div`,ge,[e(`div`,_e,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,ve,[u(t.$slots,`result`,{},void 0,!0)]),l(i(g,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[h,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var be=V(he,[[`render`,ye],[`__scopeId`,`data-v-e912fd04`]]),xe=g({name:`DigitalHumanFileInput`,components:{ElUpload:y,ElButton:Z,ImageIcon:O,MicrophoneIcon:A,MusicIcon:j,UploadIcon:ee,VideoIcon:I},mixins:[U],props:{accept:{type:String,default:``},buttonText:{type:String,default:``},icon:{type:String,default:`upload`}},emits:[`change`],data(){return{fileList:[],uploadUrl:Y()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}}},methods:{onExceed(e){let t=this.$refs.uploader;t?.clearFiles();let n=e[0];n&&(t?.handleStart?.(n),t?.submit?.())},onError(){G.error(this.$t(`digitalhuman.message.uploadError`))},onChange(){let e=this.fileList?.[0]?.response?.file_url;this.$emit(`change`,e)}}});function Se(e,t,a,s,l,u){let p=c(`video-icon`),h=c(`image-icon`),g=c(`microphone-icon`),_=c(`music-icon`),v=c(`upload-icon`),y=c(`el-button`),b=c(`el-upload`);return m(),o(`div`,null,[i(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,accept:e.accept,name:`file`,class:`w-full`,limit:1,action:e.uploadUrl,headers:e.headers,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onChange,"on-remove":e.onChange},{default:f(()=>[i(y,{size:`small`,round:``},{default:f(()=>[e.icon===`video`?(m(),d(p,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):e.icon===`image`?(m(),d(h,{key:1,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):e.icon===`microphone`?(m(),d(g,{key:2,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):e.icon===`music`?(m(),d(_,{key:3,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):(m(),d(v,{key:4,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),n(` `+r(e.buttonText),1)]),_:1})]),_:1},8,[`file-list`,`accept`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`])])}var Q=V(xe,[[`render`,Se]]),Ce=3e3,we=60,Te=g({name:`VoiceClone`,components:{ConfirmIcon:E,MagicIcon:L,ElButton:Z,ElSelect:_,ElOption:v,ElAlert:x,FileInput:Q},data(){return{sampleUrl:void 0,lang:`zh`,cloning:!1,destroyed:!1,runId:0,DIGITALHUMAN_ALLOWED_LANGS:ne,DIGITALHUMAN_AUDIO_ACCEPT:z}},computed:{credentialToken(){return this.$store.state.digitalhuman?.credential?.token},voiceId(){return this.$store.state.digitalhuman?.config?.voice_id}},watch:{lang(){this.invalidate()}},beforeUnmount(){this.destroyed=!0,this.runId++},methods:{onSampleChange(e){this.sampleUrl=e,this.invalidate()},invalidate(){this.runId++,this.cloning=!1,this.voiceId&&this.setVoiceId(void 0)},isStale(e){return this.destroyed||e!==this.runId},setVoiceId(e){this.$store.commit(`digitalhuman/setConfig`,{...this.$store.state.digitalhuman?.config,voice_id:e})},sleep(e){return new Promise(t=>setTimeout(t,e))},async onClone(){let e=this.credentialToken;if(!this.sampleUrl||!e)return;let t=++this.runId;this.cloning=!0,this.setVoiceId(void 0);try{let{data:n}=await K.cloneVoice({audio_url:this.sampleUrl,lang:this.lang},{token:e});if(this.isStale(t))return;if(n?.voice_id){this.onCloned(n.voice_id);return}if(n?.task_id)await this.pollVoice(n.task_id,e,t);else throw Error(`no task`)}catch{this.isStale(t)||G.error(this.$t(`digitalhuman.message.voiceCloneFailed`))}finally{this.isStale(t)||(this.cloning=!1)}},async pollVoice(e,t,n){for(let r=0;r<we;r++){if(this.isStale(n)||(await this.sleep(Ce),this.isStale(n)))return;let{data:r}=await K.pollTask(e,{token:t});if(this.isStale(n))return;if(r?.voice_id){this.onCloned(r.voice_id);return}if(r?.state===`failed`)throw Error(`clone failed`)}throw Error(`timeout`)},onCloned(e){this.setVoiceId(e),G.success(this.$t(`digitalhuman.message.voiceCloneSuccess`))}}}),Ee={class:`voice-clone`},De={class:`text-xs text-[var(--el-text-color-secondary)] mb-2`},Oe={class:`flex flex-row items-center gap-2 mb-2`},ke={class:`text-xs mb-0`};function Ae(t,l,u,h,g,_){let v=c(`file-input`),y=c(`el-option`),b=c(`el-select`),x=c(`magic-icon`),S=c(`el-button`),C=c(`confirm-icon`),w=c(`el-alert`);return m(),o(`div`,Ee,[e(`p`,De,r(t.$t(`digitalhuman.description.voiceClone`)),1),e(`div`,Oe,[i(v,{accept:t.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadSample`),icon:`microphone`,onChange:t.onSampleChange},null,8,[`accept`,`button-text`,`onChange`]),i(b,{modelValue:t.lang,"onUpdate:modelValue":l[0]||=e=>t.lang=e,size:`small`,class:`!w-[90px]`},{default:f(()=>[(m(!0),o(s,null,p(t.DIGITALHUMAN_ALLOWED_LANGS,e=>(m(),d(y,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),i(S,{size:`small`,type:`primary`,round:``,loading:t.cloning,disabled:!t.sampleUrl||t.cloning,onClick:t.onClone},{default:f(()=>[i(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.cloning?t.$t(`digitalhuman.button.cloning`):t.$t(`digitalhuman.button.clone`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`]),t.voiceId?(m(),d(w,{key:0,closable:!1,type:`success`,class:`mt-2`},{default:f(()=>[e(`p`,ke,[i(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.$t(`digitalhuman.name.voiceReady`))+`: `+r(t.voiceId),1)])]),_:1})):a(``,!0)])}var je=g({name:`ConfigPanel`,components:{UserIcon:F,ElButton:Z,ElInput:H,ElRadioGroup:C,ElRadioButton:S,Consumption:se,InfoIcon:ce,FileInput:Q,VoiceClone:V(Te,[[`render`,Ae]])},emits:[`generate`],data(){return{faceMode:`video`,voiceMode:`audio`,DIGITALHUMAN_ALLOWED_ENGINES:B,DIGITALHUMAN_ALLOWED_RESOLUTIONS:re,DIGITALHUMAN_VIDEO_ACCEPT:R,DIGITALHUMAN_IMAGE_ACCEPT:te,DIGITALHUMAN_AUDIO_ACCEPT:z}},computed:{config(){return this.$store.state.digitalhuman?.config},service(){return this.$store.state.digitalhuman?.service},consumption(){return q(this.config,this.service?.cost)},canGenerate(){let e=this.faceMode===`video`?!!this.config?.video_url:!!this.config?.image_url,t=this.voiceMode===`audio`?!!this.config?.audio_url:!!this.config?.text?.trim()&&!!this.config?.voice_id;return e&&t},text:{get(){return this.config?.text},set(e){this.update({text:e})}},engine:{get(){return this.config?.engine},set(e){this.update({engine:e})}},resolution:{get(){return this.config?.resolution},set(e){this.update({resolution:e})}}},mounted(){this.config?.image_url&&!this.config?.video_url&&(this.faceMode=`photo`),(this.config?.text||this.config?.voice_id)&&(this.voiceMode=`text`),this.update({engine:this.config?.engine??`latentsync`,resolution:this.config?.resolution??`720p`})},methods:{update(e){this.$store.commit(`digitalhuman/setConfig`,{...this.config,...e})},onFaceModeChange(e){this.update(e===`video`?{image_url:void 0}:{video_url:void 0})},onVoiceModeChange(e){this.update(e===`audio`?{text:void 0,voice_id:void 0}:{audio_url:void 0})},onFaceVideoChange(e){this.update({video_url:e})},onFacePhotoChange(e){this.update({image_url:e})},onAudioChange(e){this.update({audio_url:e})},onGenerate(){let e=this.config||{},t={engine:e.engine,resolution:e.resolution};this.faceMode===`video`?t.video_url=e.video_url:t.image_url=e.image_url,this.voiceMode===`audio`?t.audio_url=e.audio_url:(t.text=e.text,t.voice_id=e.voice_id),this.$emit(`generate`,t)}}}),Me={class:`flex flex-col h-full`},Ne={class:`flex-1 overflow-y-auto p-5`},Pe={class:`field-block mb-5`},Fe={class:`field-head`},Ie={class:`field-title font-bold`},Le={class:`field-block mb-5`},Re={class:`field-head`},ze={class:`field-title font-bold`},Be={class:`field-block mb-5`},Ve={class:`field-head`},He={class:`field-title font-bold`},Ue={class:`field-block`},We={class:`field-head`},Ge={class:`field-title font-bold`},Ke={class:`flex flex-col items-center justify-center px-5 pb-5`};function qe(t,a,l,u,h,g){let _=c(`info-icon`),v=c(`el-radio-button`),y=c(`el-radio-group`),b=c(`file-input`),x=c(`el-input`),S=c(`voice-clone`),C=c(`consumption`),w=c(`user-icon`),T=c(`el-button`);return m(),o(`div`,Me,[e(`div`,Ne,[e(`div`,Pe,[e(`div`,Fe,[e(`h2`,Ie,r(t.$t(`digitalhuman.name.face`)),1),i(_,{content:t.$t(`digitalhuman.description.face`),class:`ml-1`},null,8,[`content`])]),i(y,{modelValue:t.faceMode,"onUpdate:modelValue":a[0]||=e=>t.faceMode=e,class:`w-full mb-2`,onChange:t.onFaceModeChange},{default:f(()=>[i(v,{value:`video`},{default:f(()=>[n(r(t.$t(`digitalhuman.name.faceVideo`)),1)]),_:1}),i(v,{value:`photo`},{default:f(()=>[n(r(t.$t(`digitalhuman.name.facePhoto`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),t.faceMode===`video`?(m(),d(b,{key:0,accept:t.DIGITALHUMAN_VIDEO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadVideo`),icon:`video`,onChange:t.onFaceVideoChange},null,8,[`accept`,`button-text`,`onChange`])):(m(),d(b,{key:1,accept:t.DIGITALHUMAN_IMAGE_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadPhoto`),icon:`image`,onChange:t.onFacePhotoChange},null,8,[`accept`,`button-text`,`onChange`]))]),e(`div`,Le,[e(`div`,Re,[e(`h2`,ze,r(t.$t(`digitalhuman.name.voice`)),1)]),i(y,{modelValue:t.voiceMode,"onUpdate:modelValue":a[1]||=e=>t.voiceMode=e,class:`w-full mb-2`,onChange:t.onVoiceModeChange},{default:f(()=>[i(v,{value:`audio`},{default:f(()=>[n(r(t.$t(`digitalhuman.name.voiceAudio`)),1)]),_:1}),i(v,{value:`text`},{default:f(()=>[n(r(t.$t(`digitalhuman.name.voiceText`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),t.voiceMode===`audio`?(m(),d(b,{key:0,accept:t.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadAudio`),icon:`music`,onChange:t.onAudioChange},null,8,[`accept`,`button-text`,`onChange`])):(m(),o(s,{key:1},[i(x,{modelValue:t.text,"onUpdate:modelValue":a[2]||=e=>t.text=e,type:`textarea`,rows:4,placeholder:t.$t(`digitalhuman.placeholder.text`),class:`mb-2`},null,8,[`modelValue`,`placeholder`]),i(S)],64))]),e(`div`,Be,[e(`div`,Ve,[e(`h2`,He,r(t.$t(`digitalhuman.name.engine`)),1)]),i(y,{modelValue:t.engine,"onUpdate:modelValue":a[3]||=e=>t.engine=e,class:`w-full`},{default:f(()=>[(m(!0),o(s,null,p(t.DIGITALHUMAN_ALLOWED_ENGINES,e=>(m(),d(v,{key:e,value:e},{default:f(()=>[n(r(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])]),e(`div`,Ue,[e(`div`,We,[e(`h2`,Ge,r(t.$t(`digitalhuman.name.resolution`)),1)]),i(y,{modelValue:t.resolution,"onUpdate:modelValue":a[4]||=e=>t.resolution=e,class:`w-full`},{default:f(()=>[(m(!0),o(s,null,p(t.DIGITALHUMAN_ALLOWED_RESOLUTIONS,e=>(m(),d(v,{key:e,value:e},{default:f(()=>[n(r(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])])]),e(`div`,Ke,[i(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(T,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:f(()=>[i(w,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.$t(`digitalhuman.button.generate`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Je=V(je,[[`render`,qe],[`__scopeId`,`data-v-5ae1f07d`]]),Ye=g({name:`TaskPreview`,components:{DeleteIcon:N,ElTooltip:b,ControlsIcon:M,ImageIcon:O,InfoIcon:k,TimeIcon:D,UserIcon:F,VideoIcon:I,WarningIcon:P,CopyToClipboard:ae,ElAlert:x,ElProgress:T,VideoPlayer:fe,ElButton:Z,ApiCodeButton:pe},props:{modelValue:{type:Object,required:!0}},computed:{status(){return this.modelValue?.status||this.modelValue?.response?.state||`pending`},isSuccess(){return[`succeed`,`succeeded`].includes(this.status)||!!this.modelValue?.response?.video_url},isFailure(){return[`failed`,`dead`].includes(this.status)||this.modelValue?.response?.success===!1},isTerminal(){return this.isSuccess||this.isFailure},videoUrl(){return this.modelValue?.response?.video_url},progressPct(){let e=this.modelValue?.response?.progress;return typeof e==`number`?e:0},voiceLabel(){return this.modelValue?.request?.audio_url?this.$t(`digitalhuman.name.audioDriven`):this.$t(`digitalhuman.name.textDriven`)},faceLabel(){return this.modelValue?.request?.image_url?this.$t(`digitalhuman.name.facePhoto`):this.$t(`digitalhuman.name.faceVideo`)},engineLabel(){return this.modelValue?.request?.engine||this.modelValue?.response?.engine||`latentsync`},statusLabel(){let e=`digitalhuman.status.${this.status}`,t=this.$t(e);return t===e?this.$t(`digitalhuman.status.processing`):t},failureReason(){let e=this.modelValue?.response?.error;if(e)return typeof e==`string`?e:e?.message}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await ie.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`digitalhuman/deleteTask`,{id:e}),G.success(this.$t(`common.message.deleteTaskSuccess`))}catch{G.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),window.open(t,`_blank`)}}}),Xe={class:`preview`},Ze={class:`left`},Qe={class:`main`},$e={class:`bot`},et={class:`datetime`},tt=[`aria-label`],nt={class:`info`},rt={key:0,class:`prompt mt-2`},it={key:0},at={key:1,class:`prompt mt-2`},ot={key:0},st={class:`text-xs text-[var(--el-text-color-secondary)] mb-1`},ct={class:`ml-2`},lt={key:0,class:`content`},ut={class:`text-xs text-[var(--el-text-color-secondary)] mb-1`},dt={key:1,class:`content`},ft={class:`operations mt-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},mt={key:2,class:`content`},ht={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function _t(s,l,u,p,h,g){let _=c(`capability-presentation`),v=c(`delete-icon`),y=c(`el-tooltip`),b=c(`image-icon`),x=c(`video-icon`),S=c(`controls-icon`),C=c(`el-progress`),w=c(`video-player`),T=c(`el-button`),E=c(`api-code-button`),D=c(`user-icon`),O=c(`copy-to-clipboard`),k=c(`time-icon`),A=c(`el-alert`),j=c(`warning-icon`),M=c(`info-icon`);return m(),o(`div`,Xe,[e(`div`,Ze,[i(_,{capability:`digitalhuman`,part:`avatar`,class:`avatar`})]),e(`div`,Qe,[e(`div`,$e,[i(_,{capability:`digitalhuman`,part:`name`}),e(`span`,et,r(s.$dayjs.format(``+new Date(parseFloat((s.modelValue?.created_at||``).toString())*1e3))),1),i(y,{effect:`dark`,content:s.$t(`common.button.delete`),placement:`top`},{default:f(()=>[s.modelValue?.id?(m(),o(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":s.$t(`common.button.delete`),onClick:l[0]||=t((...e)=>s.onDelete&&s.onDelete(...e),[`stop`])},[i(v,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,tt)):a(``,!0)]),_:1},8,[`content`])]),e(`div`,nt,[s.modelValue?.request?.text?(m(),o(`p`,rt,[n(r(s.modelValue?.request?.text)+` `,1),s.isTerminal?a(``,!0):(m(),o(`span`,it,` - (`+r(s.statusLabel)+`) `,1))])):(m(),o(`p`,at,[n(r(s.voiceLabel)+` `,1),s.isTerminal?a(``,!0):(m(),o(`span`,ot,` - (`+r(s.statusLabel)+`) `,1))])),e(`p`,st,[s.modelValue?.request?.image_url?(m(),d(b,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):(m(),d(x,{key:1,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),n(` `+r(s.faceLabel)+` `,1),e(`span`,ct,[i(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(r(s.engineLabel),1)])])]),s.isTerminal?a(``,!0):(m(),o(`div`,lt,[e(`p`,ut,r(s.statusLabel),1),i(C,{percentage:s.progressPct,"stroke-width":6},null,8,[`percentage`])])),s.isSuccess?(m(),o(`div`,dt,[s.videoUrl?(m(),d(w,{key:0,src:s.videoUrl},null,8,[`src`])):a(``,!0),e(`div`,ft,[s.videoUrl?(m(),d(T,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:l[1]||=e=>s.onDownload(e,s.videoUrl)},{default:f(()=>[n(r(s.$t(`digitalhuman.button.download`)),1)]),_:1})):a(``,!0),i(E,{path:`/digital-human/videos`,body:s.modelValue?.request},null,8,[`body`])]),i(A,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,$,[i(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(s.$t(`digitalhuman.name.taskId`))+`: `+r(s.modelValue?.id)+` `,1),i(O,{content:s.modelValue?.id},null,8,[`content`])]),s.modelValue?.elapsed?(m(),o(`p`,pt,[i(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(s.$t(`digitalhuman.name.elapsed`))+`: `+r(s.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),s.isFailure?(m(),o(`div`,mt,[i(A,{closable:!1,class:`failure`},{template:f(()=>[i(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(s.$t(`digitalhuman.name.failure`)),1)]),default:f(()=>[e(`p`,ht,[i(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(s.$t(`digitalhuman.name.taskId`))+`: `+r(s.modelValue?.id)+` `,1),i(O,{content:s.modelValue?.id},null,8,[`content`])]),s.failureReason?(m(),o(`p`,gt,[i(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(s.$t(`digitalhuman.name.failureReason`))+`: `+r(s.failureReason),1)])):a(``,!0)]),_:1})])):a(``,!0)])])}var vt=g({name:`RecentPanel`,components:{TaskPreview:V(Ye,[[`render`,_t],[`__scopeId`,`data-v-03383155`]]),NoTasks:ue,BotPlaceholder:me,ScrollList:le},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.digitalhuman?.tasks,items:this.$store.state.digitalhuman?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),yt={key:0},bt={key:2,class:`w-full h-full flex items-center justify-center`};function xt(e,t,n,r,l,u){let h=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return m(),o(s,null,[e.tasks?.items===void 0?(m(),o(`div`,yt,[i(h)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(m(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(m(!0),o(s,null,p(e.tasks?.items,(e,t)=>(m(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(m(),o(`div`,bt,[i(v)])):a(``,!0)],64)}var St=g({name:`DigitalHumanIndex`,components:{ConfigPanel:Je,Layout:be,RecentPanel:V(vt,[[`render`,xt]])},inject:[`initialized`],data(){return{job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.digitalhuman?.status?.getApplications===J.Request},tasksLoading(){return this.$store.state.digitalhuman?.status?.getTasks===J.Request||this.fetchingTasks},credential(){return this.$store.state.digitalhuman.credential},config(){return this.$store.state.digitalhuman.config},tasks(){return this.$store.state.digitalhuman.tasks}},watch:{initialized:{async handler(e){window.clearInterval(this.job),e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await de({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`digitalhuman/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`digitalhuman/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(e){if(!X())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}G.info(this.$t(`digitalhuman.message.startingTask`)),W(`digitalhuman`,K.generate(e,{token:t})).then(()=>{G.success(this.$t(`digitalhuman.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?G.error(this.$t(`digitalhuman.message.usedUp`)):G.error(this.$t(`digitalhuman.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ct(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return m(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var wt=V(St,[[`render`,Ct]]);export{wt as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,rt as p,tt as m,x as h,z as g}from"./vendor-chart-Dw-P17PN.js";import{r as _,t as v}from"./select--z-fac6_.js";import{t as y}from"./upload-GC5EGmwp.js";import{t as b}from"./tooltip-CVVApYjJ.js";import{t as x}from"./alert-G37GiXIg.js";import{n as S,r as C}from"./radio-DgDgyT2l.js";import{t as w}from"./drawer-BF8tPGkj.js";import{t as T}from"./progress-bSUZvkfj.js";import{t as E}from"./check-D47LmiyR.js";import{t as D}from"./clock-BbOTrjoQ.js";import{t as O}from"./image-4hDRDwRY.js";import{t as k}from"./info-C7eq8W70.js";import{t as A}from"./mic-U9HFofCv.js";import{t as j}from"./music-2-Bntsr1pc.js";import{t as M}from"./sliders-horizontal-BJThi7W3.js";import{t as N}from"./trash-2-B7h9iX5Q.js";import{t as P}from"./triangle-alert-C_NcfP7e.js";import{t as ee}from"./upload-DRjQvPEd.js";import{t as F}from"./user-DAcxFEzJ.js";import{t as I}from"./video-DzECS7d8.js";import{t as L}from"./wand-sparkles-BQfGRD0P.js";import{Or as R,Sr as z,Tr as te,br as ne,xr as re,yr as B}from"./constants-7uZLiijT.js";import{E as V,Ji as H,Kt as U,Sr as W,Ti as G,Un as K,Yt as q,ci as J,di as Y,in as X,wi as ie,zi as Z}from"./index-dzU0SACS.js";import{t as ae}from"./CopyToClipboard-DOx2-KTG.js";import{n as oe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as se}from"./Consumption-JN0X0f8c.js";import{a as ce,n as le,r as ue,t as de}from"./pagination-DZKa3-YT.js";import{t as fe}from"./VideoPlayer-BnwIjt1E.js";import{t as pe}from"./ApiCodeButton-Ck-LkZnA.js";import{t as me}from"./BotPlaceholder-SAI3U7Vk.js";var he=g({name:`LayoutDigitalHuman`,components:{UserIcon:F,ElDrawer:w,ElButton:Z},mixins:[oe]}),ge={class:`main flex flex-row flex-1`},_e={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ve={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ye(t,n,r,a,s,d){let p=c(`user-icon`),g=c(`el-button`),_=c(`el-drawer`);return m(),o(`div`,ge,[e(`div`,_e,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,ve,[u(t.$slots,`result`,{},void 0,!0)]),l(i(g,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[h,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var be=V(he,[[`render`,ye],[`__scopeId`,`data-v-e912fd04`]]),xe=g({name:`DigitalHumanFileInput`,components:{ElUpload:y,ElButton:Z,ImageIcon:O,MicrophoneIcon:A,MusicIcon:j,UploadIcon:ee,VideoIcon:I},mixins:[U],props:{accept:{type:String,default:``},buttonText:{type:String,default:``},icon:{type:String,default:`upload`}},emits:[`change`],data(){return{fileList:[],uploadUrl:Y()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}}},methods:{onExceed(e){let t=this.$refs.uploader;t?.clearFiles();let n=e[0];n&&(t?.handleStart?.(n),t?.submit?.())},onError(){G.error(this.$t(`digitalhuman.message.uploadError`))},onChange(){let e=this.fileList?.[0]?.response?.file_url;this.$emit(`change`,e)}}});function Se(e,t,a,s,l,u){let p=c(`video-icon`),h=c(`image-icon`),g=c(`microphone-icon`),_=c(`music-icon`),v=c(`upload-icon`),y=c(`el-button`),b=c(`el-upload`);return m(),o(`div`,null,[i(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,accept:e.accept,name:`file`,class:`w-full`,limit:1,action:e.uploadUrl,headers:e.headers,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onChange,"on-remove":e.onChange},{default:f(()=>[i(y,{size:`small`,round:``},{default:f(()=>[e.icon===`video`?(m(),d(p,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):e.icon===`image`?(m(),d(h,{key:1,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):e.icon===`microphone`?(m(),d(g,{key:2,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):e.icon===`music`?(m(),d(_,{key:3,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):(m(),d(v,{key:4,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),n(` `+r(e.buttonText),1)]),_:1})]),_:1},8,[`file-list`,`accept`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`])])}var Q=V(xe,[[`render`,Se]]),Ce=3e3,we=60,Te=g({name:`VoiceClone`,components:{ConfirmIcon:E,MagicIcon:L,ElButton:Z,ElSelect:_,ElOption:v,ElAlert:x,FileInput:Q},data(){return{sampleUrl:void 0,lang:`zh`,cloning:!1,destroyed:!1,runId:0,DIGITALHUMAN_ALLOWED_LANGS:ne,DIGITALHUMAN_AUDIO_ACCEPT:z}},computed:{credentialToken(){return this.$store.state.digitalhuman?.credential?.token},voiceId(){return this.$store.state.digitalhuman?.config?.voice_id}},watch:{lang(){this.invalidate()}},beforeUnmount(){this.destroyed=!0,this.runId++},methods:{onSampleChange(e){this.sampleUrl=e,this.invalidate()},invalidate(){this.runId++,this.cloning=!1,this.voiceId&&this.setVoiceId(void 0)},isStale(e){return this.destroyed||e!==this.runId},setVoiceId(e){this.$store.commit(`digitalhuman/setConfig`,{...this.$store.state.digitalhuman?.config,voice_id:e})},sleep(e){return new Promise(t=>setTimeout(t,e))},async onClone(){let e=this.credentialToken;if(!this.sampleUrl||!e)return;let t=++this.runId;this.cloning=!0,this.setVoiceId(void 0);try{let{data:n}=await K.cloneVoice({audio_url:this.sampleUrl,lang:this.lang},{token:e});if(this.isStale(t))return;if(n?.voice_id){this.onCloned(n.voice_id);return}if(n?.task_id)await this.pollVoice(n.task_id,e,t);else throw Error(`no task`)}catch{this.isStale(t)||G.error(this.$t(`digitalhuman.message.voiceCloneFailed`))}finally{this.isStale(t)||(this.cloning=!1)}},async pollVoice(e,t,n){for(let r=0;r<we;r++){if(this.isStale(n)||(await this.sleep(Ce),this.isStale(n)))return;let{data:r}=await K.pollTask(e,{token:t});if(this.isStale(n))return;if(r?.voice_id){this.onCloned(r.voice_id);return}if(r?.state===`failed`)throw Error(`clone failed`)}throw Error(`timeout`)},onCloned(e){this.setVoiceId(e),G.success(this.$t(`digitalhuman.message.voiceCloneSuccess`))}}}),Ee={class:`voice-clone`},De={class:`text-xs text-[var(--el-text-color-secondary)] mb-2`},Oe={class:`flex flex-row items-center gap-2 mb-2`},ke={class:`text-xs mb-0`};function Ae(t,l,u,h,g,_){let v=c(`file-input`),y=c(`el-option`),b=c(`el-select`),x=c(`magic-icon`),S=c(`el-button`),C=c(`confirm-icon`),w=c(`el-alert`);return m(),o(`div`,Ee,[e(`p`,De,r(t.$t(`digitalhuman.description.voiceClone`)),1),e(`div`,Oe,[i(v,{accept:t.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadSample`),icon:`microphone`,onChange:t.onSampleChange},null,8,[`accept`,`button-text`,`onChange`]),i(b,{modelValue:t.lang,"onUpdate:modelValue":l[0]||=e=>t.lang=e,size:`small`,class:`!w-[90px]`},{default:f(()=>[(m(!0),o(s,null,p(t.DIGITALHUMAN_ALLOWED_LANGS,e=>(m(),d(y,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),i(S,{size:`small`,type:`primary`,round:``,loading:t.cloning,disabled:!t.sampleUrl||t.cloning,onClick:t.onClone},{default:f(()=>[i(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.cloning?t.$t(`digitalhuman.button.cloning`):t.$t(`digitalhuman.button.clone`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`]),t.voiceId?(m(),d(w,{key:0,closable:!1,type:`success`,class:`mt-2`},{default:f(()=>[e(`p`,ke,[i(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.$t(`digitalhuman.name.voiceReady`))+`: `+r(t.voiceId),1)])]),_:1})):a(``,!0)])}var je=g({name:`ConfigPanel`,components:{UserIcon:F,ElButton:Z,ElInput:H,ElRadioGroup:C,ElRadioButton:S,Consumption:se,InfoIcon:ce,FileInput:Q,VoiceClone:V(Te,[[`render`,Ae]])},emits:[`generate`],data(){return{faceMode:`video`,voiceMode:`audio`,DIGITALHUMAN_ALLOWED_ENGINES:B,DIGITALHUMAN_ALLOWED_RESOLUTIONS:re,DIGITALHUMAN_VIDEO_ACCEPT:R,DIGITALHUMAN_IMAGE_ACCEPT:te,DIGITALHUMAN_AUDIO_ACCEPT:z}},computed:{config(){return this.$store.state.digitalhuman?.config},service(){return this.$store.state.digitalhuman?.service},consumption(){return q(this.config,this.service?.cost)},canGenerate(){let e=this.faceMode===`video`?!!this.config?.video_url:!!this.config?.image_url,t=this.voiceMode===`audio`?!!this.config?.audio_url:!!this.config?.text?.trim()&&!!this.config?.voice_id;return e&&t},text:{get(){return this.config?.text},set(e){this.update({text:e})}},engine:{get(){return this.config?.engine},set(e){this.update({engine:e})}},resolution:{get(){return this.config?.resolution},set(e){this.update({resolution:e})}}},mounted(){this.config?.image_url&&!this.config?.video_url&&(this.faceMode=`photo`),(this.config?.text||this.config?.voice_id)&&(this.voiceMode=`text`),this.update({engine:this.config?.engine??`latentsync`,resolution:this.config?.resolution??`720p`})},methods:{update(e){this.$store.commit(`digitalhuman/setConfig`,{...this.config,...e})},onFaceModeChange(e){this.update(e===`video`?{image_url:void 0}:{video_url:void 0})},onVoiceModeChange(e){this.update(e===`audio`?{text:void 0,voice_id:void 0}:{audio_url:void 0})},onFaceVideoChange(e){this.update({video_url:e})},onFacePhotoChange(e){this.update({image_url:e})},onAudioChange(e){this.update({audio_url:e})},onGenerate(){let e=this.config||{},t={engine:e.engine,resolution:e.resolution};this.faceMode===`video`?t.video_url=e.video_url:t.image_url=e.image_url,this.voiceMode===`audio`?t.audio_url=e.audio_url:(t.text=e.text,t.voice_id=e.voice_id),this.$emit(`generate`,t)}}}),Me={class:`flex flex-col h-full`},Ne={class:`flex-1 overflow-y-auto p-5`},Pe={class:`field-block mb-5`},Fe={class:`field-head`},Ie={class:`field-title font-bold`},Le={class:`field-block mb-5`},Re={class:`field-head`},ze={class:`field-title font-bold`},Be={class:`field-block mb-5`},Ve={class:`field-head`},He={class:`field-title font-bold`},Ue={class:`field-block`},We={class:`field-head`},Ge={class:`field-title font-bold`},Ke={class:`flex flex-col items-center justify-center px-5 pb-5`};function qe(t,a,l,u,h,g){let _=c(`info-icon`),v=c(`el-radio-button`),y=c(`el-radio-group`),b=c(`file-input`),x=c(`el-input`),S=c(`voice-clone`),C=c(`consumption`),w=c(`user-icon`),T=c(`el-button`);return m(),o(`div`,Me,[e(`div`,Ne,[e(`div`,Pe,[e(`div`,Fe,[e(`h2`,Ie,r(t.$t(`digitalhuman.name.face`)),1),i(_,{content:t.$t(`digitalhuman.description.face`),class:`ml-1`},null,8,[`content`])]),i(y,{modelValue:t.faceMode,"onUpdate:modelValue":a[0]||=e=>t.faceMode=e,class:`w-full mb-2`,onChange:t.onFaceModeChange},{default:f(()=>[i(v,{value:`video`},{default:f(()=>[n(r(t.$t(`digitalhuman.name.faceVideo`)),1)]),_:1}),i(v,{value:`photo`},{default:f(()=>[n(r(t.$t(`digitalhuman.name.facePhoto`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),t.faceMode===`video`?(m(),d(b,{key:0,accept:t.DIGITALHUMAN_VIDEO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadVideo`),icon:`video`,onChange:t.onFaceVideoChange},null,8,[`accept`,`button-text`,`onChange`])):(m(),d(b,{key:1,accept:t.DIGITALHUMAN_IMAGE_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadPhoto`),icon:`image`,onChange:t.onFacePhotoChange},null,8,[`accept`,`button-text`,`onChange`]))]),e(`div`,Le,[e(`div`,Re,[e(`h2`,ze,r(t.$t(`digitalhuman.name.voice`)),1)]),i(y,{modelValue:t.voiceMode,"onUpdate:modelValue":a[1]||=e=>t.voiceMode=e,class:`w-full mb-2`,onChange:t.onVoiceModeChange},{default:f(()=>[i(v,{value:`audio`},{default:f(()=>[n(r(t.$t(`digitalhuman.name.voiceAudio`)),1)]),_:1}),i(v,{value:`text`},{default:f(()=>[n(r(t.$t(`digitalhuman.name.voiceText`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),t.voiceMode===`audio`?(m(),d(b,{key:0,accept:t.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadAudio`),icon:`music`,onChange:t.onAudioChange},null,8,[`accept`,`button-text`,`onChange`])):(m(),o(s,{key:1},[i(x,{modelValue:t.text,"onUpdate:modelValue":a[2]||=e=>t.text=e,type:`textarea`,rows:4,placeholder:t.$t(`digitalhuman.placeholder.text`),class:`mb-2`},null,8,[`modelValue`,`placeholder`]),i(S)],64))]),e(`div`,Be,[e(`div`,Ve,[e(`h2`,He,r(t.$t(`digitalhuman.name.engine`)),1)]),i(y,{modelValue:t.engine,"onUpdate:modelValue":a[3]||=e=>t.engine=e,class:`w-full`},{default:f(()=>[(m(!0),o(s,null,p(t.DIGITALHUMAN_ALLOWED_ENGINES,e=>(m(),d(v,{key:e,value:e},{default:f(()=>[n(r(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])]),e(`div`,Ue,[e(`div`,We,[e(`h2`,Ge,r(t.$t(`digitalhuman.name.resolution`)),1)]),i(y,{modelValue:t.resolution,"onUpdate:modelValue":a[4]||=e=>t.resolution=e,class:`w-full`},{default:f(()=>[(m(!0),o(s,null,p(t.DIGITALHUMAN_ALLOWED_RESOLUTIONS,e=>(m(),d(v,{key:e,value:e},{default:f(()=>[n(r(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])])]),e(`div`,Ke,[i(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(T,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:f(()=>[i(w,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.$t(`digitalhuman.button.generate`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Je=V(je,[[`render`,qe],[`__scopeId`,`data-v-5ae1f07d`]]),Ye=g({name:`TaskPreview`,components:{DeleteIcon:N,ElTooltip:b,ControlsIcon:M,ImageIcon:O,InfoIcon:k,TimeIcon:D,UserIcon:F,VideoIcon:I,WarningIcon:P,CopyToClipboard:ae,ElAlert:x,ElProgress:T,VideoPlayer:fe,ElButton:Z,ApiCodeButton:pe},props:{modelValue:{type:Object,required:!0}},computed:{status(){return this.modelValue?.status||this.modelValue?.response?.state||`pending`},isSuccess(){return[`succeed`,`succeeded`].includes(this.status)||!!this.modelValue?.response?.video_url},isFailure(){return[`failed`,`dead`].includes(this.status)||this.modelValue?.response?.success===!1},isTerminal(){return this.isSuccess||this.isFailure},videoUrl(){return this.modelValue?.response?.video_url},progressPct(){let e=this.modelValue?.response?.progress;return typeof e==`number`?e:0},voiceLabel(){return this.modelValue?.request?.audio_url?this.$t(`digitalhuman.name.audioDriven`):this.$t(`digitalhuman.name.textDriven`)},faceLabel(){return this.modelValue?.request?.image_url?this.$t(`digitalhuman.name.facePhoto`):this.$t(`digitalhuman.name.faceVideo`)},engineLabel(){return this.modelValue?.request?.engine||this.modelValue?.response?.engine||`latentsync`},statusLabel(){let e=`digitalhuman.status.${this.status}`,t=this.$t(e);return t===e?this.$t(`digitalhuman.status.processing`):t},failureReason(){let e=this.modelValue?.response?.error;if(e)return typeof e==`string`?e:e?.message}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await ie.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`digitalhuman/deleteTask`,{id:e}),G.success(this.$t(`common.message.deleteTaskSuccess`))}catch{G.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),window.open(t,`_blank`)}}}),Xe={class:`preview`},Ze={class:`left`},Qe={class:`main`},$e={class:`bot`},et={class:`datetime`},tt=[`aria-label`],nt={class:`info`},rt={key:0,class:`prompt mt-2`},it={key:0},at={key:1,class:`prompt mt-2`},ot={key:0},st={class:`text-xs text-[var(--el-text-color-secondary)] mb-1`},ct={class:`ml-2`},lt={key:0,class:`content`},ut={class:`text-xs text-[var(--el-text-color-secondary)] mb-1`},dt={key:1,class:`content`},ft={class:`operations mt-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},mt={key:2,class:`content`},ht={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function _t(s,l,u,p,h,g){let _=c(`capability-presentation`),v=c(`delete-icon`),y=c(`el-tooltip`),b=c(`image-icon`),x=c(`video-icon`),S=c(`controls-icon`),C=c(`el-progress`),w=c(`video-player`),T=c(`el-button`),E=c(`api-code-button`),D=c(`user-icon`),O=c(`copy-to-clipboard`),k=c(`time-icon`),A=c(`el-alert`),j=c(`warning-icon`),M=c(`info-icon`);return m(),o(`div`,Xe,[e(`div`,Ze,[i(_,{capability:`digitalhuman`,part:`avatar`,class:`avatar`})]),e(`div`,Qe,[e(`div`,$e,[i(_,{capability:`digitalhuman`,part:`name`}),e(`span`,et,r(s.$dayjs.format(``+new Date(parseFloat((s.modelValue?.created_at||``).toString())*1e3))),1),i(y,{effect:`dark`,content:s.$t(`common.button.delete`),placement:`top`},{default:f(()=>[s.modelValue?.id?(m(),o(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":s.$t(`common.button.delete`),onClick:l[0]||=t((...e)=>s.onDelete&&s.onDelete(...e),[`stop`])},[i(v,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,tt)):a(``,!0)]),_:1},8,[`content`])]),e(`div`,nt,[s.modelValue?.request?.text?(m(),o(`p`,rt,[n(r(s.modelValue?.request?.text)+` `,1),s.isTerminal?a(``,!0):(m(),o(`span`,it,` - (`+r(s.statusLabel)+`) `,1))])):(m(),o(`p`,at,[n(r(s.voiceLabel)+` `,1),s.isTerminal?a(``,!0):(m(),o(`span`,ot,` - (`+r(s.statusLabel)+`) `,1))])),e(`p`,st,[s.modelValue?.request?.image_url?(m(),d(b,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):(m(),d(x,{key:1,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),n(` `+r(s.faceLabel)+` `,1),e(`span`,ct,[i(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(r(s.engineLabel),1)])])]),s.isTerminal?a(``,!0):(m(),o(`div`,lt,[e(`p`,ut,r(s.statusLabel),1),i(C,{percentage:s.progressPct,"stroke-width":6},null,8,[`percentage`])])),s.isSuccess?(m(),o(`div`,dt,[s.videoUrl?(m(),d(w,{key:0,src:s.videoUrl},null,8,[`src`])):a(``,!0),e(`div`,ft,[s.videoUrl?(m(),d(T,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:l[1]||=e=>s.onDownload(e,s.videoUrl)},{default:f(()=>[n(r(s.$t(`digitalhuman.button.download`)),1)]),_:1})):a(``,!0),i(E,{path:`/digital-human/videos`,body:s.modelValue?.request},null,8,[`body`])]),i(A,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,$,[i(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(s.$t(`digitalhuman.name.taskId`))+`: `+r(s.modelValue?.id)+` `,1),i(O,{content:s.modelValue?.id},null,8,[`content`])]),s.modelValue?.elapsed?(m(),o(`p`,pt,[i(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(s.$t(`digitalhuman.name.elapsed`))+`: `+r(s.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),s.isFailure?(m(),o(`div`,mt,[i(A,{closable:!1,class:`failure`},{template:f(()=>[i(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(s.$t(`digitalhuman.name.failure`)),1)]),default:f(()=>[e(`p`,ht,[i(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(s.$t(`digitalhuman.name.taskId`))+`: `+r(s.modelValue?.id)+` `,1),i(O,{content:s.modelValue?.id},null,8,[`content`])]),s.failureReason?(m(),o(`p`,gt,[i(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(s.$t(`digitalhuman.name.failureReason`))+`: `+r(s.failureReason),1)])):a(``,!0)]),_:1})])):a(``,!0)])])}var vt=g({name:`RecentPanel`,components:{TaskPreview:V(Ye,[[`render`,_t],[`__scopeId`,`data-v-03383155`]]),NoTasks:ue,BotPlaceholder:me,ScrollList:le},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.digitalhuman?.tasks,items:this.$store.state.digitalhuman?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),yt={key:0},bt={key:2,class:`w-full h-full flex items-center justify-center`};function xt(e,t,n,r,l,u){let h=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return m(),o(s,null,[e.tasks?.items===void 0?(m(),o(`div`,yt,[i(h)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(m(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(m(!0),o(s,null,p(e.tasks?.items,(e,t)=>(m(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(m(),o(`div`,bt,[i(v)])):a(``,!0)],64)}var St=g({name:`DigitalHumanIndex`,components:{ConfigPanel:Je,Layout:be,RecentPanel:V(vt,[[`render`,xt]])},inject:[`initialized`],data(){return{job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.digitalhuman?.status?.getApplications===J.Request},tasksLoading(){return this.$store.state.digitalhuman?.status?.getTasks===J.Request||this.fetchingTasks},credential(){return this.$store.state.digitalhuman.credential},config(){return this.$store.state.digitalhuman.config},tasks(){return this.$store.state.digitalhuman.tasks}},watch:{initialized:{async handler(e){window.clearInterval(this.job),e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await de({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`digitalhuman/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`digitalhuman/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(e){if(!X())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}G.info(this.$t(`digitalhuman.message.startingTask`)),W(`digitalhuman`,K.generate(e,{token:t})).then(()=>{G.success(this.$t(`digitalhuman.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?G.error(this.$t(`digitalhuman.message.usedUp`)):G.error(this.$t(`digitalhuman.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ct(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return m(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var wt=V(St,[[`render`,Ct]]);export{wt as default};