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]=`34399bc1-e149-4075-a14c-927eb5e50ebc`,e._sentryDebugIdIdentifier=`sentry-dbid-34399bc1-e149-4075-a14c-927eb5e50ebc`)}catch{}import"./rolldown-runtime-eb2nym32.js";import{Sp as e,cm as t,dm as n,im as r,lm as i,mm as a,om as o,vm as s,wp as c}from"./entry.client-dr7r6s9a.js";n(),t(),r();var l={Active:`Active`,Cloaked:`Cloaked`},u=e({state:c()});function d(e){return u.parse(e)}var f=`https://userpresence.xboxlive.com/users/`,p=`3`,m=class{config;fetch;get baseUrl(){let e=this.config.baseUrl??f;return e.endsWith(`/`)?e:`${e}/`}constructor(e,t,n,r=globalThis.fetch){this.config=e,this.fetch=a(r,{authenticator:new i(n),interceptors:{request:[new o(t)]},timeoutMs:this.config.timeoutMs})}async cloakUserPresence(e,t){let n=new URL(`xuid(${e})/state`,this.baseUrl),r=await this.fetch(n.toString(),{method:`PUT`,headers:{[s.XXBLContractVersion]:p,[s.Accept]:`application/json`,[s.ContentType]:`application/json`},body:JSON.stringify({state:l.Cloaked}),signal:t?.signal});if(r.status>=300)throw Error(`Failed to cloak user: status ${r.status}, text ${r.statusText}`)}async uncloakUserPresence(e,t){let n=new URL(`xuid(${e})/state`,this.baseUrl),r=await this.fetch(n.toString(),{method:`PUT`,headers:{[s.XXBLContractVersion]:p,[s.Accept]:`application/json`,[s.ContentType]:`application/json`},body:JSON.stringify({state:l.Active}),signal:t?.signal});if(r.status>=300)throw Error(`Failed to uncloak user: status ${r.status}, text ${r.statusText}`)}async isUserPresenceCloaked(e,t){let n=new URL(`xuid(${e})/state`,this.baseUrl),r=await this.fetch(n.toString(),{method:`GET`,headers:{[s.XXBLContractVersion]:p,[s.Accept]:`application/json`,[s.ContentType]:`application/json`},signal:t?.signal});if(r.status>=300)throw Error(`Failed to retrieve user cloak state: status ${r.status}, text ${r.statusText}`);return d(await r.json()).state===l.Cloaked}};export{m as UserPresenceService};