import{r as d,e as f,n as h,l as E,q as I,$ as b,N as w,g as y,as as g}from"./jwt-decode.esm-TBTnMpAQ.js";import{s as C}from"./editor-CjW72KCN.js";import{l as p}from"./fetch-DSyaUbf1.js";import{u as T}from"./polling-DP2mM3Q4.js";import"./externalPlayer-D2sigvKf.js";import"./ts.worker-9cx-N_QF.js";import"./workspaceStore-BFbr_c_Q.js";import"./userStore-CKr6VRns.js";import"./runnerData-5zbRPzoM.js";import"./url-qvab8xVu.js";import"./colorHelpers-BMn7fztv.js";import"./useCodebaseEvents-C_jpTZ_U.js";import"./codebaseEvents-BFKqkTR1.js";import"./contracts.generated-BC6Af2JL.js";import"./constants-B87hyFPv.js";import"./files-CouHTBes.js";import"./router-Bt-fVezd.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="aa8bedc9-51bc-445d-988e-5a1d5bfd424f",t._sentryDebugIdIdentifier="sentry-dbid-aa8bedc9-51bc-445d-988e-5a1d5bfd424f")}catch{}})();const m=8,v=3e3,H=3e3,R=1e3,L=t=>/\/projects\/([^/]+)\/web-editor/.exec(t)?.[1],S=t=>{const n=t.router,o=d(""),a=d(Array(m).fill(!0));let s=0;const l=async()=>{try{const e=new AbortController,r=setTimeout(()=>e.abort(),v),c=await p("/_healthcheck",{method:"GET",signal:e.signal,headers:{"Content-Type":"application/json","Cache-Control":"no-cache"}});clearTimeout(r),a.value[s]=c.status===200}catch{a.value[s]=!1}if(s=(s+1)%m,a.value.every(e=>!e)&&o.value){const e=n.currentRoute.value.path,r=L(o.value);r&&C({type:"perceived_restart",source:"frontend",projectId:r,cause:"healthcheck_failed",healthCheckHistory:[...a.value],path:e});const c=new URLSearchParams;c.set("redirect",e),window.location.href=o.value+"?"+c.toString()}},{startPolling:i,endPolling:_}=T({task:l,interval:H}),u=async()=>{const e=await p("/_editor/api/web-editor/",{method:"GET"});if(!e.ok){setTimeout(()=>{u()},R);return}const r=await e.json();r.waitingRoomUrl&&(o.value=r.waitingRoomUrl,i())};return{setup:u,cleanUp:_}},k=f({__name:"Home",setup(t){const n=w(),{setup:o,cleanUp:a}=S({router:n});return h(()=>{o()}),E(()=>{a()}),(s,l)=>{const i=b("RouterView");return y(),I(i,{class:"router"})}}}),Z=g(k,[["__scopeId","data-v-3737a9c1"]]);export{Z as default};
//# sourceMappingURL=Home-Da01OWRf.js.map
