import{i as e}from"./useAnalytics-D7ict_xi.js";import{t}from"./gamestate-B11sJlid.js";import{t as n}from"./backendApi-BRM6WgjB.js";var r={mode:`Production`,allowsAutomaticCapture:!0,allowsExternalEffects:!0,allowsBroadcastSurfaces:!0},i=`runtime-mode-top-bar-shortcut`,a=null;function o(){return typeof localStorage>`u`||localStorage.getItem(i)!==`false`}function s(e,n){return e===t.ChampionSelect&&n===`Authoring`}var c=e(`runtimeMode`,{state:()=>({state:r,loaded:!1,loadFailed:!1,changing:!1,showTopBarShortcut:o()}),getters:{mode:e=>e.state.mode,isAuthoring:e=>e.state.mode===`Authoring`,isNonProduction:e=>e.state.mode!==`Production`,allowsBroadcastSurfaces:e=>e.state.allowsBroadcastSurfaces},actions:{async refresh(){try{this.state=await n.get(`runtime`),this.loaded=!0,this.loadFailed=!1}catch(e){throw this.loadFailed=!0,e}},async setMode(e,t=!1){this.changing=!0;try{this.state=await n.put(`runtime`,{mode:e,confirmActiveCapture:t}),this.loaded=!0,this.loadFailed=!1}finally{this.changing=!1}},setShowTopBarShortcut(e){this.showTopBarShortcut=e,typeof localStorage<`u`&&localStorage.setItem(i,String(e))},startPolling(){a===null&&(this.refresh().catch(()=>{}),a=setInterval(()=>void this.refresh().catch(()=>{}),1e3))},stopPolling(){a!==null&&(clearInterval(a),a=null)}}});export{c as n,s as t};