try{let e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`dc4759dd-e400-4e5a-856d-897a437b2f95`,e._sentryDebugIdIdentifier=`sentry-dbid-dc4759dd-e400-4e5a-856d-897a437b2f95`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{Dg as t,Ig as n,Na as r,Pa as i,ch as a,k as o,sh as s,wg as c}from"./entry.client-dr7r6s9a.js";import{t as l}from"./PendingFriendRequestType-kfaj8vup.js";var u=e(n(),1),d=(e,n,d)=>{let{privacy:f,dialog:p,settings:m,toasts:h}=s(),{trackUserAction:g}=a(),{data:_,isError:v,isPending:y}=t(f.queries.privacySettingValue.getActiveUserQuery().getOptions(i.ShareIdentity)),{mutate:b}=c(p.mutations.open.getOptions()),{data:x}=t(m.queries.showIdentitySharingConfirmationDialogSetting.getOptions()),{mutate:S}=c(h.mutations.showStandardToast.getOptions()),{locFailedAcceptFriendRequest:C,locFailedSendFriendRequest:w}=o(),T=p.keys.identitySharingConfirmation.fullPath;return(0,u.useCallback)(()=>{if(v){S({namespace:`Social`,level:`error`,content:n===l.Incoming?C():w()});return}if(y||!d){e(!1);return}_===r.PeopleOnMyList&&x||_===r.FriendCategoryShareIdentity?(g(`OpenModal`,{modalType:p.keys.identitySharingConfirmation.fullPath},`Press`),b({key:T,props:{onApprove:e,friendRequestType:n,targetGamertag:d},options:{navigationType:`stacked`}})):e(!1)},[n,v,y,C,w,e,b,_,x,S,d,g,T])},f=e=>{let{trackUserAction:t}=a();return{trackSuccessfulSendRequest:(0,u.useCallback)(n=>{t(`FriendInteraction`,{type:`SendRequest`,wasSuccessful:!0,wasRealNameShared:n},`Press`,{location:e})},[t]),trackFailedSendRequest:(0,u.useCallback)(n=>{t(`FriendInteraction`,{type:`SendRequest`,wasSuccessful:!1,wasRealNameShared:n},`Press`,{location:e})},[t]),trackSuccessfulAcceptRequest:(0,u.useCallback)(n=>{t(`FriendInteraction`,{type:`AcceptRequest`,wasSuccessful:!0,wasRealNameShared:n},`Press`,{location:e})},[t]),trackFailedAcceptRequest:(0,u.useCallback)(n=>{t(`FriendInteraction`,{type:`AcceptRequest`,wasSuccessful:!1,wasRealNameShared:n},`Press`,{location:e})},[t]),trackSuccessfulBatchAcceptRequests:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`BatchAcceptRequests`,wasSuccessful:!0},`Press`,{location:e})},[t]),trackFailedBatchAcceptRequests:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`BatchAcceptRequests`,wasSuccessful:!1},`Press`,{location:e})},[t]),trackSuccessfulDeclineRequest:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`DeclineRequest`,wasSuccessful:!0},`Press`,{location:e})},[t]),trackFailedDeclineRequest:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`DeclineRequest`,wasSuccessful:!1},`Press`,{location:e})},[t]),trackSuccessfulBatchDeclineRequests:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`BatchDeclineRequests`,wasSuccessful:!0},`Press`,{location:e})},[t]),trackFailedBatchDeclineRequests:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`BatchDeclineRequests`,wasSuccessful:!1},`Press`,{location:e})},[t]),trackSuccessfulCancelRequest:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`CancelRequest`,wasSuccessful:!0},`Press`,{location:e})},[t]),trackFailedCancelRequest:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`CancelRequest`,wasSuccessful:!1},`Press`,{location:e})},[t]),trackSuccessfulBatchCancelRequests:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`BatchCancelRequests`,wasSuccessful:!0},`Press`,{location:e})},[t]),trackFailedBatchCancelRequests:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`BatchCancelRequests`,wasSuccessful:!1},`Press`,{location:e})},[t]),trackSuccessfulRemoveFriend:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`RemoveFriend`,wasSuccessful:!0},`Press`,{location:e})},[t]),trackFailedRemoveFriend:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`RemoveFriend`,wasSuccessful:!1},`Press`,{location:e})},[t]),trackSuccessfulToggleFavorite:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`ToggleFavorite`,wasSuccessful:!0},`Press`,{location:e})},[t]),trackFailedToggleFavorite:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`ToggleFavorite`,wasSuccessful:!1},`Press`,{location:e})},[t]),trackSuccessfulRemoveSuggestion:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`RemoveSuggestion`,wasSuccessful:!0},`Press`,{location:e})},[t]),trackFailedRemoveSuggestion:(0,u.useCallback)(()=>{t(`FriendInteraction`,{type:`RemoveSuggestion`,wasSuccessful:!1},`Press`,{location:e})},[t])}};export{d as n,f as t};