@acedatacloud/nexior 3.380.8 → 3.381.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/dist/assets/{ApiCodeButton-C5tBSXac.js → ApiCodeButton-C7SPMZJ4.js} +1 -1
  2. package/dist/assets/{ApiCodeDialog-tzrLt7MW.js → ApiCodeDialog-B0m5_btu.js} +2 -2
  3. package/dist/assets/{Artifacts-Bq-ESji9.js → Artifacts-C935GA3p.js} +1 -1
  4. package/dist/assets/{AskUserQuestionCard-BHRutjE4.js → AskUserQuestionCard-Qi57dVV7.js} +1 -1
  5. package/dist/assets/{AudioPreview-fEc2Zd45.js → AudioPreview-h4P2x5TL.js} +1 -1
  6. package/dist/assets/{Auth-D0qonxcj.js → Auth-DW29k_jE.js} +1 -1
  7. package/dist/assets/{Bare-gBTQBYOF.js → Bare-DvCKQeEu.js} +1 -1
  8. package/dist/assets/{BotPlaceholder-7Rci0gLD.js → BotPlaceholder-BBI_oSgE.js} +1 -1
  9. package/dist/assets/{BottomFooter-CXfDJs6K.js → BottomFooter-afn-jz6v.js} +1 -1
  10. package/dist/assets/{BrowseConnectors-jbUHMESo.js → BrowseConnectors-G0r_jByZ.js} +1 -1
  11. package/dist/assets/{BrowserPairingDialog-BLbseBCp.js → BrowserPairingDialog-BJgs6qLU.js} +1 -1
  12. package/dist/assets/{Callback-DQ7s2YUT.js → Callback-DveJm8vT.js} +1 -1
  13. package/dist/assets/{CodeSnippet-DtFkobrj.js → CodeSnippet-BFdyqpEG.js} +1 -1
  14. package/dist/assets/{Console-DqcMlqeQ.js → Console-C21WF1jP.js} +1 -1
  15. package/dist/assets/{Conversation-CxIjxIV3.js → Conversation-D0W5uzHA.js} +1 -1
  16. package/dist/assets/Conversation-E2vMcQr8.js +2 -0
  17. package/dist/assets/{CopyToClipboard-CIB9LY9Y.js → CopyToClipboard-CdXnxkau.js} +1 -1
  18. package/dist/assets/Detail-DDl6m0vE.js +2 -0
  19. package/dist/assets/{Detail-CgTGSka5.css → Detail-DixHmQzJ.css} +1 -1
  20. package/dist/assets/Extra-C6que9Av.js +1 -0
  21. package/dist/assets/{FilePreview-_7yUZ2m8.js → FilePreview-BpPQ5OAR.js} +1 -1
  22. package/dist/assets/{Hailuo-Gr9P4KZh.js → Hailuo-BeRIbNr2.js} +1 -1
  23. package/dist/assets/{History-BdECMOXE.js → History-BsN3wekq.js} +1 -1
  24. package/dist/assets/{ImagePreview-Dq6UkYX8.js → ImagePreview-BOxOkmuq.js} +1 -1
  25. package/dist/assets/{ImageWrapper-C9nEUyQX.js → ImageWrapper-vYpJPO89.js} +1 -1
  26. package/dist/assets/{Index-DF_YSy5V.js → Index-0oHw41Oc.js} +1 -1
  27. package/dist/assets/{Index-FNGDlXFq.js → Index-1U2bTpbF.js} +1 -1
  28. package/dist/assets/{Index-CWWsa0Lz.js → Index-7IkF_rpP.js} +1 -1
  29. package/dist/assets/{Index-CGU29OIG.js → Index-B-Mkt2ur.js} +1 -1
  30. package/dist/assets/Index-BPh5XDKu.js +1 -0
  31. package/dist/assets/{Index-DxgRmJSg.js → Index-BWgi01SX.js} +1 -1
  32. package/dist/assets/{Index-EYQ1NKQW.js → Index-Ba4WWol0.js} +2 -2
  33. package/dist/assets/{Index-BS1nLceI.js → Index-BdjKyfS1.js} +1 -1
  34. package/dist/assets/Index-BiHjCG2i.js +1 -0
  35. package/dist/assets/{Index-DfJKnw20.js → Index-CB-KJcln.js} +1 -1
  36. package/dist/assets/{Index-DN7liprI.js → Index-CI-2_oM6.js} +2 -2
  37. package/dist/assets/Index-CI8i6hTW.js +1 -0
  38. package/dist/assets/{Index-DCSPk7nn.js → Index-CJ7hChmF.js} +1 -1
  39. package/dist/assets/{Index-SDzpl-Jc2.js → Index-CJtxYaZ02.js} +1 -1
  40. package/dist/assets/{Index-B7WKuXER.js → Index-CPrqWc5U.js} +1 -1
  41. package/dist/assets/{Index-CmrcDBzZ2.js → Index-CUsRTBAy2.js} +1 -1
  42. package/dist/assets/{Index-B3fIj3yi.js → Index-CVwMDW-A.js} +2 -2
  43. package/dist/assets/{Index-BinkgTmw.js → Index-CZS8iQGD.js} +1 -1
  44. package/dist/assets/{Index-D5VNzG82.js → Index-CetGJnpB.js} +1 -1
  45. package/dist/assets/{Index-AbcXPxs0.js → Index-CnYc0oJ8.js} +1 -1
  46. package/dist/assets/Index-D4x9T8au.js +1 -0
  47. package/dist/assets/Index-D5Ul2doi.js +1 -0
  48. package/dist/assets/{Index-Drdb9P_r.js → Index-DRVWr0MK.js} +1 -1
  49. package/dist/assets/{Index-DeYrbAvW.js → Index-D_y7v_Gn.js} +1 -1
  50. package/dist/assets/Index-DcVducNv.js +1 -0
  51. package/dist/assets/{Index-DLjlVvNI.js → Index-DeZs_u7x.js} +1 -1
  52. package/dist/assets/{Index-BhPsqs3d.js → Index-Dfg2U97G.js} +1 -1
  53. package/dist/assets/Index-O_CrvytF.js +1 -0
  54. package/dist/assets/Index-U68d2uZj.js +1 -0
  55. package/dist/assets/{Index-DAF6Fi1i.js → Index-_De5KqLp.js} +2 -2
  56. package/dist/assets/{Index-BDfNqyi8.js → Index-hhTRG2BF.js} +1 -1
  57. package/dist/assets/{Index-Bi_F3a9E.js → Index-iVjZH5W4.js} +1 -1
  58. package/dist/assets/Index-j-bMmKiW.js +1 -0
  59. package/dist/assets/Index-jMFiTGzQ2.js +1 -0
  60. package/dist/assets/Index-pButqdV7.js +1 -0
  61. package/dist/assets/{Index-DgC9uvAK.js → Index-wIXSyIsm.js} +1 -1
  62. package/dist/assets/{Invitees-DyGmUv2R.js → Invitees-NIBmPbQA.js} +1 -1
  63. package/dist/assets/List-BRxaXLPy.js +1 -0
  64. package/dist/assets/List-D-zLjR6q.js +1 -0
  65. package/dist/assets/List-wiwQQloc.js +1 -0
  66. package/dist/assets/LocalTools-BC90IHHk.js +5 -0
  67. package/dist/assets/{LocalTools-BPDI9e-z.js → LocalTools-CEjkt2l2.js} +1 -1
  68. package/dist/assets/{Logo-6qSswnm2.js → Logo-C6NJezpt.js} +1 -1
  69. package/dist/assets/{Main-gLvuSjN6.js → Main-B0EVjP0H.js} +1 -1
  70. package/dist/assets/{Message-BtE8gWlu.js → Message-BAL7WOXJ.js} +2 -2
  71. package/dist/assets/{Model-CeOYezTT.js → Model-j4_EX-gG.js} +2 -2
  72. package/dist/assets/{Navigator-DqokGio8.js → Navigator-CERVgrJV.js} +5 -5
  73. package/dist/assets/{NotFound-D3Q4GfiQ.js → NotFound-l7IoxBXr.js} +1 -1
  74. package/dist/assets/{PageHeader-DOWQjC3H.js → PageHeader-Cer1mYPv.js} +1 -1
  75. package/dist/assets/Pay-o3xo2mqm.js +1 -0
  76. package/dist/assets/{Player-B3iX2KLl.js → Player-UOjqiG5R.js} +1 -1
  77. package/dist/assets/{Poivelle-DKlkQB2c.js → Poivelle-BKRPVdM1.js} +1 -1
  78. package/dist/assets/{RealtimeCall-XAJLDR6Q.js → RealtimeCall-Cs8cbkOK.js} +2 -2
  79. package/dist/assets/{ReportButton-D3eba7A1.js → ReportButton-CpSn2HJv.js} +1 -1
  80. package/dist/assets/{ReportDialog-tMrdW_fU.js → ReportDialog-BoKKjM7J.js} +1 -1
  81. package/dist/assets/{ScenarioPaymentMode-BwoqFZco.js → ScenarioPaymentMode-Bfxf8Ufv.js} +1 -1
  82. package/dist/assets/{ScheduledTasks-CMcU7GEK.js → ScheduledTasks-iixEy1Ye.js} +2 -2
  83. package/dist/assets/{ServicePricingSummary-N2X5DfKj.js → ServicePricingSummary-D4J-WJ1t.js} +1 -1
  84. package/dist/assets/{SharedMarkdown-B8a4sQ0t.js → SharedMarkdown-BDyd2eGz.js} +1 -1
  85. package/dist/assets/{ShowcaseGrid-DFAlG_5F.js → ShowcaseGrid-DPrNdkyb.js} +1 -1
  86. package/dist/assets/{ShowcaseResultTabs-Bx16-8QM.js → ShowcaseResultTabs-Di_5PzXP.js} +1 -1
  87. package/dist/assets/{SolanaWalletPickerDialog-DpiM35uj.js → SolanaWalletPickerDialog-JUe0BzI8.js} +1 -1
  88. package/dist/assets/Status-C8r33_t6.js +1 -0
  89. package/dist/assets/{Status-CJdLn3iI.css → Status-Ck9ha4jD.css} +1 -1
  90. package/dist/assets/{Subscribe-BN32hXrS.js → Subscribe-z4lsK-Pw.js} +1 -1
  91. package/dist/assets/{TabSwitcher-6c6JSS4_.js → TabSwitcher-DJsQU_kt.js} +1 -1
  92. package/dist/assets/{Tts-Dio3pSmI.js → Tts-CvIT5Y3Q.js} +1 -1
  93. package/dist/assets/{VideoPlayer-BNtDhrpR.js → VideoPlayer-B43pPHVA.js} +1 -1
  94. package/dist/assets/{VideoPreview-K60Fueap.js → VideoPreview-DxrhYEOD.js} +1 -1
  95. package/dist/assets/{VueMarkdown-ktB0s_p4.js → VueMarkdown-Cm2HOlvG.js} +2 -2
  96. package/dist/assets/WriteSkillDialog-_mcGlQJv.js +1 -0
  97. package/dist/assets/{airwallexCheckout--o-YoruN.js → airwallexCheckout-DfA_t-KL.js} +1 -1
  98. package/dist/assets/arrow-down-D2NapJz3.js +1 -0
  99. package/dist/assets/arrow-left-DylqoAP7.js +1 -0
  100. package/dist/assets/arrow-right-J1XoxSVH.js +1 -0
  101. package/dist/assets/arrow-up-DO1r6z0s.js +1 -0
  102. package/dist/assets/{authorizeFlow-D30X2Lyo.js → authorizeFlow-De8qROX8.js} +1 -1
  103. package/dist/assets/{avatar--_Ho4k0C.js → avatar-CFr7Npbl.js} +1 -1
  104. package/dist/assets/{back-navigation-D-lHpBnE.js → back-navigation-CBmABnbg.js} +1 -1
  105. package/dist/assets/{basic-C8xJ8MvR.js → basic-BFxUUMy1.js} +1 -1
  106. package/dist/assets/{book-open-BH4GaBn5.js → book-open-pud407AJ.js} +1 -1
  107. package/dist/assets/{box-3_e2nW7_.js → box-BzqbI4wX.js} +1 -1
  108. package/dist/assets/{boxes-DQGNW64d.js → boxes-x-qEQ-LI.js} +1 -1
  109. package/dist/assets/{brain-DMDAedtO.js → brain-DJFZK1UE.js} +1 -1
  110. package/dist/assets/{chart-no-axes-combined-N5HL2gKV.js → chart-no-axes-combined-D35CqiRR.js} +1 -1
  111. package/dist/assets/{chat-C3QlZeo1.js → chat-Cbq_zDLN.js} +1 -1
  112. package/dist/assets/check-CHq--2kK.js +1 -0
  113. package/dist/assets/chevron-down-BI4tJ27m.js +1 -0
  114. package/dist/assets/chevron-right-CHuS6TXO.js +1 -0
  115. package/dist/assets/{circle-alert-C-PFf-1o.js → circle-alert-CHxD-85L.js} +1 -1
  116. package/dist/assets/circle-check-D_FoW3dP.js +1 -0
  117. package/dist/assets/{circle-question-mark-iFkJm6Cg.js → circle-question-mark-BGXCIlnz.js} +1 -1
  118. package/dist/assets/{clipboard-list-Cvngrayq.js → clipboard-list-BxI8Nmie.js} +1 -1
  119. package/dist/assets/clock-CvHl_Vd7.js +1 -0
  120. package/dist/assets/code-NL9LxNiy.js +1 -0
  121. package/dist/assets/codingBridge-DW94cI81.js +2 -0
  122. package/dist/assets/{codingBridgeNotify-BoMwcUhd.js → codingBridgeNotify-CokX8Ia4.js} +2 -2
  123. package/dist/assets/{coins-D0M4bX5f.js → coins-PK6Ps1X2.js} +1 -1
  124. package/dist/assets/{connection-CaarfcXm.js → connection-D1Ih6dQd.js} +1 -1
  125. package/dist/assets/{copy-CUk5HyqT.js → copy-D7lHzTGA.js} +1 -1
  126. package/dist/assets/{createTaskActions-DQEdc5ib.js → createTaskActions-BZPCtPLs.js} +1 -1
  127. package/dist/assets/{date-picker-C9cLRv2A.js → date-picker-B72Rk5Dt.js} +1 -1
  128. package/dist/assets/{digitalhuman-C7ZvYqCi.js → digitalhuman-BvEYnRvw.js} +1 -1
  129. package/dist/assets/{dollar-sign-C1s1LGmE.js → dollar-sign-CKl6b5bP.js} +1 -1
  130. package/dist/assets/{download-BmQLXojU.js → download-pMsno2DA.js} +1 -1
  131. package/dist/assets/{drawer-VaJhlwVr.js → drawer-BaqojTRQ.js} +1 -1
  132. package/dist/assets/{dropdown-iF_atr6i.js → dropdown-CuUYnMXP.js} +1 -1
  133. package/dist/assets/{dropdown-DBipAigc.js → dropdown-j3EEj4Tp.js} +1 -1
  134. package/dist/assets/{ellipsis-BqkKsvF-.js → ellipsis-BlYmih11.js} +1 -1
  135. package/dist/assets/{esm-DrVDihqw.js → esm-BmncEOyb.js} +2 -2
  136. package/dist/assets/{esm-Cbxht914.js → esm-CXE577Fh.js} +2 -2
  137. package/dist/assets/esm-qenNKkbC.js +1 -0
  138. package/dist/assets/{external-link-C9bruFod.js → external-link-BIUuevwA.js} +1 -1
  139. package/dist/assets/{eye-CFHeQVx8.js → eye-BFgFlWNS.js} +1 -1
  140. package/dist/assets/{file-CR75F95u.js → file-DmSI4aV7.js} +1 -1
  141. package/dist/assets/{file-output-CfzTcR2_.js → file-output-DncNlmtQ.js} +1 -1
  142. package/dist/assets/{file-text-DBotrbYk.js → file-text-DcI2reu5.js} +1 -1
  143. package/dist/assets/{fish-B1s1UOus.js → fish-DGdFCanw.js} +1 -1
  144. package/dist/assets/{flux-CVzCQ6JR.js → flux-CzW311tV.js} +1 -1
  145. package/dist/assets/{folder-C9cnY4AN.js → folder-uXRfk1mZ.js} +1 -1
  146. package/dist/assets/gauge-BTPC0rXL.js +1 -0
  147. package/dist/assets/{globe-BKX021RY.js → globe-BPuLsDjR.js} +1 -1
  148. package/dist/assets/{nanobanana-BPGCIia_.js → grokvideo-CSAs2I4j.js} +1 -1
  149. package/dist/assets/{hailuo-CP8PTXG3.js → hailuo-D87_m-0U.js} +1 -1
  150. package/dist/assets/{hash-B61j4cgz.js → hash-yia5yLmV.js} +1 -1
  151. package/dist/assets/{headphones-SI1F4r-k.js → headphones-B8rBVQdH.js} +1 -1
  152. package/dist/assets/{history-_iIOa-KW.js → history-BNTxRkBy.js} +1 -1
  153. package/dist/assets/{house-C3am4krm.js → house-CbbGN4zL.js} +1 -1
  154. package/dist/assets/{image-DNGAwErV.js → image-CS6hThMg.js} +1 -1
  155. package/dist/assets/{index-Bk9SKIXV.js → index-C8uXmX2U.js} +17 -17
  156. package/dist/assets/{index.es-xc1wwztg.js → index.es-5Phodjqa.js} +1 -1
  157. package/dist/assets/{info-CDi6ZfZf.js → info-DVNsJvAI.js} +1 -1
  158. package/dist/assets/{input-number-BwJ2QIsY.js → input-number-BmFOlu3s.js} +1 -1
  159. package/dist/assets/{kling-BxsNl9_b.js → kling-BDMU0ncE.js} +1 -1
  160. package/dist/assets/{languages-p0PeYqme.js → languages-DX-qFZ5y.js} +1 -1
  161. package/dist/assets/{laptop-B7PBJgxD.js → laptop-DxflGBrU.js} +1 -1
  162. package/dist/assets/{lightbulb-ByXvOBwJ.js → lightbulb-CvqLaOvJ.js} +1 -1
  163. package/dist/assets/{link-f8tGCmjZ.js → link-BmCk0KSR.js} +1 -1
  164. package/dist/assets/loader-circle-VDhzM6Nn.js +1 -0
  165. package/dist/assets/{luma-D_7feexJ.js → luma-Cc-i1JLx.js} +1 -1
  166. package/dist/assets/{maestro-BO062bai.js → maestro-BSM6rSzW.js} +1 -1
  167. package/dist/assets/{mail-Cu6rYS5J.js → mail-BCkjos6i.js} +1 -1
  168. package/dist/assets/{message-circle-DQGqX_tb.js → message-circle-BmBmlsGF.js} +1 -1
  169. package/dist/assets/{mic-Duo8uJFA.js → mic-UcSG54_q.js} +1 -1
  170. package/dist/assets/{midjourney-DgbyQQt4.js → midjourney-CuMTiD4G.js} +1 -1
  171. package/dist/assets/minimax-kQU1Q46c.js +1 -0
  172. package/dist/assets/{mobileLocalExec-BAoyTFxs.js → mobileLocalExec-CwMOa_zQ.js} +2 -2
  173. package/dist/assets/{monitor-BY7a2lSu.js → monitor-VOFjSWYN.js} +1 -1
  174. package/dist/assets/{mouse-pointer-2-BBBdRKNG.js → mouse-pointer-2-DAKfL4eZ.js} +1 -1
  175. package/dist/assets/music-2-CKgTqNZ9.js +1 -0
  176. package/dist/assets/{grokvideo-IjeySWKZ.js → nanobanana-BARcP081.js} +1 -1
  177. package/dist/assets/{omni-DRmYijL5.js → omni-BdZjSEzD.js} +1 -1
  178. package/dist/assets/openaiimage-sQHUP0bq.js +1 -0
  179. package/dist/assets/{pagination-Srdjt7tL.js → pagination-C4oGiE57.js} +1 -1
  180. package/dist/assets/{pagination-Bxloie8Z.js → pagination-CoQKuK4D.js} +1 -1
  181. package/dist/assets/{pagination-BodQ3KsQ.js → pagination-uSk2V2K7.js} +1 -1
  182. package/dist/assets/{palette-CBVqiEiY.js → palette-Cw-HJS5z.js} +1 -1
  183. package/dist/assets/{paperclip-C5ucVDdU.js → paperclip-CSMkIW0R.js} +1 -1
  184. package/dist/assets/{pause-DEsHu_JX.js → pause-BYsZ80n3.js} +1 -1
  185. package/dist/assets/{pencil-zCR4E3gn.js → pencil-D6KQdtCj.js} +1 -1
  186. package/dist/assets/{pixverse-Br13_G7h.js → pika-a8YZxfOY.js} +1 -1
  187. package/dist/assets/pixverse-B7na9cqk.js +1 -0
  188. package/dist/assets/play-PlISts4C.js +1 -0
  189. package/dist/assets/{plug-BuLs05P4.js → plug-BlxHQPiR.js} +1 -1
  190. package/dist/assets/plus-8qHkLr4t.js +1 -0
  191. package/dist/assets/{poivelle-CmbgX8cH.js → poivelle-C_aJhNN6.js} +1 -1
  192. package/dist/assets/{popover-B0GxuFgb.js → popover-BqK-ErPr.js} +1 -1
  193. package/dist/assets/{producer-CtomnQQP.js → producer-a3I8ulbm.js} +1 -1
  194. package/dist/assets/{qrart-D4w0rqYS.js → qrart-B0UCUS7O.js} +1 -1
  195. package/dist/assets/{qwenimage-DL9zIyXV.js → qwenimage-BKtsaJIJ.js} +1 -1
  196. package/dist/assets/{realtime-DMwjvq1k.js → realtime-D-W5frEc.js} +1 -1
  197. package/dist/assets/{refresh-cw-CcOH8EPk.js → refresh-cw-B-RuE_6C.js} +1 -1
  198. package/dist/assets/rotate-ccw-DafhIXvS.js +1 -0
  199. package/dist/assets/rotate-cw-DIM3zleO.js +1 -0
  200. package/dist/assets/{scheduledTasks-BatLQ_gR.js → scheduledTasks-B7bwGGDF.js} +1 -1
  201. package/dist/assets/{scroll-text-BTS-NpZu.js → scroll-text-o74NoTP2.js} +1 -1
  202. package/dist/assets/search-Bh1-kl2_.js +1 -0
  203. package/dist/assets/{seedance-Bou-k6BW.js → seedance-CWwgV8jO.js} +1 -1
  204. package/dist/assets/{seedream-C9Rua-7B.js → seedream-fbaMKMDO.js} +1 -1
  205. package/dist/assets/{select-Dv7ZrvnE.js → select-Ctt4vMla.js} +1 -1
  206. package/dist/assets/{serp-B8GBsdPs.js → serp-CxyE8Wg6.js} +1 -1
  207. package/dist/assets/{shield-D-mmPu1n.js → shield-CNEip5QK.js} +1 -1
  208. package/dist/assets/{showcase-Cq0oPoIV.js → showcase-B3x-XIzn.js} +1 -1
  209. package/dist/assets/{showcaseRecreateMixin-C0UnaxsG.js → showcaseRecreateMixin-1te_SCEr.js} +1 -1
  210. package/dist/assets/{shuffle-D5K8vZCN.js → shuffle-XCkaDWwW.js} +1 -1
  211. package/dist/assets/{siteHome-Ds14_RM3.js → siteHome-DAuiSeoD.js} +1 -1
  212. package/dist/assets/{slider-C4ifUfAq.js → slider-DgU-R1_f.js} +1 -1
  213. package/dist/assets/{solana-wallets-B_mKv7o5.js → solana-wallets-v9HM0phx.js} +2 -2
  214. package/dist/assets/{sora-CO4yLi7O.js → sora-EYl03Tg1.js} +1 -1
  215. package/dist/assets/{sparkles-BI5Fg4u8.js → sparkles-BWT6yPWj.js} +1 -1
  216. package/dist/assets/square-VQwp91bM.js +1 -0
  217. package/dist/assets/{suno-BPJ6ThLW.js → suno-nHiDCtV6.js} +1 -1
  218. package/dist/assets/{switch-CFUCWNgM.js → switch-DfKiiyLD.js} +1 -1
  219. package/dist/assets/{table-GjLQgxzP.js → table-B3Y40ujp.js} +1 -1
  220. package/dist/assets/{tag-A8kAprsR.js → tag-DeoG4_K6.js} +1 -1
  221. package/dist/assets/{taskPolling-C9KHdhtK.js → taskPolling-ed3DvCWh.js} +1 -1
  222. package/dist/assets/terminal-CoZlBFes.js +1 -0
  223. package/dist/assets/{time-picker-D4M2msCX.js → time-picker-Dw67yBu1.js} +1 -1
  224. package/dist/assets/{tooltip-L2G5ntVi.js → tooltip-Co_mOTlo.js} +1 -1
  225. package/dist/assets/{trash-2-CUcSh2xz.js → trash-2-2Il_x-4b.js} +1 -1
  226. package/dist/assets/{triangle-alert-fl0O4ttl.js → triangle-alert-Dc39dkq0.js} +1 -1
  227. package/dist/assets/{upload-ClpzRFqM.js → upload-RXQqkOuq.js} +1 -1
  228. package/dist/assets/user-CRuiuJ_x.js +1 -0
  229. package/dist/assets/{veo-DzVF-9VO.js → veo-CP7MEHUu.js} +1 -1
  230. package/dist/assets/{video-D2H2yrK5.js → video-6ckJHXgu.js} +1 -1
  231. package/dist/assets/{volume-2-DuPw1i4l.js → volume-2-NeRUKB9t.js} +1 -1
  232. package/dist/assets/{wallet-BoMayNFZ.js → wallet-DqsH6oxz.js} +1 -1
  233. package/dist/assets/{wan-Div7QNhT.js → wan-BD9moAq4.js} +1 -1
  234. package/dist/assets/{wand-sparkles-C9xUdsPZ.js → wand-sparkles-CdzPtG8R.js} +1 -1
  235. package/dist/assets/{web-CxmWSgKl.js → web-B-lQxU2R.js} +1 -1
  236. package/dist/assets/{web-NUACo-ru.js → web-BV1Sidqw.js} +1 -1
  237. package/dist/assets/{web-CXqpsAgb.js → web-Bg9dBHiL.js} +1 -1
  238. package/dist/assets/{web-CMUsrooq.js → web-CeF7asFe.js} +1 -1
  239. package/dist/assets/{web-onuv9tHs.js → web-RYS5ytss.js} +1 -1
  240. package/dist/assets/{webextrator-Di-ibQB9.js → webextrator-DxlqCl-G.js} +1 -1
  241. package/dist/assets/{zap-B0eAEhqX.js → zap-BjEPcYjV.js} +1 -1
  242. package/dist/index.html +1 -1
  243. package/package.json +1 -1
  244. package/dist/assets/Conversation-BdtH_RD0.js +0 -2
  245. package/dist/assets/Detail-Cwhh5P9b.js +0 -2
  246. package/dist/assets/Extra-C2rM0X0l.js +0 -1
  247. package/dist/assets/Index-BHFcy6tF.js +0 -1
  248. package/dist/assets/Index-Bo60hgY3.js +0 -1
  249. package/dist/assets/Index-Bx9XT7ii.js +0 -1
  250. package/dist/assets/Index-C8oOUtOA.js +0 -1
  251. package/dist/assets/Index-CGSt7zKV.js +0 -1
  252. package/dist/assets/Index-DE4Uanlv.js +0 -1
  253. package/dist/assets/Index-DUFd5F6p2.js +0 -1
  254. package/dist/assets/Index-DVhN8ZAF.js +0 -1
  255. package/dist/assets/Index-DeOmC_Q0.js +0 -1
  256. package/dist/assets/Index-Dkc39b3K.js +0 -1
  257. package/dist/assets/Index-Vz7Mw5xh.js +0 -1
  258. package/dist/assets/List-0tPShY4u.js +0 -1
  259. package/dist/assets/List-5Z5tELQE.js +0 -1
  260. package/dist/assets/List-lPxHfTDQ.js +0 -1
  261. package/dist/assets/LocalTools-CWWIjS6k.js +0 -5
  262. package/dist/assets/Pay-O5Qlb6UW.js +0 -1
  263. package/dist/assets/Status-CVUE2QYX.js +0 -1
  264. package/dist/assets/WriteSkillDialog-Bw-u8hlH.js +0 -1
  265. package/dist/assets/arrow-down-DCMjRdO_.js +0 -1
  266. package/dist/assets/arrow-left-DFXx6UvA.js +0 -1
  267. package/dist/assets/arrow-right-BBcVYEm1.js +0 -1
  268. package/dist/assets/arrow-up-BAfO-War.js +0 -1
  269. package/dist/assets/check-kkIqx5X1.js +0 -1
  270. package/dist/assets/chevron-down-vUO0pCAt.js +0 -1
  271. package/dist/assets/chevron-right-CHPHpC1T.js +0 -1
  272. package/dist/assets/circle-check-1eqJK_BD.js +0 -1
  273. package/dist/assets/clock-DIjv9Rh6.js +0 -1
  274. package/dist/assets/code-Bm4SQ3yq.js +0 -1
  275. package/dist/assets/codingBridge-CeVcO4fE.js +0 -2
  276. package/dist/assets/esm-fbzVLLeD.js +0 -1
  277. package/dist/assets/gauge-BdSNWC_w.js +0 -1
  278. package/dist/assets/loader-circle-BWTf1Yce.js +0 -1
  279. package/dist/assets/minimax-C_26yfUG.js +0 -1
  280. package/dist/assets/music-2-BmtV50Q3.js +0 -1
  281. package/dist/assets/openaiimage-DMLO-tzp.js +0 -1
  282. package/dist/assets/pika-CpXs-W0u.js +0 -1
  283. package/dist/assets/play-XZGUGKIJ.js +0 -1
  284. package/dist/assets/plus-Bz8tjapX.js +0 -1
  285. package/dist/assets/rotate-ccw-S9qsO1Sd.js +0 -1
  286. package/dist/assets/rotate-cw-DZrl6qQ6.js +0 -1
  287. package/dist/assets/search-K-yhv6oC.js +0 -1
  288. package/dist/assets/square-_e71CHtO.js +0 -1
  289. package/dist/assets/terminal-fyhUEvgw.js +0 -1
  290. package/dist/assets/user-3UxB-6FB.js +0 -1
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,R as c,T as l,at as u,ht as d,it as f,j as p,mt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-Ctt4vMla.js";import{t as x}from"./upload-BG3x_JWJ.js";import{t as S}from"./tooltip-Co_mOTlo.js";import{t as C}from"./alert-BprQRUmf.js";import{_ as w,v as T}from"./vuex.esm-bundler-C-5WV-ta.js";import{n as E,r as D}from"./radio-BNhFzeBO.js";import{t as O}from"./drawer-BaqojTRQ.js";import{t as k}from"./switch-DfKiiyLD.js";import{t as A}from"./clock-CvHl_Vd7.js";import{t as j}from"./hash-yia5yLmV.js";import{t as M}from"./info-DVNsJvAI.js";import{a as N,i as ee,n as P,r as F,t as I}from"./pagination-uSk2V2K7.js";import{t as L}from"./trash-2-2Il_x-4b.js";import{t as R}from"./triangle-alert-Dc39dkq0.js";import{t as z}from"./upload-RXQqkOuq.js";import{t as B}from"./wand-sparkles-CdzPtG8R.js";import{Ii as te}from"./constants-CspFM8fh.js";import{t as ne}from"./preload-helper-zJ_50EbN.js";import{$i as V,Br as H,D as U,Hi as W,T as G,Tn as K,Ua as q,Wi as J,Ya as Y,at as X,co as Z,ct as re,da as ie,li as ae,lt as oe,oi as se,ot as ce,ra as le,st as ue,tt as de,zr as Q}from"./index-C8uXmX2U.js";import{t as fe}from"./CopyToClipboard-CdXnxkau.js";import{t as pe}from"./ReportButton-CpSn2HJv.js";import{t as me}from"./ImagePreview-BOxOkmuq.js";import{n as he}from"./taskDrawerMixin-DyAUhFEq.js";import{t as ge}from"./ServicePricingSummary-D4J-WJ1t.js";/* empty css */import{t as _e}from"./ScenarioPaymentMode-Bfxf8Ufv.js";import{t as ve}from"./ApiCodeButton-C7SPMZJ4.js";import{t as ye}from"./BotPlaceholder-BBI_oSgE.js";import{t as be}from"./taskPollingMixin-CcLxtz8z.js";import{n as xe,t as Se}from"./generationInput-VbA_cpqx.js";var Ce=v({name:`LayoutPika`,components:{MagicIcon:B,ElDrawer:O,ElButton:Z},mixins:[he]}),we={class:`main flex flex-row flex-1`},Te={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)]`},Ee={class:`result h-full p-4 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function De(t,n,r,i,o,c){let l=u(`magic-icon`),p=u(`el-button`),h=u(`el-drawer`);return g(),s(`div`,we,[e(`div`,Te,[f(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ee,[f(t.$slots,`result`,{},void 0,!0)]),d(a(p,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[a(l,{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:m(()=>[f(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Oe=U(Ce,[[`render`,De],[`__scopeId`,`data-v-85e060ce`]]),ke=v({name:`IngredientsSelector`,components:{ElSwitch:k,InfoIcon:N},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)}}),Ae={class:`field`},je={class:`label`},Me={class:`title font-bold`};function Ne(t,n,r,o,c,l){let d=u(`info-icon`),f=u(`el-switch`);return g(),s(`div`,Ae,[e(`div`,je,[e(`h2`,Me,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 Pe=U(ke,[[`render`,Ne],[`__scopeId`,`data-v-606e1d1a`]]),Fe=v({name:`EffectSelector`,components:{ElSelect:y,ElOption:b},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})}}}}),Ie={class:`field`},Le={class:`title font-bold`},Re={class:`float-left`};function ze(t,n,r,o,c,d){let f=u(`el-option`),_=u(`el-select`);return g(),s(`div`,Ie,[e(`h2`,Le,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:m(()=>[(g(!0),s(l,null,h(t.options,t=>(g(),p(f,{key:t.value,label:t.label,value:t.value},{default:m(()=>[e(`span`,Re,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Be=U(Fe,[[`render`,ze],[`__scopeId`,`data-v-d1c54475`]]),Ve=v({name:`IngredientsModelSelector`,components:{ElRadioButton:E,ElRadioGroup:D},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||=te}}),He={class:`field`},Ue={class:`title font-bold`};function We(t,n,o,c,d,f){let _=u(`el-radio-button`),v=u(`el-radio-group`);return g(),s(`div`,He,[e(`h2`,Ue,i(t.$t(`pika.name.ingredientsModel`)),1),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`quality`},{default:m(()=>[(g(!0),s(l,null,h(t.options,e=>(g(),p(_,{key:e.value,label:e.value},{default:m(()=>[r(i(e.label),1)]),_:2},1032,[`label`]))),128))]),_:1},8,[`modelValue`])])}var Ge=U(Ve,[[`render`,We],[`__scopeId`,`data-v-b72865fa`]]),Ke=v({name:`ModelSelector`,components:{ElSelect:y,ElOption:b},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`}}),qe={class:`field`},Je={class:`title font-bold`};function Ye(t,n,r,o,c,d){let f=u(`el-option`),_=u(`el-select`);return g(),s(`div`,qe,[e(`h2`,Je,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:m(()=>[(g(!0),s(l,null,h(t.options,e=>(g(),p(f,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Xe=U(Ke,[[`render`,Ye],[`__scopeId`,`data-v-7b2e870a`]]),Ze=v({name:`ImageUrlInput`,components:{UploadIcon:z,ElUpload:x,ElButton:Z,InfoIcon:N,ImagePreview:me},mixins:[oe,re,ce,de],data(){return{fileList:[],uploadUrl:q()+`/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(){T.warning(this.$t(`pika.message.uploadStartImageExceed`))},onError(){T.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()}}}),Qe={class:`field`},$e={class:`label`},et={class:`title font-bold`},tt={key:0,class:`file-list mt-2 flex flex-wrap gap-[10px]`};function nt(t,n,c,d,f,_){let v=u(`info-icon`),y=u(`upload-icon`),b=u(`el-button`),x=u(`el-upload`),S=u(`image-preview`);return g(),s(`div`,null,[e(`div`,Qe,[e(`div`,$e,[e(`h2`,et,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,"before-upload":t.beforeUploadSizeGuard,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:m(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:m(()=>[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`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-change`,`on-remove`,`on-success`,`headers`])]),t.fileList.length?(g(),s(`div`,tt,[(g(!0),s(l,null,h(t.fileList,(e,n)=>(g(),p(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 rt=U(Ze,[[`render`,nt],[`__scopeId`,`data-v-637337bb`]]),it=v({name:`PromptInput`,components:{PromptTextarea:ee},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 at(e,t,n,r,i,a){let o=u(`prompt-textarea`);return g(),p(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 ot=v({name:`PresetPanel`,components:{MagicIcon:B,ImageUrlInput:rt,ElButton:Z,ServicePricingSummary:ge,PromptInput:U(it,[[`render`,at]]),IngredientsSelector:Pe,IngredientsModelSelector:Ge,ModelSelector:Xe,EffectSelector:Be,ScenarioPaymentMode:_e},emits:[`generate`],data(){return{quoteTimer:0,quoteRunId:0}},computed:{canGenerate(){return Se(`pika`,Q(this.config))},config(){return this.$store.state.pika?.config},consumption(){return K(this.config,this.service?.cost)},service(){return this.$store.state.pika?.service},walletMode(){return W()&&J(`pika`).mode===`wallet`}},watch:{walletMode:{handler(e){e&&this.scheduleQuote()},immediate:!0},config:{handler(){this.walletMode&&this.scheduleQuote()},deep:!0}},beforeUnmount(){window.clearTimeout(this.quoteTimer),this.quoteRunId+=1},methods:{scheduleQuote(){window.clearTimeout(this.quoteTimer),this.quoteRunId+=1;let e=J(`pika`);e.quoteUsdc=void 0,e.quoteLoading=!1,this.canGenerate&&(this.quoteTimer=window.setTimeout(this.refreshQuote,350))},async refreshQuote(){if(!this.canGenerate)return;let e=J(`pika`),t=++this.quoteRunId;e.quoteLoading=!0,e.quoteUsdc=void 0;try{let n=await H.quote(Q(this.config));t===this.quoteRunId&&e.mode===`wallet`&&this.canGenerate&&(e.quoteUsdc=n.amountUsdc)}catch(e){console.warn(`x402 quote failed`,e)}finally{t===this.quoteRunId&&(e.quoteLoading=!1)}},onGenerate(){this.$emit(`generate`)}}}),st={class:`flex flex-col h-full`},ct={class:`flex-1 overflow-y-auto p-5`},lt={class:`flex flex-col items-center justify-center px-5 pb-5`};function ut(t,n,c,l,d,f){let h=u(`prompt-input`),_=u(`model-selector`),v=u(`ingredients-selector`),y=u(`effect-selector`),b=u(`image-url-input`),x=u(`ingredients-model-selector`),S=u(`scenario-payment-mode`),C=u(`service-pricing-summary`),w=u(`magic-icon`),T=u(`el-button`);return g(),s(`div`,st,[e(`div`,ct,[a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),t.config?.ingredients?(g(),p(b,{key:0,class:`mb-4`})):o(``,!0),t.config?.ingredients?(g(),p(x,{key:1,class:`mb-4`})):o(``,!0)]),e(`div`,lt,[a(S,{scenario:`pika`}),t.walletMode?o(``,!0):(g(),p(C,{key:0,value:t.consumption,service:t.service},null,8,[`value`,`service`])),a(T,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:m(()=>[a(w,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`pika.button.generate`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var dt=U(ot,[[`render`,ut]]),ft=v({name:`VideoPlayer`,components:{VuePlyr:c(()=>ne(()=>import(`./index.esm-B6OqqThm.js`),[]))},props:{modelValue:{type:Object,required:!0}},data(){return{clientReady:!1,options:{quality:{default:1080,options:[1080]}}}},mounted(){this.clientReady=!0}}),pt=[`data-poster`],mt=[`src`];function ht(t,n,r,i,a,c){let l=u(`vue-plyr`);return g(),s(`div`,null,[t.clientReady?(g(),p(l,{key:0,options:t.options,class:`video`},{default:m(()=>[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,mt)],8,pt)]),_:1},8,[`options`])):o(``,!0)])}var gt=v({name:`TaskPreview`,components:{DeleteIcon:L,ChannelIcon:j,InfoIcon:M,MagicIcon:B,TimeIcon:A,WarningIcon:R,CopyToClipboard:fe,ElAlert:C,VideoPlayer:U(ft,[[`render`,ht],[`__scopeId`,`data-v-3a68a4bd`]]),ElTooltip:S,ElButton:Z,ApiCodeButton:ve,ReportButton:pe},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 Y.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}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.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`)}}}),_t={class:`left`},vt={class:`main`},yt={class:`bot`},bt={class:`datetime`},xt=[`aria-label`],St={class:`info`},Ct={key:0,class:`prompt mt-2`},wt={key:0},Tt={key:1},Et={key:0,class:n({content:!0,failed:!0})},Dt={class:`image-wrapper`},Ot={key:0,class:n({operations:!0,"mt-2":!0})},kt={key:0,class:`description`},At={class:`description`},jt={key:1,class:`description`},Mt={key:1,class:n({content:!0})},Nt={class:`description`},$={class:`description`},Pt={key:0,class:`description`},Ft={class:`description`},It={key:2,class:n({content:!0})},Lt={class:`description`};function Rt(n,c,d,f,_,v){let y=u(`capability-presentation`),b=u(`delete-icon`),x=u(`el-tooltip`),S=u(`VideoPlayer`),C=u(`el-button`),w=u(`api-code-button`),T=u(`report-button`),E=u(`channel-icon`),D=u(`magic-icon`),O=u(`copy-to-clipboard`),k=u(`time-icon`),A=u(`el-alert`),j=u(`warning-icon`),M=u(`info-icon`);return g(!0),s(l,null,h(n.videos,(l,u)=>(g(),s(`div`,{key:u,class:`preview`},[e(`div`,_t,[a(y,{capability:`pika`,part:`avatar`,class:`avatar`})]),e(`div`,vt,[e(`div`,yt,[a(y,{capability:`pika`,part:`name`}),e(`span`,bt,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:m(()=>[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(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,xt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,St,[n.modelValue?.request?.prompt?(g(),s(`p`,Ct,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(g(),s(`span`,wt,` - (`+i(n.$t(`pika.status.pending`))+`) `,1)),n.modelValue?.response&&n.isWaiting(l)?(g(),s(`span`,Tt,` - (`+i(n.$t(`pika.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0&&l?.video_url?(g(),s(`div`,Et,[e(`div`,Dt,[a(S,{"model-value":l},null,8,[`model-value`])]),l?(g(),s(`div`,Ot,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`pika.message.downloadVideo`),placement:`top-start`},{default:m(()=>[l?.video_url?(g(),p(C,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:e=>n.onDownload(l?.video_url)},{default:m(()=>[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`]),a(T,{service:`pika`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(A,{closable:!1,class:`mt-2 success`},{default:m(()=>[n.modelValue?.request?.model?(g(),s(`p`,kt,[a(E,{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`,At,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(O,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,jt,[a(k,{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(l)?(g(),s(`div`,Mt,[a(A,{closable:!1,class:`failure`},{template:m(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.failure`)),1)]),default:m(()=>[e(`p`,Nt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(O,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,$,[a(M,{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(O,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,Pt,[a(k,{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`,Ft,[a(E,{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(O,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0),n.isWaiting(l)?(g(),s(`div`,It,[a(A,{closable:!1,class:`info`},{template:m(()=>[a(k,{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:m(()=>[e(`p`,Lt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`pika.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(O,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0)])]))),128)}var zt=v({name:`RecentPanel`,components:{TaskPreview:U(gt,[[`render`,Rt],[`__scopeId`,`data-v-4c95d941`]]),BotPlaceholder:ye,NoTasks:F,ScrollList:P},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?.()}}}),Bt={key:0},Vt={key:2,class:`w-full h-full flex items-center justify-center`};function Ht(e,t,n,r,i,c){let d=u(`bot-placeholder`),f=u(`task-preview`),_=u(`scroll-list`),v=u(`no-tasks`);return g(),s(l,null,[e.tasks?.items===void 0?(g(),s(`div`,Bt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),p(_,{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:m(()=>[(g(!0),s(l,null,h(e.tasks?.items,(e,t)=>(g(),p(f,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,Vt,[a(v)])):o(``,!0)],64)}var Ut=v({name:`PikaIndex`,components:{ConfigPanel:dt,Layout:Oe,RecentPanel:U(zt,[[`render`,Ht]])},mixins:[ue,be(`pika`)],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1,walletTaskIds:[]}},computed:{applicationsLoading(){return this.$store.state.pika?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.pika?.status?.getTasks===w.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===w.Request},needApply(){return this.$store.state.pika.status.getApplications===w.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.tasks},walletMode(){return W()&&J(`pika`).mode===`wallet`}},watch:{walletMode:{async handler(e,t){if(!(t===void 0||e===t)){if(this.$store.commit(`pika/setTasks`,void 0),e&&!this.job&&(this.job=window.setInterval(this.onPollTasks,5e3)),!e&&!this.credential?.token){window.clearInterval(this.job),this.job=0,await this.onScrollDown();return}await this.onGetTasks(),await this.onScrollDown()}}},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.onPollTasks,5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await I({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(){V.create({application:this.application}).then(({data:e})=>{this.application=e,T.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&T.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,...this.walletMode&&!this.credential?.token?{mode:`x402`,ids:this.walletTaskIds}:{}})}finally{this.fetchingTasks=!1}},async onGenerate(){let e=Q(this.config),t=xe(`pika`,e);if(t){T.error(this.$t(`common.message.${t}`));return}if(!X(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;let n;if(this.walletMode){let t=this.getWalletContext();if(!t){T.warning(this.$t(`common.x402Scenario.connectWalletFirst`));return}n=H.generate(e,{mode:`x402`,x402:{wallet:t,confirm:e=>this.confirmWalletPayment(e),identityToken:this.credential?.token}})}else{if(!ie())return;let t=this.credential?.token;if(!t)return;n=H.generate(e,{token:t})}T.info(this.$t(`pika.message.startingTask`)),le(`pika`,n).then(e=>{let t=e?.data?.task_id;this.walletMode&&!this.credential?.token&&t&&!this.walletTaskIds.includes(t)&&this.walletTaskIds.unshift(t),T.success(this.$t(`pika.message.startTaskSuccess`)),this.$store.commit(`pika/setConfig`,{config:void 0})}).catch(e=>{e instanceof se||G(e,`pika`)||(this.walletMode?T.error(this.$t(`common.x402Scenario.paymentFailed`)):T.error(this.$t(`pika.message.startTaskFailed`)))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getWalletContext(){return ae(this.$wallet)},async confirmWalletPayment(e){return Y.confirm(this.$t(`common.x402Scenario.confirmPayment`,{amount:e.amountUsdc}),this.$t(`order.message.x402ConfirmTitle`),{confirmButtonText:this.$t(`order.message.x402WalletPayCta`),cancelButtonText:this.$t(`common.button.cancel`),type:`warning`}).then(()=>!0).catch(()=>!1)},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Wt(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`layout`);return g(),p(l,null,{config:m(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[a(c,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Gt=U(Ut,[[`render`,Wt],[`__scopeId`,`data-v-50569acf`]]);export{Gt as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,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-Ctt4vMla.js";import{t as b}from"./upload-BG3x_JWJ.js";import{t as x}from"./tooltip-Co_mOTlo.js";import{t as S}from"./alert-BprQRUmf.js";import{_ as C,v as w}from"./vuex.esm-bundler-C-5WV-ta.js";import{t as T}from"./checkbox-DXMDpaxv.js";import{t as E}from"./drawer-BaqojTRQ.js";import{t as D}from"./input-number-BmFOlu3s.js";import{t as O}from"./clock-CvHl_Vd7.js";import{t as k}from"./hash-yia5yLmV.js";import{t as ee}from"./info-DVNsJvAI.js";import{a as A,i as j,n as M,r as N,t as P}from"./pagination-uSk2V2K7.js";import{t as F}from"./trash-2-2Il_x-4b.js";import{t as I}from"./triangle-alert-Dc39dkq0.js";import{t as L}from"./wand-sparkles-CdzPtG8R.js";import{xt as te}from"./constants-CspFM8fh.js";import{Bn as R,D as z,Hi as B,T as V,Tn as H,Ua as U,Vn as W,Wi as G,Ya as K,at as q,co as J,ct as Y,da as X,go as Z,li as Q,lt as ne,oi as re,ot as ie,ra as ae,st as oe,tt as se}from"./index-C8uXmX2U.js";import{t as ce}from"./CopyToClipboard-CdXnxkau.js";import{t as le}from"./ReportButton-CpSn2HJv.js";import{t as ue}from"./ImagePreview-BOxOkmuq.js";import{n as de}from"./taskDrawerMixin-DyAUhFEq.js";import{t as fe}from"./ServicePricingSummary-D4J-WJ1t.js";import{t as pe}from"./VideoPlayer-B43pPHVA.js";import{t as me}from"./ScenarioPaymentMode-Bfxf8Ufv.js";import{t as he}from"./ApiCodeButton-C7SPMZJ4.js";import{t as ge}from"./BotPlaceholder-BBI_oSgE.js";import{t as _e}from"./taskPollingMixin-CcLxtz8z.js";import{n as ve,t as ye}from"./generationInput-VbA_cpqx.js";var be=_({name:`LayoutWan`,components:{MagicIcon:L,ElDrawer:E,ElButton:J},mixins:[de]}),xe={class:`main flex flex-row flex-1`},Se={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)]`},Ce={class:`result h-full p-4 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function we(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,xe,[e(`div`,Se,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ce,[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 Te=z(be,[[`render`,we],[`__scopeId`,`data-v-20dc9571`]]),Ee=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`wan2.6-t2v`,label:this.$t(`wan.button.modelT2v`)},{value:`wan2.6-i2v`,label:this.$t(`wan.button.modelI2v`)},{value:`wan2.6-i2v-flash`,label:this.$t(`wan.button.modelI2vFlash`)},{value:`wan2.6-r2v`,label:this.$t(`wan.button.modelR2v`)},{value:`wan3.0-video`,label:this.$t(`wan.button.modelWan3`)}]},value:{get(){return this.$store.state.wan?.config?.model},set(e){this.$store.commit(`wan/setConfig`,{...this.$store.state.wan?.config,model:e})}}},mounted(){this.value||=te}}),De={class:`field`},Oe={class:`title font-bold`},ke={class:`float-left`};function Ae(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,De,[e(`h2`,Oe,i(t.$t(`wan.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`wan.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`,ke,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var je=z(Ee,[[`render`,Ae],[`__scopeId`,`data-v-f4ee3412`]]),Me=`720p`,Ne=_({name:`ResolutionSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return[{value:`480p`,label:this.$t(`wan.name.resolution480p`)},{value:`720p`,label:this.$t(`wan.name.resolution720p`)},{value:`1080p`,label:this.$t(`wan.name.resolution1080p`)}]},value:{get(){return this.$store.state.wan?.config?.resolution},set(e){this.$store.commit(`wan/setConfig`,{...this.$store.state.wan?.config,resolution:e})}}},mounted(){this.value||=Me}}),Pe={class:`field`},Fe={class:`title font-bold`},Ie={class:`float-left`};function Le(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(`wan.name.resolution`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`wan.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`,Ie,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Re=z(Ne,[[`render`,Le],[`__scopeId`,`data-v-3e39f44e`]]),ze=5,Be=_({name:`DurationSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return[{value:5,label:this.$t(`wan.name.duration5s`)},{value:10,label:this.$t(`wan.name.duration10s`)},{value:15,label:this.$t(`wan.name.duration15s`)}]},value:{get(){return this.$store.state.wan?.config?.duration},set(e){this.$store.commit(`wan/setConfig`,{...this.$store.state.wan?.config,duration:e})}}},mounted(){this.value||=ze}}),Ve={class:`field`},He={class:`title font-bold`},Ue={class:`float-left`};function We(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Ve,[e(`h2`,He,i(t.$t(`wan.name.duration`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`wan.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`,Ue,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ge=z(Be,[[`render`,We],[`__scopeId`,`data-v-5f35a2cf`]]),Ke=_({name:`ImageUrlInput`,components:{ElUpload:b,ElButton:J,InfoIcon:A,ImagePreview:ue},mixins:[ne,Y,ie,se],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.wan?.config?.image_url},set(){let e=this.urls?.[0];this.$store.commit(`wan/setConfig`,{...this.$store.state.wan?.config,image_url:e})}}},mounted(){this.value||=void 0,this.onSetImageUrl()},methods:{onExceed(){w.warning(this.$t(`wan.message.uploadImageExceed`))},onError(){w.error(this.$t(`wan.message.uploadImageError`))},async onRemove(){w.error(this.$t(`wan.message.uploadImageError`))},onSetImageUrl(){let e=this.urls?.[0];this.$store.commit(`wan/setConfig`,{...this.$store.state.wan?.config,image_url:e})},async onSuccess(){this.onSetImageUrl()}}}),qe={class:`relative`},Je={class:`flex justify-between`},Ye={class:`flex justify-start items-center`},Xe={class:`text-sm font-bold`};function Ze(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`el-button`),y=l(`el-upload`);return h(),s(`div`,qe,[e(`div`,Je,[e(`div`,Ye,[e(`span`,Xe,i(t.$t(`wan.name.imageUrl`)),1),a(g,{content:t.$t(`wan.description.imageUrl`),class:`info`},null,8,[`content`])])]),a(y,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,"show-file-list":!0,limit:1,multiple:!1,"list-type":`picture`,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-remove":t.onRemove,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(h(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(v,{size:`small`,type:`primary`,class:`btn btn-upload`,round:``},{default:p(()=>[r(i(t.$t(`wan.button.uploadImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])])}var Qe=z(Ke,[[`render`,Ze],[`__scopeId`,`data-v-56929914`]]),$e=_({name:`PromptInput`,components:{PromptTextarea:j},computed:{prompt:{get(){return this.$store.state.wan?.config?.prompt},set(e){this.$store.commit(`wan/setConfig`,{...this.$store.state.wan?.config,prompt:e})}}},mounted(){this.prompt||=``}});function et(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(`wan.name.prompt`),info:e.$t(`wan.description.prompt`),placeholder:e.$t(`wan.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var tt=z($e,[[`render`,et]]),nt=_({name:`WanMediaInput`,components:{ElInput:Z},computed:{value:{get(){return this.$store.state.wan?.config?.media_text||``},set(e){this.$store.commit(`wan/setConfig`,{...this.$store.state.wan?.config,media_text:e})}}}}),rt={class:`field`},it={class:`flex items-center mb-2`},at={class:`text-sm font-bold`},ot={class:`text-xs mt-1 text-[var(--el-text-color-secondary)]`};function st(t,n,r,o,c,u){let d=l(`el-input`);return h(),s(`div`,rt,[e(`div`,it,[e(`span`,at,i(t.$t(`wan.name.media`)),1)]),a(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,type:`textarea`,rows:5,placeholder:t.$t(`wan.placeholder.media`)},null,8,[`modelValue`,`placeholder`]),e(`p`,ot,i(t.$t(`wan.description.media`)),1)])}var ct=z(nt,[[`render`,st]]),lt=_({name:`Wan3Options`,components:{ElSelect:v,ElOption:y,ElInputNumber:D,ElCheckbox:T},data:()=>({ratios:[`adaptive`,`16:9`,`4:3`,`1:1`,`3:4`,`9:16`]}),computed:{ratio:{get(){return this.$store.state.wan?.config?.ratio||`adaptive`},set(e){this.set({ratio:e})}},duration:{get(){return this.$store.state.wan?.config?.duration??5},set(e){this.set({duration:e})}},audio:{get(){return this.$store.state.wan?.config?.audio!==!1},set(e){this.set({audio:e})}}},methods:{set(e){this.$store.commit(`wan/setConfig`,{...this.$store.state.wan?.config,...e})}}}),ut={class:`space-y-4`},dt={class:`field`},ft={class:`label`},pt={class:`field`},mt={class:`label`};function ht(t,n,o,u,d,g){let _=l(`el-option`),v=l(`el-select`),y=l(`el-input-number`),b=l(`el-checkbox`);return h(),s(`div`,ut,[e(`div`,dt,[e(`span`,ft,i(t.$t(`wan.name.ratio`)),1),a(v,{modelValue:t.ratio,"onUpdate:modelValue":n[0]||=e=>t.ratio=e},{default:p(()=>[(h(!0),s(c,null,m(t.ratios,e=>(h(),f(_,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),e(`div`,pt,[e(`span`,mt,i(t.$t(`wan.name.duration`)),1),a(y,{modelValue:t.duration,"onUpdate:modelValue":n[1]||=e=>t.duration=e,min:-1,max:30},null,8,[`modelValue`])]),a(b,{modelValue:t.audio,"onUpdate:modelValue":n[2]||=e=>t.audio=e},{default:p(()=>[r(i(t.$t(`wan.name.audio`)),1)]),_:1},8,[`modelValue`])])}var gt=_({name:`PresetPanel`,components:{MagicIcon:L,ElButton:J,PromptInput:tt,ImageUrlInput:Qe,ModelSelector:je,ResolutionSelector:Re,DurationSelector:Ge,MediaInput:ct,Wan3Options:z(lt,[[`render`,ht],[`__scopeId`,`data-v-49568593`]]),ServicePricingSummary:fe,ScenarioPaymentMode:me},emits:[`generate`],data(){return{quoteTimer:0,quoteRunId:0}},computed:{canGenerate(){return ye(`wan`,R(this.config))},config(){return this.$store.state.wan?.config},consumption(){return H(this.config,this.service?.cost)},service(){return this.$store.state.wan?.service},supportsResolution(){let e=this.config?.model;return e===`wan2.6-t2v`||e===`wan2.6-i2v`||e===`wan2.6-i2v-flash`||e===`wan3.0-video`},supportsDuration(){return this.config?.model===`wan2.6-t2v`},isWan3(){return this.config?.model===`wan3.0-video`},supportsImageUrl(){let e=this.config?.model;return e===`wan2.6-i2v`||e===`wan2.6-i2v-flash`},walletMode(){return B()&&G(`wan`).mode===`wallet`}},watch:{walletMode:{handler(e){e&&this.scheduleQuote()},immediate:!0},config:{handler(){this.walletMode&&this.scheduleQuote()},deep:!0}},beforeUnmount(){window.clearTimeout(this.quoteTimer),this.quoteRunId+=1},methods:{scheduleQuote(){window.clearTimeout(this.quoteTimer),this.quoteRunId+=1;let e=G(`wan`);e.quoteUsdc=void 0,e.quoteLoading=!1,this.canGenerate&&(this.quoteTimer=window.setTimeout(this.refreshQuote,350))},async refreshQuote(){if(!this.canGenerate)return;let e=G(`wan`),t=++this.quoteRunId;e.quoteLoading=!0,e.quoteUsdc=void 0;try{let n=await W.quote(R(this.config));t===this.quoteRunId&&e.mode===`wallet`&&this.canGenerate&&(e.quoteUsdc=n.amountUsdc)}catch(e){console.warn(`x402 quote failed`,e)}finally{t===this.quoteRunId&&(e.quoteLoading=!1)}},onGenerate(){this.$emit(`generate`)}}}),_t={class:`flex flex-col h-full`},vt={class:`flex-1 overflow-y-auto p-5`},yt={class:`flex flex-col items-center justify-center px-5 pb-5`};function bt(t,n,c,u,d,m){let g=l(`prompt-input`),_=l(`model-selector`),v=l(`resolution-selector`),y=l(`duration-selector`),b=l(`image-url-input`),x=l(`media-input`),S=l(`wan3-options`),C=l(`scenario-payment-mode`),w=l(`service-pricing-summary`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,_t,[e(`div`,vt,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),t.supportsResolution?(h(),f(v,{key:0,class:`mb-4`})):o(``,!0),t.supportsDuration?(h(),f(y,{key:1,class:`mb-4`})):o(``,!0),t.supportsImageUrl?(h(),f(b,{key:2,class:`mb-4`})):o(``,!0),t.isWan3?(h(),f(x,{key:3,class:`mb-4`})):o(``,!0),t.isWan3?(h(),f(S,{key:4,class:`mb-4`})):o(``,!0)]),e(`div`,yt,[a(C,{scenario:`wan`}),t.walletMode?o(``,!0):(h(),f(w,{key:0,value:t.consumption,service:t.service},null,8,[`value`,`service`])),a(E,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`wan.button.generate`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var xt=z(gt,[[`render`,bt]]),St=_({name:`TaskPreview`,components:{DeleteIcon:F,ChannelIcon:k,InfoIcon:ee,MagicIcon:L,TimeIcon:O,WarningIcon:I,CopyToClipboard:ce,ElAlert:S,VideoPlayer:pe,ElTooltip:x,ElButton:J,ApiCodeButton:he,ReportButton:le},props:{modelValue:{type:Object,required:!0}},computed:{isFailure(){let e=this.modelValue?.response;return e?.success===!1||!!e?.error||e?.state===`failed`||e?.state===`cancelled`},isWaiting(){let e=this.modelValue?.response;return e?this.isFailure?!1:[`queued`,`pending`,`processing`,`running`].includes(e.state||``)?!0:e.success!==!0&&!e.state:!0},application(){return this.$store.state.wan?.application},config(){return this.$store.state.wan?.config}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await K.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(`wan/deleteTask`,{id:e}),w.success(this.$t(`common.message.deleteTaskSuccess`))}catch{w.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e){console.debug(`on download wan video`,e),window.open(e,`_blank`)}}}),Ct={class:`preview`},wt={class:`left`},Tt={class:`main`},Et={class:`bot`},Dt={class:`datetime`},Ot=[`aria-label`],kt={class:`info`},At={key:0,class:`prompt mt-2`},jt={key:0},Mt={key:1},Nt={key:0,class:n({content:!0,failed:!0})},Pt={key:0,class:`mb-4`},Ft={key:1,class:n({operations:!0,"mt-2":!0})},It={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Lt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Rt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},zt={key:1,class:n({content:!0})},Bt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Vt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ht={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ut={key:2,class:n({content:!0})},Wt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Gt(n,c,u,d,f,m){let g=l(`capability-presentation`),_=l(`delete-icon`),v=l(`el-tooltip`),y=l(`video-player`),b=l(`el-button`),x=l(`api-code-button`),S=l(`report-button`),C=l(`channel-icon`),w=l(`copy-to-clipboard`),T=l(`magic-icon`),E=l(`time-icon`),D=l(`el-alert`),O=l(`warning-icon`),k=l(`info-icon`);return h(),s(`div`,Ct,[e(`div`,wt,[a(g,{capability:`wan`,part:`avatar`,class:`avatar`})]),e(`div`,Tt,[e(`div`,Et,[a(g,{capability:`wan`,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?(h(),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,Ot)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,kt,[n.modelValue?.request?.prompt?(h(),s(`p`,At,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,jt,` - (`+i(n.$t(`wan.status.pending`))+`) `,1)),n.modelValue?.response&&n.isWaiting?(h(),s(`span`,Mt,` - (`+i(n.$t(`wan.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0&&!n.isFailure&&!n.isWaiting?(h(),s(`div`,Nt,[n.modelValue?.response?.video_url?(h(),s(`div`,Pt,[a(y,{src:n.modelValue?.response?.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response?.video_url?(h(),s(`div`,Ft,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`wan.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(b,{type:`info`,size:`small`,class:`mb-2`,onClick:c[1]||=t(e=>n.onDownload(n.modelValue?.response?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`wan.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(x,{path:`/wan/videos`,body:n.modelValue?.request},null,8,[`body`]),a(S,{service:`wan`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(D,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,It,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`wan.name.model`))+`: `+i(n.modelValue?.request?.model)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])])):o(``,!0),e(`p`,Lt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`wan.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Rt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`wan.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.isFailure?(h(),s(`div`,zt,[a(D,{closable:!1,class:`failure`},{template:p(()=>[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`wan.name.failure`)),1)]),default:p(()=>[e(`p`,Bt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`wan.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,$,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`wan.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(w,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Vt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`wan.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,Ht,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`wan.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),n.isWaiting?(h(),s(`div`,Ut,[a(D,{closable:!1,class:`info`},{template:p(()=>[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`wan.status.processing`:`wan.status.pending`)),1)]),default:p(()=>[e(`p`,Wt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`wan.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var Kt=_({name:`RecentPanel`,components:{TaskPreview:z(St,[[`render`,Gt],[`__scopeId`,`data-v-f180e91e`]]),BotPlaceholder:ge,NoTasks:N,ScrollList:M},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.wan?.tasks,items:this.$store.state.wan?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),qt={key:0},Jt={key:2,class:`w-full h-full flex items-center justify-center`};function Yt(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`,qt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),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(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Jt,[a(v)])):o(``,!0)],64)}var Xt=_({name:`WanIndex`,components:{ConfigPanel:xt,Layout:Te,RecentPanel:z(Kt,[[`render`,Yt]])},mixins:[oe,_e(`wan`)],inject:[`initialized`],data(){return{task:void 0,job:0,timer:void 0,loadingMore:!1,fetchingTasks:!1,walletTaskIds:[]}},computed:{applicationsLoading(){return this.$store.state.wan?.status?.getApplications===C.Request},tasksLoading(){return this.$store.state.wan?.status?.getTasks===C.Request||this.fetchingTasks},credential(){return this.$store.state.wan.credential},config(){return this.$store.state.wan.config},application(){return this.$store.state.wan.application},tasks(){return this.$store.state.wan.tasks},walletMode(){return B()&&G(`wan`).mode===`wallet`}},watch:{walletMode:{async handler(e,t){if(!(t===void 0||e===t)){if(this.$store.commit(`wan/setTasks`,void 0),e&&!this.job&&(this.job=window.setInterval(this.onPollTasks,5e3)),!e&&!this.credential?.token){window.clearInterval(this.job),this.job=0,await this.onScrollDown();return}await this.onGetTasks(),await this.onScrollDown()}}},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.onPollTasks,5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await P({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(`wan/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`wan/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`wan/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r,...this.walletMode&&!this.credential?.token?{mode:`x402`,ids:this.walletTaskIds}:{}})}finally{this.fetchingTasks=!1}},async onGenerate(){let e=R(this.config),t=ve(`wan`,e);if(t){w.error(this.$t(`common.message.${t}`));return}if(!q(this.uploadTracker,e=>this.$t(e),e=>w.warning(e)))return;let n;if(this.walletMode){let t=this.getWalletContext();if(!t){w.warning(this.$t(`common.x402Scenario.connectWalletFirst`));return}n=W.generate(e,{mode:`x402`,x402:{wallet:t,confirm:e=>this.confirmWalletPayment(e),identityToken:this.credential?.token}})}else{if(!X())return;let t=this.credential?.token;if(!t)return;n=W.generate(e,{token:t})}w.info(this.$t(`wan.message.startingTask`)),ae(`wan`,n).then(e=>{let t=e?.data?.task_id;this.walletMode&&!this.credential?.token&&t&&!this.walletTaskIds.includes(t)&&this.walletTaskIds.unshift(t),w.success(this.$t(`wan.message.startTaskSuccess`))}).catch(e=>{e instanceof re||V(e,`wan`)||(this.walletMode?w.error(this.$t(`common.x402Scenario.paymentFailed`)):w.error(this.$t(`wan.message.startTaskFailed`)))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getWalletContext(){return Q(this.$wallet)},async confirmWalletPayment(e){return K.confirm(this.$t(`common.x402Scenario.confirmPayment`,{amount:e.amountUsdc}),this.$t(`order.message.x402ConfirmTitle`),{confirmButtonText:this.$t(`order.message.x402WalletPayCta`),cancelButtonText:this.$t(`common.button.cancel`),type:`warning`}).then(()=>!0).catch(()=>!1)},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Zt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Qt=z(Xt,[[`render`,Zt]]);export{Qt 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,b as u,ht as d,j as f,mt as p,ot as m,qt as ee,rt as h,st as g,tt as _,x as v,z as y}from"./vendor-chart-Dw-P17PN.js";import{n as b,t as x}from"./tabs-BpSLc2Is.js";import{t as S}from"./tooltip-L2G5ntVi.js";import{v as C}from"./vuex.esm-bundler-C-5WV-ta.js";import{n as w,r as T,t as E}from"./dropdown-iF_atr6i.js";import{t as D}from"./switch-CFUCWNgM.js";import{t as O}from"./book-open-BH4GaBn5.js";import{t as k}from"./chevron-down-vUO0pCAt.js";import{t as A}from"./chevron-right-CHPHpC1T.js";import{t as j}from"./circle-check-1eqJK_BD.js";import{t as M}from"./circle-question-mark-iFkJm6Cg.js";import{t as N}from"./clipboard-list-Cvngrayq.js";import{a as P,i as F,n as I,r as L,t as R}from"./WriteSkillDialog-Bw-u8hlH.js";import{t as z}from"./code-Bm4SQ3yq.js";import{t as B}from"./copy-CUk5HyqT.js";import{t as V}from"./ellipsis-BqkKsvF-.js";import{t as H}from"./eye-CFHeQVx8.js";import{t as U}from"./file-text-DBotrbYk.js";import{t as W}from"./file-CR75F95u.js";import{t as G}from"./folder-C9cnY4AN.js";import{t as K}from"./image-DNGAwErV.js";import{t as te}from"./plus-Bz8tjapX.js";import{t as q}from"./scroll-text-BTS-NpZu.js";import{t as ne}from"./search-K-yhv6oC.js";import{t as re}from"./trash-2-CUcSh2xz.js";import{t as ie}from"./triangle-alert-fl0O4ttl.js";import{t as ae}from"./upload-ClpzRFqM.js";import{t as oe}from"./wand-sparkles-C9xUdsPZ.js";import{D as J,Ha as se,Ra as ce,Ua as Y,Va as X,lo as le,to as ue}from"./index-Bk9SKIXV.js";import{a as de,c as fe,d as pe,f as me,i as he,l as ge,m as Z,n as Q,o as _e,p as ve,r as ye,s as be,t as xe,u as Se}from"./vendor-highlight-PMOaWWrP.js";import{t as Ce}from"./VueMarkdown-ktB0s_p4.js";import{t as we}from"./index.es-xc1wwztg.js";import{t as Te}from"./PageHeader-DOWQjC3H.js";var Ee=X(`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`}]]),De=X(`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`}]]);Z.registerLanguage(`bash`,ve),Z.registerLanguage(`css`,me),Z.registerLanguage(`go`,pe),Z.registerLanguage(`javascript`,Se),Z.registerLanguage(`json`,ge),Z.registerLanguage(`markdown`,fe),Z.registerLanguage(`python`,be),Z.registerLanguage(`rust`,_e),Z.registerLanguage(`shell`,de),Z.registerLanguage(`sql`,he),Z.registerLanguage(`typescript`,ye),Z.registerLanguage(`xml`,Q),Z.registerLanguage(`html`,Q),Z.registerLanguage(`yaml`,xe),Z.registerAliases([`yml`],{languageName:`yaml`}),Z.registerAliases([`ts`,`tsx`],{languageName:`typescript`}),Z.registerAliases([`js`,`jsx`],{languageName:`javascript`}),Z.registerAliases([`py`],{languageName:`python`}),Z.registerAliases([`rs`],{languageName:`rust`}),Z.registerAliases([`sh`,`zsh`],{languageName:`bash`});var $=1e6;function Oe(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 ke(e){let t=(e.split(`.`).pop()||``).toLowerCase();return Z.getLanguage(t)?t:`plain`}var Ae=y({name:`SkillFilePreview`,components:{ElButton:ue,ElTooltip:S,ElTabs:b,ElTabPane:x,CodeIcon:z,CopyIcon:B,FileIcon:W,SaveIcon:De,SuccessIcon:j,ViewIcon:H,WarningIcon:ie,VueMarkdown:Ce},directives:{loading:Y},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,copied:!1,copiedTimer:void 0}},computed:{kind(){return this.path?Oe(this.path,this.contentType):`text`},canRender(){return this.kind===`markdown`||this.kind===`html`},hljsLang(){return`language-${ke(this.path)}`},truncatedText(){return this.textContent}},watch:{path:{handler(){this.fetch()},immediate:!0}},beforeUnmount(){this.imageUrl&&URL.revokeObjectURL(this.imageUrl),this.copiedTimer!==void 0&&window.clearTimeout(this.copiedTimer)},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.copied=!1,this.copiedTimer!==void 0&&(window.clearTimeout(this.copiedTimer),this.copiedTimer=void 0),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 F.fetchFile(this.skillId,this.path);this.contentType=t,this.size=e.size;let n=Oe(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,Z.highlightElement(e))},async onCopy(){if(this.textContent)try{await navigator.clipboard.writeText(this.textContent),this.copied=!0,this.copiedTimer!==void 0&&window.clearTimeout(this.copiedTimer),this.copiedTimer=window.setTimeout(()=>{this.copied=!1,this.copiedTimer=void 0},3e3),C.success(this.$t(`skill.preview.copied`))}catch{C.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}}}}),je={class:`preview-root`},Me={class:`toolbar`},Ne={class:`path-display`},Pe={key:0,class:`size-display`},Fe={class:`body`},Ie={key:0,class:`error`},Le=[`srcdoc`],Re={key:3,class:`image-pane`},ze=[`src`,`alt`],Be={key:4,class:`binary`},Ve=[`placeholder`],He={key:6,class:`source-pane`},Ue={key:7,class:`truncated-warning`};function We(t,c,ee,h,g,v){let y=l(`save-icon`),b=l(`el-button`),x=l(`success-icon`),S=l(`copy-icon`),C=l(`el-tooltip`),w=l(`view-icon`),T=l(`el-tab-pane`),E=l(`code-icon`),D=l(`el-tabs`),O=l(`warning-icon`),k=l(`vue-markdown`),A=l(`file-icon`),j=m(`loading`);return d((_(),s(`div`,je,[e(`div`,Me,[e(`span`,Ne,i(t.path||`—`),1),t.size?(_(),s(`span`,Pe,i(t.humanSize(t.size)),1)):o(``,!0),c[3]||=e(`span`,{class:`toolbar-spacer`},null,-1),t.editable?(_(),f(b,{key:1,type:`primary`,size:`small`,disabled:!t.dirty||t.saving,loading:t.saving,onClick:t.onSave},{default:p(()=>[a(y,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`common.button.save`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])):o(``,!0),a(C,{visible:t.copied,content:t.copied?t.$t(`skill.preview.copied`):t.$t(`skill.preview.copy`),placement:`top-start`},{default:p(()=>[a(b,{size:`small`,circle:``,disabled:!t.textContent,"aria-label":t.copied?t.$t(`skill.preview.copied`):t.$t(`skill.preview.copy`),title:t.copied?t.$t(`skill.preview.copied`):t.$t(`skill.preview.copy`),onClick:t.onCopy},{default:p(()=>[t.copied?(_(),f(x,{key:0,size:16,"aria-hidden":`true`,focusable:`false`})):(_(),f(S,{key:1,size:16,"aria-hidden":`true`,focusable:`false`}))]),_:1},8,[`disabled`,`aria-label`,`title`,`onClick`])]),_:1},8,[`visible`,`content`])]),t.canRender?(_(),f(D,{key:0,modelValue:t.viewMode,"onUpdate:modelValue":c[0]||=e=>t.viewMode=e,class:`view-tabs`},{default:p(()=>[a(T,{name:`rendered`},{label:p(()=>[a(w,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewRendered`)),1)]),_:1}),a(T,{name:`source`},{label:p(()=>[a(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewSource`)),1)]),_:1})]),_:1},8,[`modelValue`])):o(``,!0),e(`div`,Fe,[t.error?(_(),s(`div`,Ie,[a(O,{class:`mr-2`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.error),1)])):t.kind===`markdown`&&t.viewMode===`rendered`?(_(),f(k,{key:1,class:`markdown-rendered`,source:t.textContent,sanitize:``},null,8,[`source`])):t.kind===`html`&&t.viewMode===`rendered`?(_(),s(`iframe`,{key:2,ref:`htmlFrame`,class:`html-frame`,sandbox:``,srcdoc:t.textContent},null,8,Le)):t.kind===`image`?(_(),s(`div`,Re,[e(`img`,{src:t.imageUrl,alt:t.path,class:`image-content`},null,8,ze)])):t.kind===`binary`?(_(),s(`div`,Be,[a(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?d((_(),s(`textarea`,{key:5,"onUpdate:modelValue":c[1]||=e=>t.textContent=e,class:`source-editor`,spellcheck:`false`,placeholder:t.$t(`skill.placeholder.content`),onInput:c[2]||=e=>t.dirty=!0},null,40,Ve)),[[u,t.textContent]]):(_(),s(`pre`,He,[e(`code`,{ref:`codeEl`,class:n(t.hljsLang)},i(t.truncatedText),3)])),t.truncated?(_(),s(`p`,Ue,i(t.$t(`skill.preview.truncated`,{size:t.humanSize(t.MAX_PREVIEW_BYTES)})),1)):o(``,!0)])])),[[j,t.loading]])}var Ge=J(Ae,[[`render`,We],[`__scopeId`,`data-v-872078d9`]]),Ke=new Set([`py`,`ts`,`tsx`,`js`,`jsx`,`json`,`yaml`,`yml`,`sh`,`bash`,`zsh`,`css`,`html`,`sql`,`go`,`rs`,`rb`,`java`,`cpp`,`c`,`h`,`toml`]),qe=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function Je(e){let t=e.split(`/`).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();return t===`SKILL.md`?O:n===`md`?U:qe.has(n)?K:Ke.has(n)?Ee:W}function Ye(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 Xe=y({name:`FileNode`,components:{ExpandDownIcon:k,ExpandRightIcon:A,FontAwesomeIcon:we},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?Je(e.path):G},onClick(){this.node.isLeaf?this.$emit(`select-file`,this.node.path):this.open=!this.open}}}),Ze=[`aria-label`,`title`],Qe={key:1,class:`node-chevron-spacer`},$e={class:`node-label`},et={key:0,class:`children`};function tt(r,a,u,d,p,m){let v=l(`expand-down-icon`),y=l(`expand-right-icon`),b=l(`font-awesome-icon`),x=l(`file-node`,!0);return _(),s(`li`,null,[e(`div`,{class:n([`file-node`,{active:r.isActive}]),style:ee({paddingLeft:r.indent+`px`}),onClick:a[1]||=(...e)=>r.onClick&&r.onClick(...e)},[r.node.isLeaf?(_(),s(`span`,Qe)):(_(),s(`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?(_(),f(v,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(_(),f(y,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,Ze)),r.isHtmlFile(r.node)?(_(),f(b,{key:2,icon:`fa-brands fa-html5`,class:`node-icon`})):(_(),f(g(r.iconFor(r.node)),{key:3,class:`node-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),e(`span`,$e,i(r.node.label),1)],6),!r.node.isLeaf&&r.open?(_(),s(`ul`,et,[(_(!0),s(c,null,h(r.node.children||[],e=>(_(),f(x,{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))])):o(``,!0)])}var nt=y({name:`SkillRow`,components:{ExpandDownIcon:k,ExpandRightIcon:A,SkillIcon:q,FileNode:J(Xe,[[`render`,tt],[`__scopeId`,`data-v-5240087b`]])},props:{skill:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},expanded:{type:Boolean,default:!1}},emits:[`toggle-expand`,`select-skill`,`select-file`],computed:{tree(){return Ye(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)}}}),rt={class:`skill-row-wrapper`},it=[`aria-label`,`title`],at={key:1,class:`row-chevron-spacer`},ot=[`title`],st={key:0,class:`file-list`};function ct(r,u,d,p,m,ee){let g=l(`expand-down-icon`),v=l(`expand-right-icon`),y=l(`skill-icon`),b=l(`file-node`);return _(),s(`li`,rt,[e(`div`,{class:n([`skill-row`,{active:r.isSkillSelected}]),onClick:u[1]||=e=>r.$emit(`select-skill`,r.skill)},[r.hasChildren?(_(),s(`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:u[0]||=t(e=>r.$emit(`toggle-expand`,r.skill),[`stop`])},[r.expanded?(_(),f(g,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(_(),f(v,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,it)):(_(),s(`span`,at)),a(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,ot)],2),r.expanded&&r.hasChildren?(_(),s(`ul`,st,[(_(!0),s(c,null,h(r.tree,e=>(_(),f(b,{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))])):o(``,!0)])}var lt=y({name:`UserSkills`,components:{MetaTag:ce,ConsolePageHeader:Te,ElInput:le,ElSwitch:D,ElTooltip:S,ElDropdown:E,ElDropdownMenu:T,ElDropdownItem:w,AddIcon:te,AiCreateIcon:oe,DeleteIcon:re,ExpandDownIcon:k,ExpandRightIcon:A,HelpIcon:M,MarketplaceIcon:P,MoreIcon:V,SearchIcon:ne,SkillIcon:q,UploadIcon:ae,WriteIcon:N,SkillMarketplace:L,SkillFilePreview:Ge,SkillRow:J(nt,[[`render`,ct],[`__scopeId`,`data-v-231c2ce1`]]),UploadSkillDialog:I,WriteSkillDialog:R},directives:{loading:Y},data(){return{activeTab:`marketplace`,loading:!1,skills:[],togglingId:null,selectedSkillId:``,selectedPath:``,expandedSkillIds:[],personalOpen:!0,globalsOpen:!0,searchQuery:``,uploadVisible:!1,writeVisible:!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 F.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),C.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)},openUpload(){this.uploadVisible=!0},openWrite(){this.writeVisible=!0},onBrowse(){this.activeTab=`marketplace`},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 F.update(this.selectedSkill.id,{content:e});C.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){C.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)})),t.reject(e)}},async onDelete(e){try{await se.confirm(this.$t(`skill.message.deleteConfirm`,{slug:e.slug}),this.$t(`common.button.delete`),{type:`warning`})}catch{return}try{await F.remove(e.id),C.success(this.$t(`skill.message.deleteSuccess`)),this.selectedSkillId===e.id&&(this.selectedSkillId=``,this.selectedPath=``),await this.fetchSkills()}catch(e){C.error(this.extractError(e))}},async onToggleSkill(e,t){this.togglingId=e.id;try{t?(await F.enable(e.id),C.success(this.$t(`skill.message.enableSuccess`))):(await F.disable(e.id),C.success(this.$t(`skill.message.disableSuccess`))),e.enabled=t}catch(e){C.error(this.extractError(e))}finally{this.togglingId=null}}}}),ut={class:`skills-page`},dt=[`aria-label`],ft=[`aria-selected`],pt=[`aria-selected`],mt={class:`marketplace-page-content`},ht={class:`skills-shell`},gt={class:`left-pane`},_t={class:`left-header`},vt=[`aria-label`,`title`],yt={class:`submenu-trigger`},bt={class:`left-body`},xt={class:`section`},St={key:0,class:`skill-list`},Ct={key:0,class:`empty-row`},wt={key:0,class:`section`},Tt={key:0,class:`skill-list`},Et={class:`right-pane`},Dt={class:`right-header`},Ot={class:`right-title`},kt={class:`right-actions`},At=[`aria-label`,`title`],jt={class:`meta-card`},Mt={class:`meta-grid`},Nt={class:`meta-cell`},Pt={class:`meta-label`},Ft={class:`meta-value`},It={class:`meta-cell`},Lt={class:`meta-label`},Rt={class:`meta-value`},zt={key:0,class:`meta-cell`},Bt={class:`meta-label`},Vt={class:`meta-tags`},Ht={key:0,class:`meta-description`},Ut={class:`meta-description-label`},Wt={class:`meta-label`},Gt={class:`preview-card`},Kt={key:2,class:`right-empty`};function qt(t,u,ee,g,y,b){let x=l(`console-page-header`),S=l(`marketplace-icon`),C=l(`skill-icon`),w=l(`skill-marketplace`),T=l(`search-icon`),E=l(`el-input`),D=l(`add-icon`),O=l(`el-dropdown-item`),k=l(`expand-right-icon`),A=l(`ai-create-icon`),j=l(`meta-tag`),M=l(`write-icon`),N=l(`upload-icon`),P=l(`el-dropdown-menu`),F=l(`el-dropdown`),I=l(`expand-down-icon`),L=l(`skill-row`),R=l(`el-switch`),z=l(`more-icon`),B=l(`delete-icon`),V=l(`help-icon`),H=l(`el-tooltip`),U=l(`skill-file-preview`),W=l(`upload-skill-dialog`),G=l(`write-skill-dialog`),K=m(`loading`);return _(),s(`div`,ut,[a(x,{title:t.$t(`skill.title.skills`),subtitle:t.$t(`skill.message.pageDescription`)},null,8,[`title`,`subtitle`]),e(`div`,{class:`skills-tabs`,role:`tablist`,"aria-label":t.$t(`skill.title.skills`)},[e(`button`,{role:`tab`,"aria-selected":t.activeTab===`marketplace`,class:n({active:t.activeTab===`marketplace`}),onClick:u[0]||=e=>t.activeTab=`marketplace`},[a(S,{size:16,"aria-hidden":`true`}),r(i(t.$t(`skill.marketplace.title`)),1)],10,ft),e(`button`,{role:`tab`,"aria-selected":t.activeTab===`mine`,class:n({active:t.activeTab===`mine`}),onClick:u[1]||=e=>t.activeTab=`mine`},[a(C,{size:16,"aria-hidden":`true`}),r(i(t.$t(`skill.marketplace.mySkills`)),1),e(`span`,null,i(t.personalSkills.length),1)],10,pt)],8,dt),d(e(`div`,mt,[a(w,{onInstalled:t.onCreated},null,8,[`onInstalled`])],512),[[v,t.activeTab===`marketplace`]]),d(e(`div`,ht,[e(`aside`,gt,[e(`header`,_t,[a(E,{modelValue:t.searchQuery,"onUpdate:modelValue":u[2]||=e=>t.searchQuery=e,class:`search-input`,size:`default`,clearable:``,placeholder:t.$t(`skill.placeholder.search`)},{prefix:p(()=>[a(T,{size:14,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`]),a(F,{trigger:`click`,placement:`bottom-end`,"hide-on-click":!1},{dropdown:p(()=>[a(P,{class:`add-menu`},{default:p(()=>[a(O,{onClick:t.onBrowse},{default:p(()=>[a(S,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.browse`)),1)]),_:1},8,[`onClick`]),a(O,{divided:``},{default:p(()=>[a(F,{trigger:`hover`,placement:`left-start`,"hide-on-click":!0},{dropdown:p(()=>[a(P,{class:`add-menu`},{default:p(()=>[a(O,{disabled:``},{default:p(()=>[a(A,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.createWithClaude`))+` `,1),a(j,{class:`badge-soon`,density:`compact`},{default:p(()=>[r(i(t.$t(`skill.menu.soon`)),1)]),_:1})]),_:1}),a(O,{onClick:t.openWrite},{default:p(()=>[a(M,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.write`)),1)]),_:1},8,[`onClick`]),a(O,{onClick:t.openUpload},{default:p(()=>[a(N,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.upload`)),1)]),_:1},8,[`onClick`])]),_:1})]),default:p(()=>[e(`span`,yt,[a(D,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.create`))+` `,1),a(k,{class:`submenu-arrow`,size:14,"aria-hidden":`true`,focusable:`false`})])]),_:1})]),_:1})]),_:1})]),default:p(()=>[e(`button`,{type:`button`,class:`add-button`,"aria-label":t.$t(`skill.button.add`),title:t.$t(`skill.button.add`)},[a(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,vt)]),_:1})]),d((_(),s(`div`,bt,[e(`section`,xt,[e(`button`,{class:`section-header`,onClick:u[3]||=e=>t.personalOpen=!t.personalOpen},[t.personalOpen?(_(),f(I,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(_(),f(k,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.personal`)),1)]),t.personalOpen?(_(),s(`ul`,St,[!t.loading&&t.filteredPersonal.length===0?(_(),s(`li`,Ct,i(t.searchQuery?t.$t(`skill.empty.search`):t.$t(`skill.message.noSkills`)),1)):o(``,!0),(_(!0),s(c,null,h(t.filteredPersonal,e=>(_(),f(L,{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))])):o(``,!0)]),t.globalSkills.length>0?(_(),s(`section`,wt,[e(`button`,{class:`section-header`,onClick:u[4]||=e=>t.globalsOpen=!t.globalsOpen},[t.globalsOpen?(_(),f(I,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(_(),f(k,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.platform`)),1)]),t.globalsOpen?(_(),s(`ul`,Tt,[(_(!0),s(c,null,h(t.filteredGlobal,e=>(_(),f(L,{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))])):o(``,!0)])):o(``,!0)])),[[K,t.loading]])]),e(`main`,Et,[t.selectedSkill&&!t.selectedPath?(_(),s(c,{key:0},[e(`header`,Dt,[e(`h3`,Ot,i(t.selectedSkill.slug),1),e(`div`,kt,[a(R,{"model-value":t.selectedSkill.enabled,size:`default`,loading:t.togglingId===t.selectedSkill.id,onChange:u[5]||=e=>t.onToggleSkill(t.selectedSkill,!!e)},null,8,[`model-value`,`loading`]),t.selectedSkill.source===`global`?o(``,!0):(_(),f(F,{key:0,trigger:`click`,placement:`bottom-end`},{dropdown:p(()=>[a(P,null,{default:p(()=>[a(O,{onClick:u[6]||=e=>t.onDelete(t.selectedSkill)},{default:p(()=>[a(B,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`common.button.delete`)),1)]),_:1})]),_:1})]),default:p(()=>[e(`button`,{class:`icon-btn`,"aria-label":t.$t(`skill.button.more`),title:t.$t(`skill.button.more`)},[a(z,{size:16,"aria-hidden":`true`,focusable:`false`})],8,At)]),_:1}))])]),e(`div`,jt,[e(`div`,Mt,[e(`div`,Nt,[e(`span`,Pt,i(t.$t(`skill.meta.addedBy`)),1),e(`span`,Ft,i(t.selectedSkill.source===`global`?t.$t(`skill.meta.platform`):t.$t(`skill.meta.you`)),1)]),e(`div`,It,[e(`span`,Lt,i(t.$t(`skill.meta.lastUpdated`)),1),e(`span`,Rt,i(t.$dayjs.format(t.selectedSkill.updated_at)),1)]),t.selectedSkill.required_connections.length?(_(),s(`div`,zt,[e(`span`,Bt,i(t.$t(`skill.field.requiredConnections`)),1),e(`div`,Vt,[(_(!0),s(c,null,h(t.selectedSkill.required_connections,e=>(_(),f(j,{key:e,tone:`info`,density:`compact`},{default:p(()=>[r(i(e),1)]),_:2},1024))),128))])])):o(``,!0)]),t.selectedSkill.description?(_(),s(`div`,Ht,[e(`div`,Ut,[e(`span`,Wt,i(t.$t(`skill.field.description`)),1),t.selectedSkill.when_to_use?(_(),f(H,{key:0,content:t.selectedSkill.when_to_use,placement:`top`},{default:p(()=>[a(V,{class:`meta-info-icon`,size:12,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`content`])):o(``,!0)]),e(`p`,null,i(t.selectedSkill.description),1)])):o(``,!0)]),e(`div`,Gt,[(_(),f(U,{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?(_(),f(U,{key:`${t.selectedSkill.id}:${t.selectedPath}`,"skill-id":t.selectedSkill.id,path:t.selectedPath,editable:!1},null,8,[`skill-id`,`path`])):(_(),s(`div`,Kt,[a(C,{class:`right-empty-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.selectSkill`)),1)]))])],512),[[v,t.activeTab===`mine`]]),a(W,{modelValue:t.uploadVisible,"onUpdate:modelValue":u[7]||=e=>t.uploadVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),a(G,{modelValue:t.writeVisible,"onUpdate:modelValue":u[8]||=e=>t.writeVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`])])}var Jt=J(lt,[[`render`,qt],[`__scopeId`,`data-v-ead29004`]]);export{Jt 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,b as u,ht as d,j as f,mt as p,ot as m,qt as ee,rt as h,st as g,tt as _,x as v,z as y}from"./vendor-chart-Dw-P17PN.js";import{n as b,t as x}from"./tabs-BpSLc2Is.js";import{t as S}from"./tooltip-Co_mOTlo.js";import{v as C}from"./vuex.esm-bundler-C-5WV-ta.js";import{n as w,r as T,t as E}from"./dropdown-CuUYnMXP.js";import{t as D}from"./switch-DfKiiyLD.js";import{t as O}from"./book-open-pud407AJ.js";import{t as k}from"./chevron-down-BI4tJ27m.js";import{t as A}from"./chevron-right-CHuS6TXO.js";import{t as j}from"./circle-check-D_FoW3dP.js";import{t as M}from"./circle-question-mark-BGXCIlnz.js";import{t as N}from"./clipboard-list-BxI8Nmie.js";import{a as P,i as F,n as I,r as L,t as R}from"./WriteSkillDialog-_mcGlQJv.js";import{t as z}from"./code-NL9LxNiy.js";import{t as B}from"./copy-D7lHzTGA.js";import{t as V}from"./ellipsis-BlYmih11.js";import{t as H}from"./eye-BFgFlWNS.js";import{t as U}from"./file-text-DcI2reu5.js";import{t as W}from"./file-DmSI4aV7.js";import{t as G}from"./folder-uXRfk1mZ.js";import{t as K}from"./image-CS6hThMg.js";import{t as te}from"./plus-8qHkLr4t.js";import{t as q}from"./scroll-text-o74NoTP2.js";import{t as ne}from"./search-Bh1-kl2_.js";import{t as re}from"./trash-2-2Il_x-4b.js";import{t as ie}from"./triangle-alert-Dc39dkq0.js";import{t as ae}from"./upload-RXQqkOuq.js";import{t as oe}from"./wand-sparkles-CdzPtG8R.js";import{D as J,Ga as se,Ja as Y,Xa as X,Ya as ce,co as le,go as ue}from"./index-C8uXmX2U.js";import{a as de,c as fe,d as pe,f as me,i as he,l as ge,m as Z,n as Q,o as _e,p as ve,r as ye,s as be,t as xe,u as Se}from"./vendor-highlight-PMOaWWrP.js";import{t as Ce}from"./VueMarkdown-Cm2HOlvG.js";import{t as we}from"./index.es-5Phodjqa.js";import{t as Te}from"./PageHeader-Cer1mYPv.js";var Ee=Y(`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`}]]),De=Y(`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`}]]);Z.registerLanguage(`bash`,ve),Z.registerLanguage(`css`,me),Z.registerLanguage(`go`,pe),Z.registerLanguage(`javascript`,Se),Z.registerLanguage(`json`,ge),Z.registerLanguage(`markdown`,fe),Z.registerLanguage(`python`,be),Z.registerLanguage(`rust`,_e),Z.registerLanguage(`shell`,de),Z.registerLanguage(`sql`,he),Z.registerLanguage(`typescript`,ye),Z.registerLanguage(`xml`,Q),Z.registerLanguage(`html`,Q),Z.registerLanguage(`yaml`,xe),Z.registerAliases([`yml`],{languageName:`yaml`}),Z.registerAliases([`ts`,`tsx`],{languageName:`typescript`}),Z.registerAliases([`js`,`jsx`],{languageName:`javascript`}),Z.registerAliases([`py`],{languageName:`python`}),Z.registerAliases([`rs`],{languageName:`rust`}),Z.registerAliases([`sh`,`zsh`],{languageName:`bash`});var $=1e6;function Oe(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 ke(e){let t=(e.split(`.`).pop()||``).toLowerCase();return Z.getLanguage(t)?t:`plain`}var Ae=y({name:`SkillFilePreview`,components:{ElButton:le,ElTooltip:S,ElTabs:b,ElTabPane:x,CodeIcon:z,CopyIcon:B,FileIcon:W,SaveIcon:De,SuccessIcon:j,ViewIcon:H,WarningIcon:ie,VueMarkdown:Ce},directives:{loading:X},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,copied:!1,copiedTimer:void 0}},computed:{kind(){return this.path?Oe(this.path,this.contentType):`text`},canRender(){return this.kind===`markdown`||this.kind===`html`},hljsLang(){return`language-${ke(this.path)}`},truncatedText(){return this.textContent}},watch:{path:{handler(){this.fetch()},immediate:!0}},beforeUnmount(){this.imageUrl&&URL.revokeObjectURL(this.imageUrl),this.copiedTimer!==void 0&&window.clearTimeout(this.copiedTimer)},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.copied=!1,this.copiedTimer!==void 0&&(window.clearTimeout(this.copiedTimer),this.copiedTimer=void 0),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 F.fetchFile(this.skillId,this.path);this.contentType=t,this.size=e.size;let n=Oe(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,Z.highlightElement(e))},async onCopy(){if(this.textContent)try{await navigator.clipboard.writeText(this.textContent),this.copied=!0,this.copiedTimer!==void 0&&window.clearTimeout(this.copiedTimer),this.copiedTimer=window.setTimeout(()=>{this.copied=!1,this.copiedTimer=void 0},3e3),C.success(this.$t(`skill.preview.copied`))}catch{C.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}}}}),je={class:`preview-root`},Me={class:`toolbar`},Ne={class:`path-display`},Pe={key:0,class:`size-display`},Fe={class:`body`},Ie={key:0,class:`error`},Le=[`srcdoc`],Re={key:3,class:`image-pane`},ze=[`src`,`alt`],Be={key:4,class:`binary`},Ve=[`placeholder`],He={key:6,class:`source-pane`},Ue={key:7,class:`truncated-warning`};function We(t,c,ee,h,g,v){let y=l(`save-icon`),b=l(`el-button`),x=l(`success-icon`),S=l(`copy-icon`),C=l(`el-tooltip`),w=l(`view-icon`),T=l(`el-tab-pane`),E=l(`code-icon`),D=l(`el-tabs`),O=l(`warning-icon`),k=l(`vue-markdown`),A=l(`file-icon`),j=m(`loading`);return d((_(),s(`div`,je,[e(`div`,Me,[e(`span`,Ne,i(t.path||`—`),1),t.size?(_(),s(`span`,Pe,i(t.humanSize(t.size)),1)):o(``,!0),c[3]||=e(`span`,{class:`toolbar-spacer`},null,-1),t.editable?(_(),f(b,{key:1,type:`primary`,size:`small`,disabled:!t.dirty||t.saving,loading:t.saving,onClick:t.onSave},{default:p(()=>[a(y,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`common.button.save`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])):o(``,!0),a(C,{visible:t.copied,content:t.copied?t.$t(`skill.preview.copied`):t.$t(`skill.preview.copy`),placement:`top-start`},{default:p(()=>[a(b,{size:`small`,circle:``,disabled:!t.textContent,"aria-label":t.copied?t.$t(`skill.preview.copied`):t.$t(`skill.preview.copy`),title:t.copied?t.$t(`skill.preview.copied`):t.$t(`skill.preview.copy`),onClick:t.onCopy},{default:p(()=>[t.copied?(_(),f(x,{key:0,size:16,"aria-hidden":`true`,focusable:`false`})):(_(),f(S,{key:1,size:16,"aria-hidden":`true`,focusable:`false`}))]),_:1},8,[`disabled`,`aria-label`,`title`,`onClick`])]),_:1},8,[`visible`,`content`])]),t.canRender?(_(),f(D,{key:0,modelValue:t.viewMode,"onUpdate:modelValue":c[0]||=e=>t.viewMode=e,class:`view-tabs`},{default:p(()=>[a(T,{name:`rendered`},{label:p(()=>[a(w,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewRendered`)),1)]),_:1}),a(T,{name:`source`},{label:p(()=>[a(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewSource`)),1)]),_:1})]),_:1},8,[`modelValue`])):o(``,!0),e(`div`,Fe,[t.error?(_(),s(`div`,Ie,[a(O,{class:`mr-2`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.error),1)])):t.kind===`markdown`&&t.viewMode===`rendered`?(_(),f(k,{key:1,class:`markdown-rendered`,source:t.textContent,sanitize:``},null,8,[`source`])):t.kind===`html`&&t.viewMode===`rendered`?(_(),s(`iframe`,{key:2,ref:`htmlFrame`,class:`html-frame`,sandbox:``,srcdoc:t.textContent},null,8,Le)):t.kind===`image`?(_(),s(`div`,Re,[e(`img`,{src:t.imageUrl,alt:t.path,class:`image-content`},null,8,ze)])):t.kind===`binary`?(_(),s(`div`,Be,[a(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?d((_(),s(`textarea`,{key:5,"onUpdate:modelValue":c[1]||=e=>t.textContent=e,class:`source-editor`,spellcheck:`false`,placeholder:t.$t(`skill.placeholder.content`),onInput:c[2]||=e=>t.dirty=!0},null,40,Ve)),[[u,t.textContent]]):(_(),s(`pre`,He,[e(`code`,{ref:`codeEl`,class:n(t.hljsLang)},i(t.truncatedText),3)])),t.truncated?(_(),s(`p`,Ue,i(t.$t(`skill.preview.truncated`,{size:t.humanSize(t.MAX_PREVIEW_BYTES)})),1)):o(``,!0)])])),[[j,t.loading]])}var Ge=J(Ae,[[`render`,We],[`__scopeId`,`data-v-872078d9`]]),Ke=new Set([`py`,`ts`,`tsx`,`js`,`jsx`,`json`,`yaml`,`yml`,`sh`,`bash`,`zsh`,`css`,`html`,`sql`,`go`,`rs`,`rb`,`java`,`cpp`,`c`,`h`,`toml`]),qe=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function Je(e){let t=e.split(`/`).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();return t===`SKILL.md`?O:n===`md`?U:qe.has(n)?K:Ke.has(n)?Ee:W}function Ye(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 Xe=y({name:`FileNode`,components:{ExpandDownIcon:k,ExpandRightIcon:A,FontAwesomeIcon:we},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?Je(e.path):G},onClick(){this.node.isLeaf?this.$emit(`select-file`,this.node.path):this.open=!this.open}}}),Ze=[`aria-label`,`title`],Qe={key:1,class:`node-chevron-spacer`},$e={class:`node-label`},et={key:0,class:`children`};function tt(r,a,u,d,p,m){let v=l(`expand-down-icon`),y=l(`expand-right-icon`),b=l(`font-awesome-icon`),x=l(`file-node`,!0);return _(),s(`li`,null,[e(`div`,{class:n([`file-node`,{active:r.isActive}]),style:ee({paddingLeft:r.indent+`px`}),onClick:a[1]||=(...e)=>r.onClick&&r.onClick(...e)},[r.node.isLeaf?(_(),s(`span`,Qe)):(_(),s(`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?(_(),f(v,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(_(),f(y,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,Ze)),r.isHtmlFile(r.node)?(_(),f(b,{key:2,icon:`fa-brands fa-html5`,class:`node-icon`})):(_(),f(g(r.iconFor(r.node)),{key:3,class:`node-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),e(`span`,$e,i(r.node.label),1)],6),!r.node.isLeaf&&r.open?(_(),s(`ul`,et,[(_(!0),s(c,null,h(r.node.children||[],e=>(_(),f(x,{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))])):o(``,!0)])}var nt=y({name:`SkillRow`,components:{ExpandDownIcon:k,ExpandRightIcon:A,SkillIcon:q,FileNode:J(Xe,[[`render`,tt],[`__scopeId`,`data-v-5240087b`]])},props:{skill:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},expanded:{type:Boolean,default:!1}},emits:[`toggle-expand`,`select-skill`,`select-file`],computed:{tree(){return Ye(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)}}}),rt={class:`skill-row-wrapper`},it=[`aria-label`,`title`],at={key:1,class:`row-chevron-spacer`},ot=[`title`],st={key:0,class:`file-list`};function ct(r,u,d,p,m,ee){let g=l(`expand-down-icon`),v=l(`expand-right-icon`),y=l(`skill-icon`),b=l(`file-node`);return _(),s(`li`,rt,[e(`div`,{class:n([`skill-row`,{active:r.isSkillSelected}]),onClick:u[1]||=e=>r.$emit(`select-skill`,r.skill)},[r.hasChildren?(_(),s(`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:u[0]||=t(e=>r.$emit(`toggle-expand`,r.skill),[`stop`])},[r.expanded?(_(),f(g,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(_(),f(v,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,it)):(_(),s(`span`,at)),a(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,ot)],2),r.expanded&&r.hasChildren?(_(),s(`ul`,st,[(_(!0),s(c,null,h(r.tree,e=>(_(),f(b,{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))])):o(``,!0)])}var lt=y({name:`UserSkills`,components:{MetaTag:se,ConsolePageHeader:Te,ElInput:ue,ElSwitch:D,ElTooltip:S,ElDropdown:E,ElDropdownMenu:T,ElDropdownItem:w,AddIcon:te,AiCreateIcon:oe,DeleteIcon:re,ExpandDownIcon:k,ExpandRightIcon:A,HelpIcon:M,MarketplaceIcon:P,MoreIcon:V,SearchIcon:ne,SkillIcon:q,UploadIcon:ae,WriteIcon:N,SkillMarketplace:L,SkillFilePreview:Ge,SkillRow:J(nt,[[`render`,ct],[`__scopeId`,`data-v-231c2ce1`]]),UploadSkillDialog:I,WriteSkillDialog:R},directives:{loading:X},data(){return{activeTab:`marketplace`,loading:!1,skills:[],togglingId:null,selectedSkillId:``,selectedPath:``,expandedSkillIds:[],personalOpen:!0,globalsOpen:!0,searchQuery:``,uploadVisible:!1,writeVisible:!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 F.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),C.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)},openUpload(){this.uploadVisible=!0},openWrite(){this.writeVisible=!0},onBrowse(){this.activeTab=`marketplace`},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 F.update(this.selectedSkill.id,{content:e});C.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){C.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)})),t.reject(e)}},async onDelete(e){try{await ce.confirm(this.$t(`skill.message.deleteConfirm`,{slug:e.slug}),this.$t(`common.button.delete`),{type:`warning`})}catch{return}try{await F.remove(e.id),C.success(this.$t(`skill.message.deleteSuccess`)),this.selectedSkillId===e.id&&(this.selectedSkillId=``,this.selectedPath=``),await this.fetchSkills()}catch(e){C.error(this.extractError(e))}},async onToggleSkill(e,t){this.togglingId=e.id;try{t?(await F.enable(e.id),C.success(this.$t(`skill.message.enableSuccess`))):(await F.disable(e.id),C.success(this.$t(`skill.message.disableSuccess`))),e.enabled=t}catch(e){C.error(this.extractError(e))}finally{this.togglingId=null}}}}),ut={class:`skills-page`},dt=[`aria-label`],ft=[`aria-selected`],pt=[`aria-selected`],mt={class:`marketplace-page-content`},ht={class:`skills-shell`},gt={class:`left-pane`},_t={class:`left-header`},vt=[`aria-label`,`title`],yt={class:`submenu-trigger`},bt={class:`left-body`},xt={class:`section`},St={key:0,class:`skill-list`},Ct={key:0,class:`empty-row`},wt={key:0,class:`section`},Tt={key:0,class:`skill-list`},Et={class:`right-pane`},Dt={class:`right-header`},Ot={class:`right-title`},kt={class:`right-actions`},At=[`aria-label`,`title`],jt={class:`meta-card`},Mt={class:`meta-grid`},Nt={class:`meta-cell`},Pt={class:`meta-label`},Ft={class:`meta-value`},It={class:`meta-cell`},Lt={class:`meta-label`},Rt={class:`meta-value`},zt={key:0,class:`meta-cell`},Bt={class:`meta-label`},Vt={class:`meta-tags`},Ht={key:0,class:`meta-description`},Ut={class:`meta-description-label`},Wt={class:`meta-label`},Gt={class:`preview-card`},Kt={key:2,class:`right-empty`};function qt(t,u,ee,g,y,b){let x=l(`console-page-header`),S=l(`marketplace-icon`),C=l(`skill-icon`),w=l(`skill-marketplace`),T=l(`search-icon`),E=l(`el-input`),D=l(`add-icon`),O=l(`el-dropdown-item`),k=l(`expand-right-icon`),A=l(`ai-create-icon`),j=l(`meta-tag`),M=l(`write-icon`),N=l(`upload-icon`),P=l(`el-dropdown-menu`),F=l(`el-dropdown`),I=l(`expand-down-icon`),L=l(`skill-row`),R=l(`el-switch`),z=l(`more-icon`),B=l(`delete-icon`),V=l(`help-icon`),H=l(`el-tooltip`),U=l(`skill-file-preview`),W=l(`upload-skill-dialog`),G=l(`write-skill-dialog`),K=m(`loading`);return _(),s(`div`,ut,[a(x,{title:t.$t(`skill.title.skills`),subtitle:t.$t(`skill.message.pageDescription`)},null,8,[`title`,`subtitle`]),e(`div`,{class:`skills-tabs`,role:`tablist`,"aria-label":t.$t(`skill.title.skills`)},[e(`button`,{role:`tab`,"aria-selected":t.activeTab===`marketplace`,class:n({active:t.activeTab===`marketplace`}),onClick:u[0]||=e=>t.activeTab=`marketplace`},[a(S,{size:16,"aria-hidden":`true`}),r(i(t.$t(`skill.marketplace.title`)),1)],10,ft),e(`button`,{role:`tab`,"aria-selected":t.activeTab===`mine`,class:n({active:t.activeTab===`mine`}),onClick:u[1]||=e=>t.activeTab=`mine`},[a(C,{size:16,"aria-hidden":`true`}),r(i(t.$t(`skill.marketplace.mySkills`)),1),e(`span`,null,i(t.personalSkills.length),1)],10,pt)],8,dt),d(e(`div`,mt,[a(w,{onInstalled:t.onCreated},null,8,[`onInstalled`])],512),[[v,t.activeTab===`marketplace`]]),d(e(`div`,ht,[e(`aside`,gt,[e(`header`,_t,[a(E,{modelValue:t.searchQuery,"onUpdate:modelValue":u[2]||=e=>t.searchQuery=e,class:`search-input`,size:`default`,clearable:``,placeholder:t.$t(`skill.placeholder.search`)},{prefix:p(()=>[a(T,{size:14,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`]),a(F,{trigger:`click`,placement:`bottom-end`,"hide-on-click":!1},{dropdown:p(()=>[a(P,{class:`add-menu`},{default:p(()=>[a(O,{onClick:t.onBrowse},{default:p(()=>[a(S,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.browse`)),1)]),_:1},8,[`onClick`]),a(O,{divided:``},{default:p(()=>[a(F,{trigger:`hover`,placement:`left-start`,"hide-on-click":!0},{dropdown:p(()=>[a(P,{class:`add-menu`},{default:p(()=>[a(O,{disabled:``},{default:p(()=>[a(A,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.createWithClaude`))+` `,1),a(j,{class:`badge-soon`,density:`compact`},{default:p(()=>[r(i(t.$t(`skill.menu.soon`)),1)]),_:1})]),_:1}),a(O,{onClick:t.openWrite},{default:p(()=>[a(M,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.write`)),1)]),_:1},8,[`onClick`]),a(O,{onClick:t.openUpload},{default:p(()=>[a(N,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.upload`)),1)]),_:1},8,[`onClick`])]),_:1})]),default:p(()=>[e(`span`,yt,[a(D,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.create`))+` `,1),a(k,{class:`submenu-arrow`,size:14,"aria-hidden":`true`,focusable:`false`})])]),_:1})]),_:1})]),_:1})]),default:p(()=>[e(`button`,{type:`button`,class:`add-button`,"aria-label":t.$t(`skill.button.add`),title:t.$t(`skill.button.add`)},[a(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,vt)]),_:1})]),d((_(),s(`div`,bt,[e(`section`,xt,[e(`button`,{class:`section-header`,onClick:u[3]||=e=>t.personalOpen=!t.personalOpen},[t.personalOpen?(_(),f(I,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(_(),f(k,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.personal`)),1)]),t.personalOpen?(_(),s(`ul`,St,[!t.loading&&t.filteredPersonal.length===0?(_(),s(`li`,Ct,i(t.searchQuery?t.$t(`skill.empty.search`):t.$t(`skill.message.noSkills`)),1)):o(``,!0),(_(!0),s(c,null,h(t.filteredPersonal,e=>(_(),f(L,{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))])):o(``,!0)]),t.globalSkills.length>0?(_(),s(`section`,wt,[e(`button`,{class:`section-header`,onClick:u[4]||=e=>t.globalsOpen=!t.globalsOpen},[t.globalsOpen?(_(),f(I,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(_(),f(k,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.platform`)),1)]),t.globalsOpen?(_(),s(`ul`,Tt,[(_(!0),s(c,null,h(t.filteredGlobal,e=>(_(),f(L,{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))])):o(``,!0)])):o(``,!0)])),[[K,t.loading]])]),e(`main`,Et,[t.selectedSkill&&!t.selectedPath?(_(),s(c,{key:0},[e(`header`,Dt,[e(`h3`,Ot,i(t.selectedSkill.slug),1),e(`div`,kt,[a(R,{"model-value":t.selectedSkill.enabled,size:`default`,loading:t.togglingId===t.selectedSkill.id,onChange:u[5]||=e=>t.onToggleSkill(t.selectedSkill,!!e)},null,8,[`model-value`,`loading`]),t.selectedSkill.source===`global`?o(``,!0):(_(),f(F,{key:0,trigger:`click`,placement:`bottom-end`},{dropdown:p(()=>[a(P,null,{default:p(()=>[a(O,{onClick:u[6]||=e=>t.onDelete(t.selectedSkill)},{default:p(()=>[a(B,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`common.button.delete`)),1)]),_:1})]),_:1})]),default:p(()=>[e(`button`,{class:`icon-btn`,"aria-label":t.$t(`skill.button.more`),title:t.$t(`skill.button.more`)},[a(z,{size:16,"aria-hidden":`true`,focusable:`false`})],8,At)]),_:1}))])]),e(`div`,jt,[e(`div`,Mt,[e(`div`,Nt,[e(`span`,Pt,i(t.$t(`skill.meta.addedBy`)),1),e(`span`,Ft,i(t.selectedSkill.source===`global`?t.$t(`skill.meta.platform`):t.$t(`skill.meta.you`)),1)]),e(`div`,It,[e(`span`,Lt,i(t.$t(`skill.meta.lastUpdated`)),1),e(`span`,Rt,i(t.$dayjs.format(t.selectedSkill.updated_at)),1)]),t.selectedSkill.required_connections.length?(_(),s(`div`,zt,[e(`span`,Bt,i(t.$t(`skill.field.requiredConnections`)),1),e(`div`,Vt,[(_(!0),s(c,null,h(t.selectedSkill.required_connections,e=>(_(),f(j,{key:e,tone:`info`,density:`compact`},{default:p(()=>[r(i(e),1)]),_:2},1024))),128))])])):o(``,!0)]),t.selectedSkill.description?(_(),s(`div`,Ht,[e(`div`,Ut,[e(`span`,Wt,i(t.$t(`skill.field.description`)),1),t.selectedSkill.when_to_use?(_(),f(H,{key:0,content:t.selectedSkill.when_to_use,placement:`top`},{default:p(()=>[a(V,{class:`meta-info-icon`,size:12,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`content`])):o(``,!0)]),e(`p`,null,i(t.selectedSkill.description),1)])):o(``,!0)]),e(`div`,Gt,[(_(),f(U,{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?(_(),f(U,{key:`${t.selectedSkill.id}:${t.selectedPath}`,"skill-id":t.selectedSkill.id,path:t.selectedPath,editable:!1},null,8,[`skill-id`,`path`])):(_(),s(`div`,Kt,[a(C,{class:`right-empty-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.selectSkill`)),1)]))])],512),[[v,t.activeTab===`mine`]]),a(W,{modelValue:t.uploadVisible,"onUpdate:modelValue":u[7]||=e=>t.uploadVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),a(G,{modelValue:t.writeVisible,"onUpdate:modelValue":u[8]||=e=>t.writeVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`])])}var Jt=J(lt,[[`render`,qt],[`__scopeId`,`data-v-ead29004`]]);export{Jt as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,Jt as t,L as n,at as r,ht as i,j as a,mt as o,ot as s,tt as c,z as l}from"./vendor-chart-Dw-P17PN.js";import{n as u,t as d}from"./table-GjLQgxzP.js";import{t as f}from"./card-IQwqnRJR.js";import{n as p,t as m}from"./row-BxSRQSNe.js";import{t as h}from"./pagination-Bxloie8Z.js";import{D as g,Gi as _}from"./index-Bk9SKIXV.js";import{t as v}from"./CopyToClipboard-CIB9LY9Y.js";var y=l({name:`ConsoleDistributionInvitees`,components:{Pagination:h,CopyToClipboard:v,ElRow:m,ElCol:p,ElTable:d,ElTableColumn:u,ElCard:f},data(){return{invitees:[],loading:!1,total:void 0,limit:10}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onFetchData()},methods:{onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{page:e}})},onFetchData(){this.loading=!0,Promise.all([this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onFetchInvitees(){let{data:e}=await _.getInvitees({limit:this.limit,offset:(this.page-1)*this.limit,ordering:`-created_at`});this.invitees=e.items,this.total=e.count}}}),b={class:`title`},x={class:`key`},S={class:`copy`},C={class:`description`},w={class:`description`},T={class:`description`},E={class:`created-at`},D={class:`pagination m-v-lg`};function O(l,u,d,f,p,m){let h=r(`el-col`),g=r(`el-row`),_=r(`copy-to-clipboard`),v=r(`el-table-column`),y=r(`el-table`),O=r(`el-card`),k=r(`pagination`),A=s(`loading`);return c(),a(g,{class:`panel`},{default:o(()=>[n(h,{span:24},{default:o(()=>[n(g,null,{default:o(()=>[n(h,{span:24},{default:o(()=>[e(`h2`,b,t(l.$t(`common.title.invitee`)),1)]),_:1})]),_:1}),n(g,null,{default:o(()=>[n(h,{span:24},{default:o(()=>[n(O,{shadow:`never`},{default:o(()=>[i((c(),a(y,{data:l.invitees,stripe:``},{default:o(()=>[n(v,{prop:`id`,label:l.$t(`user.field.id`),"class-name":`text-center`,width:`350px`},{default:o(r=>[e(`span`,x,t(r.row.id),1),e(`span`,S,[n(_,{content:r.row.id},null,8,[`content`])])]),_:1},8,[`label`]),n(v,{label:l.$t(`user.field.username`),width:`300px`},{default:o(n=>[e(`span`,C,t(n.row?.username),1)]),_:1},8,[`label`]),n(v,{label:l.$t(`user.field.email`),width:`300px`},{default:o(n=>[e(`span`,w,t(n.row?.email),1)]),_:1},8,[`label`]),n(v,{label:l.$t(`user.field.nickname`),width:`200px`},{default:o(n=>[e(`span`,T,t(n.row.nickname),1)]),_:1},8,[`label`]),n(v,{label:l.$t(`user.field.dateJoined`)},{default:o(n=>[e(`span`,E,t(l.$dayjs.format(n.row.date_joined)),1)]),_:1},8,[`label`])]),_:1},8,[`data`])),[[A,l.loading]])]),_:1})]),_:1})]),_:1}),n(g,null,{default:o(()=>[n(h,{span:10,offset:14},{default:o(()=>[e(`div`,D,[n(k,{"current-page":l.page,"page-size":l.limit,total:l.total,onChange:l.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var k=g(y,[[`render`,O],[`__scopeId`,`data-v-db9803ce`]]);export{k as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,Jt as t,L as n,at as r,ht as i,j as a,mt as o,ot as s,tt as c,z as l}from"./vendor-chart-Dw-P17PN.js";import{n as u,t as d}from"./table-B3Y40ujp.js";import{t as f}from"./card-IQwqnRJR.js";import{n as p,t as m}from"./row-BxSRQSNe.js";import{t as h}from"./pagination-CoQKuK4D.js";import{D as g,Qi as _}from"./index-C8uXmX2U.js";import{t as v}from"./CopyToClipboard-CdXnxkau.js";var y=l({name:`ConsoleDistributionInvitees`,components:{Pagination:h,CopyToClipboard:v,ElRow:m,ElCol:p,ElTable:d,ElTableColumn:u,ElCard:f},data(){return{invitees:[],loading:!1,total:void 0,limit:10}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onFetchData()},methods:{onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{page:e}})},onFetchData(){this.loading=!0,Promise.all([this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onFetchInvitees(){let{data:e}=await _.getInvitees({limit:this.limit,offset:(this.page-1)*this.limit,ordering:`-created_at`});this.invitees=e.items,this.total=e.count}}}),b={class:`title`},x={class:`key`},S={class:`copy`},C={class:`description`},w={class:`description`},T={class:`description`},E={class:`created-at`},D={class:`pagination m-v-lg`};function O(l,u,d,f,p,m){let h=r(`el-col`),g=r(`el-row`),_=r(`copy-to-clipboard`),v=r(`el-table-column`),y=r(`el-table`),O=r(`el-card`),k=r(`pagination`),A=s(`loading`);return c(),a(g,{class:`panel`},{default:o(()=>[n(h,{span:24},{default:o(()=>[n(g,null,{default:o(()=>[n(h,{span:24},{default:o(()=>[e(`h2`,b,t(l.$t(`common.title.invitee`)),1)]),_:1})]),_:1}),n(g,null,{default:o(()=>[n(h,{span:24},{default:o(()=>[n(O,{shadow:`never`},{default:o(()=>[i((c(),a(y,{data:l.invitees,stripe:``},{default:o(()=>[n(v,{prop:`id`,label:l.$t(`user.field.id`),"class-name":`text-center`,width:`350px`},{default:o(r=>[e(`span`,x,t(r.row.id),1),e(`span`,S,[n(_,{content:r.row.id},null,8,[`content`])])]),_:1},8,[`label`]),n(v,{label:l.$t(`user.field.username`),width:`300px`},{default:o(n=>[e(`span`,C,t(n.row?.username),1)]),_:1},8,[`label`]),n(v,{label:l.$t(`user.field.email`),width:`300px`},{default:o(n=>[e(`span`,w,t(n.row?.email),1)]),_:1},8,[`label`]),n(v,{label:l.$t(`user.field.nickname`),width:`200px`},{default:o(n=>[e(`span`,T,t(n.row.nickname),1)]),_:1},8,[`label`]),n(v,{label:l.$t(`user.field.dateJoined`)},{default:o(n=>[e(`span`,E,t(l.$dayjs.format(n.row.date_joined)),1)]),_:1},8,[`label`])]),_:1},8,[`data`])),[[A,l.loading]])]),_:1})]),_:1})]),_:1}),n(g,null,{default:o(()=>[n(h,{span:10,offset:14},{default:o(()=>[e(`div`,D,[n(k,{"current-page":l.page,"page-size":l.limit,total:l.total,onChange:l.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var k=g(y,[[`render`,O],[`__scopeId`,`data-v-db9803ce`]]);export{k as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,T as o,at as s,ht as c,j as l,mt as u,ot as d,rt as f,tt as p,z as m}from"./vendor-chart-Dw-P17PN.js";import{n as h,t as g}from"./table-B3Y40ujp.js";import{g as ee,h as _,m as v,o as y,s as b,v as x}from"./vuex.esm-bundler-C-5WV-ta.js";import{t as S}from"./card-IQwqnRJR.js";import{n as C,t as w}from"./row-BxSRQSNe.js";import{t as T}from"./skeleton-Dj_a_iIP.js";import{t as E}from"./switch-DfKiiyLD.js";import{t as D}from"./pagination-CoQKuK4D.js";import{t as O}from"./boxes-x-qEQ-LI.js";import{t as k}from"./chart-no-axes-combined-D35CqiRR.js";import{t as A}from"./coins-PK6Ps1X2.js";import{t as j}from"./wallet-DqsH6oxz.js";import{La as M,no as N}from"./constants-CspFM8fh.js";import{$i as P,At as F,D as I,Ga as L,co as R,dt as z,eo as B}from"./index-C8uXmX2U.js";import{t as V}from"./CopyToClipboard-CdXnxkau.js";var H=m({name:`ConsoleApplicationList`,components:{MetaTag:L,AnalyticsIcon:k,ApplicationsIcon:O,CreditsIcon:A,WalletIcon:j,Pagination:D,CopyToClipboard:V,ElTable:g,ElRow:w,ElButton:R,ElCol:C,ElSkeleton:T,ElSwitch:E,ElEmpty:B,ElTableColumn:h,ElCard:S},data(){return{credentialType:y,serviceType:b,applicationType:_,individualApplications:[],globalApplications:[],individualApplicationsTotal:void 0,globalApplicationsTotal:void 0,loading:!1,buying:!1,limit:10,form:{amount:1},active:{service:void 0,application:void 0}}},computed:{redirect(){return this.$route.query?.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)},showGlobalPayment(){return!M(this.$store.getters.site)}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onInitializeGlobalApplication(),this.onFetchData()},methods:{rowCanPay(e){return e.role===`grantee`||M(this.$store.getters.site)?!1:N()?e.type===_.PERIOD?!1:(e?.packages||[]).some(e=>e.type===ee.USAGE&&e?.metadata?.apple_product_id):!0},updateAllowConsumeGlobal(e,t){!e||!e.id||P.updateAllConsumeGlobal(e.id,{...e,allow_consume_global:!!t}).then(()=>{x.success(this.$t(`application.message.updateSuccessfully`).toString())}).catch(()=>{x.error(this.$t(`application.message.updateFailed`).toString())})},onGoUsage(e){this.$router.push({name:F,query:{application_id:e.id}})},onBuyMore(e){let t=z(e);t&&this.$router.push(t)},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchApplications(e=v.INDIVIDUAL){return new Promise((t,n)=>{P.getAll({limit:this.limit,...e===v.INDIVIDUAL?{offset:(this.page-1)*this.limit}:{},user_id:this.$store.getters.user.id,ordering:`-created_at`,type:e===v.INDIVIDUAL?[_.USAGE,_.PERIOD]:_.USAGE,scope:e}).then(({data:n})=>{e===v.INDIVIDUAL?(this.individualApplications=n.items,this.individualApplicationsTotal=n.count):(this.globalApplications=n.items,this.globalApplicationsTotal=n.count),t(n)}).catch(e=>{x.error(this.$t(`application.message.fetchFailed`).toString()),n(e)})})},onFetchData(){this.loading=!0,Promise.all([this.onFetchApplications(v.INDIVIDUAL),this.onFetchApplications(v.GLOBAL)]).then(()=>{this.loading=!1}).catch(()=>{this.loading=!1})},onInitializeGlobalApplication(){P.create({type:_.USAGE,scope:v.GLOBAL,user_id:this.$store.getters.user.id}).finally(()=>{this.onFetchApplications(v.GLOBAL)})},hasBalance(e){return e.service?.type!==b.Dataset&&e.service?.type!==b.Deployment},getRemainingAmount(e){if(!this.hasBalance(e))return`-`;if(e.remaining_amount===void 0||e.remaining_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.remaining_amount?.toFixed(6)} ${t}`},getUsedAmount(e){if(!this.hasBalance(e))return`-`;if(e.used_amount===void 0||e.used_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.used_amount?.toFixed(6)} ${t}`}}}),U={class:`title`},W={key:1,class:`summary-card`},G={class:`icon-wrapper`},K={class:`label`},q={class:`value`},J={class:`description`},Y={key:1,class:`flex flex-row justify-between items-center gap-3`},X={class:`summary-card min-w-0 flex-1`},Z={class:`flex justify-start items-center gap-2 mb-2 w-full`},te={class:`icon-wrapper !mb-0`},Q={class:`text-[var(--el-text-color-regular)] text-[14px] truncate`},ne={class:`label`},re={class:`value`},ie={class:`description`},ae={class:`flex flex-col items-end gap-2 shrink-0`},oe={class:`copy`},se={key:0,class:`expired-at`},ce={class:`flex flex-wrap items-center justify-end gap-1`},le={class:`application-cards grid card-gap sm:hidden`},ue={class:`flex items-center gap-2 flex-wrap`},de={class:`application-card__name`},fe={class:`application-card__id`},pe={class:`truncate`},$={key:0,class:`application-card__row`},me={class:`label`},he={class:`value`},ge={key:1,class:`application-card__row`},_e={class:`label`},ve={class:`value`},ye={key:2,class:`application-card__row`},be={class:`label`},xe={class:`flex items-center justify-end gap-2 mt-3`},Se={class:`pagination`};function Ce(m,h,g,ee,_,v){let y=s(`el-col`),b=s(`el-row`),x=s(`el-skeleton`),S=s(`applications-icon`),C=s(`el-card`),w=s(`wallet-icon`),T=s(`copy-to-clipboard`),E=s(`analytics-icon`),D=s(`el-button`),O=s(`credits-icon`),k=s(`el-table-column`),A=s(`meta-tag`),j=s(`el-switch`),M=s(`el-table`),N=s(`el-empty`),P=s(`pagination`),F=d(`loading`);return p(),l(b,{class:`application-list`},{default:u(()=>[r(y,{span:24},{default:u(()=>[r(b,null,{default:u(()=>[r(y,{span:24},{default:u(()=>[e(`h2`,U,n(m.$t(`common.title.allApplications`)),1)]),_:1})]),_:1}),r(b,{gutter:15,class:`card-gap card-section-gap`},{default:u(()=>[r(y,{md:12,xs:24},{default:u(()=>[r(C,{shadow:`never`,class:`relative min-h-[180px]`,"body-style":{padding:`18px 20px`}},{default:u(()=>[m.loading?(p(),l(x,{key:0})):(p(),a(`div`,W,[e(`div`,G,[r(S,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,K,n(m.$t(`application.title.count`)),1),e(`p`,q,n(m.individualApplicationsTotal),1),e(`p`,J,n(m.$t(`application.message.countDescription`)),1)]))]),_:1})]),_:1}),m.showGlobalPayment&&m.globalApplications?.length>0?(p(),l(y,{key:0,md:12,xs:24},{default:u(()=>[r(C,{shadow:`never`,class:`relative min-h-[180px]`,"body-style":{padding:`18px 20px`}},{default:u(()=>[m.loading?(p(),l(x,{key:0})):(p(),a(`div`,Y,[e(`div`,X,[e(`div`,Z,[e(`div`,te,[r(w,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`span`,Q,[t(n(m.$t(`application.field.id`))+`: `+n(m.globalApplications?.[0]?.id)+` `,1),m.globalApplications?.[0]?.id?(p(),l(T,{key:0,content:m.globalApplications?.[0]?.id,class:`inline-block`},null,8,[`content`])):i(``,!0)])]),e(`p`,ne,n(m.$t(`application.title.globalBalance`)),1),e(`p`,re,n(m.globalApplications?.[0]?.remaining_amount?.toFixed(6)||`0.000000`)+` `+n(m.$t(`service.unit.credits`)),1),e(`p`,ie,n(m.$t(`application.message.globalBalanceDescription`)),1)]),e(`div`,ae,[r(D,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:h[0]||=e=>m.onGoUsage(m.globalApplications?.[0])},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.usage`)),1)]),_:1}),m.showGlobalPayment?(p(),l(D,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:h[1]||=e=>m.onBuyMore(m.globalApplications?.[0])},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.buyMore`)),1)]),_:1})):i(``,!0)])]))]),_:1})]),_:1})):i(``,!0)]),_:1}),r(b,null,{default:u(()=>[r(y,{span:24},{default:u(()=>[r(C,{shadow:`never`,class:`applications-table-card hidden sm:block`},{default:u(()=>[c((p(),l(M,{data:m.individualApplications,stripe:``,class:`applications-table !min-h-[calc(100vh-420px)]`,"table-layout":`fixed`,"empty-text":m.$t(`common.message.noData`)},{default:u(()=>[r(k,{prop:`id`,label:m.$t(`application.field.id`),width:`200px`,"class-name":`text-center`},{default:u(t=>[e(`span`,null,n(t.row.id),1),e(`span`,oe,[r(T,{content:t?.row?.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(k,{label:m.$t(`application.field.type`),width:`90px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row?.type===`Period`?(p(),l(A,{key:0,tone:`success`,density:`compact`},{default:u(()=>[t(n(m.$t(`application.type.period`)),1)]),_:1})):e.row?.type===`Usage`?(p(),l(A,{key:1,density:`compact`},{default:u(()=>[t(n(m.$t(`application.type.usage`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(k,{label:m.$t(`application.field.name`),width:`180px`},{default:u(r=>[e(`span`,null,n(r.row?.service?.title),1),r.row?.role===`grantee`?(p(),l(A,{key:0,tone:`info`,class:`ml-2`,density:`compact`},{default:u(()=>[t(n(m.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(k,{prop:`remaining_amount`,label:m.$t(`application.field.remainingAmount`),width:`150px`,"class-name":`text-center`},{default:u(t=>[e(`span`,null,n(m.getRemainingAmount(t.row)),1)]),_:1},8,[`label`]),r(k,{prop:`used_amount`,label:m.$t(`application.field.usedAmount`),width:`150px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(t=>[e(`span`,null,n(m.getUsedAmount(t.row)),1)]),_:1},8,[`label`]),r(k,{prop:`allow_consume_global`,label:m.$t(`application.field.allowConsumeGlobal`),width:`120px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row.service?.type===m.serviceType.API&&e.row.type===m.applicationType.USAGE?(p(),l(j,{key:0,modelValue:e.row.allow_consume_global,"onUpdate:modelValue":t=>e.row.allow_consume_global=t,"active-value":!0,"inactive-value":!1,onChange:t=>m.updateAllowConsumeGlobal(e.row,t)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])):i(``,!0)]),_:1},8,[`label`]),r(k,{label:m.$t(`application.field.expiredAt`),width:`180px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row.expired_at?(p(),a(`span`,se,n(m.$dayjs.format(e.row.expired_at)),1)):i(``,!0)]),_:1},8,[`label`]),r(k,{fixed:`right`,width:`200px`},{default:u(a=>[e(`div`,ce,[a.row?.service?.type===m.serviceType.API?(p(),l(D,{key:0,class:`!m-0 !px-2`,size:`small`,round:``,onClick:e=>m.onGoUsage(a?.row)},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`])):i(``,!0),m.rowCanPay(a?.row)?(p(),l(D,{key:1,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:e=>m.onBuyMore(a?.row)},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[F,m.loading]])]),_:1}),e(`div`,le,[m.loading?(p(),l(x,{key:0,rows:4,animated:``})):(p(),a(o,{key:1},[m.individualApplications?.length?(p(!0),a(o,{key:1},f(m.individualApplications,o=>(p(),l(C,{key:o.id,shadow:`never`,class:`application-card`,"body-style":{padding:`14px 16px`}},{default:u(()=>[e(`div`,ue,[e(`span`,de,n(o?.service?.title),1),o?.type===`Period`?(p(),l(A,{key:0,tone:`success`,density:`compact`},{default:u(()=>[t(n(m.$t(`application.type.period`)),1)]),_:1})):o?.type===`Usage`?(p(),l(A,{key:1,density:`compact`},{default:u(()=>[t(n(m.$t(`application.type.usage`)),1)]),_:1})):i(``,!0),o?.role===`grantee`?(p(),l(A,{key:2,tone:`info`,density:`compact`},{default:u(()=>[t(n(m.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),e(`div`,fe,[e(`span`,pe,n(m.$t(`application.field.id`))+`: `+n(o.id),1),r(T,{content:o.id,class:`inline-block shrink-0`},null,8,[`content`])]),m.hasBalance(o)?(p(),a(`div`,$,[e(`span`,me,n(m.$t(`application.field.remainingAmount`)),1),e(`span`,he,n(m.getRemainingAmount(o)),1)])):i(``,!0),o?.expired_at?(p(),a(`div`,ge,[e(`span`,_e,n(m.$t(`application.field.expiredAt`)),1),e(`span`,ve,n(m.$dayjs.format(o.expired_at)),1)])):i(``,!0),o.service?.type===m.serviceType.API&&o.type===m.applicationType.USAGE?(p(),a(`div`,ye,[e(`span`,be,n(m.$t(`application.field.allowConsumeGlobal`)),1),r(j,{modelValue:o.allow_consume_global,"onUpdate:modelValue":e=>o.allow_consume_global=e,"active-value":!0,"inactive-value":!1,onChange:e=>m.updateAllowConsumeGlobal(o,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])])):i(``,!0),e(`div`,xe,[o?.service?.type===m.serviceType.API?(p(),l(D,{key:0,class:`!m-0 !px-3`,size:`small`,round:``,onClick:e=>m.onGoUsage(o)},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`])):i(``,!0),m.rowCanPay(o)?(p(),l(D,{key:1,class:`!m-0 !px-3`,type:`primary`,round:``,size:`small`,onClick:e=>m.onBuyMore(o)},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:2},1024))),128)):(p(),l(N,{key:0,description:m.$t(`common.message.noData`)},null,8,[`description`]))],64))])]),_:1})]),_:1}),r(b,null,{default:u(()=>[r(y,{span:24},{default:u(()=>[e(`div`,Se,[r(P,{"current-page":m.page,"page-size":m.limit,total:m.individualApplicationsTotal,onChange:m.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var we=I(H,[[`render`,Ce],[`__scopeId`,`data-v-8b2dfd0c`]]);export{we as default};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime--c01j_DQ.js";import{A as t,I as n,Jt as r,L as i,M as a,N as o,T as s,a as c,at as l,c as u,d,ht as f,i as p,j as m,l as h,mt as g,n as _,o as v,ot as ee,qt as y,r as b,rt as x,s as S,t as C,tt as w,u as te,z as T}from"./vendor-chart-Dw-P17PN.js";import{r as E,t as D}from"./select-Ctt4vMla.js";import{n as O,t as k}from"./table-B3Y40ujp.js";import{n as A,t as ne}from"./tabs-BpSLc2Is.js";import{h as j,o as M,s as N,v as P}from"./vuex.esm-bundler-C-5WV-ta.js";import{t as F}from"./card-IQwqnRJR.js";import{n as I,r as L}from"./radio-BNhFzeBO.js";import{t as R}from"./date-picker-B72Rk5Dt.js";import{n as z,t as B}from"./row-BxSRQSNe.js";import{t as V}from"./skeleton-Dj_a_iIP.js";import{t as H}from"./switch-DfKiiyLD.js";import{t as U}from"./pagination-CoQKuK4D.js";import{t as W}from"./boxes-x-qEQ-LI.js";import{t as re}from"./external-link-BIUuevwA.js";import{t as ie}from"./file-output-DncNlmtQ.js";import{$i as G,$r as K,D as ae,Ga as oe,Ka as se,Kr as ce,Mi as le,Qr as q,Ua as ue,ca as de,co as fe,ei as pe,eo as me,hi as he,na as ge,pi as J,to as _e}from"./index-C8uXmX2U.js";import{t as ve}from"./CopyToClipboard-CdXnxkau.js";var Y=[`#5B8FF9`,`#5AD8A6`,`#5D7092`,`#F6BD16`,`#6F5EF9`,`#6DC8EC`,`#945FB9`,`#FF9845`,`#1E9493`,`#FF99C3`],X=`#C0C4CC`,ye=.01,be=20;function xe(e){return e<=Y.length?Y.slice(0,e):Array.from({length:e},(t,n)=>`hsl(${Math.round(n*360/e)}, 62%, ${n%2==0?55:45}%)`)}function Se(e,t){let n=Array.from(new Set((e.items||[]).map(e=>e.date))).sort(),r={},i={};(e.items||[]).forEach(e=>{let t=e.amount||0;(r[e.date]||(r[e.date]={}))[e.api_id]=(r[e.date]?.[e.api_id]||0)+t,i[e.api_id]=(i[e.api_id]||0)+t});let a=Object.keys(i).sort((e,t)=>i[t]-i[e]),o=a.reduce((e,t)=>e+i[t],0),s=a.length;if(o>0){let e=o*(1-ye),t=0;for(let n=0;n<a.length;n++)if(t+=i[a[n]],t>=e){s=n+1;break}s=Math.min(s,be)}a.length-s===1&&(s=a.length);let c=a.slice(0,s),l=new Set(c),u=xe(c.length),d=a.slice(s),f=`${t} (${d.length})`,p=c.map((t,i)=>({key:t,label:e.apis?.[t]?.title||t,data:n.map(e=>r[e]?.[t]||0),color:u[i]}));if(d.length){let e=n.map(e=>Object.entries(r[e]||{}).reduce((e,[t,n])=>l.has(t)?e:e+n,0));e.some(e=>e>0)&&p.push({key:`__others__`,label:f,data:e,color:X})}let m=a.map((t,n)=>({key:t,label:e.apis?.[t]?.title||t,amount:i[t],color:n<c.length?u[n]:X,share:o>0?i[t]/o:0})),h=[],g=[],_=[];c.forEach((t,n)=>{h.push(e.apis?.[t]?.title||t),g.push(i[t]),_.push(u[n])});let v=d.reduce((e,t)=>e+i[t],0);return v>0&&(h.push(f),g.push(v),_.push(X)),{barChartLabels:n,barChartSeries:p,apiBreakdown:m,pieLabels:h,pieData:g,pieColors:_}}function Z(e){return new Intl.NumberFormat().format(Math.round(((e||0)+2**-52)*100)/100)}function Ce(e){return e==null||Number.isNaN(e)?`-`:e<1?`${Math.round(e*1e3)} ms`:`${e.toFixed(2)} s`}var we=e(ge());function Q(e){return e.metadata?.x402===!0}function $(e){let t=e.metadata;if(De(t))try{let e=BigInt(t.x402_amount_atomic),n=J(e,t.x402_decimals),r,i,a;if(typeof t.x402_list_amount_atomic==`string`&&/^\d+$/.test(t.x402_list_amount_atomic)){let n=BigInt(t.x402_list_amount_atomic),o=Number(t.x402_discount_percent);n>e&&Number.isFinite(o)&&o>0&&o<1&&(r=J(n,t.x402_decimals),t.x402_discount_type===`Coin`&&t.x402_discount_coin_policy_id?a=`ace`:t.x402_discount_type===`Manual`&&(a=`manual`),a&&(i=Number((o*100).toFixed(2)).toString()))}return{amount:n,originalAmount:r,discountPercent:i,discountSource:a,currency:t.x402_currency,network:t.x402_network,transaction:t.x402_tx,payer:typeof t.x402_payer==`string`?t.x402_payer:void 0,explorerUrl:he(t.x402_network,t.x402_tx)||le(t.x402_network,t.x402_tx)}}catch{return}}function Te(e){let t=e.metadata?.x402_tx||e.metadata?.x402_settle_attempt_tx;return typeof t==`string`&&t.length>0?t:void 0}function Ee(e){return e?Object.fromEntries(Object.entries(e).filter(([e,t])=>!e.startsWith(`x402`)&&e!==`request`&&e!==`response`&&(typeof t!=`object`||!t))):{}}function De(e){return!!(e?.x402===!0&&e.x402_settlement_status===`settled`&&typeof e.x402_amount_atomic==`string`&&/^\d+$/.test(e.x402_amount_atomic)&&Number.isSafeInteger(e.x402_decimals)&&e.x402_decimals>=0&&e.x402_decimals<=255&&typeof e.x402_currency==`string`&&e.x402_currency.length>0&&typeof e.x402_network==`string`&&e.x402_network.length>0&&typeof e.x402_tx==`string`&&e.x402_tx.length>0)}v.register(c,u,p,b,S,te,d,h);var Oe=15e3,ke=T({name:`ConsoleUsageList`,components:{MetaTag:oe,StatusBadge:se,ApplicationsIcon:W,ExportIcon:ie,ExternalLinkIcon:re,Pagination:U,ElDatePicker:R,ElTable:k,ElSelect:E,ElOption:D,CopyToClipboard:ve,ElRow:B,ElCol:z,ElTableColumn:O,ElCard:F,ElRadioButton:I,ElRadioGroup:L,ElSkeleton:V,ElDialog:_e,ElTabs:A,ElTabPane:ne,ElButton:fe,ElEmpty:me,ElSwitch:H,BarChart:C,DoughnutChart:_},data(){return{applicationIds:this.$route.query.application_id?.toString()?this.$route.query.application_id?.toString().split(`,`):[],apiIds:this.$route.query.api_id?.toString()?this.$route.query.api_id?.toString().split(`,`):[],applications:[],services:[],serviceIds:this.$route.query.service_id?.toString()?this.$route.query.service_id.toString().split(`,`).filter(Boolean):[],servicesLoading:!1,apis:[],apisLoading:!1,credentialType:M,serviceType:N,apiUsages:[],proxyUsages:[],createdAtRange:(()=>{let e=this.$route.query.created_at_to?.toString(),t=this.$route.query.created_at_from?.toString();if(t&&e)return[new Date(t),new Date(e)];let n=new Date,r=new Date;return r.setDate(1),r.setHours(0,0,0,0),[r,n]})(),shortcuts:[{text:this.$t(`usage.shortcuts.thisMonth`),value:()=>{let e=new Date,t=new Date;return t.setDate(1),t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.today`),value:()=>{let e=new Date,t=new Date;return t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.last1Day`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-1),[t,e]}},{text:this.$t(`usage.shortcuts.last3Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-3),[t,e]}},{text:this.$t(`usage.shortcuts.last7Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-7),[t,e]}},{text:this.$t(`usage.shortcuts.last1Month`),value:()=>{let e=new Date,t=new Date;return t.setMonth(t.getMonth()-1),[t,e]}}],type:N.API,loading:!1,total:void 0,limit:15,totalUsed:0,barChartLabels:[],barChartSeries:[],chartView:`trend`,apiBreakdown:[],pieLabels:[],pieData:[],pieColors:[],aggLoading:!1,detailDialogVisible:!1,detailRow:null,detailActiveTab:`request`,detailLoading:!1,exporting:!1,statusCodeFilter:this.$route.query.status_code?.toString()||``,traceId:this.$route.query.trace_id?.toString()||``,statusCodeOptions:[],statusCodeOptionsLoading:!1,autoRefresh:!0,autoRefreshTimer:null,fetchSeq:0,apiFetchSeq:0}},computed:{redirect(){return this.$route.query?.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)},totalUsedString(){return`${(this.totalUsed||0).toFixed(2)}`},barChartData(){return{labels:this.barChartLabels,datasets:this.barChartSeries.map(e=>({label:e.label,data:e.data,backgroundColor:e.color,maxBarThickness:36,borderRadius:2,borderSkipped:!1}))}},barChartOptions(){let e=Z;return{responsive:!0,maintainAspectRatio:!1,interaction:{mode:`index`,intersect:!1},plugins:{legend:{position:`bottom`,labels:{usePointStyle:!0,pointStyle:`circle`,boxWidth:8,boxHeight:8,padding:14},onClick:(e,t,n)=>{let r=n?.chart;if(!r||t?.datasetIndex===void 0)return;let i=t.datasetIndex,a=r.data?.datasets||[];a.some((e,t)=>t!==i&&r.isDatasetVisible(t))?a.forEach((e,t)=>r.setDatasetVisibility(t,t===i)):a.forEach((e,t)=>r.setDatasetVisibility(t,!0)),r.update()}},title:{display:!1},tooltip:{itemSort:(e,t)=>(t.parsed?.y||0)-(e.parsed?.y||0),callbacks:{label:t=>` ${t.dataset.label}: ${e(t.parsed.y)}`,footer:t=>`${this.$t(`usage.title.totalUsed`)}: ${e(t.reduce((e,t)=>e+(t.parsed?.y||0),0))}`}}},scales:{x:{stacked:!0,grid:{display:!1},ticks:{maxRotation:0,autoSkip:!0,autoSkipPadding:16}},y:{stacked:!0,beginAtZero:!0,border:{display:!1},grid:{color:`rgba(128, 128, 128, 0.15)`},ticks:{callback:t=>e(Number(t))}}}}},doughnutChartData(){return{labels:this.pieLabels,datasets:[{data:this.pieData,backgroundColor:this.pieColors,borderWidth:0,hoverOffset:6}]}},doughnutChartOptions(){let e=e=>this.fmtAmount(e),t=this.pieData.reduce((e,t)=>e+(t||0),0);return{responsive:!0,maintainAspectRatio:!1,cutout:`58%`,plugins:{legend:{position:`right`,labels:{usePointStyle:!0,pointStyle:`circle`,boxWidth:8,boxHeight:8,padding:12}},title:{display:!1},tooltip:{callbacks:{label:n=>{let r=n.parsed||0,i=t>0?(r/t*100).toFixed(1):`0`;return` ${n.label}: ${e(r)} (${i}%)`}}}}}}},watch:{page:{handler(){this.onFetchUsages()}},type:{handler(){this.applicationIds=[],this.serviceIds=[],this.apiIds=[],this.onApplicationsChange(this.applicationIds),this.onFetchApplications(),this.onFetchServices(),this.onFetchApis(),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()}},autoRefresh:{handler(e){e?this.startAutoRefresh():this.stopAutoRefresh()}}},async mounted(){this.onFetchApplications(),await Promise.all([this.onFetchServices(),this.hydrateApiSelection()]),await this.onFetchApis(),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions(),this.autoRefresh&&this.startAutoRefresh()},beforeUnmount(){this.stopAutoRefresh()},methods:{async onFetchUsages(e=!1){this.type===N.API?this.onFetchApiUsages(e):this.type===N.Proxy&&this.onFetchProxyUsages(e)},startAutoRefresh(){this.stopAutoRefresh(),this.autoRefreshTimer=window.setInterval(()=>{document.hidden||this.onFetchUsages(!0)},Oe)},stopAutoRefresh(){this.autoRefreshTimer!==null&&(clearInterval(this.autoRefreshTimer),this.autoRefreshTimer=null)},serviceIcon(e){return this.services.find(t=>t.id===e)?.icon_url},async onServicesChange(e){e.length||(this.apiIds=[]),this.apis=[],await this.onFetchApis(),await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,service_id:e.length?e.join(`,`):void 0,api_id:this.apiIds.length?this.apiIds.join(`,`):void 0,page:void 0}}),this.onFetchApiUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()},async onApiChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,api_id:e}}),this.onFetchApiUsages(),this.onFetchAggregate()},async onApisChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,api_id:e&&e.length?e.join(`,`):void 0,page:void 0}}),this.onFetchApiUsages(),this.onFetchAggregate()},async onTimeRangeChanged(){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,created_at_from:this.createdAtRange?this.$dayjs.format(this.createdAtRange[0].toString(),`YYYY-MM-DDTHH:mm:ss.SSSSSSZ`):``,created_at_to:this.createdAtRange?this.$dayjs.format(this.createdAtRange[1].toString(),`YYYY-MM-DDTHH:mm:ss.SSSSSSZ`):``}}),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()},async onApplicationChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,application_id:e}}),this.onFetchUsages(),this.onFetchAggregate()},async onApplicationsChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,application_id:e&&e.length?e.join(`,`):``}}),this.onFetchUsages(),this.onFetchAggregate()},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},getRemainingAmount(e){if(e.remaining_amount===void 0||e.remaining_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.remaining_amount?.toFixed(6)} ${t}`},getUsedAmount(e){if(e.used_amount===void 0||e.used_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.used_amount?.toFixed(6)} ${t}`},getDeductedAmount(e){if(e?.deducted_amount===void 0||e?.deducted_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.deducted_amount?.toFixed(6)} ${t}`},getOriginalAmount(e){if(e?.original_amount===void 0||e?.original_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.original_amount?.toFixed(6)} ${t}`},onStatusCodeChange(e){let t={...this.$route.query},n=(e||``).trim();n?t.status_code=n:delete t.status_code,delete t.status_code_filter,this.$router.push({name:this.$route.name?.toString(),query:t}),this.onFetchUsages(),this.onFetchAggregate()},async onFetchStatusCodeOptions(){this.statusCodeOptionsLoading=!0;try{let{data:e}=await K.getStatusCodes({user_id:this.$store.getters.user.id,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.serviceIds.length?{service_id:this.serviceIds}:{},...this.apiIds.length?{api_id:this.apiIds}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{}});this.statusCodeOptions=(e?.items||[]).slice().sort((e,t)=>e-t)}catch{this.statusCodeOptions=[]}finally{this.statusCodeOptionsLoading=!1}},formatElapsed:Ce,isX402Usage:Q,getX402Payment:$,getX402Transaction:Te,getX402DiscountLabel(e){let t=$(e);if(!t?.discountPercent)return``;let n=t.discountSource===`ace`?`usage.value.aceDiscount`:`usage.value.accountDiscount`;return this.$t(n,{percent:t.discountPercent})},getX402StatusType(e){return $(e)?`success`:e.metadata?.x402_settlement_status===`unconfirmed`?`warning`:e.metadata?.x402_settle_error||e.metadata?.x402_skipped?`danger`:`info`},getX402StatusKey(e){return $(e)?`usage.value.paymentSettled`:e.metadata?.x402_settlement_status===`unconfirmed`?`usage.value.paymentUnconfirmed`:e.metadata?.x402_settle_error||e.metadata?.x402_skipped?`usage.value.paymentFailed`:`usage.value.paymentUnavailable`},shortTransaction(e){return!e||e.length<=16?e||``:`${e.slice(0,8)}…${e.slice(-6)}`},getSimpleMetadata(e){return Ee(e)},getCredentialLabel(e){return e.credential?.name?.trim()||e.credential?.id||e.credential_id||`-`},onShowDetail(e){if(this.detailRow={...e,metadata:e.metadata?{...e.metadata}:void 0},this.detailActiveTab=Q(e)?`payment`:`request`,this.detailDialogVisible=!0,this.detailLoading=!0,e.id){let t=e.id;K.get(t).then(e=>{this.detailRow?.id===t&&(this.detailRow=e.data)}).finally(()=>{this.detailRow?.id===t&&(this.detailLoading=!1)})}},formatJson(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}},onFetchApplications(){G.getAll({limit:100,offset:0,user_id:this.$store.getters.user.id,ordering:`-created_at`,type:j.USAGE}).then(({data:e})=>{this.applications=e.items.filter(e=>e?.service?.type===this.type)}).catch(()=>{})},async hydrateApiSelection(){if(!this.apiIds.length)return;let e=(await Promise.allSettled(this.apiIds.map(e=>q.get(e)))).filter(e=>e.status===`fulfilled`).map(e=>e.value);if(!this.serviceIds.length){let t=new Set;e.forEach(({data:e})=>{let n=e.service_id||e.service?.id;n&&t.add(n)}),this.serviceIds=Array.from(t)}this.apis=e.map(({data:e})=>e)},async onFetchServices(){this.servicesLoading=!0;try{let[{data:e},{data:t}]=await Promise.all([ce.getAll({limit:1e3,offset:0,ordering:`-rank`,type:[N.API,N.Agent],private:!1}),G.getAll({limit:1e3,offset:0,ordering:`-created_at`,user_id:`me`})]),n=new Map(e.items.map(e=>[e.id,e]));t.items.forEach(e=>{e.service?.id&&e.service.private!==!0&&n.set(e.service.id,e.service)}),this.services=Array.from(n.values())}catch{this.services=[]}finally{this.servicesLoading=!1}},async onFetchApis(){let e=++this.apiFetchSeq;if(!this.serviceIds.length){this.apis=[],this.apisLoading=!1;return}this.apisLoading=!0;try{let t=await Promise.allSettled(this.serviceIds.map(e=>q.getAllForService(e,{limit:1e3,offset:0,ordering:`-created_at`})));if(e!==this.apiFetchSeq)return;let n=new Map;if(this.apis.filter(e=>this.apiIds.includes(e.id)).forEach(e=>n.set(e.id,e)),t.filter(e=>e.status===`fulfilled`).forEach(e=>e.value.data.items.forEach(e=>n.set(e.id,e))),this.apis=Array.from(n.values()),this.apiIds.length){let e=new Set(this.apis.map(e=>e.id));this.apiIds=this.apiIds.filter(t=>e.has(t))}}finally{e===this.apiFetchSeq&&(this.apisLoading=!1)}},onFetchApiUsages(e=!1){e||(this.loading=!0);let t=++this.fetchSeq;K.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.serviceIds.length?{service_id:this.serviceIds}:{},...this.apiIds.length?{api_id:this.apiIds}:{},...this.statusCodeFilter?{status_code:this.statusCodeFilter}:{},...this.traceId?{trace_id:this.traceId}:{}}).then(({data:e})=>{t===this.fetchSeq&&(this.apiUsages=e.items,this.total=e.count)}).catch(()=>{}).finally(()=>{e||(this.loading=!1)})},onFetchProxyUsages(e=!1){e||(this.loading=!0);let t=++this.fetchSeq;pe.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{}}).then(({data:e})=>{t===this.fetchSeq&&(this.proxyUsages=e.items,this.total=e.count)}).catch(()=>{}).finally(()=>{e||(this.loading=!1)})},async onExport(){if(!this.$store.state.token?.access){P.error(this.$t(`usage.message.exportFailed`));return}let e={user_id:this.$store.getters.user.id,...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.serviceIds.length?{service_id:this.serviceIds}:{},...this.apiIds.length?{api_id:this.apiIds}:{},...this.statusCodeFilter?{status_code:this.statusCodeFilter}:{}},t=`${ue()}/api/v1/usage/apis/export/?${we.default.stringify(e,{arrayFormat:`repeat`})}`,n=null,r=window.showSaveFilePicker;if(typeof r==`function`)try{n=await r({suggestedName:`usages.csv`,types:[{description:`CSV`,accept:{"text/csv":[`.csv`]}}]})}catch(e){if(e?.name===`AbortError`)return;n=null}this.exporting=!0;try{let e=await fetch(t,{headers:{authorization:`Bearer ${de()}`}});if(!e.ok||!e.body)throw Error(`export failed: ${e.status}`);if(n)await e.body.pipeTo(await n.createWritable());else{let t=await e.blob(),n=window.URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`usages.csv`,r.click(),window.URL.revokeObjectURL(n)}}catch{P.error(this.$t(`usage.message.exportFailed`))}finally{this.exporting=!1}},fmtAmount:Z,async onFetchAggregate(){if(this.type!==this.serviceType.API)return;this.aggLoading=!0;let e={user_id:this.$store.getters.user.id,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.serviceIds.length?{service_id:this.serviceIds}:{},...this.apiIds.length?{api_id:this.apiIds}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},timezone:Intl.DateTimeFormat().resolvedOptions().timeZone};try{let{data:t}=await K.getAggregate(e);this.totalUsed=t.total||0,Object.assign(this,Se(t,this.$t(`usage.value.others`)))}finally{this.aggLoading=!1}}}}),Ae={class:`text-[26px] font-bold mb-5 text-[var(--el-text-color-primary)]`},je={class:`usage-filter-label`},Me={class:`usage-service-label`},Ne=[`src`],Pe={class:`usage-service-label`},Fe=[`src`],Ie={class:`usage-filter-label`},Le={key:1,class:`summary-card`},Re={class:`icon-wrapper`},ze={class:`text-left`},Be={class:`description`},Ve={class:`value`},He={class:`flex flex-wrap items-center justify-between gap-2`},Ue={class:`text-[15px] font-medium text-[var(--el-text-color-primary)]`},We={class:`chart-wrapper`},Ge={class:`share-cell`},Ke={class:`share-bar`},qe={class:`share-pct`},Je={class:`flex items-center justify-end gap-2 mb-4`},Ye={class:`text-sm text-[var(--el-text-color-regular)]`},Xe={class:`usage-service-label`},Ze=[`src`],Qe={key:0},$e={key:0,class:`space-y-1`},et={key:0},tt={key:1,class:`text-gray-400`},nt={key:1},rt={key:2},it={key:0,class:`space-y-1`},at={class:`flex min-w-0 items-center justify-center gap-1`},ot=[`href`],st={key:1,class:`key truncate`},ct={class:`text-xs text-gray-400`},lt={key:1},ut={class:`flex flex-wrap gap-2`},dt={key:1,class:`flex min-w-0 items-center gap-1`},ft={class:`key`},pt={key:0,class:`cursor-pointer`},mt={class:`key`},ht={key:0,class:`cursor-pointer`},gt={class:`created-at`},_t={class:`key`},vt={key:0,class:`cursor-pointer`},yt={class:`created-at`},bt={key:1,class:`payment-details`},xt={key:0,class:`ml-2 text-danger`},St={key:0},Ct={key:0,class:`ml-2`},wt={key:1},Tt={class:`break-all`},Et={class:`break-all`},Dt=[`href`],Ot={key:1,class:`detail-json`},kt={key:2,class:`text-gray-400`},At={key:1,class:`detail-json`},jt={key:2,class:`text-gray-400`},Mt={class:`float-right`};function Nt(e,c,u,d,p,h){let _=l(`el-col`),v=l(`el-row`),b=l(`el-option`),S=l(`el-select`),C=l(`el-date-picker`),te=l(`export-icon`),T=l(`el-button`),E=l(`el-skeleton`),D=l(`applications-icon`),O=l(`el-card`),k=l(`el-radio-button`),A=l(`el-radio-group`),ne=l(`bar-chart`),j=l(`el-empty`),M=l(`doughnut-chart`),N=l(`el-table-column`),P=l(`el-table`),F=l(`el-switch`),I=l(`status-badge`),L=l(`meta-tag`),R=l(`external-link-icon`),z=l(`copy-to-clipboard`),B=l(`el-tab-pane`),V=l(`el-tabs`),H=l(`el-dialog`),U=l(`pagination`),W=ee(`loading`);return w(),m(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[t(`h2`,Ae,r(e.$t(`common.title.allUsages`)),1)]),_:1})]),_:1}),i(v,{class:`usage-filters`},{default:g(()=>[e.type===e.serviceType.API?(w(),m(_,{key:0,lg:5,md:12,xs:24,class:`usage-filter`},{default:g(()=>[t(`span`,je,r(e.$t(`usage.field.service`)),1),i(S,{modelValue:e.serviceIds,"onUpdate:modelValue":c[0]||=t=>e.serviceIds=t,placeholder:e.$t(`usage.option.allServices`),loading:e.servicesLoading,clearable:``,filterable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onServicesChange},{label:g(({label:n,value:i})=>[t(`span`,Me,[e.serviceIcon(i)?(w(),o(`img`,{key:0,src:e.serviceIcon(i),class:`usage-service-icon`,alt:``},null,8,Ne)):a(``,!0),t(`span`,null,r(n),1)])]),default:g(()=>[(w(!0),o(s,null,x(e.services,e=>(w(),m(b,{key:e.id,label:e.title,value:e.id},{default:g(()=>[t(`span`,Pe,[e.icon_url?(w(),o(`img`,{key:0,src:e.icon_url,class:`usage-service-icon`,alt:``},null,8,Fe)):a(``,!0),t(`span`,null,r(e.title),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`loading`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:1,lg:5,md:12,xs:24,class:`usage-filter`},{default:g(()=>[t(`span`,Ie,r(e.$t(`usage.field.operation`)),1),i(S,{modelValue:e.apiIds,"onUpdate:modelValue":c[1]||=t=>e.apiIds=t,placeholder:e.$t(`usage.option.allOperations`),loading:e.apisLoading,disabled:!e.serviceIds.length&&!e.apiIds.length,clearable:``,filterable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onApisChange},{default:g(()=>[(w(!0),o(s,null,x(e.apis,e=>(w(),m(b,{key:e.id,label:e.title||e.id,value:e.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`loading`,`disabled`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:2,lg:7,md:12,xs:24,class:`usage-filter`},{default:g(()=>[i(C,{modelValue:e.createdAtRange,"onUpdate:modelValue":c[2]||=t=>e.createdAtRange=t,type:`datetimerange`,class:`w-full`,shortcuts:e.shortcuts,"range-separator":e.$t(`usage.placeholder.to`),"start-placeholder":e.$t(`usage.placeholder.startDate`),"end-placeholder":e.$t(`usage.placeholder.endDate`),onChange:e.onTimeRangeChanged},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:3,lg:3,md:6,xs:24,class:`usage-filter`},{default:g(()=>[i(S,{modelValue:e.statusCodeFilter,"onUpdate:modelValue":c[3]||=t=>e.statusCodeFilter=t,placeholder:e.$t(`usage.option.statusCodeAll`),class:`w-full`,clearable:``,filterable:``,"allow-create":``,"default-first-option":``,loading:e.statusCodeOptionsLoading,onChange:e.onStatusCodeChange},{default:g(()=>[(w(!0),o(s,null,x(e.statusCodeOptions,e=>(w(),m(b,{key:e,label:String(e),value:String(e)},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`loading`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:4,lg:4,md:6,xs:24,class:`usage-filter usage-filter-export`},{default:g(()=>[i(T,{type:`primary`,plain:``,loading:e.exporting,class:`w-full whitespace-nowrap`,onClick:e.onExport},{default:g(()=>[i(te,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(e.$t(`usage.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1})):a(``,!0)]),_:1}),i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[e.type===e.serviceType.API?(w(),m(v,{key:0,gutter:15,class:`card-gap card-section-gap`},{default:g(()=>[i(_,{md:6,xs:24},{default:g(()=>[i(O,{shadow:`never`,class:`h-full`},{default:g(()=>[e.aggLoading?(w(),m(E,{key:0})):(w(),o(`div`,Le,[t(`div`,Re,[i(D,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),t(`div`,ze,[t(`p`,Be,r(e.$t(`usage.title.totalUsed`)),1),t(`p`,Ve,r(e.totalUsedString),1)])]))]),_:1})]),_:1}),i(_,{md:18,xs:24},{default:g(()=>[i(O,{shadow:`never`,class:`h-full`},{header:g(()=>[t(`div`,He,[t(`span`,Ue,r(e.$t(`usage.title.usageAnalytics`)),1),i(A,{modelValue:e.chartView,"onUpdate:modelValue":c[4]||=t=>e.chartView=t,size:`small`},{default:g(()=>[i(k,{value:`trend`,label:e.$t(`usage.view.trend`)},null,8,[`label`]),i(k,{value:`distribution`,label:e.$t(`usage.view.distribution`)},null,8,[`label`]),i(k,{value:`breakdown`,label:e.$t(`usage.view.breakdown`)},null,8,[`label`])]),_:1},8,[`modelValue`])])]),default:g(()=>[t(`div`,We,[e.aggLoading?(w(),m(E,{key:0,class:`w-full`})):e.chartView===`trend`?(w(),o(s,{key:1},[e.barChartSeries.length?(w(),m(ne,{key:0,data:e.barChartData,options:e.barChartOptions,class:`chart`},null,8,[`data`,`options`])):(w(),m(j,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):e.chartView===`distribution`?(w(),o(s,{key:2},[e.pieData.length?(w(),m(M,{key:0,data:e.doughnutChartData,options:e.doughnutChartOptions,class:`chart`},null,8,[`data`,`options`])):(w(),m(j,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):(w(),o(s,{key:3},[e.apiBreakdown.length?(w(),m(P,{key:0,data:e.apiBreakdown,size:`small`,height:`300`,class:`w-full`},{default:g(()=>[i(N,{label:e.$t(`usage.field.operation`),"min-width":`160`},{default:g(e=>[t(`span`,{class:`color-dot`,style:y({backgroundColor:e.row.color})},null,4),t(`span`,null,r(e.row.label),1)]),_:1},8,[`label`]),i(N,{label:e.$t(`usage.field.consumed`),width:`120`,align:`right`},{default:g(n=>[t(`span`,null,r(e.fmtAmount(n.row.amount)),1)]),_:1},8,[`label`]),i(N,{label:e.$t(`usage.field.share`),width:`150`},{default:g(e=>[t(`div`,Ge,[t(`div`,Ke,[t(`div`,{class:`share-bar-fill`,style:y({width:e.row.share*100+`%`,backgroundColor:e.row.color})},null,4)]),t(`span`,qe,r((e.row.share*100).toFixed(1))+`%`,1)])]),_:1},8,[`label`])]),_:1},8,[`data`])):(w(),m(j,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64))])]),_:1})]),_:1})]),_:1})):a(``,!0),i(O,{shadow:`never`},{default:g(()=>[t(`div`,Je,[t(`span`,Ye,r(e.$t(`usage.field.autoRefresh`)),1),i(F,{modelValue:e.autoRefresh,"onUpdate:modelValue":c[5]||=t=>e.autoRefresh=t},null,8,[`modelValue`])]),e.type===e.serviceType.API?f((w(),m(P,{key:0,data:e.apiUsages,stripe:``,"table-layout":`fixed`,"empty-text":e.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:g(()=>[i(N,{label:e.$t(`usage.field.service`),width:`180px`},{default:g(e=>[t(`span`,Xe,[e.row?.service?.icon_url?(w(),o(`img`,{key:0,src:e.row.service.icon_url,class:`usage-service-icon`,alt:``},null,8,Ze)):a(``,!0),t(`span`,null,r(e.row?.service?.title||`-`),1)])]),_:1},8,[`label`]),i(N,{label:e.$t(`usage.field.operation`),width:`180px`},{default:g(e=>[t(`span`,null,r(e.row?.api?.title||`-`),1)]),_:1},8,[`label`]),i(N,{label:e.$t(`usage.field.statusCode`),width:`120px`},{default:g(t=>[t.row.status_code?(w(),o(`span`,Qe,r(t.row.status_code),1)):(w(),m(I,{key:1,tone:`warning`,density:`compact`},{default:g(()=>[n(r(e.$t(`usage.value.processing`)),1)]),_:1}))]),_:1},8,[`label`]),i(N,{label:e.$t(`usage.field.elapsed`),width:`120px`},{default:g(n=>[t(`span`,null,r(e.formatElapsed(n.row.elapsed)),1)]),_:1},8,[`label`]),i(N,{prop:`deducted_amount`,label:e.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:g(i=>[e.isX402Usage(i.row)?(w(),o(`div`,$e,[e.getX402Payment(i.row)?(w(),o(s,{key:0},[t(`span`,null,r(e.getX402Payment(i.row)?.amount)+` `+r(e.getX402Payment(i.row)?.currency),1),e.getX402Payment(i.row)?.originalAmount?(w(),o(`div`,et,[t(`del`,null,r(e.getX402Payment(i.row)?.originalAmount)+` `+r(e.getX402Payment(i.row)?.currency),1)])):a(``,!0),e.getX402Payment(i.row)?.discountPercent?(w(),m(L,{key:1,tone:`success`,density:`compact`},{default:g(()=>[n(r(e.getX402DiscountLabel(i.row)),1)]),_:2},1024)):a(``,!0)],64)):(w(),o(`span`,tt,r(e.$t(`usage.value.paymentUnavailable`)),1))])):e.getDeductedAmount(i.row)===e.getOriginalAmount(i.row)?(w(),o(`div`,nt,[t(`span`,null,r(e.getDeductedAmount(i.row)),1)])):(w(),o(`div`,rt,[c[8]||=t(`p`,null,null,-1),t(`p`,null,[t(`span`,null,r(e.getDeductedAmount(i.row)),1)]),t(`p`,null,[t(`del`,null,r(e.getOriginalAmount(i.row)),1)])]))]),_:1},8,[`label`]),i(N,{prop:`remaining_amount`,label:e.$t(`usage.field.balanceAfter`),width:`190px`,"class-name":`text-center`},{default:g(s=>[e.isX402Usage(s.row)?(w(),o(`div`,it,[t(`div`,at,[e.getX402Payment(s.row)?.explorerUrl?(w(),o(`a`,{key:0,href:e.getX402Payment(s.row)?.explorerUrl,target:`_blank`,rel:`noopener noreferrer`,class:`truncate text-primary`},[n(r(e.$t(`usage.button.viewTransaction`))+` `,1),i(R,{class:`ml-1 inline-block h-3.5 w-3.5`})],8,ot)):e.getX402Transaction(s.row)?(w(),o(`span`,st,r(s.row.metadata?.x402_settle_attempt_tx?`${e.$t(`usage.value.attemptTransaction`)}: `:``)+r(e.shortTransaction(e.getX402Transaction(s.row))),1)):a(``,!0),e.getX402Transaction(s.row)?(w(),m(z,{key:2,content:e.getX402Transaction(s.row),class:`inline-block shrink-0`},null,8,[`content`])):a(``,!0)]),t(`div`,ct,r(e.$t(e.getX402Payment(s.row)?`usage.value.onChainBalanceNote`:e.getX402StatusKey(s.row))),1)])):(w(),o(`span`,lt,r(e.getRemainingAmount(s.row)),1))]),_:1},8,[`label`]),i(N,{prop:`metadata`,label:e.$t(`usage.field.metadata`),width:`260px`,"class-name":`text-center`},{default:g(c=>[t(`div`,ut,[!e.isX402Usage(c.row)&&c.row.original_amount>c.row.deducted_amount&&c.row.original_amount>0?(w(),m(L,{key:0,tone:`success`,class:`usage-metadata-tag`},{default:g(()=>[n(r(((c.row.original_amount-c.row.deducted_amount)*100/c.row.original_amount).toFixed(0)+`% OFF`),1)]),_:2},1024)):a(``,!0),e.isX402Usage(c.row)?(w(),o(`div`,dt,[i(I,{tone:e.getX402StatusType(c.row)},{default:g(()=>[n(r(e.$t(e.getX402StatusKey(c.row))),1)]),_:2},1032,[`tone`])])):a(``,!0),(w(!0),o(s,null,x(e.getSimpleMetadata(c.row.metadata),(e,t)=>(w(),m(L,{key:t,class:`usage-metadata-tag`},{default:g(()=>[n(r(t)+`: `+r(e),1)]),_:2},1024))),128))])]),_:1},8,[`label`]),i(N,{label:e.$t(`usage.button.viewDetail`),width:`120px`,"class-name":`text-center`},{default:g(t=>[t.row.id?(w(),m(T,{key:0,type:`primary`,plain:``,size:`small`,class:`!px-2 !py-1 !text-xs !h-auto !min-h-0`,onClick:n=>e.onShowDetail(t.row)},{default:g(()=>[n(r(e.$t(`usage.button.viewDetail`)),1)]),_:1},8,[`onClick`])):a(``,!0)]),_:1},8,[`label`]),i(N,{prop:`trace_id`,label:e.$t(`application.field.traceId`),width:`200px`,"class-name":`text-center`},{default:g(e=>[t(`span`,ft,r(e.row.trace_id),1),e.row.trace_id?(w(),o(`span`,pt,[i(z,{content:e.row.trace_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(N,{prop:`credential_id`,label:e.$t(`usage.field.credential`),width:`200px`,"class-name":`text-center`},{default:g(n=>[t(`span`,mt,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(w(),o(`span`,ht,[i(z,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(N,{label:e.$t(`usage.field.createdAt`),width:`200px`},{default:g(n=>[t(`span`,gt,r(e.$dayjs.format(n.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[W,e.loading]]):a(``,!0),e.type===e.serviceType.Proxy?f((w(),m(P,{key:1,data:e.proxyUsages,stripe:``,"table-layout":`fixed`,"empty-text":e.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:g(()=>[i(N,{label:e.$t(`application.field.name`),width:`160px`},{default:g(e=>[t(`span`,null,r(e.row?.service?.title),1)]),_:1},8,[`label`]),i(N,{prop:`remaining_amount`,label:e.$t(`usage.field.remainingAmount`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1),t(`span`,null,r(e.getOriginalAmount(n.row)),1)]),_:1},8,[`label`]),i(N,{prop:`deducted_amount`,label:e.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getDeductedAmount(n.row)),1)]),_:1},8,[`label`]),i(N,{label:e.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1)]),_:1},8,[`label`]),i(N,{prop:`metadata`,label:e.$t(`usage.field.metadata`),width:`200px`,"class-name":`text-center`},{default:g(e=>[(w(!0),o(s,null,x(e.row.metadata,(e,t)=>(w(),m(L,{key:t,class:`mb-2`},{default:g(()=>[n(r(t)+`: `+r(e),1)]),_:2},1024))),128))]),_:1},8,[`label`]),i(N,{prop:`credential_id`,label:e.$t(`usage.field.credential`),width:`200px`,"class-name":`text-center`},{default:g(n=>[t(`span`,_t,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(w(),o(`span`,vt,[i(z,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(N,{label:e.$t(`usage.field.createdAt`),width:`200px`},{default:g(n=>[t(`span`,yt,r(e.$dayjs.format(n.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[W,e.loading]]):a(``,!0)]),_:1})]),_:1})]),_:1}),i(H,{modelValue:e.detailDialogVisible,"onUpdate:modelValue":c[7]||=t=>e.detailDialogVisible=t,title:e.$t(`usage.dialog.detailTitle`),width:`70%`,top:`5vh`,"destroy-on-close":``},{default:g(()=>[i(V,{modelValue:e.detailActiveTab,"onUpdate:modelValue":c[6]||=t=>e.detailActiveTab=t},{default:g(()=>[e.detailRow&&e.isX402Usage(e.detailRow)?(w(),m(B,{key:0,label:e.$t(`usage.dialog.payment`),name:`payment`},{default:g(()=>[e.detailLoading?(w(),m(E,{key:0,rows:6,animated:``})):(w(),o(`dl`,bt,[t(`dt`,null,r(e.$t(`usage.field.status`)),1),t(`dd`,null,[i(I,{tone:e.getX402StatusType(e.detailRow)},{default:g(()=>[n(r(e.$t(e.getX402StatusKey(e.detailRow))),1)]),_:1},8,[`tone`]),e.detailRow.metadata?.x402_settle_error?(w(),o(`span`,xt,r(e.detailRow.metadata.x402_settle_error),1)):a(``,!0)]),t(`dt`,null,r(e.$t(`usage.field.paidAmount`)),1),e.getX402Payment(e.detailRow)?(w(),o(`dd`,St,[t(`span`,null,r(e.getX402Payment(e.detailRow)?.amount)+` `+r(e.getX402Payment(e.detailRow)?.currency),1),e.getX402Payment(e.detailRow)?.originalAmount?(w(),o(`del`,Ct,r(e.getX402Payment(e.detailRow)?.originalAmount)+` `+r(e.getX402Payment(e.detailRow)?.currency),1)):a(``,!0),e.getX402Payment(e.detailRow)?.discountPercent?(w(),m(L,{key:1,tone:`success`,class:`ml-2`,density:`compact`},{default:g(()=>[n(r(e.getX402DiscountLabel(e.detailRow)),1)]),_:1})):a(``,!0)])):(w(),o(`dd`,wt,r(e.$t(`usage.value.paymentUnavailable`)),1)),t(`dt`,null,r(e.$t(`usage.field.network`)),1),t(`dd`,null,r(e.detailRow.metadata?.x402_network||`-`),1),t(`dt`,null,r(e.$t(`usage.field.payer`)),1),t(`dd`,Tt,r(e.detailRow.metadata?.x402_payer||`-`),1),t(`dt`,null,r(e.detailRow.metadata?.x402_settle_attempt_tx?e.$t(`usage.value.attemptTransaction`):e.$t(`usage.field.transaction`)),1),t(`dd`,Et,[n(r(e.getX402Transaction(e.detailRow)||`-`)+` `,1),e.getX402Transaction(e.detailRow)?(w(),m(z,{key:0,content:e.getX402Transaction(e.detailRow),class:`inline-block`},null,8,[`content`])):a(``,!0),e.getX402Payment(e.detailRow)?.explorerUrl?(w(),o(`a`,{key:1,href:e.getX402Payment(e.detailRow)?.explorerUrl,target:`_blank`,rel:`noopener noreferrer`,class:`ml-2 text-primary`},[n(r(e.$t(`usage.button.viewTransaction`))+` `,1),i(R,{class:`ml-1 inline-block h-3.5 w-3.5`})],8,Dt)):a(``,!0)])]))]),_:1},8,[`label`])):a(``,!0),i(B,{label:e.$t(`usage.dialog.request`),name:`request`},{default:g(()=>[e.detailLoading?(w(),m(E,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.request?(w(),o(`pre`,Ot,r(e.formatJson(e.detailRow.metadata.request)),1)):(w(),o(`p`,kt,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`]),i(B,{label:e.$t(`usage.dialog.response`),name:`response`},{default:g(()=>[e.detailLoading?(w(),m(E,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.response?(w(),o(`pre`,At,r(e.formatJson(e.detailRow.metadata.response)),1)):(w(),o(`p`,jt,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`]),i(v,null,{default:g(()=>[i(_,{span:10,offset:14},{default:g(()=>[t(`div`,Mt,[i(U,{"current-page":e.page,"page-size":e.limit,total:e.total,onChange:e.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var Pt=ae(ke,[[`render`,Nt],[`__scopeId`,`data-v-8b19381b`]]);export{Pt as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,N as i,T as a,at as o,ht as s,j as c,mt as l,ot as u,rt as d,tt as f,z as p}from"./vendor-chart-Dw-P17PN.js";import{r as m,t as h}from"./select-Ctt4vMla.js";import{n as ee,t as g}from"./table-B3Y40ujp.js";import{c as _}from"./vuex.esm-bundler-C-5WV-ta.js";import{t as v}from"./card-IQwqnRJR.js";import{t as y}from"./date-picker-B72Rk5Dt.js";import{n as b,t as x}from"./row-BxSRQSNe.js";import{t as S}from"./skeleton-Dj_a_iIP.js";import{t as C}from"./pagination-CoQKuK4D.js";import{t as w}from"./circle-check-D_FoW3dP.js";import{t as T}from"./clock-CvHl_Vd7.js";import{t as E}from"./dollar-sign-CKl6b5bP.js";import{t as D}from"./file-output-DncNlmtQ.js";import{D as O,En as k,Ja as A,Ka as j,Zr as M,co as N}from"./index-C8uXmX2U.js";import{t as P}from"./CopyToClipboard-CdXnxkau.js";var F=A(`receipt`,[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]),I={total_count:0,total_spent:0,state_counts:{}},L=p({name:`ConsoleOrderList`,components:{StatusBadge:j,ExportIcon:D,MoneyIcon:E,ReceiptIcon:F,SuccessIcon:w,TimeIcon:T,Pagination:C,CopyToClipboard:P,ElRow:x,ElCol:b,ElTable:g,ElTableColumn:ee,ElButton:N,ElCard:v,ElSelect:m,ElOption:h,ElDatePicker:y,ElSkeleton:S},data(){return{OrderState:_,orders:[],loading:!1,total:void 0,limit:10,filterState:this.$route.query.state?.toString()||``,filterPayWay:this.$route.query.pay_way?.toString()||``,createdAtRange:(()=>{let e=this.$route.query.created_at_from?.toString(),t=this.$route.query.created_at_to?.toString();if(e&&t)return[new Date(e),new Date(t)]})(),summary:{...I},summaryLoading:!1,exporting:!1,shortcuts:[{text:this.$t(`usage.shortcuts.today`),value:()=>{let e=new Date,t=new Date;return t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.last7Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-7),[t,e]}},{text:this.$t(`usage.shortcuts.last1Month`),value:()=>{let e=new Date,t=new Date;return t.setMonth(t.getMonth()-1),[t,e]}}]}},computed:{page(){return parseInt(this.$route.query.page?.toString()||`1`)},stateOptions(){return[{value:_.PENDING,label:this.$t(`order.state.pending`)},{value:_.FINISHED,label:this.$t(`order.state.finished`)},{value:_.PAID,label:this.$t(`order.state.paid`)},{value:_.EXPIRED,label:this.$t(`order.state.expired`)},{value:_.FAILED,label:this.$t(`order.state.failed`)},{value:_.REFUNDED,label:this.$t(`order.state.refunded`)}]},payWayOptions(){return[{value:`WechatPay`,label:this.$t(`order.title.wechatPay`)},{value:`Stripe`,label:this.$t(`order.title.stripe`)},{value:`Card`,label:this.$t(`order.title.card`)},{value:`Airwallex`,label:this.$t(`order.title.card`)},{value:`AliPay`,label:this.$t(`order.title.aliPay`)},{value:`X402`,label:this.$t(`order.title.x402`)},{value:`PayPal`,label:this.$t(`order.title.paypal`)}]},filterQuery(){let e={user_id:this.$store.getters.user?.id};return this.filterState&&(e.state=this.filterState),this.filterPayWay&&(e.pay_way=this.filterPayWay),this.createdAtRange?.[0]&&(e.created_at_from=this.createdAtRange[0]),this.createdAtRange?.[1]&&(e.created_at_to=this.createdAtRange[1]),e}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onFetchData(),this.onFetchSummary()},methods:{payWayLabel(e){return e?e===`Airwallex`?this.$t(`order.title.card`):e:`-`},getPriceString:k,stateTagType(e){return e===_.FINISHED||e===_.PAID?`success`:e===_.FAILED?`danger`:e===_.EXPIRED||e===_.REFUNDED?`warning`:`info`},stateLabel(e){return{[_.PENDING]:this.$t(`order.state.pending`),[_.PAID]:this.$t(`order.state.paid`),[_.FINISHED]:this.$t(`order.state.finished`),[_.EXPIRED]:this.$t(`order.state.expired`),[_.FAILED]:this.$t(`order.state.failed`),[_.REFUNDED]:this.$t(`order.state.refunded`)}[e]||e},isPendingAction(e){return e!==_.PAID&&e!==_.FINISHED&&e!==_.EXPIRED&&e!==_.FAILED&&e!==_.REFUNDED},goToDetail(e){this.$router.push({name:`console-order-detail`,params:{id:e}})},async onFilterChange(){await this.$router.push({name:this.$route.name?.toString(),query:{page:1,...this.filterState?{state:this.filterState}:{},...this.filterPayWay?{pay_way:this.filterPayWay}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0].toISOString()}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1].toISOString()}:{}}}),this.onFetchData(),this.onFetchSummary()},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchData(){this.loading=!0,M.getAll({ordering:`-created_at`,limit:this.limit,offset:(this.page-1)*this.limit,...this.filterQuery}).then(({data:e})=>{this.orders=e.items,this.total=e.count}).catch(()=>{}).finally(()=>{this.loading=!1})},onFetchSummary(){this.summaryLoading=!0,M.getSummary(this.filterQuery).then(({data:e})=>{this.summary=e}).catch(()=>{this.summary={...I}}).finally(()=>{this.summaryLoading=!1})},onExport(){this.exporting=!0,M.exportCsv(this.filterQuery).then(({data:e})=>{let t=window.URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`orders.csv`,n.click(),window.URL.revokeObjectURL(t)}).catch(()=>{}).finally(()=>{this.exporting=!1})}}}),R={class:`title`},z={key:1,class:`card-content`},B={class:`icon-wrapper`},V={class:`description`},H={class:`value`},U={key:1,class:`card-content`},W={class:`icon-wrapper`},G={class:`description`},K={class:`value`},q={key:1,class:`card-content`},J={class:`icon-wrapper`},te={class:`description`},Y={class:`value`},X={key:1,class:`card-content`},Z={class:`icon-wrapper`},Q={class:`description`},ne={class:`value`},re={class:`filter-row mb-3`},$={class:`key`},ie={class:`cursor-pointer`},ae={class:`price`},oe={class:`description`},se={class:`text-gray-500`},ce={class:`created-at`},le={class:`flex items-center justify-center flex-wrap`},ue={class:`float-right`};function de(p,m,h,ee,g,_){let v=o(`el-col`),y=o(`el-row`),b=o(`el-skeleton`),x=o(`receipt-icon`),S=o(`el-card`),C=o(`money-icon`),w=o(`success-icon`),T=o(`time-icon`),E=o(`el-option`),D=o(`el-select`),O=o(`el-date-picker`),k=o(`export-icon`),A=o(`el-button`),j=o(`copy-to-clipboard`),M=o(`el-table-column`),N=o(`status-badge`),P=o(`el-table`),F=o(`pagination`),I=u(`loading`);return f(),c(y,{class:`panel`},{default:l(()=>[r(v,{span:24},{default:l(()=>[r(y,null,{default:l(()=>[r(v,{span:24},{default:l(()=>[e(`h2`,R,n(p.$t(`common.title.allOrders`)),1)]),_:1})]),_:1}),r(y,{gutter:15,class:`card-gap card-section-gap`},{default:l(()=>[r(v,{md:6,sm:12,xs:24},{default:l(()=>[r(S,{shadow:`never`,class:`item-mini`},{default:l(()=>[p.summaryLoading?(f(),c(b,{key:0})):(f(),i(`div`,z,[e(`div`,B,[r(x,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,V,n(p.$t(`order.title.totalOrders`)),1),e(`p`,H,n(p.summary.total_count),1)]))]),_:1})]),_:1}),r(v,{md:6,sm:12,xs:24},{default:l(()=>[r(S,{shadow:`never`,class:`item-mini`},{default:l(()=>[p.summaryLoading?(f(),c(b,{key:0})):(f(),i(`div`,U,[e(`div`,W,[r(C,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,G,n(p.$t(`order.title.totalSpent`)),1),e(`p`,K,n(p.getPriceString({value:p.summary.total_spent})),1)]))]),_:1})]),_:1}),r(v,{md:6,sm:12,xs:24},{default:l(()=>[r(S,{shadow:`never`,class:`item-mini`},{default:l(()=>[p.summaryLoading?(f(),c(b,{key:0})):(f(),i(`div`,q,[e(`div`,J,[r(w,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,te,n(p.$t(`order.title.finishedOrders`)),1),e(`p`,Y,n(p.summary.state_counts?.Finished||0),1)]))]),_:1})]),_:1}),r(v,{md:6,sm:12,xs:24},{default:l(()=>[r(S,{shadow:`never`,class:`item-mini`},{default:l(()=>[p.summaryLoading?(f(),c(b,{key:0})):(f(),i(`div`,X,[e(`div`,Z,[r(T,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,Q,n(p.$t(`order.title.pendingOrders`)),1),e(`p`,ne,n(p.summary.state_counts?.Pending||0),1)]))]),_:1})]),_:1})]),_:1}),e(`div`,re,[r(D,{modelValue:p.filterState,"onUpdate:modelValue":m[0]||=e=>p.filterState=e,clearable:``,placeholder:p.$t(`order.field.allStates`),class:`filter-select`,onChange:p.onFilterChange},{default:l(()=>[(f(!0),i(a,null,d(p.stateOptions,e=>(f(),c(E,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(D,{modelValue:p.filterPayWay,"onUpdate:modelValue":m[1]||=e=>p.filterPayWay=e,clearable:``,placeholder:p.$t(`order.field.allPayWays`),class:`filter-select`,onChange:p.onFilterChange},{default:l(()=>[(f(!0),i(a,null,d(p.payWayOptions,e=>(f(),c(E,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(O,{modelValue:p.createdAtRange,"onUpdate:modelValue":m[2]||=e=>p.createdAtRange=e,type:`datetimerange`,shortcuts:p.shortcuts,"range-separator":p.$t(`usage.placeholder.to`),"start-placeholder":p.$t(`usage.placeholder.startDate`),"end-placeholder":p.$t(`usage.placeholder.endDate`),onChange:p.onFilterChange},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`]),r(A,{type:`primary`,plain:``,loading:p.exporting,onClick:p.onExport},{default:l(()=>[r(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`order.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),r(y,null,{default:l(()=>[r(v,{span:24},{default:l(()=>[r(S,{shadow:`never`},{default:l(()=>[s((f(),c(P,{data:p.orders,stripe:``,"empty-text":p.$t(`common.message.noData`),class:`min-h-[calc(100vh-450px)] mb-[20px]`},{default:l(()=>[r(M,{prop:`id`,label:p.$t(`order.field.id`),"class-name":`text-center`,width:`200px`},{default:l(t=>[e(`span`,$,n(t.row.id),1),e(`span`,ie,[r(j,{content:t.row.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(M,{label:p.$t(`order.field.price`),width:`110px`,align:`center`},{default:l(t=>[e(`span`,ae,n(p.getPriceString({value:t.row?.price})),1)]),_:1},8,[`label`]),r(M,{label:p.$t(`order.field.description`),"min-width":`220px`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:l(t=>[e(`span`,oe,n(t.row.description),1)]),_:1},8,[`label`]),r(M,{prop:`state`,label:p.$t(`order.field.state`),width:`130px`,align:`center`},{default:l(e=>[r(N,{tone:p.stateTagType(e.row.state),class:`mx-1`,density:`compact`},{default:l(()=>[t(n(p.stateLabel(e.row.state)),1)]),_:2},1032,[`tone`])]),_:1},8,[`label`]),r(M,{label:p.$t(`order.field.payWay`),width:`120px`,align:`center`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:l(t=>[e(`span`,se,n(p.payWayLabel(t.row.pay_way)),1)]),_:1},8,[`label`]),r(M,{label:p.$t(`order.field.createdAt`),width:`200px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:l(t=>[e(`span`,ce,n(p.$dayjs.format(t.row.created_at)),1)]),_:1},8,[`label`]),r(M,{"min-width":`130px`,fixed:`right`},{default:l(r=>[e(`div`,le,[p.isPendingAction(r.row.state)?(f(),c(A,{key:0,type:`primary`,size:`small`,onClick:e=>p.goToDetail(r.row.id)},{default:l(()=>[t(n(p.$t(`order.button.continuePay`)),1)]),_:1},8,[`onClick`])):(f(),c(A,{key:1,size:`small`,onClick:e=>p.goToDetail(r.row.id)},{default:l(()=>[t(n(p.$t(`order.button.checkDetail`)),1)]),_:1},8,[`onClick`]))])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[I,p.loading]])]),_:1})]),_:1})]),_:1}),r(y,null,{default:l(()=>[r(v,{span:10,offset:14},{default:l(()=>[e(`div`,ue,[r(F,{"current-page":p.page,"page-size":p.limit,total:p.total,onChange:p.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var fe=O(L,[[`render`,de],[`__scopeId`,`data-v-f6a1f8de`]]);export{fe as default};
@@ -0,0 +1,5 @@
1
+ import{r as e}from"./rolldown-runtime--c01j_DQ.js";import{A as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,j as l,mt as u,rt as d,st as f,tt as p,z as m}from"./vendor-chart-Dw-P17PN.js";import{t as ee}from"./switch-DfKiiyLD.js";import{t as h}from"./file-DmSI4aV7.js";import{t as g}from"./folder-uXRfk1mZ.js";import{t as _}from"./mouse-pointer-2-DAKfL4eZ.js";import{t as v}from"./pencil-D6KQdtCj.js";import{t as y}from"./plus-8qHkLr4t.js";import{t as b}from"./shield-CNEip5QK.js";import{t as x}from"./terminal-CoZlBFes.js";import{t as S}from"./wand-sparkles-CdzPtG8R.js";import{$a as C}from"./constants-CspFM8fh.js";import{D as w,Ga as T,Ha as E,Ja as D,Ka as te,co as ne,ea as O,go as k,k as A}from"./index-C8uXmX2U.js";var j=D(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),M=D(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),N=D(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),P=D(`move`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m19 9 3 3-3 3`,key:`1mg7y2`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`m5 9-3 3 3 3`,key:`j64kie`}],[`path`,{d:`m9 5 3-3 3 3`,key:`l8vdw6`}]]),F=m({name:`LocalToolsSetting`,components:{MetaTag:T,StatusBadge:te,AddIcon:y,ElButton:ne,ElSwitch:ee,ElInput:k,FolderIcon:g,MagicIcon:S,SecurityIcon:b},data(){return{roots:[],workingDir:``,pickingWorkingDir:!1,tools:[],mcpServers:[],mcpUid:0,mcpStatuses:[],mcpBusy:null,savingMcp:!1,mcpSavedTip:!1,mcpError:``,grants:null,perm:null,computerUse:!1,computerTools:[],computerGrants:{},cuBusy:null,builtinTools:[],mcpTools:[],toolGrants:{},builtinBusy:null,savingCU:!1,preauthorizing:!1,saving:!1,savedTip:!1,a11yEnabled:!1,xhsSkill:null,xhsLoading:!1,xhsInstalling:!1,xhsError:``,onFocus:null,cuOff:null,a11yPoll:null,refreshingA11y:!1}},computed:{desktop(){return!!A()},android(){return C()},canInstallXhs(){return this.a11yEnabled&&this.computerUse}},async mounted(){let e=A();if(!e)return;let t=await e.getConfig();this.roots=t.roots,this.workingDir=t.workingDir??``,this.computerUse=t.computerUse===!0,this.mcpServers=(t.mcp??[]).map(e=>({_uid:this.mcpUid++,id:e.id,command:e.command,argsText:(e.args??[]).join(`
2
+ `),envText:Object.entries(e.env??{}).map(([e,t])=>`${e}=${t}`).join(`
3
+ `),enabled:e.enabled!==!1})),this.mcpStatuses=await e.mcp?.status()??[],this.tools=(await e.listTools()).map(e=>e.name),this.computerTools=await e.computerTools?.()??[],this.builtinTools=await e.builtinTools?.()??[],this.mcpTools=await e.mcpTools?.()??[];let n=await e.perm?.status();n?.mac&&(this.perm=n),await this.loadGrants(),this.android&&(await this.refreshA11y(),this.fetchXhsSkill(),this.onFocus=()=>{document.visibilityState===`visible`&&this.refreshA11y()},document.addEventListener(`visibilitychange`,this.onFocus),this.a11yPoll=window.setInterval(()=>{document.visibilityState===`visible`&&this.refreshA11y()},3e3)),this.cuOff=e.onComputerUseDisabled?.(()=>{this.computerUse=!1})??null},beforeUnmount(){this.cuOff?.(),this.onFocus&&document.removeEventListener(`visibilitychange`,this.onFocus),this.a11yPoll&&clearInterval(this.a11yPoll)},methods:{async refreshA11y(){if(!this.refreshingA11y){this.refreshingA11y=!0;try{let e=await A()?.perm?.status();this.a11yEnabled=e?.accessibility===!0}finally{this.refreshingA11y=!1}}},async openAndroidAccessibility(){await A()?.perm?.openPane(`accessibility`)},async fetchXhsSkill(){this.xhsLoading=!0,this.xhsError=``;try{let e=await O.get(`/skills/`,{baseURL:`${E()}/api/v1`,params:{q:`xhs-dm`,limit:10}}),t=Array.isArray(e.data?.items)?e.data.items:[];this.xhsSkill=t.find(e=>e.identifier?.endsWith(`/xhs-dm`))??null}catch(e){console.warn(`[LocalTools] fetch xhs skill failed`,e),this.xhsSkill=null,this.xhsError=this.$t(`common.settings.localToolsAndroidSkillsLoadFailed`)}finally{this.xhsLoading=!1}},async installXhs(){let e=this.xhsSkill;if(!(!e||e.installed)){this.xhsInstalling=!0,this.xhsError=``;try{await O.post(`/skills/${e.id}/install/`,{},{baseURL:`${E()}/api/v1`}),e.installed=!0}catch(t){t?.response?.status===409?e.installed=!0:this.xhsError=this.$t(`common.settings.localToolsAndroidSkillsInstallFailed`)}finally{this.xhsInstalling=!1}}},async loadGrants(){let e=A();if(!e?.grants){this.grants=null;return}let t=await e.grants.list(),n={},r={},i=new Set(this.builtinTools.map(e=>e.name)),a=new Set(this.mcpTools.map(e=>e.name)),o=[];for(let e of t){if(e.startsWith(`computer.`)&&!e.includes(`:`)){n[e]=!0;continue}if(!e.includes(`:`)&&(i.has(e)||a.has(e))){r[e]=!0;continue}if(e.startsWith(`dir:`)){let t=e.slice(4),n=t.indexOf(`:`);if(n>0){o.push({key:e,name:t.slice(0,n),input:`📁 ${t.slice(n+1)}`});continue}}let t=e.indexOf(`:{`),s=t>=0?t:e.indexOf(`:`);o.push({key:e,name:s>=0?e.slice(0,s):e,input:s>=0?e.slice(s+1):``})}this.computerGrants=n,this.toolGrants=r,this.grants=o},async chooseWorkingDir(){if(!this.pickingWorkingDir){this.pickingWorkingDir=!0;try{let e=await A()?.pickFolder();if(!e)return;let t=await A()?.getConfig();await A()?.saveConfig({roots:t?.roots??this.roots,mcp:t?.mcp??[],computerUse:this.computerUse,workingDir:e}),this.workingDir=e}finally{this.pickingWorkingDir=!1}}},async addFolder(){let e=await A()?.pickFolder();e&&!this.roots.includes(e)&&this.roots.push(e)},removeRoot(e){this.roots.splice(e,1)},addMcp(){this.mcpServers.push({_uid:this.mcpUid++,id:``,command:``,argsText:``,envText:``,enabled:!0})},removeMcp(e){this.mcpServers.splice(e,1)},mcpStatusFor(e){let t=e.trim();return this.mcpStatuses.find(e=>e.id===t)},mcpBadgeType(e){let t=this.mcpStatusFor(e)?.status;return t===`connected`?`success`:t===`failed`?`danger`:`info`},mcpBadgeText(e){let t=this.mcpStatusFor(e);return this.mcpBusy===e.trim()?this.$t(`common.settings.localToolsMcpConnecting`):t?t.status===`connected`?this.$t(`common.settings.localToolsMcpConnected`,{n:t.toolCount}):t.status===`disabled`?this.$t(`common.settings.localToolsMcpDisabled`):this.$t(`common.settings.localToolsMcpFailed`):this.$t(`common.settings.localToolsMcpNotSaved`)},mcpErrorFor(e){let t=this.mcpStatusFor(e);return t?.status===`failed`&&t.error?t.error:``},buildMcpPayload(){this.mcpError=``;let e=[],t=new Set;for(let n of this.mcpServers){let r=n.id.trim(),i=n.command.trim();if(!r||!i)return this.mcpError=this.$t(`common.settings.localToolsMcpNameRequired`),null;if(!/^[A-Za-z0-9_-]+$/.test(r))return this.mcpError=this.$t(`common.settings.localToolsMcpNameInvalid`),null;if(t.has(r))return this.mcpError=this.$t(`common.settings.localToolsMcpDuplicateName`),null;t.add(r);let a=n.argsText.split(`
4
+ `).map(e=>e.trim()).filter(Boolean),o={};for(let e of n.envText.split(`
5
+ `)){let t=e.trim();if(!t)continue;let n=t.indexOf(`=`);n<=0||(o[t.slice(0,n).trim()]=t.slice(n+1).trim())}let s={id:r,command:i,args:a,enabled:n.enabled!==!1};Object.keys(o).length&&(s.env=o),e.push(s)}return e},async saveMcp(){let e=this.buildMcpPayload();if(!e)return!1;this.savingMcp=!0;try{let t=await A()?.getConfig();return await A()?.saveConfig({roots:t?.roots??this.roots,mcp:e,computerUse:this.computerUse}),await this.refreshMcpStatus(),this.mcpSavedTip=!0,setTimeout(()=>this.mcpSavedTip=!1,2e3),!0}finally{this.savingMcp=!1}},async refreshMcpStatus(){let e=A();e&&(this.mcpStatuses=await e.mcp?.status()??[],this.tools=(await e.listTools())?.map(e=>e.name)??this.tools,this.mcpTools=await e.mcpTools?.()??[],await this.loadGrants())},async onToggleMcpEnabled(e){await this.saveMcp()||(e.enabled=!e.enabled)},async reconnectMcp(e){let t=e.id.trim();if(!t||!e.command.trim())return;let n=this.buildMcpPayload();if(n){this.mcpBusy=t;try{let e=await A()?.getConfig();await A()?.saveConfig({roots:e?.roots??this.roots,mcp:n,computerUse:this.computerUse}),await A()?.mcp?.reconnect(t),await this.refreshMcpStatus()}finally{this.mcpBusy=null}}},async open(e){await A()?.perm?.openPane(e)},async save(){this.saving=!0;let e=await A()?.getConfig();await A()?.saveConfig({roots:this.roots,mcp:e?.mcp??[],computerUse:this.computerUse}),this.saving=!1,this.savedTip=!0,setTimeout(()=>this.savedTip=!1,2e3)},async onToggleComputerUse(e){this.savingCU=!0;let t=await A()?.getConfig();if(await A()?.saveConfig({roots:t?.roots??this.roots,mcp:t?.mcp??[],computerUse:e===!0}),this.savingCU=!1,e===!0&&this.android){let e=(await A()?.perm?.status())?.accessibility===!0;this.a11yEnabled=e,e||await this.openAndroidAccessibility()}},async preauthorizeAll(){let e=A();if(e?.preauthorizeComputerUse){this.preauthorizing=!0;try{let t=await e.preauthorizeComputerUse();this.computerUse=t.computerUse===!0,t.perm?.mac&&(this.perm=t.perm),await this.loadGrants()}finally{this.preauthorizing=!1}}},async onToggleComputerTool(e,t){let n=A();if(n){this.cuBusy=e;try{if(t===!0){let t=await n.preauthorizeComputerUse?.([e]);t&&(this.computerUse=t.computerUse===!0,t.perm?.mac&&(this.perm=t.perm))}else await n.grants?.revoke(e);await this.loadGrants()}finally{this.cuBusy=null}}},cuLabel(e){let t=`common.settings.localToolsCu${this.cuSuffix(e)}`,n=this.$t(t);return n===t?e.replace(/^computer\./,``):n},cuIcon(e){return{screenshot:M,click:_,move:P,type:N,key:N,scroll:j}[e.replace(/^computer\./,``)]??b},cuSuffix(e){let t=e.replace(/^computer\./,``);return t.charAt(0).toUpperCase()+t.slice(1)},async onToggleBuiltinTool(e,t){let n=A();if(n?.grants){this.builtinBusy=e;try{t===!0?(await n.grants.grantToolWide?.(e))?.ok||(this.toolGrants={...this.toolGrants,[e]:!1}):await n.grants.revoke(e),await this.loadGrants()}finally{this.builtinBusy=null}}},builtinIcon(e){return e===`shell.run_command`?x:e===`fs.write_file`?v:e===`fs.read_file`?h:e===`fs.list_dir`?g:b},async revoke(e){await A()?.grants?.revoke(e),await this.loadGrants()},async revokeAll(){await A()?.grants?.clear(),await this.loadGrants()}}}),I=e({default:()=>$}),L={class:`settings-list card-gap local-tools-setting`},R={key:0,class:`hint muted`},z={key:0},B={class:`section-head`},V={class:`muted`},H={class:`perm-row`},U={class:`perm-name`},W={key:1},G={class:`section-head`},K={class:`muted`},q={class:`rows`},J={class:`path`},Y={key:0,class:`row muted empty`},X={class:`actions`},Z={key:0,class:`muted saved-tip`},re={key:0,class:`muted tools`},ie={key:2},ae={class:`section-head`},oe={class:`muted`},se={class:`rows`},ce={key:0,class:`row`},le={class:`path`},ue={key:1,class:`row muted empty`},de={class:`section-head`},fe={class:`muted`},pe={key:0,class:`rows`},me={class:`mcp-fields`},he={class:`mcp-head`},ge={class:`mcp-grid`},_e={class:`mcp-flabel`},ve={class:`mcp-flabel`},ye={class:`mcp-flabel top`},be={class:`mcp-flabel top`},xe={key:0,class:`mcp-row-error`},Se={key:1,class:`muted`},Ce={class:`muted mcp-platform-hint`},we={class:`actions`},Te={key:0,class:`muted saved-tip`},Ee={key:1,class:`mcp-error`},De={key:3},Oe={class:`section-head`},ke={class:`muted`},Ae={class:`rows`},je={class:`grant`},Me={class:`grant-name`},Ne={class:`grant-input`},Pe={key:0,class:`row muted empty`},Fe={key:4},Ie={class:`section-head`},Le={class:`muted`},Re={class:`rows`},ze={class:`cu-action`},Be={class:`cu-action-name`},Ve={class:`grant-name`},He={class:`cu-action-desc`},Ue={key:5},We={class:`section-head`},Ge={class:`muted`},Ke={class:`rows`},qe={class:`cu-action`},Je={class:`cu-action-name`},Ye={class:`grant-name`},Xe={class:`cu-action-desc`},Ze={class:`section-head`},Qe={class:`muted`},$e={key:0,class:`perm-row cu-ready-row`},et={class:`perm-name`},tt={class:`section-head sub`},nt={class:`muted`},rt={class:`rows`},it={class:`cu-action`},at={class:`cu-action-name`},ot={class:`cu-action-desc`},st={key:6},ct={class:`section-head`},lt={class:`muted`},ut={class:`rows`},dt={key:0,class:`row`},ft={class:`cu-action`},pt={class:`cu-action-name`},mt={class:`cu-action-desc`},ht={key:1,class:`row muted empty`},gt={key:2,class:`row muted empty`},_t={key:0,class:`muted`},vt={key:1,class:`muted saved-tip`},yt={key:2,class:`mcp-error`},bt={key:7},Q={class:`section-head`},xt={class:`muted`},St={class:`perm-row`},Ct={class:`perm-name`},wt={class:`perm-row`},Tt={class:`perm-name`},Et={class:`perm-row`},Dt={class:`perm-name`};function Ot(e,m,ee,h,g,_){let v=c(`status-badge`),y=c(`el-button`),b=c(`add-icon`),x=c(`folder-icon`),S=c(`el-switch`),C=c(`el-input`),w=c(`security-icon`),T=c(`meta-tag`),E=c(`MagicIcon`),D=c(`magic-icon`);return p(),o(`div`,L,[e.desktop?(p(),o(s,{key:1},[e.android?(p(),o(`section`,z,[t(`div`,B,[t(`h3`,null,r(e.$t(`common.settings.localToolsPermsTitle`)),1)]),t(`p`,V,r(e.$t(`common.settings.localToolsAndroidPermHint`)),1),t(`div`,H,[t(`span`,U,r(e.$t(`common.settings.localToolsPermAccessibility`)),1),i(v,{tone:e.a11yEnabled?`success`:`info`,density:`compact`},{default:u(()=>[n(r(e.a11yEnabled?e.$t(`common.settings.localToolsGranted`):e.$t(`common.settings.localToolsNotGranted`)),1)]),_:1},8,[`tone`]),i(y,{size:`small`,type:`primary`,onClick:e.openAndroidAccessibility},{default:u(()=>[n(r(e.$t(`common.settings.localToolsOpen`)),1)]),_:1},8,[`onClick`])])])):a(``,!0),e.android?a(``,!0):(p(),o(`section`,W,[t(`div`,G,[t(`h3`,null,r(e.$t(`common.settings.localToolsFoldersTitle`)),1),i(y,{size:`small`,type:`primary`,onClick:e.addFolder},{default:u(()=>[i(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(e.$t(`common.settings.localToolsAddFolder`)),1)]),_:1},8,[`onClick`])]),t(`p`,K,r(e.$t(`common.settings.localToolsFoldersHint`)),1),t(`ul`,q,[(p(!0),o(s,null,d(e.roots,(a,s)=>(p(),o(`li`,{key:a,class:`row`},[i(x,{class:`row-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(`span`,J,r(a),1),i(y,{size:`small`,text:``,type:`danger`,onClick:t=>e.removeRoot(s)},{default:u(()=>[n(r(e.$t(`common.settings.localToolsRemove`)),1)]),_:1},8,[`onClick`])]))),128)),e.roots.length?a(``,!0):(p(),o(`li`,Y,r(e.$t(`common.settings.localToolsNoFolders`)),1))]),t(`div`,X,[i(y,{size:`small`,type:`primary`,loading:e.saving,onClick:e.save},{default:u(()=>[n(r(e.$t(`common.settings.localToolsSave`)),1)]),_:1},8,[`loading`,`onClick`]),e.savedTip?(p(),o(`span`,Z,r(e.$t(`common.settings.localToolsSaved`)),1)):a(``,!0)]),e.tools.length?(p(),o(`p`,re,r(e.$t(`common.settings.localToolsActiveTools`))+`: `+r(e.tools.join(`, `)),1)):a(``,!0)])),e.android?a(``,!0):(p(),o(`section`,ie,[t(`div`,ae,[t(`h3`,null,r(e.$t(`common.settings.localToolsWorkingDirTitle`)),1),i(y,{size:`small`,type:`primary`,loading:e.pickingWorkingDir,onClick:e.chooseWorkingDir},{default:u(()=>[i(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(e.workingDir?e.$t(`common.settings.localToolsWorkingDirChange`):e.$t(`common.settings.localToolsAddFolder`)),1)]),_:1},8,[`loading`,`onClick`])]),t(`p`,oe,r(e.$t(`common.settings.localToolsWorkingDirHint`)),1),t(`ul`,se,[e.workingDir?(p(),o(`li`,ce,[i(x,{class:`row-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(`span`,le,r(e.workingDir),1)])):(p(),o(`li`,ue,r(e.$t(`common.settings.localToolsWorkingDirNone`)),1))])])),t(`section`,null,[t(`div`,de,[t(`h3`,null,r(e.$t(`common.settings.localToolsMcpTitle`)),1),i(y,{size:`small`,type:`primary`,onClick:e.addMcp},{default:u(()=>[i(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(e.$t(`common.settings.localToolsMcpAdd`)),1)]),_:1},8,[`onClick`])]),t(`p`,fe,r(e.$t(`common.settings.localToolsMcpHint`)),1),e.mcpServers.length?(p(),o(`ul`,pe,[(p(!0),o(s,null,d(e.mcpServers,(s,c)=>(p(),o(`li`,{key:s._uid,class:`row mcp-row`},[t(`div`,me,[t(`div`,he,[i(v,{tone:e.mcpBadgeType(s.id),density:`compact`},{default:u(()=>[n(r(e.mcpBadgeText(s.id)),1)]),_:2},1032,[`tone`]),m[4]||=t(`span`,{class:`mcp-spacer`},null,-1),i(S,{modelValue:s.enabled,"onUpdate:modelValue":e=>s.enabled=e,size:`small`,"active-text":e.$t(`common.settings.localToolsMcpEnabled`),"inline-prompt":``,onChange:t=>e.onToggleMcpEnabled(s)},null,8,[`modelValue`,`onUpdate:modelValue`,`active-text`,`onChange`]),i(y,{size:`small`,text:``,loading:e.mcpBusy===s.id,disabled:!s.id||!s.command,onClick:t=>e.reconnectMcp(s)},{default:u(()=>[n(r(e.$t(`common.settings.localToolsMcpReconnect`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`]),i(y,{size:`small`,text:``,type:`danger`,onClick:t=>e.removeMcp(c)},{default:u(()=>[n(r(e.$t(`common.settings.localToolsRemove`)),1)]),_:1},8,[`onClick`])]),t(`div`,ge,[t(`label`,_e,r(e.$t(`common.settings.localToolsMcpName`)),1),i(C,{modelValue:s.id,"onUpdate:modelValue":e=>s.id=e,placeholder:e.$t(`common.settings.localToolsMcpNamePlaceholder`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`]),t(`label`,ve,r(e.$t(`common.settings.localToolsMcpCommand`)),1),i(C,{modelValue:s.command,"onUpdate:modelValue":e=>s.command=e,placeholder:e.$t(`common.settings.localToolsMcpCommandPlaceholder`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`]),t(`label`,ye,r(e.$t(`common.settings.localToolsMcpArgs`)),1),i(C,{modelValue:s.argsText,"onUpdate:modelValue":e=>s.argsText=e,type:`textarea`,rows:2,placeholder:e.$t(`common.settings.localToolsMcpArgsHint`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`]),t(`label`,be,r(e.$t(`common.settings.localToolsMcpEnv`)),1),i(C,{modelValue:s.envText,"onUpdate:modelValue":e=>s.envText=e,type:`textarea`,rows:2,placeholder:e.$t(`common.settings.localToolsMcpEnvHint`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),e.mcpErrorFor(s.id)?(p(),o(`p`,xe,r(e.mcpErrorFor(s.id)),1)):a(``,!0)])]))),128))])):(p(),o(`p`,Se,r(e.$t(`common.settings.localToolsMcpNoServers`)),1)),t(`p`,Ce,r(e.$t(`common.settings.localToolsMcpPlatformHint`)),1),t(`div`,we,[i(y,{size:`small`,type:`primary`,loading:e.savingMcp,onClick:e.saveMcp},{default:u(()=>[n(r(e.$t(`common.settings.localToolsSave`)),1)]),_:1},8,[`loading`,`onClick`]),e.mcpSavedTip?(p(),o(`span`,Te,r(e.$t(`common.settings.localToolsSaved`)),1)):a(``,!0),e.mcpError?(p(),o(`span`,Ee,r(e.mcpError),1)):a(``,!0)])]),e.grants!==null&&!e.android?(p(),o(`section`,De,[t(`div`,Oe,[t(`h3`,null,r(e.$t(`common.settings.localToolsGrantsTitle`)),1),e.grants.length?(p(),l(y,{key:0,size:`small`,text:``,type:`danger`,onClick:e.revokeAll},{default:u(()=>[n(r(e.$t(`common.settings.localToolsRevokeAll`)),1)]),_:1},8,[`onClick`])):a(``,!0)]),t(`p`,ke,r(e.$t(`common.settings.localToolsGrantsHint`)),1),t(`ul`,Ae,[(p(!0),o(s,null,d(e.grants,a=>(p(),o(`li`,{key:a.key,class:`row`},[i(w,{class:`row-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(`span`,je,[t(`code`,Me,r(a.name),1),t(`span`,Ne,r(a.input),1)]),i(y,{size:`small`,type:`danger`,onClick:t=>e.revoke(a.key)},{default:u(()=>[n(r(e.$t(`common.settings.localToolsRevoke`)),1)]),_:1},8,[`onClick`])]))),128)),e.grants.length?a(``,!0):(p(),o(`li`,Pe,r(e.$t(`common.settings.localToolsNoGrants`)),1))])])):a(``,!0),e.builtinTools.length&&!e.android?(p(),o(`section`,Fe,[t(`div`,Ie,[t(`h3`,null,r(e.$t(`common.settings.localToolsBuiltinTitle`)),1)]),t(`p`,Le,r(e.$t(`common.settings.localToolsBuiltinHint`)),1),t(`ul`,Re,[(p(!0),o(s,null,d(e.builtinTools,s=>(p(),o(`li`,{key:s.name,class:`row`},[(p(),l(f(e.builtinIcon(s.name)),{class:`row-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),t(`span`,ze,[t(`span`,Be,[t(`code`,Ve,r(s.name),1),s.name===`shell.run_command`?(p(),l(T,{key:0,tone:`danger`,density:`compact`},{default:u(()=>[n(r(e.$t(`common.settings.localToolsBuiltinRisky`)),1)]),_:1})):a(``,!0)]),t(`span`,He,r(s.description),1)]),i(S,{"model-value":e.toolGrants[s.name]===!0,loading:e.builtinBusy===s.name,disabled:!!e.builtinBusy,onChange:t=>e.onToggleBuiltinTool(s.name,t)},null,8,[`model-value`,`loading`,`disabled`,`onChange`])]))),128))])])):a(``,!0),e.mcpTools.length&&!e.android?(p(),o(`section`,Ue,[t(`div`,We,[t(`h3`,null,r(e.$t(`common.settings.localToolsMcpToolsTitle`)),1)]),t(`p`,Ge,r(e.$t(`common.settings.localToolsMcpToolsHint`)),1),t(`ul`,Ke,[(p(!0),o(s,null,d(e.mcpTools,s=>(p(),o(`li`,{key:s.name,class:`row`},[i(E,{class:`row-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(`span`,qe,[t(`span`,Je,[t(`code`,Ye,r(s.name),1),s.writes?(p(),l(T,{key:0,tone:`danger`,density:`compact`},{default:u(()=>[n(r(e.$t(`common.settings.localToolsBuiltinRisky`)),1)]),_:1})):a(``,!0)]),t(`span`,Xe,r(s.description),1)]),i(S,{"model-value":e.toolGrants[s.name]===!0,loading:e.builtinBusy===s.name,disabled:!!e.builtinBusy,onChange:t=>e.onToggleBuiltinTool(s.name,t)},null,8,[`model-value`,`loading`,`disabled`,`onChange`])]))),128))])])):a(``,!0),t(`section`,null,[t(`div`,Ze,[t(`h3`,null,r(e.$t(`common.settings.localToolsComputerUseTitle`)),1),i(S,{modelValue:e.computerUse,"onUpdate:modelValue":m[0]||=t=>e.computerUse=t,loading:e.savingCU,onChange:e.onToggleComputerUse},null,8,[`modelValue`,`loading`,`onChange`])]),t(`p`,Qe,r(e.$t(`common.settings.localToolsComputerUseHint`)),1),e.android&&e.computerUse?(p(),o(`div`,$e,[t(`span`,et,r(e.$t(`common.settings.localToolsCuA11yLabel`)),1),i(v,{tone:e.a11yEnabled?`success`:`danger`,density:`compact`},{default:u(()=>[n(r(e.a11yEnabled?e.$t(`common.settings.localToolsCuReady`):e.$t(`common.settings.localToolsCuA11yMissing`)),1)]),_:1},8,[`tone`]),e.a11yEnabled?a(``,!0):(p(),l(y,{key:0,size:`small`,type:`primary`,onClick:e.openAndroidAccessibility},{default:u(()=>[n(r(e.$t(`common.settings.localToolsOpen`)),1)]),_:1},8,[`onClick`]))])):a(``,!0),e.computerTools.length?(p(),o(s,{key:1},[t(`div`,tt,[t(`h4`,null,r(e.$t(`common.settings.localToolsCuActionsTitle`)),1),i(y,{size:`small`,text:``,type:`primary`,loading:e.preauthorizing,onClick:e.preauthorizeAll},{default:u(()=>[n(r(e.$t(`common.settings.localToolsPreauthorizeAll`)),1)]),_:1},8,[`loading`,`onClick`])]),t(`p`,nt,r(e.$t(`common.settings.localToolsCuActionsHint`)),1),t(`ul`,rt,[(p(!0),o(s,null,d(e.computerTools,n=>(p(),o(`li`,{key:n.name,class:`row`},[(p(),l(f(e.cuIcon(n.name)),{class:`row-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),t(`span`,it,[t(`span`,at,r(e.cuLabel(n.name)),1),t(`span`,ot,r(n.description),1)]),i(S,{"model-value":e.computerGrants[n.name]===!0,loading:e.cuBusy===n.name,disabled:!!e.cuBusy||e.preauthorizing,onChange:t=>e.onToggleComputerTool(n.name,t)},null,8,[`model-value`,`loading`,`disabled`,`onChange`])]))),128))])],64)):a(``,!0)]),e.android?(p(),o(`section`,st,[t(`div`,ct,[t(`h3`,null,r(e.$t(`common.settings.localToolsAndroidSkillsTitle`)),1)]),t(`p`,lt,r(e.$t(`common.settings.localToolsAndroidSkillsHint`)),1),t(`ul`,ut,[e.xhsSkill?(p(),o(`li`,dt,[i(D,{class:`row-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(`span`,ft,[t(`span`,pt,r(e.$t(`common.settings.localToolsAndroidSkillsXhsName`)),1),t(`span`,mt,r(e.$t(`common.settings.localToolsAndroidSkillsXhsDesc`)),1)]),e.xhsSkill.installed?(p(),l(v,{key:0,tone:`success`,density:`compact`},{default:u(()=>[n(r(e.$t(`common.settings.localToolsAndroidSkillsInstalled`)),1)]),_:1})):(p(),l(y,{key:1,size:`small`,type:`primary`,loading:e.xhsInstalling,disabled:!e.canInstallXhs,onClick:e.installXhs},{default:u(()=>[n(r(e.$t(`common.settings.localToolsAndroidSkillsInstall`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`]))])):e.xhsLoading?(p(),o(`li`,ht,r(e.$t(`common.settings.localToolsAndroidSkillsLoading`)),1)):e.xhsError?a(``,!0):(p(),o(`li`,gt,r(e.$t(`common.settings.localToolsAndroidSkillsUnavailable`)),1))]),e.xhsSkill&&!e.xhsSkill.installed&&!e.canInstallXhs?(p(),o(`p`,_t,r(e.$t(`common.settings.localToolsAndroidSkillsNeedComputerUse`)),1)):a(``,!0),e.xhsSkill&&e.xhsSkill.installed?(p(),o(`p`,vt,r(e.$t(`common.settings.localToolsAndroidSkillsNextTurn`)),1)):a(``,!0),e.xhsError?(p(),o(`p`,yt,r(e.xhsError),1)):a(``,!0)])):a(``,!0),e.perm?(p(),o(`section`,bt,[t(`div`,Q,[t(`h3`,null,r(e.$t(`common.settings.localToolsPermsTitle`)),1)]),t(`p`,xt,r(e.$t(`common.settings.localToolsPermsHint`)),1),t(`div`,St,[t(`span`,Ct,r(e.$t(`common.settings.localToolsPermFullDisk`)),1),i(v,{tone:e.perm.fullDisk?`success`:`info`,density:`compact`},{default:u(()=>[n(r(e.perm.fullDisk?e.$t(`common.settings.localToolsGranted`):e.$t(`common.settings.localToolsNotGranted`)),1)]),_:1},8,[`tone`]),i(y,{size:`small`,type:`primary`,onClick:m[1]||=t=>e.open(`fullDisk`)},{default:u(()=>[n(r(e.$t(`common.settings.localToolsOpen`)),1)]),_:1})]),t(`div`,wt,[t(`span`,Tt,r(e.$t(`common.settings.localToolsPermScreen`)),1),i(v,{tone:e.perm.screen===`granted`?`success`:`info`,density:`compact`},{default:u(()=>[n(r(e.perm.screen===`granted`?e.$t(`common.settings.localToolsGranted`):e.$t(`common.settings.localToolsNotGranted`)),1)]),_:1},8,[`tone`]),i(y,{size:`small`,type:`primary`,onClick:m[2]||=t=>e.open(`screen`)},{default:u(()=>[n(r(e.$t(`common.settings.localToolsOpen`)),1)]),_:1})]),t(`div`,Et,[t(`span`,Dt,r(e.$t(`common.settings.localToolsPermAccessibility`)),1),i(v,{tone:e.perm.accessibility?`success`:`info`,density:`compact`},{default:u(()=>[n(r(e.perm.accessibility?e.$t(`common.settings.localToolsGranted`):e.$t(`common.settings.localToolsNotGranted`)),1)]),_:1},8,[`tone`]),i(y,{size:`small`,type:`primary`,onClick:m[3]||=t=>e.open(`accessibility`)},{default:u(()=>[n(r(e.$t(`common.settings.localToolsOpen`)),1)]),_:1})])])):a(``,!0)],64)):(p(),o(`p`,R,r(e.$t(`common.settings.localToolsDesktopOnly`)),1))])}var $=w(F,[[`render`,Ot],[`__scopeId`,`data-v-a7df0f21`]]);export{I as n,$ as t};
@@ -1 +1 @@
1
- import{A as e,Jt as t,L as n,N as r,at as i,tt as a,z as o}from"./vendor-chart-Dw-P17PN.js";import{t as s}from"./LocalTools-CWWIjS6k.js";import{D as c}from"./index-Bk9SKIXV.js";var l=o({name:`SettingsLocalTools`,components:{LocalToolsSetting:s}}),u={class:`local-tools-page`};function d(o,s,c,l,d,f){let p=i(`local-tools-setting`);return a(),r(`div`,u,[e(`h2`,null,t(o.$t(`common.settings.localTools`)),1),n(p)])}var f=c(l,[[`render`,d],[`__scopeId`,`data-v-ac732814`]]);export{f as default};
1
+ import{A as e,Jt as t,L as n,N as r,at as i,tt as a,z as o}from"./vendor-chart-Dw-P17PN.js";import{t as s}from"./LocalTools-BC90IHHk.js";import{D as c}from"./index-C8uXmX2U.js";var l=o({name:`SettingsLocalTools`,components:{LocalToolsSetting:s}}),u={class:`local-tools-page`};function d(o,s,c,l,d,f){let p=i(`local-tools-setting`);return a(),r(`div`,u,[e(`h2`,null,t(o.$t(`common.settings.localTools`)),1),n(p)])}var f=c(l,[[`render`,d],[`__scopeId`,`data-v-ac732814`]]);export{f as default};
@@ -1 +1 @@
1
- import{A as e,N as t,T as n,qt as r,tt as i,z as a}from"./vendor-chart-Dw-P17PN.js";import{D as o}from"./index-Bk9SKIXV.js";var s=`/assets/acedata-mark-l2r40Kh8.png`,c=`/assets/acedata-wordmark-mask-BIn-5zkq.png`,l=a({props:{collapsed:{type:Boolean,default:!1}},emits:[`click`],data(){return{logoMark:s}},computed:{siteTitle(){return this.$store.state.site?.title||`AceData`},tenantLogoLight(){let e=this.$store.state.site;return this.collapsed?e?.favicon||e?.logo||``:e?.logo_light||e?.logo||e?.favicon||``},tenantLogoDark(){let e=this.$store.state.site;return this.collapsed?this.tenantLogoLight:e?.logo_dark||this.tenantLogoLight},wordmarkStyle(){return{"--logo-wordmark-mask":`url(${c})`}}}}),u=[`aria-label`],d=[`src`,`alt`],f=[`src`,`alt`],p=[`src`],m={key:2,class:`brand-logo__wordmark`},h={class:`brand-logo__wordmark-inner`},g=[`src`];function _(a,o,s,c,l,_){return i(),t(`button`,{type:`button`,class:`brand-logo`,"aria-label":a.siteTitle,onClick:o[0]||=e=>a.$emit(`click`,e)},[a.tenantLogoLight?(i(),t(n,{key:0},[e(`img`,{src:a.tenantLogoLight,class:`brand-logo__image brand-logo__image--light`,alt:a.siteTitle},null,8,d),e(`img`,{src:a.tenantLogoDark,class:`brand-logo__image brand-logo__image--dark`,alt:a.siteTitle},null,8,f)],64)):a.collapsed?(i(),t(`img`,{key:1,src:a.logoMark,class:`brand-logo__mark`,alt:``,"aria-hidden":`true`},null,8,p)):(i(),t(`span`,m,[e(`span`,h,[e(`img`,{src:a.logoMark,class:`brand-logo__wordmark-mark`,alt:``,"aria-hidden":`true`},null,8,g),e(`span`,{class:`brand-logo__wordmark-text`,style:r(a.wordmarkStyle),"aria-hidden":`true`},null,4)])]))],8,u)}var v=o(l,[[`render`,_],[`__scopeId`,`data-v-6b30a264`]]);export{v as t};
1
+ import{A as e,N as t,T as n,qt as r,tt as i,z as a}from"./vendor-chart-Dw-P17PN.js";import{D as o}from"./index-C8uXmX2U.js";var s=`/assets/acedata-mark-l2r40Kh8.png`,c=`/assets/acedata-wordmark-mask-BIn-5zkq.png`,l=a({props:{collapsed:{type:Boolean,default:!1}},emits:[`click`],data(){return{logoMark:s}},computed:{siteTitle(){return this.$store.state.site?.title||`AceData`},tenantLogoLight(){let e=this.$store.state.site;return this.collapsed?e?.favicon||e?.logo||``:e?.logo_light||e?.logo||e?.favicon||``},tenantLogoDark(){let e=this.$store.state.site;return this.collapsed?this.tenantLogoLight:e?.logo_dark||this.tenantLogoLight},wordmarkStyle(){return{"--logo-wordmark-mask":`url(${c})`}}}}),u=[`aria-label`],d=[`src`,`alt`],f=[`src`,`alt`],p=[`src`],m={key:2,class:`brand-logo__wordmark`},h={class:`brand-logo__wordmark-inner`},g=[`src`];function _(a,o,s,c,l,_){return i(),t(`button`,{type:`button`,class:`brand-logo`,"aria-label":a.siteTitle,onClick:o[0]||=e=>a.$emit(`click`,e)},[a.tenantLogoLight?(i(),t(n,{key:0},[e(`img`,{src:a.tenantLogoLight,class:`brand-logo__image brand-logo__image--light`,alt:a.siteTitle},null,8,d),e(`img`,{src:a.tenantLogoDark,class:`brand-logo__image brand-logo__image--dark`,alt:a.siteTitle},null,8,f)],64)):a.collapsed?(i(),t(`img`,{key:1,src:a.logoMark,class:`brand-logo__mark`,alt:``,"aria-hidden":`true`},null,8,p)):(i(),t(`span`,m,[e(`span`,h,[e(`img`,{src:a.logoMark,class:`brand-logo__wordmark-mark`,alt:``,"aria-hidden":`true`},null,8,g),e(`span`,{class:`brand-logo__wordmark-text`,style:r(a.wordmarkStyle),"aria-hidden":`true`},null,4)])]))],8,u)}var v=o(l,[[`render`,_],[`__scopeId`,`data-v-6b30a264`]]);export{v as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,at as o,j as s,k as c,mt as l,tt as u,z as d}from"./vendor-chart-Dw-P17PN.js";import{_ as f,h as p,m,v as h}from"./vuex.esm-bundler-C-5WV-ta.js";import{t as g}from"./Navigator-DqokGio8.js";import{t as _}from"./checkbox-DXMDpaxv.js";import{t as v}from"./divider-Du_3kymg.js";import"./constants-CspFM8fh.js";import{D as y,Ia as b,Ii as x,Ja as S,Ki as C,Li as w,Zi as T,to as E,wn as D}from"./index-Bk9SKIXV.js";import{t as O}from"./Status-CVUE2QYX.js";var k=d({name:`ApplicationConfirm`,components:{ElDialog:S,ElDivider:v,ElCheckbox:_,ElButton:E},props:{visible:{type:Boolean,required:!1,default:!1}},emits:[`update:visible`,`apply`],data(){return{checked:!0}},watch:{},methods:{getBaseUrlPlatform:b,onApply(){if(!this.checked){h.error(this.$t(`application.message.notAgreePolicy`));return}this.$emit(`apply`)}}}),A={class:`content py-[10px] px-[40px]`},j={class:`my-4`},M={class:`policy mb-[10px]`},N={class:`policy-title text-[12px] relative -bottom-[3px]`},P=[`href`];function F(i,a,c,d,f,p){let m=o(`el-divider`),h=o(`el-checkbox`),g=o(`el-button`),_=o(`el-dialog`);return u(),s(_,{"model-value":i.visible,width:`500px`,title:i.$t(`application.message.welcome`),center:``,onClose:a[1]||=e=>i.$emit(`update:visible`,!1)},{default:l(()=>[e(`div`,A,[e(`p`,j,n(i.$t(`application.message.notApplied`)),1),r(m,{class:`my-2`}),e(`div`,M,[r(h,{modelValue:i.checked,"onUpdate:modelValue":a[0]||=e=>i.checked=e,size:`large`,class:`policy-checkbox mr-[10px]`},null,8,[`modelValue`]),e(`span`,N,n(i.$t(`application.message.readPolicy`)),1),e(`a`,{class:`policy-title text-[12px] relative -bottom-[3px] text-[var(--el-color-primary)] cursor-pointer no-underline`,target:`_blank`,href:i.getBaseUrlPlatform()+`/terms`},` \xA0`+n(i.$t(`application.message.policy`)),9,P)]),r(g,{round:``,type:`primary`,onClick:i.onApply},{default:l(()=>[t(n(i.$t(`common.button.start`)),1)]),_:1},8,[`onClick`])])]),_:1},8,[`model-value`,`title`])}var I=y(k,[[`render`,F]]),L=15e3,R=d({name:`LayoutMain`,components:{Navigator:g,ApplicationStatus:O,ApplicationConfirm:I},provide(){return{initialized:c(()=>this.initialized)}},data(){return{initialized:!1,applying:!1,mobile:typeof window<`u`&&window.innerWidth<768,initializeRunId:0,balanceTimer:0}},computed:{appName(){let e=this.$route.meta.appName;return typeof e==`string`&&e?e:void 0},hasApplicationContext(){return!!this.appName},x402Scenario(){if(x(this.appName))return w(this.appName).walletAvailable?this.appName:void 0},showApplicationStatus(){return this.hasApplicationContext?this.$store.state.token?.access?!!(this.application||this.x402Scenario):!!(this.x402Scenario&&w(this.x402Scenario).mode===`wallet`):!1},application(){if(this.appName)return this.$store.state[this.appName]?.application},applications(){let e=this.appName?this.$store.state[this.appName]?.applications??[]:[];console.debug(`individualApplications`,e);let t=this.$store.state.applications??[];return console.debug(`globalApplications`,t),t.concat(e)},loading(){return this.appName?this.$store.state[this.appName]?.status?.getApplications===f.Request:!1},service(){return this.appName?this.$store.state[this.appName]?.service:void 0},userId(){return this.$store.state.user?.id}},watch:{appName(e){window.clearInterval(this.balanceTimer),this.balanceTimer=0,this.initialize(),e&&this.startBalanceRefresh()},userId(e,t){e&&e!==t&&this.initialize()}},mounted(){this.initialize(),window.addEventListener(`resize`,this.onResize),this.hasApplicationContext&&this.startBalanceRefresh(),document.addEventListener(`visibilitychange`,this.onVisibility)},beforeUnmount(){window.removeEventListener(`resize`,this.onResize),window.clearInterval(this.balanceTimer),document.removeEventListener(`visibilitychange`,this.onVisibility)},methods:{onResize(){this.mobile=window.innerWidth<768},startBalanceRefresh(){!this.appName||this.balanceTimer||(this.balanceTimer=window.setInterval(this.refreshBalances,L))},onVisibility(){this.appName&&typeof document<`u`&&!document.hidden&&this.refreshBalances()},async refreshBalances(){if(!this.appName||!this.$store.state.token?.access||typeof document<`u`&&document.hidden||this.loading)return;await Promise.allSettled([this.$store.dispatch(`getApplications`),this.$store.dispatch(`${this.appName}/getApplications`)]);let e=this.$store.state[this.appName]?.application;if(!e)return;let t=this.applications?.find(t=>t.id===e.id);t&&t!==e&&this.$store.commit(`${this.appName}/setApplication`,t)},async initialize(){let e=++this.initializeRunId;if(this.initialized=!1,!this.appName){this.initialized=!0;return}if(!this.$store.state.token?.access||(console.debug(`Fetching all individual and global applications for`,this.appName),await Promise.allSettled([this.$store.dispatch(`getApplications`),this.$store.dispatch(`${this.appName}/getApplications`)]),e!==this.initializeRunId))return;console.debug(`Fetched all applications`,this.applications),this.$store.state.applications?.length===0&&await this.onAutoApply();let t=this.$store.state[this.appName]?.application;console.debug(`current application`,t);let n=D(this.applications,t);console.debug(`final application`,n),n&&(console.debug(`set final application`,n,n?.type),await this.$store.dispatch(`${this.appName}/setApplication`,n)),console.debug(`finished initialization`),this.initialized=!0},onApply(){this.onAutoApply()},async onAutoApply(){let e=!1;try{await C.create({type:p.USAGE,scope:m.GLOBAL,user_id:this.$store.getters.user.id}),e=!0}catch(e){if(e?.response?.data?.code!==`duplication`){h.error(this.$t(`application.message.applyFailed`)),this.applying=!1;return}}try{let t=(await this.$store.dispatch(`getApplications`))?.find(e=>e.id&&e.scope===m.GLOBAL);if(!t){h.error(this.$t(`application.message.applyFailed`));return}let n=(t.remaining_amount??0)>0?`positive`:`zero`;T(`application_prepared`,{application_id:t.id,credit_state:n}),e&&this.showWelcomeToast(t)}catch{h.error(this.$t(`application.message.applyFailed`))}finally{this.applying=!1}},showWelcomeToast(e){let t=Math.max(0,Math.floor(e.remaining_amount??0)),n=this.$store.state.site?.title||`AceData`;h({message:t>0?this.$t(`application.message.welcomeWithCredits`,{credits:t,brand:n}):this.$t(`application.message.welcomeNoCredits`,{brand:n}),type:`success`,duration:6e3,showClose:!0})}}}),z={class:`wrapper`};function B(e,t,n,c,l,d){let f=o(`router-view`),p=o(`navigator`),m=o(`application-status`),h=o(`application-confirm`);return u(),a(`div`,z,[r(f,{class:`main`}),r(p,{class:`navigator`,direction:e.mobile?`row`:`column`},null,8,[`direction`]),e.showApplicationStatus?(u(),s(m,{key:0,class:`status-floating fixed right-2 z-[200]`,application:e.application,applications:e.applications,"show-price":!1,authenticated:!!e.$store.state.token.access,service:e.service,scenario:e.x402Scenario,onSelect:t[0]||=t=>e.$store.dispatch(`${e.appName}/setApplication`,t)},null,8,[`application`,`applications`,`authenticated`,`service`,`scenario`])):i(``,!0),e.hasApplicationContext?(u(),s(h,{key:1,modelValue:e.applying,"onUpdate:modelValue":t[1]||=t=>e.applying=t,modelModifiers:{visible:!0},onApply:e.onApply},null,8,[`modelValue`,`onApply`])):i(``,!0)])}var V=y(R,[[`render`,B],[`__scopeId`,`data-v-71dc1903`]]);export{V as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,at as o,j as s,k as c,mt as l,tt as u,z as d}from"./vendor-chart-Dw-P17PN.js";import{_ as f,h as p,m,v as h}from"./vuex.esm-bundler-C-5WV-ta.js";import{t as g}from"./Navigator-CERVgrJV.js";import{t as _}from"./checkbox-DXMDpaxv.js";import{t as v}from"./divider-Du_3kymg.js";import"./constants-CspFM8fh.js";import{$i as y,D as b,Ua as x,Ui as S,Wi as C,co as w,ia as T,to as E,wn as D}from"./index-C8uXmX2U.js";import{t as O}from"./Status-C8r33_t6.js";var k=d({name:`ApplicationConfirm`,components:{ElDialog:E,ElDivider:v,ElCheckbox:_,ElButton:w},props:{visible:{type:Boolean,required:!1,default:!1}},emits:[`update:visible`,`apply`],data(){return{checked:!0}},watch:{},methods:{getBaseUrlPlatform:x,onApply(){if(!this.checked){h.error(this.$t(`application.message.notAgreePolicy`));return}this.$emit(`apply`)}}}),A={class:`content py-[10px] px-[40px]`},j={class:`my-4`},M={class:`policy mb-[10px]`},N={class:`policy-title text-[12px] relative -bottom-[3px]`},P=[`href`];function F(i,a,c,d,f,p){let m=o(`el-divider`),h=o(`el-checkbox`),g=o(`el-button`),_=o(`el-dialog`);return u(),s(_,{"model-value":i.visible,width:`500px`,title:i.$t(`application.message.welcome`),center:``,onClose:a[1]||=e=>i.$emit(`update:visible`,!1)},{default:l(()=>[e(`div`,A,[e(`p`,j,n(i.$t(`application.message.notApplied`)),1),r(m,{class:`my-2`}),e(`div`,M,[r(h,{modelValue:i.checked,"onUpdate:modelValue":a[0]||=e=>i.checked=e,size:`large`,class:`policy-checkbox mr-[10px]`},null,8,[`modelValue`]),e(`span`,N,n(i.$t(`application.message.readPolicy`)),1),e(`a`,{class:`policy-title text-[12px] relative -bottom-[3px] text-[var(--el-color-primary)] cursor-pointer no-underline`,target:`_blank`,href:i.getBaseUrlPlatform()+`/terms`},` \xA0`+n(i.$t(`application.message.policy`)),9,P)]),r(g,{round:``,type:`primary`,onClick:i.onApply},{default:l(()=>[t(n(i.$t(`common.button.start`)),1)]),_:1},8,[`onClick`])])]),_:1},8,[`model-value`,`title`])}var I=b(k,[[`render`,F]]),L=15e3,R=d({name:`LayoutMain`,components:{Navigator:g,ApplicationStatus:O,ApplicationConfirm:I},provide(){return{initialized:c(()=>this.initialized)}},data(){return{initialized:!1,applying:!1,mobile:typeof window<`u`&&window.innerWidth<768,initializeRunId:0,balanceTimer:0}},computed:{appName(){let e=this.$route.meta.appName;return typeof e==`string`&&e?e:void 0},hasApplicationContext(){return!!this.appName},x402Scenario(){if(S(this.appName))return C(this.appName).walletAvailable?this.appName:void 0},showApplicationStatus(){return this.hasApplicationContext?this.$store.state.token?.access?!!(this.application||this.x402Scenario):!!(this.x402Scenario&&C(this.x402Scenario).mode===`wallet`):!1},application(){if(this.appName)return this.$store.state[this.appName]?.application},applications(){let e=this.appName?this.$store.state[this.appName]?.applications??[]:[];console.debug(`individualApplications`,e);let t=this.$store.state.applications??[];return console.debug(`globalApplications`,t),t.concat(e)},loading(){return this.appName?this.$store.state[this.appName]?.status?.getApplications===f.Request:!1},service(){return this.appName?this.$store.state[this.appName]?.service:void 0},userId(){return this.$store.state.user?.id}},watch:{appName(e){window.clearInterval(this.balanceTimer),this.balanceTimer=0,this.initialize(),e&&this.startBalanceRefresh()},userId(e,t){e&&e!==t&&this.initialize()}},mounted(){this.initialize(),window.addEventListener(`resize`,this.onResize),this.hasApplicationContext&&this.startBalanceRefresh(),document.addEventListener(`visibilitychange`,this.onVisibility)},beforeUnmount(){window.removeEventListener(`resize`,this.onResize),window.clearInterval(this.balanceTimer),document.removeEventListener(`visibilitychange`,this.onVisibility)},methods:{onResize(){this.mobile=window.innerWidth<768},startBalanceRefresh(){!this.appName||this.balanceTimer||(this.balanceTimer=window.setInterval(this.refreshBalances,L))},onVisibility(){this.appName&&typeof document<`u`&&!document.hidden&&this.refreshBalances()},async refreshBalances(){if(!this.appName||!this.$store.state.token?.access||typeof document<`u`&&document.hidden||this.loading)return;await Promise.allSettled([this.$store.dispatch(`getApplications`),this.$store.dispatch(`${this.appName}/getApplications`)]);let e=this.$store.state[this.appName]?.application;if(!e)return;let t=this.applications?.find(t=>t.id===e.id);t&&t!==e&&this.$store.commit(`${this.appName}/setApplication`,t)},async initialize(){let e=++this.initializeRunId;if(this.initialized=!1,!this.appName){this.initialized=!0;return}if(!this.$store.state.token?.access||(console.debug(`Fetching all individual and global applications for`,this.appName),await Promise.allSettled([this.$store.dispatch(`getApplications`),this.$store.dispatch(`${this.appName}/getApplications`)]),e!==this.initializeRunId))return;console.debug(`Fetched all applications`,this.applications),this.$store.state.applications?.length===0&&await this.onAutoApply();let t=this.$store.state[this.appName]?.application;console.debug(`current application`,t);let n=D(this.applications,t);console.debug(`final application`,n),n&&(console.debug(`set final application`,n,n?.type),await this.$store.dispatch(`${this.appName}/setApplication`,n)),console.debug(`finished initialization`),this.initialized=!0},onApply(){this.onAutoApply()},async onAutoApply(){let e=!1;try{await y.create({type:p.USAGE,scope:m.GLOBAL,user_id:this.$store.getters.user.id}),e=!0}catch(e){if(e?.response?.data?.code!==`duplication`){h.error(this.$t(`application.message.applyFailed`)),this.applying=!1;return}}try{let t=(await this.$store.dispatch(`getApplications`))?.find(e=>e.id&&e.scope===m.GLOBAL);if(!t){h.error(this.$t(`application.message.applyFailed`));return}let n=(t.remaining_amount??0)>0?`positive`:`zero`;T(`application_prepared`,{application_id:t.id,credit_state:n}),e&&this.showWelcomeToast(t)}catch{h.error(this.$t(`application.message.applyFailed`))}finally{this.applying=!1}},showWelcomeToast(e){let t=Math.max(0,Math.floor(e.remaining_amount??0)),n=this.$store.state.site?.title||`AceData`;h({message:t>0?this.$t(`application.message.welcomeWithCredits`,{credits:t,brand:n}):this.$t(`application.message.welcomeNoCredits`,{brand:n}),type:`success`,duration:6e3,showClose:!0})}}}),z={class:`wrapper`};function B(e,t,n,c,l,d){let f=o(`router-view`),p=o(`navigator`),m=o(`application-status`),h=o(`application-confirm`);return u(),a(`div`,z,[r(f,{class:`main`}),r(p,{class:`navigator`,direction:e.mobile?`row`:`column`},null,8,[`direction`]),e.showApplicationStatus?(u(),s(m,{key:0,class:`status-floating fixed right-2 z-[200]`,application:e.application,applications:e.applications,"show-price":!1,authenticated:!!e.$store.state.token.access,service:e.service,scenario:e.x402Scenario,onSelect:t[0]||=t=>e.$store.dispatch(`${e.appName}/setApplication`,t)},null,8,[`application`,`applications`,`authenticated`,`service`,`scenario`])):i(``,!0),e.hasApplicationContext?(u(),s(h,{key:1,modelValue:e.applying,"onUpdate:modelValue":t[1]||=t=>e.applying=t,modelModifiers:{visible:!0},onApply:e.onApply},null,8,[`modelValue`,`onApply`])):i(``,!0)])}var V=b(R,[[`render`,B],[`__scopeId`,`data-v-71dc1903`]]);export{V as default};