@acedatacloud/nexior 3.343.3 → 3.343.5

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 (268) hide show
  1. package/dist/assets/{ApiCodeButton-C_DtLteh.js → ApiCodeButton-B0-x9FnD.js} +1 -1
  2. package/dist/assets/{Artifacts-COeoAH1p.js → Artifacts-BVKvreS2.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-D_oKKGYl.js → AskUserQuestionCard-CwFl0Mmj.js} +1 -1
  4. package/dist/assets/{AudioPreview-DGeWuq2A.js → AudioPreview-CusjtEju.js} +1 -1
  5. package/dist/assets/{Auth-C4TMJpeT.js → Auth-D8Y1UQzx.js} +1 -1
  6. package/dist/assets/{Bare-CGTyxVcY.js → Bare-BJloPCtN.js} +1 -1
  7. package/dist/assets/{BotPlaceholder-miO90qGo.js → BotPlaceholder-DrEVlBn6.js} +1 -1
  8. package/dist/assets/{BottomFooter-Dn7ALxdB.js → BottomFooter-5mOZ55n6.js} +1 -1
  9. package/dist/assets/{Callback-W-Bnbyvh.js → Callback-Cm7Ppiyz.js} +1 -1
  10. package/dist/assets/{CodeSnippet-imENkgS_.js → CodeSnippet-DhjF2wbU.js} +1 -1
  11. package/dist/assets/{Console-DdNJBvyg.js → Console-C8vOsYmg.js} +1 -1
  12. package/dist/assets/{Consumption-DL0zm78X.js → Consumption-CT7T63yY.js} +1 -1
  13. package/dist/assets/{Conversation-DWOLdrk3.js → Conversation-CKGqC4km.js} +1 -1
  14. package/dist/assets/{Conversation-D2nipuJ4.js → Conversation-CtF3i_y-.js} +1 -1
  15. package/dist/assets/{CopyToClipboard-BMaxYkX6.js → CopyToClipboard-CYhdL6je.js} +1 -1
  16. package/dist/assets/{Detail-Csw1iIvn.js → Detail-D1TYNnqC.js} +2 -2
  17. package/dist/assets/{Extra-B_UQU3zj.js → Extra-CNIAICO7.js} +1 -1
  18. package/dist/assets/{FilePreview-CQ8miS5e.js → FilePreview-CUd67FRT.js} +1 -1
  19. package/dist/assets/{Hailuo-BYDp8J6m.js → Hailuo-BjftzRTD.js} +1 -1
  20. package/dist/assets/{History-B0VN2MMH.js → History-CJ_DvkUr.js} +1 -1
  21. package/dist/assets/{ImagePreview-Dzwq5j1p.js → ImagePreview-CN_a4NcZ.js} +1 -1
  22. package/dist/assets/{ImageWrapper-B6kHPphW.js → ImageWrapper-TQVfHlf6.js} +1 -1
  23. package/dist/assets/{Index-L4nFhGoI.js → Index-0s6Nv9s8.js} +1 -1
  24. package/dist/assets/{Index-ClkrY5lP.js → Index-6s2nWTwm.js} +1 -1
  25. package/dist/assets/{Index-B0ZHlDuU.js → Index-BDUNiP6l.js} +1 -1
  26. package/dist/assets/{Index-BB5sCnez.js → Index-BEzasVMW.js} +1 -1
  27. package/dist/assets/{Index-xk9mGgHC.js → Index-BHcP_-Rs.js} +1 -1
  28. package/dist/assets/{Index-CfwR5Za5.js → Index-BISo3LFl.js} +1 -1
  29. package/dist/assets/{Index-BsuI8C6x.js → Index-BQtPX4F9.js} +1 -1
  30. package/dist/assets/{Index-Dq9auTf_.js → Index-BcCE4ixu.js} +1 -1
  31. package/dist/assets/{Index-DaZEAkZx2.js → Index-BcV4ws_92.js} +1 -1
  32. package/dist/assets/{Index-DgNAKfOZ.js → Index-BhoUEFHy.js} +1 -1
  33. package/dist/assets/{Index-DeGiucbo.js → Index-BhtYmbM_.js} +1 -1
  34. package/dist/assets/{Index-Zxz1nVei2.js → Index-BkINsud_2.js} +1 -1
  35. package/dist/assets/{Index-Dz5AFp1c.js → Index-C5ulY0r0.js} +1 -1
  36. package/dist/assets/{Index-B-VI_aRb.js → Index-CIoS7OtA.js} +1 -1
  37. package/dist/assets/{Index-CQd3EYF4.js → Index-CbJNKd6d.js} +1 -1
  38. package/dist/assets/{Index-DrVLoVNo.js → Index-ChD33pxg.js} +1 -1
  39. package/dist/assets/{Index-vA8vIG53.js → Index-CoirFfBr.js} +1 -1
  40. package/dist/assets/{Index-BhOweqDE2.js → Index-CtNuquz02.js} +1 -1
  41. package/dist/assets/{Index-BJKwkkFZ.js → Index-D5us29kD.js} +1 -1
  42. package/dist/assets/{Index-1ZhbeLVS2.js → Index-DMrOPggf2.js} +1 -1
  43. package/dist/assets/{Index-BuNB2iGw.js → Index-DZlV0cSh.js} +1 -1
  44. package/dist/assets/{Index-CU9m8W_1.js → Index-DapepRxc.js} +1 -1
  45. package/dist/assets/{Index-COkAWs3N.js → Index-DjvOht7o.js} +1 -1
  46. package/dist/assets/{Index-DJL_xfuy.js → Index-Dmt4n7qM.js} +1 -1
  47. package/dist/assets/Index-DtKgAaeJ.js +1 -0
  48. package/dist/assets/{Index-BfpEVkAV.js → Index-DxHcgfMx.js} +1 -1
  49. package/dist/assets/{Index-QNTsRM_t.js → Index-Lzkod5Wb.js} +1 -1
  50. package/dist/assets/{Index-CKrZwUSr.js → Index-X_zvrdEt.js} +1 -1
  51. package/dist/assets/{Index-Mgk2TALV.js → Index-rOM6fXWw.js} +1 -1
  52. package/dist/assets/{Index-Ci8dp03A.js → Index-tAly4klJ.js} +1 -1
  53. package/dist/assets/{Index-C6OyAWLW.js → Index-uYj8T142.js} +1 -1
  54. package/dist/assets/{Index-CwMONzyV.js → Index-zG6W2vmD.js} +1 -1
  55. package/dist/assets/{Invitees-CMMHSe4y.js → Invitees-BO_WNLth.js} +1 -1
  56. package/dist/assets/{List-B6JleUhS.js → List-B0gIw94q.js} +1 -1
  57. package/dist/assets/{List-CtK2fe34.js → List-CPNKPg4w.js} +1 -1
  58. package/dist/assets/{List-CV9tFd5K.js → List-Clpdgyt1.js} +1 -1
  59. package/dist/assets/{LocalTools-CnXNzgGY.js → LocalTools-BYqYnWvE.js} +1 -1
  60. package/dist/assets/{LocalTools-DL6YNvwa.js → LocalTools-Dm-ywIAk.js} +1 -1
  61. package/dist/assets/{Main-r3pYZNua.js → Main-C3WWRgXW.js} +1 -1
  62. package/dist/assets/{Message-TT9Tt5EG.js → Message-jBY9OH1H.js} +1 -1
  63. package/dist/assets/{Model-bznEL95u.js → Model-CNIzPaBu.js} +1 -1
  64. package/dist/assets/{Navigator-DnHUGeWq.js → Navigator-Cvx3pCr_.js} +3 -3
  65. package/dist/assets/{NotFound-BUz1btfj.js → NotFound-yH_5FSyV.js} +1 -1
  66. package/dist/assets/{Pay-C_Fcl29f.js → Pay-_Fzvpow-.js} +1 -1
  67. package/dist/assets/{Player-CcmsVWf7.js → Player-DLrRebQK.js} +1 -1
  68. package/dist/assets/{Poivelle-3ecrWx9E.js → Poivelle-DCxH9ayp.js} +1 -1
  69. package/dist/assets/{PromptTextarea-BPhoRMVI.js → PromptTextarea-BMAJqZZI.js} +1 -1
  70. package/dist/assets/{RealtimeCall-CXRpEKEL.js → RealtimeCall-D6We_fF9.js} +1 -1
  71. package/dist/assets/{ScheduledTasks-CCgZLKXl.js → ScheduledTasks-9Pw1ngi4.js} +1 -1
  72. package/dist/assets/{Status-B7sFQTuB.js → Status-C3piVgoM.js} +1 -1
  73. package/dist/assets/{Subscribe-DA13iozT.js → Subscribe-CG135de-.js} +1 -1
  74. package/dist/assets/{TabSwitcher-DT8rOtuT.js → TabSwitcher-BRlvC3p-.js} +1 -1
  75. package/dist/assets/{Tts-BdpmdYva.js → Tts-CsLjkcsk.js} +1 -1
  76. package/dist/assets/{VideoPlayer-CyCnHmhk.js → VideoPlayer-S1FrzzNN.js} +1 -1
  77. package/dist/assets/{alert-BmDhbY4N.js → alert-GKEAiGRQ.js} +1 -1
  78. package/dist/assets/arrow-down-NIqacBiy.js +1 -0
  79. package/dist/assets/{arrow-down-wide-narrow-BV17RuKt.js → arrow-down-wide-narrow-BTK8Yz0F.js} +1 -1
  80. package/dist/assets/arrow-left-DXJlpd3-.js +1 -0
  81. package/dist/assets/arrow-right-BveAEqp4.js +1 -0
  82. package/dist/assets/arrow-up-BYHOLoj4.js +1 -0
  83. package/dist/assets/{avatar-DMypDW5N.js → avatar-D-V7sRRD.js} +1 -1
  84. package/dist/assets/{basic-Czbj6f9D.js → basic-BN8BxzIa.js} +1 -1
  85. package/dist/assets/{book-open-DgulRtEJ.js → book-open-CIe9--uX.js} +1 -1
  86. package/dist/assets/{box-CXHZJ19d.js → box-DjHCVFNB.js} +1 -1
  87. package/dist/assets/{boxes-CbZlGzxn.js → boxes-CJUomDou.js} +1 -1
  88. package/dist/assets/{brain-BY6PRLuS.js → brain-DHZNxBxI.js} +1 -1
  89. package/dist/assets/{chart-no-axes-combined-3j5FM4nV.js → chart-no-axes-combined-geIcwGzh.js} +1 -1
  90. package/dist/assets/{chat-DzHJ5mA8.js → chat-CuN2bSlj.js} +1 -1
  91. package/dist/assets/check-DuV4pUps.js +1 -0
  92. package/dist/assets/chevron-down-CTWii8cz.js +1 -0
  93. package/dist/assets/chevron-right-C-gvi5JA.js +1 -0
  94. package/dist/assets/circle-check-DySTb5tD.js +1 -0
  95. package/dist/assets/{circle-question-mark-Dg_6R6Ml.js → circle-question-mark-B0BFUzGf.js} +1 -1
  96. package/dist/assets/{clipboard-list-DQY8azPJ.js → clipboard-list-voR6-Nlr.js} +1 -1
  97. package/dist/assets/clock-CRwB_MFX.js +1 -0
  98. package/dist/assets/code-CoatZpQV.js +1 -0
  99. package/dist/assets/{codingBridge-BXkxqJJC.js → codingBridge-Cnuar25g.js} +1 -1
  100. package/dist/assets/{codingBridgeNotify-DkQVrSnN.js → codingBridgeNotify-B5VlFcb8.js} +2 -2
  101. package/dist/assets/{coins-Ccai4H-a.js → coins-DAJndBDi.js} +1 -1
  102. package/dist/assets/{collapse-CTug-yP6.js → collapse-Cacyec26.js} +1 -1
  103. package/dist/assets/{constants-Dm-HitpB.js → constants-7uZLiijT.js} +1 -1
  104. package/dist/assets/{copy-CaELERYD.js → copy-BfwKopoP.js} +1 -1
  105. package/dist/assets/{createTaskActions-DT6637AA.js → createTaskActions-8chuAxaG.js} +1 -1
  106. package/dist/assets/{digitalhuman-Cb-npF4z.js → digitalhuman-CsCPEcEe.js} +1 -1
  107. package/dist/assets/{dollar-sign-DCSgo-yC.js → dollar-sign-DqpnGcG2.js} +1 -1
  108. package/dist/assets/{download-X3vwDSki.js → download-3PhcxSrJ.js} +1 -1
  109. package/dist/assets/{drawer-BgpN40Ig.js → drawer-woRr4Mr5.js} +1 -1
  110. package/dist/assets/{dropdown-BNMcCva2.js → dropdown-DhXdLOg1.js} +1 -1
  111. package/dist/assets/{dropdown-EfsWv0Yl.js → dropdown-DwIazBnb.js} +1 -1
  112. package/dist/assets/{ellipsis-BLq9exTH.js → ellipsis-BMzB_SYq.js} +1 -1
  113. package/dist/assets/{esm-Dx7az4yl.js → esm-BKz5DWoy.js} +1 -1
  114. package/dist/assets/esm-C79eRxQ0.js +1 -0
  115. package/dist/assets/{esm-6WbJSUyo.js → esm-CUWbsqt2.js} +1 -1
  116. package/dist/assets/{esm-DPZ-0-TA.js → esm-DJ27stz9.js} +3 -3
  117. package/dist/assets/{esm-7bTqS524.js → esm-alBgpye1.js} +2 -2
  118. package/dist/assets/{esm-B0fPuulX.js → esm-nCrZIKbi.js} +1 -1
  119. package/dist/assets/{esm-DBxl_F3e.js → esm-vm4WnajE.js} +2 -2
  120. package/dist/assets/{external-link-DZ3DxAmT.js → external-link-Dvu4R_Pv.js} +1 -1
  121. package/dist/assets/{eye-Dt7czJN5.js → eye-CkA6Pdip.js} +1 -1
  122. package/dist/assets/{file-BjjWIKuD.js → file-BC6dyqNi.js} +1 -1
  123. package/dist/assets/{file-output-D5VoOEt1.js → file-output-sb8_INTC.js} +1 -1
  124. package/dist/assets/{file-text-Cg1esE6-.js → file-text-DcWgTnpa.js} +1 -1
  125. package/dist/assets/{fish-B4CwYRmY.js → fish-Djnm1u-K.js} +1 -1
  126. package/dist/assets/{flux-C_ZHZbF2.js → flux-DTeXXXsf.js} +1 -1
  127. package/dist/assets/{folder-BmoEieDF.js → folder-BoO4sARU.js} +1 -1
  128. package/dist/assets/gauge-B0iEq07x.js +1 -0
  129. package/dist/assets/{globe-BC1t7ZUy.js → globe-C3034lKm.js} +1 -1
  130. package/dist/assets/{grokvideo-CAG_3RdK.js → grokvideo-mj--G1gz.js} +1 -1
  131. package/dist/assets/{hailuo-DZD-sPQC.js → hailuo-DZXDs1QO.js} +1 -1
  132. package/dist/assets/{headphones-MFMcymce.js → headphones-BTDkaRZW.js} +1 -1
  133. package/dist/assets/{history-BWgGP74I.js → history-CIH7NLBP.js} +1 -1
  134. package/dist/assets/{house-CbITAy_f.js → house-0oHCL21v.js} +1 -1
  135. package/dist/assets/{i18n-BMgeFHoQ.js → i18n-Cfx2SrDO.js} +1 -1
  136. package/dist/assets/{image-BLa4-1L7.js → image-BgxBbqjA.js} +1 -1
  137. package/dist/assets/{index-X4H_LD85.js → index-Lo_Ido09.js} +4 -4
  138. package/dist/assets/{index.browser.esm-CCmiJWW3.js → index.browser.esm-BFQ-Spoy.js} +1 -1
  139. package/dist/assets/{index.es-GZAOy__u.js → index.es-mNPSq-xU.js} +1 -1
  140. package/dist/assets/{info-L0HoT29_.js → info-Wm-OGGAd.js} +1 -1
  141. package/dist/assets/{input-number-COp7UOII.js → input-number-CD5GSimR.js} +1 -1
  142. package/dist/assets/{key-round-COPBeT2c.js → key-round-uwZ7Wokr.js} +1 -1
  143. package/dist/assets/{kling-ekkDIWur.js → kling-ByPcQWt-.js} +1 -1
  144. package/dist/assets/{languages-DCbhf2nn.js → languages-CZhJGtxY.js} +1 -1
  145. package/dist/assets/{laptop-vqo6zEX9.js → laptop-BYpzE_NW.js} +1 -1
  146. package/dist/assets/{lightbulb-C5Ftvxfh.js → lightbulb-C_iPFY43.js} +1 -1
  147. package/dist/assets/{link-CclstGdq.js → link-Cvnamm_M.js} +1 -1
  148. package/dist/assets/loader-circle-B2P0htPr.js +1 -0
  149. package/dist/assets/{lock-BPdr7Bk-.js → lock-BEvcMFJY.js} +1 -1
  150. package/dist/assets/{luma-BlJzM-S0.js → luma-CIGgmftv.js} +1 -1
  151. package/dist/assets/{maestro-CCVCYo9K.js → maestro-4RSSuKvA.js} +1 -1
  152. package/dist/assets/{maestro-kHSSjXRl.js → maestro-udmO7-8f.js} +1 -1
  153. package/dist/assets/{mail-P-Y3KiSi.js → mail-JJj4vbbm.js} +1 -1
  154. package/dist/assets/{message-circle-CMGjhLSL.js → message-circle-C6T1km9g.js} +1 -1
  155. package/dist/assets/{mic-CD1EVj2b.js → mic-CC5ZUfsw.js} +1 -1
  156. package/dist/assets/{midjourney--Ck1Wfqc.js → midjourney-Bh8M9e-q.js} +1 -1
  157. package/dist/assets/{mobileLocalExec--fsbqVUV.js → mobileLocalExec-BrlQA6Jj.js} +2 -2
  158. package/dist/assets/{monitor-B90FW30X.js → monitor-DsoAbqia.js} +1 -1
  159. package/dist/assets/{mouse-pointer-2-BVNozhkt.js → mouse-pointer-2-BKHsM4J1.js} +1 -1
  160. package/dist/assets/music-2-BNlpzuYQ.js +1 -0
  161. package/dist/assets/{nanobanana-2O8uFKaf.js → nanobanana-CVd1To8T.js} +1 -1
  162. package/dist/assets/{omni-0Viu8s3W.js → omni-CuQWimVr.js} +1 -1
  163. package/dist/assets/{openaiimage-DQx3fXOl.js → openaiimage-B4bu7J8O.js} +1 -1
  164. package/dist/assets/{openaiimage-C2bpyQKJ.js → openaiimage-BitvkDwZ.js} +1 -1
  165. package/dist/assets/{openaiimage-DBMQ7gmY.js → openaiimage-BwZfnTWQ.js} +1 -1
  166. package/dist/assets/{openaiimage-BNpTdd65.js → openaiimage-C0jCB7z8.js} +1 -1
  167. package/dist/assets/{openaiimage-B17V2p_T.js → openaiimage-CBz6nI0u.js} +1 -1
  168. package/dist/assets/{openaiimage-kTlSy1sn.js → openaiimage-CEy5ayzF.js} +1 -1
  169. package/dist/assets/{openaiimage-D_R3iuwL.js → openaiimage-CFg8wnQb.js} +1 -1
  170. package/dist/assets/{openaiimage-BvvI3cAF.js → openaiimage-CL5qT7Su.js} +1 -1
  171. package/dist/assets/{openaiimage-6yEs8JA2.js → openaiimage-Cfdtmt74.js} +1 -1
  172. package/dist/assets/{openaiimage-g2xKNNTd.js → openaiimage-ChlcZOBt.js} +1 -1
  173. package/dist/assets/{openaiimage-o1NjJPhw.js → openaiimage-D6xRTTJm.js} +1 -1
  174. package/dist/assets/{openaiimage-Ot-ASuqJ.js → openaiimage-DL3zXN9_.js} +1 -1
  175. package/dist/assets/{openaiimage-DyfMkAO-.js → openaiimage-DQVIkzJZ.js} +1 -1
  176. package/dist/assets/{openaiimage-CmZuvl6k.js → openaiimage-DT9faLvp.js} +1 -1
  177. package/dist/assets/{openaiimage-CIpfs68J.js → openaiimage-Dl9mM0ll.js} +1 -1
  178. package/dist/assets/{openaiimage-BDejHaav.js → openaiimage-gsbmK-Nu.js} +1 -1
  179. package/dist/assets/{openaiimage-B6grtnNo.js → openaiimage-qSNYXPTw.js} +1 -1
  180. package/dist/assets/{openaiimage-C-NCPCrx.js → openaiimage-vZbAwwmq.js} +1 -1
  181. package/dist/assets/{openaiimage-AWuYLGAW.js → openaiimage-yhZwpQ9p.js} +1 -1
  182. package/dist/assets/{pagination-Bn4f3wYD.js → pagination-BVAnEIDa.js} +1 -1
  183. package/dist/assets/{pagination-DpHxEI-k.js → pagination-CVzRjA6_.js} +1 -1
  184. package/dist/assets/{pagination-Bn-Te_lz.js → pagination-DlnxtC-c.js} +1 -1
  185. package/dist/assets/{palette-DIHsHC32.js → palette-CQv6ste7.js} +1 -1
  186. package/dist/assets/{paperclip-CYkP9UNQ.js → paperclip-BXI7Zj74.js} +1 -1
  187. package/dist/assets/{pause-BgXcwbWB.js → pause-DebeAN0d.js} +1 -1
  188. package/dist/assets/{pencil-tUu6ouB5.js → pencil-DIbU_-Rj.js} +1 -1
  189. package/dist/assets/{pika-rKlrUBan.js → pika-D_TV6HXo.js} +1 -1
  190. package/dist/assets/{pixverse-BsYpepIg.js → pixverse-D50wfXvc.js} +1 -1
  191. package/dist/assets/play-CiTEyu2o.js +1 -0
  192. package/dist/assets/{plug-B2G0FN8y.js → plug-B5MoZotF.js} +1 -1
  193. package/dist/assets/plus-dvmEFOrl.js +1 -0
  194. package/dist/assets/{poivelle-BgSa25CB.js → poivelle-Nl_cLTw8.js} +1 -1
  195. package/dist/assets/{popover-B-XDEzXf.js → popover-DTpc9Lez.js} +1 -1
  196. package/dist/assets/{producer-Ld_9lBUQ.js → producer-D9oNajOa.js} +1 -1
  197. package/dist/assets/{qrart-DeeVv1qS.js → qrart-4FaDOlZ-.js} +1 -1
  198. package/dist/assets/{realtime-DbcX-uYY.js → realtime-cTFtDAvR.js} +1 -1
  199. package/dist/assets/{refresh-cw-t0kiTZWs.js → refresh-cw-amy6CUOT.js} +1 -1
  200. package/dist/assets/rotate-ccw-DCcGb3Rz.js +1 -0
  201. package/dist/assets/rotate-cw-Cv1X7f_5.js +1 -0
  202. package/dist/assets/{row-B5owDjio.js → row-CwFsM8WQ.js} +1 -1
  203. package/dist/assets/search-Bcvi0lZI.js +1 -0
  204. package/dist/assets/{seedance-B-_3RBUv.js → seedance-B23YVABM.js} +1 -1
  205. package/dist/assets/{seedream-BR7o2P5I.js → seedream-DIt7ismA.js} +1 -1
  206. package/dist/assets/{select-DqVvQzGq.js → select-u4ZPt_q3.js} +1 -1
  207. package/dist/assets/{serp-DFtauEc7.js → serp-D2Wq3JLO.js} +1 -1
  208. package/dist/assets/{shield-BPTkbELz.js → shield-CJsDNPaH.js} +1 -1
  209. package/dist/assets/{shuffle-Bmv2t6R6.js → shuffle-BloltSEq.js} +1 -1
  210. package/dist/assets/{slider-Daiw6Iva.js → slider-CItloy49.js} +1 -1
  211. package/dist/assets/{sliders-horizontal-BYKTTTwE.js → sliders-horizontal-B7k9oxX_.js} +1 -1
  212. package/dist/assets/{solana-wallets-CXC-8jG6.js → solana-wallets-B0DkoftT.js} +2 -2
  213. package/dist/assets/{solana-wallets-vue-fIiCXbp_.js → solana-wallets-vue-CbdkXPvO.js} +1 -1
  214. package/dist/assets/{sora-DiGUJQy2.js → sora-D-22tRf9.js} +1 -1
  215. package/dist/assets/{sparkles-BGrSMnoO.js → sparkles-q9oZzwMO.js} +1 -1
  216. package/dist/assets/square-8ImsGE2I.js +1 -0
  217. package/dist/assets/{store-BqFA4FXv.js → store-VxMLRNHq.js} +1 -1
  218. package/dist/assets/{suno-DzHPaaTE.js → suno-C_1L6xr7.js} +1 -1
  219. package/dist/assets/{switch-Co1BiZ5s.js → switch-2xjWV4Am.js} +1 -1
  220. package/dist/assets/{table-BJBYrivw.js → table-DunEpath.js} +1 -1
  221. package/dist/assets/{tabs-C4gim7Ak.js → tabs-BIwsuUuq.js} +1 -1
  222. package/dist/assets/{tag-DKlEOhWa.js → tag-D4u3nnn-.js} +1 -1
  223. package/dist/assets/terminal-DVU0XatN.js +1 -0
  224. package/dist/assets/{time-picker-BsiiE59u.js → time-picker-HUhBDGYh.js} +1 -1
  225. package/dist/assets/{tooltip-DowzbA2H.js → tooltip-DsAnpgnK.js} +1 -1
  226. package/dist/assets/{trash-2-DY-Xs8eB.js → trash-2-CDLeP9p9.js} +1 -1
  227. package/dist/assets/{triangle-alert-DIl0w9Tt.js → triangle-alert-6yh-6tsz.js} +1 -1
  228. package/dist/assets/{upload-Dysa20WI.js → upload-D5lWE4_S.js} +1 -1
  229. package/dist/assets/{upload-C2q57sfz.js → upload-Dcdh9YU5.js} +1 -1
  230. package/dist/assets/user-nkAqOB-o.js +1 -0
  231. package/dist/assets/{veo-Dgiv3d9X.js → veo-nEQSU2Pi.js} +1 -1
  232. package/dist/assets/{video-D-94pvqW.js → video-CSms6rbu.js} +1 -1
  233. package/dist/assets/{volume-2-glzy9b7l.js → volume-2-CGKQvcw8.js} +1 -1
  234. package/dist/assets/{wallet-DkDB80A7.js → wallet-DXEErTWF.js} +1 -1
  235. package/dist/assets/{wan-D7WRSQx1.js → wan-CQ_T_riS.js} +1 -1
  236. package/dist/assets/{wand-sparkles-bgHAAYDe.js → wand-sparkles-l5kkPYwT.js} +1 -1
  237. package/dist/assets/{web-CTwCReHZ.js → web-BasNy98E.js} +1 -1
  238. package/dist/assets/{web-BLnYRWAe.js → web-BtHLh8uJ.js} +1 -1
  239. package/dist/assets/{web-CUvu7cWL.js → web-CBdvZnd2.js} +1 -1
  240. package/dist/assets/{web-Dlm8jA1i.js → web-DS6NZOhv.js} +1 -1
  241. package/dist/assets/{web-BDw62ZyG.js → web-sSUevaAF.js} +1 -1
  242. package/dist/assets/{webextrator-BMKrL7aS.js → webextrator-Dsog8oWp.js} +1 -1
  243. package/dist/assets/{zap-CQ29DxkU.js → zap-DsvjavgK.js} +1 -1
  244. package/dist/index.html +3 -3
  245. package/package.json +1 -1
  246. package/dist/assets/Index-CSgmw5Xk.js +0 -1
  247. package/dist/assets/arrow-down-_laNvAF4.js +0 -1
  248. package/dist/assets/arrow-left-BxY2ckiR.js +0 -1
  249. package/dist/assets/arrow-right-C-DwIyqJ.js +0 -1
  250. package/dist/assets/arrow-up-DuBOEPlK.js +0 -1
  251. package/dist/assets/check-D4mUmwCI.js +0 -1
  252. package/dist/assets/chevron-down-n14G0ihm.js +0 -1
  253. package/dist/assets/chevron-right-CrLR-sC-.js +0 -1
  254. package/dist/assets/circle-check-CcZvIPVM.js +0 -1
  255. package/dist/assets/clock-CTJncUP-.js +0 -1
  256. package/dist/assets/code-DHK4Pm5M.js +0 -1
  257. package/dist/assets/esm-CjoFX8Xc.js +0 -1
  258. package/dist/assets/gauge-DO8VgOsK.js +0 -1
  259. package/dist/assets/loader-circle-CChCBdje.js +0 -1
  260. package/dist/assets/music-2-DGNhWGN8.js +0 -1
  261. package/dist/assets/play-DPIxDecq.js +0 -1
  262. package/dist/assets/plus-BJtw637u.js +0 -1
  263. package/dist/assets/rotate-ccw-D3cY5lvz.js +0 -1
  264. package/dist/assets/rotate-cw-Q9go6gdx.js +0 -1
  265. package/dist/assets/search-BL6paE0R.js +0 -1
  266. package/dist/assets/square-CdZofyiS.js +0 -1
  267. package/dist/assets/terminal-DSXKpkoK.js +0 -1
  268. package/dist/assets/user-DC1cJhr8.js +0 -1
