import{j as l}from"./ui-vendor-oFzHwyuF.js";import{u as d,r as o}from"./react-vendor-BJie2xkO.js";import{u as h,F as m}from"./main-Bfm0Ar4t.js";import{d as u}from"./api-DAXyRoTB.js";function v(){const e=d(),{isSessionValid:i,clearEvent:s,setGuests:a,markLoaded:n,guests:p}=h(),c=o.useRef(!1);return o.useEffect(()=>{if(c.current)return;c.current=!0;async function f(){if(!i()){s(),e("/checkin-app",{replace:!0});return}if(p.length>0){e("/checkin-app/dashboard",{replace:!0}),u().then(({guests:t,total:r})=>{a(t),n(r)}).catch(()=>{});return}try{const{guests:t,total:r}=await u();a(t),n(r),e("/checkin-app/dashboard",{replace:!0})}catch{s(),e("/checkin-app",{replace:!0})}}f()},[]),l.jsx(m,{})}export{v as LoadingRestore};
