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-BhpMn3dH.js";import{hn as a,mn as o}from"./api-D3NfSChA.js";import{Do as s,Eo as c,To as l,in as u,n as d,rn as f,t as p,vo as m,wo as h,yo as g}from"./dialogService-BWZ1IAoU.js";function useSubscriptionActions(){let e=d(),t=l(),n=g(),o=u(),{fetchStatus:c}=s(),f=r(!1);i(()=>{handleRefresh()});let handleAddApiCredits=()=>{e.showTopUpCreditsDialog()},handleMessageSupport=async()=>{try{f.value=!0,a&&o?.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(),h(),c(),o(),f(),p(),m()}));export{useSubscriptionActions as n,_ as t};
//# sourceMappingURL=useSubscriptionActions-CKoaXs3-.js.map