@@ -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-DqVvQzGq.js";import{t as y}from"./upload-Dysa20WI.js";import{t as b}from"./tooltip-DowzbA2H.js";import{t as x}from"./alert-BmDhbY4N.js";import{n as S,r as C}from"./radio-DgDgyT2l.js";import{t as w}from"./drawer-BgpN40Ig.js";import{t as T}from"./progress-bSUZvkfj.js";import{t as E}from"./check-D4mUmwCI.js";import{t as D}from"./clock-CTJncUP-.js";import{t as O}from"./image-BLa4-1L7.js";import{t as k}from"./info-L0HoT29_.js";import{t as A}from"./mic-CD1EVj2b.js";import{t as j}from"./music-2-DGNhWGN8.js";import{t as M}from"./sliders-horizontal-BYKTTTwE.js";import{t as N}from"./trash-2-DY-Xs8eB.js";import{t as P}from"./triangle-alert-DIl0w9Tt.js";import{t as ee}from"./upload-C2q57sfz.js";import{t as F}from"./user-DC1cJhr8.js";import{t as I}from"./video-D-94pvqW.js";import{t as L}from"./wand-sparkles-bgHAAYDe.js";import{Or as R,Sr as z,Tr as te,br as ne,xr as re,yr as B}from"./constants-Dm-HitpB.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-X4H_LD85.js";import{t as ae}from"./CopyToClipboard-BMaxYkX6.js";import{n as oe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as se}from"./Consumption-DL0zm78X.js";import{a as ce,n as le,r as ue,t as de}from"./pagination-DpHxEI-k.js";import{t as fe}from"./VideoPlayer-CyCnHmhk.js";import{t as pe}from"./ApiCodeButton-C_DtLteh.js";import{t as me}from"./BotPlaceholder-miO90qGo.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-u4ZPt_q3.js";import{t as y}from"./upload-D5lWE4_S.js";import{t as b}from"./tooltip-DsAnpgnK.js";import{t as x}from"./alert-GKEAiGRQ.js";import{n as S,r as C}from"./radio-DgDgyT2l.js";import{t as w}from"./drawer-woRr4Mr5.js";import{t as T}from"./progress-bSUZvkfj.js";import{t as E}from"./check-DuV4pUps.js";import{t as D}from"./clock-CRwB_MFX.js";import{t as O}from"./image-BgxBbqjA.js";import{t as k}from"./info-Wm-OGGAd.js";import{t as A}from"./mic-CC5ZUfsw.js";import{t as j}from"./music-2-BNlpzuYQ.js";import{t as M}from"./sliders-horizontal-B7k9oxX_.js";import{t as N}from"./trash-2-CDLeP9p9.js";import{t as P}from"./triangle-alert-6yh-6tsz.js";import{t as ee}from"./upload-Dcdh9YU5.js";import{t as F}from"./user-nkAqOB-o.js";import{t as I}from"./video-CSms6rbu.js";import{t as L}from"./wand-sparkles-l5kkPYwT.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-Lo_Ido09.js";import{t as ae}from"./CopyToClipboard-CYhdL6je.js";import{n as oe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as se}from"./Consumption-CT7T63yY.js";import{a as ce,n as le,r as ue,t as de}from"./pagination-CVzRjA6_.js";import{t as fe}from"./VideoPlayer-S1FrzzNN.js";import{t as pe}from"./ApiCodeButton-B0-x9FnD.js";import{t as me}from"./BotPlaceholder-DrEVlBn6.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 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-DqVvQzGq.js";import{t as b}from"./upload-Dysa20WI.js";import{t as x}from"./tooltip-DowzbA2H.js";import{t as S}from"./alert-BmDhbY4N.js";import{n as C,r as w}from"./radio-DgDgyT2l.js";import{t as T}from"./drawer-BgpN40Ig.js";import{t as E}from"./switch-Co1BiZ5s.js";import{t as D}from"./clock-CTJncUP-.js";import{r as O,t as k}from"./PromptTextarea-BPhoRMVI.js";import{t as A}from"./info-L0HoT29_.js";import{t as j}from"./trash-2-DY-Xs8eB.js";import{t as M}from"./triangle-alert-DIl0w9Tt.js";import{t as N}from"./upload-C2q57sfz.js";import{t as P}from"./wand-sparkles-bgHAAYDe.js";import{gi as F}from"./constants-Dm-HitpB.js";import{E as I,Gt as ee,Kt as te,Sr as ne,Ti as L,Ut as R,Wt as z,Yn as B,Yt as V,ci as H,di as U,hr as W,in as G,qt as K,wi as q,zi as J}from"./index-X4H_LD85.js";import{t as Y}from"./CopyToClipboard-BMaxYkX6.js";import{t as X}from"./ImagePreview-Dzwq5j1p.js";import{n as Z}from"./taskDrawerMixin-DyAUhFEq.js";import{t as re}from"./Consumption-DL0zm78X.js";import{a as Q,n as ie,r as ae,t as oe}from"./pagination-DpHxEI-k.js";import{t as se}from"./vue-plyr-wiIKa-zl.js";import{t as ce}from"./ApiCodeButton-C_DtLteh.js";import{t as le}from"./BotPlaceholder-miO90qGo.js";var ue=_({name:`LayoutPika`,components:{MagicIcon:P,ElDrawer:T,ElButton:J},mixins:[Z]}),de={class:`main flex flex-row flex-1`},fe={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)]`},pe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function me(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,de,[e(`div`,fe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,pe,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var he=I(ue,[[`render`,me],[`__scopeId`,`data-v-14cc52c3`]]),ge=_({name:`IngredientsSelector`,components:{ElSwitch:E,InfoIcon:Q},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients},set(e){if(!e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients:e,ingredients_mode:void 0,image_url:void 0});return}this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients:e,model:`2.0`})}}},mounted(){this.value===void 0&&(this.value=!1)}}),_e={class:`field`},ve={class:`label`},ye={class:`title font-bold`};function be(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,_e,[e(`div`,ve,[e(`h2`,ye,i(t.$t(`pika.name.ingredients`)),1),a(d,{content:t.$t(`pika.description.ingredients`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])}var xe=I(ge,[[`render`,be],[`__scopeId`,`data-v-606e1d1a`]]),Se=_({name:`EffectSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`Levitate`,label:this.$t(`pika.style.effect1`)},{value:`Decapitate`,label:this.$t(`pika.style.effect2`)},{value:`Eye-pop`,label:this.$t(`pika.style.effect3`)},{value:`Ta-da`,label:this.$t(`pika.style.effect4`)},{value:`Deflate`,label:this.$t(`pika.style.effect5`)},{value:`Crumble`,label:this.$t(`pika.style.effect6`)},{value:`Dissolve`,label:this.$t(`pika.style.effect7`)},{value:`Squish`,label:this.$t(`pika.style.effect8`)},{value:`Inflate`,label:this.$t(`pika.style.effect9`)},{value:`Melt`,label:this.$t(`pika.style.effect10`)},{value:`Cake-ify`,label:this.$t(`pika.style.effect11`)},{value:`Crush`,label:this.$t(`pika.style.effect12`)},{value:`Explode`,label:this.$t(`pika.style.effect13`)}]},value:{get(){return this.$store.state.pika?.config?.effect},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,effect:e})}}}}),Ce={class:`field`},we={class:`title font-bold`},Te={class:`float-left`};function Ee(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Ce,[e(`h2`,we,i(t.$t(`pika.name.effect`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pika.placeholder.select`),clearable:``},{default:p(()=>[(h(!0),s(c,null,m(t.options,t=>(h(),f(g,{key:t.value,label:t.label,value:t.value},{default:p(()=>[e(`span`,Te,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var De=I(Se,[[`render`,Ee],[`__scopeId`,`data-v-d1c54475`]]),Oe=_({name:`IngredientsModelSelector`,components:{ElRadioButton:C,ElRadioGroup:w},data(){return{options:[{label:this.$t(`pika.button.precise`),value:`precise`},{label:this.$t(`pika.button.creative`),value:`creative`}]}},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients_mode},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients_mode:e})}}},mounted(){this.value||=F}}),ke={class:`field`},Ae={class:`title font-bold`};function je(t,n,o,u,d,g){let _=l(`el-radio-button`),v=l(`el-radio-group`);return h(),s(`div`,ke,[e(`h2`,Ae,i(t.$t(`pika.name.ingredientsModel`)),1),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`quality`},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.value},{default:p(()=>[r(i(e.label),1)]),_:2},1032,[`label`]))),128))]),_:1},8,[`modelValue`])])}var Me=I(Oe,[[`render`,je],[`__scopeId`,`data-v-b72865fa`]]),Ne=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`2.0`,label:`2.0`},{value:`1.5`,label:`1.5`}]}},computed:{value:{get(){return this.$store.state.pika?.config?.model},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||=`2.0`}}),Pe={class:`field`},Fe={class:`title font-bold`};function Ie(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Pe,[e(`h2`,Fe,i(t.$t(`pika.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pika.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Le=I(Ne,[[`render`,Ie],[`__scopeId`,`data-v-7b2e870a`]]),Re=_({name:`ImageUrlInput`,components:{UploadIcon:N,ElUpload:b,ElButton:J,InfoIcon:Q,ImagePreview:X},mixins:[K,te,z],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.pika?.config?.image_url}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;let t=this.fileList.filter(e=>!e.response?.file_url),n=(e||[]).map(e=>this.fileList.find(t=>t.response?.file_url===e||t.url===e)||{name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}});this.fileList=[...n,...t.filter(e=>!n.includes(e))]}}},methods:{onChange(e){!e.url&&e.raw&&(e.url=URL.createObjectURL(e.raw))},onExceed(){L.warning(this.$t(`pika.message.uploadStartImageExceed`))},onError(){L.error(this.$t(`pika.message.uploadStartImageError`))},onRemove(){this.onSetStartImageUrl()},onSetStartImageUrl(){this.suppressWatch=!0,this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,image_url:this.urls}),this.$nextTick(()=>{this.suppressWatch=!1})},onSuccess(){this.onSetStartImageUrl()},onRemovePreview(e){let t=this.fileList.indexOf(e);t>=0&&this.fileList.splice(t,1),e.url?.startsWith(`blob:`)&&URL.revokeObjectURL(e.url),this.onSetStartImageUrl()}}}),ze={class:`field`},Be={class:`label`},Ve={class:`title font-bold`},He={key:0,class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ue(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`upload-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return h(),s(`div`,null,[e(`div`,ze,[e(`div`,Be,[e(`h2`,Ve,i(t.$t(`pika.name.imageUrl`)),1),a(v,{content:t.$t(`pika.description.imageUrl`),class:`info`},null,8,[`content`])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value shrink-0`,limit:3,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-change":t.onChange,"on-remove":t.onRemove,"on-success":t.onSuccess,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`pika.button.uploadImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-change`,`on-remove`,`on-success`,`headers`])]),t.fileList.length?(h(),s(`div`,He,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{key:e.uid||e.url||n,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemovePreview(e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])):o(``,!0)])}var We=I(Re,[[`render`,Ue],[`__scopeId`,`data-v-2dc7db44`]]),Ge=_({name:`PromptInput`,components:{PromptTextarea:k},computed:{prompt:{get(){return this.$store.state.pika?.config?.prompt},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ke(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`pika.name.prompt`),info:e.$t(`pika.description.prompt`),placeholder:e.$t(`pika.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var qe=_({name:`PresetPanel`,components:{MagicIcon:P,ImageUrlInput:We,ElButton:J,Consumption:re,PromptInput:I(Ge,[[`render`,Ke]]),IngredientsSelector:xe,IngredientsModelSelector:Me,ModelSelector:Le,EffectSelector:De},emits:[`generate`],computed:{config(){return this.$store.state.pika?.config},consumption(){return V(this.config,this.service?.cost)},service(){return this.$store.state.pika?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Je={class:`flex flex-col h-full`},Ye={class:`flex-1 overflow-y-auto p-5`},Xe={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ze(t,n,c,u,d,m){let g=l(`prompt-input`),_=l(`model-selector`),v=l(`ingredients-selector`),y=l(`effect-selector`),b=l(`image-url-input`),x=l(`ingredients-model-selector`),S=l(`consumption`),C=l(`magic-icon`),w=l(`el-button`);return h(),s(`div`,Je,[e(`div`,Ye,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),t.config?.ingredients?(h(),f(b,{key:0,class:`mb-4`})):o(``,!0),t.config?.ingredients?(h(),f(x,{key:1,class:`mb-4`})):o(``,!0)]),e(`div`,Xe,[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(`pika.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Qe=I(qe,[[`render`,Ze]]),$e=_({name:`VideoPlayer`,components:{VuePlyr:se},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:1080,options:[1080]}}}}}),et=[`data-poster`],tt=[`src`];function nt(t,n,r,i,o,c){let u=l(`vue-plyr`);return h(),s(`div`,null,[a(u,{options:t.options,class:`video`},{default:p(()=>[e(`video`,{controls:``,playsinline:``,preload:`metadata`,"data-poster":t.modelValue?.image_url},[e(`source`,{size:`1080`,src:t.modelValue?.video_url,type:`video/mp4`},null,8,tt)],8,et)]),_:1},8,[`options`])])}var rt=_({name:`TaskPreview`,components:{DeleteIcon:j,ChannelIcon:O,InfoIcon:A,MagicIcon:P,TimeIcon:D,WarningIcon:M,CopyToClipboard:Y,ElAlert:S,VideoPlayer:I($e,[[`render`,nt],[`__scopeId`,`data-v-897d9fe0`]]),ElTooltip:x,ElButton:J,ApiCodeButton:ce},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pika?.application},config(){return this.$store.state.pika?.config},videos(){let e=[],t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(n=>{let r=n;t&&(r.action=t),e.push(r)}),e.length===0&&e.push({}),e}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await q.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(`pika/deleteTask`,{id:e}),L.success(this.$t(`common.message.deleteTaskSuccess`))}catch{L.error(this.$t(`common.message.deleteTaskFailed`))}}},isFailure(e){let t=this.modelValue?.response;return t?.success===!1||!!t?.error||e?.state===`failed`||e?.state===`cancelled`},isWaiting(e){return this.modelValue?.response?this.isFailure(e)||e?.video_url?!1:!e?.state||[`queued`,`pending`,`processing`,`running`].includes(e.state):!0},onDownload(e){console.log(`on download`),window.open(e,`_blank`)},onReload(e){let t=e.target,n=new URL(t.src),r=n.searchParams.get(`retry`);if(!r)n.searchParams.set(`retry`,`1`);else if(parseInt(r)<2)n.searchParams.set(`retry`,(parseInt(r)+1).toString());else return;t.src=n.toString()},onOpenVideo(e){window.open(e,`_blank`)}}}),it={class:`left`},at={class:`main`},ot={class:`bot`},st={class:`datetime`},ct=[`aria-label`],lt={class:`info`},ut={key:0,class:`prompt mt-2`},dt={key:0},ft={key:1},pt={key:0,class:n({content:!0,failed:!0})},mt={class:`image-wrapper`},ht={key:0,class:n({operations:!0,"mt-2":!0})},gt={key:0,class:`description`},_t={class:`description`},vt={key:1,class:`description`},yt={key:1,class:n({content:!0})},$={class:`description`},bt={class:`description`},xt={key:0,class:`description`},St={class:`description`},Ct={key:2,class:n({content:!0})},wt={class:`description`};function Tt(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`VideoPlayer`),C=l(`el-button`),w=l(`api-code-button`),T=l(`channel-icon`),E=l(`magic-icon`),D=l(`copy-to-clipboard`),O=l(`time-icon`),k=l(`el-alert`),A=l(`warning-icon`),j=l(`info-icon`);return h(!0),s(c,null,m(n.videos,(c,l)=>(h(),s(`div`,{key:l,class:`preview`},[e(`div`,it,[a(y,{capability:`pika`,part:`avatar`,class:`avatar`})]),e(`div`,at,[e(`div`,ot,[a(y,{capability:`pika`,part:`name`}),e(`span`,st,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:u[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,ct)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,lt,[n.modelValue?.request?.prompt?(h(),s(`p`,ut,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,dt,` - (`+i(n.$t(`pika.status.pending`))+`) `,1)),n.modelValue?.response&&n.isWaiting(c)?(h(),s(`span`,ft,` - (`+i(n.$t(`pika.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0&&c?.video_url?(h(),s(`div`,pt,[e(`div`,mt,[a(S,{"model-value":c},null,8,[`model-value`])]),c?(h(),s(`div`,ht,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`pika.message.downloadVideo`),placement:`top-start`},{default:p(()=>[c?.video_url?(h(),f(C,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:e=>n.onDownload(c?.video_url)},{default:p(()=>[r(i(n.$t(`pika.button.download`)),1)]),_:1},8,[`onClick`])):o(``,!0)]),_:2},1032,[`content`]),a(w,{path:`/pika/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(k,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,gt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),e(`p`,_t,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(D,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,vt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.isFailure(c)?(h(),s(`div`,yt,[a(k,{closable:!1,class:`failure`},{template:p(()=>[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.failure`)),1)]),default:p(()=>[e(`p`,$,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(D,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,bt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(D,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,xt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,St,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(D,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0),n.isWaiting(c)?(h(),s(`div`,Ct,[a(k,{closable:!1,class:`info`},{template:p(()=>[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`pika.status.processing`:`pika.status.pending`)),1)]),default:p(()=>[e(`p`,wt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(D,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0)])]))),128)}var Et=_({name:`RecentPanel`,components:{TaskPreview:I(rt,[[`render`,Tt],[`__scopeId`,`data-v-0c3b2346`]]),BotPlaceholder:le,NoTasks:ae,ScrollList:ie},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pika?.tasks,items:this.$store.state.pika?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Dt={key:0},Ot={key:2,class:`w-full h-full flex items-center justify-center`};function kt(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Dt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,(e,t)=>(h(),f(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Ot,[a(v)])):o(``,!0)],64)}var At=_({name:`PikaIndex`,components:{ConfigPanel:Qe,Layout:he,RecentPanel:I(Et,[[`render`,kt]])},mixins:[ee],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pika?.status?.getApplications===H.Request},tasksLoading(){return this.$store.state.pika?.status?.getTasks===H.Request||this.fetchingTasks},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===H.Request},needApply(){return this.$store.state.pika.status.getApplications===H.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await oe({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`pika/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`pika/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},onApply(){W.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&L.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`pika/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!R(this.uploadTracker,e=>this.$t(e),e=>L.warning(e)))return;let e={...this.config,async:!0};if(!G())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}L.info(this.$t(`pika.message.startingTask`)),ne(`pika`,B.generate(e,{token:t})).then(()=>{L.success(this.$t(`pika.message.startTaskSuccess`)),this.$store.commit(`pika/setConfig`,{config:void 0})}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?L.error(this.$t(`pika.message.usedUp`)):L.error(this.$t(`pika.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function jt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Mt=I(At,[[`render`,jt],[`__scopeId`,`data-v-fee6c9ea`]]);export{Mt as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-u4ZPt_q3.js";import{t as b}from"./upload-D5lWE4_S.js";import{t as x}from"./tooltip-DsAnpgnK.js";import{t as S}from"./alert-GKEAiGRQ.js";import{n as C,r as w}from"./radio-DgDgyT2l.js";import{t as T}from"./drawer-woRr4Mr5.js";import{t as E}from"./switch-2xjWV4Am.js";import{t as D}from"./clock-CRwB_MFX.js";import{r as O,t as k}from"./PromptTextarea-BMAJqZZI.js";import{t as A}from"./info-Wm-OGGAd.js";import{t as j}from"./trash-2-CDLeP9p9.js";import{t as M}from"./triangle-alert-6yh-6tsz.js";import{t as N}from"./upload-Dcdh9YU5.js";import{t as P}from"./wand-sparkles-l5kkPYwT.js";import{gi as F}from"./constants-7uZLiijT.js";import{E as I,Gt as ee,Kt as te,Sr as ne,Ti as L,Ut as R,Wt as z,Yn as B,Yt as V,ci as H,di as U,hr as W,in as G,qt as K,wi as q,zi as J}from"./index-Lo_Ido09.js";import{t as Y}from"./CopyToClipboard-CYhdL6je.js";import{t as X}from"./ImagePreview-CN_a4NcZ.js";import{n as Z}from"./taskDrawerMixin-DyAUhFEq.js";import{t as re}from"./Consumption-CT7T63yY.js";import{a as Q,n as ie,r as ae,t as oe}from"./pagination-CVzRjA6_.js";import{t as se}from"./vue-plyr-wiIKa-zl.js";import{t as ce}from"./ApiCodeButton-B0-x9FnD.js";import{t as le}from"./BotPlaceholder-DrEVlBn6.js";var ue=_({name:`LayoutPika`,components:{MagicIcon:P,ElDrawer:T,ElButton:J},mixins:[Z]}),de={class:`main flex flex-row flex-1`},fe={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)]`},pe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function me(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,de,[e(`div`,fe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,pe,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var he=I(ue,[[`render`,me],[`__scopeId`,`data-v-14cc52c3`]]),ge=_({name:`IngredientsSelector`,components:{ElSwitch:E,InfoIcon:Q},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients},set(e){if(!e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients:e,ingredients_mode:void 0,image_url:void 0});return}this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients:e,model:`2.0`})}}},mounted(){this.value===void 0&&(this.value=!1)}}),_e={class:`field`},ve={class:`label`},ye={class:`title font-bold`};function be(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,_e,[e(`div`,ve,[e(`h2`,ye,i(t.$t(`pika.name.ingredients`)),1),a(d,{content:t.$t(`pika.description.ingredients`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])}var xe=I(ge,[[`render`,be],[`__scopeId`,`data-v-606e1d1a`]]),Se=_({name:`EffectSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`Levitate`,label:this.$t(`pika.style.effect1`)},{value:`Decapitate`,label:this.$t(`pika.style.effect2`)},{value:`Eye-pop`,label:this.$t(`pika.style.effect3`)},{value:`Ta-da`,label:this.$t(`pika.style.effect4`)},{value:`Deflate`,label:this.$t(`pika.style.effect5`)},{value:`Crumble`,label:this.$t(`pika.style.effect6`)},{value:`Dissolve`,label:this.$t(`pika.style.effect7`)},{value:`Squish`,label:this.$t(`pika.style.effect8`)},{value:`Inflate`,label:this.$t(`pika.style.effect9`)},{value:`Melt`,label:this.$t(`pika.style.effect10`)},{value:`Cake-ify`,label:this.$t(`pika.style.effect11`)},{value:`Crush`,label:this.$t(`pika.style.effect12`)},{value:`Explode`,label:this.$t(`pika.style.effect13`)}]},value:{get(){return this.$store.state.pika?.config?.effect},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,effect:e})}}}}),Ce={class:`field`},we={class:`title font-bold`},Te={class:`float-left`};function Ee(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Ce,[e(`h2`,we,i(t.$t(`pika.name.effect`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pika.placeholder.select`),clearable:``},{default:p(()=>[(h(!0),s(c,null,m(t.options,t=>(h(),f(g,{key:t.value,label:t.label,value:t.value},{default:p(()=>[e(`span`,Te,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var De=I(Se,[[`render`,Ee],[`__scopeId`,`data-v-d1c54475`]]),Oe=_({name:`IngredientsModelSelector`,components:{ElRadioButton:C,ElRadioGroup:w},data(){return{options:[{label:this.$t(`pika.button.precise`),value:`precise`},{label:this.$t(`pika.button.creative`),value:`creative`}]}},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients_mode},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients_mode:e})}}},mounted(){this.value||=F}}),ke={class:`field`},Ae={class:`title font-bold`};function je(t,n,o,u,d,g){let _=l(`el-radio-button`),v=l(`el-radio-group`);return h(),s(`div`,ke,[e(`h2`,Ae,i(t.$t(`pika.name.ingredientsModel`)),1),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`quality`},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.value},{default:p(()=>[r(i(e.label),1)]),_:2},1032,[`label`]))),128))]),_:1},8,[`modelValue`])])}var Me=I(Oe,[[`render`,je],[`__scopeId`,`data-v-b72865fa`]]),Ne=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`2.0`,label:`2.0`},{value:`1.5`,label:`1.5`}]}},computed:{value:{get(){return this.$store.state.pika?.config?.model},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||=`2.0`}}),Pe={class:`field`},Fe={class:`title font-bold`};function Ie(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Pe,[e(`h2`,Fe,i(t.$t(`pika.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pika.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Le=I(Ne,[[`render`,Ie],[`__scopeId`,`data-v-7b2e870a`]]),Re=_({name:`ImageUrlInput`,components:{UploadIcon:N,ElUpload:b,ElButton:J,InfoIcon:Q,ImagePreview:X},mixins:[K,te,z],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.pika?.config?.image_url}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;let t=this.fileList.filter(e=>!e.response?.file_url),n=(e||[]).map(e=>this.fileList.find(t=>t.response?.file_url===e||t.url===e)||{name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}});this.fileList=[...n,...t.filter(e=>!n.includes(e))]}}},methods:{onChange(e){!e.url&&e.raw&&(e.url=URL.createObjectURL(e.raw))},onExceed(){L.warning(this.$t(`pika.message.uploadStartImageExceed`))},onError(){L.error(this.$t(`pika.message.uploadStartImageError`))},onRemove(){this.onSetStartImageUrl()},onSetStartImageUrl(){this.suppressWatch=!0,this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,image_url:this.urls}),this.$nextTick(()=>{this.suppressWatch=!1})},onSuccess(){this.onSetStartImageUrl()},onRemovePreview(e){let t=this.fileList.indexOf(e);t>=0&&this.fileList.splice(t,1),e.url?.startsWith(`blob:`)&&URL.revokeObjectURL(e.url),this.onSetStartImageUrl()}}}),ze={class:`field`},Be={class:`label`},Ve={class:`title font-bold`},He={key:0,class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ue(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`upload-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return h(),s(`div`,null,[e(`div`,ze,[e(`div`,Be,[e(`h2`,Ve,i(t.$t(`pika.name.imageUrl`)),1),a(v,{content:t.$t(`pika.description.imageUrl`),class:`info`},null,8,[`content`])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value shrink-0`,limit:3,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-change":t.onChange,"on-remove":t.onRemove,"on-success":t.onSuccess,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`pika.button.uploadImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-change`,`on-remove`,`on-success`,`headers`])]),t.fileList.length?(h(),s(`div`,He,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{key:e.uid||e.url||n,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemovePreview(e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])):o(``,!0)])}var We=I(Re,[[`render`,Ue],[`__scopeId`,`data-v-2dc7db44`]]),Ge=_({name:`PromptInput`,components:{PromptTextarea:k},computed:{prompt:{get(){return this.$store.state.pika?.config?.prompt},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ke(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`pika.name.prompt`),info:e.$t(`pika.description.prompt`),placeholder:e.$t(`pika.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var qe=_({name:`PresetPanel`,components:{MagicIcon:P,ImageUrlInput:We,ElButton:J,Consumption:re,PromptInput:I(Ge,[[`render`,Ke]]),IngredientsSelector:xe,IngredientsModelSelector:Me,ModelSelector:Le,EffectSelector:De},emits:[`generate`],computed:{config(){return this.$store.state.pika?.config},consumption(){return V(this.config,this.service?.cost)},service(){return this.$store.state.pika?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Je={class:`flex flex-col h-full`},Ye={class:`flex-1 overflow-y-auto p-5`},Xe={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ze(t,n,c,u,d,m){let g=l(`prompt-input`),_=l(`model-selector`),v=l(`ingredients-selector`),y=l(`effect-selector`),b=l(`image-url-input`),x=l(`ingredients-model-selector`),S=l(`consumption`),C=l(`magic-icon`),w=l(`el-button`);return h(),s(`div`,Je,[e(`div`,Ye,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),t.config?.ingredients?(h(),f(b,{key:0,class:`mb-4`})):o(``,!0),t.config?.ingredients?(h(),f(x,{key:1,class:`mb-4`})):o(``,!0)]),e(`div`,Xe,[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(`pika.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Qe=I(qe,[[`render`,Ze]]),$e=_({name:`VideoPlayer`,components:{VuePlyr:se},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:1080,options:[1080]}}}}}),et=[`data-poster`],tt=[`src`];function nt(t,n,r,i,o,c){let u=l(`vue-plyr`);return h(),s(`div`,null,[a(u,{options:t.options,class:`video`},{default:p(()=>[e(`video`,{controls:``,playsinline:``,preload:`metadata`,"data-poster":t.modelValue?.image_url},[e(`source`,{size:`1080`,src:t.modelValue?.video_url,type:`video/mp4`},null,8,tt)],8,et)]),_:1},8,[`options`])])}var rt=_({name:`TaskPreview`,components:{DeleteIcon:j,ChannelIcon:O,InfoIcon:A,MagicIcon:P,TimeIcon:D,WarningIcon:M,CopyToClipboard:Y,ElAlert:S,VideoPlayer:I($e,[[`render`,nt],[`__scopeId`,`data-v-897d9fe0`]]),ElTooltip:x,ElButton:J,ApiCodeButton:ce},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pika?.application},config(){return this.$store.state.pika?.config},videos(){let e=[],t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(n=>{let r=n;t&&(r.action=t),e.push(r)}),e.length===0&&e.push({}),e}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await q.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(`pika/deleteTask`,{id:e}),L.success(this.$t(`common.message.deleteTaskSuccess`))}catch{L.error(this.$t(`common.message.deleteTaskFailed`))}}},isFailure(e){let t=this.modelValue?.response;return t?.success===!1||!!t?.error||e?.state===`failed`||e?.state===`cancelled`},isWaiting(e){return this.modelValue?.response?this.isFailure(e)||e?.video_url?!1:!e?.state||[`queued`,`pending`,`processing`,`running`].includes(e.state):!0},onDownload(e){console.log(`on download`),window.open(e,`_blank`)},onReload(e){let t=e.target,n=new URL(t.src),r=n.searchParams.get(`retry`);if(!r)n.searchParams.set(`retry`,`1`);else if(parseInt(r)<2)n.searchParams.set(`retry`,(parseInt(r)+1).toString());else return;t.src=n.toString()},onOpenVideo(e){window.open(e,`_blank`)}}}),it={class:`left`},at={class:`main`},ot={class:`bot`},st={class:`datetime`},ct=[`aria-label`],lt={class:`info`},ut={key:0,class:`prompt mt-2`},dt={key:0},ft={key:1},pt={key:0,class:n({content:!0,failed:!0})},mt={class:`image-wrapper`},ht={key:0,class:n({operations:!0,"mt-2":!0})},gt={key:0,class:`description`},_t={class:`description`},vt={key:1,class:`description`},yt={key:1,class:n({content:!0})},$={class:`description`},bt={class:`description`},xt={key:0,class:`description`},St={class:`description`},Ct={key:2,class:n({content:!0})},wt={class:`description`};function Tt(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`VideoPlayer`),C=l(`el-button`),w=l(`api-code-button`),T=l(`channel-icon`),E=l(`magic-icon`),D=l(`copy-to-clipboard`),O=l(`time-icon`),k=l(`el-alert`),A=l(`warning-icon`),j=l(`info-icon`);return h(!0),s(c,null,m(n.videos,(c,l)=>(h(),s(`div`,{key:l,class:`preview`},[e(`div`,it,[a(y,{capability:`pika`,part:`avatar`,class:`avatar`})]),e(`div`,at,[e(`div`,ot,[a(y,{capability:`pika`,part:`name`}),e(`span`,st,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:u[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,ct)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,lt,[n.modelValue?.request?.prompt?(h(),s(`p`,ut,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,dt,` - (`+i(n.$t(`pika.status.pending`))+`) `,1)),n.modelValue?.response&&n.isWaiting(c)?(h(),s(`span`,ft,` - (`+i(n.$t(`pika.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0&&c?.video_url?(h(),s(`div`,pt,[e(`div`,mt,[a(S,{"model-value":c},null,8,[`model-value`])]),c?(h(),s(`div`,ht,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`pika.message.downloadVideo`),placement:`top-start`},{default:p(()=>[c?.video_url?(h(),f(C,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:e=>n.onDownload(c?.video_url)},{default:p(()=>[r(i(n.$t(`pika.button.download`)),1)]),_:1},8,[`onClick`])):o(``,!0)]),_:2},1032,[`content`]),a(w,{path:`/pika/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(k,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,gt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),e(`p`,_t,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(D,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,vt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.isFailure(c)?(h(),s(`div`,yt,[a(k,{closable:!1,class:`failure`},{template:p(()=>[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.failure`)),1)]),default:p(()=>[e(`p`,$,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(D,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,bt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(D,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,xt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,St,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(D,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0),n.isWaiting(c)?(h(),s(`div`,Ct,[a(k,{closable:!1,class:`info`},{template:p(()=>[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`pika.status.processing`:`pika.status.pending`)),1)]),default:p(()=>[e(`p`,wt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(D,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0)])]))),128)}var Et=_({name:`RecentPanel`,components:{TaskPreview:I(rt,[[`render`,Tt],[`__scopeId`,`data-v-0c3b2346`]]),BotPlaceholder:le,NoTasks:ae,ScrollList:ie},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pika?.tasks,items:this.$store.state.pika?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Dt={key:0},Ot={key:2,class:`w-full h-full flex items-center justify-center`};function kt(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Dt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,(e,t)=>(h(),f(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Ot,[a(v)])):o(``,!0)],64)}var At=_({name:`PikaIndex`,components:{ConfigPanel:Qe,Layout:he,RecentPanel:I(Et,[[`render`,kt]])},mixins:[ee],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pika?.status?.getApplications===H.Request},tasksLoading(){return this.$store.state.pika?.status?.getTasks===H.Request||this.fetchingTasks},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===H.Request},needApply(){return this.$store.state.pika.status.getApplications===H.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await oe({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`pika/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`pika/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},onApply(){W.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&L.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`pika/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!R(this.uploadTracker,e=>this.$t(e),e=>L.warning(e)))return;let e={...this.config,async:!0};if(!G())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}L.info(this.$t(`pika.message.startingTask`)),ne(`pika`,B.generate(e,{token:t})).then(()=>{L.success(this.$t(`pika.message.startTaskSuccess`)),this.$store.commit(`pika/setConfig`,{config:void 0})}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?L.error(this.$t(`pika.message.usedUp`)):L.error(this.$t(`pika.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function jt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Mt=I(At,[[`render`,jt],[`__scopeId`,`data-v-fee6c9ea`]]);export{Mt 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-Dysa20WI.js";import{t as b}from"./tooltip-DowzbA2H.js";import{t as x}from"./alert-BmDhbY4N.js";import{t as S}from"./drawer-BgpN40Ig.js";import{t as C}from"./box-CXHZJ19d.js";import{t as w}from"./clock-CTJncUP-.js";import{n as T,r as E,t as D}from"./PromptTextarea-BPhoRMVI.js";import{t as O}from"./info-L0HoT29_.js";import{t as k}from"./trash-2-DY-Xs8eB.js";import{t as A}from"./triangle-alert-DIl0w9Tt.js";import{t as j}from"./upload-C2q57sfz.js";import{t as M}from"./wand-sparkles-bgHAAYDe.js";import{Ct as N,Dt as ee,Et as P,Ot as F,kt as I,wt as L}from"./constants-Dm-HitpB.js";import{E as R,En as te,Gt as ne,Kt as z,Sr as re,Ti as B,Ut as V,Wt as H,Yt as U,ci as W,di as G,in as K,qt as q,wi as J,zi as Y}from"./index-X4H_LD85.js";import{t as X}from"./CopyToClipboard-BMaxYkX6.js";import{t as ie}from"./FilePreview-CQ8miS5e.js";import{t as Z}from"./ImagePreview-Dzwq5j1p.js";import{n as ae}from"./taskDrawerMixin-DyAUhFEq.js";import{t as oe}from"./Consumption-DL0zm78X.js";import{a as Q,n as se,r as ce,t as le}from"./pagination-DpHxEI-k.js";import{t as ue}from"./VideoPlayer-CyCnHmhk.js";import{t as de}from"./ApiCodeButton-C_DtLteh.js";import{t as fe}from"./BotPlaceholder-miO90qGo.js";var pe=v({name:`LayoutOmni`,components:{MagicIcon:M,ElDrawer:S,ElButton:Y},mixins:[ae]}),me={class:`main flex flex-row flex-1`},he={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ge={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function _e(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,me,[e(`div`,he,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ge,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ve=R(pe,[[`render`,_e],[`__scopeId`,`data-v-b76ffabf`]]),ye=v({name:`OmniPromptInput`,components:{PromptTextarea:D},computed:{prompt:{get(){return this.$store.state.omni?.config?.prompt},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,prompt:e})}}},mounted(){this.prompt||=``}});function be(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`omni.name.prompt`),info:e.$t(`omni.description.prompt`),placeholder:e.$t(`omni.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var xe=R(ye,[[`render`,be]]),Se=v({name:`OmniResolutionSelector`,components:{InfoIcon:Q},data(){return{options:[{value:I,label:`720p`},{value:F,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.omni?.config?.resolution},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,resolution:e})}}},mounted(){this.value||=L}}),Ce={class:`resolution`},we={class:`header`},Te={class:`title font-bold`},Ee={class:`items`},De=[`onClick`];function Oe(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Ce,[e(`div`,we,[e(`h2`,Te,i(t.$t(`omni.name.resolution`)),1),a(p,{content:t.$t(`omni.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,Ee,[(g(!0),s(c,null,h(t.options,e=>(g(),s(`div`,{key:e.value,class:n([`item`,{active:t.value===e.value}]),onClick:n=>t.value=e.value},i(e.label),11,De))),128))])])}var ke=R(Se,[[`render`,Oe],[`__scopeId`,`data-v-1f9abe29`]]),Ae=v({name:`OmniRatioSelector`,components:{InfoIcon:Q},computed:{options(){return[{value:P,label:`16:9`,w:32,h:18},{value:ee,label:`9:16`,w:18,h:32}]},value:{get(){return this.$store.state.omni?.config?.aspect_ratio},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,aspect_ratio:e})}}},mounted(){this.value||=N}}),je={class:`ratio`},Me={class:`header`},Ne={class:`title font-bold`},Pe={class:`items`},Fe=[`onClick`],Ie={class:`preview`},Le={class:`name`};function Re(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,je,[e(`div`,Me,[e(`h2`,Ne,i(t.$t(`omni.name.ratio`)),1),a(p,{content:t.$t(`omni.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,Pe,[(g(!0),s(c,null,h(t.options,r=>(g(),s(`div`,{key:r.value,class:n([`item`,{active:t.value===r.value}]),onClick:e=>t.value=r.value},[e(`div`,Ie,[e(`div`,{class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)]),e(`div`,Le,i(r.label),1)],10,Fe))),128))])])}var ze=R(Ae,[[`render`,Re],[`__scopeId`,`data-v-1c0c1511`]]),Be=4,Ve=v({name:`OmniReferenceImagesInput`,components:{ElUpload:y,ElButton:Y,InfoIcon:Q,ImagePreview:Z,UploadIcon:j},mixins:[q,z,H],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`,limit:Be,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)||[]},value(){return this.$store.state.omni?.config?.image_urls}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetReferenceImages()},onExceed(){B.warning(this.$t(`omni.message.uploadReferenceExceed`))},onError(){B.error(this.$t(`omni.message.uploadError`))},onSetReferenceImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,image_urls:e.length?e:void 0}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetReferenceImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetReferenceImages()}}}),He={class:`field mb-[10px] flex min-h-8 w-full items-center justify-between gap-3`},Ue={class:`flex min-w-0 items-center`},We={class:`title m-0 text-[14px] font-bold`},Ge={class:`file-list flex flex-wrap gap-[10px]`};function Ke(t,n,o,u,d,m){let _=l(`info-icon`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`image-preview`);return g(),s(`div`,null,[e(`div`,He,[e(`div`,Ue,[e(`h2`,We,i(t.$t(`omni.name.referenceImages`)),1),a(_,{content:t.$t(`omni.description.referenceImages`)},null,8,[`content`])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value shrink-0`,limit:t.limit,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(y,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(v,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,Ge,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])}var qe=R(Ve,[[`render`,Ke]]),Je=v({name:`OmniVideoInput`,components:{ElUpload:y,ElButton:Y,InfoIcon:Q,FilePreview:ie,UploadIcon:j},mixins:[z,H],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},videoUrl(){return this.$store.state.omni?.config?.video_urls?.[0]},videoName(){let e=this.videoUrl||``;return e.split(`/`).pop()||e}},methods:{onExceed(){B.warning(this.$t(`omni.message.uploadVideoExceed`))},onError(){B.error(this.$t(`omni.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<200;return t?n?!0:(B.error(this.$t(`omni.message.uploadVideoSizeExceed`)),!1):(B.error(this.$t(`omni.message.uploadVideoTypeFailed`)),!1)},setVideoUrls(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,video_urls:e?[e]:void 0})},onRemove(){this.fileList=[],this.setVideoUrls(void 0)},async onSuccess(e,t){let n=e?.file_url||t?.response?.file_url;this.setVideoUrls(n||void 0)}}}),Ye={class:`field flex min-h-8 w-full items-center justify-between gap-3`},Xe={class:`flex min-w-0 items-center`},Ze={class:`title m-0 text-[14px] font-bold`},Qe={key:0,class:`file-list flex flex-wrap gap-[10px]`};function $e(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`),y=l(`file-preview`);return g(),s(`div`,null,[e(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`omni.name.referenceVideo`)),1),a(m,{content:t.$t(`omni.description.referenceVideo`)},null,8,[`content`])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value shrink-0`,"show-file-list":!1,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{default:p(()=>[a(_,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(h,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.uploadVideo`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.videoUrl?(g(),s(`div`,Qe,[a(y,{url:t.videoUrl,name:t.videoName,percentage:100,onRemove:t.onRemove},null,8,[`url`,`name`,`onRemove`])])):o(``,!0)])}var et=v({name:`OmniConfigPanel`,components:{ElButton:Y,MagicIcon:M,PromptInput:xe,ResolutionSelector:ke,RatioSelector:ze,ReferenceImagesInput:qe,VideoInput:R(Je,[[`render`,$e],[`__scopeId`,`data-v-bec16553`]]),Consumption:oe},emits:[`generate`],computed:{config(){return this.$store.state.omni?.config},consumption(){return U(this.config,this.service?.cost)},service(){return this.$store.state.omni?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),tt={class:`flex flex-col h-full`},nt={class:`flex-1 overflow-y-auto p-5`},rt={class:`flex flex-col items-center justify-center px-5 pb-5`};function it(t,n,o,c,u,d){let f=l(`prompt-input`),m=l(`ratio-selector`),h=l(`resolution-selector`),_=l(`reference-images-input`),v=l(`video-input`),y=l(`consumption`),b=l(`magic-icon`),x=l(`el-button`);return g(),s(`div`,tt,[e(`div`,nt,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`})]),e(`div`,rt,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.generate`)),1)]),_:1},8,[`onClick`])])])}var at=R(et,[[`render`,it]]),ot=v({name:`OmniTaskPreview`,components:{DeleteIcon:k,ApplicationIcon:C,ChannelIcon:E,CopyToClipboard:X,ExpandIcon:T,InfoIcon:O,MagicIcon:M,TimeIcon:w,WarningIcon:A,ElAlert:x,VideoPlayer:ue,ElTooltip:b,ElButton:Y,ImagePreview:Z,ApiCodeButton:de},props:{modelValue:{type:Object,required:!0}},data(){return{nowTs:Date.now(),timer:0}},computed:{video(){return this.modelValue?.response?.data?.[0]},inputImage(){return this.modelValue?.request?.image_urls?.[0]},pendingElapsed(){let e=parseFloat((this.modelValue?.created_at||``).toString());if(e)return Math.max(0,Math.floor(this.nowTs/1e3-e))}},watch:{"modelValue.response":{handler(e){e&&this.stopTimer()}}},mounted(){this.modelValue?.response||(this.timer=window.setInterval(()=>{this.nowTs=Date.now()},1e3))},beforeUnmount(){this.stopTimer()},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await J.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`omni/deleteTask`,{id:e}),B.success(this.$t(`common.message.deleteTaskSuccess`))}catch{B.error(this.$t(`common.message.deleteTaskFailed`))}}},stopTimer(){this.timer&&=(window.clearInterval(this.timer),0)},onDownload(e){window.open(e,`_blank`)}}}),st={class:`preview`},ct={class:`left`},lt={class:`main`},ut={class:`bot`},dt={class:`datetime`},ft=[`aria-label`],pt={class:`info`},mt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},ht={key:1,class:`prompt mt-2`},gt={key:0},_t={key:1},vt={key:0,class:n({content:!0})},yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},xt={key:1,class:n({content:!0})},St={key:0,class:`mb-4`},Ct={key:1,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},wt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={key:0},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},kt={key:2,class:n({content:!0})},At={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Nt={key:3,class:n({content:!0})},Pt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Ft(n,c,u,d,f,m){let h=l(`capability-presentation`),_=l(`delete-icon`),v=l(`el-tooltip`),y=l(`image-preview`),b=l(`time-icon`),x=l(`magic-icon`),S=l(`copy-to-clipboard`),C=l(`el-alert`),w=l(`video-player`),T=l(`el-button`),E=l(`api-code-button`),D=l(`application-icon`),O=l(`expand-icon`),k=l(`channel-icon`),A=l(`warning-icon`),j=l(`info-icon`);return g(),s(`div`,st,[e(`div`,ct,[a(h,{capability:`omni`,part:`avatar`,class:`avatar`})]),e(`div`,lt,[e(`div`,ut,[a(h,{capability:`omni`,part:`name`}),e(`span`,dt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(v,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(g(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(_,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,ft)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,pt,[n.inputImage?(g(),s(`div`,mt,[a(y,{url:n.inputImage,name:`image`,closable:!1},null,8,[`url`])])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,ht,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.video?.state===`processing`||n.video?.state===`pending`?(g(),s(`span`,_t,` - (`+i(n.$t(`omni.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,gt,` - (`+i(n.$t(`omni.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,xt,[n.video?.video_url?(g(),s(`div`,St,[a(w,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Ct,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`omni.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(T,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`omni.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(E,{path:`/gemini/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,wt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(g(),s(`p`,Tt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.resolution`))+`: `+i(n.modelValue?.request?.resolution)+` `,1),n.modelValue?.request?.aspect_ratio?(g(),s(`span`,Et,` · `+i(n.modelValue?.request?.aspect_ratio),1)):o(``,!0)])):o(``,!0),e(`p`,$,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,Dt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Ot,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(g(),s(`div`,kt,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failure`)),1)]),default:p(()=>[e(`p`,At,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,jt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(S,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Mt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,Nt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.status`)),1)]),default:p(()=>[e(`p`,Pt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})])):(g(),s(`div`,vt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.status.pending`)),1)]),default:p(()=>[e(`p`,yt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.pendingElapsed===void 0?o(``,!0):(g(),s(`p`,bt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.pendingElapsed)+`s `,1)]))]),_:1})]))])])}var It=v({name:`OmniRecentPanel`,components:{TaskPreview:R(ot,[[`render`,Ft],[`__scopeId`,`data-v-2f40a5a9`]]),BotPlaceholder:fe,NoTasks:ce,ScrollList:se},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.omni?.tasks,items:this.$store.state.omni?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Lt={key:0},Rt={key:2,class:`w-full h-full flex items-center justify-center`};function zt(e,t,n,r,i,u){let d=l(`bot-placeholder`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,Lt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,e=>(g(),f(m,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,Rt,[a(v)])):o(``,!0)],64)}var Bt=v({name:`OmniIndex`,components:{ConfigPanel:at,Layout:ve,RecentPanel:R(It,[[`render`,zt]])},mixins:[ne],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.omni?.status?.getApplications===W.Request},tasksLoading(){return this.$store.state.omni?.status?.getTasks===W.Request||this.fetchingTasks},credential(){return this.$store.state.omni?.credential},config(){return this.$store.state.omni?.config},tasks(){return this.$store.state.omni?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await le({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`omni/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`omni/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!V(this.uploadTracker,e=>this.$t(e),e=>B.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.image_urls)&&(e.image_urls=e.image_urls.filter(e=>typeof e==`string`&&e.trim()),e.image_urls.length||delete e.image_urls),Array.isArray(e?.video_urls)&&(e.video_urls=e.video_urls.filter(e=>typeof e==`string`&&e.trim()),e.video_urls.length||delete e.video_urls),!e?.prompt){B.warning(this.$t(`omni.message.promptRequired`));return}if(e?.video_urls&&!e?.image_urls){B.warning(this.$t(`omni.message.videoRequiresImage`));return}let t={...e,async:!0};if(!K())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}B.info(this.$t(`omni.message.startingTask`)),re(`omni`,te.generate(t,{token:n})).then(()=>{B.success(this.$t(`omni.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?B.error(this.$t(`omni.message.usedUp`)):B.error(this.$t(`omni.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Vt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Ht=R(Bt,[[`render`,Vt]]);export{Ht as default};
1
+ 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-D5lWE4_S.js";import{t as b}from"./tooltip-DsAnpgnK.js";import{t as x}from"./alert-GKEAiGRQ.js";import{t as S}from"./drawer-woRr4Mr5.js";import{t as C}from"./box-DjHCVFNB.js";import{t as w}from"./clock-CRwB_MFX.js";import{n as T,r as E,t as D}from"./PromptTextarea-BMAJqZZI.js";import{t as O}from"./info-Wm-OGGAd.js";import{t as k}from"./trash-2-CDLeP9p9.js";import{t as A}from"./triangle-alert-6yh-6tsz.js";import{t as j}from"./upload-Dcdh9YU5.js";import{t as M}from"./wand-sparkles-l5kkPYwT.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-Lo_Ido09.js";import{t as X}from"./CopyToClipboard-CYhdL6je.js";import{t as ie}from"./FilePreview-CUd67FRT.js";import{t as Z}from"./ImagePreview-CN_a4NcZ.js";import{n as ae}from"./taskDrawerMixin-DyAUhFEq.js";import{t as oe}from"./Consumption-CT7T63yY.js";import{a as Q,n as se,r as ce,t as le}from"./pagination-CVzRjA6_.js";import{t as ue}from"./VideoPlayer-S1FrzzNN.js";import{t as de}from"./ApiCodeButton-B0-x9FnD.js";import{t as fe}from"./BotPlaceholder-DrEVlBn6.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,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-DqVvQzGq.js";import{n as w,t as T}from"./tabs-C4gim7Ak.js";import{t as E}from"./tooltip-DowzbA2H.js";import{n as D,r as O,t as k}from"./dropdown-EfsWv0Yl.js";import{t as A}from"./pagination-Bn-Te_lz.js";import{t as j}from"./switch-Co1BiZ5s.js";import{t as M}from"./arrow-down-_laNvAF4.js";import{t as N}from"./arrow-left-BxY2ckiR.js";import{t as P}from"./book-open-DgulRtEJ.js";import{t as F}from"./chevron-down-n14G0ihm.js";import{t as I}from"./chevron-right-CrLR-sC-.js";import{t as L}from"./circle-check-CcZvIPVM.js";import{t as ee}from"./circle-question-mark-Dg_6R6Ml.js";import{t as te}from"./clipboard-list-DQY8azPJ.js";import{t as ne}from"./code-DHK4Pm5M.js";import{t as R}from"./copy-CaELERYD.js";import{t as re}from"./ellipsis-BLq9exTH.js";import{t as ie}from"./eye-Dt7czJN5.js";import{t as ae}from"./file-text-Cg1esE6-.js";import{t as z}from"./file-BjjWIKuD.js";import{t as B}from"./folder-BmoEieDF.js";import{t as oe}from"./image-BLa4-1L7.js";import{t as se}from"./lock-BPdr7Bk-.js";import{t as V}from"./plus-BJtw637u.js";import{n as ce,t as le}from"./store-BqFA4FXv.js";import{t as ue}from"./search-BL6paE0R.js";import{t as de}from"./trash-2-DY-Xs8eB.js";import{t as fe}from"./triangle-alert-DIl0w9Tt.js";import{t as pe}from"./upload-C2q57sfz.js";import{t as me}from"./wand-sparkles-bgHAAYDe.js";import{Ai as H,Ci as U,E as W,Ei as G,Ji as he,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-X4H_LD85.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-GZAOy__u.js";import{t as ze}from"./VueMarkdown-CiiRjbWs.js";var Be=U(`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=U(`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=U(`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=U(`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=U(`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:H,ElButton:J,ElPagination:A,ElSelect:S,ElOption:C,FontAwesomeIcon:Re,AddIcon:V,BackIcon:N,DownIcon:M,InstallIcon:Be,LockIcon:se,SearchIcon:ue,SuccessIcon:L},directives:{loading:G},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-search`},et=[`placeholder`],tt={class:`directory-controls`},nt={class:`directory-grid-wrapper`},rt={key:0,class:`directory-empty`},it={key:1,class:`directory-grid`},at=[`onClick`],ot={class:`directory-card-head`},st={class:`directory-card-title`},ct=[`title`],lt=[`title`],ut=[`aria-label`,`title`,`onClick`],dt=[`title`],ft={class:`directory-card-meta`},pt={class:`directory-card-publisher`},mt={key:0,class:`directory-card-count`},ht=[`title`],gt={class:`directory-card-desc`},_t={key:0,class:`directory-footer`},vt={class:`directory-detail-head`},yt={class:`directory-detail-actions`},bt=[`href`],xt={class:`directory-detail-body`},St={class:`directory-detail-title`},Ct={class:`directory-detail-meta`},wt={key:0},Tt={key:1},Et=[`title`],Dt={class:`directory-detail-desc`};function Ot(a,l,_,y,x,S){let C=d(`search-icon`),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:`960px`,"align-center":``,class:`directory-dialog`,"close-on-click-modal":!a.installing,"show-close":!a.installing,"onUpdate:modelValue":l[6]||=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`,vt,[e(`button`,{class:`directory-back-btn`,onClick:l[4]||=e=>a.selectedItem=null},[o(j,{size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.back`)),1)]),e(`div`,yt,[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,bt)):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[5]||=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`,xt,[e(`h2`,St,`/`+i(a.selectedItem.slug),1),e(`div`,Ct,[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`,wt,[e(`strong`,null,i(a.$t(`skill.directory.license`))+`:`,1),r(` `+i(a.selectedItem.license),1)])):s(``,!0),a.selectedItem.version?(b(),c(`span`,Tt,`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,Et)):s(``,!0)]),e(`p`,Dt,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,[e(`div`,$e,[o(C,{class:`directory-search-icon`,size:16,"aria-hidden":`true`,focusable:`false`}),p(e(`input`,{"onUpdate:modelValue":l[0]||=e=>a.searchQuery=e,class:`directory-search-input`,placeholder:a.$t(`skill.directory.searchPlaceholder`),onInput:l[1]||=(...e)=>a.onSearchInput&&a.onSearchInput(...e)},null,40,et),[[f,a.searchQuery]])]),e(`div`,tt,[o(T,{modelValue:a.namespaceFilter,"onUpdate:modelValue":l[2]||=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[3]||=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`,nt,[!a.loading&&a.total===0?(b(),c(`p`,rt,i(a.$t(`skill.directory.empty`)),1)):(b(),c(`div`,it,[(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`,ot,[e(`span`,st,`/`+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,ct)):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,lt)):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,ut)):(b(),c(`span`,{key:3,class:`directory-card-locked`,title:l.license},[o(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,dt))]),e(`div`,ft,[e(`span`,pt,i(l.publisher),1),l.install_count>0?(b(),c(`span`,mt,[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,ht)):s(``,!0)]),e(`p`,gt,i(l.description),1)],10,at))),128))]))])),[[L,a.loading]]),a.total>a.pageSize?(b(),c(`footer`,_t,[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 kt=W(Ye,[[`render`,Ot],[`__scopeId`,`data-v-80ab8a17`]]);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 At(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 jt(e){let t=(e.split(`.`).pop()||``).toLowerCase();return Y.getLanguage(t)?t:`plain`}var Mt=x({name:`SkillFilePreview`,components:{ElButton:J,ElTooltip:E,ElTabs:w,ElTabPane:T,CodeIcon:ne,CopyIcon:R,FileIcon:z,SaveIcon:Ue,ViewIcon:ie,WarningIcon:fe,VueMarkdown:ze},directives:{loading:G},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?At(this.path,this.contentType):`text`},canRender(){return this.kind===`markdown`||this.kind===`html`},hljsLang(){return`language-${jt(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=At(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}}}}),Nt={class:`preview-root`},Pt={class:`toolbar`},Ft={class:`path-display`},It={key:0,class:`size-display`},Lt={class:`body`},Rt={key:0,class:`error`},zt=[`srcdoc`],Bt={key:3,class:`image-pane`},Vt=[`src`,`alt`],Ht={key:4,class:`binary`},Ut=[`placeholder`],Wt={key:6,class:`source-pane`},Gt={key:7,class:`truncated-warning`};function Kt(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`,Nt,[e(`div`,Pt,[e(`span`,Ft,i(t.path||`—`),1),t.size?(b(),c(`span`,It,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`,Lt,[t.error?(b(),c(`div`,Rt,[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,zt)):t.kind===`image`?(b(),c(`div`,Bt,[e(`img`,{src:t.imageUrl,alt:t.path,class:`image-content`},null,8,Vt)])):t.kind===`binary`?(b(),c(`div`,Ht,[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,Ut)),[[f,t.textContent]]):(b(),c(`pre`,Wt,[e(`code`,{ref:`codeEl`,class:n(t.hljsLang)},i(t.truncatedText),3)])),t.truncated?(b(),c(`p`,Gt,i(t.$t(`skill.preview.truncated`,{size:t.humanSize(t.MAX_PREVIEW_BYTES)})),1)):s(``,!0)])])),[[j,t.loading]])}var qt=W(Mt,[[`render`,Kt],[`__scopeId`,`data-v-ec0a447e`]]),Jt=new Set([`py`,`ts`,`tsx`,`js`,`jsx`,`json`,`yaml`,`yml`,`sh`,`bash`,`zsh`,`css`,`html`,`sql`,`go`,`rs`,`rb`,`java`,`cpp`,`c`,`h`,`toml`]),Yt=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function Xt(e){let t=e.split(`/`).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();return t===`SKILL.md`?P:n===`md`?ae:Yt.has(n)?oe:Jt.has(n)?He:z}function Zt(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 Qt=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?Xt(e.path):B},onClick(){this.node.isLeaf?this.$emit(`select-file`,this.node.path):this.open=!this.open}}}),$t=[`aria-label`,`title`],en={key:1,class:`node-chevron-spacer`},tn={class:`node-label`},nn={key:0,class:`children`};function rn(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`,en)):(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,$t)),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`,tn,i(r.node.label),1)],6),!r.node.isLeaf&&r.open?(b(),c(`ul`,nn,[(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 an=x({name:`SkillRow`,components:{ExpandDownIcon:F,ExpandRightIcon:I,SkillIcon:ce,FileNode:W(Qt,[[`render`,rn],[`__scopeId`,`data-v-2215f06e`]])},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 Zt(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)}}}),on={class:`skill-row-wrapper`},sn=[`aria-label`,`title`],cn={key:1,class:`row-chevron-spacer`},ln=[`title`],un={key:0,class:`file-list`};function dn(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`,on,[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,sn)):(b(),c(`span`,cn)),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,ln)],2),r.expanded&&r.hasChildren?(b(),c(`ul`,un,[(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 fn=W(an,[[`render`,dn],[`__scopeId`,`data-v-3dd0266c`]]),pn=10*1024*1024,mn=/\.(tar\.gz|tgz|tar|zip|md)$/i,hn=x({name:`UploadSkillDialog`,components:{ElDialog:H,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>pn){K.error(this.$t(`skill.message.fileTooLarge`));return}if(!mn.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}}}}}),gn={key:0,class:`dropzone-hint`},_n={key:1,class:`dropzone-file`},vn={class:`dropzone-file-name`},yn={class:`dropzone-file-size`},bn={class:`requirements`},xn={class:`requirements-title`};function Sn(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:`520px`,"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`,_n,[e(`span`,vn,i(a.file.name),1),e(`span`,yn,i(a.humanSize(a.file.size)),1)])):(b(),c(`p`,gn,i(a.$t(`skill.dialog.uploadDrop`)),1))],34),e(`div`,bn,[e(`p`,xn,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 Cn=W(hn,[[`render`,Sn],[`__scopeId`,`data-v-3791b97e`]]),wn=x({name:`WriteSkillDialog`,components:{ElDialog:H,ElButton:J,ElInput:he,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}}}}}),Tn={class:`hint`};function En(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:`720px`,"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`,Tn,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 Dn=x({name:`UserSkills`,components:{ElSwitch:j,ElTag:ge,ElTooltip:E,ElDropdown:k,ElDropdownMenu:O,ElDropdownItem:D,AddIcon:V,AiCreateIcon:me,CloseIcon:_e,DeleteIcon:de,ExpandDownIcon:F,ExpandRightIcon:I,HelpIcon:ee,MarketplaceIcon:le,MoreIcon:re,SearchIcon:ue,SkillIcon:ce,UploadIcon:pe,WriteIcon:te,BrowseSkillsDialog:kt,SkillFilePreview:qt,SkillRow:fn,UploadSkillDialog:Cn,WriteSkillDialog:W(wn,[[`render`,En],[`__scopeId`,`data-v-019a154c`]])},directives:{loading:G},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}}}}),On={class:`page-shell`},kn={class:`page-heading`},An={class:`page-title`},jn={class:`page-subtitle`},Mn={class:`skills-shell`},Nn={class:`left-pane`},Pn={class:`left-header`},Fn={class:`left-actions`},In=[`aria-label`,`title`],Ln=[`aria-label`,`title`],Rn={class:`submenu-trigger`},zn={class:`badge-soon`},Bn={key:0,class:`search-row`},Vn=[`placeholder`],Hn=[`aria-label`,`title`],Un={class:`left-body`},Wn={class:`section`},Gn={key:0,class:`skill-list`},Kn={key:0,class:`empty-row`},qn={key:0,class:`section`},Jn={key:0,class:`skill-list`},Yn={class:`right-pane`},Xn={class:`right-header`},Zn={class:`right-title`},Qn={class:`right-actions`},$n=[`aria-label`,`title`],er={class:`meta-card`},tr={class:`meta-grid`},nr={class:`meta-cell`},rr={class:`meta-label`},ir={class:`meta-value`},ar={class:`meta-cell`},or={class:`meta-label`},sr={class:`meta-value`},cr={key:0,class:`meta-cell`},lr={class:`meta-label`},ur={class:`meta-tags`},dr={key:0,class:`meta-description`},fr={class:`meta-description-label`},pr={class:`meta-label`},mr={class:`preview-card`},hr={key:2,class:`right-empty`};function gr(t,n,a,_,y,x){let S=d(`search-icon`),C=d(`add-icon`),w=d(`marketplace-icon`),T=d(`el-dropdown-item`),E=d(`expand-right-icon`),D=d(`ai-create-icon`),O=d(`write-icon`),k=d(`upload-icon`),A=d(`el-dropdown-menu`),j=d(`el-dropdown`),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`,On,[e(`div`,kn,[e(`h2`,An,i(t.$t(`skill.title.skills`)),1),e(`p`,jn,i(t.$t(`skill.message.pageDescription`)),1)]),e(`div`,Mn,[e(`aside`,Nn,[e(`header`,Pn,[e(`div`,Fn,[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(S,{size:16,"aria-hidden":`true`,focusable:`false`})],8,In)),o(j,{trigger:`click`,placement:`bottom-end`,"hide-on-click":!1},{dropdown:h(()=>[o(A,{class:`add-menu`},{default:h(()=>[o(T,{onClick:t.onBrowse},{default:h(()=>[o(w,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.browse`)),1)]),_:1},8,[`onClick`]),o(T,{divided:``},{default:h(()=>[o(j,{trigger:`hover`,placement:`left-start`,"hide-on-click":!0},{dropdown:h(()=>[o(A,{class:`add-menu`},{default:h(()=>[o(T,{disabled:``},{default:h(()=>[o(D,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.createWithClaude`))+` `,1),e(`span`,zn,i(t.$t(`skill.menu.soon`)),1)]),_:1}),o(T,{onClick:t.openWrite},{default:h(()=>[o(O,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.write`)),1)]),_:1},8,[`onClick`]),o(T,{onClick:t.openUpload},{default:h(()=>[o(k,{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`,Rn,[o(C,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.create`))+` `,1),o(E,{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(C,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Ln)]),_:1})])]),t.searchOpen?(b(),c(`div`,Bn,[o(S,{class:`search-icon`,size:13,"aria-hidden":`true`,focusable:`false`}),p(e(`input`,{ref:`searchInput`,"onUpdate:modelValue":n[1]||=e=>t.searchQuery=e,class:`search-input`,placeholder:t.$t(`skill.placeholder.search`),onKeydown:n[2]||=l((...e)=>t.closeSearch&&t.closeSearch(...e),[`escape`])},null,40,Vn),[[f,t.searchQuery]]),e(`button`,{class:`icon-btn icon-btn-sm`,"aria-label":t.$t(`common.button.close`),title:t.$t(`common.button.close`),onClick:n[3]||=(...e)=>t.closeSearch&&t.closeSearch(...e)},[o(M,{size:14,"aria-hidden":`true`,focusable:`false`})],8,Hn)])):s(``,!0),p((b(),c(`div`,Un,[e(`section`,Wn,[e(`button`,{class:`section-header`,onClick:n[4]||=e=>t.personalOpen=!t.personalOpen},[t.personalOpen?(b(),m(N,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(b(),m(E,{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`,Gn,[!t.loading&&t.filteredPersonal.length===0?(b(),c(`li`,Kn,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`,qn,[e(`button`,{class:`section-header`,onClick:n[5]||=e=>t.globalsOpen=!t.globalsOpen},[t.globalsOpen?(b(),m(N,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(b(),m(E,{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`,Jn,[(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`,Yn,[t.selectedSkill&&!t.selectedPath?(b(),c(u,{key:0},[e(`header`,Xn,[e(`h3`,Zn,i(t.selectedSkill.slug),1),e(`div`,Qn,[o(F,{"model-value":t.selectedSkill.enabled,size:`default`,loading:t.togglingId===t.selectedSkill.id,onChange:n[6]||=e=>t.onToggleSkill(t.selectedSkill,!!e)},null,8,[`model-value`,`loading`]),t.selectedSkill.source===`global`?s(``,!0):(b(),m(j,{key:0,trigger:`click`,placement:`bottom-end`},{dropdown:h(()=>[o(A,null,{default:h(()=>[o(T,{onClick:n[7]||=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,$n)]),_:1}))])]),e(`div`,er,[e(`div`,tr,[e(`div`,nr,[e(`span`,rr,i(t.$t(`skill.meta.addedBy`)),1),e(`span`,ir,i(t.selectedSkill.source===`global`?t.$t(`skill.meta.platform`):t.$t(`skill.meta.you`)),1)]),e(`div`,ar,[e(`span`,or,i(t.$t(`skill.meta.lastUpdated`)),1),e(`span`,sr,i(t.$dayjs.format(t.selectedSkill.updated_at)),1)]),t.selectedSkill.required_connections.length?(b(),c(`div`,cr,[e(`span`,lr,i(t.$t(`skill.field.requiredConnections`)),1),e(`div`,ur,[(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`,dr,[e(`div`,fr,[e(`span`,pr,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`,mr,[(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`,hr,[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[8]||=e=>t.uploadVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),o(ae,{modelValue:t.writeVisible,"onUpdate:modelValue":n[9]||=e=>t.writeVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),o(z,{modelValue:t.browseVisible,"onUpdate:modelValue":n[10]||=e=>t.browseVisible=e,onInstalled:t.onCreated},null,8,[`modelValue`,`onInstalled`])])}var _r=W(Dn,[[`render`,gr],[`__scopeId`,`data-v-549e935d`]]);export{_r 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-u4ZPt_q3.js";import{n as w,t as T}from"./tabs-BIwsuUuq.js";import{t as E}from"./tooltip-DsAnpgnK.js";import{n as D,r as O,t as k}from"./dropdown-DwIazBnb.js";import{t as A}from"./pagination-DlnxtC-c.js";import{t as j}from"./switch-2xjWV4Am.js";import{t as M}from"./arrow-down-NIqacBiy.js";import{t as N}from"./arrow-left-DXJlpd3-.js";import{t as P}from"./book-open-CIe9--uX.js";import{t as F}from"./chevron-down-CTWii8cz.js";import{t as I}from"./chevron-right-C-gvi5JA.js";import{t as L}from"./circle-check-DySTb5tD.js";import{t as ee}from"./circle-question-mark-B0BFUzGf.js";import{t as te}from"./clipboard-list-voR6-Nlr.js";import{t as ne}from"./code-CoatZpQV.js";import{t as R}from"./copy-BfwKopoP.js";import{t as re}from"./ellipsis-BMzB_SYq.js";import{t as ie}from"./eye-CkA6Pdip.js";import{t as ae}from"./file-text-DcWgTnpa.js";import{t as z}from"./file-BC6dyqNi.js";import{t as B}from"./folder-BoO4sARU.js";import{t as oe}from"./image-BgxBbqjA.js";import{t as se}from"./lock-BEvcMFJY.js";import{t as V}from"./plus-dvmEFOrl.js";import{n as ce,t as le}from"./store-VxMLRNHq.js";import{t as ue}from"./search-Bcvi0lZI.js";import{t as de}from"./trash-2-CDLeP9p9.js";import{t as fe}from"./triangle-alert-6yh-6tsz.js";import{t as pe}from"./upload-Dcdh9YU5.js";import{t as me}from"./wand-sparkles-l5kkPYwT.js";import{Ai as H,Ci as U,E as W,Ei as G,Ji as he,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-Lo_Ido09.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-mNPSq-xU.js";import{t as ze}from"./VueMarkdown-CiiRjbWs.js";var Be=U(`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=U(`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=U(`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=U(`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=U(`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:H,ElButton:J,ElPagination:A,ElSelect:S,ElOption:C,FontAwesomeIcon:Re,AddIcon:V,BackIcon:N,DownIcon:M,InstallIcon:Be,LockIcon:se,SearchIcon:ue,SuccessIcon:L},directives:{loading:G},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-search`},et=[`placeholder`],tt={class:`directory-controls`},nt={class:`directory-grid-wrapper`},rt={key:0,class:`directory-empty`},it={key:1,class:`directory-grid`},at=[`onClick`],ot={class:`directory-card-head`},st={class:`directory-card-title`},ct=[`title`],lt=[`title`],ut=[`aria-label`,`title`,`onClick`],dt=[`title`],ft={class:`directory-card-meta`},pt={class:`directory-card-publisher`},mt={key:0,class:`directory-card-count`},ht=[`title`],gt={class:`directory-card-desc`},_t={key:0,class:`directory-footer`},vt={class:`directory-detail-head`},yt={class:`directory-detail-actions`},bt=[`href`],xt={class:`directory-detail-body`},St={class:`directory-detail-title`},Ct={class:`directory-detail-meta`},wt={key:0},Tt={key:1},Et=[`title`],Dt={class:`directory-detail-desc`};function Ot(a,l,_,y,x,S){let C=d(`search-icon`),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:`960px`,"align-center":``,class:`directory-dialog`,"close-on-click-modal":!a.installing,"show-close":!a.installing,"onUpdate:modelValue":l[6]||=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`,vt,[e(`button`,{class:`directory-back-btn`,onClick:l[4]||=e=>a.selectedItem=null},[o(j,{size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.back`)),1)]),e(`div`,yt,[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,bt)):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[5]||=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`,xt,[e(`h2`,St,`/`+i(a.selectedItem.slug),1),e(`div`,Ct,[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`,wt,[e(`strong`,null,i(a.$t(`skill.directory.license`))+`:`,1),r(` `+i(a.selectedItem.license),1)])):s(``,!0),a.selectedItem.version?(b(),c(`span`,Tt,`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,Et)):s(``,!0)]),e(`p`,Dt,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,[e(`div`,$e,[o(C,{class:`directory-search-icon`,size:16,"aria-hidden":`true`,focusable:`false`}),p(e(`input`,{"onUpdate:modelValue":l[0]||=e=>a.searchQuery=e,class:`directory-search-input`,placeholder:a.$t(`skill.directory.searchPlaceholder`),onInput:l[1]||=(...e)=>a.onSearchInput&&a.onSearchInput(...e)},null,40,et),[[f,a.searchQuery]])]),e(`div`,tt,[o(T,{modelValue:a.namespaceFilter,"onUpdate:modelValue":l[2]||=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[3]||=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`,nt,[!a.loading&&a.total===0?(b(),c(`p`,rt,i(a.$t(`skill.directory.empty`)),1)):(b(),c(`div`,it,[(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`,ot,[e(`span`,st,`/`+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,ct)):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,lt)):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,ut)):(b(),c(`span`,{key:3,class:`directory-card-locked`,title:l.license},[o(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,dt))]),e(`div`,ft,[e(`span`,pt,i(l.publisher),1),l.install_count>0?(b(),c(`span`,mt,[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,ht)):s(``,!0)]),e(`p`,gt,i(l.description),1)],10,at))),128))]))])),[[L,a.loading]]),a.total>a.pageSize?(b(),c(`footer`,_t,[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 kt=W(Ye,[[`render`,Ot],[`__scopeId`,`data-v-80ab8a17`]]);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 At(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 jt(e){let t=(e.split(`.`).pop()||``).toLowerCase();return Y.getLanguage(t)?t:`plain`}var Mt=x({name:`SkillFilePreview`,components:{ElButton:J,ElTooltip:E,ElTabs:w,ElTabPane:T,CodeIcon:ne,CopyIcon:R,FileIcon:z,SaveIcon:Ue,ViewIcon:ie,WarningIcon:fe,VueMarkdown:ze},directives:{loading:G},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?At(this.path,this.contentType):`text`},canRender(){return this.kind===`markdown`||this.kind===`html`},hljsLang(){return`language-${jt(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=At(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}}}}),Nt={class:`preview-root`},Pt={class:`toolbar`},Ft={class:`path-display`},It={key:0,class:`size-display`},Lt={class:`body`},Rt={key:0,class:`error`},zt=[`srcdoc`],Bt={key:3,class:`image-pane`},Vt=[`src`,`alt`],Ht={key:4,class:`binary`},Ut=[`placeholder`],Wt={key:6,class:`source-pane`},Gt={key:7,class:`truncated-warning`};function Kt(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`,Nt,[e(`div`,Pt,[e(`span`,Ft,i(t.path||`—`),1),t.size?(b(),c(`span`,It,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`,Lt,[t.error?(b(),c(`div`,Rt,[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,zt)):t.kind===`image`?(b(),c(`div`,Bt,[e(`img`,{src:t.imageUrl,alt:t.path,class:`image-content`},null,8,Vt)])):t.kind===`binary`?(b(),c(`div`,Ht,[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,Ut)),[[f,t.textContent]]):(b(),c(`pre`,Wt,[e(`code`,{ref:`codeEl`,class:n(t.hljsLang)},i(t.truncatedText),3)])),t.truncated?(b(),c(`p`,Gt,i(t.$t(`skill.preview.truncated`,{size:t.humanSize(t.MAX_PREVIEW_BYTES)})),1)):s(``,!0)])])),[[j,t.loading]])}var qt=W(Mt,[[`render`,Kt],[`__scopeId`,`data-v-ec0a447e`]]),Jt=new Set([`py`,`ts`,`tsx`,`js`,`jsx`,`json`,`yaml`,`yml`,`sh`,`bash`,`zsh`,`css`,`html`,`sql`,`go`,`rs`,`rb`,`java`,`cpp`,`c`,`h`,`toml`]),Yt=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function Xt(e){let t=e.split(`/`).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();return t===`SKILL.md`?P:n===`md`?ae:Yt.has(n)?oe:Jt.has(n)?He:z}function Zt(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 Qt=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?Xt(e.path):B},onClick(){this.node.isLeaf?this.$emit(`select-file`,this.node.path):this.open=!this.open}}}),$t=[`aria-label`,`title`],en={key:1,class:`node-chevron-spacer`},tn={class:`node-label`},nn={key:0,class:`children`};function rn(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`,en)):(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,$t)),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`,tn,i(r.node.label),1)],6),!r.node.isLeaf&&r.open?(b(),c(`ul`,nn,[(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 an=x({name:`SkillRow`,components:{ExpandDownIcon:F,ExpandRightIcon:I,SkillIcon:ce,FileNode:W(Qt,[[`render`,rn],[`__scopeId`,`data-v-2215f06e`]])},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 Zt(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)}}}),on={class:`skill-row-wrapper`},sn=[`aria-label`,`title`],cn={key:1,class:`row-chevron-spacer`},ln=[`title`],un={key:0,class:`file-list`};function dn(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`,on,[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,sn)):(b(),c(`span`,cn)),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,ln)],2),r.expanded&&r.hasChildren?(b(),c(`ul`,un,[(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 fn=W(an,[[`render`,dn],[`__scopeId`,`data-v-3dd0266c`]]),pn=10*1024*1024,mn=/\.(tar\.gz|tgz|tar|zip|md)$/i,hn=x({name:`UploadSkillDialog`,components:{ElDialog:H,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>pn){K.error(this.$t(`skill.message.fileTooLarge`));return}if(!mn.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}}}}}),gn={key:0,class:`dropzone-hint`},_n={key:1,class:`dropzone-file`},vn={class:`dropzone-file-name`},yn={class:`dropzone-file-size`},bn={class:`requirements`},xn={class:`requirements-title`};function Sn(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:`520px`,"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`,_n,[e(`span`,vn,i(a.file.name),1),e(`span`,yn,i(a.humanSize(a.file.size)),1)])):(b(),c(`p`,gn,i(a.$t(`skill.dialog.uploadDrop`)),1))],34),e(`div`,bn,[e(`p`,xn,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 Cn=W(hn,[[`render`,Sn],[`__scopeId`,`data-v-3791b97e`]]),wn=x({name:`WriteSkillDialog`,components:{ElDialog:H,ElButton:J,ElInput:he,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}}}}}),Tn={class:`hint`};function En(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:`720px`,"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`,Tn,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 Dn=x({name:`UserSkills`,components:{ElSwitch:j,ElTag:ge,ElTooltip:E,ElDropdown:k,ElDropdownMenu:O,ElDropdownItem:D,AddIcon:V,AiCreateIcon:me,CloseIcon:_e,DeleteIcon:de,ExpandDownIcon:F,ExpandRightIcon:I,HelpIcon:ee,MarketplaceIcon:le,MoreIcon:re,SearchIcon:ue,SkillIcon:ce,UploadIcon:pe,WriteIcon:te,BrowseSkillsDialog:kt,SkillFilePreview:qt,SkillRow:fn,UploadSkillDialog:Cn,WriteSkillDialog:W(wn,[[`render`,En],[`__scopeId`,`data-v-019a154c`]])},directives:{loading:G},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}}}}),On={class:`page-shell`},kn={class:`page-heading`},An={class:`page-title`},jn={class:`page-subtitle`},Mn={class:`skills-shell`},Nn={class:`left-pane`},Pn={class:`left-header`},Fn={class:`left-actions`},In=[`aria-label`,`title`],Ln=[`aria-label`,`title`],Rn={class:`submenu-trigger`},zn={class:`badge-soon`},Bn={key:0,class:`search-row`},Vn=[`placeholder`],Hn=[`aria-label`,`title`],Un={class:`left-body`},Wn={class:`section`},Gn={key:0,class:`skill-list`},Kn={key:0,class:`empty-row`},qn={key:0,class:`section`},Jn={key:0,class:`skill-list`},Yn={class:`right-pane`},Xn={class:`right-header`},Zn={class:`right-title`},Qn={class:`right-actions`},$n=[`aria-label`,`title`],er={class:`meta-card`},tr={class:`meta-grid`},nr={class:`meta-cell`},rr={class:`meta-label`},ir={class:`meta-value`},ar={class:`meta-cell`},or={class:`meta-label`},sr={class:`meta-value`},cr={key:0,class:`meta-cell`},lr={class:`meta-label`},ur={class:`meta-tags`},dr={key:0,class:`meta-description`},fr={class:`meta-description-label`},pr={class:`meta-label`},mr={class:`preview-card`},hr={key:2,class:`right-empty`};function gr(t,n,a,_,y,x){let S=d(`search-icon`),C=d(`add-icon`),w=d(`marketplace-icon`),T=d(`el-dropdown-item`),E=d(`expand-right-icon`),D=d(`ai-create-icon`),O=d(`write-icon`),k=d(`upload-icon`),A=d(`el-dropdown-menu`),j=d(`el-dropdown`),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`,On,[e(`div`,kn,[e(`h2`,An,i(t.$t(`skill.title.skills`)),1),e(`p`,jn,i(t.$t(`skill.message.pageDescription`)),1)]),e(`div`,Mn,[e(`aside`,Nn,[e(`header`,Pn,[e(`div`,Fn,[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(S,{size:16,"aria-hidden":`true`,focusable:`false`})],8,In)),o(j,{trigger:`click`,placement:`bottom-end`,"hide-on-click":!1},{dropdown:h(()=>[o(A,{class:`add-menu`},{default:h(()=>[o(T,{onClick:t.onBrowse},{default:h(()=>[o(w,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.browse`)),1)]),_:1},8,[`onClick`]),o(T,{divided:``},{default:h(()=>[o(j,{trigger:`hover`,placement:`left-start`,"hide-on-click":!0},{dropdown:h(()=>[o(A,{class:`add-menu`},{default:h(()=>[o(T,{disabled:``},{default:h(()=>[o(D,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.createWithClaude`))+` `,1),e(`span`,zn,i(t.$t(`skill.menu.soon`)),1)]),_:1}),o(T,{onClick:t.openWrite},{default:h(()=>[o(O,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.write`)),1)]),_:1},8,[`onClick`]),o(T,{onClick:t.openUpload},{default:h(()=>[o(k,{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`,Rn,[o(C,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.create`))+` `,1),o(E,{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(C,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Ln)]),_:1})])]),t.searchOpen?(b(),c(`div`,Bn,[o(S,{class:`search-icon`,size:13,"aria-hidden":`true`,focusable:`false`}),p(e(`input`,{ref:`searchInput`,"onUpdate:modelValue":n[1]||=e=>t.searchQuery=e,class:`search-input`,placeholder:t.$t(`skill.placeholder.search`),onKeydown:n[2]||=l((...e)=>t.closeSearch&&t.closeSearch(...e),[`escape`])},null,40,Vn),[[f,t.searchQuery]]),e(`button`,{class:`icon-btn icon-btn-sm`,"aria-label":t.$t(`common.button.close`),title:t.$t(`common.button.close`),onClick:n[3]||=(...e)=>t.closeSearch&&t.closeSearch(...e)},[o(M,{size:14,"aria-hidden":`true`,focusable:`false`})],8,Hn)])):s(``,!0),p((b(),c(`div`,Un,[e(`section`,Wn,[e(`button`,{class:`section-header`,onClick:n[4]||=e=>t.personalOpen=!t.personalOpen},[t.personalOpen?(b(),m(N,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(b(),m(E,{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`,Gn,[!t.loading&&t.filteredPersonal.length===0?(b(),c(`li`,Kn,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`,qn,[e(`button`,{class:`section-header`,onClick:n[5]||=e=>t.globalsOpen=!t.globalsOpen},[t.globalsOpen?(b(),m(N,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(b(),m(E,{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`,Jn,[(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`,Yn,[t.selectedSkill&&!t.selectedPath?(b(),c(u,{key:0},[e(`header`,Xn,[e(`h3`,Zn,i(t.selectedSkill.slug),1),e(`div`,Qn,[o(F,{"model-value":t.selectedSkill.enabled,size:`default`,loading:t.togglingId===t.selectedSkill.id,onChange:n[6]||=e=>t.onToggleSkill(t.selectedSkill,!!e)},null,8,[`model-value`,`loading`]),t.selectedSkill.source===`global`?s(``,!0):(b(),m(j,{key:0,trigger:`click`,placement:`bottom-end`},{dropdown:h(()=>[o(A,null,{default:h(()=>[o(T,{onClick:n[7]||=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,$n)]),_:1}))])]),e(`div`,er,[e(`div`,tr,[e(`div`,nr,[e(`span`,rr,i(t.$t(`skill.meta.addedBy`)),1),e(`span`,ir,i(t.selectedSkill.source===`global`?t.$t(`skill.meta.platform`):t.$t(`skill.meta.you`)),1)]),e(`div`,ar,[e(`span`,or,i(t.$t(`skill.meta.lastUpdated`)),1),e(`span`,sr,i(t.$dayjs.format(t.selectedSkill.updated_at)),1)]),t.selectedSkill.required_connections.length?(b(),c(`div`,cr,[e(`span`,lr,i(t.$t(`skill.field.requiredConnections`)),1),e(`div`,ur,[(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`,dr,[e(`div`,fr,[e(`span`,pr,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`,mr,[(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`,hr,[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[8]||=e=>t.uploadVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),o(ae,{modelValue:t.writeVisible,"onUpdate:modelValue":n[9]||=e=>t.writeVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),o(z,{modelValue:t.browseVisible,"onUpdate:modelValue":n[10]||=e=>t.browseVisible=e,onInstalled:t.onCreated},null,8,[`modelValue`,`onInstalled`])])}var _r=W(Dn,[[`render`,gr],[`__scopeId`,`data-v-549e935d`]]);export{_r as default};