import{E as p,a as n}from"./C9PzN-8-.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e646e01f-0b7e-40d1-904f-c8cf558b7cf8",e._sentryDebugIdIdentifier="sentry-dbid-e646e01f-0b7e-40d1-904f-c8cf558b7cf8")}catch{}})();var m=(e=>(e.Product="product",e.Category="category",e.Event="event",e))(m||{});const _=({type:e,id:t,preferences:u,preferencesStatus:g,isFollowedByUser:a,followMutation:v,mutationOptions:b})=>{const{isLoggedIn:s}=p(),{mutate:I,status:w}=v(b),o=n(()=>{var c,f,i;return{product:(c=u.value)==null?void 0:c.productIds,event:(f=u.value)==null?void 0:f.eventIds,category:(i=u.value)==null?void 0:i.categoryIds}[e]}),l=n(()=>a!=null&&a.value?!0:o!=null&&o.value?o.value.includes(t.value):!1),r=n(()=>s.value&&g.value==="pending"),d=n(()=>w.value==="pending"),y=n(()=>r.value||d.value);return{userIsFollowing:l,isPreferencesLoading:r,isFollowLoading:d,onToggleFollow:()=>{s.value&&(y.value||I({id:t.value,newFollowStatus:!l.value}))}}};export{m as F,_ as u};
