import{a as g,c as u}from"./chunk-IRFDE6LX.js";import{EventPipeline as m}from"@dndbeyond/event-pipeline-lib/client";import{Platform as P,Region as c,Source as o,SubscriptionLevel as p}from"@dndbeyond/event-pipeline-lib/shared";var b="ddb_vid",f="ddb_sid",n=e=>"document"in globalThis?document.cookie.match(`${e}=([^;]*)`)?.[1]:void 0,v=e=>e==="production"?c.UsEast1:c.UsEast2,y=e=>new m(v(e)),E=e=>{let i=p.Visitor;return e?(e.subscriptionTier?i=e.subscriptionTier:(e.roles?Array.isArray(e.roles)?e.roles:[e.roles]:[]).includes("Registered Users")&&(i=p.RegisteredUser),{userId:e.id,subscriptionLevel:i,visitorId:n(b),sessionId:n(f)}):{userId:void 0,subscriptionLevel:i,visitorId:n(b),sessionId:n(f)}},U=(e,i)=>({region:v(i),countryCode:"",ipAddress:e}),h=async(e,i,a,t,r,l)=>{let s=[E(e),a];if(r&&s.push(U(r,l)),g&&console.log(`

SEND_EVENT

${JSON.stringify({detailType:"ddb-maps",detail:{messageName:i,platform:t??P.Web,plugins:s},source:u?o.Mobile:o.Web},null,2)}

`),process.env.NODE_ENV!=="development"){let d=await y(l).sendEvent({messageName:i,platform:t,plugins:s},o.Mobile);d.success||console.error("Error sending event to the event pipeline: ",d.errorMessages)}};export{h as a};
//# sourceMappingURL=chunk-RJ7BCVZA.js.map
