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{on as a,sn as o}from"./api-Dwy4NIr-.js";import{Ao as s,Do as c,Oo as l,So as u,an as d,in as f,ko as p,n as m,t as h,xo as g}from"./dialogService-BJDTj7su.js";function useSubscriptionActions(){let e=m(),t=l(),n=u(),a=d(),{fetchStatus:c}=s(),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(),c()])}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(),c(),p(),a(),f(),h(),g()}));export{useSubscriptionActions as n,_ as t};
//# sourceMappingURL=useSubscriptionActions-D-MtmY19.js.map