1"use strict";(self.webpackChunkfrontend_v1=self.webpackChunkfrontend_v1||[]).push([[6748,9311],{2642:(e,s,a)=>{a.d(s,{Wj:()=>c,l_:()=>l,mK:()=>r,nL:()=>n});a(9950);var t=a(6455),i=a(4414);const n=e=>{let{title:s,description:a,keywords:n,canonical:r,image:l="https://cyberforget.com/og-default.png",type:c="website",author:o="CyberForget Security Team",twitterHandle:d="@CyberForget",noindex:m=!1}=e;return(0,i.jsxs)(t.mg,{children:[(0,i.jsx)("title",{children:s}),(0,i.jsx)("meta",{name:"description",content:a}),n&&(0,i.jsx)("meta",{name:"keywords",content:n}),(0,i.jsx)("meta",{name:"author",content:o}),r&&(0,i.jsx)("link",{rel:"canonical",href:r}),(0,i.jsx)("meta",{name:"robots",content:m?"noindex, nofollow":"index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1"}),(0,i.jsx)("meta",{property:"og:type",content:c}),(0,i.jsx)("meta",{property:"og:site_name",content:"CyberForget"}),(0,i.jsx)("meta",{property:"og:title",content:s}),(0,i.jsx)("meta",{property:"og:description",content:a}),r&&(0,i.jsx)("meta",{property:"og:url",content:r}),(0,i.jsx)("meta",{property:"og:image",content:l}),(0,i.jsx)("meta",{property:"og:image:width",content:"1200"}),(0,i.jsx)("meta",{property:"og:image:height",content:"630"}),(0,i.jsx)("meta",{property:"og:locale",content:"en_US"}),(0,i.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,i.jsx)("meta",{name:"twitter:site",content:d}),(0,i.jsx)("meta",{name:"twitter:title",content:s}),(0,i.jsx)("meta",{name:"twitter:description",content:a}),(0,i.jsx)("meta",{name:"twitter:image",content:l})]})},r=e=>{let{title:s,description:a,keywords:r,canonical:l,image:c,toolName:o,toolDescription:d,rating:m="4.8",ratingCount:h="50000",price:u="0",faqItems:x=[]}=e;const p={"@context":"https://schema.org","@graph":[{"@type":"WebApplication",name:o,url:l,description:d,applicationCategory:"SecurityApplication",operatingSystem:"Web browser",offers:{"@type":"Offer",price:u,priceCurrency:"USD"},aggregateRating:{"@type":"AggregateRating",ratingValue:m,ratingCount:h},provider:{"@type":"Organization",name:"CyberForget",url:"https://cyberforget.com"}},{"@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:"https://cyberforget.com"},{"@type":"ListItem",position:2,name:o,item:l}]}]};return x&&x.length>0&&p["@graph"].push({"@type":"FAQPage",mainEntity:x.map(e=>({"@type":"Question",name:e.question,acceptedAnswer:{"@type":"Answer",text:e.answer}}))}),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n,{title:s,description:a,keywords:r,canonical:l,image:c,type:"website"}),(0,i.jsx)(t.mg,{children:(0,i.jsx)("script",{type:"application/ld+json",children:JSON.stringify(p)})})]})},l=e=>{let{title:s,description:a,keywords:r,canonical:l,image:c,productName:o,price:d,currency:m="USD",availability:h="InStock",rating:u,ratingCount:x}=e;const p={"@context":"https://schema.org","@type":"Product",name:o,description:a,image:c,offers:{"@type":"Offer",price:d,priceCurrency:m,availability:`https://schema.org/${h}`,url:l,priceValidUntil:"2026-12-31"}};return u&&x&&(p.aggregateRating={"@type":"AggregateRating",ratingValue:u,ratingCount:x}),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n,{title:s,description:a,keywords:r,canonical:l,image:c,type:"product"}),(0,i.jsx)(t.mg,{children:(0,i.jsx)("script",{type:"application/ld+json",children:JSON.stringify(p)})})]})},c=e=>{let{title:s,description:a,keywords:r,canonical:l,image:c,author:o,datePublished:d,dateModified:m,articleBody:h}=e;const u={"@context":"https://schema.org","@type":"Article",headline:s,description:a,image:c,datePublished:d,dateModified:m||d,author:{"@type":"Person",name:o},publisher:{"@type":"Organization",name:"CyberForget",logo:{"@type":"ImageObject",url:"https://cyberforget.com/logo.png"}}};return h&&(u.articleBody=h),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n,{title:s,description:a,keywords:r,canonical:l,image:c,type:"article",author:o}),(0,i.jsx)(t.mg,{children:(0,i.jsx)("script",{type:"application/ld+json",children:JSON.stringify(u)})})]})}},6748:(e,s,a)=>{a.r(s),a.d(s,{default:()=>m});var t=a(9950),i=a(8429),n=a(4322),r=a(9311),l=a(4414);const c=()=>{const[e,s]=(0,t.useState)([]),[a,i]=(0,t.useState)(!0),[n,c]=(0,t.useState)(null),[o,d]=(0,t.useState)(null),[m,h]=(0,t.useState)({userRole:"USER",subscriptionStatus:"FREE",scanMode:"SIMULATED",isActive:!0,description:""}),u=["USER","PREMIUM","ADMIN","SUPER_ADMIN"],x=["FREE","TRIAL","PREMIUM","ENTERPRISE","CANCELLED","EXPIRED"],p=["DEMO","SIMULATED","REAL"];(0,t.useEffect)(()=>{j()},[]);const j=async()=>{try{i(!0);const e=await r.default.get("/data-broker-scan/config/modes");e.data.success&&s(e.data.data)}catch(n){console.error("Error loading scan mode configs:",n),c("Failed to load scan mode configurations")}finally{i(!1)}},g=async e=>{try{(await r.default.post("/data-broker-scan/config/modes",e)).data.success&&(await j(),d(null),h({userRole:"USER",subscriptionStatus:"FREE",scanMode:"SIMULATED",isActive:!0,description:""}))}catch(n){console.error("Error saving config:",n),c("Failed to save configuration")}},v=e=>{switch(e){case"DEMO":default:return"#6b7280";case"SIMULATED":return"#3b82f6";case"REAL":return"#10b981"}};return a?(0,l.jsx)("div",{className:"scan-mode-manager",children:(0,l.jsx)("div",{className:"loading",children:"Loading scan mode configurations..."})}):(0,l.jsxs)("div",{className:"scan-mode-manager",children:[(0,l.jsxs)("div",{className:"header",children:[(0,l.jsx)("h2",{children:"Data Broker Scan Mode Configuration"}),(0,l.jsx)("p",{children:"Configure which scan mode users get based on their role and subscription status."})]}),n&&(0,l.jsxs)("div",{className:"error-message",children:[n,(0,l.jsx)("button",{onClick:()=>c(null),children:"\xd7"})]}),(0,l.jsxs)("div",{className:"config-form",children:[(0,l.jsx)("h3",{children:"Add New Configuration"}),(0,l.jsxs)("div",{className:"form-grid",children:[(0,l.jsxs)("div",{className:"form-group",children:[(0,l.jsx)("label",{children:"User Role"}),(0,l.jsx)("select",{value:m.userRole,onChange:e=>h({...m,userRole:e.target.value}),children:u.map(e=>(0,l.jsx)("option",{value:e,children:e},e))})]}),(0,l.jsxs)("div",{className:"form-group",children:[(0,l.jsx)("label",{children:"Subscription Status"}),(0,l.jsx)("select",{value:m.subscriptionStatus,onChange:e=>h({...m,subscriptionStatus:e.target.value}),children:x.map(e=>(0,l.jsx)("option",{value:e,children:e},e))})]}),(0,l.jsxs)("div",{className:"form-group",children:[(0,l.jsx)("label",{children:"Scan Mode"}),(0,l.jsx)("select",{value:m.scanMode,onChange:e=>h({...m,scanMode:e.target.value}),children:p.map(e=>(0,l.jsx)("option",{value:e,children:e},e))})]}),(0,l.jsx)("div",{className:"form-group",children:(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:m.isActive,onChange:e=>h({...m,isActive:e.target.checked})}),"Active"]})})]}),(0,l.jsxs)("div",{className:"form-group",children:[(0,l.jsx)("label",{children:"Description"}),(0,l.jsx)("input",{type:"text",value:m.description,onChange:e=>h({...m,description:e.target.value}),placeholder:"Optional description"})]}),(0,l.jsx)("button",{className:"save-btn",onClick:()=>g(m),children:"Add Configuration"})]}),(0,l.jsxs)("div",{className:"configs-list",children:[(0,l.jsx)("h3",{children:"Current Configurations"}),(0,l.jsx)("div",{className:"configs-grid",children:e.map(e=>(0,l.jsxs)("div",{className:"config-card",children:[(0,l.jsxs)("div",{className:"config-header",children:[(0,l.jsxs)("div",{className:"config-title",children:[(0,l.jsx)("span",{className:"role-badge",children:e.userRole}),(0,l.jsx)("span",{className:"status-badge",children:e.subscriptionStatus})]}),(0,l.jsxs)("div",{className:"config-actions",children:[(0,l.jsx)("button",{className:"edit-btn",onClick:()=>d(e),children:"Edit"}),(0,l.jsx)("button",{className:"delete-btn",onClick:()=>(async e=>{if(window.confirm("Are you sure you want to delete this configuration?"))try{(await r.default.delete(`/data-broker-scan/config/modes/${e}`)).data.success&&await j()}catch(n){console.error("Error deleting config:",n),c("Failed to delete configuration")}})(e.id),children:"Delete"})]})]}),(0,l.jsxs)("div",{className:"config-details",children:[(0,l.jsxs)("div",{className:"scan-mode",children:[(0,l.jsx)("span",{className:"mode-badge",style:{backgroundColor:v(e.scanMode)},children:e.scanMode}),(0,l.jsx)("span",{className:"status "+(e.isActive?"active":"inactive"),children:e.isActive?"Active":"Inactive"})]}),e.description&&(0,l.jsx)("p",{className:"description",children:e.description}),(0,l.jsxs)("div",{className:"timestamps",children:[(0,l.jsxs)("small",{children:["Created: ",new Date(e.createdAt).toLocaleDateString()]}),(0,l.jsxs)("small",{children:["Updated: ",new Date(e.updatedAt).toLocaleDateString()]})]})]})]},e.id))})]}),o&&(0,l.jsx)("div",{className:"modal-overlay",onClick:()=>d(null),children:(0,l.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,l.jsx)("h3",{children:"Edit Configuration"}),(0,l.jsxs)("div",{className:"form-grid",children:[(0,l.jsxs)("div",{className:"form-group",children:[(0,l.jsx)("label",{children:"User Role"}),(0,l.jsx)("select",{value:o.userRole,onChange:e=>d({...o,userRole:e.target.value}),children:u.map(e=>(0,l.jsx)("option",{value:e,children:e},e))})]}),(0,l.jsxs)("div",{className:"form-group",children:[(0,l.jsx)("label",{children:"Subscription Status"}),(0,l.jsx)("select",{value:o.subscriptionStatus,onChange:e=>d({...o,subscriptionStatus:e.target.value}),children:x.map(e=>(0,l.jsx)("option",{value:e,children:e},e))})]}),(0,l.jsxs)("div",{className:"form-group",children:[(0,l.jsx)("label",{children:"Scan Mode"}),(0,l.jsx)("select",{value:o.scanMode,onChange:e=>d({...o,scanMode:e.target.value}),children:p.map(e=>(0,l.jsx)("option",{value:e,children:e},e))})]}),(0,l.jsx)("div",{className:"form-group",children:(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:o.isActive,onChange:e=>d({...o,isActive:e.target.checked})}),"Active"]})})]}),(0,l.jsxs)("div",{className:"form-group",children:[(0,l.jsx)("label",{children:"Description"}),(0,l.jsx)("input",{type:"text",value:o.description||"",onChange:e=>d({...o,description:e.target.value}),placeholder:"Optional description"})]}),(0,l.jsxs)("div",{className:"modal-actions",children:[(0,l.jsx)("button",{className:"save-btn",onClick:()=>g(o),children:"Save Changes"}),(0,l.jsx)("button",{className:"cancel-btn",onClick:()=>d(null),children:"Cancel"})]})]})})]})};var o=a(2875),d=a(2642);const m=()=>{var e;const s=(0,i.Zp)(),{user:a,isAuthenticated:m,loading:h}=(0,n.A)(),[u,x]=(0,t.useState)("overview"),[p,j]=(0,t.useState)(!0),[g,v]=(0,t.useState)({}),[f,b]=(0,t.useState)([]),[y,N]=(0,t.useState)({}),[k,S]=(0,t.useState)({}),[w,C]=(0,t.useState)({}),[A,E]=(0,t.useState)(null),[I,R]=(0,t.useState)([]),[M,L]=(0,t.useState)(!1),[F,$]=(0,t.useState)(null),[D,T]=(0,t.useState)(null),[U,P]=(0,t.useState)(!1);(0,t.useEffect)(()=>{var e;if(h)return;if(!m)return void s("/login");const t=null===a||void 0===a||null===(e=a.role)||void 0===e?void 0:e.toUpperCase();if(a&&"ADMIN"!==t&&"SUPER_ADMIN"!==t)return console.log("User is not admin, redirecting to dashboard. Role:",a.role),void s("/dashboard");q()},[null===a||void 0===a?void 0:a.id,null===a||void 0===a?void 0:a.role,m,h,s]);const q=async()=>{try{j(!0),E(null);const[e,s,a,t,i]=await Promise.allSettled([r.default.get("/admin/stats"),r.default.get("/admin/users?limit=10"),r.default.get("/admin/system/health"),r.default.get("/admin/queues"),r.default.get("/admin/threats/stats")]);"fulfilled"===e.status&&v(e.value.data),"fulfilled"===s.status&&b(s.value.data.users||[]),"fulfilled"===a.status&&N(a.value.data.health||{}),"fulfilled"===t.status&&S(t.value.data.data||{}),"fulfilled"===i.status&&C(i.value.data.data||{})}catch(A){var e;console.error("Error loading admin data:",A),401===(null===(e=A.response)||void 0===e?void 0:e.status)?E("Authentication Failed: Backend rejected the token. (Clerk/Supabase Mismatch)"):E("Failed to load admin dashboard data")}finally{j(!1)}},O=async(e,s)=>{try{await r.default.post(`/admin/queues/${e}/${s}`),await q()}catch(A){console.error(`Error ${s}ing queue:`,A),E(`Failed to ${s} queue ${e}`)}},z=async()=>{try{P(!0);const e=await r.default.get("/admin/funnel");T(e.data)}catch(e){console.error("Error loading funnel:",e),E("Failed to load funnel")}finally{P(!1)}},B=async()=>
1{try{L(!0);const e=await r.default.get("/admin/removals/queue");R(e.data.queue||[])}catch(e){console.error("Error loading removals queue:",e)}finally{L(!1)}};return p?(0,l.jsxs)("div",{className:"admin-dashboard",children:[(0,l.jsx)(d.nL,{title:"Admin Dashboard | CyberForget",noindex:!0}),(0,l.jsxs)("div",{className:"loading-container",children:[(0,l.jsx)("div",{className:"loading-spinner"}),(0,l.jsx)("p",{children:"Loading admin dashboard..."})]})]}):(0,l.jsxs)("div",{className:"admin-dashboard",children:[(0,l.jsxs)("div",{className:"admin-header",children:[(0,l.jsxs)("div",{className:"admin-title",children:[(0,l.jsx)(o.e7y,{className:"admin-icon"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{children:"Admin Dashboard"}),(0,l.jsx)("p",{children:"System administration and monitoring"})]})]}),(0,l.jsxs)("div",{className:"admin-user-info",children:[(0,l.jsx)("span",{className:"admin-badge",children:null===a||void 0===a?void 0:a.role}),(0,l.jsxs)("span",{className:"admin-name",children:[null===a||void 0===a?void 0:a.firstName," ",null===a||void 0===a?void 0:a.lastName]})]})]}),A&&(0,l.jsxs)("div",{className:"error-banner",children:[(0,l.jsx)(o.BS8,{}),(0,l.jsx)("span",{children:A}),(0,l.jsx)("button",{onClick:()=>E(null),children:"\xd7"})]}),(0,l.jsxs)("div",{className:"admin-tabs",children:[(0,l.jsxs)("button",{className:"tab "+("overview"===u?"active":""),onClick:()=>x("overview"),children:[(0,l.jsx)(o.YYR,{})," Overview"]}),(0,l.jsxs)("button",{className:"tab "+("funnel"===u?"active":""),onClick:()=>{x("funnel"),z()},children:[(0,l.jsx)(o.YYR,{})," Funnel"]}),(0,l.jsxs)("button",{className:"tab "+("users"===u?"active":""),onClick:()=>s("/admin/users"),children:[(0,l.jsx)(o.YXz,{})," Users"]}),(0,l.jsxs)("button",{className:"tab "+("scans"===u?"active":""),onClick:()=>x("scans"),children:[(0,l.jsx)(o.KSO,{})," Scan Modes"]}),(0,l.jsxs)("button",{className:"tab "+("system"===u?"active":""),onClick:()=>x("system"),children:[(0,l.jsx)(o.vwk,{})," System"]}),(0,l.jsxs)("button",{className:"tab "+("threats"===u?"active":""),onClick:()=>s("/admin/threats"),children:[(0,l.jsx)(o.BS8,{})," Threats"]}),(0,l.jsxs)("button",{className:"tab "+("queues"===u?"active":""),onClick:()=>x("queues"),children:[(0,l.jsx)(o.nBS,{})," Queues"]}),(0,l.jsxs)("button",{className:"tab "+("removals"===u?"active":""),onClick:()=>{x("removals"),B()},children:[(0,l.jsx)(o.A7C,{})," Removals",I.length>0&&(0,l.jsx)("span",{className:"tab-badge",children:I.length})]})]}),(0,l.jsxs)("div",{className:"admin-content",children:["overview"===u&&(0,l.jsxs)("div",{className:"overview-tab",children:[(0,l.jsxs)("div",{className:"stats-grid",children:[(0,l.jsxs)("div",{className:"stat-card glassmorphic hover-glow",children:[(0,l.jsx)("div",{className:"stat-icon users",children:(0,l.jsx)(o.YXz,{})}),(0,l.jsxs)("div",{className:"stat-content",children:[(0,l.jsx)("h3",{children:g.totalUsers||0}),(0,l.jsx)("p",{children:"Total Registered"})]})]}),(0,l.jsxs)("div",{className:"stat-card glassmorphic hover-glow",children:[(0,l.jsx)("div",{className:"stat-icon premium",children:(0,l.jsx)(o.SMR,{})}),(0,l.jsxs)("div",{className:"stat-content",children:[(0,l.jsx)("h3",{children:g.premiumUsers||0}),(0,l.jsx)("p",{children:"Premium Tier"})]})]}),(0,l.jsxs)("div",{className:"stat-card glassmorphic hover-glow",children:[(0,l.jsx)("div",{className:"stat-icon trial",children:(0,l.jsx)(o.YYR,{})}),(0,l.jsxs)("div",{className:"stat-content",children:[(0,l.jsx)("h3",{children:g.trialUsers||0}),(0,l.jsx)("p",{children:"Trial Accounts"})]})]}),(0,l.jsxs)("div",{className:"stat-card glassmorphic hover-glow",children:[(0,l.jsx)("div",{className:"stat-icon scans",children:(0,l.jsx)(o.KSO,{})}),(0,l.jsxs)("div",{className:"stat-content",children:[(0,l.jsx)("h3",{children:g.totalScans||0}),(0,l.jsx)("p",{children:"Total Scans Run"})]})]}),(0,l.jsxs)("div",{className:"stat-card glassmorphic hover-glow",children:[(0,l.jsx)("div",{className:"stat-icon threats",children:(0,l.jsx)(o.BS8,{})}),(0,l.jsxs)("div",{className:"stat-content",children:[(0,l.jsx)("h3",{children:g.totalThreats||0}),(0,l.jsx)("p",{children:"Exposures Found"})]})]}),(0,l.jsxs)("div",{className:"stat-card glassmorphic hover-glow",children:[(0,l.jsx)("div",{className:"stat-icon resolved",children:(0,l.jsx)(o.SMR,{})}),(0,l.jsxs)("div",{className:"stat-content",children:[(0,l.jsxs)("h3",{children:[w.resolutionRate||100,"%"]}),(0,l.jsx)("p",{children:"Threat Resolution"})]})]})]}),(0,l.jsxs)("div",{className:"stats-breakdown-card glassmorphic",children:[(0,l.jsx)("h3",{children:"User Distribution Breakdown"}),(0,l.jsx)("p",{className:"breakdown-subtitle",children:"Distribution of paid active subscriptions, active trials, and free tier accounts."}),(()=>{const e=g.totalUsers||1,s=Math.round((g.premiumUsers||0)/e*100),a=Math.round((g.trialUsers||0)/e*100),t=Math.max(0,100-s-a);return(0,l.jsxs)("div",{className:"distribution-wrapper",children:[(0,l.jsxs)("div",{className:"segmented-bar",children:[(0,l.jsx)("div",{className:"bar-segment paid",style:{width:`${s}%`},title:`Paid: ${s}%`}),(0,l.jsx)("div",{className:"bar-segment trial",style:{width:`${a}%`},title:`Trial: ${a}%`}),(0,l.jsx)("div",{className:"bar-segment free",style:{width:`${t}%`},title:`Free: ${t}%`})]}),(0,l.jsxs)("div",{className:"segmented-legend",children:[(0,l.jsxs)("div",{className:"legend-item",children:[(0,l.jsx)("span",{className:"legend-dot paid"})," Paid Active (",g.premiumUsers||0,")"]}),(0,l.jsxs)("div",{className:"legend-item",children:[(0,l.jsx)("span",{className:"legend-dot trial"})," Free Trial (",g.trialUsers||0,")"]}),(0,l.jsxs)("div",{className:"legend-item",children:[(0,l.jsx)("span",{className:"legend-dot free"})," Free Tier (",g.freeUsers||0,")"]})]})]})})()]}),(0,l.jsxs)("div",{className:"growth-chart-card glassmorphic",children:[(0,l.jsxs)("div",{className:"chart-header",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{children:"User Registrations Growth"}),(0,l.jsx)("p",{className:"chart-subtitle",children:"Chronological new user sign-ups over the last 30 days"})]}),(0,l.jsxs)("div",{className:"chart-summary",children:[(0,l.jsxs)("span",{className:"summary-trend",children:["+",(g.growthStats||[]).reduce((e,s)=>e+s.count,0)," users"]}),(0,l.jsx)("span",{className:"summary-label",children:"Past 30 Days"})]})]}),(0,l.jsx)("div",{className:"svg-chart-container",children:(()=>{const e=g.growthStats||[];if(0===e.length)return(0,l.jsx)("div",{className:"chart-empty font-code",children:"NO TIMELINE LOGS REGISTERED YET"});const s=Math.max(...e.map(e=>e.count),5),a=30,t=e.map((a,t)=>({x:40+t/(e.length-1||1)*640,y:210-a.count/s*180,date:a.date,count:a.count})),i=t.map((e,s)=>`${0===s?"M":"L"} ${e.x} ${e.y}`).join(" "),n=t.length>0?`${i} L ${t[t.length-1].x} 210 L ${t[0].x} 210 Z`:"",r=Math.ceil(e.length/5);return(0,l.jsxs)("svg",{viewBox:"0 0 720 240",width:"100%",height:"100%",children:[(0,l.jsxs)("defs",{children:[(0,l.jsxs)("linearGradient",{id:"lineGlow",x1:"0",y1:"0",x2:"1",y2:"0",children:[(0,l.jsx)("stop",{offset:"0%",stopColor:"#42ffb5"}),(0,l.jsx)("stop",{offset:"100%",stopColor:"#00d4aa"})]}),(0,l.jsxs)("linearGradient",{id:"areaFade",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,l.jsx)("stop",{offset:"0%",stopColor:"#42ffb5",stopOpacity:"0.25"}),(0,l.jsx)("stop",{offset:"100%",stopColor:"#42ffb5",stopOpacity:"0.0"})]})]}),[0,.25,.5,.75,1].map((e,t)=>{const i=a+180*e,n=Math.round(s-e*s);return(0,l.jsxs)("g",{children:[(0,l.jsx)("line",{x1:40,y1:i,x2:680,y2:i,stroke:"rgba(255,255,255,0.06)",strokeDasharray:"3 3"}),(0,l.jsx)("text",{x:30,y:i+4,fill:"#6b7280",fontSize:"10",textAnchor:"end",className:"font-code",children:n})]},t)}),t.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("path",{d:n,fill:"url(#areaFade)"}
1),(0,l.jsx)("path",{d:i,fill:"none",stroke:"url(#lineGlow)",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),t.map((e,s)=>(0,l.jsxs)("g",{className:"chart-node-group",children:[(0,l.jsx)("circle",{cx:e.x,cy:e.y,r:"5",fill:"#1f293d",stroke:"#42ffb5",strokeWidth:"2.5"}),e.count>0&&(0,l.jsx)("text",{x:e.x,y:e.y-10,fill:"#ffffff",fontSize:"10",textAnchor:"middle",fontWeight:"bold",className:"font-code node-label-pop",children:e.count})]},s)),t.map((e,s)=>{if(s%r!==0&&s!==t.length-1)return null;const a=e.date.slice(5);return(0,l.jsx)("text",{x:e.x,y:230,fill:"#6b7280",fontSize:"10",textAnchor:"middle",className:"font-code",children:a},s)})]})})()})]}),(0,l.jsxs)("div",{className:"telemetry-board-card glassmorphic",children:[(0,l.jsxs)("div",{className:"board-header",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{children:"Page Search Telemetry Hub"}),(0,l.jsx)("p",{className:"board-subtitle",children:"Live counters tracking real-time search activities across different scan tools"})]}),(0,l.jsxs)("div",{className:"live-telemetry-badge",children:[(0,l.jsx)("span",{className:"ping-dot"}),(0,l.jsx)("span",{className:"badge-text font-code",children:"LIVE FEED"})]})]}),(()=>{const e=g.searchStats||{},s=Object.values(e).reduce((e,s)=>e+s,0),a=[{key:"email_scan",label:"Email Breach Checks",icon:(0,l.jsx)(o.jNV,{}),color:"#3b82f6",desc:"HIBP database searches on /email-scan or /data-leak"},{key:"data_broker_scan",label:"Data Broker Scans",icon:(0,l.jsx)(o.SMR,{}),color:"#42ffb5",desc:"Data broker scanning tools on /scanning page"},{key:"password_check",label:"Password Exposure Checks",icon:(0,l.jsx)(o.Pcn,{}),color:"#f59e0b",desc:"Password strength and breach scans on /password-check"},{key:"phone_lookup",label:"Reverse Phone Lookups",icon:(0,l.jsx)(o.KSO,{}),color:"#8b5cf6",desc:"Dynamic owner search activities on /phone-lookup"},{key:"website_scan",label:"Website Security Scans",icon:(0,l.jsx)(o.vwk,{}),color:"#ec4899",desc:"Malware & phishing scans on /website-scanner"},{key:"employability_scan",label:"Employability ATS Checks",icon:(0,l.jsx)(o.y8Q,{}),color:"#10b981",desc:"Resume ATS format gaps checking on /employability-scan"},{key:"file_scan",label:"Cryptographic File Scans",icon:(0,l.jsx)(o.Ny1,{}),color:"#a855f7",desc:"Byte forensic analysis scans on /file-scan"}];return(0,l.jsxs)("div",{className:"telemetry-wrapper",children:[(0,l.jsx)("div",{className:"telemetry-grid",children:a.map((a,t)=>{const i=e[a.key]||0,n=s>0?Math.round(i/s*100):0;return(0,l.jsxs)("div",{className:"telemetry-item-card",style:{"--accent-color":a.color},children:[(0,l.jsxs)("div",{className:"item-left",children:[(0,l.jsx)("div",{className:"item-icon",style:{backgroundColor:`rgba(${parseInt(a.color.slice(1,3),16)}, ${parseInt(a.color.slice(3,5),16)}, ${parseInt(a.color.slice(5,7),16)}, 0.15)`,color:a.color},children:a.icon}),(0,l.jsxs)("div",{className:"item-meta",children:[(0,l.jsx)("h4",{children:a.label}),(0,l.jsx)("p",{children:a.desc})]})]}),(0,l.jsxs)("div",{className:"item-right",children:[(0,l.jsx)("div",{className:"item-counter",children:i.toLocaleString()}),(0,l.jsxs)("div",{className:"item-share font-code",children:[n,"% Share"]})]})]},t)})}),(0,l.jsxs)("div",{className:"telemetry-summary-footer",children:[(0,l.jsx)("span",{className:"footer-label font-code",children:"TOTAL SEARCH VOLUME IN SYSTEM"}),(0,l.jsxs)("span",{className:"footer-value font-code",children:[s.toLocaleString()," SEARCHES"]})]})]})})()]}),(0,l.jsxs)("div",{className:"quick-actions",children:[(0,l.jsx)("h3",{children:"Quick Actions"}),(0,l.jsxs)("div",{className:"action-buttons",children:[(0,l.jsxs)("button",{className:"action-btn primary",onClick:async()=>{try{const e=await r.default.post("/admin/auto-scan/trigger");e.data.success&&(alert(`Bulk scan triggered for ${e.data.data.userCount} users`),await q())}catch(A){console.error("Error triggering bulk scan:",A),E("Failed to trigger bulk scan")}},children:[(0,l.jsx)(o.y8Q,{})," Trigger Bulk Scan"]}),(0,l.jsxs)("button",{className:"action-btn secondary",onClick:()=>s("/admin/threats"),children:[(0,l.jsx)(o.BS8,{})," Manage Threats"]}),(0,l.jsxs)("button",{className:"action-btn secondary",onClick:()=>s("/admin/monitoring"),children:[(0,l.jsx)(o.vwk,{})," System Monitor"]}),(0,l.jsxs)("button",{className:"action-btn secondary",onClick:q,children:[(0,l.jsx)(o.Ny1,{})," Refresh Data"]})]})]})]}),"users"===u&&(0,l.jsxs)("div",{className:"users-tab",children:[(0,l.jsxs)("div",{className:"users-header",children:[(0,l.jsx)("h3",{children:"Recent Users"}),(0,l.jsxs)("div",{className:"users-actions",children:[(0,l.jsxs)("button",{className:"btn-primary",onClick:()=>s("/admin/users"),children:[(0,l.jsx)(o.YXz,{})," Manage All Users"]}),(0,l.jsx)("button",{className:"btn-secondary",onClick:q,children:"Refresh"})]})]}),(0,l.jsx)("div",{className:"users-table",children:(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:"User"}),(0,l.jsx)("th",{children:"Email"}),(0,l.jsx)("th",{children:"Role"}),(0,l.jsx)("th",{children:"Subscription"}),(0,l.jsx)("th",{children:"Status"}),(0,l.jsx)("th",{children:"Actions"})]})}),(0,l.jsx)("tbody",{children:f.map(e=>(0,l.jsxs)("tr",{children:[(0,l.jsx)("td",{children:(0,l.jsxs)("div",{className:"user-info",children:[(0,l.jsxs)("strong",{children:[e.firstName," ",e.lastName]}),(0,l.jsxs)("small",{children:["ID: ",e.id.slice(0,8),"..."]})]})}),(0,l.jsx)("td",{children:e.email}),(0,l.jsx)("td",{children:(0,l.jsx)("span",{className:`role-badge ${e.role.toLowerCase()}`,children:e.role})}),(0,l.jsx)("td",{children:(0,l.jsx)("span",{className:`subscription-badge ${e.subscription_status.toLowerCase()}`,children:e.subscription_status})}),(0,l.jsx)("td",{children:(0,l.jsx)("span",{className:"status-badge "+(e.isActive?"active":"inactive"),children:e.isActive?"Active":"Inactive"})}),(0,l.jsx)("td",{children:(0,l.jsx)("div",{className:"user-actions",children:(0,l.jsx)("button",{className:"action-btn-small",onClick:()=>(async e=>{try{(await r.default.post(`/admin/scan/${e}`)).data.success&&(alert("Broker scan queued for user"),await q())}catch(A){console.error("Error queueing scan:",A),E("Failed to queue scan")}})(e.id),title:"Simulate Scan",children:(0,l.jsx)(o.KSO,{})})})})]},e.id))})]})})]}),"funnel"===u&&(0,l.jsxs)("div",{className:"funnel-tab",style:{padding:"8px 4px"},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{style:{margin:0},children:"Conversion Funnel"}),(0,l.jsx)("p",{style:{margin:"4px 0 0",color:"rgba(255,255,255,0.5)",fontSize:"0.85rem"},children:D?`Last ${D.days} days \xb7 ${D.totalEvents} events`:"scan \u2192 results \u2192 pricing \u2192 checkout \u2192 purchase"})]}),(0,l.jsx)("button",{className:"queue-btn pause",onClick:z,disabled:U,children:U?"Loa
1ding\u2026":"Refresh"})]}),U&&(0,l.jsx)("p",{style:{color:"rgba(255,255,255,0.5)"},children:"Loading funnel\u2026"}),!U&&D&&D.steps&&(0,l.jsxs)("div",{className:"funnel-steps",children:[D.steps.map((e,s)=>{var a;const t=(null===(a=D.steps[0])||void 0===a?void 0:a.count)||0,i=t>0?Math.max(6,Math.round(e.count/t*100)):6,n=["#06b6d4","#22c55e","#eab308","#f97316","#a855f7"];return(0,l.jsxs)("div",{style:{marginBottom:12},children:[(0,l.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.85rem",marginBottom:4},children:[(0,l.jsx)("span",{style:{color:"#fff",fontWeight:600},children:e.label}),(0,l.jsxs)("span",{style:{color:"rgba(255,255,255,0.6)"},children:[e.count.toLocaleString(),s>0&&null!=e.fromPrevPct&&(0,l.jsxs)("span",{style:{color:e.fromPrevPct>=50?"#22c55e":e.fromPrevPct>=20?"#eab308":"#ef4444",marginLeft:8},children:[e.fromPrevPct,"% from prev"]})]})]}),(0,l.jsx)("div",{style:{background:"rgba(255,255,255,0.08)",borderRadius:6,height:26,overflow:"hidden"},children:(0,l.jsx)("div",{style:{width:`${i}%`,height:"100%",background:n[s%n.length],borderRadius:6,transition:"width 0.4s"}})})]},e.step)}),(0,l.jsxs)("div",{style:{marginTop:16,padding:"12px 16px",background:"rgba(34,197,94,0.1)",borderRadius:8,border:"1px solid rgba(34,197,94,0.25)"},children:[(0,l.jsx)("span",{style:{color:"rgba(255,255,255,0.7)"},children:"Overall scan \u2192 purchase: "}),(0,l.jsx)("strong",{style:{color:"#22c55e",fontSize:"1.1rem"},children:null!=D.overallConversionPct?`${D.overallConversionPct}%`:"\u2014"})]})]}),!U&&D&&(!D.steps||0===(null===(e=D.steps[0])||void 0===e?void 0:e.count))&&(0,l.jsx)("p",{style:{color:"rgba(255,255,255,0.5)"},children:"No funnel data yet. Once visitors run scans, steps will appear here."})]}),"scans"===u&&(0,l.jsx)("div",{className:"scans-tab",children:(0,l.jsx)(c,{})}),"system"===u&&(0,l.jsx)("div",{className:"system-tab",children:(0,l.jsxs)("div",{className:"system-info",children:[(0,l.jsx)("h3",{children:"System Information"}),(0,l.jsxs)("div",{className:"info-grid",children:[(0,l.jsxs)("div",{className:"info-item",children:[(0,l.jsx)("span",{className:"info-label",children:"Environment"}),(0,l.jsx)("span",{className:"info-value",children:"production"})]}),(0,l.jsxs)("div",{className:"info-item",children:[(0,l.jsx)("span",{className:"info-label",children:"System Load"}),(0,l.jsx)("span",{className:"info-value",children:y.systemLoad||"N/A"})]}),(0,l.jsxs)("div",{className:"info-item",children:[(0,l.jsx)("span",{className:"info-label",children:"Database Connections"}),(0,l.jsx)("span",{className:"info-value",children:y.databaseConnections||0})]})]})]})}),"queues"===u&&(0,l.jsxs)("div",{className:"queues-tab",children:[(0,l.jsxs)("div",{className:"queues-header",children:[(0,l.jsx)("h3",{children:"Queue Management"}),(0,l.jsx)("button",{className:"btn-secondary",onClick:q,children:"Refresh"})]}),Object.entries(k).map(e=>{let[s,a]=e;return(0,l.jsxs)("div",{className:"queue-card",children:[(0,l.jsxs)("div",{className:"queue-header",children:[(0,l.jsx)("h4",{children:s}),(0,l.jsxs)("div",{className:"queue-actions",children:[(0,l.jsxs)("button",{className:"queue-btn pause",onClick:()=>O(s,"pause"),children:[(0,l.jsx)(o.kwt,{})," Pause"]}),(0,l.jsxs)("button",{className:"queue-btn resume",onClick:()=>O(s,"resume"),children:[(0,l.jsx)(o.gSK,{})," Resume"]}),(0,l.jsxs)("button",{className:"queue-btn clean",onClick:()=>O(s,"clean"),children:[(0,l.jsx)(o.qbC,{})," Clean"]})]})]}),(0,l.jsxs)("div",{className:"queue-stats",children:[(0,l.jsxs)("div",{className:"queue-stat",children:[(0,l.jsx)("span",{className:"stat-label",children:"Waiting"}),(0,l.jsx)("span",{className:"stat-value",children:(null===a||void 0===a?void 0:a.waiting)||0})]}),(0,l.jsxs)("div",{className:"queue-stat",children:[(0,l.jsx)("span",{className:"stat-label",children:"Active"}),(0,l.jsx)("span",{className:"stat-value",children:(null===a||void 0===a?void 0:a.active)||0})]}),(0,l.jsxs)("div",{className:"queue-stat",children:[(0,l.jsx)("span",{className:"stat-label",children:"Completed"}),(0,l.jsx)("span",{className:"stat-value",children:(null===a||void 0===a?void 0:a.completed)||0})]}),(0,l.jsxs)("div",{className:"queue-stat",children:[(0,l.jsx)("span",{className:"stat-label",children:"Failed"}),(0,l.jsx)("span",{className:"stat-value",children:(null===a||void 0===a?void 0:a.failed)||0})]})]})]},s)})]}),"removals"===u&&(0,l.jsxs)("div",{className:"removals-tab",children:[(0,l.jsxs)("div",{className:"removals-header",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{style:{margin:0,color:"#fff"},children:"Manual Removal Queue"}),(0,l.jsxs)("p",{style:{margin:"4px 0 0",color:"rgba(255,255,255,0.5)",fontSize:"0.85rem"},children:[I.length," site",1!==I.length?"s":""," need manual opt-out across paid users. Marking removed sends a confirmation email automatically."]})]}),(0,l.jsx)("button",{className:"queue-btn pause",onClick:B,disabled:M,children:M?"Loading\u2026":"Refresh"})]}),M&&(0,l.jsx)("div",{style:{textAlign:"center",padding:"40px",color:"rgba(255,255,255,0.4)"},children:"Loading queue\u2026"}),!M&&0===I.length&&(0,l.jsxs)("div",{style:{textAlign:"center",padding:"60px 20px",color:"rgba(255,255,255,0.4)"},children:[(0,l.jsx)(o.A7C,{style:{fontSize:"2.5rem",marginBottom:"12px",color:"#10b981"}}),(0,l.jsx)("p",{children:"All caught up \u2014 no pending removals."})]}),!M&&I.length>0&&(0,l.jsx)("div",{className:"removals-list",children:I.map(e=>{var s,a;const t=`${e.userId}-${e.findingId}`,i=F===t,n=F===`clear-${e.userId}`,c={critical:"#ef4444",high:"#f97316",medium:"#f59e0b",low:"#10b981"}[e.severity]||"#f59e0b";return(0,l.jsxs)("div",{className:"stat-card glassmorphic",style:{display:"flex",alignItems:"center",gap:"16px",padding:"16px 20px",marginBottom:"10px"},children:[(0,l.jsx)("img",{src:`https://www.google.com/s2/favicons?domain=${e.brokerDomain}&sz=32`,alt:"",style:{width:24,height:24,borderRadius:4},onError:e=>{e.target.style.display="none"}}),(0,l.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,l.jsx)("div",{style:{fontWeight:600,color:"#fff",fontSize:"0.9rem"},children:e.brokerName}),(0,l.jsxs)("div",{style:{fontSize:"0.78rem",color:"rgba(255,255,255,0.45)",marginTop:2},children:[e.userFirstName," ",e.userLastName," \u2022 ",e.userEmail]}),e.matchedFields.length>0&&(0,l.jsx)("div",{style:{fontSize:"0.75rem",color:"rgba(255,255,255,0.35)",marginTop:2},children:e.matchedFields.join(", ")}),e.removal&&(0,l.jsxs)("div",{style:{fontSize:"0.72rem",color:"#60a5fa",marginTop:3},title:e.removal.instructions||"",children:["Removal: ",e.removal.method,e.removal.removalEmail?` \xb7 ${e.removal.removalEmail}`:"",e.removal.requiresEmailConfirm?" \xb7 email-confirm":"",e.removal.captcha?" \xb7 CAPTCHA":""]})]}),(0,l.jsx)("span",{style:{fontSize:"0.72rem",fontWeight:600,color:c,textTransform:"uppercase",letterSpacing:"0.5px"},children:e.severity}),e.optOutUrl&&(0,l.jsxs)("a",{href:e.optOutUrl,target:"_blank",rel:"noopener noreferrer",className:"queue-btn pause",style:{textDecoration:"none",display:"flex",alignItems:"center",gap:6,fontSize:"0.8rem"},children:["Opt-Out Page ",(0,l.jsx)(o.EQc,{size:10})]}),(0,l.jsxs)("button",{className:"queue-btn clean",onClick:()=>(async e=>{const s=`${e.userId}-${e.findingId}`;try{$(s),await r.default.post("/admin/removals/execute",{userId:e.userId,scanId:e.scanId,findingId:e.findingId,brokerName:e.brokerName,brokerDomain:e.brokerDomain,optOutUrl:e.optOutUrl,userEmail:e.userEmail,userFirstName:e.userFirstName,target:{firstName:e.userFirstName,lastName:e.userLastName}}),R(s=>s.filter(s=>!(s.userId===e.userId&&s.findingId===e.findingId)))}catch(a){console.error("Error auto-processing removal:",a),E("Failed to auto-process removal")}finally{$(null)}})(e),disabled:i||n,style:{minWidth:120},title:"email"===(null===(s=e.removal)||void 0===s?void 0:s.method)?`Auto-send the opt-out to ${e.removal.removalEmail||"the broker"} and notify the customer`:"Mark processed and email the customer a confirmation",children:[(0,l.jsx)(o.A7C,{})," ",i?"Processing\u2026":"email"===(null===(a=e.removal)||void 0===a?void 0:a.method)?"Auto-Send":"Process & Notify"]}),(0,l.jsx)("button",{className:"queue-btn pause",onClick:()=>(async e=>{const s=`${e.userId}-${e.findingId}`;try{$(s),await r.default.post("/admin/removals/mark-removed",{userId:e.userId,scanId:e.scanId,findingId:e.findingId,brokerName:e.brokerName,userEmail:e.userEmail,userFirstName:e.userFirstName}),R(s=>s.filter(s=>!(s.userId===e.userId&&s.findingId===e.findingId)))}catch(a){console.error("Error marking as removed:",a),E("Failed to mark as removed")}finally{$(null)}})(e),disabled:i||n,style:{minWidth:96},title:"Just mark removed (no broker email)",children:"Mark Removed"}),(0,l.jsx)("button",{className:"queue-btn pause",onClick:()=>(async e=>{if(!window.confirm(`Clear ALL threats for ${e.userEmail}?\n\nThis deletes their scan findings and resets their dashboard counters. This cannot be undone.`))return;const s=`clear-${e.userId}`;try{$(s),await r.default.post(`/admin/users/${e.userId}/clear-threats`),R(s=>s.filter(s=>
1s.userId!==e.userId))}catch(a){console.error("Error clearing user threats:",a),E("Failed to clear user threats")}finally{$(null)}})(e),disabled:n||i,style:{minWidth:96},title:"Delete ALL of this user's threats and reset their dashboard",children:n?"Clearing\u2026":"Clear User"})]},t)})})]})]})]})}},9311:(e,s,a)=>{a.r(s),a.d(s,{default:()=>o});var t=a(9246),i=a(105),n=a(5552),r=a(5835);const l=(0,i.e9)("/api/v1"),c=t.A.create({baseURL:l,headers:{"Content-Type":"application/json"},withCredentials:!0});c.interceptors.request.use(async e=>{try{let s=null;if(s=await n.A.getToken(),s||(s=r.Ay.getToken()||localStorage.getItem("token")||localStorage.getItem("authToken")||localStorage.getItem("firebaseToken")||localStorage.getItem("idToken")||sessionStorage.getItem("token")),!s){const e=localStorage.getItem("userEmail")||localStorage.getItem("scanEmail")||sessionStorage.getItem("userEmail");e&&(s=`guest_${btoa(JSON.stringify({email:e,ts:Date.now()}))}`,localStorage.setItem("token",s))}if(s){const a=`Bearer ${s}`;e.headers&&"function"===typeof e.headers.set?(e.headers.set("Authorization",a),e.headers.set("authorization",a)):e.headers&&(e.headers.Authorization=a,e.headers.authorization=a)}else console.warn("[ApiService] No authorization token found for request:",e.url)}catch(s){console.warn("[ApiService] Failed to get auth token:",s)}return e},e=>Promise.reject(e)),c.interceptors.response.use(e=>e,async e=>{var s,a;const t=e.config;if(t._retry)return Promise.reject(e);if(429===(null===(s=e.response)||void 0===s?void 0:s.status))return console.warn("[ApiService] Rate limit exceeded (429). slowing down requests."),Promise.reject(e);if(401===(null===(a=e.response)||void 0===a?void 0:a.status)){var i;t._retry=!0;try{{const e=await n.A.getToken(!0);if(e)return t.headers.Authorization=`Bearer ${e}`,c.request(t)}}catch(r){console.error("[ApiService] Auth refresh failed:",r)}return console.error("[ApiService] \ud83d\udea8 401 UNAUTHORIZED for:",null===(i=e.config)||void 0===i?void 0:i.url),Promise.reject(e)}return Promise.reject(e)});const o=c}}]);
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.