PageSourceSearch

https://aiseoradar.com/assets/AgencyPortal-CYrPQdcr.js

js aiseoradar.com collected 2026-10-09 05:04:56 UTC 23,573 bytes, 6 lines download raw bytes

1import{c as K,r as g,j as e,P as O,M as G,O as Q,e as U,W as z,m as C,s as j,B as F,U as E,a1 as $,L as S,a5 as f,n as N,G as L,C as W,k as b}from"./index-raivfVvd.js";import{P as Y}from"./PageMeta-CfbZPluk.js";import{u as M}from"./useMutation-BQctkEwv.js";import{T as H,a as X,b as T,c as I}from"./tabs-Bb7N4M9F.js";import{S as k,a as A,b as P,c as q,d as v}from"./select-BX9kXi_e.js";import J from"./html2canvas.esm-CBrSDip1.js";import{E as Z}from"./jspdf.es.min-Cou1pt6Q.js";import{M as ee}from"./mail-C6E0IY3A.js";import{P as se}from"./plus-6v325JK0.js";import{T as re}from"./trash-2-Cyxjt0HJ.js";import{D as te}from"./download-dWoFOXGF.js";import{E as ae}from"./eye-ACYDAOX0.js";import{C as le}from"./calendar-2iFhpii9.js";import{C as ne}from"./circle-x-C_CCFVXk.js";import"./index-XsHACavn.js";import"./index-Bs7G6K9v.js";import"./check-DRr65u8_.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 ie=K("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);var ce="Label",V=g.forwardRef((s,o)=>e.jsx(O.label,{...s,ref:o,onMouseDown:i=>{var r;i.target.closest("button, input, select, textarea")||((r=s.onMouseDown)==null||r.call(s,i),!i.defaultPrevented&&i.detail>1&&i.preventDefault())}}));V.displayName=ce;var B=V;const oe=Q("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),p=g.forwardRef(({className:s,...o},i)=>e.jsx(B,{ref:i,className:G(oe(),s),...o}));p.displayName=B.displayName;function Te(){const{user:s}=U(),o=z(),[i,h]=g.useState("branding"),{data:r,isLoading:c}=C({queryKey:["agency"],queryFn:async()=>{const{data:m}=await j.from("agencies").select("*").eq("user_id",s.id).maybeSingle();return m},enabled:!!s}),{data:l}=C({queryKey:["agency-clients",r==null?void 0:r.id],queryFn:async()=>{const{data:m}=await j.from("agency_clients").select("*").eq("agency_id",r.id).order("created_at",{ascending:!1});return m||[]},enabled:!!(r!=null&&r.id)}),{data:x}=C({queryKey:["agency-reports",r==null?void 0:r.id],queryFn:async()=>{if(!l||l.length===0)return[];const m=l.map(a=>a.id),{data:t}=await j.from("agency_reports").select("*, agency_clients(client_name, client_domain)").in("client_id",m).order("created_at",{ascending:!1}).limit(20);return t||[]},enabled:!!l&&l.length>0}),{data:u}=C({queryKey:["websites"],queryFn:async()=>{const{data:m}=await j.from("websites").select("id, domain").eq("user_id",s.id);return m||[]},enabled:!!s});return e.jsxs(e.Fragment,{children:[e.jsx(Y,{title:"Agency Portal | AI SEO Radar",description:"Manage agency clients, generate white-label reports, and monitor AI visibility across accounts."}),e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold tracking-tight text-foreground flex items-center gap-2",children:[e.jsx(F,{className:"h-6 w-6 text-primary"}),"Agency White-Label Portal"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Generate branded AI visibility reports for your clients"})]}),e.jsxs(H,{value:i,onValueChange:h,children:[e.jsxs(X,{className:"bg-card border border-border",children:[e.jsxs(T,{value:"branding",className:"gap-2",children:[e.jsx(ie,{className:"h-4 w-4"})," Branding"]}),e.jsxs(T,{value:"clients",className:"gap-2",children:[e.jsx(E,{className:"h-4 w-4"})," Clients"]}),e.jsxs(T,{value:"reports",className:"gap-2",children:[e.jsx($,{className:"h-4 w-4"})," Reports"]})]}),e.jsx(I,{value:"branding",children:e.jsx(de,{agency:r,agencyLoading:c,userId:(s==null?void 0:s.id)||"",queryClient:o})}),e.jsx(I,{value:"clients",children:e.jsx(me,{agency:r,clients:l||[],websites:u||[],queryClient:o})}),e.jsx(I,{value:"reports",children:e.jsx(xe,{clients:l||[],reports:x||[],agency:r,queryClient:o})})]})]})]})}function de({agency:s,agencyLoading:o,userId:i,queryClient:h}){var m,t;const[r,c]=g.useState({agency_name:"",brand_color:"#6366f1",secondary_color:"#1e293b",website:"",contact_email:"",footer_text:"AI insights powered by AI SEO Radar",show_powered_by:!0}),[l,x]=g.useState(!1);s&&!l&&(c({agency_name:s.agency_name||"",brand_color:s.brand_color||"#6366f1",secondary_color:s.secondary_color||"#1e293b",website:s.website||"",contact_email:s.contact_email||"",footer_text:s.footer_text||"",show_powered_by:s.show_powered_by??!0}),x(!0));const u=M({mutationFn:async()=>
6{if(s){const{error:a}=await j.from("agencies").update(r).eq("id",s.id);if(a)throw a}else{const{error:a}=await j.from("agencies").insert({...r,user_id:i});if(a)throw a}},onSuccess:()=>{h.invalidateQueries({queryKey:["agency"]}),b.success("Branding saved!")},onError:a=>b.error(a.message)});return o?e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsx(S,{className:"h-6 w-6 animate-spin text-primary"})}):e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mt-4",children:[e.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Agency Settings"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(p,{children:"Agency Name"}),e.jsx(f,{value:r.agency_name,onChange:a=>c({...r,agency_name:a.target.value}),placeholder:"Your Agency Name"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(p,{children:"Primary Color"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"color",value:r.brand_color,onChange:a=>c({...r,brand_color:a.target.value}),className:"h-10 w-12 rounded border border-border cursor-pointer"}),e.jsx(f,{value:r.brand_color,onChange:a=>c({...r,brand_color:a.target.value}),className:"flex-1"})]})]}),e.jsxs("div",{children:[e.jsx(p,{children:"Secondary Color"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"color",value:r.secondary_color,onChange:a=>c({...r,secondary_color:a.target.value}),className:"h-10 w-12 rounded border border-border cursor-pointer"}),e.jsx(f,{value:r.secondary_color,onChange:a=>c({...r,secondary_color:a.target.value}),className:"flex-1"})]})]})]}),e.jsxs("div",{children:[e.jsx(p,{children:"Website"}),e.jsx(f,{value:r.website,onChange:a=>c({...r,website:a.target.value}),placeholder:"https://youragency.com"})]}),e.jsxs("div",{children:[e.jsx(p,{children:"Contact Email"}),e.jsx(f,{value:r.contact_email,onChange:a=>c({...r,contact_email:a.target.value}),placeholder:"[email protected]"})]}),e.jsxs("div",{children:[e.jsx(p,{children:"Footer Text"}),e.jsx(f,{value:r.footer_text,onChange:a=>c({...r,footer_text:a.target.value})})]}),e.jsxs(N,{onClick:()=>u.mutate(),disabled:u.isPending,children:[u.isPending?e.jsx(S,{className:"h-4 w-4 animate-spin"}):null,"Save Branding"]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[e.jsx("div",{className:"px-8 py-6",style:{background:`linear-gradient(135deg, ${r.secondary_color} 0%, ${r.brand_color}33 100%)`,borderBottom:`2px solid ${r.brand_color}`},children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg flex items-center justify-center text-white font-bold",style:{background:r.brand_color},children:((t=(m=r.agency_name)==null?void 0:m[0])==null?void 0:t.toUpperCase())||"A"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-foreground",children:r.agency_name||"Your Agency"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"AI Visibility Report"})]})]}),e.jsxs("div",{className:"text-right text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(L,{className:"h-3 w-3"}),r.website||"youragency.com"]}),e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx(ee,{className:"h-3 w-3"}),r.contact_email||"[email protected]"]})]})]})}),e.jsxs("div",{className:"p-8 bg-card space-y-4",children:[e.jsx("div",{className:"grid grid-cols-3 gap-3",children:["Visibility Score","Citations","Sentiment"].map(a=>e.jsxs("div",{className:"rounded-lg p-3 border border-border text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:"—"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a})]},a))}),e.jsx("div",{className:"h-20 rounded-lg border border-border flex items-center justify-center",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:"Chart Preview"})}),r.show_powered_by&&e.jsx("p",{className:"text-[10px] text-center text-muted-foreground",children:r.footer_text})]})]})]})}function me({agency:s,clients:o,websites:i,queryClient:h}){const[r,c]=g.useState(!1),[l,x]=g.useState({client_name:"",client_domain:"",industry:"general",report_frequency:"monthly",website_id:""}),u=M({mutationFn:async()=>
6{if(!s)throw new Error("Set up branding first");const{error:t}=await j.from("agency_clients").insert({agency_id:s.id,client_name:l.client_name,client_domain:l.client_domain,industry:l.industry,report_frequency:l.report_frequency,website_id:l.website_id||null});if(t)throw t},onSuccess:()=>{h.invalidateQueries({queryKey:["agency-clients"]}),c(!1),x({client_name:"",client_domain:"",industry:"general",report_frequency:"monthly",website_id:""}),b.success("Client added!")},onError:t=>b.error(t.message)}),m=M({mutationFn:async t=>{const{error:a}=await j.from("agency_clients").delete().eq("id",t);if(a)throw a},onSuccess:()=>{h.invalidateQueries({queryKey:["agency-clients"]}),b.success("Client removed")}});return s?e.jsxs("div",{className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground",children:["Clients (",o.length,")"]}),e.jsxs(N,{size:"sm",onClick:()=>c(!r),children:[e.jsx(se,{className:"h-4 w-4"})," Add Client"]})]}),r&&e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(p,{children:"Client Name"}),e.jsx(f,{value:l.client_name,onChange:t=>x({...l,client_name:t.target.value}),placeholder:"Acme Corp"})]}),e.jsxs("div",{children:[e.jsx(p,{children:"Domain"}),e.jsx(f,{value:l.client_domain,onChange:t=>x({...l,client_domain:t.target.value}),placeholder:"acme.com"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx(p,{children:"Industry"}),e.jsx(f,{value:l.industry,onChange:t=>x({...l,industry:t.target.value})})]}),e.jsxs("div",{children:[e.jsx(p,{children:"Frequency"}),e.jsxs(k,{value:l.report_frequency,onValueChange:t=>x({...l,report_frequency:t}),children:[e.jsx(A,{children:e.jsx(P,{})}),e.jsxs(q,{children:[e.jsx(v,{value:"weekly",children:"Weekly"}),e.jsx(v,{value:"monthly",children:"Monthly"}),e.jsx(v,{value:"quarterly",children:"Quarterly"})]})]})]}),e.jsxs("div",{children:[e.jsx(p,{children:"Link Website"}),e.jsxs(k,{value:l.website_id,onValueChange:t=>x({...l,website_id:t}),children:[e.jsx(A,{children:e.jsx(P,{placeholder:"Optional"})}),e.jsx(q,{children:i.map(t=>e.jsx(v,{value:t.id,children:t.domain},t.id))})]})]})]}),e.jsxs(N,{onClick:()=>u.mutate(),disabled:!l.client_name||!l.client_domain||u.isPending,children:[u.isPending?e.jsx(S,{className:"h-4 w-4 animate-spin"}):null,"Save Client"]})]}),e.jsxs("div",{className:"space-y-2",children:[o.map(t=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-card px-4 py-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t.client_name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.client_domain," • ",t.industry," • ",t.report_frequency]})]}),e.jsx(N,{variant:"ghost",size:"icon",onClick:()=>m.mutate(t.id),children:e.jsx(re,{className:"h-4 w-4 text-destructive"})})]},t.id)),o.length===0&&e.jsxs("div",{className:"rounded-xl border border-border bg-card p-8 text-center",children:[e.jsx(E,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground opacity-40"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No clients yet"})]})]})]}):e.jsxs("div",{className:"rounded-xl border border-border bg-card p-12 text-center mt-4",children:[e.jsx(F,{className:"h-10 w-10 mx-auto mb-3 text-muted-foreground opacity-40"}),e.jsx("p",{className:"text-muted-foreground",children:"Set up your agency branding first"})]})}function xe({clients:s,reports:o,agency:i,queryClient:h}){const[r,c]=g.useState(""),[l,x]=g.useState("full"),[u,m]=g.useState(!1),[t,a]=g.useState(null);async function w(){var d;if(r){m(!0);try{const{data:n,error:y}=await j.functions.invoke("agency-report",{body:{client_id:r,report_type:l}});if(y)throw y;h.invalidateQueries({queryKey:["agency-reports"]}),a((d=n.report)==null?void 0:d.report_data),b.success("Report generated!")}catch(n){b.error(n.message||"Failed to generate report")}finally{m(!1)}}}async function _(){const d=document.getElementById("report-preview");if(d)try{const n=await J(d,{scale:2,backgroundColor:"#0a0e1a",useCORS:!0}),y=n.toDataURL("image/png"),D=new Z({orientation:"portrait",unit:"px",format:[n.width,n.height]});D.addImage(y,"PNG",0,0,n.width,n.height),D.save(`Report-${Date.now()}.pdf`),b.success("PDF downloaded!")}
6catch{b.error("PDF export failed")}}return e.jsxs("div",{className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs(k,{value:r,onValueChange:c,children:[e.jsx(A,{className:"w-52 bg-card",children:e.jsx(P,{placeholder:"Select client"})}),e.jsx(q,{children:s.map(d=>e.jsx(v,{value:d.id,children:d.client_name},d.id))})]}),e.jsxs(k,{value:l,onValueChange:x,children:[e.jsx(A,{className:"w-44 bg-card",children:e.jsx(P,{})}),e.jsxs(q,{children:[e.jsx(v,{value:"executive",children:"Executive Summary"}),e.jsx(v,{value:"full",children:"Full AI SEO Report"}),e.jsx(v,{value:"monthly",children:"Monthly Performance"})]})]}),e.jsxs(N,{onClick:w,disabled:!r||u,children:[u?e.jsx(S,{className:"h-4 w-4 animate-spin"}):e.jsx($,{className:"h-4 w-4"}),"Generate Report"]}),t&&e.jsxs(N,{variant:"outline",onClick:_,children:[e.jsx(te,{className:"h-4 w-4"})," Export PDF"]})]}),t&&e.jsx(ue,{data:t,refCallback:d=>d}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Report History"}),e.jsxs("div",{className:"space-y-2",children:[o.map(d=>{var n;return e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-card px-4 py-3 cursor-pointer hover:bg-muted/50",onClick:()=>a(d.report_data),children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-medium text-foreground",children:[((n=d.agency_clients)==null?void 0:n.client_name)||"Client"," — ",d.report_type]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(d.created_at).toLocaleDateString()})]}),e.jsx(ae,{className:"h-4 w-4 text-muted-foreground"})]},d.id)}),o.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No reports yet"})]})]})]})}function ue({data:s,refCallback:o}){var a,w,_,d;const i=(s==null?void 0:s.agency)||{},h=(s==null?void 0:s.client)||{},r=(s==null?void 0:s.visibility)||{},c=(s==null?void 0:s.metrics)||{},l=(s==null?void 0:s.model_breakdown)||[],x=(s==null?void 0:s.top_opportunities)||[],u=(s==null?void 0:s.competitors)||[],m=new Date((s==null?void 0:s.generated_at)||Date.now()).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),t=i.brand_color||"#6366f1";return e.jsxs("div",{id:"report-preview",ref:o,className:"rounded-xl border border-border overflow-hidden",style:{background:"#0a0e1a",color:"#e2e8f0"},children:[e.jsx("div",{className:"px-10 py-8",style:{background:`linear-gradient(135deg, ${i.secondary_color||"#0f172a"} 0%, ${t}22 50%, ${i.secondary_color||"#0f172a"} 100%)`,borderBottom:`2px solid ${t}`},children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-xl flex items-center justify-center font-bold text-white text-xl",style:{background:t},children:((w=(a=i.name)==null?void 0:a[0])==null?void 0:w.toUpperCase())||"A"}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold",style:{color:"#f1f5f9"},children:"AI Visibility Report"}),e.jsxs("p",{className:"text-xs font-mono tracking-wider",style:{color:"#64748b"},children:[i.name||"Agency"," • CONFIDENTIAL"]})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{color:"#94a3b8"},children:[e.jsx(L,{className:"h-3.5 w-3.5"}),h.domain||"—"]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs mt-1",style:{color:"#64748b"},children:[e.jsx(le,{className:"h-3.5 w-3.5"}),m]})]})]})}),e.jsxs("div",{className:"px-10 py-8 space-y-8",children:[(s==null?void 0:s.executive_summary)&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold tracking-wider mb-3",style:{color:"#94a3b8",textTransform:"uppercase",letterSpacing:"0.1em"},children:"Executive Summary"}),e.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-line",style:{color:"#cbd5e1"},children:s.executive_summary})]}),e.jsxs("div",{className:"flex items-center gap-8",children:[e.jsx("div",{className:"flex flex-col items-center justify-center rounded-2xl p-6",style:{width:150,height:150,background:`conic-gradient(${t} ${Number(r.score||0)*3.6}deg, #1e293b 0deg)`,position:"relative"},children:e.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl",style:{width:110,height:110,background:"#0f172a",position:"absolute"},children:[e.jsx("span",{className:"text-4xl font-black",style:{color:"#f1f5f9"},children:Math.round(Number(r.score||0))}),e.jsx("span",{className:"text-[10px] font-mono",style:{color:t},children:"/100"})]})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("h3",{className:"text-lg font-bold mb-1",style:{color:"#f1f5f9"},children:["AI Visibility Score — ",h.name||h.domain]}),e.jsxs("p",{className:"text-sm mb-4",style:{color:"#94a3b8"},children:["Measures visibility across major AI platforms for ",h.domain,"."]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(R,{label:"Citations",value:String(c.total_citations??0),color:t}),e.jsx(R,{label:"Avg Position",value:c.avg_position?`#${c.avg_position}`:"—",color:t}),e.jsx(R,{label:"Sentiment",value:c.avg_sentiment!=null?`${c.avg_sentiment}%`:"—",color:t})]})]})]}),l.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold tracking-wider mb-4",style:{color:"#94a3b8",textTransform:"uppercase",letterSpacing:"0.1em"},children:"Visibility by AI Model"}),e.jsx("div",{className:"space-y-3",children:l.map(n=>e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"w-36 text-sm font-medium truncate",style:{color:"#e2e8f0"},children:n.model}),e.jsx("div",{className:"flex-1 h-7 rounded-lg overflow-hidden",style:{background:"#1e293b"},children:e.jsx("div",{className:"h-full rounded-lg flex items-center px-3",style:{width:`${Math.max(n.score,4)}%`,background:`linear-gradient(90deg, ${t}CC, ${t}66)`},children:e.jsxs("span",{className:"text-xs font-bold text-white",children:[n.score,"%"]})})}),e.jsxs("span",{className:"text-xs w-20 text-right",style:{color:"#64748b"},children:[n.cited,"/",n.total]})]},n.model))})]}),x.length>0&&e.jsxs("div",{className:"rounded-xl p-6",style:{background:"#111827",border:"1px solid #1e293b"},children:[e.jsx("h3",{className:"text-sm font-bold tracking-wider mb-3",style:{color:"#94a3b8",textTransform:"uppercase",letterSpacing:"0.1em"},children:"Top AI Prompt Opportunities"}),e.jsx("div",{className:"space-y-2",children:x.slice(0,5).map((n,y)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ne,{className:"h-4 w-4 shrink-0",style:{color:"#ef4444"}}),e.jsx("span",{className:"text-sm flex-1",style:{color:"#e2e8f0"},children:n.query}),e.jsx("span",{className:"text-xs",style:{color:"#64748b"},children:n.model})]},y))})]}),u.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold tracking-wider mb-3",style:{color:"#94a3b8",textTransform:"uppercase",letterSpacing:"0.1em"},children:"Competitor Visibility"}),e.jsx("div",{className:"space-y-2",children:u.map((n,y)=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg p-3",style:{background:"#111827",border:"1px solid #1e293b"},children:[e.jsx("span",{className:"text-sm font-medium",style:{color:"#e2e8f0"},children:n.label||n.domain}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-xs",style:{color:"#64748b"},children:[n.total_citations||0," citations"]}),e.jsx("span",{className:"text-sm font-bold",style:{color:t},children:n.visibility_score||0})]})]},y))})]}),r.citation_score!=null&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold tracking-wider mb-4",style:{color:"#94a3b8",textTransform:"uppercase",letterSpacing:"0.1em"},children:"Score Breakdown"}
6),e.jsx("div",{className:"grid grid-cols-5 gap-3",children:[{label:"Citation",value:r.citation_score,weight:"35%"},{label:"Retrieval",value:r.retrieval_score,weight:"25%"},{label:"Prompt Diversity",value:r.prompt_diversity_score,weight:"15%"},{label:"Model Coverage",value:r.model_coverage_score,weight:"15%"},{label:"Freshness",value:r.freshness_score,weight:"10%"}].map(n=>e.jsxs("div",{className:"rounded-xl p-4 text-center",style:{background:"#111827",border:"1px solid #1e293b"},children:[e.jsx("p",{className:"text-2xl font-black",style:{color:"#f1f5f9"},children:n.value!=null?Math.round(Number(n.value)):"—"}),e.jsx("p",{className:"text-[10px] font-medium mt-1",style:{color:"#94a3b8"},children:n.label}),e.jsxs("p",{className:"text-[9px] font-mono",style:{color:"#475569"},children:["Weight: ",n.weight]})]},n.label))})]}),e.jsxs("div",{className:"flex items-center justify-between pt-6",style:{borderTop:"1px solid #1e293b"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-5 w-5 rounded flex items-center justify-center text-white text-[8px] font-bold",style:{background:t},children:((d=(_=i.name)==null?void 0:_[0])==null?void 0:d.toUpperCase())||"A"}),e.jsxs("span",{className:"text-xs font-semibold",style:{color:"#475569"},children:[i.name||"Agency"," — Generated ",m]})]}),i.show_powered_by&&e.jsx("span",{className:"text-[10px] font-mono",style:{color:"#334155"},children:i.footer_text||"Confidential"})]})]})]})}function R({label:s,value:o,color:i}){return e.jsxs("div",{className:"rounded-lg p-3",style:{background:"#111827",border:"1px solid #1e293b"},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(W,{className:"h-3.5 w-3.5",style:{color:i}}),e.jsx("span",{className:"text-[10px]",style:{color:"#64748b"},children:s})]}),e.jsx("span",{className:"text-lg font-bold",style:{color:"#f1f5f9"},children:o})]})}export{Te 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.