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-D50rA9nL.js";import{on as a,sn as o}from"./api-z_dXWY_S.js";import{Ao as s,Co as c,Oo as l,So as u,in as d,jo as f,ko as p,n as m,rn as h,t as g}from"./dialogService-Cr3DyAja.js";function useSubscriptionActions(){let e=m(),t=p(),n=c(),a=d(),{fetchStatus:s}=f(),l=r(!1);i(()=>{handleRefresh()});let handleAddApiCredits=()=>{e.showTopUpCreditsDialog()},handleMessageSupport=async()=>{try{l.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{l.value=!1}},handleRefresh=async()=>{try{await Promise.all([t.fetchBalance(),s()])}catch(e){console.error(`[useSubscriptionActions] Error refreshing data:`,e)}},handleLearnMoreClick=()=>{window.open(`https://docs.comfy.org/get_started/cloud`,`_blank`)};return{isLoadingSupport:l,handleAddApiCredits,handleMessageSupport,handleRefresh,handleLearnMoreClick}}var _=t((()=>{n(),l(),s(),a(),h(),g(),u()}));export{useSubscriptionActions as n,_ as t};
//# sourceMappingURL=useSubscriptionActions-BSxjyWUc.js.map