import{i as e,n as t}from"./rolldown-runtime-BKYq3fBv.js";import{Nn as n,Xr as r,br as i}from"./vendor-primevue-Cg-HmKZY.js";import{an as a,on as o}from"./api-CJ30itpV.js";import{Ao as s,Eo as c,Mo as l,To as u,an as d,in as f,jo as p,ko as m,n as h,t as g}from"./dialogService-DvYmp2_F.js";function useSubscriptionActions(){let e=h(),t=s(),n=c(),a=d(),{fetchStatus:u}=l(),f=r(!1);i(()=>{handleRefresh()});let handleAddApiCredits=()=>{e.showTopUpCreditsDialog()},handleMessageSupport=async()=>{try{f.value=!0,o&&a?.trackHelpResourceClicked({resource_type:`help_feedback`,is_external:!0,source:`subscription`}),await n.execute(`Comfy.ContactSupport`)}catch(e){console.error(`[useSubscriptionActions] Error contacting support:`,e)}finally{f.value=!1}},handleRefresh=async()=>{try{await Promise.all([t.fetchBalance(),u()])}catch(e){console.error(`[useSubscriptionActions] Error refreshing data:`,e)}},handleLearnMoreClick=()=>{window.open(`https://docs.comfy.org/get_started/cloud`,`_blank`)};return{isLoadingSupport:f,handleAddApiCredits,handleMessageSupport,handleRefresh,handleLearnMoreClick}}var _=t((()=>{n(),m(),p(),a(),f(),g(),u()}));export{useSubscriptionActions as n,_ as t};
//# sourceMappingURL=useSubscriptionActions-C7hMido6.js.map