1import{c as yt,f as cs,i as jt,J as ds,r as m,M as ms,j as e,m as O,B as H,u as us,L as K,T as wt,t as ne,a as Qe,X as Nt,b as ps,d as xs,e as hs,g as oe,h as fs,k as be,P as ue,l as ke,R as J,n as nt,o as kt,p as St,q as Ct,s as vs,v as gs,N as bs}from"./index-BKInu8Gb.js";import{u as At}from"./microTrack-C77-V_dP.js";import{P as _t}from"./progress-CbLU_5uA.js";import{D as It}from"./DashboardLayout-BXFPlznX.js";import{u as Et}from"./useEmbeds-CpgIiDFX.js";import{u as Dt}from"./useAnalytics-DARItQFI.js";import{u as Xe}from"./useSubscription-DWrMv6r9.js";import{u as Tt,a as ys}from"./use-transform-Cl5l0XQG.js";import{P as ie}from"./premium-card-xhF3Z65d.js";import{s as Te,a as Y}from"./animations-DdkukZz3.js";import{C as Se}from"./check-Bo92AKRy.js";import{C as Le}from"./copy-C06rTEVO.js";import{A as se}from"./arrow-right-CyjUFlGV.js";import{B as $t}from"./bot-z6hb6xhG.js";import{F as Pt}from"./file-text-BKfgSnNR.js";import{C as Lt}from"./code-C7Xr-g4W.js";import{C as Re}from"./chart-column-CL-MSr0k.js";import{u as js}from"./useReferralTokenGrants-CCeZYx8N.js";import{d as ws}from"./differenceInDays-iQiQ8oDH.js";import{S as re}from"./sparkles-Dy67g5WL.js";import{C as $e}from"./coins-6cb5NLBx.js";import{C as it}from"./clock-C42o-YdA.js";import{f as Ns}from"./format-BKSIM-Lc.js";import{f as ks}from"./formatDistanceToNow-BKX1UFBW.js";import{G as Ss}from"./gift-CE5Xg_9H.js";import{g as Je}from"./embedGenerator-_n6aVVk5.js";import{L as Cs}from"./lightbulb-Dfzh0kRE.js";import{R as Ze}from"./rocket-Bq1EGkIQ.js";import{B as As}from"./book-open-B7aoqn43.js";import{C as _s}from"./credit-card-C2LjDPcg.js";import{P as Rt}from"./plus-uPmWpQSB.js";import{N as Is}from"./NeedHelpCard-GPr_Hlqq.js";import{E as Mt}from"./external-link-CcuYPQGf.js";import{D as Ot,a as Ft,b as Es,c as Ds}from"./dialog-ENkXqeK3.js";import{u as Bt}from"./useOnboarding-CKDWM5Lp.js";import{A as Ts}from"./index-Cuaw5peq.js";import{A as $s}from"./arrow-left-0nCR_9p3.js";import{C as et}from"./circle-help-OttUiTMq.js";import{F as Ps}from"./FeedbackAnalytics-CkLBzLxD.js";import{u as Ls}from"./useQuickStart-CEwtJ8fJ.js";/* empty css */import{R as Rs,P as Ms,O as Os,C as Fs}from"./index-Be2tF3Kx.js";import{S as Bs}from"./search-CC8ZA7OB.js";import{L as Ks}from"./layout-dashboard-D9pjzpyJ.js";import{C as tt}from"./code-xml-DpgDlPge.js";import{R as Us}from"./receipt-m7kBySie.js";import{P as Kt}from"./terminal-0Fn1Zx3D.js";import{S as Gs}from"./settings-B1GBuJyd.js";import{M as Vs}from"./mic-B5-9VpyI.js";import{Z as De}from"./zap-Pd2rkksN.js";import{U as Ws}from"./user-plus-s5gJQ_Gu.js";import{M as zs}from"./minus-D8eeceKn.js";import{T as st}from"./trending-up-BqvKCaVh.js";import{T as qs}from"./trending-down-ZvAQ-D_Z.js";import{C as Ys}from"./ChartTooltip-78JP8knP.js";import{G as Hs,D as Qs,f as Xs,E as Js,L as Oe,a as Ie,C as Zs,A as er,i as je,b as tr,c as Ve,h as sr,d as rr,g as Ut,e as ot,u as ar,j as nr,X as Gt,Y as Vt,k as ir,R as rt,T as or}from"./generateCategoricalChart-Bcra4NLB.js";import{A as Wt,a as zt}from"./AreaChart-Bd_oF3ki.js";import{C as lr}from"./CartesianGrid-in275-t5.js";import{C as cr}from"./chevron-down-D6Dw-Q53.js";import{A as dr}from"./arrow-up-right-D_nBsSKv.js";import{i as mr}from"./find-Bd7eFxjG.js";import{C as ur}from"./chevron-right-nAIXCcl1.js";import{E as pr}from"./eye-BiS9dtpN.js";import{V as xr,R as hr}from"./ReplayTourButton-D6WRdXRj.js";import{M as lt}from"./message-square-CnLNEBSV.js";import"./BrandingContext-BRH9k_I2.js";import"./anvevoice-logo-C8ZQvCP0.js";import"./AnnouncementBanner-DnsBLgq7.js";import"./menu-d-k1676P.js";import"./ticket-s0MeUJXb.js";import"./history-JeYh37Y2.js";import"./link-2-dwew5_57.js";import"./ClientLayout-DhuLwAfQ.js";import"./label-Bs-8-fl1.js";import"./radio-group-BtMboj_o.js";import"./index-BuvS6xj3.js";import"./index-BdUYosLC.js";import"./index-90jyQyqH.js";import"./circle-XCExElpo.js";import"./textarea-Gt--OfrP.js";import"./circle-check-Bljibo5l.js";import"./useMutation-BRPD8YYR.js";import"./costEstimator-nQbWfvy8.js";import"./en-US-BOoww7nS.js";import"./config-BSf9rU-h.js";import"./card-BP0uVGrg.js";import"./calendar-B4GNzWL-.js";import"./mail-Ce9wnjTU.js";import"./index-DyLHZbNU.js";import"./circle-play-CdWQP0ND.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const fr=yt("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const ct=yt("Infinity",[["path",{d:"M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z",key:"1z0uae"}]]);function vr(t,s,r){const a=t.get();let n=null,i=a,l;
11const o=typeof a=="string"?a.replace(/[\d.-]/g,""):void 0,c=()=>{n&&(n.stop(),n=null)},d=()=>{c(),n=new ds({keyframes:[mt(t.get()),mt(i)],velocity:t.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01,...r,onUpdate:l})};if(t.attach((p,v)=>{i=p,l=f=>v(dt(f,o)),cs.postRender(()=>{var f;d(),(f=t.events.animationStart)==null||f.notify(),n==null||n.then(()=>{var x;(x=t.events.animationComplete)==null||x.notify()})})},c),jt(s)){const p=s.on("change",f=>t.set(dt(f,o))),v=t.on("destroy",p);return()=>{p(),v()}}return c}function dt(t,s){return s?t+s:t}function mt(t){return typeof t=="number"?t:parseFloat(t)}function gr(t,s={}){const{isStatic:r}=m.useContext(ms),a=()=>jt(t)?t.get():t;if(r)return Tt(a);const n=ys(a());return m.useInsertionEffect(()=>vr(n,t,s),[n,JSON.stringify(s)]),n}function br({value:t,duration:s=1e3,className:r="",prefix:a="",suffix:n="",decimals:i=0}){const l=gr(0,{stiffness:100,damping:30,duration:s/1e3}),o=Tt(l,c=>{const d=i>0?c.toFixed(i):Math.floor(c).toLocaleString();return`${a}${d}${n}`});return m.useEffect(()=>{l.set(t)},[t,l]),e.jsx(O.span,{className:r,children:o})}function yr({hasEmbeds:t,hasKnowledge:s,hasDeployed:r,hasSessions:a,firstEmbedCode:n}){const i=[{id:"create-bot",title:"Create your first Anve",description:"Set up Anve for your website",completed:t,href:"/embeds/create",icon:$t},{id:"add-knowledge",title:"Add knowledge base",description:"Train your Anve with URLs, files, or text",completed:s,href:t?"/embeds":"/create-embed",icon:Pt},{id:"deploy",title:"Deploy to your website",description:"Get the embed code and add it to your site",completed:r,href:t?"/embeds":"/create-embed",icon:Lt},{id:"analytics",title:"View your first session",description:"See how visitors interact with your Anve",completed:a,href:"/analytics",icon:Re}],l=i.filter(c=>c.completed).length;return l===i.length?null:e.jsxs(O.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"rounded-2xl border border-border/50 bg-gradient-to-br from-card to-card/50 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Getting Started"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-0.5",children:[l," of ",i.length," steps completed"]})]}),e.jsx("div",{className:"flex items-center gap-1",children:i.map((c,d)=>e.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${c.completed?"bg-primary":"bg-muted"}`},c.id))})]}),e.jsx(O.div,{variants:Te,initial:"hidden",animate:"visible",className:"space-y-3",children:i.map(c=>{const d=c.icon;return e.jsxs(O.div,{variants:Y,className:`group flex items-center gap-4 p-4 rounded-xl transition-all duration-200 ${c.completed?"bg-primary/5 border border-primary/20":"bg-muted/30 border border-transparent hover:bg-muted/50 hover:border-border/50"}`,children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center transition-colors ${c.completed?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground group-hover:bg-primary/10 group-hover:text-primary"}`,children:c.completed?e.jsx(Se,{className:"w-5 h-5"}):e.jsx(d,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:`font-medium ${c.completed?"text-primary line-through":"text-foreground"}`,children:c.title}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:c.description})]}),!c.completed&&e.jsxs("div",{className:"flex items-center gap-1",children:[c.id==="deploy"&&n&&e.jsxs(H,{size:"sm",variant:"outline",className:"gap-1",onClick:p=>{p.stopPropagation(),navigator.clipboard.writeText(n),us.success("Embed code copied! Paste before </body> on your site.")},children:[e.jsx(Le,{className:"w-3 h-3"}),"Copy Code"]}),e.jsx(K,{to:c.href,children:e.jsxs(H,{size:"sm",variant:"ghost",className:"gap-1",children:["Start",e.jsx(se,{className:"w-4 h-4"})]})})]})]},c.id)})})]})}const jr={paid_upgrade:{label:"Referral bonus",icon:re,color:"text-primary"},signup_free:{label:"Signup bonus",icon:Ss,color:"text-emerald-500"},legacy:{label:"Legacy bonus",icon:$e,color:"text-amber-500"}};function he(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${(t/1e3).toFixed(t%1e3===0?0:1)}
11K`:t.toLocaleString()}function wr(){const{activeBuckets:t,expiringTokens:s,permanentTokens:r,nextExpiryAt:a,bonusTokensRemaining:n,isLoading:i}=js(),{usage:l,limits:o}=Xe();if(i||!t.length)return null;const d=o.max_tokens!==-1&&(l.tokens_used??0)>=o.max_tokens&&n>0,p=[...t].sort((x,g)=>!x.expires_at&&!g.expires_at?0:x.expires_at?g.expires_at?new Date(x.expires_at).getTime()-new Date(g.expires_at).getTime():-1:1),v=a?ws(a,new Date):null,f=v!==null&&v<=14&&s>0;return e.jsx(O.div,{variants:Y,"data-track-section":"dashboard-bonus-tokens",children:e.jsxs(ie,{variant:"glass",className:"p-6",children:[e.jsxs("div",{className:"flex items-start justify-between mb-5 gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2.5 rounded-xl ${d?"bg-primary/15":"bg-muted/40"}`,children:e.jsx(re,{className:`w-5 h-5 ${d?"text-primary":"text-muted-foreground"}`})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 flex-wrap",children:["Bonus Tokens",e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-semibold border ${d?"bg-primary/10 text-primary border-primary/30":"bg-muted/40 text-muted-foreground border-border"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${d?"bg-primary animate-pulse":"bg-muted-foreground/40"}`}),d?"Active source":"Standby"]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:d?"Plan tokens exhausted â bonus tokens are powering your sessions.":"Reserves activate automatically when your plan tokens run out."})]})]}),e.jsx(K,{to:"/affiliate",className:"shrink-0",children:e.jsxs(H,{variant:"ghost",size:"sm",className:"text-primary",children:["Earn more ",e.jsx(se,{className:"w-4 h-4 ml-1"})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 mb-5",children:[e.jsxs("div",{className:"rounded-xl border border-border/60 bg-card/40 p-3",children:[e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1.5",children:[e.jsx($e,{className:"w-3.5 h-3.5"})," Total available"]}),e.jsx("div",{className:"text-xl font-bold mt-1",children:he(n)})]}),e.jsxs("div",{className:"rounded-xl border border-border/60 bg-card/40 p-3",children:[e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1.5",children:[e.jsx(it,{className:"w-3.5 h-3.5"})," Expiring"]}),e.jsx("div",{className:"text-xl font-bold mt-1",children:he(s)})]}),e.jsxs("div",{className:"rounded-xl border border-border/60 bg-card/40 p-3 col-span-2 sm:col-span-1",children:[e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1.5",children:[e.jsx(ct,{className:"w-3.5 h-3.5"})," Never expires"]}),e.jsx("div",{className:"text-xl font-bold mt-1",children:he(r)})]})]}),f&&e.jsxs("div",{className:"flex items-start gap-2 p-3 mb-4 rounded-lg bg-warning/10 border border-warning/30 text-sm",children:[e.jsx(wt,{className:"w-4 h-4 text-warning mt-0.5 shrink-0"}),e.jsxs("div",{className:"text-warning",children:[e.jsxs("span",{className:"font-medium",children:[he(s)," tokens"]})," ","expire in"," ",e.jsx("span",{className:"font-medium",children:v===0?"less than a day":`${v} day${v===1?"":"s"}`}),". They're prioritized first, so your reserves will use them automatically."]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:["Buckets (",p.length,")"]}),p.map(x=>{const g=jr[x.source]??{label:x.source,icon:$e,color:"text-muted-foreground"},S=g.icon,C=x.amount_initial>0?Math.min(100,(x.amount_initial-x.amount_remaining)/x.amount_initial*100):0,E=!!x.expires_at;return e.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/30 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("div",{className:"p-1.5 rounded-md bg-muted/40 shrink-0",children:e.jsx(S,{className:`w-3.5 h-3.5 ${g.color}`})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium truncate",children:g.label}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:E?e.
11jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(it,{className:"w-3 h-3"}),"Expires ",Ns(new Date(x.expires_at),"MMM d, yyyy")," · ",ks(new Date(x.expires_at),{addSuffix:!0})]}):e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ct,{className:"w-3 h-3"}),"Never expires"]})})]})]}),e.jsx("div",{className:"text-right shrink-0",children:e.jsxs("div",{className:"text-sm font-semibold",children:[he(x.amount_remaining),e.jsxs("span",{className:"text-muted-foreground font-normal text-xs",children:[" ","/ ",he(x.amount_initial)]})]})})]}),e.jsx(_t,{value:C,className:`h-1.5 ${E?"[&>div]:bg-primary":"[&>div]:bg-muted-foreground/50"}`})]},x.id)})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-4",children:"Drain order: expiring buckets first (soonest first), then never-expires buckets."})]})})}const Nr=({hasEmbeds:t,hasKnowledge:s,hasSessions:r,isNearVoiceLimit:a,totalSessions:n,embedsCount:i})=>{const l=m.useMemo(()=>{const o=[];return t||o.push({id:"create-first-embed",title:"Create Your First Anve",description:"Get started by setting up your voice-powered Anve",icon:Ze,href:"/embeds/create",priority:1,color:"text-primary",bgColor:"bg-primary/10"}),t&&!s&&o.push({id:"add-knowledge",title:"Add Knowledge to Your Anve",description:"Upload docs or scrape your website to improve responses",icon:As,href:"/embeds",priority:2,color:"text-emerald-500",bgColor:"bg-emerald-500/10"}),a&&o.push({id:"upgrade-plan",title:"Upgrade Your Plan",description:"You're approaching your voice minutes limit",icon:_s,href:"/pricing",priority:3,color:"text-warning",bgColor:"bg-warning/10"}),r&&n>=5&&o.push({id:"check-analytics",title:"Review Your Analytics",description:`You have ${n} sessions - see what's working`,icon:Re,href:"/analytics",priority:4,color:"text-purple-500",bgColor:"bg-purple-500/10"}),t&&i===1&&o.push({id:"create-another-embed",title:"Create Another Anve",description:"Set up Anve for different use cases",icon:Rt,href:"/embeds/create",priority:5,color:"text-cyan-500",bgColor:"bg-cyan-500/10"}),t&&s&&r&&o.push({id:"explore-integrations",title:"Explore Integrations",description:"Connect your Anve to other tools",icon:re,href:"/integrations",priority:6,color:"text-amber-500",bgColor:"bg-amber-500/10"}),o.sort((c,d)=>c.priority-d.priority).slice(0,3)},[t,s,r,a,n,i]);return l.length===0?null:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Cs,{className:"w-5 h-5 text-primary"}),e.jsx("h2",{className:"text-xl font-semibold",children:"Suggested Next Steps"})]}),e.jsx(O.div,{className:"grid grid-cols-1 md:grid-cols-3 gap-4",variants:Te,initial:"hidden",animate:"visible",children:l.map((o,c)=>e.jsx(O.div,{variants:Y,custom:c,children:e.jsx(K,{to:o.href,className:"block h-full",children:e.jsxs(ie,{variant:"glass",hover:"lift",className:"p-5 h-full flex flex-col group",children:[e.jsx("div",{className:`w-10 h-10 rounded-xl ${o.bgColor} flex items-center justify-center mb-3`,children:e.jsx(o.icon,{className:`w-5 h-5 ${o.color}`})}),e.jsx("h3",{className:"font-semibold mb-1.5 text-sm",children:o.title}),e.jsx("p",{className:"text-muted-foreground text-xs mb-3 flex-grow leading-relaxed",children:o.description}),e.jsxs("div",{className:`flex items-center ${o.color} text-xs font-medium group-hover:gap-2 transition-all`,children:["Take action",e.jsx(se,{className:"w-3.5 h-3.5 ml-1 group-hover:translate-x-1 transition-transform"})]})]})})},o.id))})]})};function kr({embeds:t}){const[s,r]=m.useState(!1),a=m.useMemo(()=>{if(!(t!=null&&t.length))return null;const l=Date.now()-60*60*1e3;return t.find(o=>{const c=typeof o.target_website=="string"&&o.target_website.trim().length>0;return!o.installed_at&&!c&&new Date(o.created_at).getTime()<l&&o.status!=="paused"})??null},[t]);if(m.useEffect(()=>{a&&ne("install_pending_banner_shown",{embedId:a.id})},[a==null?void 0:a.id]),At("install_pending_banner_dwell",{embedId:a==null?void 0:a.id}),!a)return null;const n=Je(a.id,{position:a.widget_position??"bottom-right",theme:a.widget_theme??"light"}),i=async()=>{try{await navigator.clipboard.writeText(n),r(!0),ne("install_snippet_copied",{embedId:a.id}),setTimeout(()=>r(!1),2e3)}catch{}};return e.jsx(ie,{variant:"glass",className:"p-5",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(Ze,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("h3",{className:"font-semibold mb-1",children:[a.name||"Your bot"," is ready â install it on your site"]}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Bots that are installed on a real site see ~5x more usage. Paste this one-line snippet just before the closing ",e.jsx("code",{children:"</body>"})," tag on your site."]}),e.jsx("pre",{className:"text-xs bg-muted/50 rounded-md p-3 overflow-x-auto mb-3 break-all whitespace-pre-wrap",children:e.jsx("code",{children:n})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(H,{size:"sm",onClick:i,children:s?e.jsxs(e.Fragment,{children:[e.jsx(Se,{className:"w-3.5 h-3.5 mr-1.5"})," Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(Le,{className:"w-3.5 h-3.5 mr-1.5"})," Copy snippet"]})}),e.jsx(H,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(K,{to:"/install-guide",onClick:()=>{ne("install_pending_banner_clicked",{embedId:a.id}),ne("install_test_clicked",{embedId:a.id})},children:"Install guide"})}),e.jsx(H,{size:"sm",variant:"ghost",asChild:!0,children:e.jsxs(K,{to:`/embeds/${a.id}`,onClick:()=>ne("hosted_preview_opened",{embedId:a.id}),children:["Try without installing ",e.jsx(Mt,{className:"w-3.5 h-3.5 ml-1.5"})]})})]}),e.jsx("div",{className:"mt-4 pt-3 border-t border-border/50",children:e.jsx(Is,{source:"dashboard_install_pending",variant:"inline",title:"Want us to install it?"})})]})]})})}const Fe=[{id:"welcome",title:"Welcome to AnveVoice",description:"Set up Anve to talk to your visitors, answer questions, and help them take action.",icon:re,color:"from-primary to-secondary",features:["Voice-first conversations","Trained on your content","One-line website embed","Built-in analytics"]},{id:"create-bot",title:"Create Your Anve",description:"Choose a voice, set the tone, and define how your Anve greets and helps visitors.",icon:$t,color:"from-fun to-cyan-600",features:["Pick from natural AI voices","Set personality and tone","Define greeting messages","Configure response style"]},{id:"knowledge",title:"Train with Your Content",description:"Upload documents, scrape your website, or add FAQs so your receptionist knows your business.",icon:Pt,color:"from-green-500 to-emerald-500",features:["Upload PDFs and documents","Crawl your website pages","Add FAQ content","Automatic content indexing"]},{id:"deploy",title:"Embed on Your Website",description:"Copy one line of code and your Anve starts handling visitors instantly.",icon:Lt,color:"from-
11amber-500 to-orange-500",features:["Single-line embed code","Choose widget position","Works on any website","Mobile responsive"]},{id:"analytics",title:"Monitor & Improve",description:"Track conversations, understand visitor needs, and refine your Anve over time.",icon:Re,color:"from-accent to-purple-700",features:["Session recordings","Conversation insights","Visitor engagement data","Performance metrics"]}];function Sr({open:t,onOpenChange:s}){const[r,a]=m.useState(0);Qe();const{completeOnboarding:n,dismissOnboarding:i}=Bt();m.useEffect(()=>{t&&ne("onboarding_started")},[t]);const l=Fe[r],o=r===0,c=r===Fe.length-1,d=l.icon,p=()=>{c?(n(),s(!1)):a(x=>x+1)},v=()=>{o||a(x=>x-1)},f=()=>{i(),s(!1)};return e.jsx(Ot,{open:t,onOpenChange:s,children:e.jsxs(Ft,{className:"sm:max-w-xl p-0 overflow-hidden bg-background border-border/50",children:[e.jsx(Es,{className:"sr-only",children:e.jsx(Ds,{children:l.title})}),e.jsxs("button",{onClick:f,className:"absolute right-4 top-4 z-10 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[e.jsx(Nt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),e.jsxs("div",{className:"p-6",children:[e.jsx("div",{className:"flex justify-center gap-1.5 mb-8",children:Fe.map((x,g)=>e.jsx("button",{onClick:()=>a(g),className:`w-2 h-2 rounded-full transition-all duration-300 ${g===r?"w-6 bg-primary":g<r?"bg-primary/60":"bg-muted"}`},g))}),e.jsx(Ts,{mode:"wait",children:e.jsxs(O.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.3},className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-6",children:e.jsx("div",{className:`w-20 h-20 rounded-2xl bg-gradient-to-br ${l.color} flex items-center justify-center shadow-lg`,children:e.jsx(d,{className:"w-10 h-10 text-white"})})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-3",children:l.title}),e.jsx("p",{className:"text-muted-foreground mb-8 max-w-md mx-auto",children:l.description}),e.jsx("div",{className:"grid grid-cols-2 gap-3 mb-8",children:l.features.map((x,g)=>e.jsxs(O.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.1+g*.05},className:"flex items-center gap-2 text-sm text-left p-3 rounded-lg bg-muted/50",children:[e.jsx("div",{className:`w-1.5 h-1.5 rounded-full bg-gradient-to-br ${l.color}`}),e.jsx("span",{className:"text-foreground",children:x})]},x))})]},l.id)}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-border/50",children:[e.jsxs(H,{variant:"ghost",onClick:v,disabled:o,className:"gap-2",children:[e.jsx($s,{className:"w-4 h-4"}),"Back"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[!c&&e.jsx(H,{variant:"ghost",onClick:f,children:"Skip tour"}),e.jsx(H,{onClick:p,className:`gap-2 ${c?"bg-gradient-to-r from-primary to-secondary hover:opacity-90":""}`,children:c?e.jsxs(e.Fragment,{children:[e.jsx(Ze,{className:"w-4 h-4"}),"Create My Anve"]}):e.jsxs(e.Fragment,{children:["Next",e.jsx(se,{className:"w-4 h-4"})]})})]})]})]})]})})}const Cr={"ai-receptionist":{title:"AI Receptionist",definition:"An AI-powered voice assistant that greets and helps visitors on your website. It can answer questions, guide users, and perform actions.",example:"Your AI receptionist answers visitor questions 24/7"},"knowledge-base":{title:"Knowledge Base",definition:"The collection of information your AI receptionist uses to answer questions. This includes scraped website content, uploaded documents, and FAQs.",example:"Add your product pages to the knowledge base"},session:{title:"Session",definition:"A single conversation between a website visitor and your AI receptionist, from start to finish.",example:"150 sessions this month means 150 conversations"},"voice-minutes":{title:"Voice Minutes",definition:"The total time spent in voice conversations. Your plan includes a monthly allocation of voice minutes.",example:"100 voice minutes = about 100 one-minute conversations"},tokens:{title:"Tokens",definition:"The unit of measurement for AI usage. Tokens are consumed when your AI receptionist listens (input tokens) and responds (output tokens). Roughly 1 minute of conversation uses ~3,500 tokens.",example:"100K tokens â 30 minutes of voice conversation"},"system-prompt":{title:"System Prompt",definition:"Instructions that define your AI receptionist's personality, behavior, and how it responds to visitors.",example:"Be friendly and professional, focus on sales inquiries"},"embed-code":{title:"Embed Code",definition:"A small snippet of code you add to your website to display the AI receptionist widget.",example:"Paste the code before </body> in your HTML"},"tool-calls":{title:"Tool Calls",definition:"Actions your AI receptionist takes on your website, like scrolling, clicking buttons, or filling forms.",example:"Navigate to pricing page, scroll to contact section"},"completion-rate":{title:"Completion Rate",definition:"The percentage of conversations where visitors got the help they needed and didn't abandon mid-conversation.",example:"85% completion rate means most visitors are satisfied"}};function ut({term:t,children:s,className:r,showIcon:a=!0,highlight:n=!1}){const i=Cr[t];return i?e.jsx(ps,{delayDuration:200,children:e.jsxs(xs,{children:[e.jsx(hs,{asChild:!0,children:e.jsxs("span",{className:oe("inline-flex items-center gap-1 cursor-help",n&&"border-b border-dashed border-primary/50",r),children:[s,a&&e.jsx(et,{className:"h-3.5 w-3.5 text-muted-foreground
11/60 hover:text-primary transition-colors"})]})}),e.jsxs(fs,{side:"top",className:"max-w-xs p-4 space-y-2",sideOffset:12,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-semibold text-foreground",children:i.title})]}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:i.definition}),i.example&&e.jsxs("p",{className:"text-xs text-primary/80 italic",children:['e.g., "',i.example,'"']})]})]})}):e.jsx(e.Fragment,{children:s})}const Be="anvevoice_glossary_seen";function Ar(){const[t,s]=m.useState(!1),[r,a]=m.useState(!1);return m.useEffect(()=>{localStorage.getItem(Be)||(a(!0),s(!0))},[]),{showGlossaryHints:t,isFirstSession:r,dismissGlossary:()=>{localStorage.setItem(Be,"true"),s(!1)},resetGlossary:()=>{localStorage.removeItem(Be),a(!0),s(!0)}}}function _r({onDismiss:t,className:s}){return e.jsxs("div",{className:oe("relative overflow-hidden rounded-xl border border-primary/20 bg-gradient-to-r from-primary/5 via-primary/10 to-secondary/5 p-4",s),children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-primary/10 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),e.jsxs("div",{className:"relative flex items-start gap-4",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10 shrink-0",children:e.jsx(re,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"New to AI Receptionists?"}),e.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed",children:["Look for the ",e.jsx(et,{className:"h-3.5 w-3.5 inline mx-0.5 text-primary"})," icon next to terms you might not recognize. Hover over them to learn what they mean!"]})]}),e.jsxs(H,{variant:"ghost",size:"icon",className:"shrink-0 h-8 w-8 text-muted-foreground hover:text-foreground",onClick:t,children:[e.jsx(Nt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Dismiss"})]})]})]})}var pt=1,Ir=.9,Er=.8,Dr=.17,Ke=.1,Ue=.999,Tr=.9999,$r=.99,Pr=/[\\\/_+.#"@\[\(\{&]/,Lr=/[\\\/_+.#"@\[\(\{&]/g,Rr=/[\s-]/,qt=/[\s-]/g;function We(t,s,r,a,n,i,l){if(i===s.length)return n===t.length?pt:$r;var o=`${n},${i}`;if(l[o]!==void 0)return l[o];for(var c=a.charAt(i),d=r.indexOf(c,n),p=0,v,f,x,g;d>=0;)v=We(t,s,r,a,d+1,i+1,l),v>p&&(d===n?v*=pt:Pr.test(t.charAt(d-1))?(v*=Er,x=t.slice(n,d-1).match(Lr),x&&n>0&&(v*=Math.pow(Ue,x.length))):Rr.test(t.charAt(d-1))?(v*=Ir,g=t.slice(n,d-1).match(qt),g&&n>0&&(v*=Math.pow(Ue,g.length))):(v*=Dr,n>0&&(v*=Math.pow(Ue,d-n))),t.charAt(d)!==s.charAt(i)&&(v*=Tr)),(v<Ke&&r.charAt(d-1)===a.charAt(i+1)||a.charAt(i+1)===a.charAt(i)&&r.charAt(d-1)!==a.charAt(i))&&(f=We(t,s,r,a,d+1,i+2,l),f*Ke>v&&(v=f*Ke)),v>p&&(p=v),d=r.indexOf(c,d+1);return l[o]=p,p}function xt(t){return t.toLowerCase().replace(qt," ")}function Mr(t,s,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,We(t,s,xt(t),xt(s),0,0,{})}var we='[cmdk-group=""]',Ge='[cmdk-group-items=""]',Or='[cmdk-group-heading=""]',Yt='[cmdk-item=""]',ht=`${Yt}:not([aria-disabled="true"])`,ze="cmdk-item-select",ve="data-value",Fr=(t,s,r)=>Mr(t,s,r),Ht=m.createContext(void 0),Ce=()=>m.useContext(Ht),Qt=m.createContext(void 0),at=()=>m.useContext(Qt),Xt=m.createContext(void 0),Jt=m.forwardRef((t,s)=>{let r=ge(()=>{var u,j;return{search:"",value:(j=(u=t.value)!=null?u:t.defaultValue)!=null?j:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=ge(()=>new Set),n=ge(()=>new Map),i=ge(()=>new Map),l=ge(()=>new Set),o=Zt(t),{label:c,children:d,value:p,onValueChange:v,filter:f,shouldFilter:x,loop:g,disablePointerSelection:S=!1,vimBindings:C=!0,...E}=t,V=be(),Q=be(),X=be(),F=m.useRef(null),D=Qr();pe(()=>{if(p!==void 0){let u=p.trim();r.current.value=u,P.emit()}},[p]),pe(()=>{D(6,w)},[]);let P=m.useMemo(()=>({subscribe:u=>(l.current.add(u),()=>l.current.delete(u)),snapshot:()=>r.current,setState:(u,j,N)=>{var b,I,R,G;if(!Object.is(r.current[u],j)){if(r.current[u]=j,u==="search")y(),h(),D(1,k);else if(u==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let B=document.getElementById(X);
vendor: 12,004 bytes, line 11
11B?B.focus():(b=document.getElementById(V))==null||b.focus()}if(D(7,()=>{var B;r.current.selectedItemId=(B=_())==null?void 0:B.id,P.emit()}),N||D(5,w),((I=o.current)==null?void 0:I.value)!==void 0){let B=j??"";(G=(R=o.current).onValueChange)==null||G.call(R,B);return}}P.emit()}},emit:()=>{l.current.forEach(u=>u())}}),[]),te=m.useMemo(()=>({value:(u,j,N)=>{var b;j!==((b=i.current.get(u))==null?void 0:b.value)&&(i.current.set(u,{value:j,keywords:N}),r.current.filtered.items.set(u,W(j,N)),D(2,()=>{h(),P.emit()}))},item:(u,j)=>(a.current.add(u),j&&(n.current.has(j)?n.current.get(j).add(u):n.current.set(j,new Set([u]))),D(3,()=>{y(),h(),r.current.value||k(),P.emit()}),()=>{i.current.delete(u),a.current.delete(u),r.current.filtered.items.delete(u);let N=_();D(4,()=>{y(),(N==null?void 0:N.getAttribute("id"))===u&&k(),P.emit()})}),group:u=>(n.current.has(u)||n.current.set(u,new Set),()=>{i.current.delete(u),n.current.delete(u)}),filter:()=>o.current.shouldFilter,label:c||t["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:V,inputId:X,labelId:Q,listInnerRef:F}),[]);function W(u,j){var N,b;let I=(b=(N=o.current)==null?void 0:N.filter)!=null?b:Fr;return u?I(u,r.current.search,j):0}function h(){if(!r.current.search||o.current.shouldFilter===!1)return;let u=r.current.filtered.items,j=[];r.current.filtered.groups.forEach(b=>{let I=n.current.get(b),R=0;I.forEach(G=>{let B=u.get(G);R=Math.max(B,R)}),j.push([b,R])});let N=F.current;T().sort((b,I)=>{var R,G;let B=b.getAttribute("id"),xe=I.getAttribute("id");return((R=u.get(xe))!=null?R:0)-((G=u.get(B))!=null?G:0)}).forEach(b=>{let I=b.closest(Ge);I?I.appendChild(b.parentElement===I?b:b.closest(`${Ge} > *`)):N.appendChild(b.parentElement===N?b:b.closest(`${Ge} > *`))}),j.sort((b,I)=>I[1]-b[1]).forEach(b=>{var I;let R=(I=F.current)==null?void 0:I.querySelector(`${we}[${ve}="${encodeURIComponent(b[0])}"]`);R==null||R.parentElement.appendChild(R)})}function k(){let u=T().find(N=>N.getAttribute("aria-disabled")!=="true"),j=u==null?void 0:u.getAttribute(ve);P.setState("value",j||void 0)}function y(){var u,j,N,b;if(!r.current.search||o.current.shouldFilter===!1){r.current.filtered.count=a.current.size;return}r.current.filtered.groups=new Set;let I=0;for(let R of a.current){let G=(j=(u=i.current.get(R))==null?void 0:u.value)!=null?j:"",B=(b=(N=i.current.get(R))==null?void 0:N.keywords)!=null?b:[],xe=W(G,B);r.current.filtered.items.set(R,xe),xe>0&&I++}for(let[R,G]of n.current)for(let B of G)if(r.current.filtered.items.get(B)>0){r.current.filtered.groups.add(R);break}r.current.filtered.count=I}function w(){var u,j,N;let b=_();b&&(((u=b.parentElement)==null?void 0:u.firstChild)===b&&((N=(j=b.closest(we))==null?void 0:j.querySelector(Or))==null||N.scrollIntoView({block:"nearest"})),b.scrollIntoView({block:"nearest"}))}function _(){var u;return(u=F.current)==null?void 0:u.querySelector(`${Yt}[aria-selected="true"]`)}function T(){var u;return Array.from(((u=F.current)==null?void 0:u.querySelectorAll(ht))||[])}function L(u){let j=T()[u];j&&P.setState("value",j.getAttribute(ve))}function q(u){var j;let N=_(),b=T(),I=b.findIndex(G=>G===N),R=b[I+u];(j=o.current)!=null&&j.loop&&(R=I+u<0?b[b.length-1]:I+u===b.length?b[0]:b[I+u]),R&&P.setState("value",R.getAttribute(ve))}function M(u){let j=_(),N=j==null?void 0:j.closest(we),b;for(;N&&!b;)N=u>0?Yr(N,we):Hr(N,we),b=N==null?void 0:N.querySelector(ht);b?P.setState("value",b.getAttribute(ve)):q(u)}let U=()=>L(T().length-1),$=u=>{u.preventDefault(),u.metaKey?U():u.altKey?M(1):q(1)},z=u=>{u.preventDefault(),u.metaKey?L(0):u.altKey?M(-1):q(-1)};return m.createElement(ue.div,{ref:s,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:u=>{var j;(j=E.onKeyDown)==null||j.call(E,u);let N=u.nativeEvent.isComposing||u.keyCode===229;if(!(u.defaultPrevented||N))switch(u.key){case"n":case"j":{C&&u.ctrlKey&&$(u);break}case"ArrowDown":{$(u);break}case"p":case"k":{C&&u.ctrlKey&&z(u);break}case"ArrowUp":{z(u);break}case"Home":{u.preventDefault(),L(0);break}case"End":{u.preventDefault(),U();break}case"Enter":{u.preventDefault();let b=_();if(b){let I=new Event(ze);b.dispatchEvent(I)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:te.inputId,id:te.labelId,style:Jr},c),Me(t,u=>m.createElement(Qt.Provider,{value:P},m.createElement(Ht.Provider,{value:te},u))))}),Br=m.forwardRef((t,s)=>{var r,a;let n=be(),i=m.useRef(null),l=m.useContext(Xt),o=Ce(),c=Zt(t),d=(a=(r=c.current)==null?void 0:r.forceMount)!=null?a:l==null?void 0:l.forceMount;pe(()=>{if(!d)return o.item(n,l==null?void 0:l.id)},[d]);let p=es(n,i,[t.value,t.children,i],t.keywords),v=at(),f=me(D=>D.value&&D.value===p.current),x=me(D=>d||o.filter()===!1?!0:D.search?D.filtered.items.get(n)>0:!0);m.useEffect(()=>{let D=i.current;if(!(!D||t.disabled))return D.addEventListener(ze,g),()=>D.removeEventListener(ze,g)},[x,t.onSelect,t.disabled]);function g(){var D,P;S(),(P=(D=c.current).onSelect)==null||P.call(D,p.current)}function S(){v.setState("value",p.current,!0)}if(!x)return null;let{disabled:C,value:E,onSelect:V,forceMount:Q,keywords:X,...F}=t;return m.createElement(ue.div,{ref:ke(i,s),...F,id:n,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!f,"data-disabled":!!C,"data-selected":!!f,onPointerMove:C||o.getDisablePointerSelection()?void 0:S,onClick:C?void 0:g},t.children)}),Kr=m.forwardRef((t,s)=>{let{heading:r,children:a,forceMount:n,...i}=t,l=be(),o=m.useRef(null),c=m.useRef(null),d=be(),p=Ce(),v=me(x=>n||p.filter()===!1?!0:x.search?x.filtered.groups.has(l):!0);pe(()=>p.group(l),[]),es(l,o,[t.value,t.heading,c]);let f=m.useMemo(()=>({id:l,forceMount:n}),[n]);return m.createElement(ue.div,{ref:ke(o,s),...i,"cmdk-group":"",role:"presentation",hidden:v?void 0:!0},r&&m.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),Me(t,x=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},m.createElement(Xt.Provider,{value:f},x))))}),Ur=m.forwardRef((t,s)=>{let{alwaysRender:r,...a}=t,n=m.useRef(null),i=me(l=>!l.search);return!r&&!i?null:m.createElement(ue.div,{ref:ke(n,s),...a,"cmdk-separator":"",role:"separator"})}),Gr=m.forwardRef((t,s)=>{let{onValueChange:r,...a}=t,n=t.value!=null,i=at(),l=me(d=>d.search),o=me(d=>d.selectedItemId),c=Ce();return m.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),m.createElement(ue.input,{ref:s,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":o,id:c.inputId,type:"text",value:n?t.value:l,onChange:d=>{n||i.setState("search",d.target.value),r==null||r(d.target.value)}})}),Vr=m.forwardRef((t,s)=>{let{children:r,label:a="Suggestions",...n}=t,i=m.useRef(null),l=m.useRef(null),o=me(d=>d.selectedItemId),c=Ce();return m.useEffect(()=>{if(l.current&&i.current){let d=l.current,p=i.current,v,f=new ResizeObserver(()=>{v=requestAnimationFrame(()=>{let x=d.offsetHeight;p.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return f.observe(d),()=>{cancelAnimationFrame(v),f.unobserve(d)}}},[]),m.createElement(ue.div,{ref:ke(i,s),...n,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":a,id:c.listId},Me(t,d=>m.createElement("div",{ref:ke(l,c.listInnerRef),"cmdk-list-sizer":""},d)))}),Wr=m.forwardRef((t,s)=>{let{open:r,onOpenChange:a,overlayClassName:n,contentClassName:i,container:l,...o}=t;return m.createElement(Rs,{open:r,onOpenChange:a},m.createElement(Ms,{container:l},m.createElement(Os,{"cmdk-overlay":"",className:n}),m.createElement(Fs,{"aria-label":t.label,"cmdk-dialog":"",className:i},m.createElement(Jt,{ref:s,...o}))))}),zr=m.forwardRef((t,s)=>me(r=>r.filtered.count===0)?m.createElement(ue.div,{ref:s,...t,"cmdk-empty":"",role:"presentation"}):null),qr=m.forwardRef((t,s)=>{let{progress:r,children:a,label:n="Loading...",...i}=t;return m.createElement(ue.div,{ref:s,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":n},Me(t,l=>m.createElement("div",{"aria-hidden":!0},l)))}),Z=Object.assign(Jt,{List:Vr,Item:Br,Input:Gr,Group:Kr,Separator:Ur,Dialog:Wr,Empty:zr,Loading:qr});function Yr(t,s){let r=t.nextElementSibling;for(;r;){if(r.matches(s))return r;r=r.nextElementSibling}}function Hr(t,s){let r=t.previousElementSibling;for(;r;){if(r.matches(s))return r;r=r.previousElementSibling}}function Zt(t){let s=m.useRef(t);return pe(()=>{s.current=t}),s}var pe=typeof window>"u"?m.useEffect:m.useLayoutEffect;function ge(t){let s=m.useRef();return s.current===void 0&&(s.current=t()),s}function me(t){let s=at(),r=()=>t(s.snapshot());return m.useSyncExternalStore(s.subscribe,r,r)}function es(t,s,r,a=[]){let n=m.useRef(),i=Ce();return pe(()=>{var l;let o=(()=>{var d;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(d=p.current.textContent)==null?void 0:d.trim():n.current}})(),c=a.map(d=>d.trim());i.value(t,o,c),(l=s.current)==null||l.setAttribute(ve,o),n.current=o}),n}var Qr=()=>{let[t,s]=m.useState(),r=ge(()=>new Map);return pe(()=>{r.current.forEach(a=>a()),r.current=new Map},[t]),(a,n)=>{r.current.set(a,n),s({})}};function Xr(t){let s=t.type;return typeof s=="function"?s(t.props):"render"in s?s.render(t.props):t}function Me({asChild:t,children:s},r){return t&&m.isValidElement(s)?m.cloneElement(Xr(s),{ref:s.ref},r(s.props.children)):r(s)}var Jr={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const ts=m.forwardRef(({className:t,...s},r)=>e.jsx(Z,{ref:r,className:oe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...s}));ts.displayName=Z.displayName;const Zr=({children:t,...s})=>e.jsx(Ot,{...s,children:e.jsx(Ft,{className:"overflow-hidden p-0 shadow-lg",children:e.jsx(ts,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:t})})}),ss=m.forwardRef(({className:t,...s},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Bs,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Z.Input,{ref:r,className:oe("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...s})]}));ss.displayName=Z.Input.displayName;const rs=m.forwardRef(({className:t,...s},r)=>e.jsx(Z.List,{ref:r,className:oe("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...s}));rs.displayName=Z.List.displayName;const as=m.forwardRef((t,s)=>e.jsx(Z.Empty,{ref:s,className:"py-6 text-center text-sm",...t}));as.displayName=Z.Empty.displayName;const qe=m.forwardRef(({className:t,...s},r)=>e.jsx(Z.Group,{ref:r,className:oe("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...s}));qe.displayName=Z.Group.displayName;const ns=m.forwardRef(({className:t,...s},r)=>e.jsx(Z.Separator,{ref:r,className:oe("-mx-1 h-px bg-border",t),...s}));ns.displayName=Z.Separator.displayName;const le=m.forwardRef(({className:t,...s},r)=>e.jsx(Z.Item,{ref:r,className:oe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",t),...s}));le.displayName=Z.Item.displayName;function ea(){const[t,s]=m.useState(!1),r=Qe();m.useEffect(()=>{const n=i=>
11{(i.key==="k"||i.key==="K")&&(i.metaKey||i.ctrlKey)&&(i.preventDefault(),s(l=>!l))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[]);const a=n=>{s(!1),r(n)};return e.jsxs(Zr,{open:t,onOpenChange:s,children:[e.jsx(ss,{placeholder:"Jump to anything â embeds, analytics, settingsâ¦"}),e.jsxs(rs,{children:[e.jsx(as,{children:"No matches."}),e.jsxs(qe,{heading:"Go to",children:[e.jsxs(le,{onSelect:()=>a("/dashboard"),children:[e.jsx(Ks,{className:"mr-2 h-4 w-4"})," Dashboard"]}),e.jsxs(le,{onSelect:()=>a("/embeds"),children:[e.jsx(tt,{className:"mr-2 h-4 w-4"})," Anves"]}),e.jsxs(le,{onSelect:()=>a("/analytics"),children:[e.jsx(Re,{className:"mr-2 h-4 w-4"})," Analytics"]}),e.jsxs(le,{onSelect:()=>a("/billing"),children:[e.jsx(Us,{className:"mr-2 h-4 w-4"})," Billing"]}),e.jsxs(le,{onSelect:()=>a("/integrations"),children:[e.jsx(Kt,{className:"mr-2 h-4 w-4"})," Integrations"]}),e.jsxs(le,{onSelect:()=>a("/settings"),children:[e.jsx(Gs,{className:"mr-2 h-4 w-4"})," Settings"]})]}),e.jsx(ns,{}),e.jsxs(qe,{heading:"Actions",children:[e.jsxs(le,{onSelect:()=>a("/embeds/create"),children:[e.jsx(Rt,{className:"mr-2 h-4 w-4"})," Create a new Anve"]}),e.jsxs(le,{onSelect:()=>a("/support-ticket"),children:[e.jsx(et,{className:"mr-2 h-4 w-4"})," Open a support ticket"]})]})]})]})}function ta({recommendation:t,readinessPct:s}){const{stepIndex:r,totalSteps:a,headline:n,subhead:i,kind:l,to:o}=t;return e.jsxs("div",{className:"v2-glass is-static p-5 h-full flex flex-col",style:{borderColor:"var(--v2-border-hi)"},children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 mb-3",children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-[0.12em] v2-mono",style:{color:"var(--v2-text-dim)"},children:["Next step · ",r," of ",a]}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1 max-w-[260px]",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-[0.1em] shrink-0",style:{color:"var(--v2-text-dim)"},children:"Launch"}),e.jsx("div",{className:"h-1 rounded-full flex-1 overflow-hidden",style:{background:"rgba(255,255,255,0.05)"},children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${s}%`,background:"var(--v2-grad-hero)",transition:"width 600ms cubic-bezier(0.22,1,0.36,1)"}})}),e.jsxs("span",{className:"v2-mono text-[10px] tabular-nums shrink-0",style:{color:"var(--v2-text-muted)"},children:[s,"%"]})]})]}),e.jsx("h2",{className:"text-[22px] leading-tight font-medium",style:{color:"var(--v2-text)"},children:n}),e.jsx("p",{className:"text-sm mt-1.5",style:{color:"var(--v2-text-muted)"},children:i}),e.jsxs("div",{className:"mt-4 flex-1",children:[l==="create"&&e.jsx(ra,{}),l==="knowledge"&&e.jsx(aa,{embedId:t.ctx.firstEmbedId}),l==="test_call"&&e.jsx(na,{embedId:t.ctx.firstEmbedId}),l==="install"&&e.jsx(ia,{embedId:t.ctx.firstEmbedId,domain:t.ctx.domain,position:t.ctx.embedPosition??"bottom-right",theme:t.ctx.embedTheme??"light"}),l==="verify"&&e.jsx(oa,{embedId:t.ctx.firstEmbedId,domain:t.ctx.domain}),l==="lead"&&e.jsx(la,{embedId:t.ctx.firstEmbedId}),l==="upgrade"&&e.jsx(ca,{tokenPct:t.ctx.tokenPct??0}),l==="invite"&&e.jsx(da,{})]}),e.jsx("div",{className:"mt-3 pt-3 flex items-center justify-end",style:{borderTop:"1px solid var(--v2-border)"},children:e.jsxs(K,{to:o,className:"inline-flex items-center gap-1 text-[11px]",style:{color:"var(--v2-text-dim)"},children:["Open bot settings ",e.jsx(se,{className:"h-3 w-3"})]})})]})}const sa=[{id:"ai_receptionist",label:"Receptionist",desc:"Books & routes calls"},{id:"ecommerce_support",label:"Support",desc:"Returns, orders, FAQs"},{id:"saas_demo",label:"Sales",desc:"Demos & lead capture"}];function ra(){return e.jsxs("div",{children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:sa.map(t=>e.jsxs(K,{to:`/embeds/create?template=${t.id}`,className:"group rounded-lg p-3 text-left transition-colors",style:{background:"rgba(255,255,255,0.03)",border:"1px solid var(--v2-border)"},children:[e.jsx("div",{className:"inline-flex items-center justify-center rounded-md mb-2",style:{width:28,height:28,background:"var(--v2-primary-soft)",color:"var(--v2-primary)"},children:e.jsx(re,{className:"h-3.5 w-3.5"})}),e.jsx("div",{className:"text-sm",style:{color:"var(--v2-text)"},children:t.label}),e.jsx("div",{className:"text-[11px]",style:{color:"var(--v2-text-dim)"},children:t.desc})]},t.id))}),e.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[e.jsxs(K,{to:"/embeds/create",className:"v2-cta",children:["Create bot ",e.jsx(se,{className:"h-3.5 w-3.5"})]}),e.jsx(K,{to:"/embeds/create",className:"text-[12px]",style:{color:"var(--v2-text-dim)"},children:"Start from scratch âº"})]})]})}function aa({embedId:t}){const[s,r]=m.useState(""),a=t?`/embeds/${t}?addKnowledge=${encodeURIComponent(s)}`:"/embeds";return e.jsxs("div",{children:[e.jsxs("form",{onSubmit:n=>{n.preventDefault(),s.trim()&&(window.location.href=a)},className:"flex gap-2",children:[e.jsx("input",{type:"url",value:s,onChange:n=>r(n.target.value),placeholder:"https://your-site.com/docs",className:"flex-1 min-w-0 px-3 py-2 text-sm rounded-md outline-none",style:{background:"rgba(255,255,255,0.03)",border:"1px solid var(--v2-border)",color:"var(--v2-text)"}}),e.jsxs("button",{type:"submit",className:"v2-cta",children:["Add knowledge ",e.jsx(se,{className:"h-3.5 w-3.5"})]})]}),e.jsx("div",{className:"text-[11px] mt-2",style:{color:"var(--v2-text-dim)"},children:"Or upload a PDF / docx from the bot page."})]})}function na({embedId:t}){const s=t?`/embeds/${t}?preview=1`:"/embeds";return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(K,{to:s,className:"v2-cta",children:[e.jsx(Vs,{className:"h-3.5 w-3.5"})," Open voice preview"]}),e.jsx("span",{className:"text-[12px]",style:{color:"var(--v2-text-dim)"},children:'Say "What can you do?" to hear it answer.'})]})}function ia({embedId:t,domain:s,position:r,theme:a}){const n=t?Je(t,{position:r,theme:a}):"<!-- create a bot first -->",[i,l]=m.useState(!1),o=async()=>{try{await navigator.clipboard.writeText(n),l(!0),setTimeout(()=>l(!1),1800)}catch{}};return e.jsxs("div",{children:[e.jsxs("div",{className:"relative rounded-lg p-3 pr-12 v2-mono text-[11px] leading-relaxed overflow-hidden",style:{background:"rgba(0,0,0,0.35)",border:"1px solid var(--v2-border)",color:"var(--v2-text-muted)",maxHeight:92},children:[e.jsx("pre",{className:"whitespace-pre-wrap break-all m-0",children:n}),e.jsxs("button",{type:"button",onClick:o,className:"absolute top-2 right-2 inline-flex items-center gap-1 px-2 py-1 rounded text-[10px] uppercase tracking-wider",style:{color:i?"var(--v2-good)":"var(--v2-text)",background:"rgba(255,255,255,0.06)",border:`1px solid ${i?"var(--v2-good)":"var(--v2-border)"}`},children:[i?e.jsx(Se,{className:"h-3 w-3"}):e.jsx(Le,{className:"h-3 w-3"}),i?"Copied":"Copy"]})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-[11px]",style:{color:"var(--v2-text-muted)"},children:[e.jsx("span",{className:"inline-block rounded-full",style:{width:7,height:7,background:"var(--v2-accent)",boxShadow:"0 0 8px var(--v2-accent)",animation:"v2-pulse 1.6s ease-in-out infinite"}}),"Waiting for first call",s?` from ${s}`:""]}),s&&e.jsxs("a",{href:s.startsWith("http")?s:`https://${s}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[11px]",style:{color:"var(--v2-text-dim)"},children:["Open site ",e.jsx(Mt,{className:"h-3 w-3"})]})]})]})}function oa({embedId:t,domain:s}){const r=t?`${window.location.origin}/embeds/${t}?preview=1`:null,[a,n]=m.useState(!1);return e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s&&e.jsxs("a",{href:s.startsWith("http")?s:`https://${s}`,target:"_blank",rel:"noreferrer",className:"v2-cta",children:[e.jsx(Kt,{className:"h-3.5 w-3.5"})," Open ",s]}),r&&e.jsxs("button",{type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),1800)}catch{}},className:"inline-flex items-center gap-1 text-[12px] px-2.5 py-1.5 rounded-md",style:{color:a?"var(--v2-good)":"var(--v2-text)",background:"rgba(255,255,255,0.04)",border:`1px solid ${a?"var(--v2-good)":"var(--v2-border)"}`},children:[a?e.jsx(Se,{className:"h-3 w-3"}):e.jsx(Le,{className:"h-3 w-3"}),a?"Preview link copied":"Copy preview link"]})]})}function la({embedId:t}){const s=t?`/embeds/${t}`:"/embeds";return e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(K,{to:`${s}?tool=calendly`,className:"v2-cta",children:[e.jsx(De,{className:"h-3.5 w-3.5"})," Connect Calendly"]}),e.jsx(K,{to:`${s}?tool=lead_form`,className:"inline-flex items-center gap-1 text-[12px] px-2.5 py-1.5 rounded-md",style:{color:"var(--v2-text)",background:"rgba(255,255,255,0.04)",border:"1px solid var(--v2-border)"},children:"+ Add lead form"})]})}function ca({tokenPct:t}){const s=[{name:"Pro",price:"$49/mo",desc:"10à tokens · tools · custom branding"},{name:"Scale",price:"$199/mo",desc:"100à tokens · priority routing · white-label"}];return e.jsxs("div",{children:[e.jsx("div",{className:"h-1.5 rounded-full overflow-hidden mb-3",style:{background:"rgba(255,255,255,0.05)"},children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.min(100,t)}%`,background:t>=90?"var(--v2-bad)":"var(--v2-warn)"}})}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:s.map(r=>e.jsxs(K,{to:`/billing?plan=${r.name.toLowerCase()}`,className:"rounded-lg p-3 transition-colors",style:{background:"rgba(255,255,255,0.03)",border:"1px solid var(--v2-border)"},children:[e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-sm",style:{color:"var(--v2-text)"},children:r.name}),e.jsx("span",{className:"v2-mono text-[12px]",style:{color:"var(--v2-primary)"},children:r.price})]}),e.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--v2-text-dim)"},children:r.desc})]},r.name))})]})}function da(){const[t,s]=m.useState("");return e.jsxs("form",{onSubmit:r=>{r.preventDefault(),t.trim()&&(window.location.href=`/settings/team?invite=${encodeURIComponent(t)}`)},className:"flex gap-2",children:[e.jsx("input",{type:"email",value:t,onChange:r=>s(r.target.value),placeholder:"[email protected]",className:"flex-1 min-w-0 px-3 py-2 text-sm rounded-md outline-none",style:{background:"rgba(255,255,255,0.03)",border:"1px solid var(--v2-border)",color:"var(--v2-text)"}}),e.jsxs("button",{type:"submit",className:"v2-cta",children:[e.jsx(Ws,{className:"h-3.5 w-3.5"})," Send invite"]})]})}const de=8;function ma(t){const s={firstEmbedId:t.firstEmbedId,firstEmbedName:t.firstEmbedName,domain:null};return t.embedsCount===0?{id:"create",kind:"create",stepIndex:1,totalSteps:de,headline:"Create your first bot",subhead:"Pick a template â you'll be live in 90 seconds.",to:"/embeds/create",ctx:s}:t.hasKnowledge?t.testCallsCount===0?{id:"test_call",kind:"test_call",stepIndex:3,totalSteps:de,headline:"Make a test call",subhead:"30 seconds will tell you more than 30 minutes of tweaking.",to:t.firstEmbedId?`/embeds/${t.firstEmbedId}`:"/embeds",ctx:s}:t.firstUninstalledEmbedId?{id:"install",kind:"install",stepIndex:4,totalSteps:de,headline:t.firstUninstalledEmbedSite?`Install on ${t.firstUninstalledEmbedSite}`:"Install the snippet",subhead:"One <script> tag. Copy it, paste it before </head>.",to:`/embeds/${t.firstUninstalledEmbedId}`,ctx:{firstEmbedId:t.firstUninstalledEmbedId,firstEmbedName:t.firstEmbedName,domain:t.firstUninstalledEmbedSite??null,embedPosition:t.firstUninstalledEmbedPosition??"bottom-right",embedTheme:t.firstUninstalledEmbedTheme??"light"}}
11:t.installedCount>0&&t.realSessions===0?{id:"verify",kind:"verify",stepIndex:5,totalSteps:de,headline:"Verify your install",subhead:t.firstEmbedSite?`Open ${t.firstEmbedSite} and trigger the widget once.`:"Open your site and trigger the widget once.",to:t.firstEmbedId?`/embeds/${t.firstEmbedId}`:"/embeds",ctx:{...s,domain:t.firstEmbedSite??null}}:t.realSessions>=5&&!t.hasLeadTool?{id:"lead",kind:"lead",stepIndex:6,totalSteps:de,headline:"Capture leads from calls",subhead:"Connect Calendly or add a lead form â turn chats into contacts.",to:t.firstEmbedId?`/embeds/${t.firstEmbedId}`:"/embeds",ctx:s}:t.planIsFree&&t.tokenPct>=80?{id:"upgrade",kind:"upgrade",stepIndex:7,totalSteps:de,headline:"Upgrade before calls fail",subhead:`You've used ${Math.round(t.tokenPct)}% of free tokens this month.`,to:"/billing",ctx:{...s,tokenPct:t.tokenPct}}:{id:"invite",kind:"invite",stepIndex:8,totalSteps:de,headline:"Invite a teammate",subhead:"Share monitoring and prompt tuning with the team.",to:"/settings/team",ctx:s}:{id:"knowledge",kind:"knowledge",stepIndex:2,totalSteps:de,headline:"Add knowledge",subhead:"Paste a URL or upload a doc so it can answer questions.",to:t.firstEmbedId?`/embeds/${t.firstEmbedId}`:"/embeds",ctx:s}}function ua(t){if(!t.length)return 0;const s=t.filter(r=>r.done).length;return Math.round(s/t.length*100)}function pa(t){if(!t||t<1)return"â";const s=Math.floor(t/60),r=Math.round(t%60);return s>0?`${s}m${r.toString().padStart(2,"0")}s`:`${r}s`}function xa({todaySessions:t,weekDeltaPct:s,activeNow:r,avgDurationSec:a,successRate:n,toolCalls:i}){const o=s===null?zs:s>=0?st:qs,c=s===null?"var(--v2-text-dim)":s>=0?"var(--v2-good)":"var(--v2-bad)";return e.jsxs("div",{className:"v2-glass is-static p-5 h-full flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] mb-2",style:{color:"var(--v2-text-dim)"},children:"Sessions today"}),e.jsxs("div",{className:"flex items-baseline gap-3 flex-wrap",children:[e.jsx("span",{className:"v2-mono font-medium leading-none",style:{fontSize:"clamp(40px, 6vw, 56px)",color:"var(--v2-text)"},children:t.toLocaleString()}),s!==null&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-md",style:{color:c,background:"rgba(255,255,255,0.03)",border:"1px solid var(--v2-border)"},children:[e.jsx(o,{className:"h-3 w-3"}),e.jsxs("span",{className:"v2-mono",children:[s>=0?"+":"",s.toFixed(0),"%"]}),e.jsx("span",{style:{color:"var(--v2-text-dim)"},children:"vs prev 7d"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mt-6 pt-4",style:{borderTop:"1px solid var(--v2-border)"},children:[e.jsx(Ee,{label:"Active now",value:r.toString(),accent:r>0}),e.jsx(Ee,{label:"Tool calls · 30d",value:i.toLocaleString()}),e.jsx(Ee,{label:"Avg duration",value:pa(a)}),e.jsx(Ee,{label:"Success rate",value:`${Math.round(n)}%`})]})]})}function Ee({label:t,value:s,accent:r}){return e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-[0.08em] mb-1 flex items-center gap-1.5",style:{color:"var(--v2-text-dim)"},children:[r&&e.jsx("span",{className:"inline-block rounded-full",style:{width:6,height:6,background:"var(--v2-accent)",boxShadow:"0 0 8px var(--v2-accent)"}}),t]}),e.jsx("div",{className:"v2-mono text-sm",style:{color:r?"var(--v2-accent)":"var(--v2-text)"},children:s})]})}var ha=["type","layout","connectNulls","ref"],fa=["key"];function ye(t){"@babel/helpers - typeof";return ye=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},ye(t)}function ft(t,s){if(t==null)return{};var r=va(t,s),a,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],!(s.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}function va(t,s){if(t==null)return{};var r={};for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){if(s.indexOf(a)>=0)continue;r[a]=t[a]}return r}function Ne(){return Ne=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var r=arguments[s];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Ne.apply(this,arguments)}function vt(t,s){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);
vendor: 9,114 bytes, lines 11-12
11s&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,a)}return r}function ee(t){for(var s=1;s<arguments.length;s++){var r=arguments[s]!=null?arguments[s]:{};s%2?vt(Object(r),!0).forEach(function(a){ae(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vt(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function fe(t){return ja(t)||ya(t)||ba(t)||ga()}function ga(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 12In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ba(t,s){if(t){if(typeof t=="string")return Ye(t,s);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ye(t,s)}}function ya(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ja(t){if(Array.isArray(t))return Ye(t)}function Ye(t,s){(s==null||s>t.length)&&(s=t.length);for(var r=0,a=new Array(s);r<s;r++)a[r]=t[r];return a}function wa(t,s){if(!(t instanceof s))throw new TypeError("Cannot call a class as a function")}function gt(t,s){for(var r=0;r<s.length;r++){var a=s[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,os(a.key),a)}}function Na(t,s,r){return s&>(t.prototype,s),r&>(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ka(t,s,r){return s=Pe(s),Sa(t,is()?Reflect.construct(s,r||[],Pe(t).constructor):s.apply(t,r))}function Sa(t,s){if(s&&(ye(s)==="object"||typeof s=="function"))return s;if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ca(t)}function Ca(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function is(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(is=function(){return!!t})()}function Pe(t){return Pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Pe(t)}function Aa(t,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(s&&s.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),s&&He(t,s)}function He(t,s){return He=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},He(t,s)}function ae(t,s,r){return s=os(s),s in t?Object.defineProperty(t,s,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[s]=r,t}function os(t){var s=_a(t,"string");return ye(s)=="symbol"?s:s+""}function _a(t,s){if(ye(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,s||"default");if(ye(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(t)}var Ae=function(t){function s(){var r;wa(this,s);for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return r=ka(this,s,[].concat(n)),ae(r,"state",{isAnimationFinished:!0,totalLength:0}),ae(r,"generateSimpleStrokeDasharray",function(l,o){return"".concat(o,"px ").concat(l-o,"px")}),ae(r,"getStrokeDasharray",function(l,o,c){var d=c.reduce(function(E,V){return E+V});if(!d)return r.generateSimpleStrokeDasharray(o,l);for(var p=Math.floor(l/d),v=l%d,f=o-l,x=[],g=0,S=0;g<c.length;S+=c[g],++g)if(S+c[g]>v){x=[].concat(fe(c.slice(0,g)),[v-S]);break}var C=x.length%2===0?[0,f]:[f];return[].concat(fe(s.repeat(c,p)),fe(x),C).map(function(E){return"".concat(E,"px")}).join(", ")}),ae(r,"id",ar("recharts-line-")),ae(r,"pathRef",function(l){r.mainCurve=l}),ae(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),ae(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return Aa(s,t),Na(s,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var a=this.getTotalLength();this.setState({totalLength:a})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var a=this.getTotalLength();a!==this.state.totalLength&&this.setState({totalLength:a})}}},{key:"getTotalLength",value:function(){var a=this.mainCurve;try{return a&&a.getTotalLength&&a.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(a,n){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,l=i.points,o=i.xAxis,c=i.yAxis,d=i.layout,p=i.children,v=Xs(p,Js);if(!v)return null;var f=function(S,C){return{x:S.x,y:S.y,value:S.value,errorVal:Ut(S.payload,C)}},x={clipPath:a?"url(#clipPath-".concat(n,")"):null};return J.createElement(Oe,x,v.map(function(g){return J.cloneElement(g,{key:"bar-".concat(g.props.dataKey),data:l,xAxis:o,yAxis:c,layout:d,dataPointFormatter:f})}))}},{key:"renderDots",value:function(a,n,i){var l=this.props.isAnimationActive;if(l&&!this.state.isAnimationFinished)return null;var o=this.props,c=o.dot,d=o.points,p=o.dataKey,v=Ie(this.props,!1),f=Ie(c,!0),x=d.map(function(S,C){var E=ee(ee(ee({key:"dot-".concat(C),r:3},v),f),{},{index:C,cx:S.x,cy:S.y,value:S.value,dataKey:p,payload:S.payload,points:d});return s.renderDotItem(c,E)}),g={clipPath:a?"url(#clipPath-".concat(n?"":"dots-").concat(i,")"):null};return J.createElement(Oe,Ne({className:"recharts-line-dots",key:"dots"},g),x)}},{key:"renderCurveStatically",value:function(a,n,i,l){var o=this.props,c=o.type,d=o.layout,p=o.connectNulls;o.ref;var v=ft(o,ha),f=ee(ee(ee({},Ie(v,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:n?"url(#clipPath-".concat(i,")"):null,points:a},l),{},{type:c,layout:d,connectNulls:p});return J.createElement(Zs,Ne({},f,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(a,n){var i=this,l=this.props,o=l.points,c=l.strokeDasharray,d=l.isAnimationActive,p=l.animationBegin,v=l.animationDuration,f=l.animationEasing,x=l.animationId,g=l.animateNewValues,S=l.width,C=l.height,E=this.state,V=E.prevPoints,Q=E.totalLength;return J.createElement(er,{begin:p,duration:v,isActive:d,easing:f,from:{t:0},to:{t:1},key:"line-".concat(x),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(X){var F=X.t;if(V){var D=V.length/o.length,P=o.map(function(y,w){var _=Math.floor(w*D);if(V[_]){var T=V[_],L=je(T.x,y.x),q=je(T.y,y.y);return ee(ee({},y),{},{x:L(F),y:q(F)})}if(g){var M=je(S*2,y.x),U=je(C/2,y.y);return ee(ee({},y),{},{x:M(F),y:U(F)})}return ee(ee({},y),{},{x:y.x,y:y.y})});return i.renderCurveStatically(P,a,n)}var te=je(0,Q),W=te(F),h;if(c){var k="".concat(c).split(/[,\s]+/gim).map(function(y){return parseFloat(y)});h=i.getStrokeDasharray(W,Q,k)}else h=i.generateSimpleStrokeDasharray(Q,W);return i.renderCurveStatically(o,a,n,{strokeDasharray:h})})}},{key:"renderCurve",value:function(a,n){var i=this.props,l=i.points,o=i.isAnimationActive,c=this.state,d=c.prevPoints,p=c.totalLength;return o&&l&&l.length&&(!d&&p>0||!tr(d,l))?this.renderCurveWithAnimation(a,n):this.renderCurveStatically(l,a,n)}},{key:"render",value:function(){var a,n=this.props,i=n.hide,l=n.dot,o=n.points,c=n.className,d=n.xAxis,p=n.yAxis,v=n.top,f=n.left,x=n.width,g=n.height,S=n.isAnimationActive,C=n.id;if(i||!o||!o.length)return null;var E=this.state.isAnimationFinished,V=o.length===1,Q=nt("recharts-line",c),X=d&&d.allowDataOverflow,F=p&&p.allowDataOverflow,D=X||F,P=Ve(C)?this.id:C,te=(a=Ie(l,!1))!==null&&a!==void 0?a:{r:3,strokeWidth:2},W=te.r,h=W===void 0?3:W,k=te.strokeWidth,y=k===void 0?2:k,w=sr(l)?l:{},_=w.clipDot,T=_===void 0?!0:_,L=h*2+y;return J.createElement(Oe,{className:Q},X||F?J.createElement("defs",null,J.createElement("clipPath",{id:"clipPath-".concat(P)},J.createElement("rect",{x:X?f:f-x/2,y:F?v:v-g/2,width:X?x:x*2,height:F?g:g*2})),!T&&J.createElement("clipPath",{id:"clipPath-dots-".concat(P)},J.createElement("rect",{x:f-L/2,y:v-L/2,width:x+L,height:g+L}))):null,!V&&this.renderCurve(D,P),this.renderErrorBar(D,P),(V||l)&&this.renderDots(D,T,P),(!S||E)&&rr.renderCallByParent(this.props,o))}}],[{key:"getDerivedStateFromProps",value:function(a,n){return a.animationId!==n.prevAnimationId?{prevAnimationId:a.animationId,curPoints:a.points,prevPoints:n.curPoints}:a.points!==n.curPoints?{curPoints:a.points}:null}},{key:"repeat",value:function(a,n){for(var i=a.length%2!==0?[].concat(fe(a),[0]):a,l=[],o=0;o<n;++o)l=[].concat(fe(l),fe(i));return l}},{key:"renderDotItem",value:function(a,n){var i;if(J.isValidElement(a))i=J.cloneElement(a,n);else if(mr(a))i=a(n);else{var l=n.key,o=ft(n,fa),c=nt("recharts-line-dot",typeof a!="boolean"?a.className:"");i=J.createElement(Qs,Ne({key:l},o,{className:c}))}return i}}])}(m.PureComponent);ae(Ae,"displayName","Line");ae(Ae,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendT
12ype:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Hs.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});ae(Ae,"getComposedData",function(t){var s=t.props,r=t.xAxis,a=t.yAxis,n=t.xAxisTicks,i=t.yAxisTicks,l=t.dataKey,o=t.bandSize,c=t.displayedData,d=t.offset,p=s.layout,v=c.map(function(f,x){var g=Ut(f,l);return p==="horizontal"?{x:ot({axis:r,ticks:n,bandSize:o,entry:f,index:x}),y:Ve(g)?null:a.scale(g),value:g,payload:f}:{x:Ve(g)?null:r.scale(g),y:ot({axis:a,ticks:i,bandSize:o,entry:f,index:x}),value:g,payload:f}});return ee({points:v,layout:p},d)});var Ia=nr({chartName:"LineChart",GraphicalChild:Ae,axisComponents:[{axisType:"xAxis",AxisComp:Gt},{axisType:"yAxis",AxisComp:Vt}],formatAxisMap:ir});function Ea({data:t,isDemo:s}){const[r,a]=m.useState(30),n=m.useMemo(()=>[...t].sort((d,p)=>d.date.localeCompare(p.date)).slice(-r).map(d=>({date:d.date.slice(5).replace("-","/"),sessions:d.total_sessions??0})),[t,r]),i=n.reduce((o,c)=>o+c.sessions,0),l=n.reduce((o,c)=>Math.max(o,c.sessions),0);return e.jsxs("div",{className:"v2-glass is-static p-5 h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4 flex-wrap gap-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] mb-1",style:{color:"var(--v2-text-dim)"},children:"Session volume"}),e.jsxs("div",{className:"flex items-baseline gap-3",children:[e.jsx("span",{className:"v2-mono text-2xl",style:{color:"var(--v2-text)"},children:i.toLocaleString()}),e.jsxs("span",{className:"text-[11px]",style:{color:"var(--v2-text-dim)"},children:["total · peak ",l]})]})]}),e.jsx("div",{className:"inline-flex rounded-md p-0.5",style:{background:"rgba(255,255,255,0.03)",border:"1px solid var(--v2-border)"},children:[7,30,90].map(o=>e.jsxs("button",{type:"button",onClick:()=>a(o),className:"px-2.5 py-1 text-[11px] v2-mono rounded transition-colors",style:{background:r===o?"var(--v2-primary-soft)":"transparent",color:r===o?"var(--v2-text)":"var(--v2-text-dim)"},children:[o,"d"]},o))})]}),e.jsxs("div",{className:"flex-1 min-h-[180px] relative",children:[s&&e.jsx("span",{className:"absolute top-1 right-1 z-10 text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded",style:{color:"var(--v2-text-dim)",background:"rgba(255,255,255,0.04)",border:"1px solid var(--v2-border)"},children:"Demo data"}),e.jsx(rt,{width:"100%",height:"100%",children:e.jsxs(Wt,{data:n,margin:{top:4,right:4,left:-16,bottom:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"v2-sessions-grad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#7C3AED",stopOpacity:.4}),e.jsx("stop",{offset:"100%",stopColor:"#7C3AED",stopOpacity:0})]})}),e.jsx(lr,{vertical:!1,strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.06)"}),e.jsx(Gt,{dataKey:"date",tick:{fontSize:10,fill:"#6B6788"},axisLine:!1,tickLine:!1,minTickGap:24}),e.jsx(Vt,{tick:{fontSize:10,fill:"#6B6788"},axisLine:!1,tickLine:!1,width:28,allowDecimals:!1}),e.jsx(or,{cursor:{stroke:"rgba(124,58,237,0.3)",strokeWidth:1},content:e.jsx(Ys,{valueLabel:"sessions"})}),e.jsx(zt,{type:"monotone",dataKey:"sessions",name:"sessions",stroke:"#7C3AED",strokeWidth:2,fill:"url(#v2-sessions-grad)",isAnimationActive:!1})]})})]})]})}function Da({phase1:t,phase2:s}
12){const r=[...t,...s],a=r.filter(p=>p.done).length,n=r.length?a/r.length*100:0,i=a===r.length,[l,o]=m.useState(i),c=m.useMemo(()=>r.find(p=>!p.done),[r]),d=t.every(p=>p.done);return e.jsxs("div",{className:"v2-glass is-static overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:()=>o(p=>!p),className:"w-full px-5 py-3 flex items-center gap-3 text-left",children:[e.jsx(re,{className:"h-4 w-4 shrink-0",style:{color:"var(--v2-primary)"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm",style:{color:"var(--v2-text)"},children:i?"Launch complete":d?"Production-ready checklist":"Launch checklist"}),e.jsxs("div",{className:"text-[11px]",style:{color:"var(--v2-text-dim)"},children:[a," of ",r.length," complete"]})]}),e.jsx("div",{className:"hidden sm:block flex-1 max-w-[120px]",children:e.jsx(Ta,{pct:n})}),e.jsx(cr,{className:"h-4 w-4 transition-transform",style:{color:"var(--v2-text-dim)",transform:l?"none":"rotate(180deg)"}})]}),!l&&e.jsxs("div",{className:"px-5 pb-5 pt-1 space-y-5",style:{borderTop:"1px solid var(--v2-border)"},children:[e.jsx(bt,{title:"Phase 1 · First call working",items:t,highlight:c==null?void 0:c.id}),e.jsx(bt,{title:"Phase 2 · Production-ready",items:s,highlight:c==null?void 0:c.id})]})]})}function bt({title:t,items:s,highlight:r}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.1em] mb-2 mt-4",style:{color:"var(--v2-text-dim)"},children:t}),e.jsx("ul",{className:"space-y-1.5",children:s.map(a=>e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",style:{background:a.id===r?"rgba(124,58,237,0.08)":"transparent",border:`1px solid ${a.id===r?"var(--v2-border-hi)":"transparent"}`},children:[e.jsx("span",{className:"inline-flex items-center justify-center shrink-0",style:{width:18,height:18,borderRadius:999,background:a.done?"var(--v2-primary-soft)":"transparent",border:`1px solid ${a.done?"var(--v2-primary)":"var(--v2-border-strong)"}`},children:a.done&&e.jsx(Se,{className:"h-2.5 w-2.5",style:{color:"var(--v2-primary)"}})}),e.jsx("span",{className:"text-sm flex-1 min-w-0",style:{color:a.done?"var(--v2-text-dim)":"var(--v2-text)",textDecoration:a.done?"line-through":"none"},children:a.label}),!a.done&&e.jsxs(K,{to:a.to,className:"inline-flex items-center gap-1 text-[11px] px-2.5 py-1 rounded-md shrink-0 transition-colors",style:{color:a.id===r?"#fff":"var(--v2-text)",background:a.id===r?"var(--v2-grad-hero)":"rgba(255,255,255,0.04)",border:"1px solid var(--v2-border)"},children:[a.ctaLabel,e.jsx(se,{className:"h-3 w-3"})]})]},a.id))})]})}function Ta({pct:t}){return e.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"rgba(255,255,255,0.05)"},children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${t}%`,background:"var(--v2-grad-hero)"}})})}function $a({planLabel:t,tokensUsed:s,tokensLimit:r,bonusTokens:a=0,daily:n}){const i=r<0,l=a>0,o=i?-1:r+a,c=i?0:Math.min(100,s/Math.max(1,o)*100),d=c>=90?"var(--v2-bad)":c>=70?"var(--v2-warn)":"var(--v2-primary)",p=(n??[]).slice().sort((C,E)=>C.date.localeCompare(E.date)).slice(-14).map((C,E)=>({i:E,v:C.total_sessions??0})),v=new Date,f=v.getDate(),x=new Date(v.getFullYear(),v.getMonth()+1,0).getDate(),g=f/x,S=!i&&g>.5&&s>0?Math.round(s/g):null;return e.jsxs("div",{className:"v2-glass is-static p-5 h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] mb-1",style:{color:"var(--v2-text-dim)"},children:"Plan · usage"}),e.jsx("div",{className:"text-sm",style:{color:"var(--v2-text)"},children:t??"Free"})]}),e.jsxs(K,{to:"/billing",className:"inline-flex items-center gap-1 text-[11px] px-2.5 py-1 rounded-md",style:{color:"var(--v2-text)",background:"rgba(255,255,255,0.04)",border:"1px solid var(--v2-border)"},children:["Manage ",e.jsx(dr,{className:"h-3 w-3"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"v2-mono text-sm",style:{color:"var(--v2-text)"}
12,children:s.toLocaleString()}),e.jsxs("span",{className:"v2-mono text-[11px]",style:{color:"var(--v2-text-dim)"},children:["/ ",i?"â":o.toLocaleString()," tokens",l&&e.jsxs("span",{style:{color:"var(--v2-primary)"},children:[" · incl. ",a.toLocaleString()," bonus"]})]})]}),e.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"rgba(255,255,255,0.05)"},children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${i?0:c}%`,background:d}})}),S!==null&&e.jsxs("div",{className:"text-[11px] flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--v2-text-dim)"},children:"Projected end-of-month"}),e.jsx("span",{className:"v2-mono",style:{color:S>o?"var(--v2-bad)":"var(--v2-text-muted)"},children:S.toLocaleString()})]})]}),p.length>1&&e.jsxs("div",{className:"mt-auto pt-4",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] mb-1",style:{color:"var(--v2-text-dim)"},children:"14d activity"}),e.jsx("div",{className:"h-8",children:e.jsx(rt,{width:"100%",height:"100%",children:e.jsx(Ia,{data:p,children:e.jsx(Ae,{type:"monotone",dataKey:"v",stroke:"#7C3AED",strokeWidth:1.5,dot:!1,isAnimationActive:!1})})})})]}),(c>=80||(t??"").toLowerCase().includes("free"))&&e.jsx(K,{to:"/billing",className:"v2-cta mt-4 w-full justify-center",children:c>=80?"Upgrade to keep scaling":"See Pro limits"})]})}function Pa({active:t=!1,bars:s=5,className:r}){return t?e.jsx("div",{className:oe("inline-flex items-center",r),role:"img","aria-label":"Live call in progress",style:{height:12},children:Array.from({length:s}).map((a,n)=>e.jsx("span",{className:"v2-wave-bar"},n))}):e.jsx("div",{className:oe("inline-flex items-center",r),"aria-hidden":!0,style:{height:12},children:e.jsx("span",{style:{display:"inline-block",width:s*3-1,height:1,background:"var(--v2-text-dim)",opacity:.5}})})}function La(t){if(!t||t<1)return"â";const s=Math.floor(t/60),r=Math.round(t%60);return s>0?`${s}m${r.toString().padStart(2,"0")}`:`${r}s`}function Ra(t){const s={active:{color:"var(--v2-good)",bg:"rgba(52,211,153,0.10)"},draft:{color:"var(--v2-text-muted)",bg:"rgba(255,255,255,0.04)"},paused:{color:"var(--v2-warn)",bg:"rgba(245,181,68,0.10)"}};return s[t]??s.draft}const Ma=[{id:"ecommerce_support",label:"E-commerce"},{id:"ai_receptionist",label:"Receptionist"},{id:"saas_demo",label:"SaaS demo"}];function Oa({rows:t}){const[s,r]=m.useState({key:"calls",dir:"desc"}),a=m.useMemo(()=>{const o=[...t];return o.sort((c,d)=>{const p=s.dir==="asc"?1:-1;switch(s.key){case"name":return p*c.name.localeCompare(d.name);case"calls":return p*((c.weekSessions??0)-(d.weekSessions??0));case"success":return p*((c.successRate??0)-(d.successRate??0));case"duration":return p*((c.avgDurationSec??0)-(d.avgDurationSec??0))}}),o},[t,s]);if(!t.length)return e.jsx("div",{className:"v2-glass is-static p-8",children:e.jsxs("div",{className:"max-w-md mx-auto text-center",children:[e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-[10px] uppercase tracking-wider mb-3",style:{background:"var(--v2-primary-soft)",color:"var(--v2-primary)"},children:[e.jsx(re,{className:"h-3 w-3"})," Start here"]}),e.jsx("h3",{className:"text-lg mb-2",style:{color:"var(--v2-text)"},children:"Spin up your first Anve"}),e.jsx("p",{className:"text-sm mb-5",style:{color:"var(--v2-text-muted)"},children:"Pick a template to start with battle-tested prompts, tools, and voice settings â or build from scratch."}),e.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2 mb-4",children:Ma.map(o=>e.jsx(K,{to:`/embeds/create?template=${o.id}`,className:"text-[11px] px-2.5 py-1 rounded-md",style:{color:"var(--v2-text)",background:"rgba(255,255,255,0.04)",border:"1px solid var(--v2-border)"},children:o.label},o.id))}),e.jsxs(K,{to:"/embeds/create",className:"v2-cta","data-tour":"tour-v2-create",children:["Start from scratch ",e.jsx(se,{className:"h-3.5 w-3.5"})]})]})});const n=o=>r(c=>c.key===o?{key:o,dir:c.dir==="asc"?"desc":"asc"}:{key:o,dir:"desc"}),i=({k:o,label:c,align:d="left"})=>e.jsxs("button",{type:"button",onClick:()=>n(o),className:`flex items-center gap-1 text-[10px] uppercase tracking-[0.08em] ${d==="right"?"justify-end":""}`,style:{color:s.key===o?"var(--v2-text)":"var(--v2-text-dim)"},children:[c,e.jsx(fr,{className:"h-3 w-3 opacity-60"})]});return e.jsxs("div",{className:"v2-glass is-static overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-3 flex items-center justify-between border-b",style:{borderColor:"var(--v2-border)"},children:[e.jsxs("span",{className:"text-[10px] uppercase tracking-[0.08em]",style:{color:"var(--v2-text-dim)"},children:["Fleet · ",t.length]}),e.jsx(K,{to:"/embeds/create",className:"text-[11px] hover:underline",style:{color:"var(--v2-accent)"},"data-tour":"tour-v2-create",children:"+ New Anve"})]}),e.jsxs("div",{className:"hidden md:grid px-5 py-2 border-b",style:{borderColor:"var(--v2-border)",gridTemplateColumns:"minmax(0,1fr) 80px 72px 110px 64px 64px 64px 80px",columnGap:12},children:[e.jsx(i,{k:"name",label:"Anve"}),e.jsx("span",{className:"text-[10px] uppercase tracking-[0.08em]",style:{color:"var(--v2-text-dim)"},children:"Status"}),e.jsx("span",{className:"text-[10px] uppercase tracking-[0.08em]",style:{color:"var(--v2-text-dim)"},children:"Lifecycle"}),e.jsx("span",{className:"text-[10px] uppercase tracking-[0.08em]",style:{color:"var(--v2-text-dim)"},children:"7d"}),e.jsx(i,{k:"calls",label:"Calls",align:"right"}),e.jsx(i,{k:"success",label:"OK%",align:"right"}),e.jsx(i,{k:"duration",label:"Avg",align:"right"}),e.jsx("span",{className:"text-[10px] uppercase tracking-[0.08em] text-right",style:{color:"var(--v2-text-dim)"},children:"Last"})]}),e.jsx("ul",{children:a.map((o,c)=>{const d=(o.sparkline??[]).map((v,f)=>({i:f,v})),p=Ra(o.status);return e.jsx("li",{className:`px-5 py-3 transition-colors hover:bg-[rgba(124,58,237,0.05)] ${o.liveCall?"v2-row-live":""}`,style:{borderTop:c===0?"none":"1px solid var(--v2-border)"},children:e.jsxs(K,{to:`/embeds/${o.id}`,className:"grid grid-cols-1 gap-y-2 md:grid-cols-[minmax(0,1fr)_80px_72px_110px_64px_64px_64px_80px] md:gap-x-3 md:gap-y-0 md:items-center",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(Pa,{active:!!o.liveCall,bars:4,className:"shrink-0"}),e.jsx("span",{className:"text-sm truncate",style:{color:"var(--v2-text)"},children:o.name})]}),e.jsxs("div",{className:"flex items-center gap-3 md:contents",children:[e.jsx("span",{className:"v2-mono text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded shrink-0 md:justify-self-start",style:{color:p.color,background:p.bg,border:"1px solid var(--v2-border)"},children:o.status}),e.jsx("div",{className:"hidden md:block",children:e.jsx(Fa,{built:!0,knowledge:!!o.hasKnowledge,installed:!!o.installed,traffic:!!o.hasSessions})}),e.jsx("div",{className:"h-7 min-w-0 flex-1 md:w-full",children:d.length>1?e.jsx(rt,{width:"100%",height:"100%",children:e.jsxs(Wt,{data:d,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`spark-${o.id}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#7C3AED",stopOpacity:.6}),e.jsx("stop",{offset:"100%",stopColor:"#7C3AED",stopOpacity:0})]})}),e.jsx(zt,{type:"monotone",dataKey:"v",stroke:"#7C3AED",strokeWidth:1.2,f
12ill:`url(#spark-${o.id})`,isAnimationActive:!1})]})}):e.jsx("span",{className:"text-[10px] v2-mono",style:{color:"var(--v2-text-dim)"},children:"â"})}),e.jsx("div",{className:"v2-mono text-xs text-right tabular-nums shrink-0",style:{color:"var(--v2-text-muted)"},children:(o.weekSessions??0).toLocaleString()}),e.jsx("div",{className:"v2-mono text-xs text-right tabular-nums shrink-0",style:{color:"var(--v2-text-muted)"},children:o.successRate!==void 0?`${o.successRate.toFixed(0)}%`:"â"}),e.jsx("div",{className:"hidden md:block v2-mono text-xs text-right tabular-nums",style:{color:"var(--v2-text-muted)"},children:La(o.avgDurationSec)}),e.jsx("div",{className:"hidden md:block v2-mono text-xs text-right tabular-nums",style:{color:"var(--v2-text-dim)"},children:o.lastActiveAgo??"â"})]})]})},o.id)})})]})}function Fa({built:t,knowledge:s,installed:r,traffic:a}){const n=[{on:t,label:"Built"},{on:s,label:"Knowledge"},{on:r,label:"Installed"},{on:a,label:"Traffic"}];return e.jsx("div",{className:"flex items-center gap-1.5","aria-label":"lifecycle",children:n.map((i,l)=>e.jsx("span",{title:`${i.label}: ${i.on?"â":"pending"}`,style:{width:7,height:7,borderRadius:999,background:i.on?"var(--v2-primary)":"transparent",border:`1px solid ${i.on?"var(--v2-primary)":"var(--v2-border-strong)"}`,boxShadow:i.on?"0 0 6px rgba(124,58,237,0.5)":"none"}},l))})}const Ba={resolved:"var(--v2-good)",completed:"var(--v2-good)",escalated:"var(--v2-warn)",abandoned:"var(--v2-bad)",active:"var(--v2-accent)"};function Ka({events:t,isDemo:s}){const[r,a]=m.useState(null);return t.length?e.jsxs("div",{className:"v2-glass is-static overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-3 border-b flex items-center justify-between",style:{borderColor:"var(--v2-border)"},children:[e.jsxs("span",{className:"text-[10px] uppercase tracking-[0.08em]",style:{color:"var(--v2-text-dim)"},children:["Recent conversations · ",t.length]}),s&&e.jsx("span",{className:"text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded",style:{color:"var(--v2-text-dim)",background:"rgba(255,255,255,0.04)",border:"1px solid var(--v2-border)"},children:"Demo data"})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx("ul",{className:"min-w-[560px] md:min-w-0",children:t.map((n,i)=>{const l=r===n.id,o=Ba[n.outcome]??"var(--v2-text-dim)";return e.jsxs("li",{style:{borderTop:i===0?"none":"1px solid var(--v2-border)",borderLeft:`2px solid ${o}`},children:[e.jsxs("button",{type:"button",onClick:()=>a(l?null:n.id),className:"w-full px-5 py-3 flex items-center gap-4 text-left transition-colors hover:bg-[rgba(124,58,237,0.05)]",children:[e.jsx(ur,{className:"h-3.5 w-3.5 shrink-0 transition-transform",style:{color:"var(--v2-text-dim)",transform:l?"rotate(90deg)":"none"}}),e.jsx("span",{className:"v2-mono text-xs w-14 shrink-0",style:{color:"var(--v2-text-dim)"},children:n.time}),n.bot&&e.jsx("span",{className:"text-[11px] px-1.5 py-0.5 rounded shrink-0 truncate max-w-[140px]",style:{color:"var(--v2-text-muted)",background:"rgba(255,255,255,0.03)"},children:n.bot}),e.jsx("span",{className:"text-sm flex-1 truncate min-w-0",style:{color:"var(--v2-text)"},children:n.intent}),e.jsx("span",{className:"v2-mono text-xs w-14 text-right shrink-0 tabular-nums",style:{color:"var(--v2-text-muted)"},children:n.duration}),e.jsx("span",{className:"text-[10px] uppercase tracking-wider w-20 text-right shrink-0",style:{color:o},children:n.outcome})]}),l&&n.snippet&&e.jsx("div",{className:"px-5 pb-4 pl-[68px] text-sm",style:{color:"var(--v2-text-muted)"},children:n.snippet})]},n.id)})})})]}):e.jsx("div",{className:"v2-glass is-static p-8 text-center",children:e.jsx("p",{className:"text-sm",style:{color:"var(--v2-text-muted)"},children:"No conversations yet. Once your Anve picks up its first call, it'll stream here."})})}function Ua({rows:t,title:s="Top bots · 7d",isDemo:r}){const a=Math.max(1,...t.map(i=>i.count)),n=t.slice(0,6);return e.jsxs("div",{className:"v2-glass is-static p-5 h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em]",style:{color:"var(--v2-text-dim)"},children:s}),r&&e.jsx("span",{className:"text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded",style:{color:"var(--v2-text-dim)",background:"rgba(255,255,255,0.04)",border:"1px solid var(--v2-border)"},children:"Demo"})]}),n.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center text-sm",style:{color:"var(--v2-text-dim)"},children:"No activity yet"}):e.jsx("ul",{className:"space-y-2.5 flex-1",children:n.map(i=>{const l=i.count/a*100;return e.jsxs("li",{children:[e.jsxs("div",{className:"flex items-center justify-between text-[12px] mb-1",children:[e.jsx("span",{className:"truncate",style:{color:"var(--v2-text)"},children:i.label}),e.jsx("span",{className:"v2-mono tabular-nums",style:{color:"var(--v2-text-muted)"}
12,children:i.count.toLocaleString()})]}),e.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"rgba(255,255,255,0.04)"},children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${l}%`,background:"var(--v2-grad-hero)",transition:"width 600ms cubic-bezier(0.22,1,0.36,1)"}})})]},i.label)})})]})}function Ga({steps:t,isDemo:s}){var a;const r=Math.max(1,((a=t[0])==null?void 0:a.value)??0);return e.jsxs("div",{className:"v2-glass is-static p-5 h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em]",style:{color:"var(--v2-text-dim)"},children:"Conversion funnel · 30d"}),e.jsx("div",{className:"text-[11px]",style:{color:"var(--v2-text-dim)"},children:"Where calls succeed or drop off"})]}),s&&e.jsx("span",{className:"text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded",style:{color:"var(--v2-text-dim)",background:"rgba(255,255,255,0.04)",border:"1px solid var(--v2-border)"},children:"Demo"})]}),e.jsx("ul",{className:"space-y-3 flex-1",children:t.map((n,i)=>{const l=n.value/r*100,o=i===0?100:r>0?n.value/r*100:0,c=i>0?t[i-1].value-n.value:0;return e.jsxs("li",{children:[e.jsxs("div",{className:"flex items-baseline justify-between text-[12px] mb-1",children:[e.jsx("span",{style:{color:"var(--v2-text)"},children:n.label}),e.jsxs("span",{className:"v2-mono tabular-nums",style:{color:"var(--v2-text-muted)"},children:[n.value.toLocaleString(),e.jsxs("span",{className:"ml-2 text-[10px]",style:{color:"var(--v2-text-dim)"},children:[o.toFixed(0),"%"]})]})]}),e.jsx("div",{className:"h-2 rounded-full overflow-hidden",style:{background:"rgba(255,255,255,0.04)"},children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.max(2,l)}%`,background:i===t.length-1?"var(--v2-good)":"var(--v2-grad-hero)",transition:"width 600ms cubic-bezier(0.22,1,0.36,1)"}})}),i>0&&c>0&&e.jsxs("div",{className:"text-[10px] mt-0.5",style:{color:"var(--v2-text-dim)"},children:["â",c.toLocaleString()," dropped ",n.hint?`· ${n.hint}`:""]})]},n.label)})})]})}function Va(){return e.jsxs("div",{className:"v2-glass is-static px-4 py-2.5 flex items-center gap-3",style:{background:"linear-gradient(90deg, rgba(124,58,237,0.08), rgba(0,212,255,0.04))",borderColor:"var(--v2-border-hi)"},children:[e.jsx(pr,{className:"h-4 w-4 shrink-0",style:{color:"var(--v2-primary)"}}),e.jsx("span",{className:"text-sm flex-1 min-w-0",style:{color:"var(--v2-text)"},children:"Showing demo data â create your first bot to see your own numbers here."}),e.jsxs(K,{to:"/embeds/create",className:"v2-cta shrink-0",children:["Create bot ",e.jsx(se,{className:"h-3 w-3"})]})]})}function Wa(t){if(!t)return null;const s=Math.max(0,Math.floor((Date.now()-t.getTime())/1e3));if(s<60)return`${s}s`;const r=Math.floor(s/60);if(r<60)return`${r}m`;const a=Math.floor(r/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function za(t){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function qa(t){if(!t||t<1)return"â";const s=Math.floor(t/60),r=Math.round(t%60);return s>0?`${s}m${r.toString().padStart(2,"0")}s`:`${r}s`}function Ya(){const{user:t}=kt(),s=St(),{embeds:r}=Et(),{summary:a,sessions:n,dailyAnalytics:i,isLoading:l}=Dt(30),{plan:o,usage:c,limits:d,currentPlan:p,bonusTokensRemaining:v}=Xe(),{data:f}=Ct({queryKey:["v2-knowledge-by-embed",t==null?void 0:t.id,r==null?void 0:r.map(h=>h.id)],queryFn:async()=>{if(!(r!=null&&r.length))return{};const{data:h,error:k}=await s.from("knowledge_sources").select("embed_id").in("embed_id",r.map(w=>w.id)).eq("status","indexed");if(k)return{};const y={};for(const w of h??[]){const _=w.embed_id;y[_]=(y[_]??0)+1}return y},enabled:!!(t!=null&&t.id)&&!!(r!=null&&r.length)}),x=m.useMemo(()=>Object.values(f??{}).reduce((h,k)=>h+k,0),[f]),g=((r==null?void 0:r.length)??0)===0,S=m.useMemo(()=>{const h=Date.now(),k=(n??[]).filter(M=>M.status==="active"||M.started_at&&!M.ended_at&&h-new Date(M.started_at).getTime()<5*6e4).length,y=new Date().toISOString().slice(0,10),w=(i??[]).filter(M=>M.date===y).reduce((M,U)=>M+(U.total_sessions??0),0),_=(i??[]).slice().sort((M,U)=>M.date.localeCompare(U.date)),T=_.slice(-7).reduce((M,U)=>M+(U.total_sessions??0),0),L=_.slice(-14,-7).reduce((M,U)=>M+(U.total_sessions??0),0),q=L>0?(T-L)/L*100:T>0?100:null;
12return{todaySessions:w,activeNow:k,weekDeltaPct:q,avgDurationSec:(a==null?void 0:a.avgSessionDuration)??0,successRate:(a==null?void 0:a.completionRate)??0}},[n,a,i]),C=m.useMemo(()=>{if(o)return typeof o=="string"?o:o.display_name??o.name},[o]),E=m.useMemo(()=>{const h=r==null?void 0:r[0],k=(n??[]).filter(y=>{var w;return!((w=y.embeds)!=null&&w.is_demo_seed)}).length;return[{id:"create",label:"Create your first bot",done:((r==null?void 0:r.length)??0)>0,ctaLabel:"Create bot",to:"/embeds/create"},{id:"knowledge",label:"Add knowledge (URL or document)",done:x>0,ctaLabel:"Add knowledge",to:h?`/embeds/${h.id}`:"/embeds"},{id:"test-call",label:"Make a test call from the preview",done:((a==null?void 0:a.totalSessions)??0)>0||k>0,ctaLabel:"Open preview",to:h?`/embeds/${h.id}`:"/embeds"},{id:"install",label:"Install the snippet on your site",done:!!(r!=null&&r.some(y=>!!y.target_website)),ctaLabel:"Install",to:h?`/embeds/${h.id}`:"/embeds"}]},[r,x,a,n]),V=m.useMemo(()=>{const h=r==null?void 0:r[0],k=!!(r!=null&&r.some(T=>{var q;const L=(q=T.settings)==null?void 0:q.tools;return Array.isArray(L)&&L.length>0})),y=(n??[]).filter(T=>{var L;return!((L=T.embeds)!=null&&L.is_demo_seed)}).length,w=(p??"").toLowerCase(),_=w!==""&&w!=="free"&&!w.includes("free");return[{id:"tools",label:"Enable a lead-capture or booking tool",done:k,ctaLabel:"Configure",to:h?`/embeds/${h.id}`:"/embeds"},{id:"domain",label:"Connect your production domain",done:!!(r!=null&&r.some(T=>!!T.target_website)),ctaLabel:"Connect",to:h?`/embeds/${h.id}`:"/embeds"},{id:"traffic",label:"Reach 10+ real sessions",done:y>=10,ctaLabel:"View analytics",to:"/analytics"},{id:"upgrade",label:"Upgrade for higher limits",done:_,ctaLabel:"See plans",to:"/billing"}]},[r,n,p]),Q=m.useMemo(()=>{const h=k=>{const y=Array.from({length:7},()=>0),w=Date.now();for(const _ of i??[]){if(_.embed_id!==k)continue;const T=Math.floor((w-new Date(`${_.date}T00:00:00Z`).getTime())/864e5);T>=0&&T<7&&(y[6-T]+=_.total_sessions??0)}return y};return(r??[]).map(k=>{const y=(n??[]).filter($=>$.embed_id===k.id),w=h(k.id),_=w.reduce(($,z)=>$+z,0),T=y.some($=>$.status==="active"&&$.started_at&&Date.now()-new Date($.started_at).getTime()<5*6e4),L=y.filter($=>$.status==="completed").length,q=y.length?L/y.length*100:void 0,M=y.length?y.reduce(($,z)=>$+(z.duration_seconds??0),0)/y.length:void 0,U=y.map($=>new Date($.started_at)).sort(($,z)=>z.getTime()-$.getTime())[0];return{id:k.id,name:k.name,status:k.status,liveCall:T,sparkline:w,weekSessions:_,successRate:q,avgDurationSec:M,lastActiveAgo:U?Wa(U):null,installed:!!k.target_website,hasKnowledge:((f==null?void 0:f[k.id])??0)>0,hasSessions:_>0||y.length>0}})},[r,n,i,f]),X=m.useMemo(()=>Q.map(h=>({label:h.name,count:h.weekSessions??0})).filter(h=>h.count>0).sort((h,k)=>k.count-h.count),[Q]),F=m.useMemo(()=>[{label:"Sessions started",value:(a==null?void 0:a.totalSessions)??0},{label:"Completed",value:(a==null?void 0:a.completedSessions)??0,hint:"abandoned mid-call"},{label:"Used a tool",value:(a==null?void 0:a.sessionsWithTools)??0,hint:"fired a booking/lead/action tool"},{label:"â¥60s engagement",value:(a==null?void 0:a.engagedSessions)??0,hint:"short calls"}],[a]),D=m.useMemo(()=>(n??[]).slice().sort((h,k)=>new Date(k.started_at).getTime()-new Date(h.started_at).getTime()).slice(0,8).map(h=>{var y;const k=h.status==="completed"?"resolved":h.status==="abandoned"?"abandoned":h.status==="active"?"active":h.status??"resolved";return{id:h.id,time:za(new Date(h.started_at)),bot:(y=h.embeds)==null?void 0:y.name,intent:`${h.total_messages??0} messages · ${h.total_tool_calls??0} tools`,duration:qa(h.duration_seconds),outcome:k}}),[n]),P=i??[],te=D,W=m.useMemo(()=>{const h=r==null?void 0:r[0],k=(n??[]).filter($=>{var z;return!((z=$.embeds)!=null&&z.is_demo_seed)}).length,y=(r??[]).filter($=>!!$.target_website).length,w=(r??[]).find($=>!$.target_website),_=!!(r!=null&&r.some($=>{var u;const z=(u=$.settings)==null?void 0:u.tools;return Array.isArray(z)&&z.some(j=>{const N=`${(j==null?void 0:j.name)??""} ${(j==null?void 0:j.type)??""}`.toLowerCase();return N.includes("lead")||N.includes("capture")||N.includes("book")||N.includes("calendly")})})),T=((d==null?void 0:d.max_tokens)??0)>0?((c==null?void 0:c.tokens_used)??0)/((d==null?void 0:d.max_tokens)??1)*100:0,L=(p??"").toLowerCase(),q=L===""||L.includes("free"),M=ua([...E,...V]);return{rec:ma({embedsCount:(r==null?void 0:r.length)??0,hasKnowledge:x>0,testCallsCount:(a==null?void 0:a.totalSessions)??0,realSessions:k,installedCount:y,firstUninstalledEmbedId:(w==null?void 0:w.id)??null,firstUninstalledEmbedSite:(w==null?void 0:w.target_website)??null,firstUninstalledEmbedPosition:(w==null?void 0:w.widget_position)??"bottom-right",firstUninstalledEmbedTheme:(w==null?void 0:w.widget_theme)??"light",firstEmbedId:(h==null?void 0:h.id)??null,firstEmbedName:(h==null?void 0:h.name)??null,firstEmbedSite:(h==null?void 0:h.target_website)??null,hasLeadTool:_,tokenPct:T,planIsFree:q,readinessPct:M}),readinessPct:M}},[r,n,x,a,d,c,p,E,V]);return e.jsx(It,{children:e.jsx(xr,{phase:"dashboard",children:e.jsxs("div",{className:"dashboard-v2 min-h-screen -mx-4 -mb-4 md:-m-6 p-4 md:p-6",children:[e.jsx(ea,{}),e.jsxs("header",{className:"mb-4 flex items-end justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] mb-1",style:{color:"var(--v2-text-dim)"},children:"Anve console · Labs"}),e.jsx("h1",{className:"text-xl md:text-2xl font-medium",style:{color:"var(--v2-text)"}
12,children:l?"Loadingâ¦":`Welcome back${t!=null&&t.firstName?`, ${t.firstName}`:""}`})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(hr,{fromPhase:"dashboard"}),C&&e.jsx("span",{className:"v2-chip",children:C}),e.jsx("kbd",{className:"v2-chip v2-mono",children:"âK"})]})]}),e.jsxs("div",{className:"space-y-4",children:[g&&!l&&e.jsx(Va,{}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-5 gap-4",children:[e.jsx("div",{className:"lg:col-span-3","data-tour":"tour-v2-cgo",children:e.jsx(ta,{recommendation:W.rec,readinessPct:W.readinessPct})}),e.jsx("div",{className:"lg:col-span-2","data-tour":"tour-v2-plan",children:e.jsx($a,{planLabel:C,tokensUsed:(c==null?void 0:c.tokens_used)??0,tokensLimit:(d==null?void 0:d.max_tokens)??-1,bonusTokens:v??0,daily:P})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-5 gap-4",children:[e.jsx("div",{className:"lg:col-span-2","data-tour":"tour-v2-hero",children:e.jsx(xa,{todaySessions:S.todaySessions,weekDeltaPct:S.weekDeltaPct,activeNow:S.activeNow,avgDurationSec:S.avgDurationSec,successRate:S.successRate,toolCalls:(a==null?void 0:a.totalToolCalls)??0})}),e.jsx("div",{className:"lg:col-span-3",children:e.jsx(Ea,{data:P,isDemo:!1})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-6 gap-4",children:[e.jsx("div",{className:"lg:col-span-4","data-tour":"tour-v2-checklist",children:e.jsx(Da,{phase1:E,phase2:V})}),e.jsx("div",{className:"lg:col-span-2",children:e.jsx(Ua,{rows:X,isDemo:!1})})]}),e.jsx("div",{"data-tour":"tour-v2-fleet",children:e.jsx(Oa,{rows:Q})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-5 gap-4",children:[e.jsx("div",{className:"lg:col-span-3",children:e.jsx(Ka,{events:te,isDemo:!1})}),e.jsx("div",{className:"lg:col-span-2",children:e.jsx(Ga,{steps:F,isDemo:!1})})]}),e.jsxs("p",{className:"text-[11px] text-center pt-2",style:{color:"var(--v2-text-dim)"},children:["Dashboard v3 · CGO agent · ",C??"â"," · feedback welcome"]})]})]})})})}const Ha=[{title:"Create Your AI Assistant",description:"Set up an AI assistant for your website",icon:tt,href:"/embeds/create",gradient:"from-primary to-secondary"},{title:"View Analytics",description:"Monitor conversations and visitor engagement",icon:st,href:"/analytics",gradient:"from-fun to-cyan-600"},{title:"Manage Anve",description:"Configure and customize your Anve instances",icon:re,href:"/embeds",gradient:"from-accent to-secondary"}],Qa=()=>{const t=Qe(),{user:s}=kt(),r=St(),{embeds:a,isLoading:n}=Et(),{summary:i,isLoading:l}=Dt(30),{usage:o,limits:c,plan:d,getTokensPercentage:p,isNearTokenLimit:v,formatTokens:f,bonusTokensRemaining:x,lifetimeBonusTokensEarned:g,isLoading:S}=Xe(),{shouldShowOnboarding:C}=Bt(),{showGlossaryHints:E,isFirstSession:V,dismissGlossary:Q}=Ar(),{isLoading:X,isCompleted:F}=Ls(),[D,P]=m.useState(!1),{data:te}=Ct({queryKey:["knowledge-count",s==null?void 0:s.id,a==null?void 0:a.map(A=>A.id)],queryFn:async()=>{if(!(a!=null&&a.length))return 0;const A=a.map(ls=>ls.id),{count:ce,error:_e}=await r.from("knowledge_sources").select("*",{count:"exact",head:!0}).in("embed_id",A).eq("status","indexed");if(_e)throw _e;return ce||0},enabled:!!(s!=null&&s.id)&&!!(a!=null&&a.length)});m.useEffect(()=>{C&&P(!0)},[C]),m.useEffect(()=>{s!=null&&s.id&&ne("dashboard_first_visit",{userId:s.id},s.id)},[s==null?void 0:s.id]),At("dashboard_session_dwell",{userId:s==null?void 0:s.id},s==null?void 0:s.id);const W=s!=null&&s.id?`anvevoice_install_pending_${s.id}`:null,h=s!=null&&s.id?`anvevoice_install_pending_embed_${s.id}`:null,[k,y]=m.useState(null),[w,_]=m.useState(null);m.useEffect(()=>{if(W)try{y(localStorage.getItem(W)),h&&_(localStorage.getItem(h))}catch{}},[W,h]);const T=()=>{if(W){try{localStorage.removeItem(W),h&&localStorage.removeItem(h)}catch{}y(null),_(null),ne("install_reminder_dismissed",{userId:s==null?void 0:s.id},s==null?void 0:s.id)}},L=()=>{var ce;ne("install_reminder_clicked",{userId:s==null?void 0:s.id},s==null?void 0:s.id);const A=w&&(a!=null&&a.some(_e=>_e.id===w))?w:((ce=a==null?void 0:a[0])==null?void 0:ce.id)??null;t(A?`/embeds/${A}?tab=code`:"/quickstart?force=1")},q=(s==null?void 0:s.firstName)||(s==null?void 0:s.username)||"there",M=(a==null?void 0:a.filter(A=>A.status==="active").length)||0,U=((a==null?void 0:a.length)||0)>0,$=(te||0)>0,z=(a==null?void 0:a.some(A=>!!A.target_website))||!1,u=i.totalSessions>0,j=[{label:"Anve Instances",value:M,icon:tt,color:"text-primary",bgColor:"bg-primary/10",glossaryTerm:"ai-receptionist"},{label:"Total Sessions",value:i.totalSessions,icon:lt,color:"text-emerald-500",bgColor:"bg-emerald-500/10",change:i.sessionsChange>0?`+${i.sessionsChange.toFixed(0)}%`:null,glossaryTerm:"session"},{label:"Tool Calls",value:i.totalToolCalls,icon:De,color:"text-amber-500",bgColor:"bg-
12amber-500/10",glossaryTerm:"tool-calls"},{label:"Completion Rate",value:i.completionRate,icon:st,suffix:"%",color:"text-purple-500",bgColor:"bg-purple-500/10",glossaryTerm:"completion-rate"}],N=n||l||S,b=(x??0)>0,I=(g??0)>0,R=c.max_tokens===-1?-1:c.max_tokens+(x??0),G=R===-1||R===0?0:Math.min(100,(o.tokens_used??0)/R*100),B=G>=80,xe=c.max_tokens===-1?-1:Math.max(0,c.tokens_remaining??0)+(x??0);return!X&&!F&&!n&&!U?e.jsx(bs,{to:"/onboarding",replace:!0}):e.jsxs(It,{children:[e.jsx(Sr,{open:D,onOpenChange:P}),e.jsx("div",{className:"dashboard-v2 -m-4 md:-m-6 p-4 md:p-6 min-h-screen",children:e.jsxs(O.div,{className:"max-w-7xl mx-auto space-y-8",variants:Te,initial:"hidden",animate:"visible",children:[E&&V&&e.jsx(O.div,{variants:Y,children:e.jsx(_r,{onDismiss:Q})}),e.jsx(O.div,{variants:Y,children:e.jsx(ie,{variant:"elevated",className:"overflow-hidden",children:e.jsxs("div",{className:"relative p-4 sm:p-6 lg:p-8",children:[e.jsx("div",{className:"absolute top-0 right-0 w-80 h-80 bg-gradient-to-br from-primary/20 to-secondary/10 rounded-full blur-[100px] -translate-y-1/2 translate-x-1/4 pointer-events-none"}),e.jsxs("div",{className:"relative",children:[e.jsxs(O.h1,{className:"text-2xl sm:text-3xl lg:text-4xl font-bold mb-3",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.1},children:["Welcome back, ",e.jsx("span",{className:"text-gradient",children:q})]}),e.jsx(O.p,{className:"text-muted-foreground text-lg",initial:{opacity:0}
12,animate:{opacity:1},transition:{delay:.2},children:"Here's what's happening with your Anve instances today."})]})]})})}),k&&!z&&e.jsx(O.div,{variants:Y,children:e.jsx(ie,{variant:"elevated",className:"overflow-hidden ring-1 ring-primary/30",children:e.jsxs("div",{className:"relative p-4 sm:p-5 flex flex-col sm:flex-row items-start sm:items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-primary to-secondary flex items-center justify-center shrink-0",children:e.jsx(De,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:"Ready to install your Anve?"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Pick up the install snippet where you left off."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{size:"sm",onClick:L,className:"bg-gradient-to-r from-primary to-secondary hover:opacity-90",children:"Continue install â"}),e.jsx(H,{size:"sm",variant:"ghost",onClick:T,"aria-label":"Dismiss",children:"Dismiss"})]})]})})}),!U&&(s==null?void 0:s.createdAt)&&Date.now()-new Date(s.createdAt).getTime()>2*60*60*1e3&&!localStorage.getItem("anve_activation_nudge_dismissed")&&e.jsx(O.div,{variants:Y,children:e.jsx(ie,{variant:"elevated",className:"overflow-hidden ring-1 ring-primary/30",children:e.jsxs("div",{className:"relative p-6 sm:p-8",children:[e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-gradient-to-br from-primary/15 to-secondary/10 rounded-full blur-[80px] -translate-y-1/2 translate-x-1/4 pointer-events-none"}),e.jsx("button",{onClick:()=>{localStorage.setItem("anve_activation_nudge_dismissed","true"),window.dispatchEvent(new Event("storage"))},className:"absolute top-3 right-3 p-1.5 rounded-lg hover:bg-muted/80 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Dismiss",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}),e.jsxs("div",{className:"relative flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-gradient-to-br from-primary to-secondary flex items-center justify-center shadow-lg shadow-primary/25 shrink-0",children:e.jsx(re,{className:"w-7 h-7 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold mb-1",children:"Create Your First Bot in 60 Seconds"}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Set up a voice AI receptionist for your website â no code needed. Just pick a template, add your website URL, and deploy."}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-4",children:[e.jsxs(H,{onClick:()=>t("/embeds/create"),className:"bg-gradient-to-r from-primary to-secondary hover:opacity-90 shadow-lg shadow-primary/25",children:[e.jsx(De,{className:"w-4 h-4 mr-1.5"}),"Create Your First Bot"]}),e.jsx("a",{href:"https://calendly.com/anvevoice/30min",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Need help? Book a call â"})]})]})]})]})})}),e.jsx(O.div,{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",variants:Te,"data-track-section":"dashboard-stats",children:j.map((A,ce)=>e.jsx(O.div,{variants:Y,custom:ce,children:e.jsxs(ie,{variant:"glass",hover:"lift",className:"p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("div",{className:`p-2.5 rounded-xl ${A.bgColor}`,children:e.jsx(A.icon,{className:`w-5 h-5 ${A.color}`})}),A.change&&e.jsx("span",{className:"text-xs text-emerald-400 font-semibold bg-emerald-500/10 px-2 py-1 rounded-full",children:A.change})]}),e.jsx("div",{className:"text-xl sm:text-2xl lg:text-3xl font-bold mb-1",children:N?e.jsx("div",{className:"h-9 w-20 bg-muted/50 rounded animate-pulse"}):e.jsxs(e.Fragment,{children:[e.jsx(br,{value:A.value}),A.suffix&&e.jsx("span",{className:"text-lg sm:text-2xl ml-0.5",children:A.suffix})]})}),e.jsx("div",{className:"text-sm text-muted-foreground",children:E&&A.glossaryTerm?e.jsx(ut,{term:A.glossaryTerm,showIcon:!0,children:A.label}):A.label})]})},A.label))}),e.jsx(O.div,{variants:Y,"data-track-section":"dashboard-token-usage",children:e.jsxs(ie,{variant:B?"elevated":"glass",className:`p-6 ${B?"ring-1 ring-warning/50":""}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2.5 rounded-xl ${B?"bg-warning/20":"bg-primary/10"}`,children:e.jsx($e,{className:`w-5 h-5 ${B?"text-warning":"text-primary"}`})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 flex-wrap",children:[E?e.jsx(ut,{term:"tokens",
12showIcon:!0,children:"Token Usage"}):"Token Usage",b&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-primary/10 text-primary text-[10px] font-semibold border border-primary/30",title:"Bonus tokens from referrals â used after your monthly allowance is exhausted. Never expires.",children:[e.jsx(re,{className:"w-3 h-3"}),"+",f(x)," bonus"]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[(d==null?void 0:d.display_name)||"Free"," Plan"]})]})]}),B&&e.jsxs("div",{className:"flex items-center gap-1.5 text-warning text-sm",children:[e.jsx(wt,{className:"w-4 h-4"}),e.jsx("span",{children:"Near Limit"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:f(o.tokens_used)}),e.jsxs("span",{className:"text-muted-foreground ml-2",children:["/ ",c.max_tokens===-1?"â":e.jsxs(e.Fragment,{children:[f(c.max_tokens),b&&e.jsxs("span",{className:"text-primary",children:[" + ",f(x)," bonus"]})]})]})]}),e.jsxs("span",{className:`text-sm font-medium ${G>=80?"text-warning":G>=60?"text-amber-400":"text-muted-foreground"}`,children:[G.toFixed(0),"% used"]})]}),e.jsx(_t,{value:G,className:`h-2 ${G>=80?"[&>div]:bg-warning":G>=60?"[&>div]:bg-amber-400":""}`}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:c.max_tokens===-1?"Unlimited":e.jsxs(e.Fragment,{children:[f(xe)," remaining this month",b&&e.jsxs("span",{className:"text-primary",children:[" (incl. ",f(x)," referral bonus)"]}),!b&&I&&e.jsxs("span",{className:"text-muted-foreground/70",children:[" · ",f(g)," bonus earned lifetime"]})]})}),e.jsx(K,{to:I?"/affiliate":"/pricing",children:e.jsxs(H,{variant:"ghost",size:"sm",className:"text-primary",children:[I?"Earn More":"Upgrade Plan",e.jsx(se,{className:"w-4 h-4 ml-1"})]})})]})]})]})}),e.jsx(wr,{}),e.jsx(O.div,{variants:Y,"data-track-section":"getting-started-checklist",children:e.jsx(yr,{hasEmbeds:U,hasKnowledge:$,hasDeployed:z,hasSessions:u,firstEmbedCode:a!=null&&a[0]?Je(a[0].id,{position:a[0].widget_position||"bottom-right",theme:a[0].widget_theme||"light"}):void 0})}),e.jsx(O.div,{variants:Y,"data-track-section":"install-pending-banner",children:e.jsx(kr,{embeds:a})}),e.jsx(O.div,{variants:Y,"data-track-section":"suggested-actions",children:e.jsx(Nr,{hasEmbeds:U,hasKnowledge:$,hasSessions:u,isNearVoiceLimit:B,totalSessions:i.totalSessions,embedsCount:(a==null?void 0:a.length)||0})}),e.jsx(Ps,{}),e.jsxs(O.div,{variants:Y,children:[e.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Quick Actions"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:Ha.map((A,ce)=>e.jsx(O.div,{variants:Y,custom:ce,whileHover:{y:-4},whileTap:{scale:.98},children:e.jsxs(ie,{variant:"glass",hover:"glow",className:"p-6 cursor-pointer h-full",onClick:()=>{ne("dashboard_quick_action_clicked",{action:A.href,title:A.title,userId:s==null?void 0:s.id},s==null?void 0:s.id),t(A.href)},children:[e.jsx("div",{className:`w-12 h-12 rounded-xl bg-gradient-to-br ${A.gradient} flex items-center justify-center mb-4 shadow-lg`,children:e.jsx(A.icon,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:A.title}),e.jsx("p",{className:"text-muted-foreground text-sm mb-4 leading-relaxed",children:A.description}),e.jsxs("div",{className:"flex items-center text-primary text-sm font-medium",children:["Get started ",e.jsx(se,{className:"w-4 h-4 ml-1"})]})]})},A.title))})]}),i.totalSessions===0&&e.jsx(O.div,{variants:Y,children:e.jsxs(ie,{variant:"glass",className:"p-12 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary/10 flex items-center justify-center mx-auto mb-4",children:e.jsx(lt,{className:"w-8 h-8 text-primary"})}),e.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No activity yet"}),e.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:"Once you create your Anve and start receiving conversations, you'll see your activity and analytics here."}),e.jsx(H,{onClick:()=>{ne("dashboard_empty_state_cta_clicked",{cta_id:"create_first_anve",userId:s==null?void 0:s.id},s==null?void 0:s.id),t("/embeds/create")},className:"bg-gradient-to-r from-primary to-secondary hover:opacity-90 shadow-lg shadow-primary/25",children:"Create your first Anve"})]})})]})})]})},Pi=()=>{const t=vs();return gs(t.pathname)?e.jsx(Qa,{}):e.jsx(Ya,{})};export{Pi as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.