import{i as e}from"./useAnalytics-D7ict_xi.js";import{t}from"./gamestate-B11sJlid.js";import{n}from"./runtimeModeStore-Db3SY58j.js";function r(e){return e?.state===`active`}function i(e){return r(e)&&e?.source===`mock`}function a(e){return r(e)&&e?.source===`live`}var o=[`gameVersionUnsupported`,`networkUnreachable`,`libValidationFailed`,`libLoadFailed`,`libHookFailed`,`notSpectator`,`libMissing`,`assetsUnavailable`];function s(e){return e&&o.includes(e.kind)?`appstatus.ingame.errorKind.${e.kind}`:`appstatus.ingame.error`}var c=e(`appStatus`,{state:()=>({snapshot:null}),getters:{badge:e=>{let r=e.snapshot,o=n();if(!r)return o.isAuthoring?{labelKey:`runtimeMode.authoring`,variant:`info`}:{labelKey:`appstatus.ready`,variant:`success`};if(r.ingame?.state===`error`)return{labelKey:`appstatus.ingame.error`,variant:`destructive`};if(r.assetCache?.state===`failed`)return{labelKey:`appstatus.assetCache.error`,variant:`destructive`};if(r.lifecycle?.state===`backingUp`)return{labelKey:`appstatus.backing-up`,variant:`info`,showElapsed:!0};if(r.lifecycle?.state===`closing`)return{labelKey:`appstatus.lifecycle.closing`,variant:`info`};if(r.assetCache?.state===`downloading`)return{labelKey:`appstatus.assetCache.downloading`,variant:`info`};if(r.assetCache?.state===`verifying`)return{labelKey:`appstatus.assetCache.verifying`,variant:`info`};if(!o.allowsBroadcastSurfaces)return{labelKey:`runtimeMode.authoring`,variant:`info`};if(a(r.ingame))switch(r.ingame.gameState){case t.Loading:return{labelKey:`gameStatus.${t.Loading}`,variant:`info`};case t.Running:return{labelKey:`gameStatus.${t.Running}`,variant:`success`};case t.Paused:return{labelKey:`gameStatus.${t.Paused}`,variant:`info`};case t.GameOver:return{labelKey:`gameStatus.${t.GameOver}`,variant:`default`};default:return{labelKey:`appstatus.ready`,variant:`success`}}let s=[i(r.pregame)?`pregame`:null,i(r.ingame)?`ingame`:null,i(r.postgame)?`postgame`:null].filter(e=>e!==null);return s.length>1?s.length===2&&s.includes(`pregame`)&&s.includes(`ingame`)?{labelKey:`appstatus.mocking.pregameIngame`,variant:`info`}:{labelKey:`appstatus.mocking.multiple`,labelParams:{count:s.length},variant:`info`}:s.length===1?{labelKey:`appstatus.mocking.${s[0]}`,variant:`info`}:a(r.pregame)?{labelKey:`gameStatus.${t.ChampionSelect}`,variant:`info`}:{labelKey:`appstatus.ready`,variant:`success`}},ingameError:e=>e.snapshot?.ingame?.state===`error`?e.snapshot.ingame.error??null:null,isGameRunning:e=>{if(!n().allowsBroadcastSurfaces)return!1;let r=e.snapshot?.ingame;return a(r)?r?.gameState===t.Running||r?.gameState===t.Paused:!1}},actions:{setSnapshot(e){this.snapshot=e}}});export{c as n,s as t};