import{o as e,r as t,t as n}from"./jsx-runtime-Bypl69v7.js";import{I as r,a as i,j as a,n as o,t as s,w as c}from"./index-BMtPAEHs.js";import{a as l,t as u}from"./button-CYVyx32W.js";import{t as d}from"./card-G-t986iA.js";import{t as f}from"./activity-Bc-_WW8j.js";import{t as p}from"./sparkles-DrXh6I8f.js";var m=l(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),h=e(t()),g=n();function _(){let e=r(),[t,n]=(0,h.useState)(!1);(0,h.useEffect)(()=>{c.auth.getUser().then(({data:t})=>{t.user&&(s(),e.navigate({to:`/dashboard`,replace:!0}))})},[e]);async function l(){n(!0);try{o();let t=await c.rpc(`ensure_demo_data`);t.error&&console.warn(`Demo data refresh failed:`,t.error.message),e.navigate({to:`/dashboard`,replace:!0})}catch(e){i.error(e.message??`Could not load demo`)}finally{n(!1)}}return(0,g.jsx)(`div`,{className:`min-h-screen flex items-center justify-center p-6 bg-gradient-to-br from-primary/5 via-background to-background`,children:(0,g.jsxs)(d,{className:`w-full max-w-lg p-10 text-center`,children:[(0,g.jsx)(`div`,{className:`w-14 h-14 mx-auto rounded-xl bg-primary/15 flex items-center justify-center mb-4`,children:(0,g.jsx)(f,{className:`w-7 h-7 text-primary`})}),(0,g.jsx)(`h1`,{className:`font-display text-3xl font-semibold`,children:`Performance Tracker`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-2`,children:`Weekly operational KPIs across dispatch, quality, and billing — automated from your ticket exports.`}),(0,g.jsxs)(`div`,{className:`mt-8 space-y-3`,children:[(0,g.jsxs)(u,{size:`lg`,className:`w-full gap-2`,onClick:l,disabled:t,children:[(0,g.jsx)(p,{className:`w-4 h-4`}),t?`Loading demo…`:`Explore the demo (no login)`]}),(0,g.jsx)(u,{size:`lg`,variant:`outline`,className:`w-full gap-2`,asChild:!0,children:(0,g.jsxs)(a,{to:`/auth`,children:[`Sign in to your workspace `,(0,g.jsx)(m,{className:`w-4 h-4`})]})})]}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground mt-6`,children:(0,g.jsx)(a,{to:`/how-it-works`,className:`hover:underline`,children:`How the KPIs are calculated →`})})]})})}export{_ as component};