1import{ah as z,r,j as e,S as Q,ac as O,a as c,e as P,a8 as G,C as S,o as C,p as _,q as w,B as h,b as A,H}from"./index-utzdZf0y.js";const j="w-full rounded border border-border-default bg-bg-base px-3 py-2 text-sm text-text-primary";function ne(){const a=z().includes("platform-admin"),[l,u]=r.useState("operations");return e.jsxs(e.Fragment,{children:[e.jsx(Q,{title:"Platform operations",noindex:!0}),e.jsxs("div",{className:"mx-auto max-w-6xl space-y-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-text-primary",children:"Admin console"}),e.jsx("p",{className:"mt-1 text-text-secondary",children:a?"Platform super-admin: operations, users, and configuration.":"Platform operations."})]}),a&&e.jsx(O,{variant:"pill",active:l,onChange:v=>u(v),tabs:[{id:"operations",label:"operations"},{id:"infrastructure",label:"Infrastructure & Cost"},{id:"users",label:"users"},{id:"platform",label:"Platform config"},{id:"community",label:"Community exchange"}]})]}),!a||l==="operations"?e.jsx(V,{}):l==="infrastructure"?e.jsx(W,{}):l==="users"?e.jsx(K,{}):l==="community"?e.jsx(se,{}):e.jsx(Y,{})]})]})}function V(){var M,T,D,F;const[a,l]=r.useState(null),[u,v]=r.useState(null),[x,f]=r.useState(null),[o,m]=r.useState(null),[d,N]=r.useState(null),[g,i]=r.useState(null),[s,b]=r.useState(""),[n,U]=r.useState(""),R=r.useCallback(async()=>{const[t,p,k]=await Promise.allSettled([c.adminAnalysisStatus(),c.adminSources(),c.adminQuarantine()]);t.status==="fulfilled"?(l(t.value),m(null)):m(P(t.reason,"Could not load analysis operations.")),p.status==="fulfilled"?(v(p.value.sources),N(null)):(v([]),N("Source-ingest controls are unavailable in this deployment.")),f(k.status==="fulfilled"?k.value.items:[])},[]);G(R,5e3);const $=async(t,p)=>{i(t);try{await p(),await R()}catch(k){m(P(k))}finally{i(null)}};return e.jsxs("div",{className:"space-y-6",children:[o&&e.jsx("p",{className:"rounded border border-status-danger/30 bg-status-danger/10 p-3 text-sm text-status-danger",children:o}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-4",children:[e.jsx(I,{label:"Queued",value:a==null?void 0:a.queued}),e.jsx(I,{label:"Guests in use",value:a?Z(a):void 0,hint:a?ee(a):void 0}),e.jsx(I,{label:"Analyses in flight",value:a?((M=a.inFlight)==null?void 0:M.max)!=null?`${a.inFlight.count}/${a.inFlight.max}`:String(((T=a.inFlight)==null?void 0:T.count)??a.running):void 0,hint:"Dynamic stage; exceeds guests in use by design"}),e.jsx(I,{label:"Spend today",value:(a==null?void 0:a.fleet.spendTodayUsd)!==void 0?`$${a.fleet.spendTodayUsd.toFixed(2)}`:void 0})]}),(F=(D=a==null?void 0:a.guests)==null?void 0:D.tiers)!=null&&F.length?e.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-text-muted",children:a.guests.tiers.map(t=>e.jsxs("span",{children:[t.label,":"," ",e.jsx("span",{className:"text-text-secondary",children:t.busy===null?"not measured":t.capacity===null?`${t.busy} busy`:`${t.busy}/${t.capacity}`}),t.reason?` (${t.reason})`:""]},t.tier))}):null,e.jsxs(S,{children:[e.jsx(C,{children:e.jsx(_,{children:"Emergency controls"})}),e.jsxs(w,{className:"flex flex-wrap gap-2",children:[e.jsx(h,{variant:"secondary",loading:g==="pause",onClick:()=>void $("pause",c.adminPauseAnalysis),children:"Pause analysis admission"}),e.jsx(h,{variant:"secondary",loading:g==="resume",onClick:()=>void $("resume",c.adminResumeAnalysis),children:"Resume analysis"}),e.jsx("span",{className:"self-center text-xs text-text-muted",children:"Network and fleet kill switches are enforced through SSM within 15 seconds."}),e.jsxs("div",{className:"mt-3 flex w-full flex-wrap gap-2 border-t border-border-subtle pt-3",children:[e.jsx("input",{value:s,onChange:t=>b(t.target.value),placeholder:"Task ID to terminate",className:"min-w-64 flex-1 rounded border border-border-default bg-bg-base px-3 py-2 font-mono text-sm text-text-primary"}),e.jsx(h,{variant:"secondary",disabled:!s.trim(),loading:g==="cancel-task",onClick:()=>void $("cancel-task",()=>c.adminCancelTask(s.trim())),children:"Terminate task"})]}),e.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[e.jsx("input",{value:n,onChange:t=>U(t.target.value),placeholder:"SHA-256 to take down and deny",className:"min-w-64 flex-1 rounded border border-border-default bg-bg-base px-3 py-2 font-mono text-sm text-text-primary"}),e.jsx(h,{variant:"danger",disabled:!/^[a-fA-F0-9]{64}$/.test(n.trim()),loading:g==="takedown",onClick:()=>void $("takedown",()=>c.adminTakedown(n.trim())),children:"Takedown + legal hold"})]})]})]}),e.jsxs(S,{children:[e.jsx(C,{children:e.jsx(_,{children:"Public sources"})}),e.jsxs(w,{children:[d&&e.jsx("p",{className:"mb-3 text-sm text-text-muted",children:d}),u?u.length===0&&!d?e.jsx("p",{className:"text-sm text-text-muted",children:"No sources configured."}):e.jsx("div",{className:"space-y-2",children:u.map(t=>e.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded border border-border-subtle p-3",children:[e.jsxs("div",{className:"min-w-40",children:[e.jsx("div",{className:"font-medium text-text-primary",children:t.source}),e.jsx("div",{className:"text-xs text-text-muted",children:t.lastSuccessAt?`last success ${new Date(t.lastSuccessAt).toLocaleStr
1ing()}`:"not polled"})]}),e.jsx("span",{className:t.paused||!t.enabled?"text-verdict-suspicious":"text-verdict-clean",children:t.paused?"paused":t.enabled?"enabled":"disabled"}),e.jsxs("label",{className:"flex items-center gap-2 text-xs text-text-muted",children:["batch",e.jsx("input",{type:"number",min:1,max:1e3,value:t.maxItemsPerPoll,onChange:p=>{const k=Math.max(1,Math.min(1e3,Number(p.target.value)||1));v(E=>(E==null?void 0:E.map(B=>B.source===t.source?{...B,maxItemsPerPoll:k}:B))??null)},onBlur:()=>void $(`rate-${t.source}`,()=>c.adminUpdateSource(t.source,{maxItemsPerPoll:t.maxItemsPerPoll})),className:"w-20 rounded border border-border-default bg-bg-base px-2 py-1 text-text-primary"})]}),e.jsxs("div",{className:"ml-auto flex gap-2",children:[e.jsx(h,{size:"sm",variant:"secondary",loading:g===`toggle-${t.source}`,onClick:()=>void $(`toggle-${t.source}`,()=>c.adminUpdateSource(t.source,{paused:!t.paused})),children:t.paused?"Resume":"Pause"}),e.jsx(h,{size:"sm",variant:"ghost",loading:g===`poll-${t.source}`,onClick:()=>void $(`poll-${t.source}`,()=>c.adminPollSource(t.source)),children:"Poll now"})]}),t.lastError&&e.jsx("p",{className:"w-full text-xs text-status-danger",children:t.lastError})]},t.source))}):e.jsx(A,{className:"h-24"})]})]}),e.jsxs(S,{children:[e.jsx(C,{children:e.jsxs(_,{children:["Quarantine · ",(x==null?void 0:x.length)??0]})}),e.jsx(w,{children:x?x.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:"No quarantined source items."}):e.jsx("div",{className:"max-h-80 space-y-2 overflow-y-auto",children:x.map(t=>e.jsxs("div",{className:"rounded border border-border-subtle p-3 text-sm",children:[e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("span",{className:"font-mono text-text-primary",children:t.externalId}),e.jsx("span",{className:"text-text-muted",children:t.source})]}),e.jsx("p",{className:"mt-1 text-xs text-status-danger",children:t.reason}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(h,{size:"sm",variant:"ghost",onClick:()=>void $(`resolve-${t.id}`,()=>c.adminUpdateQuarantine(t.id,"resolved")),children:"Mark resolved"}),e.jsx(h,{size:"sm",variant:"ghost",onClick:()=>void $(`discard-${t.id}`,()=>c.adminUpdateQuarantine(t.id,"discarded")),children:"Discard"})]})]},t.id))}):e.jsx(A,{className:"h-24"})})]})]})}function K(){const[a,l]=r.useState(null),[u,v]=r.useState(""),[x,f]=r.useState(null),[o,m]=r.useState(null),[d,N]=r.useState({}),g=r.useCallback(async s=>{try{const b=await c.adminListUsers(s,200);l(H(b.data)),f(null)}catch(b){f(P(b)),l([])}},[]);r.useEffect(()=>{g("")},[g]);const i=async(s,b)=>{m(s);try{await b(),await g(u)}catch(n){f(P(n))}finally{m(null)}};return e.jsxs("div",{className:"space-y-4",children:[x&&e.jsx("p",{className:"rounded border border-status-danger/30 bg-status-danger/10 p-3 text-sm text-status-danger",children:x}),e.jsxs("form",{onSubmit:s=>{s.preventDefault(),g(u)},className:"flex gap-2",children:[e.jsx("input",{value:u,onChange:s=>v(s.target.value),placeholder:"Search by email, name, or user id",className:"flex-1 rounded border border-border-default bg-bg-base px-3 py-2 text-sm text-text-primary"}),e.jsx(h,{type:"submit",variant:"secondary",children:"Search"})]}),a?a.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:"No users found."}):e.jsx("div",{className:"space-y-2",children:a.map(s=>{var b;return e.jsxs("div",{className:"rounded border border-border-subtle p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"min-w-56 flex-1",children:[e.jsx("div",{className:"font-medium text-text-primary",children:s.email}),e.jsxs("div",{className:"text-xs text-text-muted",children:[s.displayName," · ",((b=s.orgs[0])==null?void 0:b.roles.join(", "))||"no role"," · ",s.apiKeys," keys",s.mfaEnabled?" · MFA":""]})]}),e.jsx("select",{value:s.status,disabled:o!==null,onChange:n=>void i(`status-${s.id}`,()=>c.adminUpdateUser(s.id,{status:n.target.value})),className:"rounded border border-border-default bg-bg-base px-2 py-1 text-sm text-text-primary",children:["active","suspended","locked","deactivated"].map(n=>e.jsx("option",{value:n,children:n},n))}
1),s.orgs[0]&&e.jsx("select",{value:s.orgs[0].roles[0]??"analyst",disabled:o!==null,onChange:n=>void i(`role-${s.id}`,()=>c.adminUpdateUser(s.id,{orgId:s.orgs[0].orgId,roles:[n.target.value]})),className:"rounded border border-border-default bg-bg-base px-2 py-1 text-sm text-text-primary",children:["owner","admin","analyst","read-only","billing"].map(n=>e.jsx("option",{value:n,children:n},n))})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 border-t border-border-subtle pt-2",children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-text-muted",children:["daily lookups",e.jsx("input",{type:"number",value:d[s.id]??s.dailyLookupQuota??"",placeholder:String(s.effectiveDailyLookupQuota),onChange:n=>N(U=>({...U,[s.id]:n.target.value})),className:"w-28 rounded border border-border-default bg-bg-base px-2 py-1 text-text-primary"})]}),e.jsx(h,{size:"sm",variant:"secondary",loading:o===`quota-${s.id}`,onClick:()=>{const n=d[s.id],U=n===void 0||n===""?null:Number(n);i(`quota-${s.id}`,()=>c.adminSetUserLimits(s.id,U))},children:"Set quota"}),e.jsxs("span",{className:"text-xs text-text-muted",children:["effective ",s.effectiveDailyLookupQuota<0?"â":s.effectiveDailyLookupQuota,"/day"]}),e.jsxs("div",{className:"ml-auto flex gap-2",children:[e.jsx(h,{size:"sm",variant:"ghost",loading:o===`keys-${s.id}`,onClick:()=>void i(`keys-${s.id}`,()=>c.adminRevokeKeys(s.id)),children:"Revoke keys"}),e.jsx(h,{size:"sm",variant:"ghost",loading:o===`ses-${s.id}`,onClick:()=>void i(`ses-${s.id}`,()=>c.adminRevokeSessions(s.id)),children:"Revoke sessions"}),e.jsx(h,{size:"sm",variant:"ghost",loading:o===`mfa-${s.id}`,onClick:()=>void i(`mfa-${s.id}`,()=>c.adminResetMfa(s.id)),children:"Reset MFA"})]})]})]},s.id)})}):e.jsx(A,{className:"h-40"})]})}const L=[{key:"detonationGuests",label:"Parallel detonations",help:"Concurrent live malware detonations (guest slots)."},{key:"detonationHosts",label:"Detonation hosts",help:"Bare-metal QEMU hosts (each is the big cost lever)."},{key:"analysisWorkers",label:"Analysis workers",help:"SQS consumers - processing speed."},{key:"apiTasks",label:"API tasks",help:"Front-of-house API/SPA task count."},{key:"openSearchNodes",label:"Search nodes",help:"OpenSearch data nodes - search backend infra."},{key:"redisNodes",label:"Cache nodes",help:"Redis metering/cache tier."}];function W(){const[a,l]=r.useState(null),[u,v]=r.useState(null),[x,f]=r.useState(null),[o,m]=r.useState({}),[d,N]=r.useState(null),[g,i]=r.useState(null),[s,b]=r.useState(!1),[n,U]=r.useState(!1),R=r.useCallback(async()=>{try{const t=await c.adminScalingState();l(t.config),v(t.cost),f(t.state),i(null)}catch(t){i(P(t))}},[]);r.useEffect(()=>{R();const t=setInterval(()=>void R(),1e4);return()=>clearInterval(t)},[R]);const $=r.useCallback(()=>{const t={};for(const p of L){const k=o[p.key];k!==void 0&&(t[p.key]={desired:k})}return o.dailyBudgetUsd!==void 0&&(t.dailyBudgetUsd=o.dailyBudgetUsd),o.monthlyBudgetUsd!==void 0&&(t.monthlyBudgetUsd=o.monthlyBudgetUsd),o.autoScaleEnabled!==void 0&&(t.autoScaleEnabled=o.autoScaleEnabled===1),t},[o]);r.useEffect(()=>{if(Object.keys(o).length===0){N(null);return}let t=!1;const p=setTimeout(()=>{c.adminScalingPreview($()).then(k=>{t||N(k)}).catch(()=>{t||N(null)})},400);return()=>{t=!0,clearTimeout(p)}},[o,$]);const M=async()=>{b(!0),U(!1),i(null);try{const t=await c.adminApplyScaling($());l(t.config),v(t.cost),m({}),N(null),U(!0),await R()}catch(t){i(P(t))}finally{b(!1)}};if(g&&(!a||!u))return e.jsx(q,{error:g,onRetry:()=>void R()});if(!a||!u)return e.jsx(A,{className:"h-64"});const T=(d==null?void 0:d.proposed)??u,D=o.autoScaleEnabled!==void 0?o.autoScaleEnabled===1:a.autoScaleEnabled,F=o.dailyBudgetUsd??a.dailyBudgetUsd;return e.jsxs("div",{className:"space-y-4",children:[g&&e.jsx("p",{className:"rounded border border-status-danger/30 bg-status-danger/10 p-3 text-sm text-status-danger",children:g}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-4",children:[e.jsx(I,{label:"Run-rate /mo",value:`$${T.monthlyUsd.toLocaleString()}`}),e.jsx(I,{label:"Run-rate /day",value:`$${T.dailyUsd.toLocaleStr
1ing()}`}),e.jsx(I,{label:"Daily budget",value:`$${F.toLocaleString()}`}),e.jsx(I,{label:"Auto-scale",value:D?"ON":"OFF"})]}),e.jsxs(S,{children:[e.jsx(C,{children:e.jsx(_,{children:"Cost breakdown (estimate)"})}),e.jsx(w,{className:"space-y-1",children:T.lines.map(t=>e.jsxs("div",{className:"flex justify-between border-b border-border-subtle py-1 text-sm last:border-0",children:[e.jsx("span",{className:"text-text-secondary",children:t.label}),e.jsxs("span",{className:"font-mono text-text-primary",children:["$",t.monthlyUsd.toLocaleString(),"/mo"]})]},t.label))})]}),(x==null?void 0:x.elastic)&&e.jsx(J,{elastic:x.elastic}),e.jsxs(S,{children:[e.jsx(C,{children:e.jsx(_,{children:"Scale the platform"})}),e.jsxs(w,{className:"space-y-3",children:[L.map(t=>{const p=a[t.key],k=o[t.key]??p.desired;return e.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded border border-border-subtle p-3",children:[e.jsxs("div",{className:"min-w-52 flex-1",children:[e.jsx("div",{className:"font-medium text-text-primary",children:t.label}),e.jsxs("div",{className:"text-xs text-text-muted",children:[t.help," (min ",p.min,", max ",p.max,")"]})]}),e.jsx("input",{type:"range",min:p.min,max:p.max,value:k,onChange:E=>m(B=>({...B,[t.key]:Number(E.target.value)})),className:"w-40"}),e.jsx("input",{type:"number",min:p.min,max:p.max,value:k,onChange:E=>m(B=>({...B,[t.key]:Number(E.target.value)})),className:"w-24 rounded border border-border-default bg-bg-base px-2 py-1 text-sm text-text-primary"})]},t.key)}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-sm text-text-secondary",children:"Daily budget ceiling ($)"}),e.jsx("input",{type:"number",value:o.dailyBudgetUsd??a.dailyBudgetUsd,onChange:t=>m(p=>({...p,dailyBudgetUsd:Number(t.target.value)})),className:`mt-1 ${j}`})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-sm text-text-secondary",children:"Monthly budget ceiling ($)"}),e.jsx("input",{type:"number",value:o.monthlyBudgetUsd??a.monthlyBudgetUsd,onChange:t=>m(p=>({...p,monthlyBudgetUsd:Number(t.target.value)})),className:`mt-1 ${j}`})]})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-secondary",children:[e.jsx("input",{type:"checkbox",checked:D,onChange:t=>m(p=>({...p,autoScaleEnabled:t.target.checked?1:0}))}),"Auto-scale (platform grows/shrinks itself within these min/max bounds and the budget ceiling)"]}),d&&e.jsxs("div",{className:`rounded border p-3 text-sm ${d.withinDailyBudget&&d.withinMonthlyBudget?"border-accent-500/40 bg-accent-500/10":"border-status-danger/40 bg-status-danger/10"}`,children:["Projected change: ",e.jsxs("span",{className:"font-mono",children:[d.deltaMonthlyUsd>=0?"+":"","$",d.deltaMonthlyUsd.toLocaleString(),"/mo"]})," ","(",e.jsxs("span",{className:"font-mono",children:[d.deltaDailyUsd>=0?"+":"","$",d.deltaDailyUsd.toLocaleString(),"/day"]}),") â new run-rate $",d.proposed.monthlyUsd.toLocaleString(),"/mo.",d.budgetMessage&&e.jsx("div",{className:"mt-1 text-status-danger",children:d.budgetMessage})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(h,{loading:s,disabled:Object.keys(o).length===0||!!d&&(!d.withinDailyBudget||!d.withinMonthlyBudget),onClick:()=>void M(),children:"Apply & scale"}),n&&e.jsx("span",{className:"text-sm text-verdict-clean",children:"Applied. Reconciling within ~30s."}),e.jsx("span",{className:"text-xs text-text-muted",children:"Changes take effect live; detonation caps within ~30s, infra within a few minutes."})]})]})]})]})}function J({elastic:a}){const l=a.lifecycleState==="active"||a.lifecycleState==="draining"?"text-verdict-clean":a.lifecycleState==="stopped"?"text-text-muted":"text-verdict-suspicious",u=v=>v?new Date(v).toLocaleString():"none";return e.jsxs(S,{children:[e.jsx(C,{children:e.jsx(_,{children:"Elastic detonation host (pay-per-use)"})}),e.jsxs(w,{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:[e.jsx("span",{className:`font-semibold capitalize ${l}`,children:a.lifecycleState.replace("_"," ")}),e.jsxs("span",{className:"text-text-muted",children:["EC2: ",a.ec2State]}),e.jsxs("span",{className:a.enabled?"text-verdict-clean":"text-text-muted",children:["lifecycle ",a.enabled?"ENABLED":"OFF"]}),a.allowOverBudget&&e.jsx("span",{className:"text-verdict-suspicious",children:"over-budget override"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[e.jsx(I,{label:"Up-hours today",value:a.upHoursToday.toFixed(2)}),e.jsx(I,{label:"Cost today",value:`$${a.costTodayUsd.toFixed(2)}`}),e.jsx(I,{label:"Projected /mo",value:`$${a.projectedMonthlyUsd.toLocaleStr
1ing()}`}),e.jsx(I,{label:"Rate",value:`$${a.hourlyUsd.toFixed(2)}/hr`})]}),e.jsxs("div",{className:"rounded border border-border-subtle p-3 text-sm",children:[e.jsx("div",{className:"mb-1 text-xs uppercase text-text-muted",children:"Detonation demand (drives lifecycle)"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[e.jsxs("span",{className:"text-text-secondary",children:["mobile-app queued: ",e.jsx("span",{className:"font-mono text-text-primary",children:a.demand.androidQueued})]}),e.jsxs("span",{className:"text-text-secondary",children:["mobile-app running: ",e.jsx("span",{className:"font-mono text-text-primary",children:a.demand.androidRunning})]}),e.jsxs("span",{className:"text-text-secondary",children:["binary queued: ",e.jsx("span",{className:"font-mono text-text-primary",children:a.demand.binaryQueued})]}),e.jsxs("span",{className:"text-text-secondary",children:["binary running: ",e.jsx("span",{className:"font-mono text-text-primary",children:a.demand.binaryRunning})]})]})]}),e.jsxs("div",{className:"text-xs text-text-muted",children:["Pay-per-use: cost accrues only while the box is running (~$",a.hourlyUsd.toFixed(2),"/hr, c5.metal). Last start ",u(a.lastStartAt)," · last stop ",u(a.lastStopAt)," · updated ",u(a.updatedAt),"."]})]})]})}function X(){const[a,l]=r.useState(null),[u,v]=r.useState(null),[x,f]=r.useState(!1);r.useEffect(()=>{c.growthFunnel().then(l).catch(()=>f(!0)),c.growthSources().then(v).catch(()=>{})},[]);const o=a?[["Signups",a.signups.toLocaleString()],["Invites",a.invitesSent.toLocaleString()],["Referrals",a.referralsConverted.toLocaleString()],["Shares",a.shares.toLocaleString()],["K-factor",a.kFactor]]:[];return e.jsxs(S,{children:[e.jsx(C,{children:e.jsx(_,{children:"Growth: referrals & funnel"})}),e.jsxs(w,{className:"space-y-3",children:[x&&e.jsx("p",{className:"text-sm text-text-secondary",children:"Growth service unavailable (not deployed or unreachable)."}),a&&e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-5",children:o.map(([m,d])=>e.jsxs("div",{className:"rounded border border-border-subtle bg-bg-base/40 p-3",children:[e.jsx("div",{className:"text-xl font-bold text-text-primary",children:d}),e.jsx("div",{className:"text-micro text-text-muted",children:m})]},m))}),u&&Object.keys(u).length>0&&e.jsxs("div",{className:"text-xs text-text-muted",children:["Signup sources: ",Object.entries(u).map(([m,d])=>`${m} (${d})`).join(" · ")]})]})]})}function Y(){const[a,l]=r.useState(null),[u,v]=r.useState({}),[x,f]=r.useState(null),[o,m]=r.useState(!1),[d,N]=r.useState(!1),g=r.useCallback(()=>{f(null),c.adminGetPlatformSettings().then(n=>{l(n.settings),v(n.settings)}).catch(n=>f(P(n)))},[]);r.useEffect(()=>g(),[g]);const i=(n,U="")=>u[n]??(a==null?void 0:a[n])??U,s=(n,U)=>v(R=>({...R,[n]:U})),b=async()=>{m(!0),N(!1);try{const n=await c.adminSetPlatformSettings(u);l(n.settings),N(!0)}catch(n){f(P(n))}finally{m(!1)}};return x&&!a?e.jsx(q,{error:x,onRetry:()=>void g()}):a?e.jsxs("div",{className:"space-y-4",children:[x&&e.jsx("p",{className:"rounded border border-status-danger/30 bg-status-danger/10 p-3 text-sm text-status-danger",children:x}),e.jsx(X,{}),e.jsxs(S,{children:[e.jsx(C,{children:e.jsx(_,{children:"Quotas & rewards"})}),e.jsxs(w,{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(y,{label:"Default daily lookup quota",hint:"-1 = unlimited",children:e.jsx("input",{type:"number",value:i("default_daily_lookup_quota","100"),onChange:n=>s("default_daily_lookup_quota",n.target.value),className:j})}),e.jsx(y,{label:"Bonus lookups / unique sample",hint:"extra daily dataset lookups earned per contributed sample (not wallet credits)",children:e.jsx("input",{type:"number",value:i("reward_credits_per_unique_sample","1"),onChange:n=>s("reward_credits_per_unique_sample",n.target.value),className:j})}),e.jsx(y,{label:"Bonus lookups daily cap",children:e.jsx("input",{type:"number",value:i("reward_daily_cap","100000"),onChange:n=>s("reward_daily_cap",n.target.value),className:j})}),e.jsx(y,{label:"Rewards enabled",children:e.jsxs("select",{value:i("reward_enabled","true"),onChange:n=>s("reward_enabled",n.target.value),className:j,children:[e.jsx("option",{value:"true",children:"enabled"}),e.jsx("option",{value:"false",children:"disabled"})]})})]})]}),e.jsxs(S,{children:[e.jsx(C,{children:e.jsx(_,{children:"Credit pricing (billing)"})}),e.jsxs(w,{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(y,{label:"Private detonation (credits)",hint:"charged per authenticated private sample; blank = default 40",children:e.jsx("input",{type:"number",value:i("credit_price_detonation","40"),onChange:n=>s("credit_price_detonation",n.target.value),className:j})}),e.jsx(y,{label:"Deep URL scan (credits)",hint:"browser deep pass; fast pass is free; default 20",children:e.jsx("input",{type:"number",value:i("credit_price_deep_scan","20"),onChange:n=>
1s("credit_price_deep_scan",n.target.value),className:j})}),e.jsx(y,{label:"Interactive VM (credits / min)",hint:"default 10",children:e.jsx("input",{type:"number",value:i("credit_price_interactive_minute","10"),onChange:n=>s("credit_price_interactive_minute",n.target.value),className:j})}),e.jsx(y,{label:"Retrohunt (credits / job)",hint:"default 300",children:e.jsx("input",{type:"number",value:i("credit_price_retrohunt","300"),onChange:n=>s("credit_price_retrohunt",n.target.value),className:j})}),e.jsx(y,{label:"Livehunt (credits)",hint:"standing rule; default 100",children:e.jsx("input",{type:"number",value:i("credit_price_livehunt","100"),onChange:n=>s("credit_price_livehunt",n.target.value),className:j})}),e.jsx(y,{label:"API data-plane call (credits)",hint:"per authenticated API-key call; default 1",children:e.jsx("input",{type:"number",value:i("credit_price_api_call","1"),onChange:n=>s("credit_price_api_call",n.target.value),className:j})}),e.jsx(y,{label:"Free detonations / day",hint:"public/anon daily cap (free but bounded); -1 = unlimited; default 20",children:e.jsx("input",{type:"number",value:i("daily_detonation_cap","20"),onChange:n=>s("daily_detonation_cap",n.target.value),className:j})})]})]}),e.jsxs(S,{children:[e.jsx(C,{children:e.jsx(_,{children:"Access & safety"})}),e.jsxs(w,{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(y,{label:"Self-serve registration",children:e.jsxs("select",{value:i("registration_open","true"),onChange:n=>s("registration_open",n.target.value),className:j,children:[e.jsx("option",{value:"true",children:"open"}),e.jsx("option",{value:"false",children:"closed"})]})}),e.jsx(y,{label:"Require platform-first for rewards",children:e.jsxs("select",{value:i("reward_require_platform_first","false"),onChange:n=>s("reward_require_platform_first",n.target.value),className:j,children:[e.jsx("option",{value:"false",children:"no"}),e.jsx("option",{value:"true",children:"yes"})]})})]})]}),e.jsxs(S,{children:[e.jsx(C,{children:e.jsx(_,{children:"Detection engine & verdict"})}),e.jsxs(w,{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(y,{label:"Verdict weights version",hint:"stamped on every verdict for reproducibility",children:e.jsx("input",{value:i("verdict_weights_version","2026-07-15"),onChange:n=>s("verdict_weights_version",n.target.value),className:j})}),e.jsx(y,{label:"Malicious threshold",hint:"score >= this => malicious (default 70)",children:e.jsx("input",{type:"number",value:i("verdict_malicious_threshold","70"),onChange:n=>s("verdict_malicious_threshold",n.target.value),className:j})}),e.jsx(y,{label:"Suspicious threshold",hint:"score >= this => suspicious (default 35)",children:e.jsx("input",{type:"number",value:i("verdict_suspicious_threshold","35"),onChange:n=>s("verdict_suspicious_threshold",n.target.value),className:j})}),e.jsx(y,{label:"Clean coverage floor",hint:"min coverage 0-1 to assert clean, else insufficient",children:e.jsx("input",{type:"number",step:"0.05",value:i("verdict_clean_coverage_floor","0.5"),onChange:n=>s("verdict_clean_coverage_floor",n.target.value),className:j})}),e.jsx(y,{label:"Disabled analyzers",hint:"comma-separated engine ids (e.g. peid,pdfid)",children:e.jsx("input",{value:i("analyzer.disabled",""),onChange:n=>s("analyzer.disabled",n.target.value),className:j})}),e.jsx(y,{label:"Active ML model version",hint:"pins the triage model (Track D)",children:e.jsx("input",{value:i("ml.activeModelVersion",""),onChange:n=>s("ml.activeModelVersion",n.target.value),className:j})})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(h,{loading:o,onClick:()=>void b(),children:"Save configuration"}),d&&e.jsx("span",{className:"text-sm text-verdict-clean",children:"Saved. Effective within ~30s."})]})]}):e.jsx(A,{className:"h-40"})}function y({label:a,hint:l,children:u}){return e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-sm text-text-secondary",children:a}),l&&e.jsx("span",{className:"ml-2 text-xs text-text-muted",children:l}),e.jsx("div",{className:"mt-1",children:u})]})}function q({error:a,onRetry:l}){return e.jsxs("div",{role:"alert",className:"space-y-3 rounded border border-status-danger/30 bg-status-danger/10 p-4 text-sm text-status-danger",children:[e.jsx("p",{children:a}),l&&e.jsx(h,{variant:"secondary",size:"sm",onClick:l,children:"Try again"})]})}function I({label:a,value:l,hint:u}){return e.jsx(S,{children:e.jsxs(w,{className:"py-4",children:[e.jsx("div",{className:"text-xs uppercase text-text-muted",children:a}),e.jsx("div",{className:"mt-1 text-xl font-semibold text-text-primary",children:l??"n/a"}),u?e.jsx("div",{className:"mt-1 text-xs text-text-muted",children:u}):null]})})}function Z(a){const l=a.guests;return!l||l.busy===null?"not measured":l.capacity===null||!l.complete?`${l.busy} busy`:`${l.busy}/${l.capacity}`}function ee(a){const l=a.guests;if(l)return l.busy===null?"No detonation host reported occupancy":l.capacity===null||!l.complete?"Partial fleet: no total published":l.busy>l.capacity?"Reading exceeds capacity; percentage withheld":`${Math.round(l.busy/l.capacity*100)}% of measured guests`}function se(){const[a,l]=r.useState(null),[u,v]=r.useState(null),[x,f]=r.useState(null),[o,m]=r.useState(null),[d,N]=r.useState(null),g=r.useCallback(async()=>{m(null);const[s,b,n]=await Promise.allSettled([c.adminCommunityModeration(100),c.adminCommunityResearchers(),c.adminCommunityAccess({})]);s.status==="fulfilled"?l(s.value.data):(l([]),m(P(s.reason,"Could not load the moderation queue (community exchange may be disabled)."))),v(b.status==="fulfilled"?b.value.data:[]),f(n.status==="fulfilled"?n.value.data:[])},[]);r.useEffect(()=>{g()},[g]);async function i(s,b){N(s),m(null);try{await b(),await g()}catch(n){m(P(n,"Action failed"))}finally{N(null)}}return e.jsxs("div",{className:"space-y-6",children:[o&&e.jsx("div",{className:"rounded-md border border-status-danger/40 bg-status-danger/5 px-3 py-2 text-sm text-status-danger",children:o}),e.jsxs(S,{children:[e.jsx(C,{children:e.jsxs(_,{children:["Moderation queue",a?` (${a.length})`:""]})}),e.jsx(w,{children:a?a.length===0?e.jsx("div",{className:"py-6 text-center text-sm text-text-muted",children:"No contributions awaiting review."}):e.jsx("div",{className:"divide-y divide-white/5",children:a.map(s=>e.jsx("div",{className:"py-3",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text-primary",children:s.title}),e.jsx("div",{className:"truncate font-mono text-xs text-text-muted",children:s.sha256}),e.jsxs("div",{className:"mt-0.5 text-micro text-text-muted",children:[s.fileType," · owner ",s.ownerUserId," · tenant ",s.tenantId]}),s.description&&e.jsx("div",{className:"mt-1 text-xs text-text-secondary",children:s.description})]}),e.jsxs("div",{className:"flex shrink-0 gap-2",children:[e.jsx(h,{size:"sm",disabled:d===s.id,onClick:()=>void i(s.id,()=>c.adminModerate(s.id,"approve")),children:"Approve"}),e.jsx(h,{size:"sm",variant:"secondary",disabled:d===s.id,onClick:()=>void i(s.id,()=>c.adminModerate(s.id,"request-changes",{note:window.prompt("Changes requested note:")??void 0})),children:"Changes"}),e.jsx(h,{size:"sm",variant:"secondary",disabled:d===s.id,onClick:()=>void i(s.id,()=>c.adminModerate(s.id,"reject",{note:window.prompt("Rejection note:")??void 0})),children:"Reject"})]})]})},s.id))}):e.jsx(A,{className:"h-16 w-full"})})]}),e.jsxs(S,{children:[e.jsx(C,{children:e.jsx(_,{children:"Verified researchers"})}),e.jsx(w,{children:u?u.length===0?e.jsx("div",{className:"py-6 text-center text-sm text-text-muted",children:"No verified-researcher applications yet."}):e.jsx("div",{className:"divide-y divide-white/5",children:u.map(s=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text-primary",children:s.userId}),e.jsxs("div",{className:"text-micro text-text-muted",children:["status: ",s.status,s.decisionNote?` · ${s.decisionNote}`:""]}),s.statement&&e.jsx("div",{className:"mt-1 line-clamp-2 text-xs text-text-secondary",children:s.statement})]}),e.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.status!=="approved"&&e.jsx(h,{size:"sm",disabled:d===s.userId,onClick:()=>void i(s.userId,()=>c.adminResearcherDecision(s.userId,"grant")),children:"Grant"}),s.status==="pending"&&e.jsx(h,{size:"sm",variant:"secondary",disabled:d===s.userId,onClick:()=>void i(s.userId,()=>c.adminResearcherDecision(s.userId,"reject",window.prompt("Rejection note:")??void 0)),children:"Reject"}),s.status==="approved"&&e.jsx(h,{size:"sm",variant:"secondary",disabled:d===s.userId,onClick:()=>void i(s.userId,()=>c.adminResearcherDecision(s.userId,"revoke",window.prompt("Revoke reason:")??void 0)),children:"Revoke"})]})]},s.userId))}):e.jsx(A,{className:"h-16 w-full"})})]}),e.jsxs(S,{children:[e.jsx(C,{children:e.jsx(_,{children:"Abuse & suspension"})}),e.jsxs(w,{children:[e.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:e.jsx(te,{busy:!!d,onSuspend:(s,b)=>void i(s,()=>c.adminSuspendCommunity(s,b))})}),x?x.length===0?e.jsx("div",{className:"py-6 text-center text-sm text-text-muted",children:"No suspended or flagged users."}):e.jsx("div",{className:"divide-y divide-white/5",children:x.map(s=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text-primary",children:s.userId}),e.jsxs("div",{className:"text-micro text-text-muted",children:[s.suspended?e.
1jsxs("span",{className:"text-status-danger",children:["suspended",s.suspendedReason?`: ${s.suspendedReason}`:""]}):"active",s.abuseFlagged&&e.jsxs("span",{className:"ml-2 text-yellow-400",children:["flagged",s.abuseReason?`: ${s.abuseReason}`:""]})]})]}),e.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.suspended?e.jsx(h,{size:"sm",disabled:d===s.userId,onClick:()=>void i(s.userId,()=>c.adminRestoreCommunity(s.userId)),children:"Restore"}):e.jsx(h,{size:"sm",variant:"secondary",disabled:d===s.userId,onClick:()=>void i(s.userId,()=>c.adminSuspendCommunity(s.userId,window.prompt("Suspend reason:")??"admin suspension")),children:"Suspend"}),s.abuseFlagged&&e.jsx(h,{size:"sm",variant:"ghost",disabled:d===s.userId,onClick:()=>void i(s.userId,()=>c.adminClearCommunityFlag(s.userId)),children:"Clear flag"})]})]},s.userId))}):e.jsx(A,{className:"h-16 w-full"})]})]})]})}function te({busy:a,onSuspend:l}){const[u,v]=r.useState(""),[x,f]=r.useState("");return e.jsxs(e.Fragment,{children:[e.jsx("input",{className:j+" w-48",value:u,onChange:o=>v(o.target.value),placeholder:"user id to suspend"}),e.jsx("input",{className:j+" w-56",value:x,onChange:o=>f(o.target.value),placeholder:"reason"}),e.jsx(h,{size:"sm",variant:"secondary",disabled:a||!u.trim(),onClick:()=>{l(u.trim(),x.trim()||"admin suspension"),v(""),f("")},children:"Suspend"})]})}export{ne as AdminOpsPage}; 2//# sourceMappingURL=AdminOpsPage-CCoGbbZ9.js.map
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.