import{b as useNuxtApp,u as useRuntimeConfig}from"./BGddUaGe.js";const useStreamlineSessionCheck=async sessionRequestData=>{var o,s,a,t,e,r,i,n,u;const{$auth,$gc}=useNuxtApp(),user=await($auth==null?void 0:$auth.getSession()),config=useRuntimeConfig();let errors;(s=(o=user==null?void 0:user.idToken)==null?void 0:o.payload)!=null&&s.sub?(sessionRequestData.userID=user.idToken.payload.sub,sessionRequestData.userEmail=user.idToken.payload.email):(a=user==null?void 0:user.profile)!=null&&a.sub?(sessionRequestData.userID=`${eval(`user?.profile?.${((e=(t=config.public.club)==null?void 0:t.ssoOptions)==null?void 0:e.idProperty)||"sub"}`)}`,sessionRequestData.userEmail=(r=user==null?void 0:user.profile)==null?void 0:r.email):user!=null&&user.sub&&(sessionRequestData.userID=`${eval(`user?.${((n=(i=config.public.club)==null?void 0:i.ssoOptions)==null?void 0:n.idProperty)||"sub"}`)}`,sessionRequestData.userEmail=user==null?void 0:user.email);const{data,status}=await $gc().videos.web().sessionCheck(sessionRequestData);return status!==200&&(errors=handleEntitlementErrors((u=data.errors)==null?void 0:u[0].code)),{data,status,errors}},handleEntitlementErrors=o=>{let s,a,t;const e=useRuntimeConfig().public.video.supportEmail,r="https://localhost:3000/videos/faq";return o==="ERR_3684853_2"?(s=`
Sorry but there is an issue with this video
Error code: ERR_3684853_2
Please contact ${e}
`,a=!0,t="blocked"):o==="ERR_3684853_1"?(s=`Please Sign In to access this video
Error code: ERR_3684853_1
`,a=!0,t="requireLogin"):o==="ERR_56882466_2"?(s=`Sorry but users within this country are not allowed to play this video
Please read our faqs
Error code: ERR_56882466_2
If you think this is a mistake please contact ${e}
`,a=!0,t="blocked"):o==="ERR_56882466_1"?(s=`Your account has been blocked by an administrator
Error code: ERR_56882466_1
If you think this is a mistake please contact ${e}
`,a=!0,t="blocked"):o==="ERR_54648_1"?(s=`Your account has reached the limit for concurrent viewing
Please log out of some browsers and devices and try again
Error code: ERR_54648_1
If you think this is a mistake please contact ${e}
`,a=!0,t="blocked"):o==="ERR_3684853_3"?(s=`Sorry but you are not subscribed to this stream
Error code: ERR_3684853_3
Please upgrade or read our faqs
If you think this is a mistake please contact ${e}
`,a=!0,t="requirePremium"):(s=`Sorry, there has been a problem accessing this stream
Please contact ${e}with the following info: ${o}
`,a=!0,t="blocked"),{errorMessage:s,preventVideo:a,preventVideoType:t}};export{useStreamlineSessionCheck as u};