PageSourceSearch

https://founder-spark-63.lovable.app/assets/AdminTokens-YRrSgt4M.js

js founder-spark-63.lovable.app collected 2026-10-03 03:32:35 UTC 21,282 bytes, 6 lines download raw bytes

1import{j as e,u as Y}from"./query-_koPiPsI.js";import{r as u,f as ee,L as se}from"./react-vendor-h1rQ_Bae.js";import{c as te,C as p,o as $,p as T,B as G,L as F,n as g,E as ae,k as z,s as f,g as j,f as X,w as ne,z as re,T as W,a as J,b as O,R as ie,d as U}from"./index-Dq2zLArw.js";import{A as oe}from"./activity-cfZN1jba.js";import{C as le}from"./chevron-right-N8QrdNsP.js";import"./ui-radix-CKwvnS8F.js";import"./supabase-DL6nu9mS.js";import"./charts-Xu79y1bN.js";import"./motion-nVmI7L5T.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 ce=te("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]),de={google_direct:{label:"Google AI Studio",url:"https://aistudio.google.com/apikey"},openai_direct:{label:"OpenAI Billing",url:"https://platform.openai.com/settings/organization/billing/overview"},perplexity_direct:{label:"Perplexity API",url:"https://www.perplexity.ai/settings/api"},anthropic_direct:{label:"Anthropic Console",url:"https://console.anthropic.com/settings/billing"}};function me(a,c){return c?e.jsx(z,{className:"bg-emerald-600 hover:bg-emerald-700",children:"healthy"}):a==="out_of_balance"?e.jsx(z,{variant:"destructive",children:"out of balance"}):a==="invalid_key"?e.jsx(z,{variant:"destructive",children:"invalid key"}):a==="rate_limited"?e.jsx(z,{className:"bg-amber-600 hover:bg-amber-700",children:"rate limited"}):e.jsx(z,{variant:"secondary",children:"error"})}function ue(){const[a,c]=u.useState(!1),[k,v]=u.useState(!1),[S,C]=u.useState(null),[L,A]=u.useState(null);async function R(){c(!0);try{const{data:n,error:d}=await f.functions.invoke("ai-model-smoke-test",{body:{}});if(d)throw d;C(n.results),A(n.tested_at);const t=n.results.filter(s=>!s.ok).length;t===0?j.success(`All ${n.results.length} providers healthy`):j.warning(`${t} of ${n.results.length} providers need attention`)}catch(n){j.error(`Smoke test failed: ${n?.message||n}`)}finally{c(!1)}}async function P(){v(!0);try{const{data:n,error:d}=await f.functions.invoke("force-probe-engines",{body:{}});if(d)throw d;n?.ok?j.success("Probes triggered across all engines — refresh /analytics in ~1 min"):j.warning(`Probe ran with issues: ${JSON.stringify(n).slice(0,200)}`)}catch(n){j.error(`Force probe failed: ${n?.message||n}`)}finally{v(!1)}}return e.jsxs(p,{id:"provider-health",children:[e.jsxs($,{className:"flex flex-row items-center justify-between space-y-0",children:[e.jsxs("div",{children:[e.jsxs(T,{className:"text-base flex items-center gap-2",children:[e.jsx(oe,{className:"h-4 w-4"})," Provider health"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Pings every AI key with a 1-token prompt (~$0 cost). Tells you which dashboards to top up."})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(G,{onClick:P,disabled:k,size:"sm",variant:"outline",children:k?e.jsx(F,{className:"h-4 w-4 animate-spin"}):"Force probe all engines"}),e.jsx(G,{onClick:R,disabled:a,size:"sm",children:a?e.jsx(F,{className:"h-4 w-4 animate-spin"}):"Run smoke test"})]})]}),e.jsxs(g,{children:[!S&&e.jsx("p",{className:"text-sm text-muted-foreground py-4",children:'Click "Run smoke test" to verify all provider keys.'}),S&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Tested at ",L?new Date(L).toLocaleString():"—"]}),e.jsxs("div",{className:"grid grid-cols-12 text-[11px] font-medium text-muted-foreground border-b pb-2",children:[e.jsx("div",{className:"col-span-3",children:"Provider"}),e.jsx("div",{className:"col-span-3",children:"Key / Model"}),e.jsx("div",{className:"col-span-2 text-right",children:"Latency"}),e.jsx("div",{className:"col-span-2",children:"Status"}),e.jsx("div",{className:"col-span-2 text-right",children:"Dashboard"})]}),S.map(n=>{const d=de[n.provider];return e.jsxs("div",{className:"grid grid-cols-12 text-sm py-2 border-b border-border/40 items-center",children:[e.jsx("div",{className:"col-span-3 font-medium",children:n.provider}),e.jsxs("div",{className:"col-span-3 text-xs font-mono text-muted-foreground truncate",title:n.error||n.sample||"",children:[n.key_name,n.model&&e.jsx("div",{className:"text-[10px]",children:n.model})]}),e.jsxs("div",{className:"col-span-2 text-right text-xs",children:[n.latency_ms,"ms ",e.jsxs("span",{className:"text-muted-foreground",children:["(",n.status,")"]})]}),e.jsx("div",{className:"col-span-2",children:me(n.balance_hint,n.ok)}),e.jsx("div",{className:"col-span-2 text-right",children:d&&e.jsxs("a",{href:d.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[d.label," ",e.jsx(ae,{className:"h-3 w-3"})]})}),n.error&&e.jsx("div",{className:"col-span-12 text-[11px] text-destructive/80 font-mono truncate pl-2 pt-1",title:n.error,children:n.error})]},n.provider)}),e.jsxs("div",{className:"text-[11px] text-muted-foreground pt-2 border-t mt
6-2",children:[e.jsx("strong",{children:"Note on usage reporting:"})," the dashboards below only track calls that go through ",e.jsx("code",{children:"_shared/gemini.ts"}),". Direct Perplexity, OpenAI, embeddings, and image-gen calls bypass that helper — so total spend is under-reported. Verify balances directly on each provider dashboard above."]})]})]})]})}function xe(a){const c=a==="ok"?"bg-emerald-500":a==="warn"?"bg-amber-500":a==="err"?"bg-destructive":"bg-muted";return e.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full ${c}`})}function he(a){if(!a)return"never";try{return re(new Date(a),{addSuffix:!0})}catch{return"—"}}const pe=["chatgpt","claude","perplexity","gemini"];function ge(){const{user:a}=X(),[c,k]=u.useState({}),[v,S]=u.useState(!1),[C,L]=u.useState(!1),{data:A,isLoading:R,refetch:P}=Y({queryKey:["my-account-health",a?.id],enabled:!!a,refetchInterval:6e4,queryFn:async()=>{if(!a)return[];const t=new Date(Date.now()-30*864e5).toISOString(),s=new Date(Date.now()-7*864e5).toISOString(),[i,w,B,M,E,N]=await Promise.all([f.from("gsc_connections").select("site_url,last_synced_at").eq("user_id",a.id).maybeSingle(),f.from("search_performance").select("date").eq("user_id",a.id).order("date",{ascending:!1}).limit(1).maybeSingle(),f.from("ai_citation_probes").select("engine,probed_at,error_message,mentioned").eq("user_id",a.id).gte("probed_at",t).order("probed_at",{ascending:!1}),f.from("page_views").select("id",{count:"exact",head:!0}).eq("is_bot",!0).gte("created_at",s),f.from("newsletter_sequence_sends").select("sent_at").order("sent_at",{ascending:!1}).limit(1).maybeSingle(),f.from("sequence_enrollment_errors").select("id,error_message,created_at").gte("created_at",s).order("created_at",{ascending:!1}).limit(5)]),o=[],b=i.data??null,D=b?.last_synced_at??null,H=!!b?.site_url,r=D?Date.now()-new Date(D).getTime()>48*36e5:!0;let m="warn",I="not connected";b&&H?(m=r?"warn":"ok",I=`${b.site_url}${r&&D?" · sync overdue":""}`):b&&!H&&(m="warn",I="connected — pick a property in Profile"),o.push({key:"gsc",label:"Google Search Console",status:m,detail:I,timestamp:D});const x=w.data?.date??null;o.push({key:"rankings",label:"Rankings pipeline",status:x?"ok":"warn",detail:x?`last snapshot ${x}`:"no ranking rows yet",timestamp:x?new Date(x).toISOString():null});const h={};(B.data??[]).forEach(_=>{const l=_.engine;h[l]||(h[l]={count:0,mentions:0,last:_.probed_at,error:null}),h[l].count++,_.mentioned&&h[l].mentions++,_.error_message&&!h[l].error&&(h[l].error=_.error_message)});for(const _ of pe){const l=h[_],Z=l?l.error||l.count===0?"warn":"ok":"err";o.push({key:`probe-${_}`,label:`AI probes — ${_}`,status:Z,detail:l?`${l.count} probes / 30d · ${l.mentions} mentions`:"no probe data",timestamp:l?.last,error:l?.error})}o.push({key:"crawlers",label:"AI crawler visits",status:(M.count??0)>0?"ok":"warn",detail:`${M.count??0} bot hits / 7d`});const V=E.data?.sent_at??null;o.push({key:"sequences",label:"Newsletter sequences processor",status:V?"ok":"unknown",detail:V?"last send logged":"no sends yet (idle is normal)",timestamp:V});const q=N.data??[];return o.push({key:"seq-enroll-errors",label:"Sequence auto-enroll errors",status:q.length===0?"ok":"warn",detail:q.length===0?"no failed enrollments in last 7d":`${q.length} failure(s) — latest: ${q[0]?.error_message||"unknown"}`,timestamp:q[0]?.created_at??null,error:q[0]?.error_message??null}),o}});async function n(){S(!0);try{const{data:t,error:s}=await f.functions.invoke("ai-model-smoke-test",{body:{}});if(s)throw s;const i=(t?.results??[]).filter(w=>!w.ok).length;i===0?j.success("All providers healthy"):j.warning(`${i} provider(s) failing — see Provider health below`)}catch(t){j.error(`Smoke test failed: ${t?.message||t}`)}finally{S(!1)}}async function d(){L(!0);try{const{data:t,error:s}=await f.functions.invoke("force-probe-engines",{body:{}});if(s)throw s;t?.ok?j.success("Probes triggered — refresh in ~1 min"):j.warning("Probe ran with issues; check details below"),setTimeout(()=>P(),6e4)}catch(t){j.error(`Force probe failed: ${t?.message||t}`)}finally{L(!1)}}return e.jsxs(p,{children:[e.jsxs($,{className:"flex flex-row items-center justify-between space-y-0",children:[e.jsxs("div",{children:[e.jsxs(T,{className:"text-base flex items-center gap-2",children:[e.jsx(ce,{className:"h-4 w-4"})," My account pipeline health"]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["End-to-end check for ",e.jsx("span",{className:"font-mono",children:a?.email})," — one row per pipeline. Auto-refreshes every 60s."]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(G,{size:"sm",variant:"outline",onClick:n,disabled:v,children:v?e.jsx(F,{className:"h-4 w-4 animate-spin"}):"Run smoke test"}),e.jsx(G,{size:"sm",onClick:d,disabled:C,children:C?e.jsx(F,{className:"h-4 w-4 animate-spin"}):"Force probe all engines"})]})]}),e.jsxs(g,{children:[R&&e.jsxs("div",{className:"py-6 text-center text-sm text-muted-foreground",children:[e.jsx(F,{className:"h-4 w-4 animate-spin inline mr-2"}),"Checking pipelines…"]}),!R&&A&&e.jsx("div",{className:"space-y-1",children:A.map(t=>{const s=!!t.error,i=!!c[t.key];return e.jsxs("div",{className:"border-b border-border/40 last:border-0",children:[e.jsxs("div",{className:`grid grid-cols-12 items-center py-2 text-sm ${s?"cursor-pointer hover:bg-muted/30 rounded px-1":"px-1"}`,onClick:()=>s&&k(w=>({...w,[t.key]:!w[t.key]})),children:[e.jsxs("div",{className:"col-span-4 flex items-center gap-2",children:[s?i?e.jsx(ne,{className:"h-3 w-3"}):e.jsx(le,{className:"h-3 w-3"}):e.jsx("span",{className:"w-3"}),xe(t.status),e.jsx("span",{className:"font-medium",children:t.label})]}),e.jsx("div",{className:"col-span-6 text-xs text-muted-foreground truncate",children:t.detail}),e.jsx("div",{className:"col-span-2 text-right text-[11px] text-muted-foreground",children:t.timestamp?he(t.timestamp):"—"})]}),i&&t.error&&e.jsx("div",{className:"pl-10 pb-2 text-[11px] font-mono text-destructive/80 break-all",children:t.error})]},t.key)})})]})]})}const fe={"gemini-2.5-pro":.00125,"google/gemini-2.5-pro":.00125,"gemini-2.5-flash":75e-6,"google/gemini-2.5-flash":75e-6,"gpt-4o":.0025,"gpt-4o-mini":15e-5},je={"gemini-2.5-pro":.005,"google/gemini-2.5-pro":.005,"gemini-2.5-flash":3e-4,"google/gemini-2.5-flash":3e-4,"gpt-4o":.01,"gpt-4o-mini":6e-4},be={"gemini-2.5-pro":.04,"google/gemini-2.5-pro":.04,"gemini-2.5-flash":.005,"google/gemini-2.5-flash":.005},Q={"atomize-content":"Article atomize","extract-concept-spine":"Concept spine","transform-content":"Platform transform (LI/X/Threads)","generate-linkedin-variations":"LinkedIn variations","plan-carousel-slides":"Carousel plan (draft)","generate-linkedin-images":"Carousel images","newsletter-draft":"Newsletter draft","newsletter-personalize":"Newsletter personalize","
6weekly-brief":"Weekly brief","geo-score":"GEO score","geo-upgrade":"GEO upgrade","ai-citation-probes":"AI citation probes",proofread:"Proofread","internal-linking-suggestions":"Internal linking","content-radar":"Content radar","agent-respond":"Agent chat"},K=a=>`$${a.toFixed(a<1?4:2)}`,y=a=>a.toLocaleString();function ve(a){if(a.tokens_in||a.tokens_out){const c=fe[a.model]??0,k=je[a.model]??0;return(a.tokens_in||0)/1e3*c+(a.tokens_out||0)/1e3*k}return be[a.model]??.01}const Ie=()=>{const{user:a,loading:c}=X(),k=ee(),[v,S]=u.useState(null),[C,L]=u.useState([]),[A,R]=u.useState(!0),[P,n]=u.useState(7);u.useEffect(()=>{if(!c){if(!a){k("/auth");return}(async()=>{const{data:s}=await f.from("user_roles").select("role").eq("user_id",a.id).eq("role","admin").maybeSingle();S(!!s)})()}},[a,c,k]);const d=async()=>{R(!0);const s=new Date(Date.now()-P*864e5).toISOString(),{data:i}=await f.from("ai_usage_log").select("function_name, model, status, created_at, user_id, latency_ms, tokens_in, tokens_out").gte("created_at",s).order("created_at",{ascending:!1}).limit(1e4);L(i||[]),R(!1)};u.useEffect(()=>{v&&d()},[v,P]);const t=u.useMemo(()=>{let s=0,i=0,w=0,B=0,M=0;const E=[],N={},o={},b={};for(const r of C){s++;const m=r.status==="ok"||r.status==="degraded";m||i++;const I=ve(r);M+=I,w+=r.tokens_in||0,B+=r.tokens_out||0,r.latency_ms&&E.push(r.latency_ms);const x=r.function_name||"unknown";N[x]=N[x]||{calls:0,cost:0,tin:0,tout:0,err:0},N[x].calls++,N[x].cost+=I,N[x].tin+=r.tokens_in||0,N[x].tout+=r.tokens_out||0,m||N[x].err++,o[r.model]=o[r.model]||{calls:0,cost:0,tin:0,tout:0},o[r.model].calls++,o[r.model].cost+=I,o[r.model].tin+=r.tokens_in||0,o[r.model].tout+=r.tokens_out||0;const h=r.user_id||"(anonymous)";b[h]=b[h]||{calls:0,cost:0},b[h].calls++,b[h].cost+=I}E.sort((r,m)=>r-m);const D=r=>E.length?E[Math.min(E.length-1,Math.floor(E.length*r))]:0,H=s?Math.round(i/s*1e3)/10:0;return{calls:s,errors:i,errRate:H,tokensIn:w,tokensOut:B,cost:M,p50:D(.5),p95:D(.95),byFeature:Object.entries(N).sort((r,m)=>m[1].cost-r[1].cost),byModel:Object.entries(o).sort((r,m)=>m[1].cost-r[1].cost),byUser:Object.entries(b).sort((r,m)=>m[1].cost-r[1].cost).slice(0,10)}},[C]);return c||v===null?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(F,{className:"h-6 w-6 animate-spin"})}):v?e.jsxs("div",{className:"container mx-auto p-6 space-y-6 max-w-6xl",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Token & Cost Meter"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Real token counts where instrumented (Gemini + Lovable Gateway via ",e.jsx("code",{className:"text-xs",children:"_shared/gemini.ts"}),"), heuristic per-call cost for the rest. Admin-only — never exposed to paid users. See also ",e.jsx(se,{to:"/admin/ai-spend",className:"underline",children:"AI Spend"}),"."]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{value:String(P),onValueChange:s=>n(Number(s)),children:e.jsxs(J,{children:[e.jsx(O,{value:"1",children:"24h"}),e.jsx(O,{value:"7",children:"7d"}),e.jsx(O,{value:"30",children:"30d"})]})}),e.jsxs(G,{variant:"outline",size:"sm",onClick:d,disabled:A,className:"gap-2",children:[e.jsx(ie,{className:`h-4 w-4 ${A?"animate-spin":""}`})," Refresh"]})]})]}),e.jsx(ge,{}),e.jsx(ue,{}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[e.jsxs(p,{children:[e.jsx($,{className:"pb-2",children:e.jsx(T,{className:"text-xs text-muted-foreground",children:"Calls"})}),e.jsx(g,{children:e.jsx("div",{className:"text-2xl font-bold",children:y(t.calls)})})]}),e.jsxs(p,{children:[e.jsx($,{className:"pb-2",children:e.jsx(T,{className:"text-xs text-muted-foreground",children:"Est. cost"})}),e.jsx(g,{children:e.jsx("div",{className:"text-2xl font-bold",children:K(t.cost)})})]}),e.jsxs(p,{children:[e.jsx($,{className:"pb-2",children:e.jsx(T,{className:"text-xs text-muted-foreground",children:"Tokens in / out"})}),e.jsx(g,{children:e.jsxs("div",{className:"text-lg font-bold",children:[y(t.tokensIn)," / ",y(t.tokensOut)]})})]}),e.jsxs(p,{children:[e.jsx($,{className:"pb-2",children:e.jsx(T,{className:"text-xs text-muted-foreground",children:"Latency p50 / p95"})}),e.jsx(g,{children:e.jsxs("div",{className:"text-lg font-bold",children:[t.p50,"ms / ",t.p95,"ms"]})})]}),e.jsxs(p,{children:[e.jsx($,{className:"pb-2",children:e.jsx(T,{className:"text-xs text-muted-foreground",children:"Error rate"})}),e.jsx(g,{children:e.jsxs("div",{className:`text-2xl font-bold ${t.errRate>5?"text-destructive":""}`,children:[t.errRate,"%"]})})]})]}),e.jsxs(W,{defaultValue:"feature",className:"w-full",children:[e.jsxs(J,{children:[e.jsx(O,{value:"feature",children:"By Feature"}),e.jsx(O,{value:"model",children:"By Model"}),e.jsx(O,{value:"user",children:"Top Users"}),e.jsx(O,{value:"recent",children:"Recent"})]}),e.jsx(U,{value:"feature",children:e.jsx(p,{children:e.jsxs(g,{className:"pt-4",children:[e.jsxs("div",{className:"grid grid-cols-12 text-[11px] font-medium text-muted-foreground border-b pb-2 mb-2",children:[e.jsx("div",{className:"col-span-5",children:"Feature"}),e.jsx("div",{className:"col-span-1 text-right",children:"Calls"}),e.jsx("div",{className:"col-span-2 text-right",children:"Tokens in/out"}),e.jsx("div",{className:"col-span-2 text-right",children:"Est. cost"}),e.jsx("div",{className:"col-span-1 text-right",children:"Err"}),e.jsx("div",{className:"col-span-1 text-right",children:"Tag"})]}),e.jsxs("div",{className:"space-y-1 max-h-[500px] overflow-y-auto",children:[t.byFeature.map(([s,i])=>e.jsxs("div",{className:"grid grid-cols-12 text-sm py-1 border-b border-border/40",children:[e.jsx("div",{className:"col-span-5 truncate",children:e.jsx("span",{className:"font-medium",children:Q[s]||s})}),e.jsx("div",{className:"col-span-1 text-right",children:y(i.calls)}),e.jsxs("div",{className:"col-span-2 text-right text-xs",children:[y(i.tin)," / ",y(i.tout)]}),e.jsx("div",{className:"col-span-2 text-right font-medium",children:K(i.cost)}),e.jsx("div",{className:`col-span-1 text-right text-xs ${i.err?"text-destructive":"text-muted-foreground"}`,children:i.err}),e.jsx("div",{className:"col-span-1 text-right text-[10px] font-mono text-muted-foreground truncate",title:s,children:s})]},s)),!A&&t.byFeature.length===0&&e.jsx("div",{className:"text-sm text-muted-foreground py-6 text-center",children:"No usage in window."})]})]})})}),e.jsx(U,{value:"model",children:e.jsx(p,{children:e.jsx(g,{className:"pt-4 space-y-1",children:t.byModel.map(([s,i])=>e.jsxs("div",{className:"grid grid-cols-12 text-sm py-1 border-b border-border/40",children:[e.jsx("div",{className:"col-span-5 font-mono text-xs truncate",children:s}),e.jsxs("div",{className:"col-span-2 text-right",children:[y(i.calls)," calls"]}),e.jsxs("div",{className:"col-span-3 text-right text-xs",children:[y(i.tin)," in / ",y(i.tout)," out"]}),e.jsx("div",{className:"col-span-2 text-right font-medium",children:K(i.cost)})]},s))})})}),e.jsx(U,{value:"user",children:e.jsx(p,{children:e.jsxs(g,{className:"pt-4 space-y-1",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-2",children:"Top 10 users by estimated cost — spot abuse fast."}),t.byUser.map(([s,i])=>e.jsxs("div",{className:"grid grid-cols-12 text-sm py-1 border-b border-border/40",children:[e.jsx("div",{className:"col-span-8 font-mono text-xs truncate",children:s}),e.jsx("div",{className:"col-span-2 text-right",children:y(i.calls)}),e.jsx("div",{className:"col-span-2 text-right font-medium",children:K(i.cost)})]},s))]})})}),e.jsx(U,{value:"recent",children:e.jsx(p,{children:e.jsx(g,{className:"pt-4 space-y-1 max-h-[600px] overflow-y-auto",children:C.slice(0,100).map((s,i)=>e.jsxs("div",{className:"grid grid-cols-12 text-xs py-1 border-b border-border/40",children:[e.jsx("div",{className:"col-span-3 text-muted-foreground",children:new Date(s.created_at).toLocaleStr
6ing()}),e.jsx("div",{className:"col-span-3 truncate font-medium",children:Q[s.function_name]||s.function_name}),e.jsx("div",{className:"col-span-3 font-mono truncate text-muted-foreground",children:s.model}),e.jsx("div",{className:"col-span-1 text-right",children:s.tokens_in||"—"}),e.jsx("div",{className:"col-span-1 text-right",children:s.tokens_out||"—"}),e.jsx("div",{className:`col-span-1 text-right ${s.status==="ok"||s.status==="degraded"?"text-muted-foreground":"text-destructive"}`,children:s.status})]},i))})})})]}),e.jsxs(p,{children:[e.jsx($,{children:e.jsx(T,{className:"text-sm",children:"How this is calculated"})}),e.jsxs(g,{className:"text-xs text-muted-foreground space-y-1",children:[e.jsxs("p",{children:["• Real per-token cost when ",e.jsx("code",{children:"tokens_in"})," / ",e.jsx("code",{children:"tokens_out"})," exist (Gemini + Lovable Gateway via the shared client)."]}),e.jsx("p",{children:"• Per-call heuristic for older rows that pre-date token instrumentation."}),e.jsxs("p",{children:["• Image generation (Gemini Image) is not yet token-metered — expect carousel costs to under-report until we instrument ",e.jsx("code",{children:"generateGeminiImage"}),"."]})]})]})]}):e.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Admin access required."})};export{Ie 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.